question-mark
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.

Stricter `no-undef` default

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.0.0-alpha
  • Node Version: 10.0.0-pre
  • npm Version: 5.6

What parser (default, Babel-ESLint, etc.) are you using?

Default

Please show your full configuration:

no-undef: error

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

if (typeof undef === 'string') {
  throw new Error('foobar')
}

What did you expect to happen?

An error should be reported. This is possible by using the typeof option. I personally feel this option should be activated by default as I do not see a reason why it such statements are not validated by default.

What actually happened? Please include the actual, raw output from ESLint.

No error is reported by default.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
platinumazurecommented, Jun 21, 2018

I’m mildly opposed to making a breaking change here because of the fact that this is behaving like the language spec, and we do have the option available. I’m not convinced that there is much benefit to making the breaking change.

0reactions
btmillscommented, Apr 11, 2021

Thanks all for the discussion on this. Since we have split opinions on this issue and there hasn’t been any further discussion in almost 3 years, I’ll close this instead of bumping it again to another release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

D81678 Introduce noundef attribute at call sites for ... - LLVM
This change adds a new IR noundef attribute, which denotes when a function call argument or return val may never contain uninitialized bits....
Read more >
[PATCH] D81678: Introduce noundef attribute at call sites for stricter ...
In any case, I'd recommend changing this patch to default > `-disable-noundef-analysis` to true (so you need to compile with > `-disable-noundef-analysis=0` ...
Read more >
Fixing 'define' is not defined no-undef in react create app third ...
You can add the following to the tsconfig.json file at the root level of your project folder: {"skipLibCheck": true,}.
Read more >
How To Customize ESLint Rules with an Ejected Create React ...
Let's use Create React App to quickly set up a React project. ... Since their rules are a little strict to start with,...
Read more >
eslint-config-torchbox - npm
Start using eslint-config-torchbox in your project by running `npm i eslint-config-torchbox`. There are no other projects in the npm registry using ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found