Skip to content

Commit

Permalink
docs: Improve ignores documentation (#17239)
Browse files Browse the repository at this point in the history
* docs: Improve `ignores` documentation

* Another note about `dir/` vs. `dir/**` in non-global patterns

* Update docs/src/use/configure/configuration-files-new.md

Clarifiy a sentence

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

---------

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
fasttime and mdjermanovic committed Jun 8, 2023
1 parent 35e11d3 commit 3912f3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/src/use/configure/configuration-files-new.md
Expand Up @@ -116,7 +116,9 @@ export default [

Here, the configuration object excludes files ending with `.config.js` except for `eslint.config.js`. That file still has `semi` applied.

If `ignores` is used without `files` and any other setting, then the configuration object applies to all files except the ones specified in `ignores`, for example:
Non-global `ignores` patterns can only match file names. A pattern like `"dir-to-exclude/"` will not ignore anything. To ignore everything in a particular directory, a pattern like `"dir-to-exclude/**"` should be used instead.

If `ignores` is used without `files` and there are other keys (such as `rules`), then the configuration object applies to all files except the ones specified in `ignores`, for example:

```js
export default [
Expand Down Expand Up @@ -145,6 +147,9 @@ export default [

This configuration specifies that all of the files in the `.config` directory should be ignored. This pattern is added after the default patterns, which are `["**/node_modules/**", ".git/**"]`.

Note that only global `ignores` patterns can match directories.
`ignores` patterns that are specific to a configuration will only match file names.

#### Cascading configuration objects

When more than one configuration object matches a given filename, the configuration objects are merged with later objects overriding previous objects when there is a conflict. For example:
Expand Down

0 comments on commit 3912f3a

Please sign in to comment.