Skip to main content

lint-staged

Use lint-staged to make your code uniform. It allows you to run arbitrary scripts against currently staged files.

Refer to official documentation for detailed usage. →

Adding lint-staged to your project later#

npm install --save husky lint-staged prettier
  • Add the following field to the package.json section:
package.json
"dependencies": {  // ...},"husky": {  "hooks": {    "pre-commit": "lint-staged"  }},"lint-staged": {   "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [     "prettier --write"   ]},