Created by Kifor Kostiantyn
This is the standard configuration file for stylelint from Kifor Kostiantyn.
Use it as is or as a basis for your own configuration.
Along with the config, install the stylelint
itself.
npm i -D kifor-stylelint-config stylelint
In the root of the project, create a .stylelintrc
file and in it add kifor-stylelint-config
to the extends
field.
.stylelintrc
{
"extends": "kifor-stylelint-config"
}
If you set kifor-stylelint-config
globally with the -g
flag, then you need to use the absolute path kifor-stylelint-config
in the configuration file:
.stylelintrc
{
"extends": "/absolute/path/to/kifor-stylelint-config"
}
You can override existing rules or add new ones.
To do this, add a rules
field to the config with the desired rule overrides.
.stylelintrc
{
"extends": "kifor-stylelint-config",
"rules": {
"property-no-unknown": [
true,
{
"ignoreProperties": [
"composes"
]
}
],
"unit-whitelist": ["em", "rem", "s", "px"]
}
}
In the same rules
field, you can also override the no longer supported Stylelint styleguide rules from the stylelint-codeguide
plugin by adding the prefix codeguide/
before the rule name.
.stylelintrc
{
"extends": "kifor-stylelint-config",
"rules": {
"property-no-unknown": [
true,
{
"ignoreProperties": [
"composes"
]
}
],
"unit-whitelist": ["em", "rem", "s", "px"],
"codeguide/indentation": "tab",
"codeguide/number-leading-zero": null
}
}
- Install stylelint and config
- Open VSCode
- Install the stylelint plugin
- Use it