-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Docs: How is @typescript-eslint/no-unused-vars
different than TypeScript’s own errors?
#4641
Comments
Unfortunately TS has no concept of a warning. Everything is an error. Typescript's compiler options create build time errors. If you use the no emit on error option then it means that having an unused local will prevent you from building. In production builds this is great and correct! But in development where it is common to have half-finished code this can be a real workflow blocker. OTOH eslint usually won't be setup to block build pipelines in dev. Which makes it much better for DevX. Additionally there options for no-unused-vars - but TS can only be on, or off. |
That makes sense, so you're saying that if I enable |
Thanks for the detailed explanation! I don’t think this has ever been a problem as unused variables can be very easily dropped, so I’ll stick to the strict TS config here. OT: I wish there was such a rule for |
Unfortunately |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
typescript seems to ignore variables starting with |
tsconfig settings: "noUnusedLocals": true, "noUnusedParameters": true, typescript-eslint/typescript-eslint#4641
Suggested Changes
Every unused variable is marked by both TypeScript and this rule. Why does it exist? It seems to be a duplicate. If it isn't a duplicate, can you explain why in the documentation?
It would also be great to include this explanation or a link to it in the documentation:
no-unused-vars
? #438Affected URL(s)
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unused-vars.md
The text was updated successfully, but these errors were encountered: