Stylelint CSS linter now enabled on mozilla-central

17 views
Skip to first unread message

Gijs Kruitbosch

unread,
May 12, 2023, 5:36:34 AM5/12/23
to firefox-dev, dev-platform

Hello,

As of late yesterday, stylelint now lints CSS files in mozilla-central. You can invoke it locally using `./mach lint -l stylelint`, it can run for trypushes and autoland/mozilla-central commits, etc. Similar to eslint, it can auto-fix some types of issues, but not everything. There is also some initial documentation.

Thanks to Mark Banner, Dão Gottwald, Sylvestre Ledru and many others for their speedy reviews and advice.

What kind of issues does this detect?
To start with, only correctness issues: CSS syntax issues, duplicate property declarations in the same selector, broken property value syntax, etc. To land it, we had to adjust a few typos (that broke CSS) in our user agent sheet as well as various other places in the tree, so it has already helped discover and fix bugs.

We will likely increase coverage by enabling more rules to enforce conventions in use (e.g. using `em` sizing for fonts), help people write text-direction agnostic CSS (using logical CSS properties rather than physical ones) and so on, but this will happen gradually.

I work on newtab/debugger, I thought we already had this?
This new coverage is tree-wide, rather than specific to these 2 projects which already had a stylelint configuration. Right now those separate configurations for new tab and debugger code still exist. We will merge these into the main linter job soon.

I found a bug / problem with the new linter!
Uh oh. Please file under Developer Infrastructure :: Lint and Formatting and needinfo me (if appropriate, mark as a regression from the bug that landed support, and/or blocking the metabug).


Happy (CSS) Hacking!

Gijs

Reply all
Reply to author
Forward
0 new messages