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.

ignore node_modules folder by default [$15 awarded]

See original GitHub issue

Sorry, I searched but couldn’t find an existing issue for this…


Should ESLint ignore the “node_modules/**” folder by default?

I have a sample Node project with one *.js file (and ESLint installed globally) and typed:

$ eslint .

...
node_modules/syntax-error/test/sources/check.js
  5:30  error  Unexpected identifier

✖ 88164 problems

real    0m33.670s
user    0m30.912s
sys     0m0.958s

The command took ~30s and found 88k problems in my node_modules/ folder. 😕 I think we’d want to automatically ignore the “node_modules/**” folder since it’d be a better “out of the box” experience.

Workaround:

Put node_modules/** in the project’s .eslintignore file.

$ echo "node_modules/**" > .eslintignore

$ cat .eslintignore
node_modules/**

$ time eslint .

index.js
  1:0  error  'console' is not defined      no-undef
  1:0  error  Unexpected console statement  no-console

node_modules/hapi/test/templates/valid/helpers/.hidden.js
  1:16  error  Strings must use doublequote  quotes

✖ 3 problems

real    0m0.346s
user    0m0.293s
sys     0m0.053s

Not sure why, but even though I have node_modules/** in my .eslintignore file, it looks like it’s linting node_modules/hapi/test/templates/valid/helpers/.hidden.js.

<bountysource-plugin>

The $15 bounty on this issue has been claimed at Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Oct 8, 2014

Yeah, thanks, I understand now. I’m quite hesitant to add too many ignored directories by default. node_modules/** makes me confident that we’re handling the most important case, **/node_modules/** scares me a bit because it’s an uncommon use and therefore I’m not sure if we can derive any sort of meaning from that directory structure.

In this case, I’d much rather allow projects to opt-in to **/node_modules/** if they need it rather that doing it automatically.

0reactions
wavdedcommented, Oct 9, 2014

Fair enough, thx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node modules - Git - Ignore node_modules folder everywhere
Add node_modules/ or node_modules to the .gitignore file to ignore all directories called node_modules in the current folder and any subfolders like the ......
Read more >
How to ignore the node_modules folder in Git? - Tim Mousk
1. Create a .gitignore file with this entry. . · 2. Remove the node_modules folder from the Git index using the git rm...
Read more >
Excluding the node_modules Folder in Visual Studio WebSite ...
In short if you have a massive node_modules folder that folder shows in the project. There's no official, built-in way to limit files...
Read more >
Command-line API | Node.js v19.3.0 Documentation
Specify the directory where the CPU profiles generated by --cpu-prof will be placed. The default value is controlled by the --diagnostic-dir command-line ...
Read more >
Cleanup the node_modules for a lighter Lambda Function
Posted on Dec 8, 2020 • Updated on Sep 15, 2021 • Originally ... Any nodejs project carries a bulky folder - the...
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