prettier-plugin-solidity 2.2.0 → 2.2.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.
Files changed (80) hide show
  1. package/README.md +4 -6
  2. package/dist/03c9b7ce95addc7d5ba0.wasm +0 -0
  3. package/dist/options.js +1 -1
  4. package/dist/options.js.map +1 -1
  5. package/dist/parser.js +2 -2
  6. package/dist/parser.js.map +1 -1
  7. package/dist/slang-nodes/ArgumentsDeclaration.js +1 -1
  8. package/dist/slang-nodes/ArgumentsDeclaration.js.map +1 -1
  9. package/dist/slang-nodes/ContractMember.js +1 -1
  10. package/dist/slang-nodes/ContractMember.js.map +1 -1
  11. package/dist/slang-nodes/ContractSpecifier.js +1 -1
  12. package/dist/slang-nodes/ContractSpecifier.js.map +1 -1
  13. package/dist/slang-nodes/Expression.js +1 -1
  14. package/dist/slang-nodes/Expression.js.map +1 -1
  15. package/dist/slang-nodes/FallbackFunctionAttribute.js +1 -1
  16. package/dist/slang-nodes/FallbackFunctionAttribute.js.map +1 -1
  17. package/dist/slang-nodes/ForStatementInitialization.js +1 -1
  18. package/dist/slang-nodes/ForStatementInitialization.js.map +1 -1
  19. package/dist/slang-nodes/FunctionAttribute.js +1 -1
  20. package/dist/slang-nodes/FunctionAttribute.js.map +1 -1
  21. package/dist/slang-nodes/ImportClause.js +1 -1
  22. package/dist/slang-nodes/ImportClause.js.map +1 -1
  23. package/dist/slang-nodes/MappingKeyType.js +1 -1
  24. package/dist/slang-nodes/MappingKeyType.js.map +1 -1
  25. package/dist/slang-nodes/Pragma.js +1 -1
  26. package/dist/slang-nodes/Pragma.js.map +1 -1
  27. package/dist/slang-nodes/ReceiveFunctionAttribute.js +1 -1
  28. package/dist/slang-nodes/ReceiveFunctionAttribute.js.map +1 -1
  29. package/dist/slang-nodes/SourceUnitMember.js +1 -1
  30. package/dist/slang-nodes/SourceUnitMember.js.map +1 -1
  31. package/dist/slang-nodes/Statement.js +1 -1
  32. package/dist/slang-nodes/Statement.js.map +1 -1
  33. package/dist/slang-nodes/StringExpression.js +1 -1
  34. package/dist/slang-nodes/StringExpression.js.map +1 -1
  35. package/dist/slang-nodes/TupleMember.js +1 -1
  36. package/dist/slang-nodes/TupleMember.js.map +1 -1
  37. package/dist/slang-nodes/TypeName.js +1 -1
  38. package/dist/slang-nodes/TypeName.js.map +1 -1
  39. package/dist/slang-nodes/UsingClause.js +1 -1
  40. package/dist/slang-nodes/UsingClause.js.map +1 -1
  41. package/dist/slang-nodes/VersionExpression.js +1 -1
  42. package/dist/slang-nodes/VersionExpression.js.map +1 -1
  43. package/dist/slang-nodes/YulExpression.js +1 -1
  44. package/dist/slang-nodes/YulExpression.js.map +1 -1
  45. package/dist/slang-nodes/YulLiteral.js +1 -1
  46. package/dist/slang-nodes/YulLiteral.js.map +1 -1
  47. package/dist/slang-nodes/YulStatement.js +1 -1
  48. package/dist/slang-nodes/YulStatement.js.map +1 -1
  49. package/dist/slang-nodes/YulSwitchCase.js +1 -1
  50. package/dist/slang-nodes/YulSwitchCase.js.map +1 -1
  51. package/dist/slangSolidityParser.js +1 -1
  52. package/dist/standalone.js +1 -1
  53. package/dist/standalone.js.map +1 -1
  54. package/package.json +12 -12
  55. package/src/options.ts +1 -1
  56. package/src/parser.js +2 -2
  57. package/src/slang-nodes/ArgumentsDeclaration.ts +1 -1
  58. package/src/slang-nodes/ContractMember.ts +1 -1
  59. package/src/slang-nodes/ContractSpecifier.ts +1 -1
  60. package/src/slang-nodes/Expression.ts +1 -1
  61. package/src/slang-nodes/FallbackFunctionAttribute.ts +1 -1
  62. package/src/slang-nodes/ForStatementInitialization.ts +1 -1
  63. package/src/slang-nodes/FunctionAttribute.ts +1 -1
  64. package/src/slang-nodes/ImportClause.ts +1 -1
  65. package/src/slang-nodes/MappingKeyType.ts +1 -1
  66. package/src/slang-nodes/Pragma.ts +1 -1
  67. package/src/slang-nodes/ReceiveFunctionAttribute.ts +1 -1
  68. package/src/slang-nodes/SourceUnitMember.ts +1 -1
  69. package/src/slang-nodes/Statement.ts +1 -1
  70. package/src/slang-nodes/StringExpression.ts +1 -1
  71. package/src/slang-nodes/TupleMember.ts +1 -1
  72. package/src/slang-nodes/TypeName.ts +1 -1
  73. package/src/slang-nodes/UsingClause.ts +1 -1
  74. package/src/slang-nodes/VersionExpression.ts +1 -1
  75. package/src/slang-nodes/YulExpression.ts +1 -1
  76. package/src/slang-nodes/YulLiteral.ts +1 -1
  77. package/src/slang-nodes/YulStatement.ts +1 -1
  78. package/src/slang-nodes/YulSwitchCase.ts +1 -1
  79. package/src/slangSolidityParser.ts +1 -1
  80. package/dist/9a31af7202ef4388d62d.wasm +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-solidity",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A Prettier Plugin for automatically formatting your Solidity code.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -85,16 +85,16 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@babel/code-frame": "^7.27.1",
88
- "@eslint/eslintrc": "^3.3.1",
89
- "@eslint/js": "^9.39.1",
88
+ "@eslint/eslintrc": "^3.3.3",
89
+ "@eslint/js": "^9.39.2",
90
90
  "@types/jest": "^30.0.0",
91
- "@types/node": "^24.10.0",
91
+ "@types/node": "^25.0.3",
92
92
  "@types/semver": "^7.7.1",
93
- "@typescript-eslint/eslint-plugin": "^8.46.3",
94
- "@typescript-eslint/parser": "^8.46.3",
93
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
94
+ "@typescript-eslint/parser": "^8.50.0",
95
95
  "c8": "^10.1.3",
96
96
  "cross-env": "^10.1.0",
97
- "eslint": "^9.39.1",
97
+ "eslint": "^9.39.2",
98
98
  "eslint-config-prettier": "^10.1.8",
99
99
  "eslint-plugin-import": "^2.32.0",
100
100
  "esm-utils": "^4.4.2",
@@ -104,18 +104,18 @@
104
104
  "jest-snapshot-serializer-ansi": "^2.2.1",
105
105
  "jest-snapshot-serializer-raw": "^2.0.0",
106
106
  "jest-watch-typeahead": "^3.0.1",
107
- "knip": "^5.68.0",
107
+ "knip": "^5.75.1",
108
108
  "lines-and-columns": "^2.0.4",
109
- "prettier": "^3.6.2",
110
- "solc": "^0.8.30",
109
+ "prettier": "^3.7.4",
110
+ "solc": "^0.8.32",
111
111
  "ts-loader": "^9.5.4",
112
112
  "ts-node": "^10.9.2",
113
113
  "typescript": "^5.9.3",
114
- "webpack": "^5.102.1",
114
+ "webpack": "^5.104.1",
115
115
  "webpack-cli": "^6.0.1"
116
116
  },
117
117
  "dependencies": {
118
- "@nomicfoundation/slang": "1.3.0",
118
+ "@nomicfoundation/slang": "1.3.1",
119
119
  "@solidity-parser/parser": "^0.20.2",
120
120
  "semver": "^7.7.3"
121
121
  },
package/src/options.ts CHANGED
@@ -10,7 +10,7 @@ const options: SupportOptions = {
10
10
  category: CATEGORY_GLOBAL,
11
11
  type: 'int',
12
12
  default: 80,
13
- description: 'The line length where Prettier will try wrap.',
13
+ description: 'The line length where Prettier will try to wrap.',
14
14
  range: { start: 0, end: Number.POSITIVE_INFINITY, step: 1 }
15
15
  },
16
16
  tabWidth: {
package/src/parser.js CHANGED
@@ -59,7 +59,7 @@ function parse(text, _parsers, options = _parsers) {
59
59
  ctx.value = options.singleQuote ? `hex'${value}'` : `hex"${value}"`;
60
60
  },
61
61
  Conditional(ctx) {
62
- // TODO: while the behaviour is not stable, it should be behind the
62
+ // TODO: while the behavior is not stable, it should be behind the
63
63
  // experimentalTernaries flag.
64
64
  if (options.experimentalTernaries) {
65
65
  // We can remove parentheses only because we are sure that the
@@ -91,7 +91,7 @@ function parse(text, _parsers, options = _parsers) {
91
91
  ctx.left = tryHug(ctx.left, ['*', '/', '%']);
92
92
  break;
93
93
  case '**':
94
- // If the compiler has not been given as an option using we leave
94
+ // If the compiler has not been given as an option we leave
95
95
  // a**b**c.
96
96
  if (!compiler) break;
97
97
 
@@ -18,7 +18,7 @@ function createNonterminalVariant(
18
18
  return new NamedArgumentsDeclaration(variant, options);
19
19
  }
20
20
  const exhaustiveCheck: never = variant;
21
- return exhaustiveCheck;
21
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
22
22
  }
23
23
 
24
24
  export class ArgumentsDeclaration extends SlangNode {
@@ -62,7 +62,7 @@ function createNonterminalVariant(
62
62
  return new UserDefinedValueTypeDefinition(variant);
63
63
  }
64
64
  const exhaustiveCheck: never = variant;
65
- return exhaustiveCheck;
65
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
66
66
  }
67
67
 
68
68
  export class ContractMember extends SlangNode {
@@ -18,7 +18,7 @@ function createNonterminalVariant(
18
18
  return new StorageLayoutSpecifier(variant, options);
19
19
  }
20
20
  const exhaustiveCheck: never = variant;
21
- return exhaustiveCheck;
21
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
22
22
  }
23
23
 
24
24
  export class ContractSpecifier extends SlangNode {
@@ -123,7 +123,7 @@ function createNonterminalVariant(
123
123
  return extractVariant(new ElementaryType(variant));
124
124
  }
125
125
  const exhaustiveCheck: never = variant;
126
- return exhaustiveCheck;
126
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
127
127
  }
128
128
 
129
129
  export class Expression extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new OverrideSpecifier(variant);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class FallbackFunctionAttribute extends SlangNode {
@@ -29,7 +29,7 @@ function createNonterminalVariant(
29
29
  return new TupleDeconstructionStatement(variant, options);
30
30
  }
31
31
  const exhaustiveCheck: never = variant;
32
- return exhaustiveCheck;
32
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
33
33
  }
34
34
 
35
35
  export class ForStatementInitialization extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new OverrideSpecifier(variant);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class FunctionAttribute extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new ImportDeconstruction(variant, options);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class ImportClause extends SlangNode {
@@ -15,7 +15,7 @@ function createNonterminalVariant(
15
15
  return new IdentifierPath(variant);
16
16
  }
17
17
  const exhaustiveCheck: never = variant;
18
- return exhaustiveCheck;
18
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
19
19
  }
20
20
 
21
21
  export class MappingKeyType extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new VersionPragma(variant);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class Pragma extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new OverrideSpecifier(variant);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class ReceiveFunctionAttribute extends SlangNode {
@@ -62,7 +62,7 @@ function createNonterminalVariant(
62
62
  return new EventDefinition(variant, options);
63
63
  }
64
64
  const exhaustiveCheck: never = variant;
65
- return exhaustiveCheck;
65
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
66
66
  }
67
67
 
68
68
  export class SourceUnitMember extends SlangNode {
@@ -78,7 +78,7 @@ function createNonterminalVariant(
78
78
  return new UncheckedBlock(variant, options);
79
79
  }
80
80
  const exhaustiveCheck: never = variant;
81
- return exhaustiveCheck;
81
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
82
82
  }
83
83
 
84
84
  export class Statement extends SlangNode {
@@ -30,7 +30,7 @@ function createNonterminalVariant(
30
30
  return new UnicodeStringLiterals(variant, options);
31
31
  }
32
32
  const exhaustiveCheck: never = variant;
33
- return exhaustiveCheck;
33
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
34
34
  }
35
35
 
36
36
  export class StringExpression extends SlangNode {
@@ -18,7 +18,7 @@ function createNonterminalVariant(
18
18
  return new UntypedTupleMember(variant);
19
19
  }
20
20
  const exhaustiveCheck: never = variant;
21
- return exhaustiveCheck;
21
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
22
22
  }
23
23
 
24
24
  export class TupleMember extends SlangNode {
@@ -31,7 +31,7 @@ function createNonterminalVariant(
31
31
  return new IdentifierPath(variant);
32
32
  }
33
33
  const exhaustiveCheck: never = variant;
34
- return exhaustiveCheck;
34
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
35
35
  }
36
36
 
37
37
  export class TypeName extends SlangNode {
@@ -14,7 +14,7 @@ function createNonterminalVariant(
14
14
  return new UsingDeconstruction(variant);
15
15
  }
16
16
  const exhaustiveCheck: never = variant;
17
- return exhaustiveCheck;
17
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
18
18
  }
19
19
 
20
20
  export class UsingClause extends SlangNode {
@@ -14,7 +14,7 @@ function createNonterminalVariant(
14
14
  return new VersionTerm(variant);
15
15
  }
16
16
  const exhaustiveCheck: never = variant;
17
- return exhaustiveCheck;
17
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
18
18
  }
19
19
 
20
20
  export class VersionExpression extends SlangNode {
@@ -23,7 +23,7 @@ function createNonterminalVariant(
23
23
  return new YulPath(variant);
24
24
  }
25
25
  const exhaustiveCheck: never = variant;
26
- return exhaustiveCheck;
26
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
27
27
  }
28
28
 
29
29
  export class YulExpression extends SlangNode {
@@ -22,7 +22,7 @@ function createNonterminalVariant(
22
22
  return new StringLiteral(variant, options);
23
23
  }
24
24
  const exhaustiveCheck: never = variant;
25
- return exhaustiveCheck;
25
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
26
26
  }
27
27
 
28
28
  export class YulLiteral extends SlangNode {
@@ -63,7 +63,7 @@ function createNonterminalVariant(
63
63
  return extractVariant(new YulExpression(variant, options));
64
64
  }
65
65
  const exhaustiveCheck: never = variant;
66
- return exhaustiveCheck;
66
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
67
67
  }
68
68
 
69
69
  export class YulStatement extends SlangNode {
@@ -18,7 +18,7 @@ function createNonterminalVariant(
18
18
  return new YulValueCase(variant, options);
19
19
  }
20
20
  const exhaustiveCheck: never = variant;
21
- return exhaustiveCheck;
21
+ throw new Error(`Unexpected variant: ${JSON.stringify(exhaustiveCheck)}`);
22
22
  }
23
23
 
24
24
  export class YulSwitchCase extends SlangNode {
@@ -20,7 +20,7 @@ export default function parse(
20
20
  options
21
21
  );
22
22
 
23
- // Because of comments being extracted like a russian doll, the order needs
23
+ // Because of comments being extracted like a Russian doll, the order needs
24
24
  // to be fixed at the end.
25
25
  parsed.comments = clearComments().sort((a, b) => a.loc.start - b.loc.start);
26
26
  clearOffsets();
Binary file