Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

eslint ignores variables named `status`

See original GitHub issue

Can you reproduce the problem with latest npm?

yes. npm version: 4.1.1


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


Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): 0.9.0
  2. node -v: v7.7.1
  3. npm -v: 4.4.1

Then, specify:

  1. Operating system: Linux, Deepin
  2. 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:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

gaearoncommented, Mar 15, 2017

It’s still confusing and IMO we should forbid implicit window properties without window. qualifier.

gaearoncommented, May 16, 2017

Please help beta test the new version that includes this change!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found