Ignore eslint errors during git pre-commit

Viewed 2143

I would like to use eslint with git pre-commit hook, so it can fix errors automatically (at least what can be fixed automatically) and ignore other errors, so it doesn't block the commit itself.

The code from package.json:

"scripts": {
    "test-staged": "lint-staged"
},
"pre-commit": [
  "test-staged"
],
"lint-staged": {
  "*.{js,jsx}": [
    "eslint --config=config/.eslintrc --fix",
    "git add"
  ]
}

How can I achieve it?

1 Answers
Related