Skip to content

chore: add quality guardrails — linting, accessibility, rules#273

Merged
tomasz-tomczyk merged 2 commits intomainfrom
quality-guardrails
Apr 16, 2026
Merged

chore: add quality guardrails — linting, accessibility, rules#273
tomasz-tomczyk merged 2 commits intomainfrom
quality-guardrails

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

Add automated tooling to catch the recurring issue categories found across 21 audit PRs (#145#271). Based on analysis of every audit finding, research of popular Go project linter configs (cli/cli, cobra, docker/cli, bubbletea, tailscale), and Claude Code best practices.

Go linting

  • Expand golangci-lint with nilerr, gocritic, errorlint, unparam (industry-backed selection — errcheck and dupl deliberately skipped as too noisy)
  • Fix all 26 findings: errors.As conversions, if-else→switch, //nolint:nilerr annotations for intentional patterns, exitAfterDefer extraction, loadCommentsFromCritJSON complexity refactoring

Frontend linting

  • Add ESLint (no-var, prefer-const, no-unused-vars, eqeqeq, no-shadow, no-implicit-globals)
  • Add Stylelint (ban hardcoded colors in style.css, duplicate selectors, empty blocks)
  • Fix all 133 findings: 87 hardcoded colors → 33 new CSS custom properties across all 4 theme blocks, 46 JS fixes
  • Add scripts/check-css-vars.sh — validates all var() references resolve to defined properties
  • Use color-mix() to derive badge/toast border colors from existing --green/--red vars

Accessibility

  • Add axe-core to Playwright E2E suite with WCAG 2.0 AA test

Pre-commit hook

  • ESLint, Stylelint, CSS variable validation added alongside existing Go checks

CI

  • New lint-frontend job (ESLint + Stylelint + CSS var check)
  • 58% Go coverage threshold (current: 59.5%)

Claude Code config

  • .claude/rules/ with path-specific semantic rules for Go, JS, CSS (only things linters can't catch)
  • PostCompact hook to re-inject semantic reminders after context compaction
  • "Common Mistakes" section in AGENTS.md (non-linter-catchable issues from audit history)
  • Compaction guidance in CLAUDE.md

Expected impact

~74% reduction in audit findings per cycle (from ~27 to ~7), leaving only genuinely hard issues for periodic review.

Test plan

  • golangci-lint run ./... — 0 issues
  • npx eslint frontend/app.js — 0 issues
  • npx stylelint "frontend/*.css" — 0 issues
  • bash scripts/check-css-vars.sh — all defined
  • go test ./... — all pass
  • E2E tests (CI)
  • Visual inspection of theme changes in light/dark modes

🤖 Generated with Claude Code

tomasz-tomczyk and others added 2 commits April 15, 2026 15:13
Add automated tooling to catch issues that previously required manual audits:

**Go linting** — expand golangci-lint with nilerr, gocritic, errorlint, unparam.
Fix all 26 findings: errors.As conversions, if-else→switch, nolint annotations
for intentional nil-return patterns, exitAfterDefer extraction, complexity
refactoring of loadCommentsFromCritJSON.

**Frontend linting** — add ESLint (no-var, prefer-const, no-unused-vars, eqeqeq)
and Stylelint (ban hardcoded colors in style.css). Fix all 133 findings: 87
hardcoded colors extracted to 33 new CSS custom properties across all 4 theme
blocks, 46 JS fixes (catch params, dead assignments, strict equality, shadowing).
Use color-mix() to derive badge/toast borders from existing --green/--red vars.

**Accessibility** — add axe-core to Playwright E2E suite with WCAG 2.0 AA test.

**Pre-commit hook** — add ESLint, Stylelint, CSS variable validation checks
alongside existing Go checks.

**CI** — add lint-frontend job, 58% Go coverage threshold.

**Claude Code config** — add .claude/rules/ with path-specific semantic rules
(Go, frontend JS, frontend CSS) that only contain things linters can't catch.
Add PostCompact hook to re-inject semantic reminders after context compaction.
Add Common Mistakes section to AGENTS.md. Add compaction guidance to CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Disable color-contrast (74 elements) and nested-interactive (6 elements)
rules for now — these are pre-existing issues, not regressions. The test
still catches new ARIA, keyboard, and structural violations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk marked this pull request as ready for review April 16, 2026 08:28
@tomasz-tomczyk tomasz-tomczyk merged commit 3246814 into main Apr 16, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the quality-guardrails branch April 16, 2026 08:41
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.

1 participant