Repository navigation
Description
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
- 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.
- As a maintainer, I want one flat config file, so that I use the only config format ESLint 10 reads.
- As a maintainer, I want
eslint-config-react-appgone, so that lint does not depend on an unmaintained preset or print its Babel warning on every run. - 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.
- As a maintainer, I want the
resolutionspins on typescript-eslint removed, so thatpackage.jsoncarries no workaround for a package that is no longer installed. - 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.
- As a contributor, I want JSX children checked for indentation, so that JSX follows the same indentation rule as the rest of the code.
- As a contributor, I want semicolons and single quotes enforced by lint, so that the style the Prettier config describes is actually checked.
- As a contributor, I want
yarn lint:fixto repair every formatting report, so that I never fix whitespace or quotes by hand. - As a contributor, I want type imports kept separate and top-level, so that import blocks stay in the current style.
- As a contributor, I want unused variables reported unless they start with an underscore, so that the existing convention for ignored bindings keeps working.
- 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.
- 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.
- As a contributor, I want a
shortcut:comment to fail lint, so that the existing debt gate stays in force. - As a contributor, I want full-package lodash imports to fail lint, so that the existing import-scope rule stays in force.
- 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.
- 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.
- As a contributor, I want empty function bodies allowed, so that test stubs and deliberate no-op defaults need no workaround.
- 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. - 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.
- 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.
- As a maintainer, I want CI to keep calling
yarn lintunchanged, so that no workflow needs editing. - 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.
- 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-importunchanged. - Base presets:
@eslint/jsrecommended, typescript-eslintrecommendedandstylistic. No type-checked presets. No@electron-toolkitor 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.jsin 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
srcis TypeScript, whereno-undefis 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-appand 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). Theresolutionspins on@typescript-eslint/*are removed. -
eslint-plugin-import-xis registered under its own key. Rule names and every reference to them becomeimport-x/*; nothing is aliased to the oldimport/*names. -
import-x/no-cycleneeds the plugin's TypeScript settings and a resolver that knows the.tsand.tsxextensions. 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' ] } ) ], },
- The four formatting rules move from ESLint core to
@stylistic/eslint-pluginwith 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/indentis 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) andimport-x/consistent-type-specifier-style(top-level).@typescript-eslint/no-unused-varswith the current options, including the underscore ignore patterns.prefer-destructuring(objects only),no-warning-commentsforshortcut:,lodash/import-scope,import-x/no-cycle.
Rules dropped from the old config (#329)
@typescript-eslint/array-type,@typescript-eslint/consistent-type-definitionsand@typescript-eslint/no-explicit-any: the presets set them identically, so the explicit entries go.- The "full typing" block:
@typescript-eslint/explicit-module-boundary-typesand both catch-clauseno-restricted-syntaxselectors. Nothing replaces them. - The override for the
e2etree, 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-unreachableis switched back on for TypeScript files.- Hooks: the full
recommendedset ofeslint-plugin-react-hooksv7, including its React Compiler rules. - Everything else the old preset enforced is let go, including the accessibility rules, the
react/*rules, the eval family andno-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 onerequirein the pack test to animport; if the test then cannot load that module, keep therequirewith an inline disable and a reason). @typescript-eslint/no-unsafe-declaration-mergingstays 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-constand 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 lintpasses at the end of each.- 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.
- 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
lintandlint:fixscripts and both CI workflows that callyarn lintdo not change. - Agent docs: the sentence in the TypeScript leaves doc that requires explicit return types and cites
explicit-module-boundary-typesis 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.jsin 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 theyarn lintfile 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
srcwith the other shell-config tests and follows the same child-process pattern. - The existing Vitest suite and
yarn typecheck:baselinemust 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
e2eandscriptstrees. 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/js10.0.1, typescript-eslint 8.73.0,eslint-plugin-import-x4.18.1,eslint-plugin-react-hooks7.1.1,eslint-plugin-lodash8.1.0,@stylistic/eslint-plugin6.0.1.@stylistic/eslint-plugin6 was released days before the measurement; 5.10 gave the same reports and is an acceptable pin if 6 misbehaves. eslint-plugin-lodashdeclares 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
importin 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.
Activity
jtklein-agents commentedon Nov 23, 2026
Spec PR: AntonelliLab#512. Close this when it merges.