Skip to content

build(solidity): migrate to ESLint 10 flat configs - #4302

Merged
piotr-roslaniec merged 11 commits into
codex/beacon-hardhat-verifyfrom
codex/solidity-eslint-10
Sep 13, 2026
Merged

build(solidity): migrate to ESLint 10 flat configs#4302
piotr-roslaniec merged 11 commits into
codex/beacon-hardhat-verifyfrom
codex/solidity-eslint-10

Conversation

@mswilkison

@mswilkison mswilkison commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Both Solidity packages depended on a Git-pinned ESLint configuration that cannot support the current ESLint line. This migrates them to ESLint 10 flat configs with typescript-eslint 8, import-x, and the focused-test guard, and removes the shared config dependency.

The flat configs carry forward the existing active non-React lint policy, including package-specific overrides and the existing warning severities. Prettier runs as a separate formatting check. Generated files are ignored; the auxiliary ECDSA script remains covered by a dedicated lint TypeScript project. Obsolete directives and import styles are updated without changing contract behavior.

Part of #4214; stacked on #4301. Prettier 3 and Solhint 6 follow separately so their dependency and formatting changes can be reviewed independently. This stack builds on #4208; #4217 enables CI for the stacked branch bases, and the runtime rollout is tracked by #4205.

Validation (Node 24.11.1): both packages pass their full lint commands, strict typechecks, and prepack builds. ESLint probes confirm authored tests are checked, generated output is ignored, focused Mocha tests fail, and ordinary tests pass. TypeScript emit comparison found only ordered task-registration imports, a built-in fs import hoist, and a Chai import reorder beyond comment/format changes; both full test suites passed on the prerequisite stack (955 beacon, 673 ECDSA, 44 existing pending).


Review follow-up

  • Formatting scope: lint:eslint (renamed lint:ts) now also runs prettier --check over JS/TS/MJS/CJS files. Previously only .sol and .json/.yaml were Prettier-checked in either package, so this is net-new enforcement, not a pre-existing check that moved.
  • Existing warnings: the pre-migration warning counts from Modernize the lint and format toolchain (eslint, prettier, solhint) #4214 (random-beacon 18+13, ecdsa 103+9) are accepted as-is, not fixed, to keep this config-migration diff reviewable on its own. A follow-up cleanup PR can address them if desired.
  • Per-package config duplication: the two ~530-line flat configs are intentionally not extracted into a shared module in this PR. Sibling repo tbtc-v2 solved the same problem with a shared solidity/eslint.rules.cjs (build: migrate Solidity tooling to ESLint 10 tbtc-v2#1132); doing the same here is a reasonable follow-up if these configs need to stay in sync going forward, but is out of scope for this migration.
  • Landed 4 follow-up commits addressing review findings: restored 9 error-severity core rules dropped from the shared-config transcription (no-new-func, no-promise-executor-return, no-unreachable-loop, no-dupe-else-if, no-unsafe-optional-chaining, no-useless-backreference, no-constructor-return, grouped-accessor-pairs, default-param-last - verified directly against the actual removed @thesis-co/eslint-config source, including the disallowArithmeticOperators option on no-unsafe-optional-chaining); added a committed ESLint policy regression test per package (asserts no-only-tests fires, typechain/** stays ignored, ordinary test files are actually linted); made random-beacon's no-await-in-loop: off explicit instead of silently unconfigured; and removed a stale npm lockfile still referencing the removed tarball dependency.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 53a67413-50d7-4f3d-8303-550b0935861a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

piotr-roslaniec and others added 7 commits September 12, 2026 17:17
- Add 9 missing error-severity core rules (no-new-func, no-promise-executor-
  return, no-unreachable-loop, no-dupe-else-if, no-unsafe-optional-chaining,
  no-useless-backreference, no-constructor-return, grouped-accessor-pairs,
  default-param-last) that were active under the old shared airbnb-based
  config but did not carry over to the flat config.
- Drop 3 default-value-only options (import/order's distinctGroup/
  sortTypesGroup/named, import/no-unresolved's caseSensitiveStrict,
  import/no-cycle's allowUnsafeDynamicCyclicDependency) that only restated
  plugin defaults and obscured this package's real differences from
  random-beacon's config.
- Add a committed ESLint policy regression test (scripts/test-eslint-
  policy.mjs) asserting no-only-tests fires, typechain/** stays ignored, and
  ordinary test files are actually linted - guards against a future config
  edit silently weakening any of the three.
- Rename lint:eslint/lint:fix:eslint to lint:ts/lint:fix:ts to match the
  domain-naming convention lint:sol/lint:config already use, since the
  script now also runs Prettier.
- Add 9 missing error-severity core rules (no-new-func, no-promise-executor-
  return, no-unreachable-loop, no-dupe-else-if, no-unsafe-optional-chaining,
  no-useless-backreference, no-constructor-return, grouped-accessor-pairs,
  default-param-last) that were active under the old shared airbnb-based
  config but did not carry over to the flat config.
- Add an explicit no-await-in-loop: off entry (with a comment noting ecdsa
  uses ["error"]) instead of leaving the rule silently unconfigured, since
  this package's eslint-disable guard comments for it were already removed
  by the parent migration.
- Remove two orphaned blank lines left behind where eslint-disable-next-line
  no-await-in-loop directives were deleted, one of which stranded an
  explanatory comment from the statement it described.
- Add a committed ESLint policy regression test (scripts/test-eslint-
  policy.mjs) asserting no-only-tests fires, typechain/** stays ignored, and
  ordinary test files are actually linted.
- Rename lint:eslint/lint:fix:eslint to lint:ts/lint:fix:ts to match the
  domain-naming convention lint:sol/lint:config already use.
solidity/ecdsa/package-lock.json (an npm lockfile in a Yarn-managed package)
still pinned the git-tarball @thesis-co/eslint-config dependency this PR
already removed from package.json, which would keep dependency scanners
reporting it as present. The package installs via yarn.lock; this file was
unused.
…ptional-chaining

Verified the actual removed @thesis-co/eslint-config source (github.com/
thesis/eslint-config@778365b) against upstream eslint-config-airbnb-base
15.0.0: no-unsafe-optional-chaining was active there as
['error', { disallowArithmeticOperators: true }], not the bare ['error']
this PR's earlier fix restored. Brings the rule back to full fidelity with
the original policy.
…unsafe-optional-chaining

Same fidelity fix as the sibling ecdsa commit: the actual removed
@thesis-co/eslint-config (via eslint-config-airbnb-base 15.0.0) set this
rule to ['error', { disallowArithmeticOperators: true }], not the bare
['error'] restored earlier.
…4304)

Both Solidity packages now use Solhint 6.2.4. The Git-pinned
`solhint-config-keep` dependency is replaced with explicit local rules,
preserving its error/warning policy and the existing
constructor/assembly overrides. The removed event-naming rule is
migrated to `event-name-capwords`.

Closes #4214 together with the prerequisite ESLint PR #4302 and Prettier
PR #4303. This is stacked on #4303. The stack depends on #4208;
coordinate the Node 24 runtime rollout in #4205 and stacked-branch CI
support in #4217 before merging the toolchain stack.

Warnings remain deliberately non-blocking in this migration. Solhint 6
reports 14 beacon and 12 ECDSA warnings, primarily declaration ordering
and state counts, with no errors. The new analyzer detects a few
additional ordering cases; the existing error rules are not weakened to
accommodate the upgrade. ESLint's existing warning policy is likewise
retained in #4302.

Validation: both packages pass Solidity lint and formatting/config
checks. Targeted probes confirm missing state visibility still fails,
valid source passes, and event naming remains a warning. No contract or
TypeScript source changes are included. The preceding stack passed
strict typechecks, prepack, fresh TypeChain generation, full lint,
comparison of all 159 contract ABIs/runtimes and emitted JavaScript, and
both functional suites (955 beacon and 673 ECDSA, 44 existing pending).
Both Solidity packages now use Prettier 3 and prettier-plugin-solidity
2, with explicit plugin loading and `trailingComma: "all"`. ECDSA's
shell-formatting plugin is updated to the compatible line. The first
commit contains only dependency/configuration changes; the second
contains only formatter output.

Part of #4214; stacked on #4302 (ESLint 10). Solhint 6 follows in the
final toolchain PR. This stack builds on #4208; stacked-branch CI is
addressed by #4217, and Node 24 rollout by #4205.

Validation on Node 24.11.1:
- Both packages pass a forced Solidity rebuild with the generated
TypeChain directories removed, strict typechecks, prepack, and full
lint.
- All 159 compiled contract ABIs and deployed runtime bytecodes are
identical to the baseline after stripping Solidity metadata. Both
packages regenerate TypeChain successfully with Prettier 3 installed
(166 beacon and 218 ECDSA typings).
- All 108 reformatted TypeScript files preserve emitted JavaScript apart
from whitespace.
- The prerequisite functional stack passed all 955 beacon and 673 ECDSA
tests (44 existing pending). The formatting-only changes are
additionally covered by the ABI/runtime and JavaScript comparisons
above.
@piotr-roslaniec
piotr-roslaniec merged commit bbda6be into codex/beacon-hardhat-verify Sep 13, 2026
17 checks passed
@piotr-roslaniec
piotr-roslaniec deleted the codex/solidity-eslint-10 branch September 13, 2026 12:12
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.

2 participants