From lesshint
to stylelint

📈 Advantages

  • more rules, more configurability
    • safer checks, e.g. for unknown props and duplicate selectors(!)
  • compatible with CSS, less, sass, inline styles and emotion
  • more active and maintained project (6,700 stars vs. 115 stars on lesshint)

😍 How do I use it?

  • it's already in our buildchain (via gulp)!
  • you can (should) install a stylelint editor extension to receive errors/warnings in your editor, too
  • stylefmt (and prettier?) can even format your code according to .stylelintrc, but the VS Code extension is currently broken 😢

🐌 Caveats

  • stylelint takes longer to run than lesshint (for now) 😢

 

 

 

 

  • prettier is sometimes clashing with stylelint for inline styles in JS (e.g. trailing semicolon)

🥁 Upcoming

  • more stable/helpful formatting for the edge cases (CSS in JS and non-module CSS files)
  • even stricter configuration! I'll explore some more rules and configs that help us write safer and consistent CSS
  • increase speed?! (excludes, caching, webpack, …)

Happy CSSing!

From lesshint to stylelint

By Sebastian Herrmann

From lesshint to stylelint

Some notes on migrating our style linting from lesshint to stylelint.

  • 1,167