Create no-global-assign rule
See original GitHub issueWhat version are you using?
2.2.0
What did you do?
I have the file test.js
:
/*global a:false */
a = 5;
I have the configuration .eslintrc.yaml
:
root: true
rules:
no-undef: 2
I linted the file with the command-line argument eslint test.js
.
What happened?
It did not report any errors.
What did you expect to happen?
I expect it to warn me that I am assigning to a global variable with the false
flag, as described in the documentation.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:17 (16 by maintainers)
Top Results From Across the Web
Eslint Error while working with Trails js - Stack Overflow
1 Answer 1 ... The no-global-assign rule was added in ESLint 3.3.0. You need to use that version or later, if you want...
Read more >no-undef - ESLint - Pluggable JavaScript Linter
This rule can help you locate potential ReferenceErrors resulting from misspellings ... See no-global-assign if you also want to disallow those assignments.
Read more >How to benchmark ESLint rules - JavaScript in Plain English
The performance of ESLint rules can be benchmarked by setting the environment variable TIMING=1. ... no-global-assign | 0.630 | 0.4%
Read more >List of available rules - ESLint - Pluggable JavaScript linter
No rules are enabled by default. ... Possible Errors. These rules relate to possible syntax or logic errors in JavaScript code: ... no-global-assign....
Read more >Rules - JavaScript Standard Style
This is a summary of the standard JavaScript rules. The best way to ... Declare browser globals with a /* global */ comment....
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
Ok, yeah, I think we can mark this as JSHint compat though, no? And I won’t work on this until JSCS compat is done, but I would like to champion this, so when it gets 3 thumbs, I can assign it to myself?
ok, I’ll champion this. Important to maintain feature parity with JSHint here. I recommend:
\* global var:true *\
annotation as exceptions to this rule.\* global var:false *\
as that only applies tono-undef
.no-global-assign
.Given 2 & 4, a dev coming from JSHint SHOULD convert
\* global var: true *\
to// eslint no-global-assign ["error", ["var"]] *\
, but isn’t absolutely required to do so.