Search code examples
javascriptnpmeslintstylelinthusky

How to run several commands on precommit with husky npm module?


I use husky to check JS before commit. In my package.json i have

"scripts": {
    "lintStyles": "stylelint app/**/*.scss",
    "fixStylesLinting": "stylelint app/**/*.scss --fix",
    "lintJS": "eslint app/**/*.js",
    "fixJSLinting": "eslint --fix app/**/*.js",
    "precommit": "npm run lintJS"
  }

It works, what i don't understand is how can i run both lintJS, lintStyles commands.


Solution

  • to include more than one script add &&for ex:

    precommit: npm run lint:sass && npm run lint:js