Cannot override rule in shared config
See original GitHub issueESLint v1.6.0
In my .eslintrc, I’m extending the AirBnb config and overriding a rule like this:
{
"extends": "airbnb",
"rules": {
"indent": 2
}
}
I couldn’t find an example elsewhere, but eslint-config-airbnb v0.1.0 is overriding a rule the same way in its .eslintrc file so I assume what I have is correct. However, I’m seeing the following output when I run eslint scripts/**
:
C:\dev\my-project\scripts\index.js
2:5 error Expected indentation of 2 space characters but found 4 indent
2:5 warning Unexpected console statement no-console
✖ 2 problems (1 error, 1 warning)
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
How to adjust (not 100% override) existing eslint rule's ...
I would like to slightly adjust the import/no-extraneous-dependencies rule which is already configured with airbnb config. I am interested in ...
Read more >Action overrides in rule groups - AWS WAF ...
Overriding the actions for a rule group inside your web ACL configuration doesn't alter the rule group itself. It only alters how AWS...
Read more >GitLab CI/CD include examples
This method is called merging. Override included configuration arrays. You can use merging to extend and override configuration in an included template, but...
Read more >Overriding the default Palo Alto Policies - YouTube
There are a few default policies in the Palo Alto that cannot be modified, however they can be overridden. Here we discuss why...
Read more >Data Loss Prevention policy reference
DLP policy component and configuration reference. ... Rule 1: blocks activity and doesn't allow user override; Rule 2: blocks activity and ...
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
This behavior still seems confusing to me, and (as far as I understand it) makes it impossible to override certain rule options (see #6144). Also, @nzakas, I don’t see anywhere in the docs where it explains that rule options will be inherited from extended configs, just that rules can be overridden in the child configs. I was lead to believe that if you specified a rule in a child config, it would completely negate any rules of the same name in extended configs, resorting back to that rule’s default options if none are specified.
@ilyavolodin Sure, sorry. The code is simply:
The documentation for the indent rule (http://eslint.org/docs/rules/indent.html) says the default is 4 spaces and gives the example
"indent": 2
for 4-space indentation, so I expected that overriding any extended configs using that configuration for the indent rule would make eslint pass for any files using 4-space indentation.I’ve changed my .eslintrc to the following, specifying a number of spaces, and it works now:
Perhaps the default space setting for indentation is overridden elsewhere and I’m not aware of it or haven’t found it.