-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-unused-vars] false positive when a type is used in a generic position on a method in a class with emitDecoratorMetadata: true
#2972
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
Comments
Same issue here: "@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1" |
@Brooooooklyn - not to be rude - but that's a pretty useless comment as it doesn't add anything to this issue. All it does is create noise. If you're able to repro it yourself - follow my previous comment: please provide a repro repo so that we can look into it. |
@bradzacher here is a repo to reproduce.
|
@bradzacher Maybe some effects of the TS version? I apologize, but when testing version 4.14.1, I mistakenly reported that TS 4.0.5 was used, but in reality, it was 4.1.3. Version 4.1.3 is also used in the repro @chunghha mentioned above.
No, I used version 4.14.1. |
@chunghha My case is very similar, but it's not actually in the public repo, so I think your repro is enough for the problem reproduction at this moment. If it would be necessary, I can create a simple public demo of it also. |
Can confirm that the issue is still there. Use https://github.com/vladimiry/ElectronMail/tree/wip to repro if needed ( |
Cool! With @chunghha's repro case I'm able to reproduce this now. The issue is only occurring for users that are using type-aware linting AND are using This highlights the value of providing as much detail as possible in the initial post and in follow up comments. The more information you can give when you file an issue - the more likely it is that the maintainer can look into it sooner. The OP contained minimal information - two one-line code fragments, and that was it. If they had provided their configs (ESLint and TS), then I wouldn't have had to wait for others to provide a repro. Never be afraid to dump as much info as you have. All of it. Just dump it. |
…ator metadata is enabled Fixes #2972
@bradzacher You are right on 100%. The same arguments I am using in other projects. 👍 But you know, the one thing is what you know, and the other is to keep it on 100% on each step. So, thank you for your patience to all of you. |
@bradzacher , thanks for the update. Just tested setting the Cheers and thanks for the prompt replies. |
emitDecoratorMetadata: true
This has been fixed in #2975. If you need it ASAP, it has also been released to the $ npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary
# or
$ yarn add @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary |
4.14.2-alpha.1 appears to be working. Thanks. |
The final version of 4.14.2 works as expected. Thanks. |
We have still the same issue in our Angular project.
IsMobile, DialogsService, UiState and WindowRef are reported as |
@kmaraz @vegerot As explained above, there are several scenarios and conditions under which your problem can persist. So it's crucial to have a simple reproduction project to demonstrate the concrete case 100%. It really helps a lot and also allows eliminating the problem as fast as possible. So invest the necessary time to create it. Thanks. With such info, this closed issue should be re-open or a new one created. |
@kmaraz thanks for taking care of this for us ❤️ |
@mlc-mlapis sorry for not having a repo. Here it is: https://github.com/kmaraz/no-unused-vars-issue |
@kmaraz Can you confirm that your case didn't have a problem with version 4.13.0? |
@mlc-mlapis Yes, I confirm. It worked. |
@bradzacher It looks like that there is one special case, where The showed repro has been working correctly in 4.13.0. |
Please open a new issue. |
New issue: #2994 |
This comment has been minimized.
This comment has been minimized.
no - you just have misconfigured. |
@bradzacher I was wondering if you knew if my issue I describe here (vuejs/vue-cli#3145) is from a bug in vue or a bug in consistent-type-imports. Appreciate the assistance, thanks |
please file a new issue, as it is unrelated to this closed issue |
The problem reported in #2947 has not been solved by #2943. It remains the same as before.
Repro
If
AppState
is imported:and later used only in a constructor, like:
then the warning appears in many places (in relation to the
import {AppState} from '@m-kbase/shared/general/states';
line):warning 'AppState' is defined but never used @typescript-eslint/no-unused-vars
Expected Result
The same result as with the previous version 4.13.0 or earlier, with no warnings.
Versions
@typescript-eslint/eslint-plugin
4.14.1
@typescript-eslint/parser
4.14.1
TypeScript
4.1.3
ESLint
7.18.0
node
12.13.1
The text was updated successfully, but these errors were encountered: