Skip to content

Commit 387762d

Browse files
committed
refactor(linter/no-unused-vars): simplify check for export nodes (#12044)
This PR is a follow-up to #12022 This method checks whether a symbol has been exported, and only `ExportNamedDeclaration` and `ExportDefaultDeclaration` can produce a Symbol, so the `module.is_export()` is unnecessary.
1 parent 07e14a4 commit 387762d

File tree

1 file changed

+2
-2
lines changed
  • crates/oxc_linter/src/rules/eslint/no_unused_vars

1 file changed

+2
-2
lines changed

crates/oxc_linter/src/rules/eslint/no_unused_vars/symbol.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ impl<'a> Symbol<'_, 'a> {
186186
fn in_export_node(&self) -> bool {
187187
for parent in self.nodes().ancestors(self.declaration_id()).skip(1) {
188188
match parent.kind() {
189-
m if m.is_module_declaration() => {
190-
return m.as_module_declaration_kind().unwrap().is_export();
189+
AstKind::ExportNamedDeclaration(_) | AstKind::ExportDefaultDeclaration(_) => {
190+
return true;
191191
}
192192
AstKind::VariableDeclaration(_)
193193
| AstKind::ArrayExpression(_)

0 commit comments

Comments
 (0)