Lint multiple directories with stylelint
Asked Answered
S

1

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?

Sourpuss answered 3/4, 2019 at 9:1 Comment(0)
H
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

Hypoderm answered 3/4, 2019 at 22:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.