Files to be ignored depend on working directory
See original GitHub issueI’ve created a minimal reproduction repo here: https://github.com/paleite/eslintignore-bug
Tell us about your environment
Node version: v14.16.1 npm version: v7.12.1 Local ESLint version: v7.30.0 (Currently used) Global ESLint version: Not found Operating System: darwin 20.5.0
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
default
Please show your full configuration:
Configuration
console.log(`Loaded .eslintrc from the root folder. CWD is ${process.cwd()}`);
module.exports = {
env: { es6: true, jest: true, node: true },
extends: "eslint:recommended",
root: true,
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
When running eslint with the same ignore-file from different paths, I expected the ignorefile to behave the same way, but got different results. I used 2 commands:
eslint --config $(git rev-parse --show-toplevel)/.eslintrc.js --ignore-path $(git rev-parse --show-toplevel)/.list-of-ignored-files package-a/
and
cd package-a/ && eslint --config $(git rev-parse --show-toplevel)/.eslintrc.js --ignore-path $(git rev-parse --show-toplevel)/.list-of-ignored-files .
What did you expect to happen?
I expected both commands to have the same result
What actually happened? Please copy-paste the actual, raw output from ESLint.
I got different results
Steps to reproduce this issue:
I’ve created a minimal reproduction repo here: https://github.com/paleite/eslintignore-bug The steps (as detailed in the README.md in that repo) are as follows:
npm install # Install modules
npm run lint-absolute # Starts ESLint from the git root folder and uses the ignore-file from the git root folder
npm run lint-relative # Starts ESLint from a subfolder and uses the ignore-file from the git root folder
Are you willing to submit a pull request to fix this bug?
Yes.
Hopefully this is a good candidate for a new contributor.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (11 by maintainers)
Top GitHub Comments
Thanks for all the research and the repo case. Given that we wanted to fix this earlier, it seems like a good idea to revisit.
I think we once again need to decide if this is a breaking change or not. Given how long the behavior has been this way, I’m leaning towards it being a breaking change but I’d like to hear what others think.
Given the tie-in with eslintrc, it seems like a good idea to wait until eslintrc is removed before considering making a change here.