Skip to content

Commit 1e97e35

Browse files
committed
fix(linter/unicorn/prefer-structured-clone): update Default implementation for PreferStructuredCloneConfig (#12791)
1 parent d382159 commit 1e97e35

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

crates/oxc_linter/src/rules/unicorn/prefer_structured_clone.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ fn prefer_structured_clone_diagnostic(span: Span) -> OxcDiagnostic {
2525
#[derive(Debug, Default, Clone)]
2626
pub struct PreferStructuredClone(Box<PreferStructuredCloneConfig>);
2727

28-
#[derive(Debug, Default, Clone)]
28+
#[derive(Debug, Clone)]
2929
pub struct PreferStructuredCloneConfig {
3030
allowed_functions: Vec<String>,
3131
}
3232

33+
impl Default for PreferStructuredCloneConfig {
34+
fn default() -> Self {
35+
Self { allowed_functions: vec!["cloneDeep".to_string(), "utils.clone".to_string()] }
36+
}
37+
}
38+
3339
impl Deref for PreferStructuredClone {
3440
type Target = PreferStructuredCloneConfig;
3541

crates/oxc_linter/tests/rule_configuration_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn test_rule_default_matches_from_configuration_null() {
2424
// When fixing a rule, ensure that either:
2525
// 1. The Default implementation returns the same values as from_configuration(null), or
2626
// 2. The from_configuration method is updated to return Default::default() when given null
27-
let exceptions = ["unicorn/prefer-structured-clone"];
27+
let exceptions = [];
2828

2929
// Iterate through all available linter rules
3030
for rule in RULES.iter() {

0 commit comments

Comments
 (0)