Repository navigation
chore: migrate from Prettier to oxfmt and forge fmt - #2628
Open
philippzentner wants to merge 8 commits into
Open
philippzentner wants to merge 8 commits into
philippzentner wants to merge 8 commits into
Conversation
…undry.toml vetting
Contributor
|
Important Review skippedToo many files! This PR contains 334 files, which is 234 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Prettier is gone. TS/JS is now formatted by oxfmt and Solidity by
forge fmt. ESLint was already replaced by oxlint before this PR, so this PR only bumps oxlint.prettier,prettier-plugin-solidity,solhint-plugin-prettier,.prettierrc.cjsand.prettierignore.oxfmt0.76.0 and.oxfmtrc.json. Bumpedoxlint1.86.0 → 1.91.0 andoxlint-tsgolint→ 7.0.2006 (exact pins, as before)..oxlintrc.jsonis unchanged..solhint.json: removed theprettierplugin and theprettier/prettierrule.foundry.toml: new[fmt]section.format=oxfmt --check && forge fmt --check,format:fix=oxfmt && forge fmt. The script names stay the same.*.{ts,js}→oxfmt,*.sol→forge fmt(it skipssrc/, see below)..agents/hooks/post-edit-format.sh(oxfmt / forge fmt, skipssrc/),post-edit-validate.shcomment,.agents/factory/factory.yml(format: [bunx, oxfmt, --check]),.agents/context.md,.agents/rules/099-finish.md,.agents/rules/402-typescript-tests.md,CLAUDE.md,docs/TronFork.md,.vscode/*.default(oxc extension as the default formatter, forge for Solidity, prettier extension removed)..github/workflows/syncLedgerClearSigning.ymlanddocs/ClearSigningProposal.md: the Ledger registry fixture is now formatted withoxfmt(printWidth: 120, through--stdin-filepath) instead ofprettier. I checked the output againstprettier@3 --parser json --print-width 120onconfig/networks.json: it is byte-identical.script/deploy/codehash/checkout-foundry-config.tsallowlistsfoundry.tomlsections for the sign-time rebuild. It now allows[fmt], limited to the keys used here with typed values (ignoremust be a list of strings).forge builddoes not read[fmt].script/deploy/safe/propose-funnel-fence.test.ts: the lint-staged order assertion now expectsoxfmtfirst, where it expectedprettier --write.Config mapping
.oxfmtrc.json).prettierignoreignorePatternsts/jsignorePatternsstarts with*.*,!*.ts,!*.js, so a bareoxfmtalso formats only TS/JS. JSON/MD/YAML stay untouched:config/clearSigningProposal.jsonis compared byte-for-byte in CI.sortPackageJson: false*.soloverride)forge fmt([fmt])line_length = 79tab_width = 4quote_style = "double"bracket_spacing = trueint_types = "preserve",number_underscore = "preserve"Decision:
src/is not forge-formatted.forge fmtcannot reproduce prettier-solidity's layout, so it would have rewritten most audited contracts. That changes their audit source hashes and bytecode metadata.src/**andsrc/*.solare in[fmt] ignore.forge fmtignores that list for explicit file paths, so lint-staged and the agent hook skipsrc/themselves. Onlytest/andscript/Solidity is formatted.Rules not ported / downgraded
None. ESLint had already been removed, and the oxlint rule set is unchanged.
Reformat commits
6d4bb8astyle: reformat with oxfmt — 90 TS files, +335/−3412631351style: reformat test and script Solidity with forge fmt — 224 files intest/solidityandscript/, +8079/−12230. Nosrc/file is touched..git-blame-ignore-revs(4ecf3d1).Verification (local)
Formatting was done and checked with the pinned Foundry 1.7.1 (
.foundry-version). The local default was 1.9.0.oxfmt --check→ exit 0forge fmt --check→ exit 0bun lint:js(oxlint --type-aware .) → exit 0 (warnings only)bun lint:sol(solhint) → exit 0forge build→ exit 0bun --no-env-file test script/ tasks/→ 7238 pass, 1 fail. The failure (pinned-target-state.test.ts› remote-tracking ref) comes from my global git config. It passes withGIT_CONFIG_GLOBAL=/dev/null(98/98).tsc --noEmit(whole project, afterbun typechain:incremental) → 38 errors, all inscript/demoScripts/*. They were there before this PR; the reformat there is whitespace-only (git diff -wis empty).script/demoScripts/demoChainflip.tsalready failedtsconmain(4 errors: missing export,bigintvsBigNumber, undefinedlifiDiamondAddress, nullable hex). It is the only reformatted file that failsvalidate-scripts. I restored it frommainand added it to.oxfmtrc.jsonignorePatterns, with a comment saying why. The other demo-scripttscerrors are in files this PR doesn't touch.bunx tsx script/utils/validateScripts.ts(merge-base withorigin/main, the range CI checks) →Script validation passed.