Closed saifelse closed 5 years ago
@saifelse i was thinking about making this change directly in estree with additional field "abstract" set to true, to be able to detect that this is an abstract class
This issue has been migrated to the new project here: typescript-eslint/typescript-eslint#20
Thanks!
What version of TypeScript are you using? 3.1.3
What version of
typescript-eslint-parser
are you using? 21.0.2What code were you trying to parse?
What did you expect to happen? No lint errors
What happened?
While I understand that Typescript already has scope checks that seem to make no-undef unnecessary and can be disabled, it has been useful to ensure that
name
andlength
are not accidentally used, see: https://github.com/Microsoft/TypeScript/issues/18433Potential Fix 1
eslint-scope/lib/referencer.js:Referencer.visitClass adds a definition into the scope for "ClassDeclaration", which does not happen for "TSAbstractClassDeclaration". I think this can be fixed by doing:
However this then causes:
Because of this special casing of ClassDeclaration in eslint/lib/rules/no-shadow.js:
From here, I suppose you could just say that no-shadow should be disabled on typescript files, in favor of using tslint's no-shadowed-variables
Potential Fix 2
In typescript-eslint-parser/parser.js, we can simply re-map the abstract class node:
which to me seems pretty clean, since as far as eslint is concerned, the abstract keyword doesn't affect anything.