Search code examples
stylelint

check-types or check-lint similar command to stylelint


When running a lint like Eslint, I can use the command npm run check-lint to check all the code on my project. The same goes with npm run check-types from typescript. Is there a similar command with stylelint? I didn't find anything on their docs about it. I know there is a --fix flag, but that's not exactly what I want.


Solution

  • These are npm run scripts, and unrelated to Stylelint itself. You can use run scripts to run any arbitrary command from a package's "scripts" object.

    For example, to add a check-styles command to your project you should edit your package.json file and add:

    {
      "scripts": {
        "check-styles": "stylelint \"**/*.css\""
      }
    }
    

    You'll then be able to use npm run check-styles.