From 0262ff6ea8cb4049cc0a2b3b2fc4262fcc58e2ad Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 28 Aug 2022 07:59:39 +0000 Subject: [PATCH 01/11] Update dependency typescript to v4.8.2 --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 52d84505f2b3..3eb52ce857e8 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "string-width": "5.0.1", "strip-ansi": "7.0.1", "to-fast-properties": "4.0.0", - "typescript": "4.7.4", + "typescript": "4.8.2", "unicode-regex": "3.0.0", "unified": "9.2.2", "vnopts": "1.0.2", diff --git a/yarn.lock b/yarn.lock index d50aded68c41..7ccb834b4137 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6998,7 +6998,7 @@ __metadata: strip-ansi: 7.0.1 tempy: 3.0.0 to-fast-properties: 4.0.0 - typescript: 4.7.4 + typescript: 4.8.2 unicode-regex: 3.0.0 unified: 9.2.2 vnopts: 1.0.2 @@ -8289,23 +8289,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:4.7.4": - version: 4.7.4 - resolution: "typescript@npm:4.7.4" +"typescript@npm:4.8.2": + version: 4.8.2 + resolution: "typescript@npm:4.8.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 5750181b1cd7e6482c4195825547e70f944114fb47e58e4aa7553e62f11b3f3173766aef9c281783edfd881f7b8299cf35e3ca8caebe73d8464528c907a164df + checksum: 7f5b81d0d558c9067f952c7af52ab7f19c2e70a916817929e4a5b256c93990bf3178eccb1ac8a850bc75df35f6781b6f4cb3370ce20d8b1ded92ed462348f628 languageName: node linkType: hard -"typescript@patch:typescript@4.7.4#~builtin": - version: 4.7.4 - resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin::version=4.7.4&hash=a1c5e5" +"typescript@patch:typescript@4.8.2#~builtin": + version: 4.8.2 + resolution: "typescript@patch:typescript@npm%3A4.8.2#~builtin::version=4.8.2&hash=a1c5e5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 9096d8f6c16cb80ef3bf96fcbbd055bf1c4a43bd14f3b7be45a9fbe7ada46ec977f604d5feed3263b4f2aa7d4c7477ce5f9cd87de0d6feedec69a983f3a4f93e + checksum: 5cb0f02f414f5405f4b0e7ee1fd7fa9177b6a8783c9017b6cad85f56ce4c4f93e0e6f2ce37e863cb597d44227cd009474c9fbd85bf7a50004e5557426cb58079 languageName: node linkType: hard From 4cbd94dd2de40d6d6ed3706150d9f25a8e6a4bdc Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 15:06:36 +0800 Subject: [PATCH 02/11] Update `@typescript-eslint/*` --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3eb52ce857e8..b998acec26af 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "@babel/types": "7.18.13", "@glimmer/syntax": "0.84.2", "@iarna/toml": "2.2.5", - "@typescript-eslint/typescript-estree": "5.35.1", - "@typescript-eslint/visitor-keys": "5.35.1", + "@typescript-eslint/typescript-estree": "5.36.1", + "@typescript-eslint/visitor-keys": "5.36.1", "acorn": "8.8.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "2.5.1", @@ -104,7 +104,7 @@ "@types/file-entry-cache": "5.0.2", "@types/find-cache-dir": "3.2.1", "@types/jest": "29.0.0", - "@typescript-eslint/eslint-plugin": "5.35.1", + "@typescript-eslint/eslint-plugin": "5.36.1", "benchmark": "2.1.4", "browserslist-to-esbuild": "1.2.0", "c8": "7.12.0", From 96d9575df55c8c5434e9ccbbfa64d80845aec57d Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 15:50:01 +0800 Subject: [PATCH 03/11] Fix `tsDecorators` --- .../parse/postprocess/typescript.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/language-js/parse/postprocess/typescript.js b/src/language-js/parse/postprocess/typescript.js index 6a1a7b2d5a82..5bac90d74141 100644 --- a/src/language-js/parse/postprocess/typescript.js +++ b/src/language-js/parse/postprocess/typescript.js @@ -1,6 +1,15 @@ +import isNonEmptyArray from "../../../utils/is-non-empty-array.js"; import visitNode from "./visit-node.js"; import throwTsSyntaxError from "./throw-ts-syntax-error.js"; +const getTsDecorators = (tsNode) => + tsNode.modifiers?.filter( + (node) => + node.kind === + // require('typescript').SyntaxKind.Decorator + 165 + ); + // Invalid decorators are removed since `@typescript-eslint/typescript-estree` v4 // https://github.com/typescript-eslint/typescript-eslint/pull/2375 function throwErrorForInvalidDecorator( @@ -8,10 +17,15 @@ function throwErrorForInvalidDecorator( esTreeNode, tsNodeToESTreeNodeMap ) { - const tsDecorators = tsNode.decorators; - if (!Array.isArray(tsDecorators)) { + const tsModifiers = tsNode.modifiers; + if (!Array.isArray(tsModifiers)) { + return; + } + const tsDecorators = getTsDecorators(tsNode); + if (!isNonEmptyArray(tsDecorators)) { return; } + const esTreeDecorators = esTreeNode.decorators; if ( !Array.isArray(esTreeDecorators) || From 257694f3b12aa8de591e78c49bd478bd649cfe4b Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 16:27:49 +0800 Subject: [PATCH 04/11] Fix `throwErrorForInvalidDecorator` --- .../parse/postprocess/typescript.js | 56 ++++++-------- .../__snapshots__/jsfmt.spec.js.snap | 77 +++++++++---------- 2 files changed, 58 insertions(+), 75 deletions(-) diff --git a/src/language-js/parse/postprocess/typescript.js b/src/language-js/parse/postprocess/typescript.js index 5bac90d74141..9a6ae9d679ea 100644 --- a/src/language-js/parse/postprocess/typescript.js +++ b/src/language-js/parse/postprocess/typescript.js @@ -1,45 +1,32 @@ -import isNonEmptyArray from "../../../utils/is-non-empty-array.js"; import visitNode from "./visit-node.js"; import throwTsSyntaxError from "./throw-ts-syntax-error.js"; -const getTsDecorators = (tsNode) => - tsNode.modifiers?.filter( - (node) => - node.kind === - // require('typescript').SyntaxKind.Decorator - 165 - ); +// Copied from https://unpkg.com/typescript@4.8.2/lib/typescript.js +function getSourceFileOfNode(node) { + while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + node = node.parent; + } + return node; +} // Invalid decorators are removed since `@typescript-eslint/typescript-estree` v4 // https://github.com/typescript-eslint/typescript-eslint/pull/2375 -function throwErrorForInvalidDecorator( - tsNode, - esTreeNode, - tsNodeToESTreeNodeMap -) { - const tsModifiers = tsNode.modifiers; - if (!Array.isArray(tsModifiers)) { - return; - } - const tsDecorators = getTsDecorators(tsNode); - if (!isNonEmptyArray(tsDecorators)) { +function throwErrorForInvalidDecorator(tsNode) { + const illegalDecorator = tsNode.illegalDecorators?.[0]; + if (!illegalDecorator) { return; } +console.log(illegalDecorator) + const sourceFile = getSourceFileOfNode(illegalDecorator); + const [start, end] = [illegalDecorator.pos, illegalDecorator.end].map( + (position) => { + const { line, character: column } = + sourceFile.getLineAndCharacterOfPosition(position); + return { line: line + 1, column }; + } + ); - const esTreeDecorators = esTreeNode.decorators; - if ( - !Array.isArray(esTreeDecorators) || - esTreeDecorators.length !== tsDecorators.length || - tsDecorators.some((tsDecorator) => { - const esTreeDecorator = tsNodeToESTreeNodeMap.get(tsDecorator); - return !esTreeDecorator || !esTreeDecorators.includes(esTreeDecorator); - }) - ) { - throwTsSyntaxError( - esTreeNode, - "Leading decorators must be attached to a class declaration" - ); - } + throwTsSyntaxError({ loc: { start, end } }, "Decorators are not valid here."); } // Values of abstract property is removed since `@typescript-eslint/typescript-estree` v5 @@ -73,12 +60,13 @@ function throwErrorForInvalidNodes(ast, options) { if (!tsNode) { return; } + const esTreeNode = tsNodeToESTreeNodeMap.get(tsNode); if (esTreeNode !== node) { return; } - throwErrorForInvalidDecorator(tsNode, esTreeNode, tsNodeToESTreeNodeMap); + throwErrorForInvalidDecorator(tsNode); throwErrorForInvalidAbstractProperty(tsNode, esTreeNode); }); } diff --git a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap index 8d1286b597dd..a2c63243e5a3 100644 --- a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap @@ -10,13 +10,14 @@ exports[`decorator.ts [babel-ts] format 1`] = ` `; exports[`decorator.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) - 1 | declare function dec(target: T): T; - 2 | +"Decorators are not valid here. (1:39) +> 1 | declare function dec(target: T): T; + | ^ +> 2 | + | ^ > 3 | @dec - | ^^^^ -> 4 | enum E {} - | ^^^^^^^^^^ + | ^^^^^ + 4 | enum E {} 5 |" `; @@ -32,24 +33,16 @@ exports[`enums.ts [babel-ts] format 1`] = ` `; exports[`enums.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) - 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - 2 | -> 3 | @decorator() - | ^^^^^^^^^^^^ -> 4 | enum Direction { - | ^^^^^^^^^^^^^^^^ -> 5 | Up = 1, - | ^^^^^^^^^^^^^^^^ -> 6 | Down, - | ^^^^^^^^^^^^^^^^ -> 7 | Left, - | ^^^^^^^^^^^^^^^^ -> 8 | Right - | ^^^^^^^^^^^^^^^^ -> 9 | } - | ^^ - 10 |" +"Decorators are not valid here. (1:1) +> 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 2 | + | ^ +> 3 | @decorator() + | ^^^^^^^^^^^^^ + 4 | enum Direction { + 5 | Up = 1, + 6 | Down," `; exports[`function.ts [babel-ts] format 1`] = ` @@ -62,13 +55,14 @@ exports[`function.ts [babel-ts] format 1`] = ` `; exports[`function.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) - 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - 2 | +"Decorators are not valid here. (1:1) +> 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 2 | + | ^ > 3 | @decorator() - | ^^^^^^^^^^^^ -> 4 | function foo( ){} - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ + 4 | function foo( ){} 5 |" `; @@ -83,15 +77,17 @@ exports[`interface.ts [babel-ts] format 1`] = ` `; exports[`interface.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (4:1) - 2 | // #4632 - 3 | -> 4 | @hello() +"Decorators are not valid here. (1:1) +> 1 | // invalid place but shouldn't be removed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +> 2 | // #4632 | ^^^^^^^^ -> 5 | interface MyInterface {id: string; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 6 | } - | ^^ +> 3 | + | ^^^^^^^^ +> 4 | @hello() + | ^^^^^^^^^ + 5 | interface MyInterface {id: string; + 6 | } 7 |" `; @@ -105,11 +101,10 @@ exports[`issue-9102.ts [babel-ts] format 1`] = ` `; exports[`issue-9102.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (1:1) +"Decorators are not valid here. (1:1) > 1 | @Decorator() | ^^^^^^^^^^^^ -> 2 | type T = 1; - | ^^^^^^^^^^^^ + 2 | type T = 1; 3 | class C {} 4 |" `; From d409e5212a0c92b7e168bf707b25b012d0d6de9d Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 16:35:29 +0800 Subject: [PATCH 05/11] Add comment --- src/language-js/parse/postprocess/typescript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/language-js/parse/postprocess/typescript.js b/src/language-js/parse/postprocess/typescript.js index 9a6ae9d679ea..a191e0abc975 100644 --- a/src/language-js/parse/postprocess/typescript.js +++ b/src/language-js/parse/postprocess/typescript.js @@ -11,12 +11,13 @@ function getSourceFileOfNode(node) { // Invalid decorators are removed since `@typescript-eslint/typescript-estree` v4 // https://github.com/typescript-eslint/typescript-eslint/pull/2375 +// There is a `checkGrammarDecorators` in `typescript` package, consider use it directly in future function throwErrorForInvalidDecorator(tsNode) { const illegalDecorator = tsNode.illegalDecorators?.[0]; if (!illegalDecorator) { return; } -console.log(illegalDecorator) + const sourceFile = getSourceFileOfNode(illegalDecorator); const [start, end] = [illegalDecorator.pos, illegalDecorator.end].map( (position) => { From 6746ddf9907c414167f426b50deeabfb396a46fc Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 16:54:48 +0800 Subject: [PATCH 06/11] Update snapshot --- .../instantiation-expression/__snapshots__/jsfmt.spec.js.snap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap index 974c9bdab73a..75e7a6721b94 100644 --- a/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap @@ -26,7 +26,8 @@ new A < B > C =====================================output===================================== -new A() < B > C; +new A(); +C; ================================================================================ `; From f6110f970721dff8fd88b6de44eae5116a43a20c Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 31 Aug 2022 17:34:54 +0800 Subject: [PATCH 07/11] Improve code frame location --- .../parse/postprocess/typescript.js | 21 +++++---- .../__snapshots__/jsfmt.spec.js.snap | 46 ++++++++----------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/src/language-js/parse/postprocess/typescript.js b/src/language-js/parse/postprocess/typescript.js index a191e0abc975..2d9ffb3c2074 100644 --- a/src/language-js/parse/postprocess/typescript.js +++ b/src/language-js/parse/postprocess/typescript.js @@ -1,3 +1,4 @@ +import isNonEmptyArray from "../../../utils/is-non-empty-array.js"; import visitNode from "./visit-node.js"; import throwTsSyntaxError from "./throw-ts-syntax-error.js"; @@ -13,19 +14,19 @@ function getSourceFileOfNode(node) { // https://github.com/typescript-eslint/typescript-eslint/pull/2375 // There is a `checkGrammarDecorators` in `typescript` package, consider use it directly in future function throwErrorForInvalidDecorator(tsNode) { - const illegalDecorator = tsNode.illegalDecorators?.[0]; - if (!illegalDecorator) { + const { illegalDecorators } = tsNode; + if (!isNonEmptyArray(illegalDecorators)) { return; } - const sourceFile = getSourceFileOfNode(illegalDecorator); - const [start, end] = [illegalDecorator.pos, illegalDecorator.end].map( - (position) => { - const { line, character: column } = - sourceFile.getLineAndCharacterOfPosition(position); - return { line: line + 1, column }; - } - ); + const [{ expression }] = illegalDecorators; + + const sourceFile = getSourceFileOfNode(expression); + const [start, end] = [expression.pos, expression.end].map((position) => { + const { line, character: column } = + sourceFile.getLineAndCharacterOfPosition(position); + return { line: line + 1, column }; + }); throwTsSyntaxError({ loc: { start, end } }, "Decorators are not valid here."); } diff --git a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap index a2c63243e5a3..26d9fed0966b 100644 --- a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap @@ -10,13 +10,11 @@ exports[`decorator.ts [babel-ts] format 1`] = ` `; exports[`decorator.ts [typescript] format 1`] = ` -"Decorators are not valid here. (1:39) -> 1 | declare function dec(target: T): T; - | ^ -> 2 | - | ^ +"Decorators are not valid here. (3:2) + 1 | declare function dec(target: T): T; + 2 | > 3 | @dec - | ^^^^^ + | ^^^ 4 | enum E {} 5 |" `; @@ -33,13 +31,11 @@ exports[`enums.ts [babel-ts] format 1`] = ` `; exports[`enums.ts [typescript] format 1`] = ` -"Decorators are not valid here. (1:1) -> 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 2 | - | ^ +"Decorators are not valid here. (3:2) + 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 + 2 | > 3 | @decorator() - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ 4 | enum Direction { 5 | Up = 1, 6 | Down," @@ -55,13 +51,11 @@ exports[`function.ts [babel-ts] format 1`] = ` `; exports[`function.ts [typescript] format 1`] = ` -"Decorators are not valid here. (1:1) -> 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 2 | - | ^ +"Decorators are not valid here. (3:2) + 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 + 2 | > 3 | @decorator() - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ 4 | function foo( ){} 5 |" `; @@ -77,15 +71,11 @@ exports[`interface.ts [babel-ts] format 1`] = ` `; exports[`interface.ts [typescript] format 1`] = ` -"Decorators are not valid here. (1:1) -> 1 | // invalid place but shouldn't be removed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 2 | // #4632 - | ^^^^^^^^ -> 3 | - | ^^^^^^^^ +"Decorators are not valid here. (4:2) + 2 | // #4632 + 3 | > 4 | @hello() - | ^^^^^^^^^ + | ^^^^^^^ 5 | interface MyInterface {id: string; 6 | } 7 |" @@ -101,9 +91,9 @@ exports[`issue-9102.ts [babel-ts] format 1`] = ` `; exports[`issue-9102.ts [typescript] format 1`] = ` -"Decorators are not valid here. (1:1) +"Decorators are not valid here. (1:2) > 1 | @Decorator() - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^ 2 | type T = 1; 3 | class C {} 4 |" From 348d79885e51d5551a4aa438e5d6b627ad6d1a42 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Tue, 6 Sep 2022 09:52:10 +0800 Subject: [PATCH 08/11] Update `@typescript-eslint/*` --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b998acec26af..e4d5371a9e0f 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "@babel/types": "7.18.13", "@glimmer/syntax": "0.84.2", "@iarna/toml": "2.2.5", - "@typescript-eslint/typescript-estree": "5.36.1", - "@typescript-eslint/visitor-keys": "5.36.1", + "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/visitor-keys": "5.36.2", "acorn": "8.8.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "2.5.1", @@ -104,7 +104,7 @@ "@types/file-entry-cache": "5.0.2", "@types/find-cache-dir": "3.2.1", "@types/jest": "29.0.0", - "@typescript-eslint/eslint-plugin": "5.36.1", + "@typescript-eslint/eslint-plugin": "5.36.2", "benchmark": "2.1.4", "browserslist-to-esbuild": "1.2.0", "c8": "7.12.0", From b3650f1126e7a2233b9ada2e72d59cdda1bdee1b Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Tue, 6 Sep 2022 09:58:18 +0800 Subject: [PATCH 09/11] Update `@typescript-eslint/*` --- yarn.lock | 87 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7ccb834b4137..8d0c403923ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1635,13 +1635,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/eslint-plugin@npm:5.35.1" +"@typescript-eslint/eslint-plugin@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/eslint-plugin@npm:5.36.2" dependencies: - "@typescript-eslint/scope-manager": 5.35.1 - "@typescript-eslint/type-utils": 5.35.1 - "@typescript-eslint/utils": 5.35.1 + "@typescript-eslint/scope-manager": 5.36.2 + "@typescript-eslint/type-utils": 5.36.2 + "@typescript-eslint/utils": 5.36.2 debug: ^4.3.4 functional-red-black-tree: ^1.0.1 ignore: ^5.2.0 @@ -1654,25 +1654,26 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 073f4dffd863881f1c87e1c217ac13bda44aaa2db12ef260032b5e8eb6ffd6b9cf6f62c85132dbf84152f353c435c66dd4f75c3bcb86eb23e926737aa4fb66fa + checksum: edcd9fcecdeb22a689b421cafe3b7adc859bf2fd6227aecdd7412c319c808e7bab063c8f94af32116cfc971962f9780d181cb0a4aa999951c2d2be1f84c6c376 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/scope-manager@npm:5.35.1" +"@typescript-eslint/scope-manager@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/scope-manager@npm:5.36.2" dependencies: - "@typescript-eslint/types": 5.35.1 - "@typescript-eslint/visitor-keys": 5.35.1 - checksum: 5a969a081309bac5962f99ee6dfdfd9c68ea677bc79d9796592dce82a36217f67aa55c7bf421b2c97b46c5149d6a9401bb4c57829595e8c19f47cfa9e8c2dd86 + "@typescript-eslint/types": 5.36.2 + "@typescript-eslint/visitor-keys": 5.36.2 + checksum: 93ff655f7c237c88ec6dc5911202dd8f81bd8909b27f1a758a9d77e9791040f1ee6fe2891314bde75c808ce586246e98003a1b1396937b0312f2440016dea751 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/type-utils@npm:5.35.1" +"@typescript-eslint/type-utils@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/type-utils@npm:5.36.2" dependencies: - "@typescript-eslint/utils": 5.35.1 + "@typescript-eslint/typescript-estree": 5.36.2 + "@typescript-eslint/utils": 5.36.2 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -1680,23 +1681,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: af317ba156f2767f76a7f97193873a00468370e157fdcc6ac19f664bc6c4c0a6836bd25028d17fdd54d339b6842fda68b82f1ce4142a222de6953625ea6c0a9c + checksum: c202b7d2cd08ed7f7d1ad7e430e9e1596478e147f0d485d02babfda0211c55fa950de1dc4d1c950008a8a047a31c1e982e97fe5558f93d496830eb9d9532bc71 languageName: node linkType: hard -"@typescript-eslint/types@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/types@npm:5.35.1" - checksum: a4e1001867f43f3364b109fc5a07b91ae7a34b78ab191c6c5c4695dac9bb2b80b0a602651c0b807c1c7c1fc3656d2bbd47c637afa08a09e7b1c39eae3c489e00 +"@typescript-eslint/types@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/types@npm:5.36.2" + checksum: 736cb8a76b58f2f9a7d066933094c5510ffe31479ea8b804a829ec85942420f1b55e0eb2688fbdaaaa9c0e5b3b590fb8f14bbd745353696b4fd33fda620d417b languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/typescript-estree@npm:5.35.1" +"@typescript-eslint/typescript-estree@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/typescript-estree@npm:5.36.2" dependencies: - "@typescript-eslint/types": 5.35.1 - "@typescript-eslint/visitor-keys": 5.35.1 + "@typescript-eslint/types": 5.36.2 + "@typescript-eslint/visitor-keys": 5.36.2 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -1705,33 +1706,33 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: a917ca4753a3f92c8d8555c96f5414383a9742761625476fa36a019401543aa74996159afa0f7fc7fae05fe0f904e3c6f4153a55412070c8a94e8171e81084c7 + checksum: 2827ff57a114b6107ea6d555f3855007133b08a7c2bafba0cfa0c935d8b99fd7b49e982d48cccc1c5ba550d95748d0239f5e2109893f12a165d76ed64a0d261b languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.35.1, @typescript-eslint/utils@npm:^5.10.0": - version: 5.35.1 - resolution: "@typescript-eslint/utils@npm:5.35.1" +"@typescript-eslint/utils@npm:5.36.2, @typescript-eslint/utils@npm:^5.10.0": + version: 5.36.2 + resolution: "@typescript-eslint/utils@npm:5.36.2" dependencies: "@types/json-schema": ^7.0.9 - "@typescript-eslint/scope-manager": 5.35.1 - "@typescript-eslint/types": 5.35.1 - "@typescript-eslint/typescript-estree": 5.35.1 + "@typescript-eslint/scope-manager": 5.36.2 + "@typescript-eslint/types": 5.36.2 + "@typescript-eslint/typescript-estree": 5.36.2 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 2b04092583c3139dd090727c24fb9d7fdb1fb9f20f2e3f0141cab5b98b6a1934b0fc8cab948f7faae55588385b0f1fb7bbf91f52c705ce4528036a527c3119c6 + checksum: 45356cf55a8733e3ab1f2c3c19cdaefdb79857e35eb1433c29b81f3df071e9cef8a286bc407abe243889a21d9e793e999f92f03b9c727a0fac1c17a48e64c42a languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.35.1": - version: 5.35.1 - resolution: "@typescript-eslint/visitor-keys@npm:5.35.1" +"@typescript-eslint/visitor-keys@npm:5.36.2": + version: 5.36.2 + resolution: "@typescript-eslint/visitor-keys@npm:5.36.2" dependencies: - "@typescript-eslint/types": 5.35.1 + "@typescript-eslint/types": 5.36.2 eslint-visitor-keys: ^3.3.0 - checksum: ef3c8377aac89935b5cc2fcf37bb3e42aa5f98848e7c22bdcbe5bb06c0fe8a1373a6897fd21109be8929b4708ad06c8874d2ef7bba17ff64911964203457330d + checksum: 87ccdcfa5cdedaa3a1aac30d656969f4f5910b62bcaacdf80a514dbf0cbbd8e79b55f8e987eab34cc79ece8ce4b8c19d5caf8b0afb74e0b0d7ab39fb29aa8eba languageName: node linkType: hard @@ -6899,9 +6900,9 @@ __metadata: "@types/file-entry-cache": 5.0.2 "@types/find-cache-dir": 3.2.1 "@types/jest": 29.0.0 - "@typescript-eslint/eslint-plugin": 5.35.1 - "@typescript-eslint/typescript-estree": 5.35.1 - "@typescript-eslint/visitor-keys": 5.35.1 + "@typescript-eslint/eslint-plugin": 5.36.2 + "@typescript-eslint/typescript-estree": 5.36.2 + "@typescript-eslint/visitor-keys": 5.36.2 acorn: 8.8.0 acorn-jsx: 5.3.2 angular-estree-parser: 2.5.1 From 56164a406dd7ffc1d696d0b40fa4c3bbcd5fcf48 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Tue, 6 Sep 2022 10:03:20 +0800 Subject: [PATCH 10/11] Remove outdated code --- tests/config/format-test.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/config/format-test.js b/tests/config/format-test.js index 98151797d787..9802c444e3c3 100644 --- a/tests/config/format-test.js +++ b/tests/config/format-test.js @@ -78,10 +78,7 @@ const meriyahDisabledTests = new Set([ ), ]); const babelTsDisabledTest = new Set( - [ - // Disabled temporarily https://github.com/babel/babel/issues/14777#issuecomment-1191474632 - "instantiation-expression", - ].map((directory) => path.join(__dirname, "../format/typescript", directory)) + [].map((directory) => path.join(__dirname, "../format/typescript", directory)) ); const isUnstable = (filename, options) => { From e4ae38ee754e34812025e4198172062a2edc51b7 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Tue, 6 Sep 2022 20:45:48 +0800 Subject: [PATCH 11/11] Enable check --- scripts/build/modify-typescript-module.mjs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/build/modify-typescript-module.mjs b/scripts/build/modify-typescript-module.mjs index da1b4760729c..815c7b5f266b 100644 --- a/scripts/build/modify-typescript-module.mjs +++ b/scripts/build/modify-typescript-module.mjs @@ -47,14 +47,12 @@ function removeSubmodule(text, testFunction) { function replaceSubmodule(text, testFunction, replacement) { const modules = getSubmodules(text, testFunction); if (modules.length !== 1) { - return text; - // TODO: Enable this check when merge to `next` branch - // throw Object.assign( - // new Error( - // `Expect exactly one submodule to be found, got ${modules.length} submodules.` - // ), - // { modules } - // ); + throw Object.assign( + new Error( + `Expect exactly one submodule to be found, got ${modules.length} submodules.` + ), + { modules } + ); } const [{ start, end, before, after }] = modules;