Skip to content

CSS

gspot checks style sheets, and the style blocks inside Vue, Svelte, and Astro components, with Stylelint. Lint rules shows how to change its options. Prettier formats .scss files, and Stylelint does not lint them.

Check Stage Level What it does
css/stylelint commit basic 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 %.

gspot adds these rules to the standard Stylelint rules, so a first commit can fail on code that Stylelint alone accepts:

Refused Write instead Level
Left and right properties, such as margin-left and padding-right, and left and right margin-inline-start, inset-inline-start Both
float, clear, or text-align with left or right inline-start, start Both
outline: none or outline: 0 A visible focus style Both
font-size outside rem, em, and % rem Both
An ID in a selector, specificity above 0,3,0, or a .is-* or .has-* class alone A class, with a state class on it, as .card.is-open all

Stylelint accepts the special selectors of each kind of component: :deep, :slotted, and :global in Vue, and :global in Svelte and Astro. In a Vue component, it also accepts v-bind() in a value, such as color: v-bind(themeColor).

When the scope depends on tailwindcss, Stylelint accepts the Tailwind at-rules, such as @apply and @theme, and the theme() function. Without that dependency, each one gets an unknown at-rule or unknown function finding.

In *.module.css files, Stylelint accepts the composes property and the :global, :local, :export, and :import selectors of CSS Modules.