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],
[...]
Now I feel bad about using deprecated properties...7 years ago.
But, yes, this needs modernization and visitors are advised to follow your example!