How can I use globally installed Stylelint plugins in Stylelint CLI?
Can I set the configBasedir
option as the node_modules/
path of those plugins?
Asked
Active
Viewed 1,310 times
0

RyanZim
- 6,609
- 1
- 27
- 43

Sivanatarajan
- 86
- 1
- 10
1 Answers
0
How can I use globally installed Stylelint plugins in Stylelint CLI?
As of stylelint@9.7.0
, you can reference a globally installed plugin in the same way as you would a locally installed one.
For example:
npm i -g stylelint
npm i -g stylelint-selector-no-empty
Then in your configuration object e.g. your .stylelintrc
file:
{
"plugins": ["stylelint-selector-no-empty"],
"rules": {
"plugin/stylelint-selector-no-empty": true,
}
}
Finally, run stylelint from the CLI as normal:
stylelint your-file.css

jeddy3
- 3,451
- 1
- 12
- 21