Registry / devops / eslint-config-flat-gitignore

eslint-config-flat-gitignore

JSON →
library2.3.0jsnpmunverified

ESLint flat config helper that automatically applies .gitignore patterns to ESLint's ignore list. Current stable version is 2.3.0, with monthly releases. Key differentiators: supports recursive .gitignore discovery (monorepos), git submodule detection via .gitmodules, strict mode (throws on missing ignore files by default), and the ability to specify custom ignore file paths. Only works with ESLint flat config (ESLint v9+). ESM-only since v2.0.0. Maintained by Anthony Fu.

npm install eslint-config-flat-gitignore
INSTALL
IMPORT
SIG · ESLINT-CONFIG-FLAT
E
eslint-config-flat-gitignore
devopsjavascriptv2.3.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export (function)
✓ import gitignore from 'eslint-config-flat-gitignore'
✗ const { gitignore } = require('eslint-config-flat-gitignore')
Package is ESM-only since v2.0.0; no named exports. Use default import.
gitignore() options
✓ gitignore({ files: ['.gitignore'], strict: true })
✗ gitignore({ files: ['.eslintignore'] })
By default, only .gitignore is looked for; add .eslintignore explicitly if needed.
gitignore with recursive option
✓ gitignore({ recursive: true })
✗ gitignore({ recursive: true, skipDirs: ['dist'] })
In v2.3.0, recursive can be boolean or object with skipDirs; skipDirs matches directory names, not paths.

Shows basic setup: import the default function and call it as the first config item in ESLint flat config array.

// eslint.config.js import gitignore from 'eslint-config-flat-gitignore' export default [ // Place gitignore first to ensure .gitignore patterns take precedence gitignore(), // Your other configs... { rules: { 'no-console': 'warn' } } ]
Debug
Known issues
breakingESM-only since v2.0.0: require() will fail with ERR_REQUIRE_ESM
fix
Use import instead of require, or upgrade to Node.js with --experimental-require-module (unstable).
affects: >=2.0.0
breakingRequires ESLint v9+ with flat config; ESLint v8 or .eslintrc is not supported.
fix
Migrate to ESLint v9 flat config. See ESLint migration guide.
affects: >=0.3.0
breakingMissing ignore file causes error by default (strict: true) since v1.0.0.
fix
Set strict: false if you expect .gitignore to be missing, or ensure the file exists.
affects: >=1.0.0
gotcharecursive option added in v2.3.0; older versions ignore .gitignore in subdirectories.
fix
Upgrade to v2.3.0 and enable recursive: true for monorepo support.
affects: <2.3.0
gotchaDefault only looks for .gitignore; .eslintignore is ignored unless explicitly added to files array.
fix
Pass files: ['.gitignore', '.eslintignore'] if you need both.
affects: >=1.0.0
deprecatedIn v0.x, the module had a different API (name property, etc.); avoid using v0.x in new projects.
fix
Upgrade to v1 or later, update import and usage.
affects: <1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module /path/to/eslint-config-flat-gitignore/index.js from /path/to/project/eslint.config.js not supported.
Using CommonJS require() on an ESM-only package (v2.0.0+).
fix
Change eslint.config.js to use import syntax, or rename to .mjs and use import.
Error: Failed to load config 'flat-gitignore' to extend from. Referenced from: ...
Incorrect import or config format (e.g., using extends array instead of flat config).
fix
Use flat config array: export default [ gitignore(), ... ] instead of extends.
TypeError: gitignore is not a function
Default import used incorrectly; e.g., import { gitignore } instead of import gitignore.
fix
Import default: import gitignore from 'eslint-config-flat-gitignore'
Error: Cannot find module 'eslint-config-flat-gitignore'
Package not installed or ESLint cannot resolve it in the config file.
fix
Run npm install eslint-config-flat-gitignore --save-dev and ensure node_modules is accessible.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency, required for flat config API, v9.5.0 or v10.0.0
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-config-flat-gitignore — npm install eslint-config-flat-gitignore · libregistry