Skip to content

Commit c8c150e

Browse files
committed
Fix last remaining test issues
1 parent 0c9bd8a commit c8c150e

9 files changed

Lines changed: 12 additions & 19 deletions

File tree

packages/swc-plugin/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl CompiledTransform {
415415

416416
// Check what types of React imports already exist
417417
let mut has_react_namespace_or_default = false;
418-
let mut has_react_named_imports = false;
418+
let mut _has_react_named_imports = false;
419419
let mut has_forwardref_import = false;
420420

421421
for item in &module.body {
@@ -427,7 +427,7 @@ impl CompiledTransform {
427427
has_react_namespace_or_default = true;
428428
}
429429
ImportSpecifier::Named(named) => {
430-
has_react_named_imports = true;
430+
_has_react_named_imports = true;
431431
if named.local.sym.as_ref() == "forwardRef" {
432432
has_forwardref_import = true;
433433
}

packages/swc-plugin/src/utils/module_resolver.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl ModuleResolver {
133133
/// # Examples
134134
///
135135
/// ```rust
136+
/// use compiled_swc::utils::module_resolver::ModuleResolver;
136137
/// let resolver = ModuleResolver::new("src/components");
137138
/// // Relative imports like "./colors" will be resolved as "src/components/colors"
138139
/// ```
@@ -161,6 +162,7 @@ impl ModuleResolver {
161162
/// # Examples
162163
///
163164
/// ```rust
165+
/// use compiled_swc::utils::module_resolver::ModuleResolver;
164166
/// let mut resolver = ModuleResolver::new("src");
165167
///
166168
/// // Resolve a relative import
@@ -409,6 +411,7 @@ impl ModuleResolver {
409411
/// # Examples
410412
///
411413
/// ```rust
414+
/// use compiled_swc::utils::module_resolver::{ModuleResolver, ExportValue};
412415
/// let mut resolver = ModuleResolver::new("src");
413416
///
414417
/// // Get a named export: export const primaryColor = "red"
@@ -445,6 +448,7 @@ impl ModuleResolver {
445448
/// # Examples
446449
///
447450
/// ```rust
451+
/// use compiled_swc::utils::module_resolver::{ModuleResolver, ExportValue};
448452
/// let mut resolver = ModuleResolver::new("src");
449453
///
450454
/// // Get default export: export default { theme: "dark" }

packages/swc-plugin/src/utils/variable_context.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ pub fn build_variable_context_from_module_with_mutations(module: &Module, mutate
4747
context
4848
}
4949

50-
/// Extract variable declarations from a statement
51-
fn extract_variable_declarations_from_stmt(stmt: &ModuleItem, context: &mut VariableContext) {
52-
extract_variable_declarations_from_stmt_with_mutations(stmt, context, &std::collections::HashSet::new())
53-
}
54-
5550
/// Extract variable declarations from a statement, excluding mutated variables
5651
fn extract_variable_declarations_from_stmt_with_mutations(stmt: &ModuleItem, context: &mut VariableContext, mutated_variables: &std::collections::HashSet<String>) {
5752
match stmt {
@@ -62,11 +57,6 @@ fn extract_variable_declarations_from_stmt_with_mutations(stmt: &ModuleItem, con
6257
}
6358
}
6459

65-
/// Extract variable declarations from a statement (inner)
66-
fn extract_variable_declarations_from_stmt_inner(stmt: &Stmt, context: &mut VariableContext) {
67-
extract_variable_declarations_from_stmt_inner_with_mutations(stmt, context, &std::collections::HashSet::new())
68-
}
69-
7060
/// Extract variable declarations from a statement (inner), excluding mutated variables
7161
fn extract_variable_declarations_from_stmt_inner_with_mutations(stmt: &Stmt, context: &mut VariableContext, mutated_variables: &std::collections::HashSet<String>) {
7262
match stmt {
@@ -97,7 +87,6 @@ fn extract_variable_declarations_from_stmt_inner_with_mutations(stmt: &Stmt, con
9787
#[cfg(test)]
9888
mod tests {
9989
use super::*;
100-
use swc_core::ecma::ast::*;
10190
use swc_core::common::DUMMY_SP;
10291

10392
#[test]

packages/swc-plugin/tests/class_names_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
1+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes_multiple};
22

33
#[cfg(test)]
44
mod class_names_tests {

packages/swc-plugin/tests/css_map_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
1+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes_multiple};
22

33
#[cfg(test)]
44
mod css_map_tests {

packages/swc-plugin/tests/custom_import_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// exactly like the babel plugin, including @atlaskit/css automatic detection
44
// and proper error handling for misconfigured sources.
55

6-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
6+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes};
77

88
#[cfg(test)]
99
mod custom_import_tests {

packages/swc-plugin/tests/jsx_automatic_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
1+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes_multiple};
22

33
#[cfg(test)]
44
mod jsx_automatic_tests {

packages/swc-plugin/tests/keyframes_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
1+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes_multiple};
22

33
#[cfg(test)]
44
mod keyframes_tests {

packages/swc-plugin/tests/styled_components_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes, assert_includes_multiple};
1+
use compiled_swc::{test_utils::{transform_with_compiled, TestTransformOptions, TestAssertions}, assert_includes_multiple};
22

33
#[cfg(test)]
44
mod styled_components_tests {

0 commit comments

Comments
 (0)