question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Files to be ignored depend on working directory

See original GitHub issue

I’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:open
  • Created 2 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
nzakascommented, Jul 9, 2021

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.

1reaction
nzakascommented, Dec 30, 2021

Given the tie-in with eslintrc, it seems like a good idea to wait until eslintrc is removed before considering making a change here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >
Trouble un-ignoring previously ignored files in Git repo
In order to start tracking previously ignored files or patterns: First, you need to change your working directory to the repository by typing...
Read more >
How to add a directory but ignore included files in git
How to check in a directory into git but ignore all including files using a nested `.gitignore` file.
Read more >
gitignore Documentation - Git
gitignore - Specifies intentionally untracked files to ignore ... or in any parent directory (up to the top-level of the working tree), with...
Read more >
How to Use a .gitignore File - Pluralsight
Here's how it works. A .gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found