prettier-solidity / prettier-plugin-solidity

A Prettier plugin for automatically formatting your Solidity code.
https://t.me/+kgTgkFgIwJkwMjcx
MIT License
729 stars 73 forks source link

Wrong comments reformatting in `else if` statements #1035

Closed pcaversaccio closed 3 months ago

pcaversaccio commented 3 months ago

@Janther @fvictorio I tried the latest update 1.4.0 (can you please make a proper GitHub release with a CHANGELOG?) and the following gets reformatted (see here):

image

I think this is a bug? If not, please tell me how to configure it outside of the source file so it does not get formatted as I can't change the source file anymore.

fvictorio commented 3 months ago

Thanks for this @pcaversaccio. I think this shows that there are several things we need to improve.

Versioning

In terms of versioning, we do the same that Prettier does. This is not documented anywhere, although there is a very old discussion that sheds some light. Basically: semver doesn't really work for a formatter because you have a (input: string) => string API that can be interpreted as "any change is valid" or "any change is breaking". So in practice:

We should add a section to the Readme explaining this.

Releases

I'm 100% with @pcaversaccio in that we should start having proper GitHub releases that explain what's involved in every new version. IMO this can be done manually, at least for now, since the team is small and we don't publish new releases super often. Alternatively, something like changesets can be very useful. There's also workflows based on conventional commits, but I'm not a fan.

Frozen files

Ethereum projects have something very particular which is that, after deployments and/or audits, some files are effectively frozen. So you very likely don't want to re-format them. I don't have a good answer to this need, but some thoughts in descending order of preference: