A utility for ESLint respecting `.gitignore` files.
npm install eslint-gitignore




A utility for ESLint respecting .gitignore files.
Use [npm] or a compatible tool.
```
$ npm install -D eslint eslint-gitignore
Use it in your .eslintrc.js file. For example:
`js
const { readGitignoreFiles } = require("eslint-gitignore")
module.exports = {
// Your config.
ignorePatterns: readGitignoreFiles({ cwd: __dirname })
};
`
Then run ESLint!
It finds .gitignore files, reads the found files, then converts the patterns in the found files to be able to use as ignorePatterns of ESLint config.
If you use eslint --debug CLI option, this function prints debug information.
#### Arguments
- options.cwd (string) ... Specify the current working directory. Default is process.cwd(). This should be the directory where your .eslintrc.js file exists.options.patterns
- (string[]) ... Specify glob patterns to find .gitignore files. Default is ["/.gitignore", "!/node_modules/**"]. Please be careful to ignore unrelated directories.
#### Return Value
- (string[]) ... The ignorePatterns value.
See GitHub Releases.
Welcome contributing!
Please use GitHub's Issues/PRs.
- npm test ... Run tests. It generates code coverage into coverage directory.npm run watch
- ... Run tests when files are edited.npm version
-
[npm]: https://www.npmjs.com/