diff --git a/package.json b/package.json index 972b72dc1b23..e3fb4ce713f9 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "@nx/jest": "16.8.1", "@nx/linter": "16.8.1", "@nx/workspace": "16.8.1", + "@prettier/sync": "^0.3.0", "@swc/core": "^1.3.68", "@swc/jest": "^0.2.26", "@types/babel__code-frame": "^7.0.3", @@ -74,7 +75,6 @@ "@types/natural-compare": "^1.4.1", "@types/ncp": "^2.0.5", "@types/node": "^20.0.0", - "@types/prettier": "^2.7.2", "@types/semver": "^7.5.0", "@types/tmp": "^0.2.3", "console-fail-test": "^0.2.3", @@ -107,7 +107,7 @@ "netlify": "^13.1.9", "nx": "16.8.1", "nx-cloud": "16.4.0", - "prettier": "^2.8.4", + "prettier": "3.0.3", "pretty-format": "^29.6.2", "raw-loader": "^4.0.2", "rimraf": "^5.0.1", diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 62f7009e1e38..545820b8f758 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -54,7 +54,7 @@ "jest-snapshot": "^29.6.2", "jest-specific-snapshot": "^8.0.0", "make-dir": "*", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "pretty-format": "*", "rimraf": "*", "typescript": "*" diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/fixture.ts b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/fixture.ts index fb115370b27e..171ad43b5470 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/fixture.ts +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/fixture.ts @@ -3,7 +3,10 @@ module A { export var x = 'hello world'; export class Point { - constructor(public x: number, public y: number) {} + constructor( + public x: number, + public y: number, + ) {} } export module B { export interface Id { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot index 1c290645bdc6..c4a8a3d48712 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot @@ -104,10 +104,10 @@ Program { type: "BlockStatement", body: [], - range: [191, 193], + range: [210, 212], loc: { - start: { column: 52, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 8, line: 9 }, }, }, declare: false, @@ -130,33 +130,33 @@ Program { typeAnnotation: TSNumberKeyword { type: "TSNumberKeyword", - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [163, 171], + range: [170, 178], loc: { - start: { column: 24, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [162, 171], + range: [169, 178], loc: { - start: { column: 23, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 22, line: 7 }, }, }, readonly: false, static: false, - range: [155, 171], + range: [162, 178], loc: { - start: { column: 16, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 22, line: 7 }, }, }, TSParameterProperty { @@ -174,56 +174,56 @@ Program { typeAnnotation: TSNumberKeyword { type: "TSNumberKeyword", - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [181, 189], + range: [194, 202], loc: { - start: { column: 42, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [180, 189], + range: [193, 202], loc: { - start: { column: 41, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 22, line: 8 }, }, }, readonly: false, static: false, - range: [173, 189], + range: [186, 202], loc: { - start: { column: 34, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 22, line: 8 }, }, }, ], - range: [154, 193], + range: [154, 212], loc: { start: { column: 15, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, - range: [143, 193], + range: [143, 212], loc: { start: { column: 4, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, ], - range: [137, 197], + range: [137, 216], loc: { start: { column: 21, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, declare: false, @@ -243,20 +243,20 @@ Program { implements: [], superClass: null, - range: [125, 197], + range: [125, 216], loc: { start: { column: 9, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, exportKind: "value", source: null, specifiers: [], - range: [118, 197], + range: [118, 216], loc: { start: { column: 2, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, ExportNamedDeclaration { @@ -284,10 +284,10 @@ Program { name: "name", optional: false, - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, optional: false, @@ -298,32 +298,32 @@ Program { typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [254, 262], + range: [273, 281], loc: { - start: { column: 10, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [250, 263], + range: [269, 282], loc: { - start: { column: 6, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 19, line: 13 }, }, }, ], - range: [242, 269], + range: [261, 288], loc: { - start: { column: 24, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 24, line: 12 }, + end: { column: 5, line: 14 }, }, }, declare: false, @@ -334,35 +334,35 @@ Program { name: "Id", optional: false, - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, - range: [229, 269], + range: [248, 288], loc: { - start: { column: 11, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 11, line: 12 }, + end: { column: 5, line: 14 }, }, }, exportKind: "type", source: null, specifiers: [], - range: [222, 269], + range: [241, 288], loc: { - start: { column: 4, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 12 }, + end: { column: 5, line: 14 }, }, }, ], - range: [216, 273], + range: [235, 292], loc: { - start: { column: 18, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 18, line: 11 }, + end: { column: 3, line: 15 }, }, }, declare: false, @@ -373,36 +373,36 @@ Program { name: "B", optional: false, - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, kind: "module", - range: [207, 273], + range: [226, 292], loc: { - start: { column: 9, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 9, line: 11 }, + end: { column: 3, line: 15 }, }, }, exportKind: "value", source: null, specifiers: [], - range: [200, 273], + range: [219, 292], loc: { - start: { column: 2, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 11 }, + end: { column: 3, line: 15 }, }, }, ], - range: [82, 275], + range: [82, 294], loc: { start: { column: 9, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, declare: false, @@ -421,19 +421,19 @@ Program { }, kind: "module", - range: [73, 275], + range: [73, 294], loc: { start: { column: 0, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, ], sourceType: "script", - range: [73, 276], + range: [73, 295], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 14 }, + end: { column: 0, line: 17 }, }, } `; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/2-TSESTree-Tokens.shot index e3447023c759..ab5325cefc81 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/2-TSESTree-Tokens.shot @@ -156,280 +156,290 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod type: "Keyword", value: "public", - range: [155, 161], + range: [162, 168], loc: { - start: { column: 16, line: 6 }, - end: { column: 22, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 12, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [162, 163], + range: [169, 170], loc: { - start: { column: 23, line: 6 }, - end: { column: 24, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [163, 164], + range: [170, 171], loc: { - start: { column: 24, line: 6 }, - end: { column: 25, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 15, line: 7 }, }, }, Identifier { type: "Identifier", value: "number", - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [171, 172], + range: [178, 179], loc: { - start: { column: 32, line: 6 }, - end: { column: 33, line: 6 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, Keyword { type: "Keyword", value: "public", - range: [173, 179], + range: [186, 192], loc: { - start: { column: 34, line: 6 }, - end: { column: 40, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 12, line: 8 }, }, }, Identifier { type: "Identifier", value: "y", - range: [180, 181], + range: [193, 194], loc: { - start: { column: 41, line: 6 }, - end: { column: 42, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 14, line: 8 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [181, 182], + range: [194, 195], loc: { - start: { column: 42, line: 6 }, - end: { column: 43, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 15, line: 8 }, }, }, Identifier { type: "Identifier", value: "number", - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [202, 203], + loc: { + start: { column: 22, line: 8 }, + end: { column: 23, line: 8 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [189, 190], + range: [208, 209], loc: { - start: { column: 50, line: 6 }, - end: { column: 51, line: 6 }, + start: { column: 4, line: 9 }, + end: { column: 5, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [191, 192], + range: [210, 211], loc: { - start: { column: 52, line: 6 }, - end: { column: 53, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 7, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [192, 193], + range: [211, 212], loc: { - start: { column: 53, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 7, line: 9 }, + end: { column: 8, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [196, 197], + range: [215, 216], loc: { - start: { column: 2, line: 7 }, - end: { column: 3, line: 7 }, + start: { column: 2, line: 10 }, + end: { column: 3, line: 10 }, }, }, Keyword { type: "Keyword", value: "export", - range: [200, 206], + range: [219, 225], loc: { - start: { column: 2, line: 8 }, - end: { column: 8, line: 8 }, + start: { column: 2, line: 11 }, + end: { column: 8, line: 11 }, }, }, Identifier { type: "Identifier", value: "module", - range: [207, 213], + range: [226, 232], loc: { - start: { column: 9, line: 8 }, - end: { column: 15, line: 8 }, + start: { column: 9, line: 11 }, + end: { column: 15, line: 11 }, }, }, Identifier { type: "Identifier", value: "B", - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [216, 217], + range: [235, 236], loc: { - start: { column: 18, line: 8 }, - end: { column: 19, line: 8 }, + start: { column: 18, line: 11 }, + end: { column: 19, line: 11 }, }, }, Keyword { type: "Keyword", value: "export", - range: [222, 228], + range: [241, 247], loc: { - start: { column: 4, line: 9 }, - end: { column: 10, line: 9 }, + start: { column: 4, line: 12 }, + end: { column: 10, line: 12 }, }, }, Keyword { type: "Keyword", value: "interface", - range: [229, 238], + range: [248, 257], loc: { - start: { column: 11, line: 9 }, - end: { column: 20, line: 9 }, + start: { column: 11, line: 12 }, + end: { column: 20, line: 12 }, }, }, Identifier { type: "Identifier", value: "Id", - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [242, 243], + range: [261, 262], loc: { - start: { column: 24, line: 9 }, - end: { column: 25, line: 9 }, + start: { column: 24, line: 12 }, + end: { column: 25, line: 12 }, }, }, Identifier { type: "Identifier", value: "name", - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [254, 255], + range: [273, 274], loc: { - start: { column: 10, line: 10 }, - end: { column: 11, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 11, line: 13 }, }, }, Identifier { type: "Identifier", value: "string", - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [262, 263], + range: [281, 282], loc: { - start: { column: 18, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 18, line: 13 }, + end: { column: 19, line: 13 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [268, 269], + range: [287, 288], loc: { - start: { column: 4, line: 11 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 14 }, + end: { column: 5, line: 14 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [272, 273], + range: [291, 292], loc: { - start: { column: 2, line: 12 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 15 }, + end: { column: 3, line: 15 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [274, 275], + range: [293, 294], loc: { - start: { column: 0, line: 13 }, - end: { column: 1, line: 13 }, + start: { column: 0, line: 16 }, + end: { column: 1, line: 16 }, }, }, ] diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/3-Babel-AST.shot index 779d97cdbd1c..a3ded8ae19b3 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/3-Babel-AST.shot @@ -94,10 +94,10 @@ Program { type: "BlockStatement", body: [], - range: [191, 193], + range: [210, 212], loc: { - start: { column: 52, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 8, line: 9 }, }, }, expression: false, @@ -115,31 +115,31 @@ Program { typeAnnotation: TSNumberKeyword { type: "TSNumberKeyword", - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [163, 171], + range: [170, 178], loc: { - start: { column: 24, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [162, 171], + range: [169, 178], loc: { - start: { column: 23, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [155, 171], + range: [162, 178], loc: { - start: { column: 16, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 22, line: 7 }, }, }, TSParameterProperty { @@ -153,54 +153,54 @@ Program { typeAnnotation: TSNumberKeyword { type: "TSNumberKeyword", - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [181, 189], + range: [194, 202], loc: { - start: { column: 42, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [180, 189], + range: [193, 202], loc: { - start: { column: 41, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [173, 189], + range: [186, 202], loc: { - start: { column: 34, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 22, line: 8 }, }, }, ], - range: [154, 193], + range: [154, 212], loc: { start: { column: 15, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, - range: [143, 193], + range: [143, 212], loc: { start: { column: 4, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, ], - range: [137, 197], + range: [137, 216], loc: { start: { column: 21, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, id: Identifier { @@ -215,20 +215,20 @@ Program { }, superClass: null, - range: [125, 197], + range: [125, 216], loc: { start: { column: 9, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, exportKind: "value", source: null, specifiers: [], - range: [118, 197], + range: [118, 216], loc: { start: { column: 2, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, ExportNamedDeclaration { @@ -254,10 +254,10 @@ Program { type: "Identifier", name: "name", - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, typeAnnotation: TSTypeAnnotation { @@ -265,102 +265,102 @@ Program { typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [254, 262], + range: [273, 281], loc: { - start: { column: 10, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [250, 263], + range: [269, 282], loc: { - start: { column: 6, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 19, line: 13 }, }, }, ], - range: [242, 269], + range: [261, 288], loc: { - start: { column: 24, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 24, line: 12 }, + end: { column: 5, line: 14 }, }, }, id: Identifier { type: "Identifier", name: "Id", - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, - range: [229, 269], + range: [248, 288], loc: { - start: { column: 11, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 11, line: 12 }, + end: { column: 5, line: 14 }, }, }, exportKind: "type", source: null, specifiers: [], - range: [222, 269], + range: [241, 288], loc: { - start: { column: 4, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 12 }, + end: { column: 5, line: 14 }, }, }, ], - range: [216, 273], + range: [235, 292], loc: { - start: { column: 18, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 18, line: 11 }, + end: { column: 3, line: 15 }, }, }, id: Identifier { type: "Identifier", name: "B", - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, - range: [207, 273], + range: [226, 292], loc: { - start: { column: 9, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 9, line: 11 }, + end: { column: 3, line: 15 }, }, }, exportKind: "value", source: null, specifiers: [], - range: [200, 273], + range: [219, 292], loc: { - start: { column: 2, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 11 }, + end: { column: 3, line: 15 }, }, }, ], - range: [82, 275], + range: [82, 294], loc: { start: { column: 9, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, id: Identifier { @@ -374,19 +374,19 @@ Program { }, }, - range: [73, 275], + range: [73, 294], loc: { start: { column: 0, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, ], sourceType: "module", - range: [73, 276], + range: [73, 295], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 14 }, + end: { column: 0, line: 17 }, }, } `; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/4-Babel-Tokens.shot index 7819eee28a12..318246ae6292 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/4-Babel-Tokens.shot @@ -156,280 +156,290 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod type: "Identifier", value: "public", - range: [155, 161], + range: [162, 168], loc: { - start: { column: 16, line: 6 }, - end: { column: 22, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 12, line: 7 }, }, }, Identifier { type: "Identifier", value: "x", - range: [162, 163], + range: [169, 170], loc: { - start: { column: 23, line: 6 }, - end: { column: 24, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [163, 164], + range: [170, 171], loc: { - start: { column: 24, line: 6 }, - end: { column: 25, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 15, line: 7 }, }, }, Identifier { type: "Identifier", value: "number", - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ",", - range: [171, 172], + range: [178, 179], loc: { - start: { column: 32, line: 6 }, - end: { column: 33, line: 6 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, Identifier { type: "Identifier", value: "public", - range: [173, 179], + range: [186, 192], loc: { - start: { column: 34, line: 6 }, - end: { column: 40, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 12, line: 8 }, }, }, Identifier { type: "Identifier", value: "y", - range: [180, 181], + range: [193, 194], loc: { - start: { column: 41, line: 6 }, - end: { column: 42, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 14, line: 8 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [181, 182], + range: [194, 195], loc: { - start: { column: 42, line: 6 }, - end: { column: 43, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 15, line: 8 }, }, }, Identifier { type: "Identifier", value: "number", - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [202, 203], + loc: { + start: { column: 22, line: 8 }, + end: { column: 23, line: 8 }, }, }, Punctuator { type: "Punctuator", value: ")", - range: [189, 190], + range: [208, 209], loc: { - start: { column: 50, line: 6 }, - end: { column: 51, line: 6 }, + start: { column: 4, line: 9 }, + end: { column: 5, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [191, 192], + range: [210, 211], loc: { - start: { column: 52, line: 6 }, - end: { column: 53, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 7, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [192, 193], + range: [211, 212], loc: { - start: { column: 53, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 7, line: 9 }, + end: { column: 8, line: 9 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [196, 197], + range: [215, 216], loc: { - start: { column: 2, line: 7 }, - end: { column: 3, line: 7 }, + start: { column: 2, line: 10 }, + end: { column: 3, line: 10 }, }, }, Keyword { type: "Keyword", value: "export", - range: [200, 206], + range: [219, 225], loc: { - start: { column: 2, line: 8 }, - end: { column: 8, line: 8 }, + start: { column: 2, line: 11 }, + end: { column: 8, line: 11 }, }, }, Identifier { type: "Identifier", value: "module", - range: [207, 213], + range: [226, 232], loc: { - start: { column: 9, line: 8 }, - end: { column: 15, line: 8 }, + start: { column: 9, line: 11 }, + end: { column: 15, line: 11 }, }, }, Identifier { type: "Identifier", value: "B", - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [216, 217], + range: [235, 236], loc: { - start: { column: 18, line: 8 }, - end: { column: 19, line: 8 }, + start: { column: 18, line: 11 }, + end: { column: 19, line: 11 }, }, }, Keyword { type: "Keyword", value: "export", - range: [222, 228], + range: [241, 247], loc: { - start: { column: 4, line: 9 }, - end: { column: 10, line: 9 }, + start: { column: 4, line: 12 }, + end: { column: 10, line: 12 }, }, }, Identifier { type: "Identifier", value: "interface", - range: [229, 238], + range: [248, 257], loc: { - start: { column: 11, line: 9 }, - end: { column: 20, line: 9 }, + start: { column: 11, line: 12 }, + end: { column: 20, line: 12 }, }, }, Identifier { type: "Identifier", value: "Id", - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [242, 243], + range: [261, 262], loc: { - start: { column: 24, line: 9 }, - end: { column: 25, line: 9 }, + start: { column: 24, line: 12 }, + end: { column: 25, line: 12 }, }, }, Identifier { type: "Identifier", value: "name", - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [254, 255], + range: [273, 274], loc: { - start: { column: 10, line: 10 }, - end: { column: 11, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 11, line: 13 }, }, }, Identifier { type: "Identifier", value: "string", - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [262, 263], + range: [281, 282], loc: { - start: { column: 18, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 18, line: 13 }, + end: { column: 19, line: 13 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [268, 269], + range: [287, 288], loc: { - start: { column: 4, line: 11 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 14 }, + end: { column: 5, line: 14 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [272, 273], + range: [291, 292], loc: { - start: { column: 2, line: 12 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 15 }, + end: { column: 3, line: 15 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [274, 275], + range: [293, 294], loc: { - start: { column: 0, line: 13 }, - end: { column: 1, line: 13 }, + start: { column: 0, line: 16 }, + end: { column: 1, line: 16 }, }, }, ] diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot index dd7ddcca6f73..f54c0978f19e 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot @@ -108,10 +108,10 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod type: 'BlockStatement', body: Array [], - range: [191, 193], + range: [210, 212], loc: { - start: { column: 52, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 8, line: 9 }, }, }, - declare: false, @@ -134,33 +134,33 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod typeAnnotation: TSNumberKeyword { type: 'TSNumberKeyword', - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [163, 171], + range: [170, 178], loc: { - start: { column: 24, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 22, line: 7 }, }, }, - range: [162, 171], + range: [169, 178], loc: { - start: { column: 23, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 22, line: 7 }, }, }, - readonly: false, - static: false, - range: [155, 171], + range: [162, 178], loc: { - start: { column: 16, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 22, line: 7 }, }, }, TSParameterProperty { @@ -178,56 +178,56 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod typeAnnotation: TSNumberKeyword { type: 'TSNumberKeyword', - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [181, 189], + range: [194, 202], loc: { - start: { column: 42, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 22, line: 8 }, }, }, - range: [180, 189], + range: [193, 202], loc: { - start: { column: 41, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 22, line: 8 }, }, }, - readonly: false, - static: false, - range: [173, 189], + range: [186, 202], loc: { - start: { column: 34, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 22, line: 8 }, }, }, ], - range: [154, 193], + range: [154, 212], loc: { start: { column: 15, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, - range: [143, 193], + range: [143, 212], loc: { start: { column: 4, line: 6 }, - end: { column: 54, line: 6 }, + end: { column: 8, line: 9 }, }, }, ], - range: [137, 197], + range: [137, 216], loc: { start: { column: 21, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, - declare: false, @@ -247,20 +247,20 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod - implements: Array [], superClass: null, - range: [125, 197], + range: [125, 216], loc: { start: { column: 9, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, exportKind: 'value', source: null, specifiers: Array [], - range: [118, 197], + range: [118, 216], loc: { start: { column: 2, line: 5 }, - end: { column: 3, line: 7 }, + end: { column: 3, line: 10 }, }, }, ExportNamedDeclaration { @@ -288,10 +288,10 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod name: 'name', - optional: false, - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, - optional: false, @@ -302,32 +302,32 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod typeAnnotation: TSStringKeyword { type: 'TSStringKeyword', - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [254, 262], + range: [273, 281], loc: { - start: { column: 10, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 18, line: 13 }, }, }, - range: [250, 263], + range: [269, 282], loc: { - start: { column: 6, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 19, line: 13 }, }, }, ], - range: [242, 269], + range: [261, 288], loc: { - start: { column: 24, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 24, line: 12 }, + end: { column: 5, line: 14 }, }, }, - declare: false, @@ -338,35 +338,35 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod name: 'Id', - optional: false, - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, - range: [229, 269], + range: [248, 288], loc: { - start: { column: 11, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 11, line: 12 }, + end: { column: 5, line: 14 }, }, }, exportKind: 'type', source: null, specifiers: Array [], - range: [222, 269], + range: [241, 288], loc: { - start: { column: 4, line: 9 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 12 }, + end: { column: 5, line: 14 }, }, }, ], - range: [216, 273], + range: [235, 292], loc: { - start: { column: 18, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 18, line: 11 }, + end: { column: 3, line: 15 }, }, }, - declare: false, @@ -377,36 +377,36 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod name: 'B', - optional: false, - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, - kind: 'module', - range: [207, 273], + range: [226, 292], loc: { - start: { column: 9, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 9, line: 11 }, + end: { column: 3, line: 15 }, }, }, exportKind: 'value', source: null, specifiers: Array [], - range: [200, 273], + range: [219, 292], loc: { - start: { column: 2, line: 8 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 11 }, + end: { column: 3, line: 15 }, }, }, ], - range: [82, 275], + range: [82, 294], loc: { start: { column: 9, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, - declare: false, @@ -425,20 +425,20 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod }, - kind: 'module', - range: [73, 275], + range: [73, 294], loc: { start: { column: 0, line: 3 }, - end: { column: 1, line: 13 }, + end: { column: 1, line: 16 }, }, }, ], - sourceType: 'script', + sourceType: 'module', - range: [73, 276], + range: [73, 295], loc: { start: { column: 0, line: 3 }, - end: { column: 0, line: 14 }, + end: { column: 0, line: 17 }, }, }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/6-AST-Alignment-Tokens.shot index 22adb3f05ccf..0a1136396ff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/6-AST-Alignment-Tokens.shot @@ -162,50 +162,50 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod + type: 'Identifier', value: 'public', - range: [155, 161], + range: [162, 168], loc: { - start: { column: 16, line: 6 }, - end: { column: 22, line: 6 }, + start: { column: 6, line: 7 }, + end: { column: 12, line: 7 }, }, }, Identifier { type: 'Identifier', value: 'x', - range: [162, 163], + range: [169, 170], loc: { - start: { column: 23, line: 6 }, - end: { column: 24, line: 6 }, + start: { column: 13, line: 7 }, + end: { column: 14, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: ':', - range: [163, 164], + range: [170, 171], loc: { - start: { column: 24, line: 6 }, - end: { column: 25, line: 6 }, + start: { column: 14, line: 7 }, + end: { column: 15, line: 7 }, }, }, Identifier { type: 'Identifier', value: 'number', - range: [165, 171], + range: [172, 178], loc: { - start: { column: 26, line: 6 }, - end: { column: 32, line: 6 }, + start: { column: 16, line: 7 }, + end: { column: 22, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: ',', - range: [171, 172], + range: [178, 179], loc: { - start: { column: 32, line: 6 }, - end: { column: 33, line: 6 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, - Keyword { @@ -214,130 +214,140 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod + type: 'Identifier', value: 'public', - range: [173, 179], + range: [186, 192], loc: { - start: { column: 34, line: 6 }, - end: { column: 40, line: 6 }, + start: { column: 6, line: 8 }, + end: { column: 12, line: 8 }, }, }, Identifier { type: 'Identifier', value: 'y', - range: [180, 181], + range: [193, 194], loc: { - start: { column: 41, line: 6 }, - end: { column: 42, line: 6 }, + start: { column: 13, line: 8 }, + end: { column: 14, line: 8 }, }, }, Punctuator { type: 'Punctuator', value: ':', - range: [181, 182], + range: [194, 195], loc: { - start: { column: 42, line: 6 }, - end: { column: 43, line: 6 }, + start: { column: 14, line: 8 }, + end: { column: 15, line: 8 }, }, }, Identifier { type: 'Identifier', value: 'number', - range: [183, 189], + range: [196, 202], loc: { - start: { column: 44, line: 6 }, - end: { column: 50, line: 6 }, + start: { column: 16, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [202, 203], + loc: { + start: { column: 22, line: 8 }, + end: { column: 23, line: 8 }, }, }, Punctuator { type: 'Punctuator', value: ')', - range: [189, 190], + range: [208, 209], loc: { - start: { column: 50, line: 6 }, - end: { column: 51, line: 6 }, + start: { column: 4, line: 9 }, + end: { column: 5, line: 9 }, }, }, Punctuator { type: 'Punctuator', value: '{', - range: [191, 192], + range: [210, 211], loc: { - start: { column: 52, line: 6 }, - end: { column: 53, line: 6 }, + start: { column: 6, line: 9 }, + end: { column: 7, line: 9 }, }, }, Punctuator { type: 'Punctuator', value: '}', - range: [192, 193], + range: [211, 212], loc: { - start: { column: 53, line: 6 }, - end: { column: 54, line: 6 }, + start: { column: 7, line: 9 }, + end: { column: 8, line: 9 }, }, }, Punctuator { type: 'Punctuator', value: '}', - range: [196, 197], + range: [215, 216], loc: { - start: { column: 2, line: 7 }, - end: { column: 3, line: 7 }, + start: { column: 2, line: 10 }, + end: { column: 3, line: 10 }, }, }, Keyword { type: 'Keyword', value: 'export', - range: [200, 206], + range: [219, 225], loc: { - start: { column: 2, line: 8 }, - end: { column: 8, line: 8 }, + start: { column: 2, line: 11 }, + end: { column: 8, line: 11 }, }, }, Identifier { type: 'Identifier', value: 'module', - range: [207, 213], + range: [226, 232], loc: { - start: { column: 9, line: 8 }, - end: { column: 15, line: 8 }, + start: { column: 9, line: 11 }, + end: { column: 15, line: 11 }, }, }, Identifier { type: 'Identifier', value: 'B', - range: [214, 215], + range: [233, 234], loc: { - start: { column: 16, line: 8 }, - end: { column: 17, line: 8 }, + start: { column: 16, line: 11 }, + end: { column: 17, line: 11 }, }, }, Punctuator { type: 'Punctuator', value: '{', - range: [216, 217], + range: [235, 236], loc: { - start: { column: 18, line: 8 }, - end: { column: 19, line: 8 }, + start: { column: 18, line: 11 }, + end: { column: 19, line: 11 }, }, }, Keyword { type: 'Keyword', value: 'export', - range: [222, 228], + range: [241, 247], loc: { - start: { column: 4, line: 9 }, - end: { column: 10, line: 9 }, + start: { column: 4, line: 12 }, + end: { column: 10, line: 12 }, }, }, - Keyword { @@ -346,100 +356,100 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod + type: 'Identifier', value: 'interface', - range: [229, 238], + range: [248, 257], loc: { - start: { column: 11, line: 9 }, - end: { column: 20, line: 9 }, + start: { column: 11, line: 12 }, + end: { column: 20, line: 12 }, }, }, Identifier { type: 'Identifier', value: 'Id', - range: [239, 241], + range: [258, 260], loc: { - start: { column: 21, line: 9 }, - end: { column: 23, line: 9 }, + start: { column: 21, line: 12 }, + end: { column: 23, line: 12 }, }, }, Punctuator { type: 'Punctuator', value: '{', - range: [242, 243], + range: [261, 262], loc: { - start: { column: 24, line: 9 }, - end: { column: 25, line: 9 }, + start: { column: 24, line: 12 }, + end: { column: 25, line: 12 }, }, }, Identifier { type: 'Identifier', value: 'name', - range: [250, 254], + range: [269, 273], loc: { - start: { column: 6, line: 10 }, - end: { column: 10, line: 10 }, + start: { column: 6, line: 13 }, + end: { column: 10, line: 13 }, }, }, Punctuator { type: 'Punctuator', value: ':', - range: [254, 255], + range: [273, 274], loc: { - start: { column: 10, line: 10 }, - end: { column: 11, line: 10 }, + start: { column: 10, line: 13 }, + end: { column: 11, line: 13 }, }, }, Identifier { type: 'Identifier', value: 'string', - range: [256, 262], + range: [275, 281], loc: { - start: { column: 12, line: 10 }, - end: { column: 18, line: 10 }, + start: { column: 12, line: 13 }, + end: { column: 18, line: 13 }, }, }, Punctuator { type: 'Punctuator', value: ';', - range: [262, 263], + range: [281, 282], loc: { - start: { column: 18, line: 10 }, - end: { column: 19, line: 10 }, + start: { column: 18, line: 13 }, + end: { column: 19, line: 13 }, }, }, Punctuator { type: 'Punctuator', value: '}', - range: [268, 269], + range: [287, 288], loc: { - start: { column: 4, line: 11 }, - end: { column: 5, line: 11 }, + start: { column: 4, line: 14 }, + end: { column: 5, line: 14 }, }, }, Punctuator { type: 'Punctuator', value: '}', - range: [272, 273], + range: [291, 292], loc: { - start: { column: 2, line: 12 }, - end: { column: 3, line: 12 }, + start: { column: 2, line: 15 }, + end: { column: 3, line: 15 }, }, }, Punctuator { type: 'Punctuator', value: '}', - range: [274, 275], + range: [293, 294], loc: { - start: { column: 0, line: 13 }, - end: { column: 1, line: 13 }, + start: { column: 0, line: 16 }, + end: { column: 1, line: 16 }, }, }, ]" diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 72328c5ac615..bb34f02287dd 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -13,12 +13,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@types/prettier": "*", + "@prettier/sync": "*", "@typescript-eslint/rule-tester": "6.8.0", "@typescript-eslint/scope-manager": "6.8.0", "@typescript-eslint/type-utils": "6.8.0", "@typescript-eslint/utils": "6.8.0", - "prettier": "^2.8.4" + "prettier": "^3.0.3" }, "devDependencies": { "jest": "29.7.0", diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index be81846a116a..f55b9e96950c 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -1,7 +1,7 @@ +import prettier from '@prettier/sync'; import { getContextualType } from '@typescript-eslint/type-utils'; import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; -import { format, resolveConfig } from 'prettier'; import { createRule } from '../util'; @@ -45,7 +45,7 @@ const a = 1; ] */ -const prettierConfig = resolveConfig.sync(__dirname) ?? {}; +const prettierConfig = prettier.resolveConfig(__dirname) ?? {}; const START_OF_LINE_WHITESPACE_MATCHER = /^([ ]*)/; const BACKTICK_REGEX = /`/g; const TEMPLATE_EXPR_OPENER = /\$\{/g; @@ -162,13 +162,18 @@ export default createRule({ } try { - return format(code, { - ...prettierConfig, - parser: 'typescript', - }).trimEnd(); // prettier will insert a new line at the end of the code + return prettier + .format(code, { + ...prettierConfig, + parser: 'typescript', + }) + .trimEnd(); // prettier will insert a new line at the end of the code } catch (ex) { - // adapted from https://github.com/prettier/eslint-plugin-prettier/blob/185b1064d3dd674538456fb2fad97fbfcde49e0d/eslint-plugin-prettier.js#L242-L257 - if (!(ex instanceof SyntaxError)) { + // ex instanceof Error is false as of @prettier/sync@0.3.0, as is ex instanceof SyntaxError + if ( + (ex as Partial | undefined)?.constructor?.name !== + 'SyntaxError' + ) { throw ex; } const err = ex as Error & { diff --git a/packages/eslint-plugin-internal/tsconfig.json b/packages/eslint-plugin-internal/tsconfig.json index 12e8b67a5a34..cc78ba59388e 100644 --- a/packages/eslint-plugin-internal/tsconfig.json +++ b/packages/eslint-plugin-internal/tsconfig.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.build.json", "compilerOptions": { "composite": false, + "target": "ES2022", "rootDir": "." }, "include": ["src", "typings", "tests"], diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 3c9cdadfc377..29d4343d1c0d 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -57,7 +57,7 @@ "@types/lodash": "*", "@typescript-eslint/parser": "6.8.0", "jest": "29.7.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*" }, "funding": { diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts index bd8ce6a5be1a..b4e8d753b8f9 100644 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ b/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -4,7 +4,10 @@ import type { Program, SourceFile } from 'typescript'; // @ts-expect-error - We need to access the program, but Linter has private program already export class CustomLinter extends Linter { - constructor(options: ILinterOptions, private readonly program: Program) { + constructor( + options: ILinterOptions, + private readonly program: Program, + ) { super(options, program); } diff --git a/packages/eslint-plugin/docs/rules/default-param-last.md b/packages/eslint-plugin/docs/rules/default-param-last.md index 62c3889012b7..909f9ac10d0f 100644 --- a/packages/eslint-plugin/docs/rules/default-param-last.md +++ b/packages/eslint-plugin/docs/rules/default-param-last.md @@ -20,10 +20,16 @@ function f(a = 0, b: number) {} function f(a: number, b = 0, c: number) {} function f(a: number, b?: number, c: number) {} class Foo { - constructor(public a = 10, private b: number) {} + constructor( + public a = 10, + private b: number, + ) {} } class Foo { - constructor(public a?: number, private b: number) {} + constructor( + public a?: number, + private b: number, + ) {} } ``` @@ -38,9 +44,15 @@ function f(a: number, b?: number) {} function f(a: number, b?: number, c = 0) {} function f(a: number, b = 0, c?: number) {} class Foo { - constructor(public a, private b = 0) {} + constructor( + public a, + private b = 0, + ) {} } class Foo { - constructor(public a, private b?: number) {} + constructor( + public a, + private b?: number, + ) {} } ``` diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index c7ac599ac56c..7c7b82028555 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -209,14 +209,14 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions #### ❌ Incorrect ```ts -const func = (value: number) => ({ type: 'X', value } as any); -const func = (value: number) => ({ type: 'X', value } as Action); +const func = (value: number) => ({ type: 'X', value }) as any; +const func = (value: number) => ({ type: 'X', value }) as Action; ``` #### ✅ Correct ```ts -const func = (value: number) => ({ foo: 'bar', value } as const); +const func = (value: number) => ({ foo: 'bar', value }) as const; const func = () => x as const; ``` diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 51fa8523582f..fe74bfce0273 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -90,7 +90,10 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -113,7 +116,10 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -136,7 +142,10 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, name) { + constructor( + protected breed, + name, + ) { // Parameter property and constructor this.name = name; } diff --git a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index e48af85195d8..d10515e261cd 100644 --- a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -131,11 +131,11 @@ export const bar = () => 1; #### ✅ Correct ```ts -export const func = (value: number) => ({ type: 'X', value } as const); +export const func = (value: number) => ({ type: 'X', value }) as const; export const foo = () => ({ bar: true, - } as const); + }) as const; export const bar = () => 1 as const; ``` diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index f82b2082cb48..9f8e069f77e4 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -69,10 +69,10 @@ "ts-api-utils": "^1.0.1" }, "devDependencies": { + "@prettier/sync": "*", "@types/debug": "*", "@types/marked": "*", "@types/natural-compare": "*", - "@types/prettier": "*", "@typescript-eslint/rule-schema-to-typescript-types": "6.8.0", "@typescript-eslint/rule-tester": "6.8.0", "ajv": "^6.12.6", @@ -84,7 +84,7 @@ "json-schema": "*", "markdown-table": "^3.0.3", "marked": "^5.1.1", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "title-case": "^3.0.3", "tsx": "*", diff --git a/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts b/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts index de6a73e536ca..825eceb29d97 100644 --- a/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts @@ -12,12 +12,12 @@ ruleTester.run('arrow-parens', rule, { valid: [ // https://github.com/typescript-eslint/typescript-eslint/issues/14 noFormat`const foo = (t) => {};`, - 'const foo = (t) => {};', - 'const foo = (t: T) => {};', + 'const foo = (t) => {};', + 'const foo = (t: T) => {};', 'const foo = ((t: T) => {});', 'const foo = function (t: T) {};', ` -const foo = (bar: any): void => { +const foo = (bar: any): void => { // Do nothing }; `, @@ -26,7 +26,7 @@ const foo = (bar: any): void => { options: ['as-needed'], }, { - code: 'const foo = (t) => {};', + code: 'const foo = (t) => {};', options: ['as-needed'], }, { @@ -34,11 +34,11 @@ const foo = (bar: any): void => { options: ['as-needed'], }, { - code: 'const foo = (t: T) => {};', + code: 'const foo = (t: T) => {};', options: ['as-needed'], }, { - code: 'const foo = (t: T) => ({});', + code: 'const foo = (t: T) => ({});', options: ['as-needed', { requireForBlockBody: true }], }, ], diff --git a/packages/eslint-plugin/tests/rules/default-param-last.test.ts b/packages/eslint-plugin/tests/rules/default-param-last.test.ts index 317434d9d445..33be682be7c5 100644 --- a/packages/eslint-plugin/tests/rules/default-param-last.test.ts +++ b/packages/eslint-plugin/tests/rules/default-param-last.test.ts @@ -60,32 +60,56 @@ class Foo { `, ` class Foo { - constructor(public a: number, protected b: number, private c: number) {} + constructor( + public a: number, + protected b: number, + private c: number, + ) {} } `, ` class Foo { - constructor(public a: number, protected b?: number, private c = 10) {} + constructor( + public a: number, + protected b?: number, + private c = 10, + ) {} } `, ` class Foo { - constructor(public a: number, protected b = 10, private c?: number) {} + constructor( + public a: number, + protected b = 10, + private c?: number, + ) {} } `, ` class Foo { - constructor(a: number, protected b?: number, private c = 0) {} + constructor( + a: number, + protected b?: number, + private c = 0, + ) {} } `, ` class Foo { - constructor(a: number, b?: number, private c = 0) {} + constructor( + a: number, + b?: number, + private c = 0, + ) {} } `, ` class Foo { - constructor(a: number, private b?: number, c = 0) {} + constructor( + a: number, + private b?: number, + c = 0, + ) {} } `, ], @@ -576,60 +600,74 @@ class Foo { { code: ` class Foo { - constructor(public a: number, protected b?: number, private c: number) {} + constructor( + public a: number, + protected b?: number, + private c: number, + ) {} } `, errors: [ { messageId: 'shouldBeLast', - line: 3, - column: 33, - endColumn: 53, + line: 5, + column: 5, + endColumn: 25, }, ], }, { code: ` class Foo { - constructor(public a: number, protected b = 0, private c: number) {} + constructor( + public a: number, + protected b = 0, + private c: number, + ) {} } `, errors: [ { messageId: 'shouldBeLast', - line: 3, - column: 33, - endColumn: 48, + line: 5, + column: 5, + endColumn: 20, }, ], }, { code: ` class Foo { - constructor(public a?: number, private b: number) {} + constructor( + public a?: number, + private b: number, + ) {} } `, errors: [ { messageId: 'shouldBeLast', - line: 3, - column: 15, - endColumn: 32, + line: 4, + column: 5, + endColumn: 22, }, ], }, { code: ` class Foo { - constructor(public a = 0, private b: number) {} + constructor( + public a = 0, + private b: number, + ) {} } `, errors: [ { messageId: 'shouldBeLast', - line: 3, - column: 15, - endColumn: 27, + line: 4, + column: 5, + endColumn: 17, }, ], }, diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index d65263a9c023..0036b5f94d90 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -338,8 +338,8 @@ foo({ }, { code: ` -const func = (value: number) => ({ type: 'X', value } as const); -const func = (value: number) => ({ type: 'X', value } as const); +const func = (value: number) => ({ type: 'X', value }) as const; +const func = (value: number) => ({ type: 'X', value }) as const; const func = (value: number) => x as const; const func = (value: number) => x as const; `, @@ -369,7 +369,7 @@ new Foo(1, () => {}); options: [{ allowFunctionsWithoutTypeParameters: true }], }, { - code: 'const log = (a: A): A => a;', + code: 'const log = (a: A): A => a;', options: [{ allowFunctionsWithoutTypeParameters: true }], }, { @@ -1320,8 +1320,8 @@ const x: HigherOrderType = () => arg1 => arg2 => 'foo'; }, { code: ` -const func = (value: number) => ({ type: 'X', value } as any); -const func = (value: number) => ({ type: 'X', value } as Action); +const func = (value: number) => ({ type: 'X', value }) as any; +const func = (value: number) => ({ type: 'X', value }) as Action; `, options: [ { @@ -1347,7 +1347,7 @@ const func = (value: number) => ({ type: 'X', value } as Action); }, { code: ` -const func = (value: number) => ({ type: 'X', value } as const); +const func = (value: number) => ({ type: 'X', value }) as const; `, options: [ { @@ -1397,7 +1397,7 @@ const func = (value: number) => ({ type: 'X', value } as const); ], }, { - code: 'const log = (a: A) => a;', + code: 'const log = (a: A) => a;', errors: [{ messageId: 'missingReturnType' }], options: [{ allowFunctionsWithoutTypeParameters: true }], }, diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index ce9176c136b4..8a945ceca631 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -334,8 +334,8 @@ new Accumulator().accumulate(() => 1); }, { code: ` -export const func1 = (value: number) => ({ type: 'X', value } as const); -export const func2 = (value: number) => ({ type: 'X', value } as const); +export const func1 = (value: number) => ({ type: 'X', value }) as const; +export const func2 = (value: number) => ({ type: 'X', value }) as const; export const func3 = (value: number) => x as const; export const func4 = (value: number) => x as const; `, @@ -1133,8 +1133,8 @@ export default () => () => { }, { code: ` -export const func1 = (value: number) => ({ type: 'X', value } as any); -export const func2 = (value: number) => ({ type: 'X', value } as Action); +export const func1 = (value: number) => ({ type: 'X', value }) as any; +export const func2 = (value: number) => ({ type: 'X', value }) as Action; `, options: [ { @@ -1160,7 +1160,7 @@ export const func2 = (value: number) => ({ type: 'X', value } as Action); }, { code: ` -export const func = (value: number) => ({ type: 'X', value } as const); +export const func = (value: number) => ({ type: 'X', value }) as const; `, options: [ { @@ -1217,22 +1217,25 @@ export class Test { { code: ` export class Test { - constructor(public foo, private ...bar) {} + constructor( + public foo, + private ...bar, + ) {} } `, errors: [ { messageId: 'missingArgType', - line: 3, - column: 22, + line: 4, + column: 12, data: { name: 'foo', }, }, { messageId: 'missingArgType', - line: 3, - column: 27, + line: 5, + column: 5, data: { name: 'bar', }, diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index 731fc22d9c42..6150f9476f33 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -568,7 +568,10 @@ ruleTester.run('naming-convention', rule, { { code: ` class Ignored { - constructor(private readonly some_name, IgnoredDueToModifiers) {} + constructor( + private readonly some_name, + IgnoredDueToModifiers, + ) {} } `, options: [ @@ -1588,7 +1591,10 @@ ruleTester.run('naming-convention', rule, { { code: ` class Ignored { - constructor(private readonly some_name, IgnoredDueToModifiers) {} + constructor( + private readonly some_name, + IgnoredDueToModifiers, + ) {} } `, options: [ diff --git a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts index 00ba6e4a51f7..7252bd3501c2 100644 --- a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts +++ b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts @@ -120,7 +120,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { 'type Generic = [T];', 'type voidPromiseUnion = void | Promise;', 'type promiseNeverUnion = Promise | never;', - 'const arrowGeneric1 = (arg: T) => {};', + 'const arrowGeneric1 = (arg: T) => {};', 'declare function functionDeclaration1(arg: T): void;', ], invalid: [ diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts index 121378f78fd6..2b1f6841f2c1 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts @@ -22,7 +22,7 @@ type TODO = any; function data() {} `, 'const data = () => {};', - 'const data = () => {};', + 'const data = () => {};', 'const data = () => {};', 'const data = () => {};', 'const data = () => {};', diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts index 2646f3ce55bc..636e2fe8d2c1 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts @@ -147,12 +147,12 @@ bar(); `, ` import { Foo } from 'foo'; -const bar = (): T => {}; +const bar = (): T => {}; bar(); `, ` import { Foo } from 'foo'; -((): T => {})(); +((): T => {})(); `, ` import { Nullable } from 'nullable'; @@ -469,7 +469,10 @@ export class App { `, ` export class App { - constructor(baz: string, private logger: Logger) { + constructor( + baz: string, + private logger: Logger, + ) { console.log(baz); console.log(this.logger); } @@ -477,7 +480,11 @@ export class App { `, ` export class App { - constructor(baz: string, private logger: Logger, private bar: () => void) { + constructor( + baz: string, + private logger: Logger, + private bar: () => void, + ) { console.log(this.logger); this.bar(); } @@ -699,7 +706,7 @@ export namespace Foo { } `, ` -export namespace foo.bar { +namespace foo.bar { export interface User { name: string; } diff --git a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts index 6a60e06ee893..6323a5858bba 100644 --- a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts +++ b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts @@ -96,7 +96,10 @@ class Foo { { code: ` class Foo { - constructor(readonly name: string, private age: number) {} + constructor( + readonly name: string, + private age: number, + ) {} } `, options: [{ allow: ['readonly', 'private'] }], @@ -104,7 +107,10 @@ class Foo { { code: ` class Foo { - constructor(public readonly name: string, private age: number) {} + constructor( + public readonly name: string, + private age: number, + ) {} } `, options: [{ allow: ['public readonly', 'private'] }], @@ -148,7 +154,10 @@ class Foo { { code: ` class Foo { - constructor(private age: string, ...name: string[]) {} + constructor( + private age: string, + ...name: string[] + ) {} } `, options: [{ prefer: 'parameter-property' }], @@ -437,7 +446,10 @@ class Foo { { code: ` class Foo { - constructor(public name: string, age: number) {} + constructor( + public name: string, + age: number, + ) {} } `, errors: [ @@ -446,15 +458,18 @@ class Foo { data: { parameter: 'name', }, - line: 3, - column: 15, + line: 4, + column: 5, }, ], }, { code: ` class Foo { - constructor(private name: string, private age: number) {} + constructor( + private name: string, + private age: number, + ) {} } `, errors: [ @@ -463,23 +478,26 @@ class Foo { data: { parameter: 'name', }, - line: 3, - column: 15, + line: 4, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 3, - column: 37, + line: 5, + column: 5, }, ], }, { code: ` class Foo { - constructor(protected name: string, protected age: number) {} + constructor( + protected name: string, + protected age: number, + ) {} } `, errors: [ @@ -488,23 +506,26 @@ class Foo { data: { parameter: 'name', }, - line: 3, - column: 15, + line: 4, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 3, - column: 39, + line: 5, + column: 5, }, ], }, { code: ` class Foo { - constructor(public name: string, public age: number) {} + constructor( + public name: string, + public age: number, + ) {} } `, errors: [ @@ -513,16 +534,16 @@ class Foo { data: { parameter: 'name', }, - line: 3, - column: 15, + line: 4, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 3, - column: 36, + line: 5, + column: 5, }, ], }, @@ -530,7 +551,10 @@ class Foo { code: ` class Foo { constructor(name: string) {} - constructor(private name: string, age?: number) {} + constructor( + private name: string, + age?: number, + ) {} } `, errors: [ @@ -539,8 +563,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -548,7 +572,10 @@ class Foo { code: ` class Foo { constructor(private name: string) {} - constructor(private name: string, age?: number) {} + constructor( + private name: string, + age?: number, + ) {} } `, errors: [ @@ -565,8 +592,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -574,7 +601,10 @@ class Foo { code: ` class Foo { constructor(private name: string) {} - constructor(private name: string, private age?: number) {} + constructor( + private name: string, + private age?: number, + ) {} } `, errors: [ @@ -591,16 +621,16 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 4, - column: 37, + line: 6, + column: 5, }, ], }, @@ -608,7 +638,10 @@ class Foo { code: ` class Foo { constructor(name: string) {} - constructor(protected name: string, age?: number) {} + constructor( + protected name: string, + age?: number, + ) {} } `, errors: [ @@ -617,8 +650,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -626,7 +659,10 @@ class Foo { code: ` class Foo { constructor(protected name: string) {} - constructor(protected name: string, age?: number) {} + constructor( + protected name: string, + age?: number, + ) {} } `, errors: [ @@ -643,8 +679,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -652,7 +688,10 @@ class Foo { code: ` class Foo { constructor(protected name: string) {} - constructor(protected name: string, protected age?: number) {} + constructor( + protected name: string, + protected age?: number, + ) {} } `, errors: [ @@ -669,16 +708,16 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 4, - column: 39, + line: 6, + column: 5, }, ], }, @@ -686,7 +725,10 @@ class Foo { code: ` class Foo { constructor(name: string) {} - constructor(public name: string, age?: number) {} + constructor( + public name: string, + age?: number, + ) {} } `, errors: [ @@ -695,8 +737,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -704,7 +746,10 @@ class Foo { code: ` class Foo { constructor(public name: string) {} - constructor(public name: string, age?: number) {} + constructor( + public name: string, + age?: number, + ) {} } `, errors: [ @@ -721,8 +766,8 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, ], }, @@ -730,7 +775,10 @@ class Foo { code: ` class Foo { constructor(public name: string) {} - constructor(public name: string, public age?: number) {} + constructor( + public name: string, + public age?: number, + ) {} } `, errors: [ @@ -747,16 +795,16 @@ class Foo { data: { parameter: 'name', }, - line: 4, - column: 15, + line: 5, + column: 5, }, { messageId: 'preferClassProperty', data: { parameter: 'age', }, - line: 4, - column: 36, + line: 6, + column: 5, }, ], }, @@ -896,7 +944,10 @@ class Foo { code: ` class Foo { constructor(private name: string) {} - constructor(private name: string, protected age?: number) {} + constructor( + private name: string, + protected age?: number, + ) {} } `, options: [{ allow: ['private'] }], @@ -906,8 +957,8 @@ class Foo { data: { parameter: 'age', }, - line: 4, - column: 37, + line: 6, + column: 5, }, ], }, diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot index 8ae5a4a339d9..668f54f1a3b4 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -1791,7 +1791,7 @@ type Options = /** Multiple selectors in one config */ filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('requiresQuotes')[]; + modifiers?: 'requiresQuotes'[]; prefix?: PrefixSuffixConfig; selector: 'enumMember'; suffix?: PrefixSuffixConfig; @@ -2009,7 +2009,7 @@ type Options = /** Multiple selectors in one config */ filter?: MatchRegexConfig | string; format: FormatOptionsConfig; leadingUnderscore?: UnderscoreOptions; - modifiers?: ('unused')[]; + modifiers?: 'unused'[]; prefix?: PrefixSuffixConfig; selector: 'typeParameter'; suffix?: PrefixSuffixConfig; diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts index 8ac28f96d82d..5524203d1815 100644 --- a/packages/eslint-plugin/tests/schemas.test.ts +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -3,8 +3,8 @@ import 'jest-specific-snapshot'; import fs from 'node:fs'; import path from 'node:path'; +import prettier from '@prettier/sync'; import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; -import { format, resolveConfig } from 'prettier'; import rules from '../src/rules/index'; import { areOptionsValid } from './areOptionsValid'; @@ -17,7 +17,7 @@ try { } const prettierConfigJson = { - ...(resolveConfig.sync(__filename) ?? {}), + ...(prettier.resolveConfig(__filename) ?? {}), filepath: path.join(__dirname, 'schema.json'), }; @@ -34,7 +34,7 @@ describe('Rule schemas should be convertible to TS types for documentation purpo } (ruleName === ONLY ? it.only : it)(ruleName, () => { - const schemaString = format( + const schemaString = prettier.format( JSON.stringify( ruleDef.meta.schema, (k, v: unknown) => { diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 8fac06d16687..fdd536d47179 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -1,7 +1,7 @@ +import prettier from '@prettier/sync'; import type { TSESLint } from '@typescript-eslint/utils'; import * as fs from 'fs'; import * as path from 'path'; -import prettier from 'prettier'; import * as url from 'url'; import type RulesFile from '../src/rules'; @@ -45,7 +45,7 @@ async function main(): Promise { ].join('\n'); } - const prettierConfig = prettier.resolveConfig.sync(__dirname); + const prettierConfig = prettier.resolveConfig(__dirname); type LinterConfigRules = Record; diff --git a/packages/parser/package.json b/packages/parser/package.json index 060ae6868b8c..c960f6f52b3a 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -62,7 +62,7 @@ "downlevel-dts": "*", "glob": "*", "jest": "29.7.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "typescript": "*" }, diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 78e130463252..501b127ab905 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -15,9 +15,10 @@ }, "devDependencies": { "@nx/devkit": "*", + "@prettier/sync": "*", "cross-fetch": "*", "execa": "*", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "tmp": "*", "typescript": "*" diff --git a/packages/repo-tools/src/generate-lib.ts b/packages/repo-tools/src/generate-lib.ts index 29cf0536f975..dc397d4e2289 100644 --- a/packages/repo-tools/src/generate-lib.ts +++ b/packages/repo-tools/src/generate-lib.ts @@ -1,3 +1,4 @@ +import prettier from '@prettier/sync'; import type { AnalyzeOptions, ScopeManager, @@ -11,7 +12,6 @@ import { parse } from '@typescript-eslint/typescript-estree'; import { ESLint } from '@typescript-eslint/utils/ts-eslint'; import * as fs from 'fs'; import * as path from 'path'; -import { format, resolveConfig } from 'prettier'; import { rimraf } from 'rimraf'; import * as ts from 'typescript'; @@ -54,7 +54,7 @@ function addAutoGeneratedComment(code: string[]): string { ].join('\n'); } -const PRETTIER_CONFIG = resolveConfig.sync(__dirname); +const PRETTIER_CONFIG = prettier.resolveConfig(__dirname); const TS_LIB_FOLDER = path.resolve( __dirname, '..', @@ -94,7 +94,7 @@ enum BASE_CONFIG_EXPORT_NAMES { } function formatCode(code: string[]): string { - return format(addAutoGeneratedComment(code), { + return prettier.format(addAutoGeneratedComment(code), { parser: 'typescript', ...PRETTIER_CONFIG, }); diff --git a/packages/repo-tools/src/generate-sponsors.ts b/packages/repo-tools/src/generate-sponsors.ts index cbec8141ddc1..c8b7a3b9cebc 100644 --- a/packages/repo-tools/src/generate-sponsors.ts +++ b/packages/repo-tools/src/generate-sponsors.ts @@ -1,7 +1,7 @@ import fetch from 'cross-fetch'; import * as fs from 'fs'; import * as path from 'path'; -import * as prettier from 'prettier'; +import prettier from 'prettier'; const graphqlEndpoint = 'https://api.opencollective.com/graphql/v2'; @@ -184,7 +184,7 @@ async function stringifyObject( 2, ); - return prettier.format(text, { + return await prettier.format(text, { ...config, parser: 'json', }); diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index 5618b65612f6..843c585ef7e6 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -33,10 +33,11 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { + "@prettier/sync": "*", "@typescript-eslint/type-utils": "6.8.0", "@typescript-eslint/utils": "6.8.0", "natural-compare": "^1.4.0", - "prettier": "^2.8.4" + "prettier": "^3.0.3" }, "funding": { "type": "opencollective", diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts index e998719a3060..90a553e2fd7d 100644 --- a/packages/rule-schema-to-typescript-types/src/index.ts +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -1,7 +1,7 @@ +import prettier from '@prettier/sync'; import { TSUtils } from '@typescript-eslint/utils'; import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import path from 'path'; -import { format as prettierFormat, resolveConfig } from 'prettier'; import { generateType } from './generateType'; import { optimizeAST } from './optimizeAST'; @@ -9,7 +9,7 @@ import { printTypeAlias } from './printAST'; import type { AST } from './types'; const prettierConfig = { - ...(resolveConfig.sync(__filename) ?? {}), + ...(prettier.resolveConfig(__filename) ?? {}), filepath: path.join(__dirname, 'schema.ts'), }; @@ -52,7 +52,7 @@ export function compile( const unformattedCode = [...refTypes, optionsType].join('\n\n'); try { - return prettierFormat(unformattedCode, prettierConfig); + return prettier.format(unformattedCode, prettierConfig); } catch (e) { if (e instanceof Error) { e.message = e.message + `\n\nUnformatted Code:\n${unformattedCode}`; diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 5c946ee0cf89..dcde5405ea20 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -48,6 +48,7 @@ "@typescript-eslint/visitor-keys": "6.8.0" }, "devDependencies": { + "@prettier/sync": "*", "@types/glob": "*", "@typescript-eslint/typescript-estree": "6.8.0", "glob": "*", diff --git a/packages/scope-manager/tests/fixtures/decorators/parameter-property.ts b/packages/scope-manager/tests/fixtures/decorators/parameter-property.ts index 1b2a5356f7c4..b3d208fd3f01 100644 --- a/packages/scope-manager/tests/fixtures/decorators/parameter-property.ts +++ b/packages/scope-manager/tests/fixtures/decorators/parameter-property.ts @@ -1,4 +1,7 @@ function decorator() {} class Foo { - constructor(@decorator readonly a, @decorator readonly b = 1) {} + constructor( + @decorator readonly a, + @decorator readonly b = 1, + ) {} } diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 4bef583afa8a..a634ea6bea0d 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -55,7 +55,7 @@ "ajv": "^6.10.0", "downlevel-dts": "*", "jest": "29.7.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "typescript": "*" }, diff --git a/packages/types/package.json b/packages/types/package.json index 5c9215235be3..79b23109624d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -74,7 +74,7 @@ }, "devDependencies": { "downlevel-dts": "*", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "tsx": "*", "typescript": "*" diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index e1393b9b35af..1f4d549d4ed5 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -67,7 +67,7 @@ "jest": "29.7.0", "jest-specific-snapshot": "^8.0.0", "make-dir": "*", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "tmp": "*", "typescript": "*" diff --git a/packages/utils/package.json b/packages/utils/package.json index c77e0d25816f..2d304d444bc2 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -80,7 +80,7 @@ "@typescript-eslint/parser": "6.8.0", "downlevel-dts": "*", "jest": "29.7.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "typescript": "*" }, diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 97f987cf1708..3cf36f70cc49 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -52,7 +52,7 @@ "@types/eslint-visitor-keys": "*", "downlevel-dts": "*", "jest": "29.7.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rimraf": "*", "typescript": "*" }, diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 8fe99d7a08c5..8fd2e543233f 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -36,7 +36,7 @@ "esbuild": "~0.19.0", "eslint": "*", "esquery": "*", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "rollup": "^2.75.4", "rollup-plugin-terser": "^7.0.2", "semver": "^7.5.4", diff --git a/packages/website/package.json b/packages/website/package.json index 6e2659e85665..0b938368f914 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -23,6 +23,7 @@ "@docusaurus/remark-plugin-npm2yarn": "~2.4.1", "@docusaurus/theme-common": "~2.4.1", "@mdx-js/react": "1.6.22", + "@prettier/sync": "*", "@typescript-eslint/parser": "6.8.0", "@typescript-eslint/website-eslint": "6.8.0", "clsx": "^2.0.0", @@ -31,7 +32,7 @@ "json5": "^2.2.3", "konamimojisplosion": "^0.5.2", "lz-string": "^1.5.0", - "prettier": "^2.8.4", + "prettier": "^3.0.3", "prism-react-renderer": "^1.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index 9f4d013d5455..207b11720bff 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -1,3 +1,4 @@ +import prettier from '@prettier/sync'; import pluginRules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; import * as fs from 'fs'; @@ -5,7 +6,6 @@ import * as lz from 'lz-string'; import type * as mdast from 'mdast'; import { EOL } from 'os'; import * as path from 'path'; -import { format, resolveConfig } from 'prettier'; import type { Plugin } from 'unified'; import type * as unist from 'unist'; @@ -29,7 +29,7 @@ const SPECIAL_CASE_DEFAULTS = new Map([ ]); const prettierConfig = { - ...(resolveConfig.sync(__filename) ?? {}), + ...(prettier.resolveConfig(__filename) ?? {}), filepath: path.join(__dirname, 'defaults.ts'), }; @@ -287,7 +287,7 @@ export const generatedRuleDocs: Plugin = () => { type: 'code', value: [ compile(rule.meta.schema), - format( + prettier.format( `const defaultOptions: Options = ${defaults};`, prettierConfig, ), diff --git a/packages/website/src/components/ErrorsViewer.module.css b/packages/website/src/components/ErrorsViewer.module.css index 4cfc2e15d18c..83d29207fd59 100644 --- a/packages/website/src/components/ErrorsViewer.module.css +++ b/packages/website/src/components/ErrorsViewer.module.css @@ -7,7 +7,9 @@ font-size: 13px; line-height: 18px; letter-spacing: 0; - font-feature-settings: 'liga' 0, 'calt' 0; + font-feature-settings: + 'liga' 0, + 'calt' 0; box-sizing: border-box; margin: 0; white-space: break-spaces; diff --git a/packages/website/src/components/RulesTable/styles.module.css b/packages/website/src/components/RulesTable/styles.module.css index 2f9aefd132d7..3ffcec037609 100644 --- a/packages/website/src/components/RulesTable/styles.module.css +++ b/packages/website/src/components/RulesTable/styles.module.css @@ -104,8 +104,10 @@ margin-left: 0; opacity: 0; width: 0; - transition: margin-left var(--ifm-transition-fast), - opacity var(--ifm-transition-fast), width var(--ifm-transition-fast); + transition: + margin-left var(--ifm-transition-fast), + opacity var(--ifm-transition-fast), + width var(--ifm-transition-fast); } .visual.visual-exclude::after, diff --git a/packages/website/src/components/ast/ASTViewer.module.css b/packages/website/src/components/ast/ASTViewer.module.css index b986c95305e6..b872078b8d06 100644 --- a/packages/website/src/components/ast/ASTViewer.module.css +++ b/packages/website/src/components/ast/ASTViewer.module.css @@ -6,7 +6,9 @@ font-size: 13px; line-height: 18px; letter-spacing: 0; - font-feature-settings: 'liga' 0, 'calt' 0; + font-feature-settings: + 'liga' 0, + 'calt' 0; position: relative; min-width: 100%; } diff --git a/packages/website/src/components/config/ConfigEditor.module.css b/packages/website/src/components/config/ConfigEditor.module.css index 940c7a825ee9..ceab4a98c419 100644 --- a/packages/website/src/components/config/ConfigEditor.module.css +++ b/packages/website/src/components/config/ConfigEditor.module.css @@ -12,7 +12,8 @@ .searchResult { margin: 0; - transition: background-color var(--ifm-transition-fast) + transition: + background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default), color var(--ifm-transition-fast) var(--ifm-transition-timing-default); } diff --git a/packages/website/src/components/inputs/CopyButton.module.css b/packages/website/src/components/inputs/CopyButton.module.css index c60c53bb5453..9967e6ddf82f 100644 --- a/packages/website/src/components/inputs/CopyButton.module.css +++ b/packages/website/src/components/inputs/CopyButton.module.css @@ -22,7 +22,9 @@ align-items: center; display: flex; line-height: 0; - transition: opacity 0.2s ease-in-out, border-color 0.4s ease-in-out, + transition: + opacity 0.2s ease-in-out, + border-color 0.4s ease-in-out, color 0.4s ease-in-out; } diff --git a/packages/website/src/components/layout/Expander.module.css b/packages/website/src/components/layout/Expander.module.css index 79699d0ee783..2e77070b22e6 100644 --- a/packages/website/src/components/layout/Expander.module.css +++ b/packages/website/src/components/layout/Expander.module.css @@ -9,7 +9,8 @@ display: flex; flex-direction: row; align-items: center; - transition: background-color var(--ifm-transition-fast) + transition: + background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default), color var(--ifm-transition-fast) var(--ifm-transition-timing-default); color: var(--ifm-color-emphasis-900); diff --git a/packages/website/src/components/layout/InputLabel.module.css b/packages/website/src/components/layout/InputLabel.module.css index 7c4e4491e6a5..1d9440616f13 100644 --- a/packages/website/src/components/layout/InputLabel.module.css +++ b/packages/website/src/components/layout/InputLabel.module.css @@ -7,7 +7,8 @@ font-size: 0.75rem; margin: 0; padding: 0.4rem 0.8rem; - transition: background-color var(--ifm-transition-fast) + transition: + background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default), color var(--ifm-transition-fast) var(--ifm-transition-timing-default); color: var(--ifm-font-color-secondary); diff --git a/packages/website/tools/generate-website-dts.ts b/packages/website/tools/generate-website-dts.ts index 6f7525b9f0da..303615e1fe08 100644 --- a/packages/website/tools/generate-website-dts.ts +++ b/packages/website/tools/generate-website-dts.ts @@ -35,7 +35,7 @@ async function getFileAndStoreLocally( let contents = await response.text(); contents = [...banner, '', editFunc(contents)].join('\n'); - contents = prettier.format(contents, { + contents = await prettier.format(contents, { parser: 'typescript', ...config, }); diff --git a/yarn.lock b/yarn.lock index 4b7ad262bad0..aabfe67553f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4522,6 +4522,15 @@ __metadata: languageName: node linkType: hard +"@prettier/sync@npm:*, @prettier/sync@npm:^0.3.0": + version: 0.3.0 + resolution: "@prettier/sync@npm:0.3.0" + peerDependencies: + prettier: ^3.0.0 + checksum: a663ceca292629c66c2c983662293b047b48435942c25b7ea76f0eab899e434f2bc17ae3dce56ee66b29929f7853118073f716fd4c7dabc3cccf78458a168dd4 + languageName: node + linkType: hard + "@rollup/plugin-babel@npm:^5.2.0": version: 5.3.1 resolution: "@rollup/plugin-babel@npm:5.3.1" @@ -5478,13 +5487,6 @@ __metadata: languageName: node linkType: hard -"@types/prettier@npm:*, @types/prettier@npm:^2.7.2": - version: 2.7.3 - resolution: "@types/prettier@npm:2.7.3" - checksum: 705384209cea6d1433ff6c187c80dcc0b95d99d5c5ce21a46a9a58060c527973506822e428789d842761e0280d25e3359300f017fbe77b9755bc772ab3dc2f83 - languageName: node - linkType: hard - "@types/prop-types@npm:*": version: 15.7.5 resolution: "@types/prop-types@npm:15.7.5" @@ -5702,7 +5704,7 @@ __metadata: jest-snapshot: ^29.6.2 jest-specific-snapshot: ^8.0.0 make-dir: "*" - prettier: ^2.8.4 + prettier: ^3.0.3 pretty-format: "*" rimraf: "*" typescript: "*" @@ -5713,13 +5715,13 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/eslint-plugin-internal@workspace:packages/eslint-plugin-internal" dependencies: - "@types/prettier": "*" + "@prettier/sync": "*" "@typescript-eslint/rule-tester": 6.8.0 "@typescript-eslint/scope-manager": 6.8.0 "@typescript-eslint/type-utils": 6.8.0 "@typescript-eslint/utils": 6.8.0 jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" languageName: unknown linkType: soft @@ -5732,7 +5734,7 @@ __metadata: "@typescript-eslint/parser": 6.8.0 "@typescript-eslint/utils": 6.8.0 jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -5746,10 +5748,10 @@ __metadata: resolution: "@typescript-eslint/eslint-plugin@workspace:packages/eslint-plugin" dependencies: "@eslint-community/regexpp": ^4.5.1 + "@prettier/sync": "*" "@types/debug": "*" "@types/marked": "*" "@types/natural-compare": "*" - "@types/prettier": "*" "@typescript-eslint/rule-schema-to-typescript-types": 6.8.0 "@typescript-eslint/rule-tester": 6.8.0 "@typescript-eslint/scope-manager": 6.8.0 @@ -5769,7 +5771,7 @@ __metadata: markdown-table: ^3.0.3 marked: ^5.1.1 natural-compare: ^1.4.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" semver: ^7.5.4 title-case: ^3.0.3 @@ -5807,7 +5809,7 @@ __metadata: downlevel-dts: "*" glob: "*" jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" typescript: "*" peerDependencies: @@ -5823,9 +5825,10 @@ __metadata: resolution: "@typescript-eslint/repo-tools@workspace:packages/repo-tools" dependencies: "@nx/devkit": "*" + "@prettier/sync": "*" cross-fetch: "*" execa: "*" - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" tmp: "*" typescript: "*" @@ -5836,10 +5839,11 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/rule-schema-to-typescript-types@workspace:packages/rule-schema-to-typescript-types" dependencies: + "@prettier/sync": "*" "@typescript-eslint/type-utils": 6.8.0 "@typescript-eslint/utils": 6.8.0 natural-compare: ^1.4.0 - prettier: ^2.8.4 + prettier: ^3.0.3 languageName: unknown linkType: soft @@ -5868,6 +5872,7 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/scope-manager@workspace:packages/scope-manager" dependencies: + "@prettier/sync": "*" "@types/glob": "*" "@typescript-eslint/types": 6.8.0 "@typescript-eslint/typescript-estree": 6.8.0 @@ -5901,7 +5906,7 @@ __metadata: debug: ^4.3.4 downlevel-dts: "*" jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" ts-api-utils: ^1.0.1 typescript: "*" @@ -5918,7 +5923,7 @@ __metadata: resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: downlevel-dts: "*" - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" tsx: "*" typescript: "*" @@ -5946,6 +5951,7 @@ __metadata: "@nx/jest": 16.8.1 "@nx/linter": 16.8.1 "@nx/workspace": 16.8.1 + "@prettier/sync": ^0.3.0 "@swc/core": ^1.3.68 "@swc/jest": ^0.2.26 "@types/babel__code-frame": ^7.0.3 @@ -5958,7 +5964,6 @@ __metadata: "@types/natural-compare": ^1.4.1 "@types/ncp": ^2.0.5 "@types/node": ^20.0.0 - "@types/prettier": ^2.7.2 "@types/semver": ^7.5.0 "@types/tmp": ^0.2.3 console-fail-test: ^0.2.3 @@ -5991,7 +5996,7 @@ __metadata: netlify: ^13.1.9 nx: 16.8.1 nx-cloud: 16.4.0 - prettier: ^2.8.4 + prettier: 3.0.3 pretty-format: ^29.6.2 raw-loader: ^4.0.2 rimraf: ^5.0.1 @@ -6018,7 +6023,7 @@ __metadata: jest: 29.7.0 jest-specific-snapshot: ^8.0.0 make-dir: "*" - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" semver: ^7.5.4 tmp: "*" @@ -6061,7 +6066,7 @@ __metadata: "@typescript-eslint/typescript-estree": 6.8.0 downlevel-dts: "*" jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" semver: ^7.5.4 typescript: "*" @@ -6097,7 +6102,7 @@ __metadata: downlevel-dts: "*" eslint-visitor-keys: ^3.4.1 jest: 29.7.0 - prettier: ^2.8.4 + prettier: ^3.0.3 rimraf: "*" typescript: "*" languageName: unknown @@ -6128,7 +6133,7 @@ __metadata: esbuild: ~0.19.0 eslint: "*" esquery: "*" - prettier: ^2.8.4 + prettier: ^3.0.3 rollup: ^2.75.4 rollup-plugin-terser: ^7.0.2 semver: ^7.5.4 @@ -16806,12 +16811,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^2.8.4": - version: 2.8.8 - resolution: "prettier@npm:2.8.8" +"prettier@npm:3.0.3, prettier@npm:^3.0.3": + version: 3.0.3 + resolution: "prettier@npm:3.0.3" bin: - prettier: bin-prettier.js - checksum: b49e409431bf129dd89238d64299ba80717b57ff5a6d1c1a8b1a28b590d998a34e083fa13573bc732bb8d2305becb4c9a4407f8486c81fa7d55100eb08263cf8 + prettier: bin/prettier.cjs + checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0 languageName: node linkType: hard @@ -20745,6 +20750,7 @@ __metadata: "@docusaurus/remark-plugin-npm2yarn": ~2.4.1 "@docusaurus/theme-common": ~2.4.1 "@mdx-js/react": 1.6.22 + "@prettier/sync": "*" "@types/react": "*" "@types/react-helmet": ^6.1.6 "@types/react-router-dom": ^5.3.3 @@ -20764,7 +20770,7 @@ __metadata: lz-string: ^1.5.0 make-dir: "*" monaco-editor: ~0.43.0 - prettier: ^2.8.4 + prettier: ^3.0.3 prism-react-renderer: ^1.3.3 raw-loader: ^4.0.2 react: ^18.2.0