5

I'm trying to lint more than one directory at once with stylelint.

In my package.json file I have:

"scripts": {
  "lint": "stylelint 'pages/**/*.scss', 'global/components/**/*.scss' ; exit 0"
},

If I remove either 'pages/**/*.scss' or 'global/components/**/*.scss', I can lint one of the directories.

Is it possible to lint 2 at once?

Eli Nathan
  • 1,020
  • 2
  • 13
  • 35

1 Answers1

8

Is it possible to lint 2 at once?

Yes.

stylelint expects a single glob pattern, but you can construct a glob pattern that matches more than one directory. For example:

{global/components,pages}/**/*.scss

And in the context of your example:

"scripts": {
  "lint": "stylelint '{global/components,pages}/**/*.scss'; exit 0"
},

stylelint supports these glob features and you can test your glob patterns using globtester.com

jeddy3
  • 3,451
  • 1
  • 12
  • 21