Skip to content

css

Style sheets and the style blocks of components: the standard stylelint rules, no left or right properties, a visible focus outline, and relative font sizes. SCSS gets formatting only. Guide: CSS.

A scope has file extensions .css, .vue, .svelte, or .astro.

Lints every stylesheet with the standard stylelint rules, and refuses left and right properties and values, outline: none, and a font-size outside rem, em, and %.

Runs at the commit stage. gspot check --fix fixes what it can.

A browser silently skips a declaration it cannot parse, so a typo in a property ships as a missing style.

Run the fix: command that the report prints for the rules that fix themselves.

The declaration color: #ggg holds an invalid hex value and reports a finding. Replace it with a valid one such as #abc.

gspot ignore css/stylelint --paths "<path>" --reason "<why>"
gspot ignore css/stylelint --rule <rule> --reason "<why>"

To silence one place, write a comment such as:

/* stylelint-disable-next-line declaration-no-important -- reason: the vendor widget sets its own color */
Setting What it sets
tools.stylelint.rules Options for Stylelint rules, which stay errors. gspot refuses options for a rule of level all at a lower level, and Stylelint reports a rule that it does not know. Ignore a finding with gspot ignore css/stylelint --rule <rule> --reason "<why>".
tools.stylelint.plugins Stylelint plugins of your own: a tracked .js or .mjs module as path or a pinned npm package as package and version, and the rules that turn on as errors.
Rule file Installed when
.gspot/rules/CSS.md Always
.gspot/rules/TAILWIND.md The repository has a dependency on tailwindcss.
Tool Version
stylelint 17.16.0
stylelint-config-standard 40.0.0
postcss-html 2.0.0

.stylelintrc.yml and .gspot/configurations/css/stylelint.json