A mighty, modern linter and fixer for CSS and CSS-like languages.
One that is:
Provide built-in rules for the following three areas:
Provide rules to catch two types of possible errors:
Invalid code is best handled by emerging dedicated tools e.g. csstree - a language parser with syntax validation. As a stop-gap, while these tools mature, provide invalid code rules for the simplest of cases.
(In the future, these tools can be wrapped as plugins to make use of features such as /* stylelint-* */
command comments, severity levels, and options validator.)
Provide rules to limit what language features can be used, including:
all
keyword for transitions as it is not performant.px
or rem
etc.)Provide rules to enforce a diverse range of stylistic conventions, including:
There are two approaches to enforcing stylistic conventions:
The former is handled by pretty printers, like prettier, whereas the latter is catered for by the built-in stylistic rules.
Additionally, the built-in stylistic rules and plugins are configurable to support this diverse range of stylistic conventions. This is in contrast to pretty printers, which tend to be opinionated. The ordering of properties within declaration blocks is an example of a divisive topic, where there is no one or two dominant conventions. The stylelint-order
plugin adheres to stylelint's philosophies, and can be used to lint and fix a diverse range of ordering conventions.
Another example is the use of single-line rules for sets of related rules e.g.
/* Single-line related classes */ .class-1 { top: 0; bottom: 0; } .class-2 { top: 5px; right: 0; } .class-3 { top: 8px; left: 0; }
The built-in stylistic rules can be configured to allow both multi-line and single-line rules. The choice of when to use each belongs to the user, who can determine which rules are related.
Provide multiple points of extensions, including:
Provide a robust tool with a comprehensive test suite, including:
Provide consistency throughout, including:
Provide a fast tool, and the means to test and improve performance, including: