Skip to content

Stylelint

A CSS linter that catches errors and enforces style conventions in your stylesheets.

Stars
11.5k
Forks
1k
Licence
MIT
Language
JavaScript
Last update
8 days ago
Type
Dev tool

What it is

Stylelint checks CSS and CSS-like code for mistakes, such as malformed grid areas, misspelled property names, or duplicate selectors, and for style rules your team chooses, such as disallowed units or naming patterns. It can also automatically fix some problems. The README says it has over 150 built-in rules and supports plugins and shareable configs.

  • Flag invalid or misspelled CSS properties in a project's stylesheets
  • Enforce naming patterns for custom properties
  • Set limits such as the number of ID selectors allowed
  • Extract and lint styles embedded in HTML, Markdown, or CSS-in-JS template literals

Great for

  • Front-end teams that want consistent CSS across a shared codebase
  • Developers who want to catch typos and invalid CSS before it ships
  • Projects that write SCSS, Sass, or Less and want linting for those syntaxes
  • Teams that already use Prettier and want a linter alongside it

Not ideal for

  • People who only need to write a few static CSS rules and do not want a Node.js toolchain (the project is distributed as a JavaScript package, per its JavaScript language and npm badges)
  • Anyone looking for a visual editor or a CSS preprocessor; Stylelint only checks code
Step-by-step guide: how to use StylelintInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js

    Clone the repository

    git clone https://github.com/stylelint/stylelint
  2. 2

    Run it

    • Read the Getting started guide at docs/user-guide/get-started.md
    • Install Stylelint as a project dependency using the npm package
    • Create a configuration file as described in the Configuring guide
    • Run the CLI from the command line against your stylesheets
  3. 3

    Get the most out of it

    • Pair it with Prettier, which the README recommends for consistent formatting
    • Use the Customizing and Configuring guides to select only the rules you need
    • Write your own rules with the plugin guide at docs/developer-guide/plugins.md
    • Extend it to other syntaxes with the custom syntaxes guide if you use CSS-in-JS or embedded styles

Downloads

Strengths

  • Large built-in rule set, described as over 150 rules in the README
  • Can automatically fix some problems where possible
  • Supports plugins and shareable configs so teams can customize or extend it

Trade-offs

  • Setup and rule configuration require some familiarity with Node.js tooling and config files
  • The README does not detail configuration specifics here, so teams will need to read the linked docs to tune rules

How it compares

ProjectStarsTypeLevelUpdatedBest for
stylelint (this)11.5kDev toolintermediate8 days agoFront-end teams that want consistent CSS across a shared codebase
prettier52.4kDev toolbeginner4 days agoTeams that want one shared code style without writing their own rules
parcel44kDev toolbeginner4 days agoWeb developers who want a bundler that works without a config file
esbuild40.1kDev toolintermediate3 months agoDevelopers who want fast builds for JavaScript, TypeScript, or CSS projects
standard29.4kDev toolbeginner1.3 years agoJavaScript projects where the team wants consistent style without debating rules
postcss29kDev toolintermediate4 days agoWeb developers who want to automate CSS fixes such as vendor prefixes

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.