Skip to content

fix(lint): migrate .eslintrc.js to ESLint 9 flat config - #9

Merged
chicks-net merged 1 commit into
deployfrom
fix/133-eslint-flat-config
Oct 31, 2026
Merged

chicks-net merged 1 commit into
deployfrom
fix/133-eslint-flat-config

Conversation

@chicks-net

Copy link
Copy Markdown
Member

Fixes the broken lint gate. npm run lint has failed on every invocation since ESLint was bumped to 9.x (commit aab881e) because the legacy .eslintrc.js was never migrated to flat config — so the repo has had no working lint gate at all, locally or in CI.

Refs chicks-net/chicks-projects#133

What changed

  • eslint.config.mjs replaces .eslintrc.js, preserving rule intent:
    • typescript-eslint recommended (type-aware parsing against tsconfig.json)
    • prettier via eslint-plugin-prettier/recommended + eslint-config-prettier
    • the legacy 'off' overrides kept (explicit-function-return-type, explicit-module-boundary-types, no-explicit-any)
    • @typescript-eslint/interface-name-prefix dropped — the rule was removed from typescript-eslint long before v8 and would fail config load
  • New devDeps (exact pins per repo convention): typescript-eslint@8.41.0 (umbrella with the flat configs/config() helpers) and globals@17.13.0 (ESLint 9 dropped env; node + jest globals now declared explicitly)
  • Ignore mapping: legacy ignorePatterns → flat global ignores — src/createChart.ts, __test__/**, script.js unchanged; __test__ stays deliberately unlinted to keep parity with the pre-migration effective behavior; dist/** added as hardening in case anyone runs a bare npx eslint .
  • First real lint run in months — 3 findings, all fixed:
    • src/handlers.ts ×2: unused catch (error) params → optional catch binding catch {} (the catches deliberately swallow and send a fallback SVG; tsc 5.9 downlevels the syntax for the es2017 target, verified)
    • src/utils.ts: one over-width line, reformatted per prettier
  • package.json scripts: lint glob simplified to src/**/*.ts (top-level styles/, types/, interfaces/ dirs don't exist — they live under src/), and --fix dropped from lint so it works as a real CI gate; new lint:fix keeps the autofix workflow
  • CI: npm run lint added to the Node.js workflow between npm ci and npm test — the natural gate now that CI runs on deploy PRs

Verification

  • ✅ npm run lint — clean (first passing run since the 9.x bump)
  • ✅ npm test — 16 passing, 4 suites (same as baseline)
  • ✅ npm run build — clean
  • ✅ npx prettier --check "src/**/*.ts" — all formatted, no .prettierrc changes

⚠️ Local dev note

Node 26.12.1 (current node on macOS/homebrew) has a native crash bug: any ESLint invocation dies with SIGABRT inside Node's own module-resolution code (ParsePackageJSON), before any config is even read. That's a Node bug, not this repo — nothing to fix here. Until Node patches it, run lint/tests with Node 22/24 (e.g. PATH="/opt/homebrew/opt/node@24/bin:$PATH" npm run lint). CI (Node 22.x) is unaffected.

ESLint 9 requires eslint.config.js (flat config); the legacy .eslintrc.js
was never migrated, so npm run lint has been broken since the eslint 9
bump - no working lint gate locally or in CI.

- Replace .eslintrc.js with eslint.config.mjs preserving rule intent:
  typescript-eslint recommended, type-aware parsing against tsconfig.json,
  prettier via eslint-plugin-prettier/recommended + eslint-config-prettier,
  and the legacy 'off' overrides (interface-name-prefix dropped - the rule
  no longer exists in v8 and would fail config load)
- Add missing devDeps: typescript-eslint (umbrella) and globals (ESLint 9
  dropped env; node+jest globals declared explicitly)
- Map legacy ignorePatterns to flat global ignores (__test__ stays
  deliberately unlinted; createChart.ts and script.js unchanged; dist
  added as hardening for bare 'eslint .' runs)
- Fix the 3 findings from the first real lint run in months: unused catch
  params in handlers.ts (optional catch binding; tsc downlevels it for
  the es2017 target) and one over-width line in utils.ts
- Simplify the lint glob to src/**/*.ts (top-level styles/types/interfaces
  dirs don't exist) and drop --fix so lint works as a CI gate; lint:fix
  keeps the autofix workflow
- Run npm run lint in the Node.js CI workflow between npm ci and npm test

Refs chicks-net/chicks-projects#133
@chicks-net
chicks-net merged commit 2d9bff5 into deploy Oct 31, 2026
2 checks passed
@chicks-net
chicks-net deleted the fix/133-eslint-flat-config branch October 31, 2026 22:21
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