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
[naming-convention] Allow underscore prefix for unused parameters #1510
Comments
I need to figure out how to do this in a performant way. Using typescript's diagnostics would be awesome, but they're super slow - ~50ms to get the diagnostics for a file, which is too slow for linting (related: #1335). I should test tsutils's unused variables function. If that's quick, then that's a decent compromise. The only problem with both of these routes is that without #716, this would require type information. Though we're planning on starting the 3.0.0 release soon, so that isn't that far off. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hy @bradzacher I think there is nothing to work in this issue so we can close it. |
Sorry, the last few comments were unrelated to the root issue. For a bit of background; the When I wrote it, I cut some features from that rule for the purpose of keeping complexity down and cutting features until we saw how people used them. Right now you can only say "all variables can have leading underscores". |
So, I can work on it. |
This needs some exploration to find an efficient way to check if a variable is unused. You're certainly welcome to explore this if you'd like. I don't have a clear idea of how to do this in a performant manner yet. |
Once #2039 lands this should be pretty simple to do. |
@bradzacher nice, #2039 got merged 💯 |
How do we use it? I can't get this to work |
@evanjmg Use what? This hasn't been implemented yet. |
Repro
Expected Result
No error on
_id
.Actual Result
Error on
_id
.Additional Info
As mentioned here with Brad's response here.
When using the
noUnusedParameters
compiler option, you have to use an underscore to suppress TypeScript's error. However, this shouldn't be done unless the parameter is actually unused.Versions
@typescript-eslint/eslint-plugin
2.16.0
@typescript-eslint/parser
2.16.0
TypeScript
3.7.5
ESLint
6.8.0
node
12.14.1
npm
6.13.4
The text was updated successfully, but these errors were encountered: