Atom exclude node_modules folder from search

GitAtom Editor

Git Problem Overview


How to exclude node_modules folder from Atom searches "Find in project" after you have put node_modules inside your .gitignore file? Does atom require that the project actually has a git repository, or should the .gitignore be enough for Atom to exclude the folder?

My .gitignore looks like this:

.DS_STORE
*.log

node_modules

dist
coverage

Git Solutions


Solution 1 - Git

Steps

  1. Launch atom
  2. From the menu: edit > preferences (atom > prefernces on Mac)
  3. From the side menu, click the button "Open Config Folder"

Now a new atom IDE should open.

  1. Open the file "config.cson"
  2. Add ignoredNames: ["node_modules"] under core

Example of a config.cson

"*":
  core:
    ignoredNames: [
      ".git"
      "node_modules"
    ]
  editor: {}
  minimap:
    plugins:
      "highlight-selected": true
      "highlight-selectedDecorationsZIndex": 0
  welcome:
    showOnStartup: false

Hope this helps

Solution 2 - Git

In the "File/directory pattern" field of the search use an exclamation mark followed by the name of the directory you want to ignore:

enter image description here

Solution 3 - Git

If your .gitignore file sits higher in the directory than where you are performing a Search in Directory your node_modules will not be excluded from Atom's search.

For that reason I recommend adding node_modules to the Ignored Names list in the Core Settings.

Atom Editor Ignored File Names

Solution 4 - Git

The .gitignore file should be enough for Atom to exclude the folder, as long as you have the ignore "exclude VCS ignored paths" option checked.

You should also append a "/" after node_modules

node_modules/

enter image description here

Solution 5 - Git

For new versions of Atom (I am using 1.28.2 on Windows) I accessed config.cson via File > Config...

Then, as mentioned in this previous answer, ignoredNames: ["node_modules"] must be added under the core section:

"*":
  core:
    telemetryConsent: "no"
    themes: [
      "one-light-ui"
      "one-light-syntax"
    ]
    ignoredNames: ["node_modules"]

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVille Miekk-ojaView Question on Stackoverflow
Solution 1 - GitaSmater.MeView Answer on Stackoverflow
Solution 2 - GitRodrigo PintoView Answer on Stackoverflow
Solution 3 - GitReggie PinkhamView Answer on Stackoverflow
Solution 4 - GitFab313View Answer on Stackoverflow
Solution 5 - GitStriderView Answer on Stackoverflow