{"id":19519,"library":"eslint-config-flat-gitignore","title":"eslint-config-flat-gitignore","description":"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.","status":"active","version":"2.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/eslint-config-flat-gitignore","tags":["javascript","eslint-config","eslint-flat-config","typescript"],"install":[{"cmd":"npm install eslint-config-flat-gitignore","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-flat-gitignore","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-flat-gitignore","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required for flat config API, v9.5.0 or v10.0.0","package":"eslint","optional":false}],"imports":[{"note":"Package is ESM-only since v2.0.0; no named exports. Use default import.","wrong":"const { gitignore } = require('eslint-config-flat-gitignore')","symbol":"default export (function)","correct":"import gitignore from 'eslint-config-flat-gitignore'"},{"note":"By default, only .gitignore is looked for; add .eslintignore explicitly if needed.","wrong":"gitignore({ files: ['.eslintignore'] })","symbol":"gitignore() options","correct":"gitignore({ files: ['.gitignore'], strict: true })"},{"note":"In v2.3.0, recursive can be boolean or object with skipDirs; skipDirs matches directory names, not paths.","wrong":"gitignore({ recursive: true, skipDirs: ['dist'] })","symbol":"gitignore with recursive option","correct":"gitignore({ recursive: true })"}],"quickstart":{"code":"// eslint.config.js\nimport gitignore from 'eslint-config-flat-gitignore'\n\nexport default [\n  // Place gitignore first to ensure .gitignore patterns take precedence\n  gitignore(),\n  // Your other configs...\n  {\n    rules: {\n      'no-console': 'warn'\n    }\n  }\n]","lang":"javascript","description":"Shows basic setup: import the default function and call it as the first config item in ESLint flat config array."},"warnings":[{"fix":"Use import instead of require, or upgrade to Node.js with --experimental-require-module (unstable).","message":"ESM-only since v2.0.0: require() will fail with ERR_REQUIRE_ESM","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Migrate to ESLint v9 flat config. See ESLint migration guide.","message":"Requires ESLint v9+ with flat config; ESLint v8 or .eslintrc is not supported.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Set strict: false if you expect .gitignore to be missing, or ensure the file exists.","message":"Missing ignore file causes error by default (strict: true) since v1.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade to v2.3.0 and enable recursive: true for monorepo support.","message":"recursive option added in v2.3.0; older versions ignore .gitignore in subdirectories.","severity":"gotcha","affected_versions":"<2.3.0"},{"fix":"Pass files: ['.gitignore', '.eslintignore'] if you need both.","message":"Default only looks for .gitignore; .eslintignore is ignored unless explicitly added to files array.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v1 or later, update import and usage.","message":"In v0.x, the module had a different API (name property, etc.); avoid using v0.x in new projects.","severity":"deprecated","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change eslint.config.js to use import syntax, or rename to .mjs and use import.","cause":"Using CommonJS require() on an ESM-only package (v2.0.0+).","error":"ERR_REQUIRE_ESM: require() of ES Module /path/to/eslint-config-flat-gitignore/index.js from /path/to/project/eslint.config.js not supported."},{"fix":"Use flat config array: export default [ gitignore(), ... ] instead of extends.","cause":"Incorrect import or config format (e.g., using extends array instead of flat config).","error":"Error: Failed to load config 'flat-gitignore' to extend from. Referenced from: ..."},{"fix":"Import default: import gitignore from 'eslint-config-flat-gitignore'","cause":"Default import used incorrectly; e.g., import { gitignore } instead of import gitignore.","error":"TypeError: gitignore is not a function"},{"fix":"Run npm install eslint-config-flat-gitignore --save-dev and ensure node_modules is accessible.","cause":"Package not installed or ESLint cannot resolve it in the config file.","error":"Error: Cannot find module 'eslint-config-flat-gitignore'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}