eslint-gitignore is a utility package designed to integrate patterns from `.gitignore` files directly into an ESLint configuration's `ignorePatterns` array. It was last published six years ago, with its sole version being `0.1.0`. The package appears to be abandoned, with no further updates or maintenance since its initial release. While it served a specific purpose at the time of its creation by programmatically parsing gitignore files, modern ESLint versions, particularly with the introduction of flat configurations, now offer native capabilities to achieve this through the `@eslint/compat` package's `includeIgnoreFile` utility. Therefore, its key differentiator has been superseded by core ESLint functionality, making it largely obsolete for new projects and potentially problematic for existing ones due to lack of maintenance.
npm install eslint-gitignoreVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate `readGitignoreFiles` into an ESLint CommonJS configuration file to respect `.gitignore` patterns.
Consider migrating to native ESLint features. For ESLint's flat config, use `@eslint/compat`'s `includeIgnoreFile` utility. For older `.eslintrc.*` configurations, manually maintain `.eslintignore` or the `ignorePatterns` array.
For new projects or when upgrading ESLint, prefer using `includeIgnoreFile` from `@eslint/compat` if using flat config, or manually manage ignore patterns if on legacy configs. For example:
```javascript
// eslint.config.js (Flat Config)
import { defineConfig } from 'eslint/config';
import { includeIgnoreFile } from '@eslint/compat';
import { fileURLToPath } from 'node:url';
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
export default defineConfig([
includeIgnoreFile(gitignorePath),
// ... other configs
]);
```This package is CommonJS-only. Ensure you are using `const { readGitignoreFiles } = require('eslint-gitignore')` in a CJS environment.Verify that `cwd: __dirname` (or the correct path to your project root) is passed to `readGitignoreFiles`. Also, check for conflicting ignore patterns defined elsewhere in your `.eslintrc.js` or `.eslintignore` files.