prettier-plugin-solidity 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-solidity",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A Prettier Plugin for automatically formatting your Solidity code.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -103,7 +103,7 @@
103
103
  "jest-snapshot-serializer-raw": "^2.0.0",
104
104
  "jest-watch-typeahead": "^2.2.2",
105
105
  "lines-and-columns": "^2.0.3",
106
- "prettier": "^3.1.0",
106
+ "prettier": "^3.1.1",
107
107
  "proxyquire": "^2.1.3",
108
108
  "solc": "^0.8.23-fixed",
109
109
  "webpack": "^5.88.2",
package/src/parser.js CHANGED
@@ -61,15 +61,19 @@ function parse(text, _parsers, options = _parsers) {
61
61
  ctx.value = options.singleQuote ? `hex'${value}'` : `hex"${value}"`;
62
62
  },
63
63
  Conditional(ctx) {
64
- // We can remove parentheses only because we are sure that the
65
- // `condition` must be a single `bool` value.
66
- while (
67
- ctx.condition.type === 'TupleExpression' &&
68
- !ctx.condition.isArray &&
69
- ctx.condition.components.length === 1 &&
70
- ctx.condition.components[0].type !== 'Conditional'
71
- ) {
72
- [ctx.condition] = ctx.condition.components;
64
+ // TODO: while the behaviour is not stable, it should be behind the
65
+ // experimentalTernaries flag.
66
+ if (options.experimentalTernaries) {
67
+ // We can remove parentheses only because we are sure that the
68
+ // `condition` must be a single `bool` value.
69
+ while (
70
+ ctx.condition.type === 'TupleExpression' &&
71
+ !ctx.condition.isArray &&
72
+ ctx.condition.components.length === 1 &&
73
+ ctx.condition.components[0].type !== 'Conditional'
74
+ ) {
75
+ [ctx.condition] = ctx.condition.components;
76
+ }
73
77
  }
74
78
  },
75
79
  BinaryOperation(ctx) {