This release contains significant and breaking changes that will help us modernize our code so that Stylelint remains free of security issues.
We deprecated most of the rules that enforce stylistic conventions. You should remove these rules from your configuration object.
We recommend:
- using a pretty printer, like Prettier, alongside Stylelint
- extending our standard config in your configuration object
Stylelint and pretty printers are complementary tools that work together to help you write consistent and error-free code. To help facilitate this, we've removed the deprecated rules from the latest version of our standard config. You can extend the config using:
{
+ "extends": ["stylelint-config-standard"],
"rules" { .. }
}
Our standard config turns on many of the other rules that enforce conventions, e.g. most of the *-notation
, *-pattern
and *-quotes
rules. We recommend adding more of the rules that enforce conventions to your config as many of them will be specific to your needs, e.g. what units you allow in your code.
For example, you can:
Additionally, you may no longer need to extend Prettier's Stylelint config as there should be no conflicting rules:
{
- "extends": ["stylelint-config-prettier"],
"rules" { .. }
}
If you want to continue using Stylelint to enforce stylistic consistency, you can migrate the deprecated rules you need to a plugin. We will remove the rules from Stylelint in the next major release.
Three breaking changes may also affect you:
- removed support for Node.js 12
- removed support for processors
- changed
overrides.extends
behavior
You should use the following or higher versions of Node.js:
- 14.13.1
- 16.0.0
You should use a custom syntax instead.
To be consistent with the overrides.plugins
, overrides.extends
will merge rather than replace.
If you would like to keep the previous behavior, you should change your config to:
{
- "extends": ["config-a"],
"overrides": [
{
"rules": ["*.module.css"],
"extends": ["config-b"]
},
+ {
+ "rules": ["*.css"],
+ "extends": ["config-a"]
+ }
]
}