prettier-plugin-solidity 2.0.0-beta.7 → 2.0.0-beta.8

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": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.8",
4
4
  "description": "A Prettier Plugin for automatically formatting your Solidity code.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -86,31 +86,31 @@
86
86
  "@babel/code-frame": "^7.26.2",
87
87
  "@types/jest": "^29.5.14",
88
88
  "@types/semver": "^7.5.8",
89
- "@typescript-eslint/eslint-plugin": "^8.22.0",
90
- "@typescript-eslint/parser": "^8.22.0",
89
+ "@typescript-eslint/eslint-plugin": "^8.28.0",
90
+ "@typescript-eslint/parser": "^8.28.0",
91
91
  "c8": "^10.1.3",
92
92
  "cross-env": "^7.0.3",
93
- "eslint": "^9.19.0",
94
- "eslint-config-prettier": "10.0.1",
93
+ "eslint": "^9.23.0",
94
+ "eslint-config-prettier": "10.1.1",
95
95
  "esm-utils": "^4.3.0",
96
96
  "jest": "^29.7.0",
97
97
  "jest-light-runner": "^0.6.0",
98
- "jest-snapshot-serializer-ansi": "^2.1.0",
98
+ "jest-snapshot-serializer-ansi": "^2.2.1",
99
99
  "jest-snapshot-serializer-raw": "^2.0.0",
100
100
  "jest-watch-typeahead": "^2.2.2",
101
101
  "lines-and-columns": "^2.0.4",
102
- "prettier": "^3.4.2",
103
- "solc": "^0.8.28",
102
+ "prettier": "^3.5.3",
103
+ "solc": "^0.8.29",
104
104
  "ts-loader": "^9.5.2",
105
105
  "ts-node": "^10.9.2",
106
- "typescript": "^5.7.3",
107
- "webpack": "^5.97.1",
106
+ "typescript": "^5.8.2",
107
+ "webpack": "^5.98.0",
108
108
  "webpack-cli": "^6.0.1"
109
109
  },
110
110
  "dependencies": {
111
- "@nomicfoundation/slang": "0.19.0",
111
+ "@nomicfoundation/slang": "1.0.0",
112
112
  "@solidity-parser/parser": "^0.19.0",
113
- "semver": "^7.7.0"
113
+ "semver": "^7.7.1"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "prettier": ">=3.0.0"
@@ -9,7 +9,7 @@ import { ConditionalExpression } from './ConditionalExpression.js';
9
9
  import { OrExpression } from './OrExpression.js';
10
10
  import { AndExpression } from './AndExpression.js';
11
11
  import { EqualityExpression } from './EqualityExpression.js';
12
- import { ComparisonExpression } from './ComparisonExpression.js';
12
+ import { InequalityExpression } from './InequalityExpression.js';
13
13
  import { BitwiseOrExpression } from './BitwiseOrExpression.js';
14
14
  import { BitwiseXorExpression } from './BitwiseXorExpression.js';
15
15
  import { BitwiseAndExpression } from './BitwiseAndExpression.js';
@@ -51,7 +51,7 @@ export class Expression implements SlangNode {
51
51
  | OrExpression
52
52
  | AndExpression
53
53
  | EqualityExpression
54
- | ComparisonExpression
54
+ | InequalityExpression
55
55
  | BitwiseOrExpression
56
56
  | BitwiseXorExpression
57
57
  | BitwiseAndExpression
@@ -112,9 +112,9 @@ export class Expression implements SlangNode {
112
112
  options
113
113
  );
114
114
  break;
115
- case NonterminalKind.ComparisonExpression:
116
- this.variant = new ComparisonExpression(
117
- ast.variant as ast.ComparisonExpression,
115
+ case NonterminalKind.InequalityExpression:
116
+ this.variant = new InequalityExpression(
117
+ ast.variant as ast.InequalityExpression,
118
118
  options
119
119
  );
120
120
  break;
@@ -8,8 +8,8 @@ import type { AstPath, Doc, ParserOptions } from 'prettier';
8
8
  import type { AstNode } from './types.d.ts';
9
9
  import type { PrintFunction, SlangNode } from '../types.d.ts';
10
10
 
11
- export class ComparisonExpression implements SlangNode {
12
- readonly kind = NonterminalKind.ComparisonExpression;
11
+ export class InequalityExpression implements SlangNode {
12
+ readonly kind = NonterminalKind.InequalityExpression;
13
13
 
14
14
  comments;
15
15
 
@@ -21,7 +21,7 @@ export class ComparisonExpression implements SlangNode {
21
21
 
22
22
  rightOperand: Expression;
23
23
 
24
- constructor(ast: ast.ComparisonExpression, options: ParserOptions<AstNode>) {
24
+ constructor(ast: ast.InequalityExpression, options: ParserOptions<AstNode>) {
25
25
  let metadata = getNodeMetadata(ast);
26
26
 
27
27
  this.leftOperand = new Expression(ast.leftOperand, options);
@@ -35,7 +35,7 @@ export class ComparisonExpression implements SlangNode {
35
35
  }
36
36
 
37
37
  print(
38
- path: AstPath<ComparisonExpression>,
38
+ path: AstPath<InequalityExpression>,
39
39
  print: PrintFunction,
40
40
  options: ParserOptions<AstNode>
41
41
  ): Doc {
@@ -2,7 +2,6 @@ import { NonterminalKind } from '@nomicfoundation/slang/cst';
2
2
  import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js';
3
3
  import { YulFunctionCallExpression } from './YulFunctionCallExpression.js';
4
4
  import { YulLiteral } from './YulLiteral.js';
5
- import { YulBuiltInFunction } from './YulBuiltInFunction.js';
6
5
  import { YulPath } from './YulPath.js';
7
6
 
8
7
  import type * as ast from '@nomicfoundation/slang/ast';
@@ -17,11 +16,7 @@ export class YulExpression implements SlangNode {
17
16
 
18
17
  loc;
19
18
 
20
- variant:
21
- | YulFunctionCallExpression
22
- | YulLiteral
23
- | YulBuiltInFunction
24
- | YulPath;
19
+ variant: YulFunctionCallExpression | YulLiteral | YulPath;
25
20
 
26
21
  constructor(ast: ast.YulExpression, options: ParserOptions<AstNode>) {
27
22
  let metadata = getNodeMetadata(ast);
@@ -36,11 +31,6 @@ export class YulExpression implements SlangNode {
36
31
  case NonterminalKind.YulLiteral:
37
32
  this.variant = new YulLiteral(ast.variant as ast.YulLiteral, options);
38
33
  break;
39
- case NonterminalKind.YulBuiltInFunction:
40
- this.variant = new YulBuiltInFunction(
41
- ast.variant as ast.YulBuiltInFunction
42
- );
43
- break;
44
34
  case NonterminalKind.YulPath:
45
35
  this.variant = new YulPath(ast.variant as ast.YulPath);
46
36
  break;
@@ -20,7 +20,6 @@ import type { CallOptionsExpression } from './CallOptionsExpression.ts';
20
20
  import type { CatchClause } from './CatchClause.ts';
21
21
  import type { CatchClauseError } from './CatchClauseError.ts';
22
22
  import type { CatchClauses } from './CatchClauses.ts';
23
- import type { ComparisonExpression } from './ComparisonExpression.ts';
24
23
  import type { ConditionalExpression } from './ConditionalExpression.ts';
25
24
  import type { ConstantDefinition } from './ConstantDefinition.ts';
26
25
  import type { ConstructorAttribute } from './ConstructorAttribute.ts';
@@ -80,6 +79,7 @@ import type { ImportDeconstructionSymbols } from './ImportDeconstructionSymbols.
80
79
  import type { ImportDirective } from './ImportDirective.ts';
81
80
  import type { IndexAccessEnd } from './IndexAccessEnd.ts';
82
81
  import type { IndexAccessExpression } from './IndexAccessExpression.ts';
82
+ import type { InequalityExpression } from './InequalityExpression.ts';
83
83
  import type { InheritanceSpecifier } from './InheritanceSpecifier.ts';
84
84
  import type { InheritanceType } from './InheritanceType.ts';
85
85
  import type { InheritanceTypes } from './InheritanceTypes.ts';
@@ -190,7 +190,6 @@ import type { YulArguments } from './YulArguments.ts';
190
190
  import type { YulAssignmentOperator } from './YulAssignmentOperator.ts';
191
191
  import type { YulBlock } from './YulBlock.ts';
192
192
  import type { YulBreakStatement } from './YulBreakStatement.ts';
193
- import type { YulBuiltInFunction } from './YulBuiltInFunction.ts';
194
193
  import type { YulColonAndEqual } from './YulColonAndEqual.ts';
195
194
  import type { YulContinueStatement } from './YulContinueStatement.ts';
196
195
  import type { YulDefaultCase } from './YulDefaultCase.ts';
@@ -321,7 +320,7 @@ export type StrictAstNode =
321
320
  | OrExpression
322
321
  | AndExpression
323
322
  | EqualityExpression
324
- | ComparisonExpression
323
+ | InequalityExpression
325
324
  | BitwiseOrExpression
326
325
  | BitwiseXorExpression
327
326
  | BitwiseAndExpression
@@ -409,7 +408,6 @@ export type StrictAstNode =
409
408
  | YulAssignmentOperator
410
409
  | YulSwitchCase
411
410
  | YulExpression
412
- | YulBuiltInFunction
413
411
  | YulLiteral
414
412
  | SourceUnitMembers
415
413
  | VersionExpressionSet
@@ -5,8 +5,8 @@ import { createKindCheckFunction } from '../slang-utils/create-kind-check-functi
5
5
 
6
6
  import type { AstPath, Doc } from 'prettier';
7
7
  import type { BinaryOperation, StrictAstNode } from '../slang-nodes/types.d.ts';
8
- import type { ComparisonExpression } from '../slang-nodes/ComparisonExpression.ts';
9
8
  import type { EqualityExpression } from '../slang-nodes/EqualityExpression.ts';
9
+ import type { InequalityExpression } from '../slang-nodes/InequalityExpression.ts';
10
10
 
11
11
  const { group, indent } = doc.builders;
12
12
 
@@ -25,7 +25,7 @@ const isBinaryOperationWithoutComparison = createKindCheckFunction([
25
25
  node: StrictAstNode
26
26
  ) => node is Exclude<
27
27
  BinaryOperation,
28
- ComparisonExpression | EqualityExpression
28
+ EqualityExpression | InequalityExpression
29
29
  >;
30
30
 
31
31
  const binaryGroupRulesBuilder =
@@ -11,8 +11,8 @@ export const isBinaryOperation = createKindCheckFunction([
11
11
  NonterminalKind.BitwiseAndExpression,
12
12
  NonterminalKind.BitwiseOrExpression,
13
13
  NonterminalKind.BitwiseXorExpression,
14
- NonterminalKind.ComparisonExpression,
15
14
  NonterminalKind.EqualityExpression,
15
+ NonterminalKind.InequalityExpression,
16
16
  NonterminalKind.AndExpression,
17
17
  NonterminalKind.OrExpression,
18
18
  NonterminalKind.ShiftExpression
package/src/types.d.ts CHANGED
@@ -142,7 +142,7 @@ export type SlangAstNode =
142
142
  | ast.OrExpression
143
143
  | ast.AndExpression
144
144
  | ast.EqualityExpression
145
- | ast.ComparisonExpression
145
+ | ast.InequalityExpression
146
146
  | ast.BitwiseOrExpression
147
147
  | ast.BitwiseXorExpression
148
148
  | ast.BitwiseAndExpression
@@ -230,7 +230,6 @@ export type SlangAstNode =
230
230
  | ast.YulAssignmentOperator
231
231
  | ast.YulSwitchCase
232
232
  | ast.YulExpression
233
- | ast.YulBuiltInFunction
234
233
  | ast.YulLiteral
235
234
  | ast.SourceUnitMembers
236
235
  | ast.VersionExpressionSet
Binary file
Binary file
Binary file
@@ -1,15 +0,0 @@
1
- import { NonterminalKind } from '@nomicfoundation/slang/cst';
2
- import { getNodeMetadata } from '../slang-utils/metadata.js';
3
- export class YulBuiltInFunction {
4
- constructor(ast) {
5
- this.kind = NonterminalKind.YulBuiltInFunction;
6
- const metadata = getNodeMetadata(ast);
7
- this.variant = ast.variant.unparse();
8
- this.comments = metadata.comments;
9
- this.loc = metadata.loc;
10
- }
11
- print() {
12
- return this.variant;
13
- }
14
- }
15
- //# sourceMappingURL=YulBuiltInFunction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"YulBuiltInFunction.js","sourceRoot":"","sources":["../../src/slang-nodes/YulBuiltInFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7D,MAAM,OAAO,kBAAkB;IAS7B,YAAY,GAA2B;QAR9B,SAAI,GAAG,eAAe,CAAC,kBAAkB,CAAC;QASjD,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;IAC1B,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
@@ -1,29 +0,0 @@
1
- import { NonterminalKind } from '@nomicfoundation/slang/cst';
2
- import { getNodeMetadata } from '../slang-utils/metadata.js';
3
-
4
- import type * as ast from '@nomicfoundation/slang/ast';
5
- import type { Doc } from 'prettier';
6
- import type { SlangNode } from '../types.d.ts';
7
-
8
- export class YulBuiltInFunction implements SlangNode {
9
- readonly kind = NonterminalKind.YulBuiltInFunction;
10
-
11
- comments;
12
-
13
- loc;
14
-
15
- variant: string;
16
-
17
- constructor(ast: ast.YulBuiltInFunction) {
18
- const metadata = getNodeMetadata(ast);
19
-
20
- this.variant = ast.variant.unparse();
21
-
22
- this.comments = metadata.comments;
23
- this.loc = metadata.loc;
24
- }
25
-
26
- print(): Doc {
27
- return this.variant;
28
- }
29
- }