A mighty, modern CSS linter and fixer that helps you avoid errors and enforce consistent conventions in your stylesheets.
Over one hundred and sixty built-in rules. Geared towards standard CSS syntax, these can:
Limit language features: e.g.:
calc()and level 4 selectors.
<style>tags (used by Vue and Web Components) and Markdown code fences.
With stylelint, it's easy to start linting your CSS:
Decide how you want to use stylelint:
Create your configuration object by either extending a shared config or crafting your own:
stylelint-config-recommended. We update the configs with each new release of stylelint, so it's easy to stay up to date. Both configs are geared towards standard CSS syntax. If you use non-standard syntax (like
@ifetc.) then you might want to use a community config designed for that syntax e.g.
stylelint-config-recommended-scss. The recommended config turns on just the possible error rules. The standard config builds on top of the recommended config by additionally turning on over 60 of stylelint's stylistic rules with sensible defaults. You can always override specific rules after extending either config. When using either config, you'll likely want to add (and configure to your specific needs) some of the rules that limit language features. Alternately, you can search for another community config and extend that instead.
To craft your own config, first learn about how rules are named and how they work together, then either:
null) the rules that you don't care to enforce.
You'll find more detailed information on using stylelint and tailoring it to your needs in our guides:
If you're looking for help or have a support question, then check out our FAQ first. If the answer to your problem isn't there, then go to stackoverflow. stackoverflow is a huge Question and Answer community, and tagging your post there with "stylelint" will catch the stylelint team's attention.
If you think you've found a bug or if you have feature request, then create a new GitHub issue. Be sure to follow the issue template, answering each question, as this helps us greatly in understanding your problem or request.
Upgrading? Please read our CHANGELOG to learn what changes to expect in the latest version, whether that's new features, bug fixes, renamed rules, or whatever else.
There is always a lot of work to do, and already well over 150 rules to maintain. So please help out in any way that you can:
Interested in the project vision? Please read our VISION document.
stylelint follows semantic versioning. However, due to the nature of stylelint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, based on ESLint's semantic versioning policy we've defined the following semantic versioning policy for stylelint:
Patch release (intended to not break your lint build)
Minor release (might break your lint build)
Major release (likely to break your lint build)
According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (
"stylelint": "~7.2.0" to guarantee the results of your builds.