Skip to content

Meta: Add eslint/css#9275

Merged
fregante merged 12 commits into
mainfrom
copilot/enable-eslint-css-rules
Apr 30, 2026
Merged

Meta: Add eslint/css#9275
fregante merged 12 commits into
mainfrom
copilot/enable-eslint-css-rules

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

Adds @eslint/css to lint all *.css files in the project.

Config changes (eslint.config.js)

  • Import @eslint/css and add it as a CSS language plugin for **/*.css
  • tolerant: true — required to parse modern CSS features (@container range syntax, nesting, etc.) without errors
  • css/no-important: 'off'!important is intentionally used throughout to override GitHub's styles
  • css/use-baseline: 'off' — we support the latest browsers only
  • css/no-invalid-properties: 'off'Bug: css/no-invalid-properties can't parse valid nested color functions eslint/css#434
  • css/font-family-fallbacks: 'off' — GitHub-defined font stacks may not have generic fallbacks
  • Disable all svelte/* rules for **/*.css files — Svelte rules require the Svelte parser and crash when applied to CSS files

CSS fixes

File Change
clean-conversation-sidebar.css Change bare span:is(...) nested selector to & span:is(...) — corrects CSS nesting spec compliance (bare type selectors require &)
clean-rich-text-editor.css Replace deprecated clip: rect(...) with clip-path: inset(50%)
readable-title-change-events.css Replace non-standard word-break: break-word with standard overflow-wrap: break-word
show-associated-branch-prs-on-fork.css Expand font: 600 12px / 1 inherit shorthand into individual font-weight, font-size, line-height, and font-family properties

Test URLs

Screenshot

Copy link
Copy Markdown
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

A couple of good suggestions but otherwise noise and bugs. We can reconsider if we decide to introduce custom CSS lint rules.

Comment thread source/features/fit-textareas.css Outdated
Comment thread source/features/sticky-comment-header.css Outdated
Comment thread source/features/show-associated-branch-prs-on-fork.css Outdated
@fregante fregante closed this Apr 25, 2026
@fregante fregante deleted the copilot/enable-eslint-css-rules branch April 25, 2026 09:55
@fregante fregante restored the copilot/enable-eslint-css-rules branch April 30, 2026 07:28
@fregante
Copy link
Copy Markdown
Member

Yes there's room for custom rules, for example to avoid #9298

Let's add it, even if it means disabling most native rules.

@fregante fregante reopened this Apr 30, 2026
@fregante
Copy link
Copy Markdown
Member

@copilot disable css/use-baseline, undo the changes in show-associated-branch-prs-on-fork.css, remove all inline css/no-invalid-properties exclusions and let the lint script fail, I want to see the error

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 30, 2026

@copilot disable css/use-baseline, undo the changes in show-associated-branch-prs-on-fork.css, remove all inline css/no-invalid-properties exclusions and let the lint script fail, I want to se...

Done in 247f827:

  • css/use-baseline disabled globally in the config
  • show-associated-branch-prs-on-fork.css reverted to original (font: 600 12px / 1 inherit)
  • All inline css/no-invalid-properties exclusions removed (heat-map.css, sticky-comment-header.css)

The failing lint now shows 13 errors across 3 files:

  • show-associated-branch-prs-on-fork.css: invalid font shorthand + missing font fallbacks
  • sticky-comment-header.css: linear-gradient(var(…), var(…)) parsed as invalid background value
  • heat-map.css (×10): color-mix(…, var(--fgColor-muted, var(--fallback))) — the nested var() fallback confuses the parser into reading ) as the color value

Copilot AI requested a review from fregante April 30, 2026 07:34
@fregante fregante marked this pull request as ready for review April 30, 2026 07:42
@fregante fregante changed the title Enable eslint/css recommended rules and fix violations Meta: Add eslint/css Apr 30, 2026
@fregante
Copy link
Copy Markdown
Member

@copilot merge conflicts, disable css/no-invalid-properties and css/font-family-fallbacks globally, explain why you're using tolerant. Then run npm run fix before committing.

@fregante fregante added the meta Related to Refined GitHub itself label Apr 30, 2026
…lbacks globally, explain tolerant

Co-authored-by: fregante <[email protected]>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 30, 2026

@copilot merge conflicts, disable css/no-invalid-properties and css/font-family-fallbacks globally, explain why you're using tolerant. Then run npm run fix before committing.

Done in 6f1d7e1:

  • Merged origin/main
  • css/no-invalid-properties and css/font-family-fallbacks both disabled globally (off)
  • Added a comment on tolerant: true explaining it's required to parse modern CSS features (nesting, :has(), etc.) without errors
  • Ran npm run fix

@fregante fregante changed the title Meta: Add eslint/css Meta: Add eslint/css Apr 30, 2026
Copilot AI changed the title Meta: Add eslint/css Meta: Add eslint/css Apr 30, 2026
@fregante fregante changed the title Meta: Add eslint/css Meta: Add eslint/css Apr 30, 2026
@fregante
Copy link
Copy Markdown
Member

@copilot fix svelte config, then restore your previous fix for that code:

font-weight: 600;
font-size: 12px;
line-height: 1;
etc

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 30, 2026

@copilot fix svelte config, then restore your previous fix for that code:

...

Done in 4bf3936:

  • Svelte rules are now disabled for all **/*.css files via Object.fromEntries(Object.keys(sveltePlugin.rules).map(...)) — svelte rules require the Svelte parser and crash on CSS files
  • Font shorthand restored: font: 600 12px / 1 inheritfont-weight: 600; font-size: 12px; line-height: 1; font-family: inherit
  • Also added back tolerant: true (needed for @container range syntax in github-bugs.css) and css/font-family-fallbacks: 'off' (needed for font-family: inherit)

@fregante fregante enabled auto-merge (squash) April 30, 2026 09:42
@fregante fregante merged commit a2b24e9 into main Apr 30, 2026
9 checks passed

span:is([class*='emptyText'], [class*='developmentHelpText']):not(
:has(> button)
) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@g-plane strangely an extra & changed the indentation here, but shouldn't.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you provide a minimal reproduction with playground?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I saw your commit, thank you!

@fregante fregante deleted the copilot/enable-eslint-css-rules branch April 30, 2026 09:52
Copilot AI added a commit that referenced this pull request Apr 30, 2026
Co-authored-by: fregante <[email protected]>
Co-authored-by: fregante <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

3 participants