Skip to content

Releases: prettier-solidity/prettier-plugin-solidity

v2.1.0

09 Jul 20:23
29f41b4
Compare
Choose a tag to compare

What's Changed

API Changes

Format Changes

  • Only break import deconstruction if the list of items is longer than 1. by @Janther in #1178
// Original
import { Item } from "../../../contracts/very/long/path/to/File1.sol";
import { Item1, Item2 } from "../../../contracts/very/long/path/to/File2.sol";

// version 2.0.0
import {
    Item
} from "../../../contracts/very/long/path/to/File.sol";
import {
    Item1,
    Item2
} from "../../../contracts/very/long/path/to/File2.sol";

// version 2.1.0
import { Item } from "../../../contracts/very/long/path/to/File.sol";
import {
    Item1,
    Item2
} from "../../../contracts/very/long/path/to/File2.sol";
  • New rules added to the grouping in a single line when possible and indentation when the line breaks on binary operations to improve readability and make operations precedence more visible. by @Janther in #1133
// Original
x = veryLongNameA * veryLongNameB + veryLongNameC;
x = veryLongNameA + veryLongNameB * veryLongNameC;

x = veryVeryLongNameA * veryVeryLongNameB + veryVeryLongNameC;
x = veryVeryLongNameA + veryVeryLongNameB * veryVeryLongNameC;

// version 2.0.0
x =
    veryLongNameA *
    veryLongNameB +
    veryLongNameC;
x =
    veryLongNameA +
    veryLongNameB *
    veryLongNameC;

x =
    veryVeryLongNameA *
    veryVeryLongNameB +
    veryVeryLongNameC;
x =
    veryVeryLongNameA +
    veryVeryLongNameB *
    veryVeryLongNameC;

// version 2.1.0
x =
    veryLongNameA * veryLongNameB +
    veryLongNameC;
x =
    veryLongNameA +
    veryLongNameB * veryLongNameC;

x =
    veryVeryLongNameA *
        veryVeryLongNameB +
    veryVeryLongNameC;
x =
    veryVeryLongNameA +
    veryVeryLongNameB *
        veryVeryLongNameC;
  • Fixed a format issue where a small operand would be left in a new line if the right operand breaks in an assignment. by @Janther in #1161
// Original
a = veryVeryVeryVeryVeryLongFunctionCalledA(veryVeryVeryVeryVeryLongArgumentCalledB) ** c;

// version 2.0.0
a =
    veryVeryVeryVeryVeryLongFunctionCalledA(
        veryVeryVeryVeryVeryLongVariableCalledB
    ) **
    c;

// version 2.1.0
a =
    veryVeryVeryVeryVeryLongFunctionCalledA(
        veryVeryVeryVeryVeryLongVariableCalledB
    ) ** c;
  • Added parentheses on consecutive equality operators to improve readability in operation precedence. by @Janther in #1132
// Original
a == b == c;
a != b == c;

// version 2.0.0
a == b == c;
a != b == c;

// version 2.1.0
(a == b) == c;
(a != b) == c;
  • Fixed bug in the last comment in a struct definition. by @Janther in #1181
// Original
struct A {
    uint a;
    uint b;
    // uint c; // commented because I decided to test something
}

// version 2.0.0
struct A {
    uint a;
    uint b;
}
// uint c; // commented because I decided to test something

// version 2.1.0
struct A {
    uint a;
    uint b;
    // uint c; // commented because I decided to test something
}

Breaking Changes

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0

30 Apr 08:10
4fc697c
Compare
Choose a tag to compare

This is a new major version of Prettier Plugin Solidity.

The changes from v1 are minimal, but there are a couple of breaking changes.

The plugin now uses Slang as the parser by default. Slang is a more powerful and correct parser that improves formatting in many edge cases—especially when comments are involved.

If you had the parser explicitly set in your .prettierrc (e.g., "parser": "solidity-parse"), you'll need to update it to:

"parser": "slang"

If you don't have the parser option set in your config, no action is needed.

The old ANTLR-based parser is still supported in v2, but it's deprecated and will be removed in the next major version.

v1.4.3

25 Apr 16:28
ef2ec66
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.4.2...v1.4.3

v2.0.0-beta.8

25 Mar 10:38
bd5ece9
Compare
Choose a tag to compare
v2.0.0-beta.8 Pre-release
Pre-release

What's Changed

Full Changelog: v2.0.0-beta.7...v2.0.0-beta.8

v2.0.0-beta.7

30 Jan 00:48
Compare
Choose a tag to compare
v2.0.0-beta.7 Pre-release
Pre-release

What's Changed

Full Changelog: 2.0.0-beta.6...v2.0.0-beta.7

2.0.0-beta.6

06 Jan 23:04
Compare
Choose a tag to compare
2.0.0-beta.6 Pre-release
Pre-release

New features

  • Add support for transient keyword in the solidity-parse parser by @Janther in #1079

Format changes

  • Don't re-write import * as ... from ... in the solidity-parse parser by @Janther in #1083
// Original
import * as SomeSymbol from "AnotherFile.sol";

// prettier-plugin-solidity@2.0.0-beta.5
// { parser: 'solidity-parse' }
import "AnotherFile.sol" as SomeSymbol;

// prettier-plugin-solidity@2.0.0-beta.6
// { parser: 'solidity-parse' }
import * as SomeSymbol from "AnotherFile.sol";

Breaking changes

Full Changelog: v1.4.1...v1.4.2

v1.4.2

06 Jan 23:00
03b224d
Compare
Choose a tag to compare

New features

Format changes

// Original
import * as SomeSymbol from "AnotherFile.sol";

// prettier-plugin-solidity@v1.4.1
import "AnotherFile.sol" as SomeSymbol;

// prettier-plugin-solidity@v1.4.2
import * as SomeSymbol from "AnotherFile.sol";

Breaking changes

Full Changelog: v1.4.1...v1.4.2

v2.0.0-beta.5

20 Dec 06:21
1ca44e3
Compare
Choose a tag to compare
v2.0.0-beta.5 Pre-release
Pre-release

Smaller bundled file size and performance improvements.

v2.0.0-beta.4

20 Dec 06:15
Compare
Choose a tag to compare
v2.0.0-beta.4 Pre-release
Pre-release

Fix a bug in the previous release with the unpkg endpoint.

v2.0.0-beta.3

20 Dec 06:11
1cf3dfd
Compare
Choose a tag to compare
v2.0.0-beta.3 Pre-release
Pre-release

Features

  • Support for Slang 18
  • Support for the browser was added back

Breaking changes

  • Slang provides a wasm endpoint that relies on ESM features. Therefore we had to drop UMD and CommonJS support in order to bundle a package for the browser.