Skip to content

Commit 80dffed

Browse files
authored
docs: fix Ignoring Files section in config migration guide (#17392)
* docs: fix Ignoring Files section in config migration guide * remove extra blank line
1 parent 8a9abb7 commit 80dffed

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

docs/src/use/configure/migration-guide.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,14 @@ export default [
345345

346346
With eslintrc, you can make ESLint ignore files by creating a separate `.eslintignore` file in the root of your project. The `.eslintignore` file uses the same glob pattern syntax as `.gitignore` files. Alternatively, you can use an `ignorePatterns` property in your eslintrc file.
347347

348-
To ignore files with flat config, you can use the `ignores` property in a config object. The `ignores` property accepts an array of glob patterns. Note that flat config glob patterns do _not_ match dot files (e.g. `*.js` won't match `.dotfile.js`). Flat config does not support loading ignore patterns from `.eslintignore` files, so you'll need to migrate those patterns directly into flat config.
348+
To ignore files with flat config, you can use the `ignores` property in a config object. The `ignores` property accepts an array of glob patterns. Flat config does not support loading ignore patterns from `.eslintignore` files, so you'll need to migrate those patterns directly into flat config.
349349

350350
For example, here's a `.eslintignore` example you can use with an eslintrc config:
351351

352352
```shell
353353
# .eslintignore
354354
temp.js
355-
.config/*
355+
config/*
356356
# ...other ignored files
357357
```
358358

@@ -362,21 +362,23 @@ temp.js
362362
// .eslintrc.js
363363
module.exports = {
364364
// ...other config
365-
ignorePatterns: ["temp.js", ".config/*"],
365+
ignorePatterns: ["temp.js", "config/*"],
366366
};
367367
```
368368

369369
Here are the same files ignore patterns in flat config:
370370

371371
```javascript
372372
export default [
373+
// ...other config
373374
{
374-
// ...other config
375-
ignores: ["temp.js", ".config/*"]
375+
ignores: ["**/temp.js", "config/*"]
376376
}
377377
];
378378
```
379379

380+
Also, with flat config, dotfiles (e.g. `.dotfile.js`) are no longer ignored by default. If you want to ignore dotfiles, add files ignore pattern `"**/.*"`.
381+
380382
### Linter Options
381383

382384
ESlintrc files let you configure the linter itself with the `noInlineConfig` and `reportUnusedDisableDirectives` properties.

0 commit comments

Comments
 (0)