--print-config outputs empty config if called not from config file directory
See original GitHub issueWhat version of ESLint are you using?
2.11.1
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
e:\DOC\prg\js\node\.eslintrc.json
{
"root": true,
"extends": [
"eslint:recommended",
"airbnb-base"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "script"
},
"env": {
"browser": false,
"es6": true,
"node": true
},
"rules": {
"eqeqeq": "error",
"no-console": "off",
"no-extra-parens": ["error", "all"],
"quotes": ["error", "single"],
"spaced-comment": ["error", "always", { "exceptions": ["/", "*"] }],
"strict": ["error", "global"]
}
}
What did you do? Please include the actual source code causing the issue.
I have a simple test script in the subdirectory relative to the config directory:
e:\DOC\prg\js\node\-test\test.js
:
'use strict';
console.log(1);
eslint output (to be sure eslint really uses all the rules frome the additional configs):
e:\DOC\prg\js\node\-test>eslint test.js
E:\DOC\prg\js\node\-test\test.js
4:2 error More than 2 blank lines not allowed no-multiple-empty-lines
✖ 1 problem (1 error, 0 warnings)
I want to see all the config set via eslint --print-config test.js
.
What did you expect to happen?
All the rules from .eslintrc.json
+ eslint:recommended
+ airbnb-base
should be shown.
What actually happened? Please include the actual, raw output from ESLint.
The output is:
{
"globals": {},
"env": {},
"rules": {},
"parserOptions": {}
}
However, if I place test.js
in the same directory with .eslintrc.json
, the output is a big proper rule set.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
@platinumazure the bug depends not on path and not on relation between path and config file, but from relation between CWD and config file. If you call eslint for
subfolder/bar.js
from the same folder with config file, it is OK.@nzakas That’s what I assumed as well. However, that’s not what is happening.
eslint --print-config .
is working in the case that you have.eslintrc
in the current directory, which is strange and not what I expected. But the tests that I posted are done on the file, not on the pattern. So it seems that there might be two bugs here. First one,--print-config
on a file in the subdirectory returns an empty object. Second one,--print-config
seems to work on patterns, when it shouldn’t.