Skip to content

Commit

Permalink
Docs: Clarify node_modules is ignored by default (fixes #13006) (#13054)
Browse files Browse the repository at this point in the history
  • Loading branch information
MKuijpers committed Mar 21, 2020
1 parent 0de91f3 commit 9ac5b9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide/command-line-interface.md
Expand Up @@ -480,7 +480,7 @@ Example:

ESLint supports `.eslintignore` files to exclude files from the linting process when ESLint operates on a directory. Files given as individual CLI arguments will be exempt from exclusion. The `.eslintignore` file is a plain text file containing one pattern per line. It can be located in any of the target directory's ancestors; it will affect files in its containing directory as well as all sub-directories. Here's a simple example of a `.eslintignore` file:

node_modules/*
temp.js
**/vendor/*.js

A more detailed breakdown of supported patterns and directories ESLint ignores by default can be found in [Configuring ESLint](configuring.md#ignoring-files-and-directories).
Expand Down
9 changes: 5 additions & 4 deletions docs/user-guide/configuring.md
Expand Up @@ -1021,7 +1021,7 @@ You can tell ESLint to ignore specific files and directories by `ignorePatterns`

```json
{
"ignorePatterns": ["temp.js", "node_modules/"],
"ignorePatterns": ["temp.js", "**/vendor/*.js"],
"rules": {
//...
}
Expand Down Expand Up @@ -1061,12 +1061,13 @@ Of particular note is that like `.gitignore` files, all paths used as patterns f

Please see `.gitignore`'s specification for further examples of valid syntax.

In addition to any patterns in a `.eslintignore` file, ESLint always ignores files in `/**/node_modules/*`.
In addition to any patterns in a `.eslintignore` file, ESLint ignores files in `/**/node_modules/*` by default. It can still be added using `!`.

For example, placing the following `.eslintignore` file in the current working directory will ignore all of `node_modules/*` and anything in the `build/` directory except `build/index.js`:
For example, placing the following `.eslintignore` file in the current working directory will not ignore `node_modules/*` and ignore anything in the `build/` directory except `build/index.js`:

```text
# node_modules/* are ignored by default
# node_modules/* is ignored by default, but can be added using !
!node_modules/*
# Ignore built files except build/index.js
build/*
Expand Down

0 comments on commit 9ac5b9e

Please sign in to comment.