Skip to content

Commit

Permalink
fix(ast): remove #[visit(ignore)] from `ExportDefaultDeclarationKin…
Browse files Browse the repository at this point in the history
…d`'s `TSInterfaceDeclaration` (#4497)

I can't find any reason to add `#[visit(ignore)]` there
  • Loading branch information
Dunqing committed Jul 27, 2024
1 parent f5f0ba8 commit 368112c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 0 additions & 1 deletion crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,6 @@ pub enum ExportDefaultDeclarationKind<'a> {
FunctionDeclaration(Box<'a, Function<'a>>) = 64,
ClassDeclaration(Box<'a, Class<'a>>) = 65,

#[visit(ignore)]
TSInterfaceDeclaration(Box<'a, TSInterfaceDeclaration<'a>>) = 66,

// `Expression` variants added here by `inherit_variants!` macro
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_ast/src/generated/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4154,10 +4154,12 @@ pub mod walk {
visitor.visit_function(it, flags)
}
ExportDefaultDeclarationKind::ClassDeclaration(it) => visitor.visit_class(it),
ExportDefaultDeclarationKind::TSInterfaceDeclaration(it) => {
visitor.visit_ts_interface_declaration(it)
}
match_expression!(ExportDefaultDeclarationKind) => {
visitor.visit_expression(it.to_expression())
}
_ => {}
}
}

Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_ast/src/generated/visit_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4396,10 +4396,12 @@ pub mod walk_mut {
visitor.visit_function(it, flags)
}
ExportDefaultDeclarationKind::ClassDeclaration(it) => visitor.visit_class(it),
ExportDefaultDeclarationKind::TSInterfaceDeclaration(it) => {
visitor.visit_ts_interface_declaration(it)
}
match_expression!(ExportDefaultDeclarationKind) => {
visitor.visit_expression(it.to_expression_mut())
}
_ => {}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ source: crates/oxc_linter/src/tester.rs
╰────
help: Use an `type` instead of a `interface`

typescript-eslint(consistent-type-definitions): Use an `type` instead of a `interface`
╭─[consistent_type_definitions.tsx:2:19]
1
2export default interface Test {
· ─────────
3 │ bar(): string;
╰────
help: Use an `type` instead of a `interface`

typescript-eslint(consistent-type-definitions): Use an `interface` instead of a `type`
╭─[consistent_type_definitions.tsx:2:19]
1 │
Expand Down
7 changes: 7 additions & 0 deletions crates/oxc_linter/src/snapshots/prefer_function_type.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ source: crates/oxc_linter/src/tester.rs
╰────
help: The function type form `() => string` is generally preferred when possible for being more succinct.

⚠ typescript-eslint(prefer-function-type): Enforce using function types instead of interfaces with call signatures.
╭─[prefer_function_type.tsx:1:47]
1 │ export default interface Foo { /** comment */ (): string; }
· ───────────
╰────
help: The function type form `() => string` is generally preferred when possible for being more succinct.

⚠ typescript-eslint(prefer-function-type): Enforce using function types instead of interfaces with call signatures.
╭─[prefer_function_type.tsx:4:11]
3 │ // comment
Expand Down

0 comments on commit 368112c

Please sign in to comment.