chore(lint): add ESLint flat config so CodeRabbit can run it#5
Conversation
geekspace had no ESLint configured at all, so CodeRabbit had nothing to run. Add a flat eslint.config.js mapping the project's zones (Vite/React renderer under src, Node for electron/convex/scripts/mcp/tests, convex/_generated ignored), the eslint + typescript-eslint + react-hooks/react-refresh stack (pinned to the ESLint 9 line to match the other repos), and a lint script. CI (npm run verify = tsc + vitest) does not gate on lint, so this is non-breaking. Pre-existing violations surfaced by the linter are left for a follow-up; this change only makes the linter run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds an ESLint 9 flat config, wires linting into package scripts and devDependencies, and reformats Electron Builder ChangesESLint tooling rollout
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@eslint.config.js`:
- Around line 58-63: The global ESLint override in the config object under
`eslint.config.js` disables `no-undef` for all matched files, including plain
JS/MJS entrypoints and config files. Update that override so it applies only to
TypeScript sources (for example, the TS/TSX file patterns in the same config
block) and keep `no-undef` enabled for JS/MJS files such as the `electron`,
`scripts`, `mcp`, and `*.config` targets. Ensure the `rules` entry for
`no-undef` is removed or narrowed in the affected config object rather than
applied project-wide.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ac96e16c-a8fe-4482-8027-61c683619900
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
eslint.config.jspackage.json
| // TypeScript already flags undefined identifiers; the core no-undef rule | ||
| // produces false positives on TS and is explicitly not recommended by | ||
| // typescript-eslint, so turn it off project-wide. | ||
| { | ||
| files: ["**/*.{ts,tsx,mjs,js}"], | ||
| rules: { "no-undef": "off" }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
# Inspect eslint.config.js and find how .js/.mjs files are treated elsewhere.
git ls-files | sed -n '1,200p'
printf '\n--- eslint.config.js outline ---\n'
ast-grep outline eslint.config.js --view expanded
printf '\n--- relevant lines ---\n'
cat -n eslint.config.js | sed -n '1,140p'
printf '\n--- search for no-undef and file globs ---\n'
rg -n '"no-undef"|no-undef|\\*\\*/\\*\\.{ts,tsx,mjs,js}|\\.mjs|\\.js' eslint.config.js .eslintrc* package.jsonRepository: Jmeg8r/geekspace
Length of output: 6054
🏁 Script executed:
# Check whether JS/MJS files have separate overrides or parser settings that change the impact.
rg -n 'files:\s*\[.*(js|mjs|cjs|ts|tsx)|no-undef|languageOptions|globals|sourceType' -S .Repository: Jmeg8r/geekspace
Length of output: 1410
🏁 Script executed:
# Read the config region around the rule and nearby overrides.
cat -n eslint.config.js | sed -n '1,220p'Repository: Jmeg8r/geekspace
Length of output: 2784
Keep no-undef enabled for JS/MJS files. The global override at eslint.config.js:61-63 disables undefined-variable checks for plain JS/MJS too, including electron/*.mjs, scripts/*.{js,mjs}, mcp/*.{js,mjs}, and *.config.{js,mjs}. Scope it to TS/TSX only.
Suggested fix
{
- files: ["**/*.{ts,tsx,mjs,js}"],
+ files: ["**/*.{ts,tsx}"],
rules: { "no-undef": "off" },
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // TypeScript already flags undefined identifiers; the core no-undef rule | |
| // produces false positives on TS and is explicitly not recommended by | |
| // typescript-eslint, so turn it off project-wide. | |
| { | |
| files: ["**/*.{ts,tsx,mjs,js}"], | |
| rules: { "no-undef": "off" }, | |
| // TypeScript already flags undefined identifiers; the core no-undef rule | |
| // produces false positives on TS and is explicitly not recommended by | |
| // typescript-eslint, so turn it off project-wide. | |
| { | |
| files: ["**/*.{ts,tsx}"], | |
| rules: { "no-undef": "off" }, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@eslint.config.js` around lines 58 - 63, The global ESLint override in the
config object under `eslint.config.js` disables `no-undef` for all matched
files, including plain JS/MJS entrypoints and config files. Update that override
so it applies only to TypeScript sources (for example, the TS/TSX file patterns
in the same config block) and keep `no-undef` enabled for JS/MJS files such as
the `electron`, `scripts`, `mcp`, and `*.config` targets. Ensure the `rules`
entry for `no-undef` is removed or narrowed in the affected config object rather
than applied project-wide.
What
Adds ESLint to geekspace: a flat
eslint.config.js, theeslint+typescript-eslint+eslint-plugin-react-hooks+eslint-plugin-react-refreshstack as devDependencies, and alintscript.Why
CodeRabbit reported ESLint unavailable here — the repo had no ESLint configured at all. The config maps geekspace's zones:
src/**→ Vite/React renderer (browser globals, react-hooks + react-refresh rules)electron/ convex/ scripts/ mcp/ tests/→ Node globalsconvex/_generated/**,dist/,build/,release/→ ignoredPinned to the ESLint 9 line to match viceroy and the rest of your repos (ESLint 10 is out, but
@eslint/js@10peer-requires eslint 10 — staying on 9 keeps the fleet consistent and CodeRabbit-proven).Verification
npx eslint .now executes, surfacing 38 pre-existing problems (react-hooks violations, unused vars, etc.). These are intentionally left for a follow-up — this PR only makes the linter run. CI (npm run verify=tsc+vitest) does not gate on lint, so this is non-breaking.Proof for the original issue
After merge, CodeRabbit reviews here should show a
🪛 ESLinttool section instead of skipping it.🤖 Generated with Claude Code
Summary by CodeRabbit
lintcommand for easier code quality checks.