Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
iiroj committed Jan 9, 2020
2 parents 8bdeec0 + 2cd1d37 commit bd3721f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -482,3 +482,20 @@ In certain project setups, it might be desirable to bypass this restriction. See
Note that patterns like `*.js`, `**/*.js` will still only match the project files and not any of the files in parent or sibling directories.

Example repo: [sudo-suhas/lint-staged-django-react-demo](https://github.com/sudo-suhas/lint-staged-django-react-demo).

### How can i ignore files from `.eslintignore` ?

ESLint throws out `warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override` warnings that breaks the linting process ( if you used `--max-warnings=0` which is recommended ).

Based on the discussion from https://github.com/eslint/eslint/issues/9977 , it was decided that using [the outlined script ](https://github.com/eslint/eslint/issues/9977#issuecomment-406420893)is the best route to fix this.

So you can setup a `.lintstagedrc.js` config file to do this:

```
var CLIEngine = require("eslint").CLIEngine;
var cli = new CLIEngine({});
module.exports = {
"*.js": files => 'eslint --max-warnings=0 ' + files.filter( file => ! cli.isPathIgnored( file ) ).join( ' ' ),
}
```
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -10,6 +10,9 @@
"Suhas Karanth <sudo.suhas@gmail.com>",
"Iiro Jäppinen <iiro@jappinen.fi> (https://iiro.fi)"
],
"funding": {
"url": "https://opencollective.com/lint-staged"
},
"bin": "./bin/lint-staged",
"main": "./lib/index.js",
"files": [
Expand Down

0 comments on commit bd3721f

Please sign in to comment.