Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

4.0: 'no-unused-variable is deprecated....' message when using "extends": "tslint:recommended" #1748

Closed
locobert opened this issue Nov 19, 2016 · 12 comments · Fixed by #1754
Closed

Comments

@locobert
Copy link

When using TSLint 4.0 with a rule set that "extends": "tslint:recommended", the following deprecation message is always shown

no-unused-variable is deprecated. Use the compiler options --noUnusedParameters and --noUnusedLocals instead.

Removing the rule from node_modules/tslint/lib/configs/recommended.js (where it is set to false) fixes it

@devoto13
Copy link
Contributor

devoto13 commented Nov 19, 2016

If we need to have this warning, can we at least show it ONLY, when rule is enabled. It is pretty inconvenient to copy whole config file to get rid of it.

Never mind. It won't work as everybody will get recommended config, where it is disabled.

@yvo-niedrich
Copy link

The notice should be suppressed, once the rule is actively disabled in the config:

{
    "extends": "tslint:latest",
    "rules": {
        "no-unused-variable": false
    }
}

Right now, the notice still appears (and doesn't fair well with some JetBrains-IDEs).

@locobert
Copy link
Author

locobert commented Nov 19, 2016

@Ungolianth not for me: as long as the rule is mentioned (including as "no-unused-variable": false, in tslint/lib/configs/recommended.js, which is also used in latest), the warning appears

Edit: I've read your post as a 'I think that works' vs 'I think this is how it should work': in the latter case, I wholeheartedly agree (and it would be helpful to include a hint in the warning message itself or at least in the blog post)

@yvo-niedrich
Copy link

yvo-niedrich commented Nov 19, 2016

@locobert yes, it was meant to be "It should work like this, but right now it does not".

Modifying node_modules/tslint/lib/configs/recommended.js cannot be the ultimate solution, until "no-unused-variable" is removed officially from tslint:recommended, as your changes are overwritten with every (minor) update of tslint...
And the packages behavior will not be consistent for your team members.

@locobert
Copy link
Author

:) Yes, modifying node_modules/tslint/lib/configs/recommended.js was not meant as a solution or even workaround, it was meant to indicate the source of the problem

@adidahiya
Copy link
Contributor

sorry about that, v4.0.1 should have the fix

@e-cloud
Copy link

e-cloud commented Nov 24, 2016

It also prevent the tslint service in webstorm from working.
image

@yvo-niedrich
Copy link

yvo-niedrich commented Nov 24, 2016

Did you update your tslint package?

All JetBrains IDEs show this behaviour (I use PHPStorm and IntelliJ), as they cannot map the deprecated message to a specific file. Removing the no-unused-variable rule from your project now (v4.0.1) also fixes your IDE.

@e-cloud
Copy link

e-cloud commented Nov 24, 2016

In fact, i prefer to turn on this rule because it can't be disabled for some code with common tag, which the tsc can't achieve for now.

@adidahiya
Copy link
Contributor

@e-cloud what do you mean by "common tag" here? With tsc, you can opt out of noUnused... checking by prefixing variable or parameter identifiers with underscore, e.g. _unusedVar

@e-cloud
Copy link

e-cloud commented Nov 25, 2016

sorry, typo. I mean use tslint comment flag to disable something.

@nomaed
Copy link
Contributor

nomaed commented Jan 1, 2017

The problem with using the flag in tsc is that it causes an error during build, while the tslint rules is more configurable and can be used to produce warnings only.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants