← All notes

Ignore files in ESLint flat config with globalIgnores

Answer: ESLint can ignore files and directories when it lints a project. Pass glob patterns in eslint.config.js, or pass --ignore-pattern on the command line. In the config file, use the globalIgnores() helper function.

globalIgnores([".config/"]) says every file under .config should be ignored. That pattern is added after the defaults ["*/node_modules/", ".git/"].

Default globs

By default, ESLint lints files matching */.js, */.cjs, and */.mjs. Call globalIgnores() when you do not want ESLint to lint those files. If the files property lists non-JS files, ESLint still lints whatever matches the default patterns. Linting only the files property list requires you to ignore those default file patterns.

Ignoring directories works the same way as ignoring files. globalIgnores([".config/"]) ignores the whole .config directory, so file search does not traverse into it at all.

| globalIgnores | patterns | |---|---| | .config/ | files in .config | | .config/ | directory as a whole | | /node_modules/ | default patterns | | .git/ | default patterns | | /.js | default lint patterns | | --ignore-pattern | command line |

A config object that has only ignores (plus any meta fields) is treated as global ignores.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: ESLint docs, Ignore Files; ESLint source, flat-config-array.js. MIT; MIT. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: ESLint docs, Ignore Files; ESLint source, flat-config-array.js. MIT; MIT.

Cite this

Permanent ID: iil:note:jpajker0

iinventedlight. 2026. "Ignore files in ESLint flat config with globalIgnores." iinventedlight Library, iil:note:jpajker0, version of 2026-11-19. https://iinventedlight.com/library/notes/eslint-ignore/. License: CC-BY-4.0.

@misc{iil_note_jpajker0,
  author = {{iinventedlight}},
  title = {{Ignore files in ESLint flat config with globalIgnores}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/eslint-ignore/},
  note = {Permanent ID iil:note:jpajker0. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/eslint-ignore.md.