Skip to content

Spec: move lint to ESLint 10 on a flat config #333

Closed
2 of 2 issues completed
Closed

Description

@jtklein-agents

Problem Statement

yarn lint runs ESLint 8.57 from an .eslintrc.cjs that extends eslint-config-react-app, the preset of the unmaintained Create React App. As a maintainer I am stuck on an ESLint major that is past its end of life, on a config format ESLint 10 no longer reads, and on a preset that will never be updated. Four of my formatting rules are deprecated ESLint core rules that are scheduled for removal in ESLint 11.

The current setup also hides gaps. The cycle check (import/no-cycle) reports nothing on a real TypeScript import cycle, so it has been checking nothing. Semicolons and quote style are written down in a Prettier config that no script runs, so nothing enforces them. Several plugins the config depends on are installed only as side effects of the preset.

Solution

yarn lint runs ESLint 10 from one flat config, eslint.config.js, written for this Electron app: a thin, maintained base (@eslint/js recommended, typescript-eslint recommended and stylistic), blocks for each process (shell main, preload, page, tests, config files), and the repo's own code style on top. Every plugin the config uses is a direct dependency. The code style I care about is enforced by maintained rules, the cycle check actually works, and a test proves the important rules fire.

The command, its arguments and the CI jobs stay the same. The tree passes yarn lint with zero warnings at the end.

User Stories

  1. As a maintainer, I want lint to run on ESLint 10, so that I am on a supported major and not blocked from future plugin updates.
  2. As a maintainer, I want one flat config file, so that I use the only config format ESLint 10 reads.
  3. As a maintainer, I want eslint-config-react-app gone, so that lint does not depend on an unmaintained preset or print its Babel warning on every run.
  4. As a maintainer, I want every plugin the config uses listed as a direct dependency, so that removing an unrelated package cannot silently remove a lint rule.
  5. As a maintainer, I want the resolutions pins on typescript-eslint removed, so that package.json carries no workaround for a package that is no longer installed.
  6. As a contributor, I want indentation, trailing commas, spaces inside parentheses and multiline ternaries enforced exactly as today, so that the code style of the tree does not change under me.
  7. As a contributor, I want JSX children checked for indentation, so that JSX follows the same indentation rule as the rest of the code.
  8. As a contributor, I want semicolons and single quotes enforced by lint, so that the style the Prettier config describes is actually checked.
  9. As a contributor, I want yarn lint:fix to repair every formatting report, so that I never fix whitespace or quotes by hand.
  10. As a contributor, I want type imports kept separate and top-level, so that import blocks stay in the current style.
  11. As a contributor, I want unused variables reported unless they start with an underscore, so that the existing convention for ignored bindings keeps working.
  12. As a contributor, I want an import cycle between TypeScript files to fail lint, so that the cycle check protects the page store and the shell as it was meant to.
  13. As a contributor, I want the React hooks rules enforced on page code, so that a hook called conditionally or outside a component fails lint.
  14. As a contributor, I want a shortcut: comment to fail lint, so that the existing debt gate stays in force.
  15. As a contributor, I want full-package lodash imports to fail lint, so that the existing import-scope rule stays in force.
  16. As a contributor, I want loose equality, a callback that forgets to return, a thrown literal, a self-comparison and a template placeholder in a plain string to fail lint, so that the bug-catching rules worth keeping from the old preset survive it.
  17. As a contributor, I want unreachable code to fail lint in TypeScript files, so that it is caught even though the TypeScript config does not report it.
  18. As a contributor, I want empty function bodies allowed, so that test stubs and deliberate no-op defaults need no workaround.
  19. As a contributor, I want the rule names in lint output to match the installed plugins (import-x/*, @stylistic/*), so that a report tells me which plugin's documentation to read.
  20. As a maintainer, I want a test that proves the cycle, hooks, semicolon and quote rules report on a known-bad fixture, so that a rule that stops firing is noticed instead of passing silently.
  21. As a maintainer, I want the hand-written code fixes to land separately from the mechanical config swap, so that I can review behaviour-bearing changes on their own.
  22. As a maintainer, I want CI to keep calling yarn lint unchanged, so that no workflow needs editing.
  23. As an agent working a ticket, I want the agent docs to stop citing a lint rule that no longer exists, so that I do not chase a requirement lint does not enforce.
  24. As a maintainer, I want lint to stay as fast as today or faster, so that the pre-PR loop does not slow down.

Implementation Decisions

Each decision links the map ticket that holds its detail and evidence.

Target and base (#326, #322, #324)

  • ESLint 10. The fallback, only if implementation hits a blocker the prototype did not, is ESLint 9 with eslint-plugin-import unchanged.
  • Base presets: @eslint/js recommended, typescript-eslint recommended and stylistic. No type-checked presets. No @electron-toolkit or neostandard dependency.
  • The typescript-eslint parser parses every linted file, including the two JavaScript config files. No Babel parser.

Config shape (#328)

  • One eslint.config.js in this order: global ignores; base presets; per-process blocks that set globals for shell main, preload, page, tests and config files; one block with the repo's style rules for every file; the hooks preset for page code; one block of TypeScript rules.
  • The per-process blocks are hand-written. Every file under src is TypeScript, where no-undef is off, so today they bind globals only for the two JavaScript config files; they stay to mark the process boundaries.
  • The starting point is the accepted draft on the throwaway branch prototype/eslint-flat-config. It predates the rule decisions below, so it is adjusted to them, not copied.

Plugins (#326)

  • Added as direct dev dependencies: @eslint/js, typescript-eslint (the single package, replacing the two @typescript-eslint/* packages), @stylistic/eslint-plugin, eslint-plugin-import-x, eslint-plugin-react-hooks, globals.

  • Kept: eslint-plugin-lodash.

  • Removed: eslint-config-react-app and everything only it brought in (eslint-plugin-import, eslint-plugin-react, eslint-plugin-jsx-a11y, the Flow, Jest and Testing Library plugins, the Babel parser). The resolutions pins on @typescript-eslint/* are removed.

  • eslint-plugin-import-x is registered under its own key. Rule names and every reference to them become import-x/*; nothing is aliased to the old import/* names.

  • import-x/no-cycle needs the plugin's TypeScript settings and a resolver that knows the .ts and .tsx extensions. Without them it passes while checking nothing. The prototype used the plugin's built-in node resolver; no extra resolver package was needed. From the prototype:

    settings: {
      ...importX.flatConfigs.typescript.settings,
      'import-x/resolver-next': [ createNodeResolver( { extensions: [ '.ts', '.tsx', '.js', '.mjs', '.json' ] } ) ],
    },

Formatting rules (#327, #325)

  • The four formatting rules move from ESLint core to @stylistic/eslint-plugin with their current options: @stylistic/indent (2 spaces, switch cases indented once), @stylistic/comma-dangle (always on multiline), @stylistic/space-in-parens (always), @stylistic/multiline-ternary (always).
  • Added: @stylistic/semi (always) and @stylistic/quotes (single, escapes may switch quote style).
  • @stylistic/indent is not configured to skip JSX. Its 22 reports on JSX children and the 20 quote reports are fixed with the autofix.
  • Prettier and its config are not touched and take over no formatting.

Rules kept from the old config (#329)

  • @typescript-eslint/consistent-type-imports (separate type imports) and import-x/consistent-type-specifier-style (top-level).
  • @typescript-eslint/no-unused-vars with the current options, including the underscore ignore patterns.
  • prefer-destructuring (objects only), no-warning-comments for shortcut:, lodash/import-scope, import-x/no-cycle.

Rules dropped from the old config (#329)

  • @typescript-eslint/array-type, @typescript-eslint/consistent-type-definitions and @typescript-eslint/no-explicit-any: the presets set them identically, so the explicit entries go.
  • The "full typing" block: @typescript-eslint/explicit-module-boundary-types and both catch-clause no-restricted-syntax selectors. Nothing replaces them.
  • The override for the e2e tree, which lint never reads.

Rules carried over from the old preset as explicit entries (#329, #323)

  • Bug-catching: eqeqeq (smart), array-callback-return, no-throw-literal, no-self-compare, no-template-curly-in-string.
  • Style: import-x/first, no-useless-rename, no-useless-computed-key, no-useless-concat, @typescript-eslint/no-useless-constructor.
  • no-unreachable is switched back on for TypeScript files.
  • Hooks: the full recommended set of eslint-plugin-react-hooks v7, including its React Compiler rules.
  • Everything else the old preset enforced is let go, including the accessibility rules, the react/* rules, the eval family and no-restricted-globals.

Reports from the new presets (#330)

  • Switched off: @typescript-eslint/no-empty-function, @typescript-eslint/class-literal-property-style.
  • Fixed in code (17 reports): no-case-declarations (wrap the case bodies in braces), no-useless-assignment (remove the dead assignments), @typescript-eslint/prefer-for-of, no-empty (a comment in the empty catch block saying why the error is ignored), @typescript-eslint/no-require-imports (convert the one require in the pack test to an import; if the test then cannot load that module, keep the require with an inline disable and a reason).
  • @typescript-eslint/no-unsafe-declaration-merging stays on, with one inline disable and a reason at the deliberate interface and class merge in the alignment store.
  • The remaining small autofixable reports (prefer-const and four typescript-eslint stylistic rules, 8 in total) are fixed with the autofix.

Slicing (#331)

  • Two implementation tickets on this spec's feature branch. yarn lint passes at the end of each.
    1. Code fixes ahead of the swap: the 17 hand fixes. They are valid under today's ESLint 8 config. This is the only ticket that changes behaviour-bearing code.
    2. The swap, blocked by ticket 1: the new config, removal of the old one, the dependency changes, the autofixes, the inline disable, the new test, and the doc edit.
  • The lint and lint:fix scripts and both CI workflows that call yarn lint do not change.
  • Agent docs: the sentence in the TypeScript leaves doc that requires explicit return types and cites explicit-module-boundary-types is removed. That doc is excluded from git on the working clone, so the edit is local and not part of the pull request. No other agent doc restates a changed rule.

Testing Decisions

A good test here checks what lint reports from the outside, through the real config, and does not assert on the config object's contents. Asserting that a rule name appears in the config would have passed for the dead cycle check; only a report on a known-bad input proves a rule works.

  • Seam 1: yarn lint. It runs on every pull request with zero warnings allowed. Passing on the migrated tree is the main acceptance check for both tickets. No new code.
  • Seam 2: one new Vitest test that proves the rules fire. It lints a small known-bad fixture through the real eslint.config.js in a child Node process and asserts a report for each of: a two-file TypeScript import cycle (import-x/no-cycle), a hook called outside a component (react-hooks/rules-of-hooks), a missing semicolon (@stylistic/semi), a double-quoted string (@stylistic/quotes). The fixture must be linted under the page block's rules yet stay out of the yarn lint file set, so the normal run stays clean; how is the implementer's choice.
  • Prior art: the source-maps test, which loads the shell build config in a child Node process and asserts on what it produces. The new test lives under src with the other shell-config tests and follows the same child-process pattern.
  • The existing Vitest suite and yarn typecheck:baseline must still pass after ticket 1, since it edits production code. The typecheck baseline is rewritten only where a fix changes a diagnostic's fingerprint.

Out of Scope

  • Upgrading the Electron shell dependencies (electron-builder, @sentry/electron, electron-log, electron-store, electron-download) or moving the shell's main process to ESM.
  • Type-aware linting (the type-checked typescript-eslint presets).
  • Linting the e2e and scripts trees. The linted file set stays as it is.
  • Changing Prettier's role, its config, or the import-line-length script.
  • Replacing the accessibility or react/* rules that leave with the old preset.
  • Changing tsconfig.json.

Further Notes

  • This spec is the destination of the wayfinder map #321; the tickets linked above hold the evidence behind each decision.
  • Measured on the prototype (ESLint 10.15.0, 156 files): the draft config reported 166 issues, 50 autofixable, and ran in about 3.0 s against about 4.8 s for today's lint (one run each). Every rule kept from the old config, the lodash rule, the cycle rule and all hooks rules reported nothing on the real tree.
  • Versions the prototype ran with: @eslint/js 10.0.1, typescript-eslint 8.73.0, eslint-plugin-import-x 4.18.1, eslint-plugin-react-hooks 7.1.1, eslint-plugin-lodash 8.1.0, @stylistic/eslint-plugin 6.0.1. @stylistic/eslint-plugin 6 was released days before the measurement; 5.10 gave the same reports and is an acceptable pin if 6 misbehaves.
  • eslint-plugin-lodash declares support for ESLint 9 and above without evidence of testing on 10. Its one rule in use worked on 10 in the prototype.
  • Not verified: whether the import in the pack test loads its module (a fallback is written into the decision), and the counts for the ten rules carried over from the old preset under the new config. They report nothing under today's config with the same options.
  • ESLint core plans to remove the deprecated formatting rules in ESLint 11; after this spec the repo no longer uses them.

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    ready-for-agent
    on Nov 23, 2026
  2. jtklein-agents commented on Nov 23, 2026

    @jtklein-agents
    OwnerAuthor

    Spec PR: AntonelliLab#512. Close this when it merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions