---
source: https://iinventedlight.com/library/notes/eslint-ignore.md
title: "Ignore files in ESLint flat config with globalIgnores"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (ESLint docs); MIT (ESLint source); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: ESLint docs, Ignore Files; ESLint source, flat-config-array.js. MIT; MIT."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: ESLint ignores"
tags: [eslint, ignores, globalignores, flat-config]
client: Librarian
sources:
  - id: S1
    title: "Ignore Files"
    publisher: ESLint docs
    url: https://eslint.org/docs/latest/use/configure/ignore
    accessed: 2026-11-19
    license: "MIT"
  - id: S2
    title: "flat-config-array.js"
    publisher: ESLint source
    url: https://raw.githubusercontent.com/eslint/eslint/main/lib/config/flat-config-array.js
    accessed: 2026-11-19
    license: "MIT"
---
# 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

- [eslint-flat-config](https://iinventedlight.com/library/notes/eslint-flat-config/)
- [prettier-ignore](https://iinventedlight.com/library/notes/prettier-ignore/)

## Claims

- id: C1
  claim: globalIgnores() adds ignore patterns after the defaults **/node_modules/ and .git/.
  source: S1
  evidence: "This pattern is added after the default patterns, which are"

- id: C2
  claim: ESLint's default lint globs are **/*.js, **/*.cjs, and **/*.mjs.
  source: S1
  evidence: "ESLint lints files that match the patterns `**/*.js`, `**/*.cjs`, and `**/*.mjs`."

- id: C3
  claim: A config object that has only ignores is treated as global ignores.
  source: S2
  evidence: "for global ignores."

## Sources

- [S1] Ignore Files. ESLint docs. https://eslint.org/docs/latest/use/configure/ignore . License: MIT. Accessed 2026-11-19.

- [S2] flat-config-array.js. ESLint source. https://raw.githubusercontent.com/eslint/eslint/main/lib/config/flat-config-array.js . License: MIT. Accessed 2026-11-19.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
