chore(lint): add ESLint flat config + CI lint/build gate#6
Open
Builder106 wants to merge 1 commit into
Open
Conversation
Introduce a linter to the v3.0.0 React codebase. The setup is scoped to
src/ (the live app) and the Node build scripts; legacy dirs (frontend/,
electron/) and static sites (docs/, landing/) are ignored.
- eslint 9 flat config (eslint.config.mjs) with @eslint/js recommended +
eslint-plugin-react (jsx-runtime) + eslint-plugin-react-hooks
- `npm run lint` script
- .github/workflows/ci.yml — runs lint + frontend build on PRs and pushes
to main (full Tauri builds stay in the tag-triggered release.yml)
Baseline is green (0 errors). Two rules tuned to the codebase's intent:
allowEmptyCatch for deliberate `catch {}`, and react-hooks/set-state-in-effect
downgraded to a warning (intentional config→state sync in effects).
Also fixes one genuine bug the linter caught on first run: API.elevateNotchWindow
called a bare `invoke` that doesn't exist in api.js (every other method uses
tauriInvoke), which would throw ReferenceError at runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The repo has no linter today. This adds one to the v3.0.0 React codebase with a green baseline, plus a CI gate so future PRs get checked automatically.
Changes
eslint.config.mjs— ESLint 9 flat config:@eslint/jsrecommended +eslint-plugin-react(jsx-runtime) +eslint-plugin-react-hooks. Scoped tosrc/(the live app) and the Node build scripts; legacy dirs (frontend/,electron/) and static sites (docs/,landing/) are ignored.npm run lintscript + dev dependencies (eslint@^9, pinned below 10 foreslint-plugin-reactpeer compatibility)..github/workflows/ci.yml— runsnpm run lint+npm run build:frontendon PRs and pushes tomain. Full Tauri builds stay in the existing tag-triggeredrelease.yml.Baseline
Green — 0 errors, 19 warnings (pre-existing exhaustive-deps / unused-var advisories, left as non-blocking signal). Two rules tuned to the codebase's intent rather than rewriting working code:
no-empty: { allowEmptyCatch: true }— the deliberatecatch {}blocks are fine.react-hooks/set-state-in-effect: 'warn'— the app intentionally syncs external config into state inside effects; surfaced, not blocked.Bug caught on first run
ESLint immediately flagged a real one:
API.elevateNotchWindowinsrc/lib/api.jscalled a bareinvokethat isn't defined in the module (every other method usestauriInvoke), so calling it would throwReferenceErrorat runtime. Fixed in this PR (one line).Testing
npm run lint→ passes (exit 0)npm ci→ lockfile in syncnpm run build:frontend→ clean