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. →

How to configure lint-staged?#

caution

All required configurations will be handled automatically by CLI as long as you choose plugins during the project creation phase.

package.json
{    "devDependencies": {        "husky": "^4.3.7",        "lint-staged": "^10.5.3"    },    "lint-staged": {        "*.{js,jsx,ts,tsx}": [            "npm run lint -- --quiet --fix"        ]    },    "husky": {        "hooks": {            "pre-commit": "lint-staged"        }    }}

Adding lint-staged to your project later#

npm i -D lint-staged husky
warning

You must have installed the ESLint plugin to use lint-staged.

To learn how to configure ESLint in your project follow instructions from here →