diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs b/crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs index 79d6ac3688e5a..6be2debfb3758 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs @@ -25,11 +25,17 @@ fn prefer_structured_clone_diagnostic(span: Span) -> OxcDiagnostic { #[derive(Debug, Default, Clone)] pub struct PreferStructuredClone(Box); -#[derive(Debug, Default, Clone)] +#[derive(Debug, Clone)] pub struct PreferStructuredCloneConfig { allowed_functions: Vec, } +impl Default for PreferStructuredCloneConfig { + fn default() -> Self { + Self { allowed_functions: vec!["cloneDeep".to_string(), "utils.clone".to_string()] } + } +} + impl Deref for PreferStructuredClone { type Target = PreferStructuredCloneConfig; diff --git a/crates/oxc_linter/tests/rule_configuration_test.rs b/crates/oxc_linter/tests/rule_configuration_test.rs index 90547a57169ed..967a774113cd9 100644 --- a/crates/oxc_linter/tests/rule_configuration_test.rs +++ b/crates/oxc_linter/tests/rule_configuration_test.rs @@ -24,7 +24,7 @@ fn test_rule_default_matches_from_configuration_null() { // When fixing a rule, ensure that either: // 1. The Default implementation returns the same values as from_configuration(null), or // 2. The from_configuration method is updated to return Default::default() when given null - let exceptions = ["unicorn/prefer-structured-clone"]; + let exceptions = []; // Iterate through all available linter rules for rule in RULES.iter() {