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-unused-vars] False negative with variables matching HTML element names #2985
Comments
Here is the related code that should prevent this from happening: typescript-eslint/packages/scope-manager/src/referencer/Referencer.ts Lines 519 to 525 in 7b701a3
We have a passing test for this: typescript-eslint/packages/scope-manager/tests/fixtures/jsx/component-intrinsic-name.tsx Lines 1 to 2 in 7b701a3
and associated snapshot: typescript-eslint/packages/scope-manager/tests/fixtures/jsx/component-intrinsic-name.tsx.shot Lines 7 to 18 in 7b701a3
(there's no test for the I don't have a checkout handy so I can't look into it right now, but this shouldn't be possible. |
Very interesting! I'll have to test again... |
Ok, so I tested with the full config first (it's failing here): For this file: const a = 1;
export default function App(div: any) {
return <div />;
} It only reports the
https://github.com/karlhorky/typescript-eslint-no-unused-vars-jsx-div-repro-full-config Next I'll try to create a minimal reproduction... |
Ok, so it appears to be an issue with Sorry about taking your time here! Closing... |
Reported in |
Thanks for following up! Nice catch on the repro! Worth noting that shouldn't actually need the |
Great, glad to help! And thanks for the additional info - will disable this rule permanently in our config. |
Repro
This also happens with other variables (eg. variables declared separately):
However, the following correctly warns:
Screenshots
False Negative
Correct Warning
tsconfig.json
Expected Result
Any variables matching HTML element names should warn and error with
@typescript-eslint/no-unused-vars
Actual Result
No errors or warnings for variable names matching HTML element names.
Additional Info
Versions
@typescript-eslint/eslint-plugin
4.14.1
@typescript-eslint/parser
4.14.1
TypeScript
4.1.2
ESLint
7.18.0
node
15.5.0
The text was updated successfully, but these errors were encountered: