New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[no-undef] Linter does not report error when using undefined variables. #662
Comments
We suggest turning off |
I'm not sure I follow -- by "it" do you mean the typescript eslint plugin? To elaborate I expect that this feature would be implemented as a new rule (such as Thanks! |
Our parser is only a parser. It leverages the typescript compiler to parse and generate an AST, and provide type information. However we don't currently have have access to the diagnostics typescript provides, nor can we access things like its scope analyser. As it stands right now the rule maintains its own logic for analysing scope, which has no idea about typescript type scope. If you're looking for a way to have typescript compiler error TS2304 reported, the best way is via running the typescript compiler.. |
For what it’s worth, we turned no-undef off and just let tsc report this at my last job and it was never an issue. Most popular editors are able to report errors reported by tsc, and we would run |
That was the implication of the first comment. Considering this rule's functionality is completely covered by the typescript compiler, rewriting the rule to work properly is low on the list of priorities... |
Got it -- thanks for the clear explanation! I'll look into using the typescript compiler to catch these types of issues. |
Merging into #1856 |
Repro
package.json
src/test.d.ts
ORsrc/test.ts
Expected Result
A
no-undef
rule error is reported becauseUndefinedClass
is being used but has not been defined.Actual Result
No errors are reported.
Additional Info
The error is correctly reported when doing the equivalent in a js file.
Versions
@typescript-eslint/eslint-plugin
1.11.0
@typescript-eslint/parser
1.11.0
TypeScript
3.5.2
ESLint
6.0.1
node
12.4.0
npm
6.9.0
The text was updated successfully, but these errors were encountered: