Skip to content

Commit a354c84

Browse files
committed
fix(linter/no-this-alias): update NoThisAliasConfig default config
1 parent f7a5686 commit a354c84

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/oxc_linter/src/rules/typescript/no_this_alias.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ fn no_this_destructure_diagnostic(span: Span) -> OxcDiagnostic {
3131
#[derive(Debug, Default, Clone)]
3232
pub struct NoThisAlias(Box<NoThisAliasConfig>);
3333

34-
#[derive(Debug, Default, Clone)]
34+
#[derive(Debug, Clone)]
3535
pub struct NoThisAliasConfig {
3636
allow_destructuring: bool,
3737
allow_names: FxHashSet<CompactStr>,
3838
}
3939

40+
impl Default for NoThisAliasConfig {
41+
fn default() -> Self {
42+
Self { allow_destructuring: true, allow_names: FxHashSet::default() }
43+
}
44+
}
45+
4046
impl std::ops::Deref for NoThisAlias {
4147
type Target = NoThisAliasConfig;
4248

@@ -81,7 +87,7 @@ impl Rule for NoThisAlias {
8187
allow_destructuring: obj
8288
.and_then(|v| v.get("allowDestructuring"))
8389
.and_then(Value::as_bool)
84-
.unwrap_or_default(),
90+
.unwrap_or(true),
8591
allow_names: allowed_names,
8692
}))
8793
}

0 commit comments

Comments
 (0)