Repository navigation
Description
Overview
An audit of packages/desktop-app against ../nodespace-docs/DESIGN.md (the design token and component-convention spec) found extensive drift: three disagreeing node-type accent color systems, hardcoded hex/rgba colors bypassing CSS variable tokens in ~23 files, forbidden shadows on modals, and unauthorized transitions/animations in ~33 files. Separate issues cover fixing each category of violation. This issue is about the regression gate: without it, fixing the current violations only resets the clock until the same drift reaccumulates.
Problem Statement
packages/desktop-app/eslint.config.js uses eslint-plugin-svelte + svelte-eslint-parser and is wired into the mandatory quality:fix/quality:check gate. However, eslint-plugin-svelte does not parse CSS inside Svelte <style> blocks — that region is entirely opaque to ESLint. Nearly all of the drift found in the audit (hardcoded colors, forbidden shadows, unauthorized transitions, the three disagreeing node-color systems) lives inside <style> blocks, so ESLint structurally cannot catch any of it today, no matter what custom rules are added to it.
There is no CSS linter (Stylelint or otherwise) installed anywhere in the repo (checked node_modules/.bin and all package.json workspaces).
There is an established precedent for custom lint rule infrastructure in this repo: packages/desktop-app/eslint-rules/enforce-nodetype.js is a working custom ESLint rule already wired into eslint.config.js, enforcing a different naming convention. This proves the team already has working custom-lint infra and is comfortable maintaining it — the gap is specifically CSS-content coverage, not lint tooling in general.
Proposed Solution
Add Stylelint (or an equivalent CSS-aware linter capable of parsing <style> blocks inside .svelte files) to packages/desktop-app, wired into its quality:check/quality:fix scripts, configured to catch the categories of violation found in the audit:
- Flag raw hex/rgb/hsl color literals in
<style>blocks — requirevar(--token-name)instead (e.g. viastylelint-declaration-strict-valueor equivalent), with the token list inpackages/desktop-app/src/app.cssas the source of truth - Flag
box-shadowdeclarations outside an allowlist — DESIGN.md andapp.cssonly permit specific values (see the modal shadow issue for the exact spec) - Flag
transition/animationdeclarations outside an allowlist — DESIGN.md permits exactly two transitions app-wide (sidebar-width collapse, code-block hover-button fade); everything else should be caught
Architecture Impact
No prior ADR governs CSS linting or the design-token enforcement layer — ../nodespace-docs/decisions/ was searched (grep across decisions/, architecture/, components/ for lint/design-system/token/stylelint terms) and turned up no relevant prior decision. This issue does not reverse or supersede any existing ADR; it establishes new tooling. The governing spec this enforces is ../nodespace-docs/DESIGN.md (front-matter tokens + prose rules), which already exists and is not being changed by this issue.
Acceptance Criteria
- A CSS-aware linter (Stylelint or equivalent) is added as a dependency to
packages/desktop-appand configured to parse<style>blocks inside.sveltefiles - A rule flags hex/rgb/hsl color literals inside
<style>blocks inpackages/desktop-app/src, requiringvar(--token)usage instead, with the token names sourced frompackages/desktop-app/src/app.css - A rule flags
box-shadowvalues outside an explicit allowlist matching DESIGN.md's floating-surface shadow spec (the value used correctly today inpackages/desktop-app/src/lib/design/components/base-node.svelte's date-picker popover:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)) and explicitly rejects shadows on modal panels per DESIGN.md's "no drop shadow on the panel itself" rule - A rule flags
transition/animationproperty declarations and@keyframesblocks outside an explicit allowlist limited to the two DESIGN.md-approved cases (sidebar-width collapse at 0.25s ease-out; code-block hover-button opacity fade at 0.2s ease) - The new linter is wired into
packages/desktop-app'squality:checkandquality:fixscripts (or the root equivalents that invoke them) so it runs as part of the existing mandatory gate — no separate script that can be silently skipped - Running the new linter against current
mainproduces a list of violations consistent with the audit findings (three node-color systems, hardcoded colors in modals/sync-pills/diagnostic-panel/noderef.css, forbidden modal shadows, unauthorized transitions) — this confirms the tool actually catches the known-bad patterns before they're fixed elsewhere - The linter configuration itself passes with zero violations against
packages/desktop-app/src/app.cssand any other token-definition file that legitimately needs to declare raw color values (token definitions are the one place raw values belong; component<style>blocks are not) - Documented (in the issue or PR description, not in
nodespace-docs) which files were violating at the time this lands, so the remediation issues have a checklist to work against - Code passes
bun run quality:fix - Tests pass (
bun run test:all)
Technical Specifications
Reference Files
- Token source of truth:
packages/desktop-app/src/app.css— defines all CSS custom properties correctly per DESIGN.md - Design spec:
../nodespace-docs/DESIGN.md— front-matter tokens + prose rules for colors, typography, spacing, radii, shadows, motion - Existing custom-lint precedent:
packages/desktop-app/eslint-rules/enforce-nodetype.js, wired intopackages/desktop-app/eslint.config.js - ESLint config (JS/TS only, does not see into
<style>blocks):packages/desktop-app/eslint.config.js, rooteslint.config.js - Known violating files (non-exhaustive, from audit):
packages/desktop-app/src/lib/design/components/base-node-viewer.svelte,packages/desktop-app/src/lib/styles/noderef.css,delete-confirmation-modal.svelte,subtree-access-denied-modal.svelte,version-conflict-modal.svelte,first-pro-consent-modal.svelte,first-pro-consent-slot.svelte,pro-relogin-modal.svelte,update-banner.svelte,conflict-toast.svelte,pro-sync-pill.svelte,enable-sync-pill.svelte,pro-teaser-pill.svelte,lib/design/components/diagnostic-panel.svelte,navigation-sidebar.svelte,theme-provider.svelte,query-node-viewer.svelte,node-tree.svelte,collection-node-viewer.svelte,tab-system.svelte,chat-message.svelte,agent-selector.svelte,ai-onboarding-dialog.svelte
Implementation Details
- Prefer
stylelintwithstylelint-config-standardplusstylelint-declaration-strict-value(or a comparably-maintained equivalent) for the "no raw color, usevar()" rule; confirm whichever package is chosen actually supports parsing embedded<style>blocks in.sveltefiles (via a Svelte-aware custom syntax/processor) rather than only.cssfiles - Scope the color-literal rule to
color,background,background-color,border-color,box-shadow,fill,strokeproperties (anywhere a hex/rgb/hsl literal could substitute for a token) - Consider
overrides/ignoreFilesfor legitimate raw-value locations (token definition files) rather than a blanket-disable — the point is to prevent new component-level literals, not to make the linter permissive - This issue should land before (or at minimum land in a form other issues can run against for a violation count) the remediation issues below, since fixing violations without a gate lets new ones creep back in during the same fix window
Dependencies
(none — this is the first issue to land in this remediation set)
Related Issues
- Unify node-type accent colors to a single primary-based system #2590 (node-color unification — this enforcement issue's rules are what catch regressions of that fix)
- Replace hardcoded shadows and colors in modal/toast/banner components with design tokens #2591 (modals hardcoded colors/shadows remediation)
- Replace hardcoded status colors and phantom CSS variables in diagnostic-panel and invitations-inbox with design tokens #2592 (sync/pro pills hardcoded colors remediation)
- Rework diagnostic-panel dark IDE theme and remaining noderef.css literals onto design tokens #2593 (diagnostic-panel/noderef.css hardcoded colors remediation)
- Prune unauthorized CSS transitions and animations back to the two DESIGN.md-approved exceptions #2594 (unauthorized transitions/animations audit)
Activity
malibio commentedon Sep 16, 2026
Baseline (worktree issue-2589-stylelint-design-tokens): Frontend: 242 test files passed, 4995 tests passed, 0 failed (84.62s).