-
Notifications
You must be signed in to change notification settings - Fork 889
Start to deprecate no-unused-variable rule #1481
Comments
A good feature here is that the compiler provides an opt-out: give a variable name a leading underscore and the compiler won't flag it. This should make it easier for people who want to enable the complier checks but may have an edge-case or two which they don't want to change. |
@jkillian That's only applicable to parameters, right? |
@glen-84 - good catch, I think you're correct. |
@adidahiya just to note that The |
@charsleysa yeah, the implementation is slightly different. I think the compiler options are better than the TSLint rule, which is why I want to favor it. As noted in the original issue post, we'll remove it slowly from TSLint core. |
Resolves #1481. Adds a `deprecationMessage` field to rule metadata.
Resolves #1481. Adds a `deprecationMessage` field to rule metadata.
Resolves #1481. Adds a `deprecationMessage` field to rule metadata.
Resolves #1481. Adds a `deprecationMessage` field to rule metadata.
I think you should remove it in version 4. There should be many preview releases where all the developers should see the deprecation warning. And you have removed other rules in favor of compiler options in anyway. PD: In dev-1 release, I think this is as a recommended settings. |
Just as a bit of feedback, I hit this issue tonight and even after finding this issue it took me a bit to understand that the |
@ryanguill thanks for the feedback. I committed a change that clarifies the message |
As discussed in feedback on palantir#1481 and palantir#1617, for many users `--noUnusedParameters` and `--noUnusedLocals` do not work as a replacement for `noUnusedVariable`. This change de-deprecates the rule and documents the alternative compiler flags (and why they might not work for users) in the description. Fixes palantir#1617.
Looks like there's a lot of interest in keeping this rule around. I went ahead and merged #2256, which un-deprecates the rule. It still won't be encouraged in the built-in configs, but it'll be available on an opt-in basis. |
Seems like if you your tsconfig has |
@ccorcos "missing import" is an entirely different error from "no unused variable". |
sounds good. im just not seeing this error in VSCode... :/ |
Hi @adidahiya , Thanks for taking this rule back. Question is, when will be released? As I can see is not yet included in 5.1.0. |
@javier-tarazaga it is there in v5, just as it's always been. it's not enabled in the |
Hi @adidahiya, Uhm weird. When I include the rule in version of tslint 5.1.0 I get the following error,
|
That's because you used the wrong file name. It's no-unused-variable, not
no-unused-vars
Am 02.05.2017 09:33 schrieb "Javier Tarazaga" <notifications@github.com>:
… Hi @adidahiya <https://github.com/adidahiya>,
Uhm weird. When I include the rule in version of tslint 5.1.0 I get the
following error,
Could not find implementations for the following rules specified in the configuration:
no-unused-vars
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1481 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALaeKKYydi8vQ8MAhxOwBk3uL02jgzKNks5r1txLgaJpZM4JjuQh>
.
|
Thanks for the heads up! Now I am facing #2650 so I cannot really verify it. |
I installed https://github.com/blakeembrey/tslint-config-standard
|
@quantuminformation Have you tried using |
Yeah that works thx |
🤖 Beep boop! 👉 TSLint is deprecated 👈 and you should switch to typescript-eslint! 🤖 🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋 |
I just noticed these new compiler checks in v2.0:
--noUnusedParameters
and--noUnusedLocals
. These essentially make theno-unused-variable
rule obsolete. Since it's a very core rule, I don't think we should remove it right away.Proposal:
no-unused-variable
fromtslint:latest
&tslint:recommended
in v4.0remove the rule implementation completely in TSLint v5.0The text was updated successfully, but these errors were encountered: