Closed remedcu closed 1 month ago
This turned out to be more complex than I initially anticipated; the prettier plugin I mentioned doesn’t work with solidity out of the box because it’s missing a parser. Therefore I see three possible solutions:
I’m personally leaning towards option 2. What do you think?
EDIT: Foundry can only sort imports alphabetically, so it is impossible to use it, leaving 1 and 3 as the only options. Going with 1 will imply adjusting the complexity from 2 to 5/8
We decided to close this issue because it's not worth the effort, and no tool exists that can help us achieve the desired outcome out of the box.
solhint
now has import ordering based on the path: https://github.com/protofire/solhint/blob/develop/CHANGELOG.md#503---2024-08-03
Context / issue
While working on creating Interfaces for Safe, importing order inconsistency was found.
Proposed solution
Using a npm package like: https://github.com/trivago/prettier-plugin-sort-imports with settings mentioned in like: https://github.com/foundry-rs/foundry/issues/3396 (Thanks to @mmv08 for finding it out!)
Alternatives
Doing it manually. It can become a tedious process in the long run though.
Additional context
Initial discussion took place here: https://github.com/safe-global/safe-contracts/pull/722#discussion_r1453148827