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

Don't add `external` modifier to fallback functions #778

Open fvictorio opened 1 year ago

fvictorio commented 1 year ago

This:

contract Foo {
  fallback() {}
}

when formatted, gets an added external modifier. This is useful in a lot of situations, but I don't think we should do it. In the same vein as issues like #662, we should avoid making this kind of non-strictly-formatting change.

Janther commented 1 year ago

the printer doesn't make that decision. We print exactly the visibility that the parser gives us.

https://github.com/prettier-solidity/prettier-plugin-solidity/blob/f927935dc8c0ce4a0da06b5a7df6063fe81ba9bc/src/nodes/FunctionDefinition.js#L110

https://github.com/prettier-solidity/prettier-plugin-solidity/blob/f927935dc8c0ce4a0da06b5a7df6063fe81ba9bc/src/nodes/FunctionDefinition.js#L57-L60

fvictorio commented 1 year ago

I will open an issue in the parser about this.

fvictorio commented 1 year ago

https://github.com/solidity-parser/parser/issues/76