Skip to content

chore(lint): add ESLint flat config so CodeRabbit can run it#5

Open
Jmeg8r wants to merge 1 commit into
mainfrom
chore/coderabbit-eslint
Open

chore(lint): add ESLint flat config so CodeRabbit can run it#5
Jmeg8r wants to merge 1 commit into
mainfrom
chore/coderabbit-eslint

Conversation

@Jmeg8r

@Jmeg8r Jmeg8r commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Adds ESLint to geekspace: a flat eslint.config.js, the eslint + typescript-eslint + eslint-plugin-react-hooks + eslint-plugin-react-refresh stack as devDependencies, and a lint script.

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 globals
  • convex/_generated/**, dist/, build/, release/ → ignored

Pinned to the ESLint 9 line to match viceroy and the rest of your repos (ESLint 10 is out, but @eslint/js@10 peer-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 🪛 ESLint tool section instead of skipping it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added a project-wide linting setup and a new lint command for easier code quality checks.
    • Updated development tooling to better support the app’s mixed browser and Node environments.
    • Improved packaging configuration for bundled desktop resources.

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>
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an ESLint 9 flat config, wires linting into package scripts and devDependencies, and reformats Electron Builder extraResources entries in package metadata.

Changes

ESLint tooling rollout

Layer / File(s) Summary
Package metadata
package.json
Adds the lint script, ESLint-related devDependencies, and multi-line extraResources objects.
Flat ESLint config
eslint.config.js
Exports a flat config with project ignores, browser rules for src/**/*.{ts,tsx}, Node rules for Electron/Convex/scripts/tests/config files, and a global no-undef override.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through lint with tidy feet,
Flat configs make the rules feel neat.
Node and React share the trail,
Convex crumbs and builds don’t fail.
Hooray, my whiskers twitch in tune! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding ESLint flat config and tooling to enable linting in the repo.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/coderabbit-eslint

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9c6912f and beb5ff3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • eslint.config.js
  • package.json

Comment thread eslint.config.js
Comment on lines +58 to +63
// 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" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.json

Repository: 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.

Suggested change
// 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.

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