You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, the filepath level. Personally I like to sort imports as forge-std > dependencies > test > script > src, then alphabetically by path within each of those categories. This is similar to the sort order suggested in python's style guide. I'm not sure of conventions in rust or elsewhere, but don't feel too strongly on the exact order here. Maybe we default to sorting imports like rustfmt and let users toggle that off?
Then with named imports. For example, import {foo, bar} from "src/Contract.sol" should become import {bar, foo} from "src/Contract.sol".
Probably can have a single sort-imports config item that covers both sort options.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Import order can effect build output in some rare instances.
Interesting, does it just affect the metadata hash? I'd be surprised if this affects the contract bytecode in some non-trivial way, curious to see more docs/info on this
Component
Forge
Describe the feature you would like
There's two levels of sorting here:
First, the filepath level. Personally I like to sort imports as forge-std > dependencies > test > script > src, then alphabetically by path within each of those categories. This is similar to the sort order suggested in python's style guide. I'm not sure of conventions in rust or elsewhere, but don't feel too strongly on the exact order here. Maybe we default to sorting imports like rustfmt and let users toggle that off?
Then with named imports. For example,
import {foo, bar} from "src/Contract.sol"
should becomeimport {bar, foo} from "src/Contract.sol"
.Probably can have a single
sort-imports
config item that covers both sort options.Additional context
No response
The text was updated successfully, but these errors were encountered: