Skip to content

Releases: prettier-solidity/prettier-plugin-solidity

v1.1.0

15 Dec 05:05
372fcf4
Compare
Choose a tag to compare

With this version, we are releasing a standalone build (#727).
It follows the same patterns Prettier uses for their internal plugins such as UMD.
Hopefully this will make integration for projects based on the browser easy and will be automatically shipped on each release to http://unpkg.com/prettier-plugin-solidity@latest.

We also took care of a small bug that would print an extra line when formatting solidity code within a markdown code block (#765).

v1.0.0

17 Nov 12:40
Compare
Choose a tag to compare

We are happy to release the first stable version of Prettier Solidity! 🎉 🎉

What does this mean for you as a user? Semantic versioning doesn't make a lot of sense for a formatter, so it's hard to give hard rules about what will be the meaning of future versions. But we'll try to follow these guidelines:

  • We won't make big formatting changes within the same major version. For example, you shouldn't get all your function signatures changed just because you upgraded to, say, v1.1.0.
  • We won't remove any option within the same major version.
  • We'll use patch versions (e.g., moving from 1.2.3 to 1.2.4) for bug fixes and very minor formatting changes.
  • We'll use minor versions (e.g., moving from 1.2.3 to 1.3.0) for new language constructs, new options (if any) and somewhat bigger formatting changes.

What separates a "very minor formatting change" from a "bigger one" is hard to define precisely, of course, so some of these decisions will be very subjective, but we'll try to do our best.

Thanks for using our plugin and remember to star the repo! ⭐

v1.0.0-rc.1

02 Nov 09:21
3e61cab
Compare
Choose a tag to compare

This is our first release candidate for a stable v1.0.0!

This version includes some significant changes:

  • We removed the explicitTypes option, since we believe that this belongs to a linter. The behavior now is the same one that you would get if using explicitTypes: "preserve", meaning that we'll never convert an uint to an uint256 or vice versa.
  • In previous versions, the parameters of a function definition would always be split if there were more than two of them. Starting now, we only split them if the line doesn't fit in line-width. Plus, the way this works is that first the parameters are split, then the modifiers (if they also don't fit in a single line), and finally the return parameters (also only if they don't fit).
  • The exponentiation operator (**) now has spaces around it. This is more consistent with other operators, and it looks better for long variable names (that is, base ** decimals is better than base**decimals). We do know that this is not as nice for some cases (2 ** 10), but we are erring on the side of consistency and a better worst-case scenario.

As an example, a function like this:

contract Foo {
  function f(uint x, uint y, uint z) mod1 mod2 { x**y**z; }
}

would be formatted in the previous version like this:

contract Foo {
    function f(
        uint256 x,
        uint256 y,
        uint256 z
    ) mod1 mod2 {
        x**y**z;
    }
}

and now it will be formatted like this:

contract Foo {
    function f(uint x, uint y, uint z) mod1 mod2 {
        x ** y ** z;
    }
}

Please upgrade to the latest version and let us if you find any issues!

v1.0.0-dev.22

11 Jul 03:41
Compare
Choose a tag to compare

This new release provides some bug fixes and new formatting added by solidity.

#643
#683
#685
#693
#694

v1.0.0-beta.19

11 Nov 19:37
fe8ebda
Compare
Choose a tag to compare
v1.0.0-beta.19 Pre-release
Pre-release

Changes in this version:

  • 🔧 node 12 is no longer supported. #598 thanks @mattiaerre
  • 🐛 fixed bug for pragma statements containing multiple versions. #583 thanks @fvictorio
  • ✨ added support for user defined types. #607 thanks @zemse

v1.0.0-beta.18

09 Sep 20:49
976da5c
Compare
Choose a tag to compare
v1.0.0-beta.18 Pre-release
Pre-release

Description

v1.0.0-beta.17

21 Jul 02:31
4fbf978
Compare
Choose a tag to compare
v1.0.0-beta.17 Pre-release
Pre-release

This release contains 2 main improvements:

  • indentation in chained elements:
// v1.0.0-beta.16
uint foo = someLongFunction(
    foo,
    bar,
    baz
)
.someOtherFunctionA(
    foo,
    bar,
    baz
)
.someOtherFunctionB(
    foo,
    bar,
    baz
)

// v1.0.0-beta.17
uint foo = someLongFunction(
    foo,
    bar,
    baz
)
    .someOtherFunctionA(
        foo,
        bar,
        baz
    )
    .someOtherFunctionB(
        foo,
        bar,
        baz
    )
  • Bug fix for long variable declarations
// input
function isAuthorized(
    bytes32 serviceId,
    address client
) external view override returns (bool) {
    WhitelistStatus storage whitelistStatus = serviceIdToClientToWhitelistStatus[serviceId][client];
    return true;
}

// v1.0.0-beta.16
function isAuthorized(bytes32 serviceId, address client)
    external
    view
    override
    returns (bool)
{

        WhitelistStatus storage whitelistStatus
     = serviceIdToClientToWhitelistStatus[serviceId][client];
    return true;
}

// v1.0.0-beta.17
function isAuthorized(bytes32 serviceId, address client)
    external
    view
    override
    returns (bool)
{
    WhitelistStatus
        storage whitelistStatus = serviceIdToClientToWhitelistStatus[
            serviceId
        ][client];
    return true;
}

Special thanks to @acenolaza (#564) and @passabilities (#562) for their help.

v1.0.0-beta.16

15 Jul 20:49
b488f73
Compare
Choose a tag to compare
v1.0.0-beta.16 Pre-release
Pre-release

This release contains a bug fix and an improvement in our opinionated standardised code.

  • (#557) We fixed a problem in our indentation in MemberAccess chains.
// input
int256 amount = SafeCast.toInt256(amount.mul(10**(18 - underlyingAssetDecimals))).neg();

// v1.0.0-beta.15
int256 amount = SafeCast
.toInt256(amount.mul(10**(18 - underlyingAssetDecimals)))
.neg();

// v1.0.0-beta.16
int256 amount = SafeCast
    .toInt256(amount.mul(10**(18 - underlyingAssetDecimals)))
    .neg();
  • (#555) We also made the decision to enforce parentheses in ModifierDeclarations without parameters,
// input
modifier onlyOwner {
    require(owner() == _msgSender(), "Ownable: caller is not the owner");
    _;
}

// v1.0.0-beta.15
modifier onlyOwner {
    require(owner() == _msgSender(), "Ownable: caller is not the owner");
    _;
}

// v1.0.0-beta.16
modifier onlyOwner() {
    require(owner() == _msgSender(), "Ownable: caller is not the owner");
    _;
}

and remove them from ModifierInvocations without arguments.

// input
function renounceOwnership() public virtual onlyOwner() {
    _setOwner(address(0));
}

// v1.0.0-beta.15
function renounceOwnership() public virtual onlyOwner() {
    _setOwner(address(0));
}

// v1.0.0-beta.16
function renounceOwnership() public virtual onlyOwner {
    _setOwner(address(0));
}

v1.0.0-beta.15

11 Jul 01:37
64ad76f
Compare
Choose a tag to compare
v1.0.0-beta.15 Pre-release
Pre-release

This release adds a runtime security check for Prettier's version.
The printing process will throw if Prettier's version does not satisfy the range >=2.3.0

v1.0.0-beta.14

07 Jul 23:05
1da60ad
Compare
Choose a tag to compare
v1.0.0-beta.14 Pre-release
Pre-release

Release v1.0.0-beta.14 comes with a new option for the configuration file. You can use the compiler option to help prettier-plugin-solidity choose a appropriate formats.

along this mayor change the release includes these other minor changes: