stylelint: a CSS linter with a plugin API
A mighty CSS linter that helps you avoid errors and enforce conventions.
At a glance
- What is it?
- Over 150 built-in rules, autofix where possible, plugins and shareable configs, and support for SCSS, Sass, Less and SugarSS.
- Who is it for?
- stylelint is at its best on plain CSS, where the built-in rule set is deep. Preprocessed languages are supported through custom syntaxes rather than first-class parsing, which means a SCSS or Less user depends on a separate package for that half of the work.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- stylelint/stylelint11,559 ★ · +33
| Repository | 2026-10-07 | 2026-11-25 |
|---|---|---|
| stylelint/stylelint | 11.5k | 11.6k |
33 Stars in the last 49 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The rule set, and the four jobs it is meant to do
The README's own description is short: a mighty CSS linter that helps you avoid errors and enforce conventions. Everything else follows from that pair of verbs. Avoiding errors splits three ways in the project's framing. There are invalid things, such as malformed grid areas. There are valid things that are nonetheless problematic, such as duplicate selectors. And there are unknown things, such as misspelled property names, where a typo produces no parse error at all.
Enforcing conventions splits four ways. You can disallow things, such as specific units. You can enforce naming patterns, for custom properties or anything else. You can set limits, such as a maximum number of ID selectors. And you can specify notations, for example for modern color functions.
That list is the clearest statement of what the tool is for.
The count is over 150 built-in rules. That number is also a cost: every rule is a promise about a language that is still gaining features.
Autofix, plugins, shareable configs and how they compose
Four extension mechanisms are listed in the features section, and they sit at different levels.
Autofix is the one that changes the most about day to day. The README claims stylelint automatically fixes problems where possible. Any project deciding how much automation to trust should start by fixing a subset of rules and reading the diff.
Plugins are how you add rules of your own, and the developer guide has a dedicated page on writing them. Shareable configs are how you distribute a rule set, and they can be extended by others, so a team can share one rule set. Customization covers the middle ground, where you set rule options in your own config rather than adopting someone else's package.
The package layout shows how the pieces are shipped. `package.json` exposes the library entry at `lib/index.mjs` with types alongside it, exposes internals under `./lib/utils/*` for plugins that need them, and declares a single binary at `bin/stylelint.mjs`. The published `files` array excludes tests and rule READMEs, which tells you the docs for individual rules travel separately from the code.
One more item in the README deserves a flag rather than a quotation. It names 10k unit tests and names Google and GitHub as users. Test counts and adopter names are the kind of evidence that dates quickly and tells you little about whether a specific rule will behave the way you need, so treat them as context rather than as an argument.
Getting past CSS with custom syntaxes
The README states two extension points for languages that are not CSS. Stylelint can extract embedded styles from HTML, from Markdown, and from CSS-in-JS template literals. And it can parse CSS-like languages such as SCSS, Sass, Less, and SugarSS.
Both are worth reading carefully, because the wording hides an important distinction. Custom syntaxes are a PostCSS concept, and Stylelint sits on PostCSS. What a custom syntax actually does is hand Stylelint a different parser, so that constructs your preprocessor understands are tokenized rather than rejected. Once that parsing succeeds, the rules that operate on the token stream still run.
The practical consequence is that SCSS variables, nesting, and mixins will not trip a syntax error, but neither are they the subject of any built-in rule. Nothing in the README suggests rules for preprocessor semantics. Separate community packages cover that, such as `stylelint-scss`.
The same applies to CSS-in-JS template literals. Extracting styles from them means Stylelint can lint the CSS you wrote inside a styled-components or similar template. It does not mean Stylelint understands the JavaScript around it, which is ESLint's job.
The `keywords` array in `package.json` lists css, scss, sass, less, sugarss, css-in-js and markdown, so the intent is broad. The developer guide has a page on writing custom syntaxes if you need one the ecosystem does not already provide.
The release notes are mostly about being wrong
The GitHub releases listed at the time of writing are 18.0.0-next.0 (2026-10-22), 17.16.0 (2026-10-01) and 17.15.0 (2026-09-04). The README links a changelog at CHANGELOG.md and a migration guide for 18.0.0, and the repository uses changesets for releases. Check the changelog for what each release changed before upgrading.
Prettier, ESLint, and the line stylelint draws
The README takes a clear position on the formatter question, recommending that you use a pretty printer like Prettier alongside Stylelint because linters and pretty printers are complementary. That is the correct division and it is worth being precise about it. Prettier reformats. It decides where the whitespace and line breaks go, and it is safe to run on a whole file because its output is a function of the input.
Stylelint decides whether something should be there at all. A rule can say a color must be written in a particular notation, that a selector must not exceed a length, that a property is unknown. Many of those rules are not expressible as a formatting transformation, and the ones that involve renaming or removing cannot be inferred from the file alone.
Against ESLint the boundary is the file type. ESLint checks JavaScript and TypeScript. The repository defines these lint scripts in `package.json`:
"lint:formatting": "prettier . --check --cache",
"lint:js": "eslint . --cache --max-warnings=0",
"lint:md": "remark . --quiet --frail",
"lint:types": "tsc"Four separate commands run under the `lint:*` scripts, and the JavaScript one is set to fail on any warning.
The docs tree tells you where the answers are
The README is almost entirely a table of contents, which is a deliberate choice and a reasonable one for a tool with this much surface. The guides section maps out where each kind of question lives.
The user guide covers getting started, customizing, configuring, rules, ignoring code, the CLI, the Node.js API, the PostCSS plugin, options, and the handling of errors and warnings. Two entries in that list decide which integration you need. The CLI page is for a standalone command, the Node.js API is for calling it from a script or build tool, and the PostCSS plugin is for embedding it in a PostCSS pipeline where another tool is already driving.
The developer guide covers writing plugins, writing custom syntaxes, and writing custom formatters. That last one matters if you are integrating stylelint into a tool that needs output in a specific shape rather than the default.
The migration guides are the most practically important section and the README lists five of them: migrating to 18.0.0, 17.0.0, 16.0.0, 15.0.0, and 14.0.0. The README also links a semantic versioning page under `docs/about/`. There are also maintainer guides for issues, pull requests and releases, and the repository carries a `.changeset/` directory, which is the tool those releases are generated from.
So the honest summary of the README is that it will not tell you how to configure anything. It tells you what the categories are, points at the page for each one, and hands you the changelog.
Editorial conclusion
stylelint is at its best on plain CSS, where the built-in rule set is deep. Preprocessed languages are supported through custom syntaxes rather than first-class parsing, which means a SCSS or Less user depends on a separate package for that half of the work. Install it from npm, adopt one of the shareable configs instead of writing rules from scratch, run it alongside Prettier rather than instead of it, and read the migration guide for your target major version before upgrading.
Frequently asked questions
What are the key differences between Prettier and Stylelint?
Prettier reformats a file: it decides whitespace, line breaks, and quoting, and its output is a pure function of the input. Stylelint decides whether something should be there, using over 150 rules covering invalid syntax, unmatched selectors, misspelled properties, and convention rules for units, naming, and notation. The Stylelint README recommends running them together rather than choosing between them.
How to install stylelint?
It is published to npm as `stylelint`, which is what the README's npm version badge tracks and what `package.json` declares as the package name. The README itself does not include an install command : the CLI binary at `bin/stylelint.mjs`, the Node.js API entry at `lib/index.mjs`, or the PostCSS plugin.
Can stylelint check SCSS and Less files?
Yes, through custom syntaxes built on PostCSS, which the README lists alongside SCSS, Sass, Less and SugarSS, plus a separate mechanism for extracting embedded styles from HTML, Markdown and CSS-in-JS template literals. The parsing is handled by the syntax; the built-in rules operate on the resulting token stream and do not check preprocessor semantics, which is what packages like stylelint-scss cover.
Should I trust stylelint autofix on an existing codebase?
Apply it rule by rule and read the diff, rather than running it across everything at once. Start with a stylistic rule you agree with and expand from there.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/stylelint-stylelint)Star history chart for your README
[](https://hysenlabs.com/projects/stylelint-stylelint)Was this useful?