eslint: if config appears in project folder, configs in home directory can't be seen totally
Tell us about your environment Linux version 3.6.32-431.11.2.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Tue Mar 25 19:59:55 UTC 2014
-
ESLint Version: v3.11.1
-
Node Version: v7.2.0
-
npm Version: 3.10.9 What parser (default, Babel-ESLint, etc.) are you using? espree Please show your full configuration:
in .eslintrc in ~/:
{
"env":{
"browser":true
,"node":true
,"es6":true
}
,"extends":"eslint:recommended"
}
-----------------------------------------------------------------------------------------------
the next cause problem(if removed works as expected):
-----------------------------------------------------------------------------------------------
in project directory:
either place the following in package.json:
eslintConfig:{}
or file .eslintrc with following content exists
{}
What did you do? Please include the actual source code causing the issue.
in app.js
const a=1;
What did you expect to happen? config cascading and hierarchy take effect.
run: eslint --print-config app.js long config list shows, with the same content with when no empty config appears in project folder;
run: eslint app.js error ‘a’ is assigned a value but never used no-unused-vars
What actually happened? Please include the actual, raw output from ESLint. run: eslint --print-config app.js { “globals”: {}, “env”: {}, “rules”: {}, “parserOptions”: {} }
run: eslint app.js error Parsing error: The keyword ‘const’ is reserved
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (10 by maintainers)
Commits related to this issue
- Docs: write about the home dir case eslint config (fixes #7729) — committed to VictorHom/eslint by VictorHom 7 years ago
- Docs: Add instruction re home-directory config files (refs #7729) (#9426) Without this, config file in home directory makes 1 test fail. — committed to eslint/eslint by jrpool 7 years ago
- Docs: Add missing info about special status of home-dir config files. (#9472) This seems to be the last step in liquidating issue #7729. — committed to eslint/eslint by jrpool 7 years ago
I think the current behavior is correct. the home directory is a special case because it can unintentionally affect a lot of projects (iirc this was an early complaint). I think changing that now would be confusing and possibly damaging to the current user base.
I’m all for updating the docs to make this special case clearer.
@ljharb I believe the accepted resolution here is to update the docs to make it clear that the home directory is a special case. I agree with others that this is too big a breaking change to introduce now.
Yes, my project is a descendant of home. now, the two rules for ‘home’ and ‘ancestor’ collide. which one to choose, and even the ‘home’ rule itself, is better to placed in the docs, in case new comers get confused. Anyway, thanks for team’s hard work!