-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebreaking changeThis change will require a new major version to be releasedThis change will require a new major version to be releasedpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree
Milestone
Description
Currently we have the following AST properties declared:
modifiers?: Modifier[]; |
modifiers?: Modifier[]; |
typescript-eslint/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts
Line 14 in 8329498
implements?: TSInterfaceHeritage[]; |
typescript-eslint/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts
Line 15 in 8329498
abstract?: boolean; |
These all represent bad code that would cause errors if one attempted to build in TS:
public enum Foo {}
// 'public' modifier cannot appear on a module or namespace element.(1044)
abstract namespace Bar {}
// 'abstract' modifier can only appear on a class, method, or property declaration.(1242)
interface Baz implements Bam {}
// Interface declaration cannot have 'implements' clause.(1176)
abstract interface Bam {}
// 'abstract' modifier can only appear on a class, method, or property declaration.
TS parses these fine and emits a semantic error, not a syntactic error.
Our parser currently does not error on syntactically bad code, thus we also don't error on it (#1852).
We should remove these properties from the AST as it is non-sensical to include them - nobody should ever be inspecting the code that is produced on them.
armano2
Metadata
Metadata
Assignees
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebreaking changeThis change will require a new major version to be releasedThis change will require a new major version to be releasedpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree