Registry / devops / eslint-gitignore

eslint-gitignore

JSON →
library0.1.0jsnpmunverified

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-gitignore
INSTALL
IMPORT
SIG · ESLINT-GITIGNORE
E
eslint-gitignore
devopsjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

readGitignoreFiles
const { readGitignoreFiles } = require('eslint-gitignore')
import { readGitignoreFiles } from 'eslint-gitignore'
This package is CommonJS-only, last published over 6 years ago. ESM imports are not supported.
ESLint Config Usage
module.exports = { ignorePatterns: readGitignoreFiles({ cwd: __dirname }) }
The primary use case is within an `.eslintrc.js` file to populate the `ignorePatterns` array.

Demonstrates how to integrate `readGitignoreFiles` into an ESLint CommonJS configuration file to respect `.gitignore` patterns.

const { readGitignoreFiles } = require('eslint-gitignore'); module.exports = { root: true, env: { browser: true, es2021: true, node: true }, extends: [ 'eslint:recommended', 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended' ], parser: '@typescript-eslint/parser', parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, plugins: [ 'react', '@typescript-eslint' ], rules: { // Example rule 'no-unused-vars': 'warn' }, // Uses eslint-gitignore to incorporate .gitignore patterns ignorePatterns: readGitignoreFiles({ cwd: __dirname }) }; // To run ESLint: npx eslint .
Debug
Known issues
breakingThis package is effectively abandoned, with no updates or maintenance for over 6 years. It is highly unlikely to be compatible with modern ESLint versions (e.g., v8, v9 with flat config) or newer Node.js runtimes without potential issues.
fix
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.
affects: All versions (0.1.0)
gotchaThe functionality provided by `eslint-gitignore` is now natively supported and recommended directly within ESLint (especially with flat configurations using `@eslint/compat`). Relying on this abandoned package introduces unnecessary technical debt and potential compatibility problems.
fix
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
]);
```
affects: All versions (0.1.0)
Errors
Common errors & fixes
TypeError: readGitignoreFiles is not a function
Attempting to use `import { readGitignoreFiles } from 'eslint-gitignore'` in a modern ESM project, or incorrect `require` syntax.
fix
This package is CommonJS-only. Ensure you are using `const { readGitignoreFiles } = require('eslint-gitignore')` in a CJS environment.
ESLint ignores files that are not in .gitignore or lints files that should be ignored.
Incorrect `options.cwd` parameter passed to `readGitignoreFiles` or conflicts with other `ignorePatterns` in the ESLint configuration.
fix
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.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency, required for ESLint configuration integration.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-gitignore — npm install eslint-gitignore · libregistry