Can't overwrite "strict" rule
See original GitHub issueI have the following files:
// foo.js
function foo() {
return 42;
}
foo();
---
extends: airbnb/base
rules:
strict: [2, "global"]
Running eslint foo.js
returns successfully, even though foo.js
has no "use strict";
directive. If I change to extends: eslint:recommended
, it complains because of the lack of "use strict";
(as expected).
I tried to overwrite another rule, so I changed the files to:
// foo.js
function foo() {
return 42;
}
// Remove the call to foo();
// foo();
---
extends: airbnb/base
rules:
no-unused-vars: 0
And it worked. I was able to overwrite no-unused-vars
.
I’m running eslint@1.10.3
and eslint-config-airbnb@5.0.0
with Node v5.5.0 and npm v3.6.0.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7
Top Results From Across the Web
Turning off Strict Mode in Angular? - Stack Overflow
Following Angular doc, the strict mode can be disabled turning off these flags on tsconfig.json file:
Read more >12 Rules of Overriding in Java You Should Know
Rule #1:Only inherited methods can be overridden. Because overriding happens when a subclass re-implements a method inherited from a superclass, ...
Read more >Strict mode - JavaScript - MDN Web Docs
Strict mode makes several changes to normal JavaScript semantics: Eliminates some JavaScript silent errors by changing them to throw errors.
Read more >Preset security policies - Office 365 - Microsoft Learn
Rules : Separate rules for the Standard preset security policy, the Strict preset security policy, and the Built-in protection preset security ...
Read more >How to Deal With Strict Parents as a Teenager
Discover the six effective ways for teenagers to deal with overly strict parents. The best way to stop harsh parents from ruining your...
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
Sorry for this way to late reply 😦
The problem I had was to force the use of
"use strict";
using the"strict": [2, "global"]
rule. This did not have any effect and ESLint said that"use strict";
was not necessary when using ES6 modules.However this was in a Node.js project and my models are not ES6 modules and I wanted them all to have strict mode enabled and I was able to force it by setting
"sourceType": "script"
inparserOptions
like this:@Starefossen you’re solution works. I had the exact same use case for linting an AWS Lambda project. Thanks!