-
Notifications
You must be signed in to change notification settings - Fork 12.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
Unused underscore variables not being ignored by lint rules #19614
Comments
Underscores may be used to indicate unused parameters. A local variable such as |
Originally noticed this on this variable: Let me see if I can make a self-contained repro. |
|
Repro: _someFunction() { tsc --noUnusedLocals test.ts |
In our particular case these variables are read by the html page. |
We don't support underscore ignores for private fields, only for parameters. Maybe you could use |
My use case for this is array destructing. I have a function that returns a "tuple" (an array like |
@nikklassen you can use a leading const [ , bar ] = func(); |
This warning
Would be more useful than the one I was getting in version 2.6.1
Because it is a new check I was searching for quite a while to figure this out, seeing the variable was being used (written to) in the ts. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: 2.7.0-dev.20171031, 2.6.1 (Regression from 2.5.3)
Expected behavior:
Variables with names that begin with an underscore do not cause an error if not used.
Actual behavior:
components/panel/panel.ts(22,11): error TS6133: '_someVariable' is declared but its value is never read.
The text was updated successfully, but these errors were encountered: