Migrate to lint-staged +10


Since lint-staged v10, the git add step is no longer necessary in the lint-staged commands.

So if your .lintstagedrc looks something like this:

{
  "*.js": ["eslint --fix", "prettier --write", "git add"],
  "*.{css,html,json,md,yml}": ["prettier --write", "git add"]
}

Then it can be updated to:

{
  "*.js": ["eslint --fix", "prettier --write"],
  "*.{css,html,json,md,yml}": "prettier --write"
}

Script

I wrote a script that migrates the lint-staged config in:

  • .lintstagedrc
  • .lintstagedrc.json
  • package.json

To run the script:

npx https://gist.github.com/remarkablemark/7732ca7f192550c8851419eec2aad7ea

Gist



Please support this site and join our Discord!