Skip to content

Migrate SCSS linting to stylelint 17 and run autofix pass#3624

Open
matthewhelmke wants to merge 1 commit into
chainguard-dev:mainfrom
matthewhelmke:matthewhelmke/docs-2-scss-stylelint-migration
Open

Migrate SCSS linting to stylelint 17 and run autofix pass#3624
matthewhelmke wants to merge 1 commit into
chainguard-dev:mainfrom
matthewhelmke:matthewhelmke/docs-2-scss-stylelint-migration

Conversation

@matthewhelmke

Copy link
Copy Markdown
Collaborator

What this does

Modernizes the SCSS/stylelint setup for assets/scss and runs a single autofix pass, the last remaining lint area for this repo (DOCS-2). eslint, markdownlint, and pre-commit CI are already done.

Tooling:

  • Bumps stylelint 14 → ^17 and stylelint-config-standard-scss 3 → ^17, matching chainguard-dev/courses-theme (the docs team's existing CSS-lint setup) — the standardization decision for this ticket.
  • Rewrites .stylelintrc.json for stylelint 16+, where the stylistic rules (indentation, whitespace) were removed and moved to formatters. Mirrors courses-theme's rule choices: disables no-descending-specificity, custom-property-pattern, the redundant-longhand/shorthand rules, and the *-pattern rules.

Three rules disabled because their autofixes break the Hugo/Dart Sass build:

  • scss/load-partial-extension stripped .scss from the DocSearch @import, which a sibling .css file made ambiguous.
  • color-function-alias-notation rewrote rgba()rgb(), which Dart Sass rejects as a built-in-function arity error.
  • media-feature-range-notation, disabled to keep classic max-width media queries (matching courses-theme) and avoid a large diff.

Autofix pass: clears 3,551 of 3,573 findings. The remaining 22 are manual fixes (shorthand-overrides, import-position, duplicates), tracked as follow-ups.

Verification

  • npm run build compiles cleanly (1,599 pages, no errors).
  • The compiled, minified CSS was diffed between the original and fixed SCSS. Every difference reduces to a behavior-preserving transform: hex shortening (#ffffff#fff), zero-unit trimming (0px0), the spec-equivalent word-wrapoverflow-wrap alias, and same-block duplicate-declaration removal where the later declaration already won the cascade.

Not in this PR (follow-ups)

  • The 22 manual findings (one issue, worked one rule per commit).
  • Wiring a stylelint pre-commit hook once the tree reaches zero findings.

Created in collaboration with Claude Code running Opus 4.8 on 2026-07-22.

Bump stylelint 14 -> 17 and stylelint-config-standard-scss 3 -> 17 to
match chainguard-dev/courses-theme, the docs team's existing CSS-lint
setup. Modernize .stylelintrc.json for stylelint 16+, where the removed
stylistic rules (indentation, whitespace) moved to formatters, and
mirror courses-theme's rule choices: disable no-descending-specificity,
custom-property-pattern, the redundant-longhand and shorthand rules, and
the *-pattern rules.

Disable three rules whose autofixes break the Hugo/Dart Sass build:

- scss/load-partial-extension stripped ".scss" from the DocSearch
  @import, which a sibling .css file made ambiguous.
- color-function-alias-notation rewrote rgba() to rgb(), which Dart Sass
  rejects as a built-in-function arity error.
- media-feature-range-notation, disabled to keep classic max-width media
  queries (matching courses-theme) and avoid a large diff.

Run one autofix pass across assets/scss, clearing 3,551 of 3,573
findings. The compiled CSS is behavior-identical, verified by diffing
the minified build output: every change reduces to hex shortening,
zero-unit trimming, the spec-equivalent word-wrap to overflow-wrap
alias, or same-block duplicate-declaration removal where the later
declaration already won the cascade. The remaining 22 findings are
manual fixes tracked as follow-ups.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@matthewhelmke
matthewhelmke requested review from a team as code owners July 22, 2026 17:39
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for ornate-narwhal-088216 ready!

Name Link
🔨 Latest commit f65ea2c
🔍 Latest deploy log https://app.netlify.com/projects/ornate-narwhal-088216/deploys/6a61005da61cb80008cb040b
😎 Deploy Preview https://deploy-preview-3624--ornate-narwhal-088216.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SharpRake SharpRake left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @matthewhelmke!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants