Skip to content

feat(fmt): use nearest project configs - #16064

Merged
figtracer merged 3 commits into
foundry-rs:masterfrom
figtracer:fig/fmt-nearest-config
Aug 7, 2026
Merged

feat(fmt): use nearest project configs#16064
figtracer merged 3 commits into
foundry-rs:masterfrom
figtracer:fig/fmt-nearest-config

Conversation

@figtracer

@figtracer figtracer commented Aug 7, 2026

Copy link
Copy Markdown
Member

Motivation

forge fmt applies one config to every input, making mixed-config Solidity monorepos require separate invocations.

Closes #5686.

Solution

Add forge fmt --nearest to resolve each file's nearest foundry.toml, including its formatter settings and ignore rules. Existing behavior is unchanged without the flag.

Validation

  • CLI coverage for per-project formatting, nested ignore ownership, and config conflicts.
  • sablier-labs/evm-monorepo: 645 files across 6 projects matched independent --root runs byte-for-byte; its ignored deployed source remained untouched.
  • latticexyz/mud: 495 files across 25 projects matched independent --root runs byte-for-byte, including 487 reformatted files.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@figtracer
figtracer marked this pull request as ready for review August 7, 2026 11:01
mablr
mablr previously approved these changes Aug 7, 2026

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, some non-blocking suggestions...

Comment thread crates/forge/src/cmd/fmt.rs
Comment thread crates/forge/src/cmd/fmt.rs
Comment thread crates/forge/tests/cli/fmt.rs Outdated
@figtracer
figtracer merged commit 3e56b92 into foundry-rs:master Aug 7, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

forge fmt with nearest foundry.toml

3 participants