# eslint-config-flat-gitignore

> .gitignore support for ESLint Flat Config

Latest version **2.4.0** (published 2026-08-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-config-flat-gitignore
pnpm add eslint-config-flat-gitignore
yarn add eslint-config-flat-gitignore
bun add eslint-config-flat-gitignore
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2026-08-27 |
| First published | 2023-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 137 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu |
| Keywords | eslint-config, eslint-flat-config |

## Links

- npm: https://www.npmjs.com/package/eslint-config-flat-gitignore
- Repository: https://github.com/antfu/eslint-config-flat-gitignore
- Homepage: https://github.com/antfu/eslint-config-flat-gitignore#readme
- Issues: https://github.com/antfu/eslint-config-flat-gitignore/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/eslint-config-flat-gitignore

## Dependencies (1)

- [@eslint/compat](https://npm.io/package/@eslint/compat.md) ^2.1.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.4.0 (latest) — 2026-08-27
- 2.3.0 — 2026-03-24
- 2.2.1 — 2026-02-19
- 2.1.0 — 2025-02-18
- 2.0.0 — 2025-01-28
- 1.0.1 — 2025-01-28
- 1.0.0 — 2025-01-09
- 0.3.0 — 2024-08-29
- 0.2.0 — 2024-08-29
- 0.1.8 — 2024-07-16
- 0.1.7 — 2024-07-10
- 0.1.6 — 2024-07-07
- 0.1.5 — 2024-04-02
- 0.1.4 — 2024-04-02
- 0.1.3 — 2024-02-11
- … 3 more at https://npm.io/package/eslint-config-flat-gitignore/versions

## README

# eslint-config-flat-gitignore

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]

`.gitignore` support for [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new).

## Usage

```bash
npm i -D eslint-config-flat-gitignore
```

```js
// eslint.config.js
import gitignore from 'eslint-config-flat-gitignore'

export default [
  // recommended putting it at the first
  gitignore(),
  // your other configs here
]
```

By default it will only looks for `.gitignore` but NOT `.eslintignore`, as we would recommended move away from `.eslintignore` to declare directly in `eslint.config.js` for single source of truth. If you still want it, you can pass the `files` option to specify the files to look for.

```js
gitignore({
  files: [
    '.gitignore',
    '.eslintignore',
  ]
})
```

By default, this plugin throws if any of the ignore files are missing. This can be disabled by passing setting the `strict` option to `false`.

```js
gitignore({
  files: [
    '.gitignore',
    '.eslintignore',
  ],
  strict: false,
})
```

By default, this plugin will try to look up the directory tree and match the first `.gitignore` file. You can disable this by setting the `root` option to `true`, or specify the `files` option to a specific path.

```js
gitignore({
  root: true
})
```

If you want to include recursive `.gitignore` files (for example in monorepos), enable the `recursive` option.

```js
gitignore({
  recursive: true,
})
```

If you want recursive discovery but need to skip specific directory names, pass an object to `recursive` with `skipDirs`.

```js
gitignore({
  recursive: {
    // Skip any directory with this name at any depth
    skipDirs: ['dist', 'coverage'],
  },
})
```

`skipDirs` matches directory names (not paths) and applies in addition to the built-in skipped directories: `.git` and `node_modules`.

This plugin will also automatically detect git submodule file `.gitmodules` and ignore all files under the submodule dirs. If you want to disable or customize this behavior, you can pass the `filesGitModules` option.

<!-- eslint-skip -->
```js
gitignore({
  filesGitModules: [], // disable
  filesGitModules: ['path/to/.gitmodules'], // customize
})
```

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
    <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg' alt='Sponsors' />
  </a>
</p>

## License

[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/eslint-config-flat-gitignore?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/eslint-config-flat-gitignore
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-config-flat-gitignore?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/eslint-config-flat-gitignore
[bundle-src]: https://img.shields.io/bundlephobia/minzip/eslint-config-flat-gitignore?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=eslint-config-flat-gitignore
[license-src]: https://img.shields.io/github/license/antfu/eslint-config-flat-gitignore.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/antfu/eslint-config-flat-gitignore/blob/main/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
[jsdocs-href]: https://www.jsdocs.io/package/eslint-config-flat-gitignore

---
_Source: https://npm.io/package/eslint-config-flat-gitignore · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
