Stricter `no-undef` default
See original GitHub issueTell 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:
- Created 5 years ago
- Reactions:9
- Comments:12 (12 by maintainers)
Top 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 >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
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.
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.