Having .eslintrc in the root dir causes eslint tests to fail
See original GitHub issueWhat version of ESLint are you using?
2.10.2
What did you do?
I cloned the eslint
repo and ran tests.
What did you expect to happen?
No errors.
What actually happened?
A few errors (about 70 or so).
I think I might be the only one that has such a troubling configuration, because I’ve already created a few PRs to other quite popular repos, which added "root": true
to the .eslintrc
config file.
The problem is this: I have a “global” .eslintrc
file that sits in the root dir. So every project that uses eslint
and doesn’t have "root": true
set is also using my “global” config. It turns out that eslint
itself has this problem, or rather eslint
tests 😄
Changing the name of my “global” config file to something random solved the problem (all tests passed).
The simplest way to reproduce this is to create an .eslintrc
file in the root dir with this content:
{
"env": {
"es6": true
}
}
For me this caused 13 errors to emerge, for example:
1) Config findLocalConfigFiles() should return an empty array when an .eslintrc file is not found:
AssertionError: expected [ 'D:\\.eslintrc' ] to have a length of 0 but got 1
and
6) Config getConfig() should merge configs when local .eslintrc overrides parent .eslintrc:
AssertionError: expected { es6: true, node: true } to deeply equal { node: true }
+ expected - actual
{
- "es6": true
"node": true
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:23 (23 by maintainers)
Top GitHub Comments
So far https://github.com/tschaub/mock-fs looks promising as we can fake the directory structure rather than using the real directory structure. Really this would cutout a lot of our real fixtures in the future. We dont need to make physical files.
@gyandeeps Tried it right now and it worked (so Windows is ok with the changes). Great work!