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.

node_modules file is not ignored correctly if it contains eslint config

See original GitHub issue

Related: https://github.com/microsoft/vscode-eslint/issues/1240

And also #14533, #14546. They are both closed, but actually it is a bug IMO.

node_modules is already in my .eslintignore. (**/node_modules does not work too)

image


I don’t know should it be fixed in ESLint core or the related vscode extension. And I don’t know if any other related editors share the same issue.


Tell us about your environment

  • ESLint Version: v7.27.0
  • Node Version: v12.22.1
  • npm Version: 7.18.1
  • Operating System: macOS 12

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?

Please show your full configuration:

N/A

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

N/A

yarn eslint node_modules/stylelint/lib/cli.js

What did you expect to happen?

report file ignored warning

What actually happened? Please copy-paste the actual, raw output from ESLint.

❯ yarn eslint node_modules/stylelint/lib/cli.js                                                                                                                          (master|●11)

yarn run v1.22.10
$ /Users/JounQin/Workspaces/Alauda/icarus/node_modules/.bin/eslint node_modules/stylelint/lib/cli.js

Oops! Something went wrong! :(

ESLint: 7.27.0

ESLint couldn't find the config "stylelint" to extend from. Please check that the name of the config is correct.

The config "stylelint" was referenced from the config file in "/Users/JounQin/Workspaces/Alauda/icarus/node_modules/stylelint/package.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce this issue:

https://github.com/alauda/k8s-form-in-action

run yarn && yarn eslint node_modules/stylelint/lib/cli.js

Are you willing to submit a pull request to fix this bug?

Yes

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (18 by maintainers)

github_iconTop GitHub Comments

5reactions
JounQincommented, Jul 10, 2021

If it is confirmed should be fixed, I’ll take a look at tonight or tomorrow.

3reactions
nzakascommented, Aug 4, 2021

I’ve confirmed this is most likely a bug, however, I don’t think it’s one we want to fix at this point. The problem is the complexity of the way the eslintrc config files work, and any time we touch or change things, we run the risk of introducing other errors along the way. It’s this complexity that has led us towards a new, simpler config system that will replace it. We made the decision to freeze eslintrc to minimize any further disruptions to our users while we work on transitioning to a new config system.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eslint not ignoring node_modules folder - Stack Overflow
In my case, ESLint (v7.8.1) was ignoring node_modules directories properly, but not my dist directory. I added this to .eslintignore :
Read more >
Plugins & Parsers - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
VS Code ESLint extension - Visual Studio Marketplace
Extension for Visual Studio Code - Integrates ESLint JavaScript into VS Code.
Read more >
ESLint | WebStorm Documentation - JetBrains
Configure linting scope · Open the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript | Code Quality Tools | ......
Read more >
eslint/eslint - Gitter
Please check that the name of the config is correct. .eslintrc.json: "extends": ... I can run $ npx eslint --no-ignore .eslintrc.js and it...
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