Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remappings): ✨ fallback to forge auto-remappings #47

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cruzdanilo
Copy link

when remappings.txt is absent and foundry.toml config doesn't have any remapping, fallback to forge auto-generated remappings.

apart from being a good fallback, many developers even prefer this approach. as an example, here is a quote from coinbase solidity style guide:

1. Avoid custom remappings.

Remappings help Forge find dependencies based on import statements. Forge will automatically deduce some remappings, for example

forge-std/=lib/forge-std/src/
solmate/=lib/solmate/src/

We should avoid adding to these or defining any remappings explicitly, as it makes our project harder for others to use as a dependency. For example, if our project depends on Solmate and so does theirs, we want to avoid our project having some irregular import naming, resolved with a custom remapping, which will conflict with their import naming.

source: https://github.com/coinbase/solidity-style-guide?tab=readme-ov-file#1-avoid-custom-remappings

@gas1cent gas1cent self-requested a review April 4, 2024 11:25
@gas1cent
Copy link
Member

gas1cent commented Apr 4, 2024

Hey @cruzdanilo! Thanks for the PR, letting foundry figure out the remappings sounds like a great idea! We're in the process of overhauling the CLI and will get back to this PR a bit later.

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.

4 participants