-
Notifications
You must be signed in to change notification settings - Fork 76
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
Don't re-write import * as ... from ...
#662
Comments
+1 to not adding new options. If I may suggest, these kind of transformations are more useful in a linter (solhint?), where it works with the user to educate/produce better code. For formatting, I think it should focus on just layout/whitespaces. |
Out of curiosity @fvictorio why are we formatting it this way? is it based on how we read the AST? |
It can be either a thing we did (consciously or not), or it could be that the AST doesn't have enough information to tell apart between these semantically equivalent statements. |
Found another one: |
I actually do not think they are semantically the same wrt the solidity compiler, i think if you do: import * as {Bar} from "./Bar.sol" and import "./Bar.sol" as Bar; they are the same? Imports are not 1:1 wrt the javascript module spec which solidity states its suppose to model after (as you can import via URL) https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system |
This
is re-written as
Those two statements are (I think?) semantically equivalent, but I think this is too opinionated. We should keep in mind that prettier solidity is not only being used by smart contract developers. For example, @OmarTawfik is considering using it to generate snippets in an upcoming solidity specification, and re-writes like this one make it impossible to use for that use case.
We could have an option for this, but I think at this point everyone knows I really, really don't like adding new options 😅
The text was updated successfully, but these errors were encountered: