Note: See MatanelGordon's comment for an updated approach to do this.
Just a quick how-to to import rules specified in .editorconfig into your stylelint configuration to avoid duplication.
Install the following packages. stylelint-config-standard
is just used as an example. Use a different one or your current configuration object.
#> (npm install -g | yarn global add) editorconfig stylelint stylelint-config-standard
Now, see .stylelintrc.js
below. The .js
ending is important.
You will have to extend the map of rules if you need more than the three I'm using. To get a list of rules:
> node -e "console.log(require('stylelint'))"
{ [Function: creator]
process: [Function],
utils:
{ report: [Function],
ruleMessages: [Function],
validateOptions: [Function] },
lint: [Function],
rules:
{ 'at-rule-blacklist': { [Function: rule] primaryOptionArray: true },
'at-rule-empty-line-before': [Function],
'at-rule-name-case': [Function],
'at-rule-name-newline-after': [Function],
[...]
Here's a more modern approach:
Instead of using
parseSync
, turn the whole file into a module and usetop-level await
withparse
.Also, at this time I must point out that
indentation
is deprecated instylelint v15
so other tools like prettier will take it from here.*
top-level await
is unflagged sincenode v14.8
.