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

Imports Ordering for Contracts #731

Closed
remedcu opened this issue Jan 16, 2024 · 2 comments
Closed

Imports Ordering for Contracts #731

remedcu opened this issue Jan 16, 2024 · 2 comments
Assignees

Comments

@remedcu
Copy link
Member

remedcu commented Jan 16, 2024

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: foundry-rs/foundry#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: #722 (comment)

@remedcu remedcu self-assigned this Jan 18, 2024
@mmv08 mmv08 self-assigned this May 13, 2024
@mmv08
Copy link
Member

mmv08 commented May 13, 2024

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:

  1. Fork and adjust the plugin to support solidity (I think it’s doable by reusing the existing solidity parser) -> this would imply maintaining the plugin
  2. Use foundry instead of prettier for formatting solidity contracts
  3. Continue without import sorting

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

@mmv08
Copy link
Member

mmv08 commented May 15, 2024

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.

@mmv08 mmv08 closed this as completed May 15, 2024
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

No branches or pull requests

2 participants