eslint ignores variables named `status`
See original GitHub issueCan you reproduce the problem with latest npm?
yes. npm version: 4.1.1
Description
Linter ignores status
variable name when checking for unused vars.
Not sure if this is a bug or expected behaviour.
Expected behavior
It should probably warn when I have not declared a variable named status
and have this line of code:
console.log(status)
Actual behavior
Even though I have not declared any variable named status
,
using it does not show any warning or errors.
it shows no-undef
error on all other variables names like statuss
as expected
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): 0.9.0node -v
: v7.7.1npm -v
: 4.4.1
Then, specify:
- Operating system: Linux, Deepin
- Browser and version: any
Reproducible Demo
create a new app with:
create-react-app test-app
In index.js type: console.log(status)
It won’t show any error that status is not defined but changing the variable name to statuss
would show error as expected
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
no-unused-vars - ESLint - Pluggable JavaScript Linter
This rule is aimed at eliminating unused variables, functions, and function parameters. ... For example, variables whose names contain ignored or Ignored ....
Read more >no-undef - ESLint - Pluggable JavaScript Linter
This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for ...
Read more >Rules - ESLint - Pluggable JavaScript Linter
no-constant-condition ... Disallow the use of undeclared variables unless mentioned in `/*global */` ... Disallow labels that share a name with a variable....
Read more >camelcase - ESLint - Pluggable JavaScript Linter
It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable...
Read more >Working with Rules - ESLint - Pluggable JavaScript Linter
markVariableAsUsed(name) - marks a variable with the given name in the current ... without updating references that makes them incorrect (they are ignored)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s still confusing and IMO we should forbid implicit
window
properties withoutwindow.
qualifier.Please help beta test the new version that includes this change! https://github.com/facebookincubator/create-react-app/issues/2172