Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docs: Clarify default ignoring of node_modules (#10092)
When using ESLint from the root of a mono repo `node_modules` needs to
be explicitly added to `.eslintignore` for ESLint to ignore for example
`packages/*/node_modules`. Clarified this in the configuring
documentation.
  • Loading branch information
matijs authored and not-an-aardvark committed Mar 16, 2018
1 parent 72ed3db commit 935f4e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/user-guide/configuring.md
Expand Up @@ -833,16 +833,18 @@ Globs are matched using [node-ignore](https://github.com/kaelzhang/node-ignore),

In addition to any patterns in a `.eslintignore` file, ESLint always ignores files in `/node_modules/*` and `/bower_components/*`.

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

```text
# /node_modules/* and /bower_components/* ignored by default
# /node_modules/* and /bower_components/* in the project root are ignored by default
# Ignore built files except build/index.js
build/*
!build/index.js
```

**Important**: Note that `node_modules` directories in, for example, a `packages` directory in a mono repo are *not* ignored by default and need to be added to `.eslintignore` explicitly.

### Using an Alternate File

If you'd prefer to use a different file than the `.eslintignore` in the current working directory, you can specify it on the command line using the `--ignore-path` option. For example, you can use `.jshintignore` file because it has the same format:
Expand Down

0 comments on commit 935f4e4

Please sign in to comment.