From 67569cc360df9da25078e6a3898461557f66c22b Mon Sep 17 00:00:00 2001 From: reduckted Date: Tue, 23 Feb 2021 04:08:05 +1000 Subject: [PATCH 01/24] docs(eslint-plugin): Corrected numbering of selector order for naming-convention (#3085) --- packages/eslint-plugin/docs/rules/naming-convention.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index fc4d914e449f..ff9f8e79a3cf 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -320,8 +320,8 @@ To clearly spell it out: - (3) is tested first because it has `types` and is an individual selector. - (2) is tested next because it is an individual selector. -- (1) is tested next as it is a grouped selector. -- (4) is tested last as it is the base default selector. +- (4) is tested next as it is a grouped selector. +- (1) is tested last as it is the base default selector. Its worth noting that whilst this order is applied, all selectors may not run on a name. This is explained in ["How does the rule evaluate a name's format?"](#how-does-the-rule-evaluate-a-names-format) From 2b6f634ff8d0ca60d808e48ccfaff7c3fc939b3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:08:51 -0800 Subject: [PATCH 02/24] chore: bump husky from 5.0.9 to 5.1.0 (#3089) Bumps [husky](https://github.com/typicode/husky) from 5.0.9 to 5.1.0. - [Release notes](https://github.com/typicode/husky/releases) - [Commits](https://github.com/typicode/husky/compare/v5.0.9...v5.1.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 831a96fd4bb7..044928910fe0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4634,9 +4634,9 @@ humanize-ms@^1.2.1: ms "^2.0.0" husky@^5.0.9: - version "5.0.9" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.0.9.tgz#6d38706643d66ed395bcd4ee952d02e3f15eb3a3" - integrity sha512-0SjcaY21a+IRdx7p7r/X33Vc09UR2m8SbP8yfkhUX2/jAmwcz+GR7i9jXkp2pP3GfX23JhMkVP6SWwXB18uXtg== + version "5.1.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.0.tgz#68b1148523acc838af0655ead71bf4671adb9f93" + integrity sha512-Os0EY2haOO+59YZSwMiUDsHY43RFwBVIRStHcnnT8/kvA+sFfaA/YS4uLFRiymXYgQl6E6TQTt3y4v/Z2ctEtw== iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" From 7053d39d30423ae6f2b37a5c8d9ac94238215990 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:09:00 -0800 Subject: [PATCH 03/24] chore: bump eslint-plugin-jest from 24.1.3 to 24.1.5 (#3087) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.1.3 to 24.1.5. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.1.3...v24.1.5) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 044928910fe0..b448706c89ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3686,9 +3686,9 @@ eslint-plugin-import@^2.22.0: tsconfig-paths "^3.9.0" eslint-plugin-jest@^24.1.3: - version "24.1.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz#fa3db864f06c5623ff43485ca6c0e8fc5fe8ba0c" - integrity sha512-dNGGjzuEzCE3d5EPZQ/QGtmlMotqnYWD/QpCZ1UuZlrMAdhG5rldh0N0haCvhGnUkSeuORS5VNROwF9Hrgn3Lg== + version "24.1.5" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz#1e866a9f0deac587d0a3d5d7cefe99815a580de2" + integrity sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" From 5e24be5afd4661a2cbc7e28c6cc02cd4d3509390 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:09:19 -0800 Subject: [PATCH 04/24] chore: bump @babel/parser from 7.12.16 to 7.12.17 (#3086) Bumps [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) from 7.12.16 to 7.12.17. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.12.17/packages/babel-parser) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b448706c89ec..f87a1f3e331c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -151,9 +151,9 @@ js-tokens "^4.0.0" "@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.12.16": - version "7.12.16" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.16.tgz#cc31257419d2c3189d394081635703f549fc1ed4" - integrity sha512-c/+u9cqV6F0+4Hpq01jnJO+GLp2DdT63ppz9Xa+6cHaajM9VFzK/iDXiKK65YtpeVwu+ctfS6iqlMqRgQRzeCw== + version "7.12.17" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.17.tgz#bc85d2d47db38094e5bb268fc761716e7d693848" + integrity sha512-r1yKkiUTYMQ8LiEI0UcQx5ETw5dpTLn9wijn9hk6KkTtOK95FndDN10M+8/s6k/Ymlbivw0Av9q4SlgF80PtHg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" From 406804b5d9fdbf827827f0234609456dfd78db50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:09:33 -0800 Subject: [PATCH 05/24] chore: bump lodash from 4.17.20 to 4.17.21 (#3088) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f87a1f3e331c..93ff4567d5d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5957,9 +5957,9 @@ lodash.uniq@^4.5.0: integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= lodash@4.x, lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.2.1: - version "4.17.20" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" - integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== log-symbols@^4.0.0: version "4.0.0" From 2b0ad1455f8e5c7ca58dcf33aa219f74a4ab0afa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:34:38 -0800 Subject: [PATCH 06/24] chore: bump husky from 5.0.9 to 5.1.1 (#3095) Bumps [husky](https://github.com/typicode/husky) from 5.0.9 to 5.1.1. - [Release notes](https://github.com/typicode/husky/releases) - [Commits](https://github.com/typicode/husky/compare/v5.0.9...v5.1.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 93ff4567d5d8..760e16c500e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4634,9 +4634,9 @@ humanize-ms@^1.2.1: ms "^2.0.0" husky@^5.0.9: - version "5.1.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.0.tgz#68b1148523acc838af0655ead71bf4671adb9f93" - integrity sha512-Os0EY2haOO+59YZSwMiUDsHY43RFwBVIRStHcnnT8/kvA+sFfaA/YS4uLFRiymXYgQl6E6TQTt3y4v/Z2ctEtw== + version "5.1.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.1.1.tgz#8678953fd8deb86f387cbf1ad50bb2f7f96e83f2" + integrity sha512-80LZ736V0Nr4/st0c2COYaMbEQhHNmAbLMN8J/kLk7/mo0QdUkUGNDjv/7jVkhug377Wh8wfbWyaVXEJ/h2B/Q== iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" From e9644aad49cdbb8bddddb5483030020bbdbcf97d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:34:58 -0800 Subject: [PATCH 07/24] chore: bump @babel/types from 7.12.13 to 7.12.17 (#3096) Bumps [@babel/types](https://github.com/babel/babel/tree/HEAD/packages/babel-types) from 7.12.13 to 7.12.17. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.12.17/packages/babel-types) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 760e16c500e0..15ba11271812 100644 --- a/yarn.lock +++ b/yarn.lock @@ -271,9 +271,9 @@ lodash "^4.17.19" "@babel/types@^7.0.0", "@babel/types@^7.12.13", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.13.tgz#8be1aa8f2c876da11a9cf650c0ecf656913ad611" - integrity sha512-oKrdZTld2im1z8bDwTOQvUbxKwE+854zc16qWZQlcTqMN00pWxHQ4ZeOq0yDMnisOpRykH2/5Qqcrk/OlbAjiQ== + version "7.12.17" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.17.tgz#9d711eb807e0934c90b8b1ca0eb1f7230d150963" + integrity sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ== dependencies: "@babel/helper-validator-identifier" "^7.12.11" lodash "^4.17.19" From e7e9f889723d8fb0a7ecb92fe9c3e6fe659b2734 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 10:35:08 -0800 Subject: [PATCH 08/24] chore: bump @types/node from 14.14.27 to 14.14.31 (#3090) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.27 to 14.14.31. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 15ba11271812..6c9fa4035b19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1903,9 +1903,9 @@ integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.27": - version "14.14.27" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.27.tgz#c7127f8da0498993e13b1a42faf1303d3110d2f2" - integrity sha512-Ecfmo4YDQPwuqTCl1yBxLV5ihKfRlkBmzUEDcfIRvDxOTGQEeikr317Ln7Gcv0tjA8dVgKI3rniqW2G1OyKDng== + version "14.14.31" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.31.tgz#72286bd33d137aa0d152d47ec7c1762563d34055" + integrity sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g== "@types/normalize-package-data@^2.4.0": version "2.4.0" From af5cbd5c2a0499b775110c704817b056fff78364 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 22 Feb 2021 14:24:40 -0800 Subject: [PATCH 09/24] chore: add newline to husky gitignore (#3098) --- .husky/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/.gitignore b/.husky/.gitignore index c9cdc63b0701..31354ec13899 100644 --- a/.husky/.gitignore +++ b/.husky/.gitignore @@ -1 +1 @@ -_ \ No newline at end of file +_ From 66dc285f1011211b9b27ac361807fad418231fc7 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 23 Feb 2021 23:25:16 +0100 Subject: [PATCH 10/24] test(scope-manager): add missing test cases for typeof import (#3101) --- .../type-declaration/type-query-qualified.ts | 3 + .../type-query-qualified.ts.shot | 96 +++++++++++++++++++ .../typeof-import-type-with-qualifier.ts | 1 + .../typeof-import-type-with-qualifier.ts.shot | 38 ++++++++ 4 files changed, 138 insertions(+) create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot diff --git a/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts new file mode 100644 index 000000000000..4b1cc563d5f5 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts @@ -0,0 +1,3 @@ +const x = { y: { z: 1 } }; +type T = typeof x.y.z; +type Unresolved = x.y.z; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot new file mode 100644 index 000000000000..afb1ec52a0d2 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/type-query-qualified.ts.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-declaration type-query-qualified 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: ObjectExpression$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + TypeDefinition$2 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$3, + }, + ], + name: "T", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + TypeDefinition$3 { + name: Identifier<"Unresolved">, + node: TSTypeAliasDeclaration$4, + }, + ], + name: "Unresolved", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$5, + isStrict: false, + references: Array [ + Reference$1, + Reference$2, + Reference$3 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: null, + }, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "T" => Variable$3, + "Unresolved" => Variable$4, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$4, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts new file mode 100644 index 000000000000..c61a204af86d --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts @@ -0,0 +1 @@ +type T = typeof import('').default; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot new file mode 100644 index 000000000000..95ad0a27df5b --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/typeof-import-type-with-qualifier.ts.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-declaration typeof-import-type-with-qualifier 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "T", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$2, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "T" => Variable$2, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + ], + }, + ], +} +`; From 0c0ca4a6d2b54efd827d4a09f3c437e9ceb24979 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 24 Feb 2021 03:41:55 +0100 Subject: [PATCH 11/24] refactor(typescript-estree): add missing type guards to node utils (#3102) --- packages/typescript-estree/src/node-utils.ts | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index c9eef0fba760..3467a8263c4e 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -165,7 +165,9 @@ export function getLastModifier(node: ts.Node): ts.Modifier | null { * @param token the TypeScript token * @returns is comma */ -export function isComma(token: ts.Node): boolean { +export function isComma( + token: ts.Node, +): token is ts.Token { return token.kind === SyntaxKind.CommaToken; } @@ -186,7 +188,7 @@ export function isComment(node: ts.Node): boolean { * @param node the TypeScript node * @returns is JSDoc comment */ -export function isJSDocComment(node: ts.Node): boolean { +export function isJSDocComment(node: ts.Node): node is ts.JSDoc { return node.kind === SyntaxKind.JSDocComment; } @@ -285,7 +287,7 @@ export function getRange(node: ts.Node, ast: ts.SourceFile): [number, number] { * @param node the ts.Node * @returns is a token */ -export function isToken(node: ts.Node): boolean { +export function isToken(node: ts.Node): node is ts.Token { return ( node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken ); @@ -434,7 +436,9 @@ export function unescapeStringLiteralText(text: string): string { * @param node ts.Node to be checked * @returns is Computed Property */ -export function isComputedProperty(node: ts.Node): boolean { +export function isComputedProperty( + node: ts.Node, +): node is ts.ComputedPropertyName { return node.kind === SyntaxKind.ComputedPropertyName; } @@ -471,15 +475,11 @@ export function isChildUnwrappableOptionalChain( | ts.NonNullExpression, child: TSESTree.Node, ): boolean { - if ( + return ( isChainExpression(child) && // (x?.y).z is semantically different, and as such .z is no longer optional node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression - ) { - return true; - } - - return false; + ); } /** @@ -586,7 +586,7 @@ export function getTokenType( * @returns the converted Token */ export function convertToken( - token: ts.Node, + token: ts.Token, ast: ts.SourceFile, ): TSESTree.Token { const start = From 1cf9243a6e715bee7167b16adc11bc599b87c949 Mon Sep 17 00:00:00 2001 From: Michael Scott Cuthbert Date: Tue, 23 Feb 2021 20:26:16 -1000 Subject: [PATCH 12/24] docs: improve no-undef FAQ (#3082) --- docs/getting-started/linting/FAQ.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/linting/FAQ.md b/docs/getting-started/linting/FAQ.md index 47e5a221155c..e4ea1f19130f 100644 --- a/docs/getting-started/linting/FAQ.md +++ b/docs/getting-started/linting/FAQ.md @@ -187,11 +187,24 @@ Instead, our tooling exists to **_augment_** TypeScript's built in checks with l The `no-undef` lint rule does not use TypeScript to determine the global variables that exist - instead, it relies upon ESLint's configuration. -You can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments). +We strongly recommend that you do not use the `no-undef` lint rule on TypeScript projects. The checks it provides are already provided by TypeScript without the need for configuration - TypeScript just does this significantly better. As of our v4.0.0 release, this also applies to types. If you use global types from a 3rd party package (i.e. anything from an `@types` package), then you will have to configure ESLint appropriately to define these global types. For example; the `JSX` namespace from `@types/react` is a global 3rd party type that you must define in your ESLint config. -We strongly recommend that you do not use the `no-undef` lint rule on TypeScript projects. The checks it provides are already provided by TypeScript without the need for configuration - TypeScript just does this significantly better. +Note, that for a mixed project including JavaScript and TypeScript, the `no-undef` rule (like any role) can be turned off for TypeScript files alone by adding an `overrides` section to .eslintrc.json: + +```json + "overrides": [ + { + "files": ["*.ts"], + "rules": { + "no-undef": "off" + } + } + ] +``` + +If you choose to leave on the ESLint `no-undef` lint rule, you can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments).

From 5e2a9931ded2c7b563598a4170cd7ee9390afd14 Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Thu, 25 Feb 2021 02:55:09 +0800 Subject: [PATCH 13/24] docs: FAQ: update prettier config for v8 (#3103) --- docs/getting-started/linting/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/linting/README.md b/docs/getting-started/linting/README.md index 63163d9a6fd8..655974fff4e2 100644 --- a/docs/getting-started/linting/README.md +++ b/docs/getting-started/linting/README.md @@ -121,6 +121,8 @@ If you use [`prettier`](https://www.npmjs.com/package/prettier), there is also a Using this config is as simple as adding it to the end of your `extends`: +> Note: [Since version `8.0.0` of `eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21), all you need to extend is `'prettier'`. That includes all plugins. Otherwise for `<8.0.0`, you need include `'prettier/@typescript-eslint'`. + ```diff module.exports = { root: true, @@ -132,7 +134,6 @@ Using this config is as simple as adding it to the end of your `extends`: 'eslint:recommended', 'plugin:@typescript-eslint/recommended', + 'prettier', -+ 'prettier/@typescript-eslint', ], }; ``` From 25f459cdc4f38d44b48554e04cfa1676538ccdfb Mon Sep 17 00:00:00 2001 From: Nikita Stefaniak Date: Sun, 28 Feb 2021 20:06:57 +0100 Subject: [PATCH 14/24] feat(eslint-plugin): [prom-func-async] report only function head (#2872) --- .../src/rules/promise-function-async.ts | 3 + .../src/util/explicitReturnTypeUtils.ts | 63 +-------------- .../src/util/getFunctionHeadLoc.ts | 79 +++++++++++++++++++ packages/eslint-plugin/src/util/index.ts | 1 + .../rules/promise-function-async.test.ts | 19 +++++ 5 files changed, 104 insertions(+), 61 deletions(-) create mode 100644 packages/eslint-plugin/src/util/getFunctionHeadLoc.ts diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 00888c8f39fa..ce624be643c1 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -91,6 +91,7 @@ export default util.createRule({ ]); const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); + const sourceCode = context.getSourceCode(); function validateNode( node: @@ -140,12 +141,14 @@ export default util.createRule({ return context.report({ messageId: 'missingAsync', node, + loc: util.getFunctionHeadLoc(node, sourceCode), }); } context.report({ messageId: 'missingAsync', node, + loc: util.getFunctionHeadLoc(node, sourceCode), fix: fixer => { if ( node.parent && diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index d2c3a684c868..cd2f0b11826b 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -2,9 +2,9 @@ import { TSESTree, AST_NODE_TYPES, TSESLint, - AST_TOKEN_TYPES, } from '@typescript-eslint/experimental-utils'; import { isTypeAssertion, isConstructor, isSetter } from './astUtils'; +import { getFunctionHeadLoc } from './getFunctionHeadLoc'; import { nullThrows, NullThrowsReasons } from './nullThrows'; type FunctionExpression = @@ -12,65 +12,6 @@ type FunctionExpression = | TSESTree.FunctionExpression; type FunctionNode = FunctionExpression | TSESTree.FunctionDeclaration; -/** - * Creates a report location for the given function. - * The location only encompasses the "start" of the function, and not the body - * - * eg. - * function foo(args) {} - * ^^^^^^^^^^^^^^^^^^ - * - * get y(args) {} - * ^^^^^^^^^^^ - * - * const x = (args) => {} - * ^^^^^^^^^ - */ -function getReporLoc( - node: FunctionNode, - sourceCode: TSESLint.SourceCode, -): TSESTree.SourceLocation { - /** - * Returns start column position - * @param node - */ - function getLocStart(): TSESTree.LineAndColumnData { - /* highlight method name */ - const parent = node.parent; - if ( - parent && - (parent.type === AST_NODE_TYPES.MethodDefinition || - (parent.type === AST_NODE_TYPES.Property && parent.method)) - ) { - return parent.loc.start; - } - - return node.loc.start; - } - - /** - * Returns end column position - * @param node - */ - function getLocEnd(): TSESTree.LineAndColumnData { - /* highlight `=>` */ - if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { - return sourceCode.getTokenBefore( - node.body, - token => - token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', - )!.loc.end; - } - - return sourceCode.getTokenBefore(node.body)!.loc.end; - } - - return { - start: getLocStart(), - end: getLocEnd(), - }; -} - /** * Checks if a node is a variable declarator with a type annotation. * ``` @@ -327,7 +268,7 @@ function checkFunctionReturnType( return; } - report(getReporLoc(node, sourceCode)); + report(getFunctionHeadLoc(node, sourceCode)); } /** diff --git a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts new file mode 100644 index 000000000000..dc18a832f948 --- /dev/null +++ b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts @@ -0,0 +1,79 @@ +import { + AST_NODE_TYPES, + AST_TOKEN_TYPES, + TSESLint, + TSESTree, +} from '@typescript-eslint/experimental-utils'; + +type FunctionNode = + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionExpression + | TSESTree.FunctionDeclaration; + +/** + * Creates a report location for the given function. + * The location only encompasses the "start" of the function, and not the body + * + * eg. + * + * ``` + * function foo(args) {} + * ^^^^^^^^^^^^^^^^^^ + * + * get y(args) {} + * ^^^^^^^^^^^ + * + * const x = (args) => {} + * ^^^^^^^^^ + * ``` + */ +export function getFunctionHeadLoc( + node: FunctionNode, + sourceCode: TSESLint.SourceCode, +): TSESTree.SourceLocation { + function getLocStart(): TSESTree.LineAndColumnData { + if (node.parent && node.parent.type === AST_NODE_TYPES.MethodDefinition) { + // return the start location for class method + + if (node.parent.decorators && node.parent.decorators.length > 0) { + // exclude decorators + return sourceCode.getTokenAfter( + node.parent.decorators[node.parent.decorators.length - 1], + )!.loc.start; + } + + return node.parent.loc.start; + } + + if ( + node.parent && + node.parent.type === AST_NODE_TYPES.Property && + node.parent.method + ) { + // return the start location for object method shorthand + return node.parent.loc.start; + } + + // return the start location for a regular function + return node.loc.start; + } + + function getLocEnd(): TSESTree.LineAndColumnData { + if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { + // find the end location for arrow function expression + return sourceCode.getTokenBefore( + node.body, + token => + token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', + )!.loc.end; + } + + // return the end location for a regular function + return sourceCode.getTokenBefore(node.body)!.loc.end; + } + + return { + start: getLocStart(), + end: getLocEnd(), + }; +} diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index 810398a093f0..fc5346f73466 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -3,6 +3,7 @@ import { ESLintUtils } from '@typescript-eslint/experimental-utils'; export * from './astUtils'; export * from './collectUnusedVariables'; export * from './createRule'; +export * from './getFunctionHeadLoc'; export * from './isTypeReadonly'; export * from './misc'; export * from './nullThrows'; diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 49f6e250b6c8..961047138c99 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -611,6 +611,25 @@ async function foo(): Promise | SPromise { return Math.random() > 0.5 ? Promise.resolve('value') : Promise.resolve(false); +} + `, + }, + { + code: ` +class Test { + @decorator + public test() { + return Promise.resolve(123); + } +} + `, + errors: [{ line: 4, column: 3, messageId }], + output: ` +class Test { + @decorator + public async test() { + return Promise.resolve(123); + } } `, }, From b0475aff3920d748fa74b5a6d8a7ad5dd731aec4 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 28 Feb 2021 20:08:46 +0100 Subject: [PATCH 15/24] fix(eslint-plugin): [consistent-indexed-object-style] do not autofix if interface has extends (#3009) --- .../rules/consistent-indexed-object-style.ts | 21 ++++++++++++------- .../consistent-indexed-object-style.test.ts | 15 ++++++++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index bd48718c68b5..a30102dd123e 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -2,6 +2,7 @@ import { createRule } from '../util'; import { AST_NODE_TYPES, TSESTree, + TSESLint, } from '@typescript-eslint/experimental-utils'; type MessageIds = 'preferRecord' | 'preferIndexSignature'; @@ -66,6 +67,7 @@ export default createRule({ node: TSESTree.Node, prefix: string, postfix: string, + safeFix = true, ): void { if (members.length !== 1) { return; @@ -98,14 +100,16 @@ export default createRule({ context.report({ node, messageId: 'preferRecord', - fix(fixer) { - const key = sourceCode.getText(keyType.typeAnnotation); - const value = sourceCode.getText(valueType.typeAnnotation); - const record = member.readonly - ? `Readonly>` - : `Record<${key}, ${value}>`; - return fixer.replaceText(node, `${prefix}${record}${postfix}`); - }, + fix: safeFix + ? (fixer): TSESLint.RuleFix => { + const key = sourceCode.getText(keyType.typeAnnotation); + const value = sourceCode.getText(valueType.typeAnnotation); + const record = member.readonly + ? `Readonly>` + : `Record<${key}, ${value}>`; + return fixer.replaceText(node, `${prefix}${record}${postfix}`); + } + : null, }); } @@ -128,6 +132,7 @@ export default createRule({ node, `type ${node.id.name}${genericTypes} = `, ';', + !node.extends?.length, ); }, }; diff --git a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts index 31077fcf6206..eb7e5cc8d1f6 100644 --- a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts @@ -76,7 +76,6 @@ interface Foo { []; } `, - // 'index-signature' // Unhandled type { @@ -166,6 +165,20 @@ type Foo = Record; errors: [{ messageId: 'preferRecord', line: 2, column: 1 }], }, + // Interface with extends + { + code: ` +interface B extends A { + [index: number]: unknown; +} + `, + output: ` +interface B extends A { + [index: number]: unknown; +} + `, + errors: [{ messageId: 'preferRecord', line: 2, column: 1 }], + }, // Readonly interface with generic parameter { code: ` From c65a1391be15bbcf3ae293b1c53686703883d546 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 28 Feb 2021 20:11:01 +0100 Subject: [PATCH 16/24] fix(eslint-plugin): [unbound-method] allow `super` expressions in `this` assignments (#3010) --- .../eslint-plugin/src/rules/unbound-method.ts | 9 ++- .../tests/rules/unbound-method.test.ts | 59 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 407d04c11ece..2ec66bc2aa33 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -305,7 +305,14 @@ function isSafeUse(node: TSESTree.Node): boolean { return ['instanceof', '==', '!=', '===', '!=='].includes(parent.operator); case AST_NODE_TYPES.AssignmentExpression: - return parent.operator === '=' && node === parent.left; + return ( + parent.operator === '=' && + (node === parent.left || + (node.type === AST_NODE_TYPES.MemberExpression && + node.object.type === AST_NODE_TYPES.Super && + parent.left.type === AST_NODE_TYPES.MemberExpression && + parent.left.object.type === AST_NODE_TYPES.ThisExpression)) + ); case AST_NODE_TYPES.ChainExpression: case AST_NODE_TYPES.TSNonNullExpression: diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 83f3b93524ce..911206b1f219 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -265,6 +265,22 @@ class Foo { } const { bound } = new Foo(); `, + // https://github.com/typescript-eslint/typescript-eslint/issues/1866 + ` +class BaseClass { + x: number = 42; + logThis() {} +} +class OtherClass extends BaseClass { + superLogThis: any; + constructor() { + super(); + this.superLogThis = super.logThis; + } +} +const oc = new OtherClass(); +oc.superLogThis(); + `, ], invalid: [ { @@ -529,5 +545,48 @@ const { log } = console; }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1866 + { + code: ` +class BaseClass { + logThis() {} +} +class OtherClass extends BaseClass { + constructor() { + super(); + const x = super.logThis; + } +} + `, + errors: [ + { + line: 8, + column: 15, + messageId: 'unbound', + }, + ], + }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1866 + { + code: ` +class BaseClass { + logThis() {} +} +class OtherClass extends BaseClass { + constructor() { + super(); + let x; + x = super.logThis; + } +} + `, + errors: [ + { + line: 9, + column: 9, + messageId: 'unbound', + }, + ], + }, ], }); From ae14bf55fe31b0eb982ba17333e4aac550d10342 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 28 Feb 2021 20:15:11 +0100 Subject: [PATCH 17/24] feat(typescript-estree): throw custom error instead of plain object (#3011) --- packages/typescript-estree/src/node-utils.ts | 29 +- .../tests/ast-fixtures.test.ts | 5 +- .../semantic-diagnostics-enabled.test.ts.snap | 292 +++++++++--------- .../lib/semantic-diagnostics-enabled.test.ts | 5 +- .../error-missing-paren.src.js.shot | 2 +- .../error-not-arrow.src.js.shot | 2 +- .../error-numeric-param-multi.src.js.shot | 2 +- .../error-numeric-param.src.js.shot | 2 +- .../error-reverse-arrow.src.js.shot | 2 +- .../error-wrapped-param.src.js.shot | 2 +- .../binaryLiterals/invalid.src.js.shot | 2 +- .../classes/class-with-no-body.src.js.shot | 2 +- ...nvalid-class-two-super-classes.src.js.shot | 2 +- .../error-dynamic-import-params.src.js.shot | 2 +- .../invalid-rest.src.js.shot | 2 +- .../forIn/for-in-object.src.js.shot | 2 +- .../hexLiterals/invalid.src.js.shot | 2 +- ...port-batch-missing-from-clause.src.js.shot | 2 +- .../invalid-export-batch-token.src.js.shot | 2 +- .../invalid-export-default-equal.src.js.shot | 2 +- .../invalid-export-default-token.src.js.shot | 2 +- .../invalid-export-default.src.js.shot | 2 +- ...valid-export-named-extra-comma.src.js.shot | 2 +- ...alid-export-named-middle-comma.src.js.shot | 2 +- ...ault-after-named-after-default.src.js.shot | 2 +- ...lid-import-default-after-named.src.js.shot | 2 +- ...fault-missing-module-specifier.src.js.shot | 2 +- .../invalid-import-default.src.js.shot | 2 +- ...mport-missing-module-specifier.src.js.shot | 2 +- ...valid-import-named-after-named.src.js.shot | 2 +- ...d-import-named-after-namespace.src.js.shot | 2 +- ...d-import-named-as-missing-from.src.js.shot | 2 +- ...valid-import-named-extra-comma.src.js.shot | 2 +- ...alid-import-named-middle-comma.src.js.shot | 2 +- ...d-import-namespace-after-named.src.js.shot | 2 +- ...id-import-namespace-missing-as.src.js.shot | 2 +- ...lid-computed-variable-property.src.js.shot | 2 +- ...one-computed-variable-property.src.js.shot | 2 +- .../invalid-method-no-braces.src.js.shot | 2 +- .../octalLiterals/invalid.src.js.shot | 2 +- .../spread/error-invalid-if.src.js.shot | 2 +- .../spread/error-invalid-sequence.src.js.shot | 2 +- .../invalid-empty-escape.src.js.shot | 2 +- .../invalid-too-large-escape.src.js.shot | 2 +- .../snapshots/jsx/embedded-tags.src.js.shot | 2 +- ...valid-attribute-missing-equals.src.js.shot | 2 +- .../jsx/invalid-attribute.src.js.shot | 2 +- .../jsx/invalid-broken-tag.src.js.shot | 2 +- .../invalid-computed-end-tag-name.src.js.shot | 2 +- ...d-computed-string-end-tag-name.src.js.shot | 2 +- .../invalid-embedded-expression.src.js.shot | 2 +- .../invalid-leading-dot-tag-name.src.js.shot | 2 +- ...ing-placeholder-in-closing-tag.src.js.shot | 2 +- ...invalid-mismatched-closing-tag.src.js.shot | 2 +- ...nvalid-mismatched-closing-tags.src.js.shot | 2 +- ...nvalid-mismatched-dot-tag-name.src.js.shot | 2 +- ...valid-mismatched-namespace-tag.src.js.shot | 2 +- ...sing-tag-attribute-placeholder.src.js.shot | 2 +- .../invalid-missing-closing-tag.src.js.shot | 2 +- ...invalid-missing-namespace-name.src.js.shot | 2 +- ...nvalid-missing-namespace-value.src.js.shot | 2 +- ...nvalid-missing-spread-operator.src.js.shot | 2 +- ...alid-namespace-name-with-docts.src.js.shot | 2 +- ...alid-namespace-value-with-dots.src.js.shot | 2 +- ...-no-common-parent-with-comment.src.js.shot | 2 +- .../jsx/invalid-no-common-parent.src.js.shot | 2 +- .../jsx/invalid-no-tag-name.src.js.shot | 2 +- ...lid-placeholder-in-closing-tag.src.js.shot | 2 +- ...-shorthand-fragment-no-closing.src.js.shot | 2 +- .../invalid-trailing-dot-tag-name.src.js.shot | 2 +- .../jsx/invalid-unexpected-comma.src.js.shot | 2 +- .../jsx/member-expression-private.src.js.shot | 2 +- ...d-attribute-and-value-inserted.src.js.shot | 2 +- .../namespaced-name-and-attribute.src.js.shot | 2 +- .../jsx/newslines-and-entities.src.js.shot | 2 +- .../self-closing-tag-with-newline.src.js.shot | 2 +- ...jsx-member-expression-private.src.tsx.shot | 2 +- .../interface-with-no-body.src.ts.shot | 2 +- .../tools/tserror-serializer.ts | 18 ++ 79 files changed, 263 insertions(+), 234 deletions(-) create mode 100644 packages/typescript-estree/tools/tserror-serializer.ts diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 3467a8263c4e..eb88660fdfa3 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -649,16 +649,26 @@ export function convertTokens(ast: ts.SourceFile): TSESTree.Token[] { return result; } -export interface TSError { - index: number; - lineNumber: number; - column: number; - message: string; +export class TSError extends Error { + constructor( + message: string, + public readonly fileName: string, + public readonly index: number, + public readonly lineNumber: number, + public readonly column: number, + ) { + super(message); + Object.defineProperty(this, 'name', { + value: new.target.name, + enumerable: false, + configurable: true, + }); + } } /** * @param ast the AST object - * @param start the index at which the error starts + * @param start the index at which the error starts * @param message the error message * @returns converted error object */ @@ -668,12 +678,7 @@ export function createError( message: string, ): TSError { const loc = ast.getLineAndCharacterOfPosition(start); - return { - index: start, - lineNumber: loc.line + 1, - column: loc.character, - message, - }; + return new TSError(message, ast.fileName, start, loc.line + 1, loc.character); } /** diff --git a/packages/typescript-estree/tests/ast-fixtures.test.ts b/packages/typescript-estree/tests/ast-fixtures.test.ts index 339378a6883c..613595e4f8aa 100644 --- a/packages/typescript-estree/tests/ast-fixtures.test.ts +++ b/packages/typescript-estree/tests/ast-fixtures.test.ts @@ -1,10 +1,13 @@ import fs from 'fs'; import glob from 'glob'; -import 'jest-specific-snapshot'; +import { addSerializer } from 'jest-specific-snapshot'; import makeDir from 'make-dir'; import path from 'path'; import { parseAndGenerateServices } from '../src/parser'; import { isJSXFileType } from '../tools/test-utils'; +import { serializer } from '../tools/tserror-serializer'; + +addSerializer(serializer); // Assign a segment set to this variable to limit the test to only this segment // This is super helpful if you need to debug why a specific fixture isn't producing the correct output diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 2aa60bf249ea..e5e4d1e16bf5 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -81,7 +81,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-dup-params.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-missing-paren.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -90,7 +90,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-not-arrow.src 1`] = ` -Object { +TSError { "column": 26, "index": 26, "lineNumber": 1, @@ -99,7 +99,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-numeric-param.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, @@ -108,7 +108,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-numeric-param-multi.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -117,7 +117,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-reverse-arrow.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -134,7 +134,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-eval-return.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-octal.src 1`] = ` -Object { +TSError { "column": 21, "index": 21, "lineNumber": 1, @@ -153,7 +153,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-strict-param-no-paren-eval.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-two-lines.src 1`] = ` -Object { +TSError { "column": 1, "index": 12, "lineNumber": 2, @@ -162,7 +162,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/arrowFunctions/error-wrapped-param.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, @@ -229,7 +229,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/bigIntLiterals/octal.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/binaryLiterals/invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -302,7 +302,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-constructor-with-space.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/class-with-no-body.src 1`] = ` -Object { +TSError { "column": 0, "index": 10, "lineNumber": 2, @@ -323,7 +323,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/empty-literal-derived-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-declaration.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -332,7 +332,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-setter-declaration.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, @@ -341,7 +341,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/classes/invalid-class-two-super-classes.src 1`] = ` -Object { +TSError { "column": 18, "index": 18, "lineNumber": 1, @@ -440,7 +440,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/destructured-object-catch.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring/invalid-defaults-object-assign.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -525,7 +525,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/destructuring-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -534,7 +534,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/invalid-not-final-array-empty.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, @@ -545,7 +545,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/multi-destructured.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/destructuring-and-spread/not-final-array.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -588,7 +588,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalDynamicImport/dynamic-import.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalDynamicImport/error-dynamic-import-params.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -603,7 +603,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest.src 1`] = ` -Object { +TSError { "column": 18, "index": 18, "lineNumber": 1, @@ -612,7 +612,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -663,7 +663,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-destruction-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forIn/for-in-object.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, @@ -694,7 +694,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-object.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/forOf/for-of-with-function-initializer.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -743,7 +743,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/globalReturn/return-true.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/hexLiterals/invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -864,7 +864,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-class.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-batch-missing-from-clause.src 1`] = ` -Object { +TSError { "column": 0, "index": 9, "lineNumber": 2, @@ -873,7 +873,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-batch-token.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -882,7 +882,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default.src 1`] = ` -Object { +TSError { "column": 20, "index": 20, "lineNumber": 1, @@ -891,7 +891,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default-equal.src 1`] = ` -Object { +TSError { "column": 15, "index": 15, "lineNumber": 1, @@ -900,7 +900,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-default-token.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, @@ -911,7 +911,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-default.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-extra-comma.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -920,7 +920,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-export-named-middle-comma.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -929,7 +929,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -938,7 +938,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -947,7 +947,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-after-named-after-default.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, @@ -956,7 +956,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-missing-module-specifier.src 1`] = ` -Object { +TSError { "column": 0, "index": 11, "lineNumber": 2, @@ -965,7 +965,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-default-module-specifier.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -974,7 +974,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-missing-module-specifier.src 1`] = ` -Object { +TSError { "column": 0, "index": 20, "lineNumber": 2, @@ -983,7 +983,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-module-specifier.src 1`] = ` -Object { +TSError { "column": 18, "index": 18, "lineNumber": 1, @@ -992,7 +992,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -1001,7 +1001,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-after-namespace.src 1`] = ` -Object { +TSError { "column": 15, "index": 15, "lineNumber": 1, @@ -1010,7 +1010,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-as-missing-from.src 1`] = ` -Object { +TSError { "column": 0, "index": 24, "lineNumber": 2, @@ -1019,7 +1019,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-extra-comma.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -1028,7 +1028,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-named-middle-comma.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -1037,7 +1037,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-namespace-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -1046,7 +1046,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/modules/invalid-import-namespace-missing-as.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -1055,7 +1055,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/newTarget/invalid-new-target.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, @@ -1064,7 +1064,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/newTarget/invalid-unknown-property.src 1`] = ` -Object { +TSError { "column": 25, "index": 25, "lineNumber": 1, @@ -1087,7 +1087,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/computed-variable-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src 1`] = ` -Object { +TSError { "column": 0, "index": 20, "lineNumber": 3, @@ -1096,7 +1096,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, @@ -1111,7 +1111,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/error-proto-property.src 1`] = ` -Object { +TSError { "column": 1, "index": 62, "lineNumber": 7, @@ -1122,7 +1122,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src 1`] = ` -Object { +TSError { "column": 1, "index": 39, "lineNumber": 5, @@ -1133,7 +1133,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src 1`] = ` -Object { +TSError { "column": 13, "index": 19, "lineNumber": 2, @@ -1158,7 +1158,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/objectLiteralShorthandProperties/shorthand-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -1167,7 +1167,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/octalLiterals/legacy.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -1198,7 +1198,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/class-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/error-no-default.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, @@ -1207,7 +1207,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/restParams/error-not-last.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, @@ -1240,7 +1240,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/complex-spread.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/error-invalid-if.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, @@ -1249,7 +1249,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/spread/error-invalid-sequence.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -1288,7 +1288,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/ignored.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/invalid-empty-escape.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -1297,7 +1297,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src 1`] = ` -Object { +TSError { "column": 10, "index": 10, "lineNumber": 1, @@ -1316,7 +1316,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-invalid-js-identifier.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-tags.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -1335,7 +1335,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/escape-patters-multi.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, @@ -1344,7 +1344,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-attribute-missing-equals.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, @@ -1353,7 +1353,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-broken-tag.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -1362,7 +1362,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-end-tag-name.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1371,7 +1371,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-computed-string-end-tag-name.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1380,7 +1380,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-embedded-expression.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, @@ -1389,7 +1389,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-leading-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -1398,7 +1398,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src 1`] = ` -Object { +TSError { "column": 27, "index": 27, "lineNumber": 1, @@ -1407,7 +1407,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tag.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, @@ -1416,7 +1416,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-closing-tags.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -1425,7 +1425,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -1434,7 +1434,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-namespace-tag.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1443,7 +1443,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -1452,7 +1452,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, @@ -1461,7 +1461,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -1470,7 +1470,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-namespace-value.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1479,7 +1479,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-missing-spread-operator.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, @@ -1488,7 +1488,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-name-with-docts.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -1497,7 +1497,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-value-with-dots.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1506,7 +1506,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, @@ -1515,7 +1515,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent-with-comment.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, @@ -1524,7 +1524,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-tag-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -1533,7 +1533,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-placeholder-in-closing-tag.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -1542,7 +1542,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-shorthand-fragment-no-closing.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -1551,7 +1551,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-trailing-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, @@ -1560,7 +1560,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-unexpected-comma.src 1`] = ` -Object { +TSError { "column": 19, "index": 19, "lineNumber": 1, @@ -1575,7 +1575,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/member-expression-private.src 1`] = ` -Object { +TSError { "column": 10, "index": 10, "lineNumber": 1, @@ -1588,7 +1588,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, @@ -1597,7 +1597,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-name-and-attribute.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1606,7 +1606,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/newslines-and-entities.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, @@ -1619,7 +1619,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-inside-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/self-closing-tag-with-newline.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, @@ -1654,7 +1654,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-member-expression-private.src 1`] = ` -Object { +TSError { "column": 22, "index": 22, "lineNumber": 1, @@ -1671,7 +1671,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-constructor.src 1`] = ` -Object { +TSError { "column": 4, "index": 43, "lineNumber": 2, @@ -1686,7 +1686,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-static-constructor.src 1`] = ` -Object { +TSError { "column": 2, "index": 41, "lineNumber": 2, @@ -1699,7 +1699,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-interface.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -1720,7 +1720,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/await-without-async-function.src 1`] = ` -Object { +TSError { "column": 14, "index": 31, "lineNumber": 2, @@ -1745,7 +1745,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/catch-clause-with-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/catch-clause-with-invalid-annotation.src 1`] = ` -Object { +TSError { "column": 12, "index": 19, "lineNumber": 3, @@ -1770,7 +1770,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-definite-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-export-parameter-properties.src 1`] = ` -Object { +TSError { "column": 16, "index": 28, "lineNumber": 2, @@ -1791,7 +1791,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-implements-and-extends.src 1`] = ` -Object { +TSError { "column": 57, "index": 57, "lineNumber": 1, @@ -1834,7 +1834,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-static-parameter-properties.src 1`] = ` -Object { +TSError { "column": 16, "index": 28, "lineNumber": 2, @@ -1891,7 +1891,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-number.src 1`] = ` -Object { +TSError { "column": 4, "index": 22, "lineNumber": 2, @@ -1902,7 +1902,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-string.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/export-named-enum-computed-var-ref.src 1`] = ` -Object { +TSError { "column": 4, "index": 22, "lineNumber": 2, @@ -1971,7 +1971,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-all-property-types.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` -Object { +TSError { "column": 9, "index": 26, "lineNumber": 2, @@ -2004,7 +2004,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/never-type-param.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/new-target-in-arrow-function-body.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, @@ -2207,7 +2207,7 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-empty-extends.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, @@ -2216,7 +2216,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-empty-extends-implements.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, @@ -2225,7 +2225,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-extends-empty-implements.src 1`] = ` -Object { +TSError { "column": 32, "index": 32, "lineNumber": 1, @@ -2234,7 +2234,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/class-multiple-implements.src 1`] = ` -Object { +TSError { "column": 21, "index": 21, "lineNumber": 1, @@ -2243,7 +2243,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -2252,7 +2252,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-function.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -2261,7 +2261,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -2270,7 +2270,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/decorator-on-variable.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, @@ -2279,7 +2279,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, @@ -2288,7 +2288,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-call-expression.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, @@ -2297,7 +2297,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-arguments-in-new-expression.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -2306,7 +2306,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters.src 1`] = ` -Object { +TSError { "column": 11, "index": 11, "lineNumber": 1, @@ -2315,7 +2315,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src 1`] = ` -Object { +TSError { "column": 11, "index": 11, "lineNumber": 1, @@ -2324,7 +2324,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-constructor.src 1`] = ` -Object { +TSError { "column": 13, "index": 25, "lineNumber": 2, @@ -2333,7 +2333,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-function-expression.src 1`] = ` -Object { +TSError { "column": 20, "index": 20, "lineNumber": 1, @@ -2342,7 +2342,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method.src 1`] = ` -Object { +TSError { "column": 6, "index": 18, "lineNumber": 2, @@ -2351,7 +2351,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/empty-type-parameters-in-method-signature.src 1`] = ` -Object { +TSError { "column": 6, "index": 22, "lineNumber": 2, @@ -2360,7 +2360,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/enum-with-keywords.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, @@ -2369,7 +2369,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/index-signature-parameters.src 1`] = ` -Object { +TSError { "column": 3, "index": 16, "lineNumber": 2, @@ -2378,7 +2378,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-empty-extends.src 1`] = ` -Object { +TSError { "column": 21, "index": 21, "lineNumber": 1, @@ -2387,7 +2387,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-implements.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, @@ -2396,7 +2396,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-export.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2405,7 +2405,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-private.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2414,7 +2414,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-protected.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2423,7 +2423,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-public.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2432,7 +2432,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-index-signature-static.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2441,7 +2441,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-export.src 1`] = ` -Object { +TSError { "column": 4, "index": 20, "lineNumber": 2, @@ -2450,7 +2450,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-private.src 1`] = ` -Object { +TSError { "column": 4, "index": 20, "lineNumber": 2, @@ -2459,7 +2459,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-protected.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2468,7 +2468,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-public.src 1`] = ` -Object { +TSError { "column": 4, "index": 20, "lineNumber": 2, @@ -2479,7 +2479,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-readonly.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-static.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2488,7 +2488,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-multiple-extends.src 1`] = ` -Object { +TSError { "column": 26, "index": 26, "lineNumber": 1, @@ -2497,7 +2497,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-export.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2506,7 +2506,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-private.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2515,7 +2515,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-protected.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2524,7 +2524,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-public.src 1`] = ` -Object { +TSError { "column": 4, "index": 20, "lineNumber": 2, @@ -2533,7 +2533,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-static.src 1`] = ` -Object { +TSError { "column": 2, "index": 18, "lineNumber": 2, @@ -2542,7 +2542,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-property-with-default-value.src 1`] = ` -Object { +TSError { "column": 16, "index": 32, "lineNumber": 2, @@ -2551,7 +2551,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-with-no-body.src 1`] = ` -Object { +TSError { "column": 0, "index": 14, "lineNumber": 2, @@ -2562,7 +2562,7 @@ Object { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-with-optional-index-signature.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/object-assertion-not-allowed.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, @@ -2571,7 +2571,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/object-optional-not-allowed.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, @@ -2580,7 +2580,7 @@ Object { `; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/solo-const.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts index 3cbe87f9f552..eefd71a587e8 100644 --- a/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts +++ b/packages/typescript-estree/tests/lib/semantic-diagnostics-enabled.test.ts @@ -3,6 +3,7 @@ import glob from 'glob'; import path from 'path'; import * as parser from '../../src'; import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils'; +import { serializer } from '../../tools/tserror-serializer'; /** * Process all fixtures, we will only snapshot the ones that have semantic errors @@ -10,10 +11,12 @@ import { formatSnapshotName, isJSXFileType } from '../../tools/test-utils'; */ const FIXTURES_DIR = path.join(__dirname, '../../../shared-fixtures/fixtures'); -const testFiles = glob.sync(`**/*.src.*`, { +const testFiles = glob.sync('**/*.src.*', { cwd: FIXTURES_DIR, }); +expect.addSnapshotSerializer(serializer); + describe('Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled', () => { testFiles.forEach(filename => { const code = readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot index 4d8588883161..0ac39c77fa9b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-missing-paren.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot index 6e864113410b..ccca762cfacc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-not-arrow.src 1`] = ` -Object { +TSError { "column": 26, "index": 26, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot index a420234d969d..a6309f29f7a1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-numeric-param-multi.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot index ce4227697aef..00a6318c84e4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-numeric-param.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot index 6d661e7e9416..2b010cb8480d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-reverse-arrow.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot index 49be12cab232..921faeae08b9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript arrowFunctions error-wrapped-param.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot index 061b8be20a61..a65dcc90f690 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript binaryLiterals invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot index da522f5fbd0a..b92aba616ebc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript classes class-with-no-body.src 1`] = ` -Object { +TSError { "column": 0, "index": 10, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot index 3931bfb0029f..71e4b3acbbb5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript classes invalid-class-two-super-classes.src 1`] = ` -Object { +TSError { "column": 18, "index": 18, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot index 4409934d5bd6..6eab5338468b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript experimentalDynamicImport error-dynamic-import-params.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot index d0b41a2d431b..79ebf6dc533f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript experimentalObjectRestSpread invalid-rest.src 1`] = ` -Object { +TSError { "column": 18, "index": 18, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot index a7fc7b9f8af0..f1d2b3dbc4a0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript forIn for-in-object.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot index d340dd7f1af2..1095e6d6c8e2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript hexLiterals invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot index 140771b44066..ae346cd3c57f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-batch-missing-from-clause.src 1`] = ` -Object { +TSError { "column": 0, "index": 9, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot index 684e19e0233c..5a05ea68acb9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-batch-token.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot index 7a9ce96887f6..ee8455cff2e8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-default-equal.src 1`] = ` -Object { +TSError { "column": 15, "index": 15, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot index 60a6d78b8a8c..68613dac12a5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-default-token.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot index 50249961d3af..aa02d1b56fc4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-default.src 1`] = ` -Object { +TSError { "column": 20, "index": 20, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot index 6ecbf90fdcab..143a7bd54948 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-named-extra-comma.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot index 41db50ebc78d..b4f8f3d9872d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-export-named-middle-comma.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot index 7607179ac6ee..fdb5bd5d6bd2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-default-after-named-after-default.src 1`] = ` -Object { +TSError { "column": 17, "index": 17, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot index fdb8cb274d5d..756a15c8851f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-default-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot index 4dd22655d116..95e60f66c12d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-default-missing-module-specifier.src 1`] = ` -Object { +TSError { "column": 0, "index": 11, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot index 072020a6f46b..a15834eebdca 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-default.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot index eed69ef23a0c..adeb29427a96 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-missing-module-specifier.src 1`] = ` -Object { +TSError { "column": 0, "index": 20, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot index 39758891aa47..2205d06adcb6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-named-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot index 91a74529b99c..a6adaddba9ee 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-named-after-namespace.src 1`] = ` -Object { +TSError { "column": 15, "index": 15, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot index e725b5a845c3..e49ff4b519d5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-named-as-missing-from.src 1`] = ` -Object { +TSError { "column": 0, "index": 24, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot index 7b6f49a80d52..602373b73e68 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-named-extra-comma.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot index 9ae813ee7061..cac59c052809 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-named-middle-comma.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot index c77b5326270f..b5b5e09f82b1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-namespace-after-named.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot index 5d846e434301..ccd1659afe4e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript modules invalid-import-namespace-missing-as.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot index eba3235d029a..b70c46baf0ae 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript objectLiteralComputedProperties invalid-computed-variable-property.src 1`] = ` -Object { +TSError { "column": 0, "index": 20, "lineNumber": 3, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot index 3ad37e27ab31..3431838086bf 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript objectLiteralComputedProperties invalid-standalone-computed-variable-property.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot index 80376a615c6a..14d3993f83b0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript objectLiteralShorthandMethods invalid-method-no-braces.src 1`] = ` -Object { +TSError { "column": 13, "index": 19, "lineNumber": 2, diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot index 849f063d5db9..40818b0aef69 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript octalLiterals invalid.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot index 705c64e01793..f80801010e12 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript spread error-invalid-if.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot index 4ee0121d3c74..2606eea3403a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript spread error-invalid-sequence.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot index 4a663bbe3a8d..7d4d1d1a6bde 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript unicodeCodePointEscapes invalid-empty-escape.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot index cb7085a9d65b..b5e8902e41da 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`javascript unicodeCodePointEscapes invalid-too-large-escape.src 1`] = ` -Object { +TSError { "column": 10, "index": 10, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot index 95a7931627ba..d778d382e997 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx embedded-tags.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot index bcca853e1250..312d414ac20d 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-attribute-missing-equals.src 1`] = ` -Object { +TSError { "column": 14, "index": 14, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot index cd30dc7093f5..b0eaf47f8e9e 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-attribute.src 1`] = ` -Object { +TSError { "column": 5, "index": 5, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot index 8e62b046d279..f04a71430590 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-broken-tag.src 1`] = ` -Object { +TSError { "column": 12, "index": 12, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot index 0f377ef358c5..4e6aab214780 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-computed-end-tag-name.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot index 7a5ac6909c88..d6ebfad1a333 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-computed-string-end-tag-name.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot index c8c137461dbd..b100da149e8b 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-embedded-expression.src 1`] = ` -Object { +TSError { "column": 9, "index": 9, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot index 7a898add8cb6..57a4e46ab9dc 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-leading-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot index fe40f0361216..0109dd78aee8 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-matching-placeholder-in-closing-tag.src 1`] = ` -Object { +TSError { "column": 27, "index": 27, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot index bab969b949a6..a35f3afd7151 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-mismatched-closing-tag.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot index 48a5da759091..911494689a40 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-mismatched-closing-tags.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot index df751d1740dc..77d7e4187c3b 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-mismatched-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 7, "index": 7, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot index 11aa190352b1..b466cc6ba4c8 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-mismatched-namespace-tag.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot index 2d6c87006666..80d75f36ba2e 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot index a1e249095988..56f8c0d6ae30 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-missing-closing-tag.src 1`] = ` -Object { +TSError { "column": 1, "index": 1, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot index 539d6637c079..c208b579c837 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-missing-namespace-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot index d90c23b13602..d76a079d93ea 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-missing-namespace-value.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot index daec8f23ef24..ac0a591ee4fe 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-missing-spread-operator.src 1`] = ` -Object { +TSError { "column": 6, "index": 6, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot index 8d3d4b531193..31752fe92610 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-namespace-name-with-docts.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot index 632d941125a6..33b9b97c43a4 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-namespace-value-with-dots.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot index 74546236bad9..70dbe413502c 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-no-common-parent-with-comment.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot index 7490422a4b5f..459f48170205 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-no-common-parent.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot index b63c1ccfe3c3..7468255ed504 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-no-tag-name.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot index 2e857296666d..68d4a0fe19d7 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-placeholder-in-closing-tag.src 1`] = ` -Object { +TSError { "column": 16, "index": 16, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot index 48602742927e..decbdbd3dc16 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-shorthand-fragment-no-closing.src 1`] = ` -Object { +TSError { "column": 0, "index": 0, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot index 0d642dc05548..9043d6e41959 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-trailing-dot-tag-name.src 1`] = ` -Object { +TSError { "column": 3, "index": 3, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot index 9e8f2aadcc65..6f8f5c8668eb 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-unexpected-comma.src 1`] = ` -Object { +TSError { "column": 19, "index": 19, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot index be5a6d6f54d4..c6d458d493ef 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx member-expression-private.src 1`] = ` -Object { +TSError { "column": 10, "index": 10, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot index eea2ab649582..84724e7bdb74 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx namespaced-attribute-and-value-inserted.src 1`] = ` -Object { +TSError { "column": 4, "index": 4, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot index 5082dcbe1dde..ac04b31a1402 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx namespaced-name-and-attribute.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot index 2690d120c1c5..598f29385b2d 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx newslines-and-entities.src 1`] = ` -Object { +TSError { "column": 8, "index": 8, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot index 51247306bf31..9de3d885b9d5 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx self-closing-tag-with-newline.src 1`] = ` -Object { +TSError { "column": 2, "index": 2, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot index 71fd0f423147..5d5d2c98492f 100644 --- a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot +++ b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`tsx generic-jsx-member-expression-private.src 1`] = ` -Object { +TSError { "column": 22, "index": 22, "lineNumber": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot index 326171a51717..cd817aad0dc9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`typescript errorRecovery interface-with-no-body.src 1`] = ` -Object { +TSError { "column": 0, "index": 14, "lineNumber": 2, diff --git a/packages/typescript-estree/tools/tserror-serializer.ts b/packages/typescript-estree/tools/tserror-serializer.ts new file mode 100644 index 000000000000..b56ed97e837b --- /dev/null +++ b/packages/typescript-estree/tools/tserror-serializer.ts @@ -0,0 +1,18 @@ +import { TSError } from '../src/node-utils'; +import type { Plugin } from 'pretty-format'; + +export const serializer: Plugin = { + test: (val: unknown): val is TSError => val instanceof TSError, + serialize(val: TSError, config, indentation, depth, refs, printer) { + const format = (value: unknown): string => + printer(value, config, indentation, depth + 1, refs); + return ( + `${val.name} {\n` + + `${config.indent}"column": ${format(val.column)},\n` + + `${config.indent}"index": ${format(val.index)},\n` + + `${config.indent}"lineNumber": ${format(val.lineNumber)},\n` + + `${config.indent}"message": ${format(val.message)},\n` + + `}` + ); + }, +}; From c32f803d4480acf5ffc88e308b4243e5185c4f48 Mon Sep 17 00:00:00 2001 From: armin yahya Date: Sun, 28 Feb 2021 22:47:52 +0330 Subject: [PATCH 18/24] fix(eslint-plugin): [prefer-function-type] apply existing comments to the fixed code (#3094) --- .../src/rules/prefer-function-type.ts | 142 +++++++++++------- .../tests/rules/prefer-function-type.test.ts | 111 +++++++++++++- 2 files changed, 195 insertions(+), 58 deletions(-) diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index f6aad463930e..761e8bc98eb9 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -1,6 +1,7 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, + TSESLint, TSESTree, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -69,46 +70,6 @@ export default util.createRule({ } } - /** - * @param call The call signature causing the diagnostic - * @param parent The parent of the call - * @returns The suggestion to report - */ - function renderSuggestion( - call: - | TSESTree.TSCallSignatureDeclaration - | TSESTree.TSConstructSignatureDeclaration, - parent: TSESTree.Node, - ): string { - const start = call.range[0]; - const colonPos = call.returnType!.range[0] - start; - const text = sourceCode.getText().slice(start, call.range[1]); - - let suggestion = `${text.slice(0, colonPos)} =>${text.slice( - colonPos + 1, - )}`; - - const lastChar = suggestion.endsWith(';') ? ';' : ''; - if (lastChar) { - suggestion = suggestion.slice(0, -1); - } - if (shouldWrapSuggestion(parent.parent)) { - suggestion = `(${suggestion})`; - } - if (parent.type === AST_NODE_TYPES.TSInterfaceDeclaration) { - if (typeof parent.typeParameters !== 'undefined') { - return `type ${sourceCode - .getText() - .slice( - parent.id.range[0], - parent.typeParameters.range[1], - )} = ${suggestion}${lastChar}`; - } - return `type ${parent.id.name} = ${suggestion}${lastChar}`; - } - return suggestion; - } - /** * @param member The TypeElement being checked * @param node The parent of member being checked @@ -140,30 +101,97 @@ export default util.createRule({ }); return; } - const suggestion = renderSuggestion(member, node); - const fixStart = - node.type === AST_NODE_TYPES.TSTypeLiteral - ? node.range[0] - : sourceCode - .getTokens(node) - .filter( - token => - token.type === AST_TOKEN_TYPES.Keyword && - token.value === 'interface', - )[0].range[0]; + const fixable = + node.parent && + node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration; context.report({ node: member, messageId: 'functionTypeOverCallableType', data: { literalOrInterface: phrases[node.type], }, - fix(fixer) { - return fixer.replaceTextRange( - [fixStart, node.range[1]], - suggestion, - ); - }, + fix: fixable + ? null + : (fixer): TSESLint.RuleFix[] => { + const fixes: TSESLint.RuleFix[] = []; + const start = member.range[0]; + const colonPos = member.returnType!.range[0] - start; + const text = sourceCode.getText().slice(start, member.range[1]); + const comments = sourceCode + .getCommentsBefore(member) + .concat(sourceCode.getCommentsAfter(member)); + let suggestion = `${text.slice(0, colonPos)} =>${text.slice( + colonPos + 1, + )}`; + const lastChar = suggestion.endsWith(';') ? ';' : ''; + if (lastChar) { + suggestion = suggestion.slice(0, -1); + } + if (shouldWrapSuggestion(node.parent)) { + suggestion = `(${suggestion})`; + } + + if (node.type === AST_NODE_TYPES.TSInterfaceDeclaration) { + if (typeof node.typeParameters !== 'undefined') { + suggestion = `type ${sourceCode + .getText() + .slice( + node.id.range[0], + node.typeParameters.range[1], + )} = ${suggestion}${lastChar}`; + } else { + suggestion = `type ${node.id.name} = ${suggestion}${lastChar}`; + } + } + + const isParentExported = + node.parent && + node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration; + + if ( + node.type === AST_NODE_TYPES.TSInterfaceDeclaration && + isParentExported + ) { + const commentsText = comments.reduce((text, comment) => { + return ( + text + + (comment.type === AST_TOKEN_TYPES.Line + ? `//${comment.value}` + : `/*${comment.value}*/`) + + '\n' + ); + }, ''); + // comments should move before export and not between export and interface declaration + fixes.push( + fixer.insertTextBefore( + node.parent as TSESTree.Node | TSESTree.Token, + commentsText, + ), + ); + } else { + comments.forEach(comment => { + let commentText = + comment.type === AST_TOKEN_TYPES.Line + ? `//${comment.value}` + : `/*${comment.value}*/`; + const isCommentOnTheSameLine = + comment.loc.start.line === member.loc.start.line; + if (!isCommentOnTheSameLine) { + commentText += '\n'; + } else { + commentText += ' '; + } + suggestion = commentText + suggestion; + }); + } + + const fixStart = node.range[0]; + fixes.push( + fixer.replaceTextRange([fixStart, node.range[1]], suggestion), + ); + return fixes; + }, }); } } diff --git a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts index 71c2557fda44..51aa85234890 100644 --- a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts @@ -65,6 +65,114 @@ interface Foo { type Foo = () => string; `, }, + // https://github.com/typescript-eslint/typescript-eslint/issues/3004 + { + code: ` +export default interface Foo { + /** comment */ + (): string; +} + `, + errors: [ + { + messageId: 'functionTypeOverCallableType', + type: AST_NODE_TYPES.TSCallSignatureDeclaration, + data: { + literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], + }, + }, + ], + output: ` +export default interface Foo { + /** comment */ + (): string; +} + `, + }, + { + code: ` +interface Foo { + // comment + (): string; +} + `, + errors: [ + { + messageId: 'functionTypeOverCallableType', + type: AST_NODE_TYPES.TSCallSignatureDeclaration, + data: { + literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], + }, + }, + ], + output: ` +// comment +type Foo = () => string; + `, + }, + { + code: ` +export interface Foo { + /** comment */ + (): string; +} + `, + errors: [ + { + messageId: 'functionTypeOverCallableType', + type: AST_NODE_TYPES.TSCallSignatureDeclaration, + data: { + literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], + }, + }, + ], + output: ` +/** comment */ +export type Foo = () => string; + `, + }, + { + code: ` +export interface Foo { + // comment + (): string; +} + `, + errors: [ + { + messageId: 'functionTypeOverCallableType', + type: AST_NODE_TYPES.TSCallSignatureDeclaration, + data: { + literalOrInterface: phrases[AST_NODE_TYPES.TSInterfaceDeclaration], + }, + }, + ], + output: ` +// comment +export type Foo = () => string; + `, + }, + { + code: ` +function foo(bar: { /* comment */ (s: string): number } | undefined): number { + return bar('hello'); +} + `, + errors: [ + { + messageId: 'functionTypeOverCallableType', + type: AST_NODE_TYPES.TSCallSignatureDeclaration, + data: { + literalOrInterface: phrases[AST_NODE_TYPES.TSTypeLiteral], + }, + }, + ], + output: ` +function foo(bar: /* comment */ ((s: string) => number) | undefined): number { + return bar('hello'); +} + `, + }, { code: ` type Foo = { @@ -234,8 +342,8 @@ interface Foo { }, { code: ` +// isn't actually valid ts but want to not give message saying it refers to Foo. interface Foo { - // isn't actually valid ts but want to not give message saying it refers to Foo. (): { a: { nested: this; @@ -257,6 +365,7 @@ interface Foo { }, ], output: noFormat` +// isn't actually valid ts but want to not give message saying it refers to Foo. type Foo = () => { a: { nested: this; From cf86f427186d58b0fce4bb3ff9571c4301babeb3 Mon Sep 17 00:00:00 2001 From: pfg Date: Sun, 28 Feb 2021 11:40:10 -0800 Subject: [PATCH 19/24] feat(eslint-plugin): [member-delimiter-style] Add an option 'multilineDetection' to treat types and interfaces as single line if the last member ends on the same line as the closing bracket (#2970) --- .../docs/rules/member-delimiter-style.md | 9 +- .../src/rules/member-delimiter-style.ts | 19 +- .../rules/member-delimiter-style.test.ts | 165 ++++++++++++++++++ 3 files changed, 190 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/member-delimiter-style.md b/packages/eslint-plugin/docs/rules/member-delimiter-style.md index ed1b09577563..c6f7ca470002 100644 --- a/packages/eslint-plugin/docs/rules/member-delimiter-style.md +++ b/packages/eslint-plugin/docs/rules/member-delimiter-style.md @@ -72,6 +72,7 @@ type Config = BaseConfig & { interface?: BaseConfig; typeLiteral?: BaseConfig; }; + multilineDetection?: 'brackets' | 'last-member'; }; ``` @@ -86,7 +87,8 @@ Default config: "singleline": { "delimiter": "semi", "requireLast": false - } + }, + "multilineDetection": "brackets" } ``` @@ -94,6 +96,11 @@ Default config: `singleline` config only applies to single line `interface`/`type` definitions. The two configs are entirely separate, and do not effect one another. +`multilineDetection` determines what counts as multiline + +- `"brackets"` (default) any newlines in the type or interface make it multiline. +- `"last-member"` if the last member of the interface is on the same line as the last bracket, it is counted as a single line. + ### `delimiter` Accepts three values (or two for `singleline`): diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index 75381a8df2cb..64147b37cf2a 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -21,6 +21,7 @@ type Config = BaseOptions & { typeLiteral?: BaseOptions; interface?: BaseOptions; }; + multilineDetection?: 'brackets' | 'last-member'; }; type Options = [Config]; type MessageIds = @@ -82,6 +83,9 @@ export default util.createRule({ }, additionalProperties: false, }, + multilineDetection: { + enum: ['brackets', 'last-member'], + }, }), additionalProperties: false, }, @@ -97,6 +101,7 @@ export default util.createRule({ delimiter: 'semi', requireLast: false, }, + multilineDetection: 'brackets', }, ], create(context, [options]) { @@ -215,11 +220,21 @@ export default util.createRule({ function checkMemberSeparatorStyle( node: TSESTree.TSInterfaceBody | TSESTree.TSTypeLiteral, ): void { - const isSingleLine = node.loc.start.line === node.loc.end.line; - const members = node.type === AST_NODE_TYPES.TSInterfaceBody ? node.body : node.members; + let isSingleLine = node.loc.start.line === node.loc.end.line; + if ( + options.multilineDetection === 'last-member' && + !isSingleLine && + members.length > 0 + ) { + const lastMember = members[members.length - 1]; + if (lastMember.loc.end.line === node.loc.end.line) { + isSingleLine = true; + } + } + const typeOpts = node.type === AST_NODE_TYPES.TSInterfaceBody ? interfaceOptions diff --git a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts index d0fa7895b9c6..c69e54e2af00 100644 --- a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts +++ b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts @@ -705,6 +705,75 @@ type Bar = { }, ], }, + { + code: ` +type Foo = {a: { + b: true; +}}; + `, + options: [ + { + multilineDetection: 'last-member', + }, + ], + }, + ` +type Foo = {a: { + b: true; +};}; + `, + { + code: ` +type Foo = {a: { + b: true; +};}; + `, + options: [ + { + multilineDetection: 'brackets', + }, + ], + }, + { + code: ` +type Foo = { + a: { + b: true; + }; +}; + `, + options: [ + { + multilineDetection: 'last-member', + }, + ], + }, + { + code: ` +type Foo = {a: { + b: true; +};}; + `, + options: [ + { + singleline: { delimiter: 'semi', requireLast: true }, + multilineDetection: 'last-member', + }, + ], + }, + { + code: ` +type Foo = { + +}; + `, + options: [ + { + singleline: { delimiter: 'semi', requireLast: true }, + multilineDetection: 'last-member', + }, + ], + }, { code: ` @@ -3365,5 +3434,101 @@ type Foo = { }, ], }, + { + code: ` +type Foo = {a: { + b: true; +};}; + `, + output: ` +type Foo = {a: { + b: true; +}}; + `, + options: [ + { + multilineDetection: 'last-member', + }, + ], + errors: [ + { + messageId: 'unexpectedSemi', + line: 4, + column: 3, + }, + ], + }, + { + code: ` +type Foo = {a: { + b: true; +}}; + `, + output: ` +type Foo = {a: { + b: true; +};}; + `, + errors: [ + { + messageId: 'expectedSemi', + line: 4, + column: 2, + }, + ], + }, + { + code: ` +type Foo = { + a: { + b: true; + } +}; + `, + output: ` +type Foo = { + a: { + b: true; + }; +}; + `, + options: [ + { + multilineDetection: 'last-member', + }, + ], + errors: [ + { + messageId: 'expectedSemi', + line: 5, + column: 4, + }, + ], + }, + { + code: ` +type Foo = {a: { + b: true; +}}; + `, + output: ` +type Foo = {a: { + b: true; +};}; + `, + options: [ + { + singleline: { delimiter: 'semi', requireLast: true }, + multilineDetection: 'last-member', + }, + ], + errors: [ + { + messageId: 'expectedSemi', + line: 4, + column: 2, + }, + ], + }, ], }); From 2ebfb21ba6c88c793cfbd0e231e5803b2381694c Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 1 Mar 2021 01:03:43 +0100 Subject: [PATCH 20/24] feat: TypeScript 4.2 syntax support (#3112) * chore(typescript-estree): update @babel/parser to 7.13.4 * feat: update typescript to ~4.2 * fix(typescript-estree): add support for JSXNamespacedName node * fix(typescript-estree): correct tsNodeToESTreeNodeMap * fix(typescript-estree): add support for ThisKeyword as JSXNamespaceOrIdentifier helper Co-authored-by: Brad Zacher --- README.md | 2 +- package.json | 4 +- .../fixtures/jsx/namespace-this-name.src.js | 1 + .../types/constructor-abstract.src.ts | 1 + .../typescript/types/constructor-empty.src.ts | 1 + packages/types/src/ast-node-types.ts | 1 + packages/types/src/ts-estree.ts | 16 +- packages/typescript-estree/package.json | 4 +- packages/typescript-estree/src/convert.ts | 115 ++- .../src/ts-estree/estree-to-ts-node-types.ts | 9 +- .../tests/ast-alignment/fixtures-to-test.ts | 20 +- .../semantic-diagnostics-enabled.test.ts.snap | 39 +- ...valid-mismatched-namespace-tag.src.js.shot | 6 +- ...alid-namespace-value-with-dots.src.js.shot | 491 ++++++++- .../jsx/namespace-this-name.src.js.shot | 226 +++++ ...d-attribute-and-value-inserted.src.js.shot | 934 +++++++++++++++++- .../namespaced-name-and-attribute.src.js.shot | 316 +++++- .../basics/class-with-mixin.src.ts.shot | 1 + .../types/constructor-abstract.src.ts.shot | 333 +++++++ .../types/constructor-empty.src.ts.shot | 315 ++++++ .../types/constructor-generic.src.ts.shot | 1 + .../types/constructor-in-generic.src.ts.shot | 1 + .../types/constructor-with-rest.src.ts.shot | 1 + .../typescript/types/constructor.src.ts.shot | 1 + .../visitor-keys/tests/visitor-keys.test.ts | 1 - yarn.lock | 196 ++-- 26 files changed, 2854 insertions(+), 182 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/jsx/namespace-this-name.src.js create mode 100644 packages/shared-fixtures/fixtures/typescript/types/constructor-abstract.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/types/constructor-empty.src.ts create mode 100644 packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot create mode 100644 packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot diff --git a/README.md b/README.md index 93cacd404622..e44cd7102461 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ The latest version under the `canary` tag **(latest commit to master)** is: ## Supported TypeScript Version -**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.2.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.3.0`.** These versions are what we test against. diff --git a/package.json b/package.json index 8be3c9f9dd77..a7a9b8fc318c 100644 --- a/package.json +++ b/package.json @@ -112,9 +112,9 @@ "ts-jest": "^26.5.1", "ts-node": "^9.0.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.2.0" + "typescript": ">=3.3.1 <4.3.0" }, "resolutions": { - "typescript": "4.1.5" + "typescript": "4.2.2" } } diff --git a/packages/shared-fixtures/fixtures/jsx/namespace-this-name.src.js b/packages/shared-fixtures/fixtures/jsx/namespace-this-name.src.js new file mode 100644 index 000000000000..71eb04b5e41a --- /dev/null +++ b/packages/shared-fixtures/fixtures/jsx/namespace-this-name.src.js @@ -0,0 +1 @@ +; diff --git a/packages/shared-fixtures/fixtures/typescript/types/constructor-abstract.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor-abstract.src.ts new file mode 100644 index 000000000000..fbaa3a91c4a4 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/constructor-abstract.src.ts @@ -0,0 +1 @@ +const x: abstract new () => void; diff --git a/packages/shared-fixtures/fixtures/typescript/types/constructor-empty.src.ts b/packages/shared-fixtures/fixtures/typescript/types/constructor-empty.src.ts new file mode 100644 index 000000000000..c1fc7b6057c6 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/constructor-empty.src.ts @@ -0,0 +1 @@ +const x: new () => void; diff --git a/packages/types/src/ast-node-types.ts b/packages/types/src/ast-node-types.ts index 091e9d3bb945..f233d60f8aeb 100644 --- a/packages/types/src/ast-node-types.ts +++ b/packages/types/src/ast-node-types.ts @@ -47,6 +47,7 @@ enum AST_NODE_TYPES { JSXFragment = 'JSXFragment', JSXIdentifier = 'JSXIdentifier', JSXMemberExpression = 'JSXMemberExpression', + JSXNamespacedName = 'JSXNamespacedName', JSXOpeningElement = 'JSXOpeningElement', JSXOpeningFragment = 'JSXOpeningFragment', JSXSpreadAttribute = 'JSXSpreadAttribute', diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index e341088f2011..9fee42b8ff9b 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -188,6 +188,7 @@ export type Node = | JSXFragment | JSXIdentifier | JSXMemberExpression + | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute @@ -374,6 +375,7 @@ export type Expression = | SequenceExpression | SpreadElement | TSAsExpression + | TSTypeAssertion | TSUnaryExpression | YieldExpression; export type ForInitialiser = Expression | VariableDeclaration; @@ -398,7 +400,10 @@ export type JSXExpression = | JSXEmptyExpression | JSXSpreadChild | JSXExpressionContainer; -export type JSXTagNameExpression = JSXIdentifier | JSXMemberExpression; +export type JSXTagNameExpression = + | JSXIdentifier + | JSXMemberExpression + | JSXNamespacedName; export type LeftHandSideExpression = | CallExpression | ClassExpression @@ -1024,7 +1029,7 @@ export interface ImportSpecifier extends BaseNode { export interface JSXAttribute extends BaseNode { type: AST_NODE_TYPES.JSXAttribute; - name: JSXIdentifier; + name: JSXIdentifier | JSXNamespacedName; value: Literal | JSXExpression | null; } @@ -1071,6 +1076,12 @@ export interface JSXMemberExpression extends BaseNode { property: JSXIdentifier; } +export interface JSXNamespacedName extends BaseNode { + type: AST_NODE_TYPES.JSXNamespacedName; + namespace: JSXIdentifier; + name: JSXIdentifier; +} + export interface JSXOpeningElement extends BaseNode { type: AST_NODE_TYPES.JSXOpeningElement; typeParameters?: TSTypeParameterInstantiation; @@ -1340,6 +1351,7 @@ export interface TSConditionalType extends BaseNode { export interface TSConstructorType extends FunctionSignatureBase { type: AST_NODE_TYPES.TSConstructorType; + abstract: boolean; } export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 73f1317acbcc..69f2b3823967 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -51,8 +51,8 @@ }, "devDependencies": { "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.16", - "@babel/types": "^7.12.13", + "@babel/parser": "^7.13.4", + "@babel/types": "^7.13.0", "@types/babel__code-frame": "*", "@types/debug": "*", "@types/glob": "*", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 762df318e6d7..28442094c2cd 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -517,6 +517,46 @@ export class Converter { return result; } + private convertJSXIdentifier( + node: ts.Identifier | ts.ThisExpression, + ): TSESTree.JSXIdentifier { + const result = this.createNode(node, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.getText(), + }); + this.registerTSNodeInNodeMap(node, result); + return result; + } + + private convertJSXNamespaceOrIdentifier( + node: ts.Identifier | ts.ThisExpression, + ): TSESTree.JSXIdentifier | TSESTree.JSXNamespacedName { + const text = node.getText(); + const colonIndex = text.indexOf(':'); + // this is intentional we can ignore conversion if `:` is in first character + if (colonIndex > 0) { + const range = getRange(node, this.ast); + const result = this.createNode(node, { + type: AST_NODE_TYPES.JSXNamespacedName, + namespace: this.createNode(node, { + type: AST_NODE_TYPES.JSXIdentifier, + name: text.slice(0, colonIndex), + range: [range[0], range[0] + colonIndex], + }), + name: this.createNode(node, { + type: AST_NODE_TYPES.JSXIdentifier, + name: text.slice(colonIndex + 1), + range: [range[0] + colonIndex + 1, range[1]], + }), + range, + }); + this.registerTSNodeInNodeMap(node, result); + return result; + } + + return this.convertJSXIdentifier(node); + } + /** * Converts a TypeScript JSX node.tagName into an ESTree node.name * @param node the tagName object from a JSX ts.Node @@ -526,8 +566,8 @@ export class Converter { private convertJSXTagName( node: ts.JsxTagNameExpression, parent: ts.Node, - ): TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier { - let result: TSESTree.JSXMemberExpression | TSESTree.JSXIdentifier; + ): TSESTree.JSXTagNameExpression { + let result: TSESTree.JSXTagNameExpression; switch (node.kind) { case SyntaxKind.PropertyAccessExpression: if (node.name.kind === SyntaxKind.PrivateIdentifier) { @@ -539,27 +579,14 @@ export class Converter { result = this.createNode(node, { type: AST_NODE_TYPES.JSXMemberExpression, object: this.convertJSXTagName(node.expression, parent), - property: this.convertJSXTagName( - node.name, - parent, - ) as TSESTree.JSXIdentifier, + property: this.convertJSXIdentifier(node.name), }); break; case SyntaxKind.ThisKeyword: - result = this.createNode(node, { - type: AST_NODE_TYPES.JSXIdentifier, - name: 'this', - }); - break; - case SyntaxKind.Identifier: default: - result = this.createNode(node, { - type: AST_NODE_TYPES.JSXIdentifier, - name: node.text, - }); - break; + return this.convertJSXNamespaceOrIdentifier(node); } this.registerTSNodeInNodeMap(node, result); @@ -2113,12 +2140,9 @@ export class Converter { } case SyntaxKind.JsxAttribute: { - const attributeName = this.convertChild(node.name); - attributeName.type = AST_NODE_TYPES.JSXIdentifier; - return this.createNode(node, { type: AST_NODE_TYPES.JSXAttribute, - name: attributeName, + name: this.convertJSXNamespaceOrIdentifier(node.name), value: this.convertChild(node.initializer), }); } @@ -2407,36 +2431,40 @@ export class Converter { } return result; } - case SyntaxKind.ConstructorType: + case SyntaxKind.ConstructorType: { + const result = this.createNode(node, { + type: AST_NODE_TYPES.TSConstructorType, + params: this.convertParameters(node.parameters), + abstract: hasModifier(SyntaxKind.AbstractKeyword, node), + }); + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ); + } + return result; + } + case SyntaxKind.FunctionType: case SyntaxKind.ConstructSignature: case SyntaxKind.CallSignature: { - let type: AST_NODE_TYPES; - switch (node.kind) { - case SyntaxKind.ConstructSignature: - type = AST_NODE_TYPES.TSConstructSignatureDeclaration; - break; - case SyntaxKind.CallSignature: - type = AST_NODE_TYPES.TSCallSignatureDeclaration; - break; - case SyntaxKind.FunctionType: - type = AST_NODE_TYPES.TSFunctionType; - break; - case SyntaxKind.ConstructorType: - default: - type = AST_NODE_TYPES.TSConstructorType; - break; - } + const type = + node.kind === SyntaxKind.ConstructSignature + ? AST_NODE_TYPES.TSConstructSignatureDeclaration + : node.kind === SyntaxKind.CallSignature + ? AST_NODE_TYPES.TSCallSignatureDeclaration + : AST_NODE_TYPES.TSFunctionType; const result = this.createNode< - | TSESTree.TSConstructSignatureDeclaration - | TSESTree.TSCallSignatureDeclaration | TSESTree.TSFunctionType - | TSESTree.TSConstructorType + | TSESTree.TSCallSignatureDeclaration + | TSESTree.TSConstructSignatureDeclaration >(node, { type: type, params: this.convertParameters(node.parameters), }); - if (node.type) { result.returnType = this.convertTypeAnnotation(node.type, node); } @@ -2446,7 +2474,6 @@ export class Converter { node.typeParameters, ); } - return result; } @@ -2694,7 +2721,7 @@ export class Converter { ? (node as any).elementTypes.map((el: ts.Node) => this.convertType(el), ) - : node.elements.map((el: ts.Node) => this.convertType(el)); + : node.elements.map(el => this.convertType(el)); return this.createNode(node, { type: AST_NODE_TYPES.TSTupleType, diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 2eebfc93b127..92ef8c42e604 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -93,6 +93,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.JSXSpreadAttribute]: ts.JsxSpreadAttribute; [AST_NODE_TYPES.JSXSpreadChild]: ts.JsxExpression; [AST_NODE_TYPES.JSXMemberExpression]: ts.PropertyAccessExpression; + [AST_NODE_TYPES.JSXNamespacedName]: ts.Identifier | ts.ThisExpression; [AST_NODE_TYPES.JSXText]: ts.JsxText; [AST_NODE_TYPES.LabeledStatement]: ts.LabeledStatement; [AST_NODE_TYPES.Literal]: @@ -157,15 +158,11 @@ export interface EstreeToTsNodeTypes { | ts.ConstructorDeclaration; [AST_NODE_TYPES.TSArrayType]: ts.ArrayTypeNode; [AST_NODE_TYPES.TSAsExpression]: ts.AsExpression; - [AST_NODE_TYPES.TSCallSignatureDeclaration]: ts.PropertySignature; + [AST_NODE_TYPES.TSCallSignatureDeclaration]: ts.CallSignatureDeclaration; [AST_NODE_TYPES.TSClassImplements]: ts.ExpressionWithTypeArguments; [AST_NODE_TYPES.TSConditionalType]: ts.ConditionalTypeNode; [AST_NODE_TYPES.TSConstructorType]: ts.ConstructorTypeNode; - [AST_NODE_TYPES.TSConstructSignatureDeclaration]: - | ts.ConstructorTypeNode - | ts.FunctionTypeNode - | ts.ConstructSignatureDeclaration - | ts.CallSignatureDeclaration; + [AST_NODE_TYPES.TSConstructSignatureDeclaration]: ts.ConstructSignatureDeclaration; [AST_NODE_TYPES.TSDeclareFunction]: ts.FunctionDeclaration; [AST_NODE_TYPES.TSEnumDeclaration]: ts.EnumDeclaration; [AST_NODE_TYPES.TSEnumMember]: ts.EnumMember; diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 0515aa57f4d9..4acae2c6a5bd 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -299,16 +299,6 @@ tester.addFixturePatternConfig('jsx', { * https://github.com/Microsoft/TypeScript/issues/7410 */ 'embedded-tags', - /** - * JSX fixtures which have known issues for typescript-estree - * @see https://github.com/Microsoft/TypeScript/issues/7411 - */ - 'namespaced-attribute-and-value-inserted', - /** - * JSX fixtures which have known issues for typescript-estree - * @see https://github.com/Microsoft/TypeScript/issues/7411 - */ - 'namespaced-name-and-attribute', /** * Current random error difference on jsx/invalid-no-tag-name.src.js * ts-estree - SyntaxError @@ -316,6 +306,12 @@ tester.addFixturePatternConfig('jsx', { * @see https://github.com/babel/babel/issues/6680 */ 'invalid-no-tag-name', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * SyntaxError: Unexpected token + * TODO: investigate if this code is valid as there is no typescript error + */ + 'invalid-namespace-value-with-dots', ], }); tester.addFixturePatternConfig('jsx-useJSXTextNode'); @@ -346,7 +342,7 @@ tester.addFixturePatternConfig('typescript/basics', { /** * Babel parses it as TSQualifiedName * ts parses it as MemberExpression - * TODO: report it to babel + * @see https://github.com/babel/babel/issues/12884 */ 'interface-with-extends-member-expression', /** @@ -387,7 +383,7 @@ tester.addFixturePatternConfig('typescript/basics', { 'import-type-error', /** * [TS-ESTREE ERRORED, BUT BABEL DID NOT] - * TODO: report this to babel + * This is intentional; babel is not checking types */ 'catch-clause-with-invalid-annotation', ], diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index e5e4d1e16bf5..eb7e5c687e68 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -1435,10 +1435,10 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-mismatched-namespace-tag.src 1`] = ` TSError { - "column": 2, - "index": 2, + "column": 5, + "index": 5, "lineNumber": 1, - "message": "Identifier expected.", + "message": "Expected corresponding JSX closing tag for 'a:b'.", } `; @@ -1496,14 +1496,7 @@ TSError { } `; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-value-with-dots.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-namespace-value-with-dots.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/invalid-no-common-parent.src 1`] = ` TSError { @@ -1587,23 +1580,11 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/multiple-blank-spaces.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespace-this-name.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-name-and-attribute.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-attribute-and-value-inserted.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/namespaced-name-and-attribute.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/newslines-and-entities.src 1`] = ` TSError { @@ -2622,6 +2603,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-abstract.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-empty.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor-in-generic.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot index b466cc6ba4c8..1dd65c521056 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot @@ -2,9 +2,9 @@ exports[`jsx invalid-mismatched-namespace-tag.src 1`] = ` TSError { - "column": 2, - "index": 2, + "column": 5, + "index": 5, "lineNumber": 1, - "message": "Identifier expected.", + "message": "Expected corresponding JSX closing tag for 'a:b'.", } `; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot index 33b9b97c43a4..3d11bc184cc8 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot @@ -1,10 +1,491 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx invalid-namespace-value-with-dots.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXNamespacedName", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 7, + 15, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXNamespacedName", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 6, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 7, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "a:b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXIdentifier", + "value": "a:b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", } `; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot new file mode 100644 index 000000000000..58e66b804b7e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot @@ -0,0 +1,226 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespace-this-name.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 6, + 9, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "this", + "range": Array [ + 1, + 5, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 9, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 0, + 12, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 12, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "this:bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot index 84724e7bdb74..647aa3f85b5e 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot @@ -1,10 +1,934 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx namespaced-attribute-and-value-inserted.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Identifier expected.", +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": " ", + "type": "Literal", + "value": " ", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "value", + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": " ", + "type": "Literal", + "value": " ", + }, + Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 27, + 32, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 27, + 32, + ], + "type": "JSXElement", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 34, + 35, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 32, + 36, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 24, + 27, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 24, + 36, + ], + "type": "JSXElement", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 38, + 39, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 36, + 40, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 8, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 3, + 14, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "raw": "\\"bar\\"", + "type": "Literal", + "value": "bar", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 15, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 40, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "type": "JSXIdentifier", + "value": "n:foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXText", + "value": "\\"bar\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", } `; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot index ac04b31a1402..b27c937e5a0a 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot @@ -1,10 +1,316 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`jsx namespaced-name-and-attribute.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 0, + 11, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "n:a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "n:v", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", } `; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot index 2483ab6e80a3..7ea53067001e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot @@ -655,6 +655,7 @@ Object { ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { + "abstract": false, "loc": Object { "end": Object { "column": 47, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot new file mode 100644 index 000000000000..2896e8859179 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot @@ -0,0 +1,333 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-abstract.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": true, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 9, + 32, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot new file mode 100644 index 000000000000..cb15aec46848 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot @@ -0,0 +1,315 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 23, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 9, + 23, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot index 8472c563eedb..d0434a7edb77 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot @@ -40,6 +40,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "abstract": false, "loc": Object { "end": Object { "column": 25, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot index e54dffb608d0..e74c46c3f4cd 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot @@ -86,6 +86,7 @@ Object { }, "params": Array [ Object { + "abstract": false, "loc": Object { "end": Object { "column": 29, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot index 419b2d8790df..e001f2adb029 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot @@ -40,6 +40,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "abstract": false, "loc": Object { "end": Object { "column": 35, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot index 79710aea0ac7..03af1a6c2c07 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot @@ -40,6 +40,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "abstract": false, "loc": Object { "end": Object { "column": 42, diff --git a/packages/visitor-keys/tests/visitor-keys.test.ts b/packages/visitor-keys/tests/visitor-keys.test.ts index a8ee4a78336f..a6fe66bc5408 100644 --- a/packages/visitor-keys/tests/visitor-keys.test.ts +++ b/packages/visitor-keys/tests/visitor-keys.test.ts @@ -16,7 +16,6 @@ describe('Every ast node type should have a visitor key defined', () => { const IGNORED_KEYS = new Set([ 'ExperimentalRestProperty', 'ExperimentalSpreadProperty', - 'JSXNamespacedName', ]); describe('Every visitor key should have an ast node type defined', () => { for (const key of keys) { diff --git a/yarn.lock b/yarn.lock index 6c9fa4035b19..7391d1c4c005 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,36 +16,52 @@ dependencies: "@babel/highlight" "^7.12.13" +"@babel/compat-data@^7.13.0": + version "7.13.6" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.6.tgz#11972d07db4c2317afdbf41d6feb3a730301ef4e" + integrity sha512-VhgqKOWYVm7lQXlvbJnWOzwfAQATd2nV52koT0HZ/LdDH0m4DUDwkKYsH+IwpXb+bKPyBJzawA4I6nBKqZcpQw== + "@babel/core@^7.1.0", "@babel/core@^7.7.5": - version "7.12.16" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.16.tgz#8c6ba456b23b680a6493ddcfcd9d3c3ad51cab7c" - integrity sha512-t/hHIB504wWceOeaOoONOhu+gX+hpjfeN6YRBT209X/4sibZQfSF1I0HFRRlBe97UZZosGx5XwUg1ZgNbelmNw== + version "7.13.1" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.1.tgz#7ddd027176debe40f13bb88bac0c21218c5b1ecf" + integrity sha512-FzeKfFBG2rmFtGiiMdXZPFt/5R5DXubVi82uYhjGX4Msf+pgYQMCFIqFXZWs5vbIYbf14VeBIgdGI03CDOOM1w== dependencies: "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.12.15" - "@babel/helper-module-transforms" "^7.12.13" - "@babel/helpers" "^7.12.13" - "@babel/parser" "^7.12.16" + "@babel/generator" "^7.13.0" + "@babel/helper-compilation-targets" "^7.13.0" + "@babel/helper-module-transforms" "^7.13.0" + "@babel/helpers" "^7.13.0" + "@babel/parser" "^7.13.0" "@babel/template" "^7.12.13" - "@babel/traverse" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" convert-source-map "^1.7.0" debug "^4.1.0" - gensync "^1.0.0-beta.1" + gensync "^1.0.0-beta.2" json5 "^2.1.2" lodash "^4.17.19" - semver "^5.4.1" + semver "7.0.0" source-map "^0.5.0" -"@babel/generator@^7.12.13", "@babel/generator@^7.12.15": - version "7.12.15" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.15.tgz#4617b5d0b25cc572474cc1aafee1edeaf9b5368f" - integrity sha512-6F2xHxBiFXWNSGb7vyCUTBF8RCLY66rS0zEPcP8t/nQyXjha5EuK4z7H5o7fWG8B4M7y6mqVWq1J+1PuwRhecQ== +"@babel/generator@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.13.0.tgz#bd00d4394ca22f220390c56a0b5b85568ec1ec0c" + integrity sha512-zBZfgvBB/ywjx0Rgc2+BwoH/3H+lDtlgD4hBOpEv5LxRnYsm/753iRuLepqnYlynpjC3AdQxtxsoeHJoEEwOAw== dependencies: - "@babel/types" "^7.12.13" + "@babel/types" "^7.13.0" jsesc "^2.5.1" source-map "^0.5.0" +"@babel/helper-compilation-targets@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.0.tgz#c9cf29b82a76fd637f0faa35544c4ace60a155a1" + integrity sha512-SOWD0JK9+MMIhTQiUVd4ng8f3NXhPVQvTv7D3UN4wbp/6cAHnB2EmMaU1zZA2Hh1gwme+THBrVSqTFxHczTh0Q== + dependencies: + "@babel/compat-data" "^7.13.0" + "@babel/helper-validator-option" "^7.12.17" + browserslist "^4.14.5" + semver "7.0.0" + "@babel/helper-function-name@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a" @@ -62,12 +78,12 @@ dependencies: "@babel/types" "^7.12.13" -"@babel/helper-member-expression-to-functions@^7.12.13": - version "7.12.16" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.16.tgz#41e0916b99f8d5f43da4f05d85f4930fa3d62b22" - integrity sha512-zYoZC1uvebBFmj1wFAlXwt35JLEgecefATtKp20xalwEK8vHAixLBXTGxNrVGEmTT+gzOThUgr8UEdgtalc1BQ== +"@babel/helper-member-expression-to-functions@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.0.tgz#6aa4bb678e0f8c22f58cdb79451d30494461b091" + integrity sha512-yvRf8Ivk62JwisqV1rFRMxiSMDGnN6KH1/mDMmIrij4jztpQNRoHqqMG3U6apYbGRPJpgPalhva9Yd06HlUxJQ== dependencies: - "@babel/types" "^7.12.13" + "@babel/types" "^7.13.0" "@babel/helper-module-imports@^7.12.13": version "7.12.13" @@ -76,19 +92,19 @@ dependencies: "@babel/types" "^7.12.13" -"@babel/helper-module-transforms@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.13.tgz#01afb052dcad2044289b7b20beb3fa8bd0265bea" - integrity sha512-acKF7EjqOR67ASIlDTupwkKM1eUisNAjaSduo5Cz+793ikfnpe7p4Q7B7EWU2PCoSTPWsQkR7hRUWEIZPiVLGA== +"@babel/helper-module-transforms@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.13.0.tgz#42eb4bd8eea68bab46751212c357bfed8b40f6f1" + integrity sha512-Ls8/VBwH577+pw7Ku1QkUWIyRRNHpYlts7+qSqBBFCW3I8QteB9DxfcZ5YJpOwH6Ihe/wn8ch7fMGOP1OhEIvw== dependencies: "@babel/helper-module-imports" "^7.12.13" - "@babel/helper-replace-supers" "^7.12.13" + "@babel/helper-replace-supers" "^7.13.0" "@babel/helper-simple-access" "^7.12.13" "@babel/helper-split-export-declaration" "^7.12.13" "@babel/helper-validator-identifier" "^7.12.11" "@babel/template" "^7.12.13" - "@babel/traverse" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" lodash "^4.17.19" "@babel/helper-optimise-call-expression@^7.12.13": @@ -99,19 +115,19 @@ "@babel/types" "^7.12.13" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.8.0": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.12.13.tgz#174254d0f2424d8aefb4dd48057511247b0a9eeb" - integrity sha512-C+10MXCXJLiR6IeG9+Wiejt9jmtFpxUc3MQqCmPY8hfCjyUGl9kT+B2okzEZrtykiwrc4dbCPdDoz0A/HQbDaA== + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" + integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== -"@babel/helper-replace-supers@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.13.tgz#00ec4fb6862546bd3d0aff9aac56074277173121" - integrity sha512-pctAOIAMVStI2TMLhozPKbf5yTEXc0OJa0eENheb4w09SrgOWEs+P4nTOZYJQCqs8JlErGLDPDJTiGIp3ygbLg== +"@babel/helper-replace-supers@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.13.0.tgz#6034b7b51943094cb41627848cb219cb02be1d24" + integrity sha512-Segd5me1+Pz+rmN/NFBOplMbZG3SqRJOBlY+mA0SxAv6rjj7zJqr1AVr3SfzUVTLCv7ZLU5FycOM/SBGuLPbZw== dependencies: - "@babel/helper-member-expression-to-functions" "^7.12.13" + "@babel/helper-member-expression-to-functions" "^7.13.0" "@babel/helper-optimise-call-expression" "^7.12.13" - "@babel/traverse" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" "@babel/helper-simple-access@^7.12.13": version "7.12.13" @@ -132,14 +148,19 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== -"@babel/helpers@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.12.13.tgz#3c75e993632e4dadc0274eae219c73eb7645ba47" - integrity sha512-oohVzLRZ3GQEk4Cjhfs9YkJA4TdIDTObdBEZGrd6F/T0GPSnuV6l22eMcxlvcvzVIPH3VTtxbseudM1zIE+rPQ== +"@babel/helper-validator-option@^7.12.17": + version "7.12.17" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" + integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== + +"@babel/helpers@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.13.0.tgz#7647ae57377b4f0408bf4f8a7af01c42e41badc0" + integrity sha512-aan1MeFPxFacZeSz6Ld7YZo5aPuqnKlD7+HZY75xQsueczFccP9A7V05+oe0XpLwHK3oLorPe9eaAUljL7WEaQ== dependencies: "@babel/template" "^7.12.13" - "@babel/traverse" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/traverse" "^7.13.0" + "@babel/types" "^7.13.0" "@babel/highlight@^7.10.4", "@babel/highlight@^7.12.13": version "7.12.13" @@ -150,10 +171,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.12.16": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.17.tgz#bc85d2d47db38094e5bb268fc761716e7d693848" - integrity sha512-r1yKkiUTYMQ8LiEI0UcQx5ETw5dpTLn9wijn9hk6KkTtOK95FndDN10M+8/s6k/Ymlbivw0Av9q4SlgF80PtHg== +"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.13.0", "@babel/parser@^7.13.4": + version "7.13.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.4.tgz#340211b0da94a351a6f10e63671fa727333d13ab" + integrity sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -240,9 +261,9 @@ "@babel/helper-plugin-utils" "^7.12.13" "@babel/runtime@^7.11.0", "@babel/runtime@^7.11.2", "@babel/runtime@^7.7.6": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.13.tgz#0a21452352b02542db0ffb928ac2d3ca7cb6d66d" - integrity sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw== + version "7.13.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.6.tgz#86e0fad6cbb46a680e21c1aa4748717a058d345a" + integrity sha512-Y/DEVhSQ91u27rxq7D0EH/sewS6+x06p/MgO1VppbDHMzYXLZrAR5cFjCom78e9RUw1BQAq6qJg6fXc/ep7glA== dependencies: regenerator-runtime "^0.13.4" @@ -255,25 +276,25 @@ "@babel/parser" "^7.12.13" "@babel/types" "^7.12.13" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.13.tgz#689f0e4b4c08587ad26622832632735fb8c4e0c0" - integrity sha512-3Zb4w7eE/OslI0fTp8c7b286/cQps3+vdLW3UcwC8VSJC6GbKn55aeVVu2QJNuCDoeKyptLOFrPq8WqZZBodyA== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.13.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" + integrity sha512-xys5xi5JEhzC3RzEmSGrs/b3pJW/o87SypZ+G/PhaE7uqVQNv/jlmVIBXuoh5atqQ434LfXV+sf23Oxj0bchJQ== dependencies: "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.12.13" + "@babel/generator" "^7.13.0" "@babel/helper-function-name" "^7.12.13" "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/parser" "^7.12.13" - "@babel/types" "^7.12.13" + "@babel/parser" "^7.13.0" + "@babel/types" "^7.13.0" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.12.13", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.17.tgz#9d711eb807e0934c90b8b1ca0eb1f7230d150963" - integrity sha512-tNMDjcv/4DIcHxErTgwB9q2ZcYyN0sUfgGKUK/mm1FJK7Wz+KstoEekxrl/tBiNDgLK1HGi+sppj1An/1DR4fQ== +"@babel/types@^7.0.0", "@babel/types@^7.12.13", "@babel/types@^7.13.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" + integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== dependencies: "@babel/helper-validator-identifier" "^7.12.11" lodash "^4.17.19" @@ -2463,6 +2484,17 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== +browserslist@^4.14.5: + version "4.16.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.3.tgz#340aa46940d7db878748567c5dea24a48ddf3717" + integrity sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw== + dependencies: + caniuse-lite "^1.0.30001181" + colorette "^1.2.1" + electron-to-chromium "^1.3.649" + escalade "^3.1.1" + node-releases "^1.1.70" + bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -2623,6 +2655,11 @@ camelcase@^6.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== +caniuse-lite@^1.0.30001181: + version "1.0.30001191" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001191.tgz#bacb432b6701f690c8c5f7c680166b9a9f0843d9" + integrity sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -2803,6 +2840,11 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +colorette@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" + integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== + columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" @@ -3514,6 +3556,11 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +electron-to-chromium@^1.3.649: + version "1.3.672" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.672.tgz#3a6e335016dab4bc584d5292adc4f98f54541f6a" + integrity sha512-gFQe7HBb0lbOMqK2GAS5/1F+B0IMdYiAgB9OT/w1F4M7lgJK2aNOMNOM622aEax+nS1cTMytkiT0uMOkbtFmHw== + emittery@^0.7.1: version "0.7.2" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82" @@ -3615,6 +3662,11 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -4223,7 +4275,7 @@ gensequence@^3.1.1: resolved "https://registry.yarnpkg.com/gensequence/-/gensequence-3.1.1.tgz#95c1afc7c0680f92942c17f2d6f83f3d26ea97af" integrity sha512-ys3h0hiteRwmY6BsvSttPmkhC0vEQHPJduANBRtH/dlDPZ0UBIb/dXy80IcckXyuQ6LKg+PloRqvGER9IS7F7g== -gensync@^1.0.0-beta.1: +gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== @@ -6486,6 +6538,11 @@ node-notifier@^8.0.0: uuid "^8.3.0" which "^2.0.2" +node-releases@^1.1.70: + version "1.1.71" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb" + integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== + nopt@^4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" @@ -7709,6 +7766,11 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== + semver@7.3.2: version "7.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" @@ -8604,10 +8666,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.1.5, "typescript@>=3.3.1 <4.2.0", typescript@^4.1.0-dev.20201026: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== +typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026: + version "4.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c" + integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" From 0336c798c9502fc250d2eaa045661950da55e52f Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 1 Mar 2021 01:29:00 +0100 Subject: [PATCH 21/24] fix(scope-manager): update libs for typescript 4.2 (#3118) --- packages/scope-manager/src/lib/dom.ts | 186 ++++++++++++++------ packages/scope-manager/src/lib/webworker.ts | 134 +++++++------- 2 files changed, 202 insertions(+), 118 deletions(-) diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index e736f675fd4c..9fc4c5106841 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -629,6 +629,12 @@ export const dom = { isValueVariable: false, name: 'ImageEncodeOptions', }, + ImportMeta: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ImportMeta', + }, InputEventInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -959,12 +965,6 @@ export const dom = { isValueVariable: false, name: 'PermissionDescriptor', }, - PipeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PipeOptions', - }, PointerEventInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1073,6 +1073,12 @@ export const dom = { isValueVariable: false, name: 'QueuingStrategy', }, + QueuingStrategyInit: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'QueuingStrategyInit', + }, RTCAnswerOptions: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1421,17 +1427,23 @@ export const dom = { isValueVariable: false, name: 'RTCTransportStats', }, - ReadableStreamReadDoneResult: { + ReadableStreamDefaultReadDoneResult: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadDoneResult', + name: 'ReadableStreamDefaultReadDoneResult', }, - ReadableStreamReadValueResult: { + ReadableStreamDefaultReadValueResult: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadValueResult', + name: 'ReadableStreamDefaultReadValueResult', + }, + ReadableWritablePair: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableWritablePair', }, RegistrationOptions: { eslintImplicitGlobalSetting: 'readonly', @@ -1445,6 +1457,12 @@ export const dom = { isValueVariable: false, name: 'RequestInit', }, + ResizeObserverOptions: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ResizeObserverOptions', + }, ResponseInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1565,6 +1583,18 @@ export const dom = { isValueVariable: false, name: 'ShareData', }, + SpeechRecognitionErrorEventInit: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'SpeechRecognitionErrorEventInit', + }, + SpeechRecognitionEventInit: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'SpeechRecognitionEventInit', + }, SpeechSynthesisErrorEventInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1613,6 +1643,12 @@ export const dom = { isValueVariable: false, name: 'StoreSiteSpecificExceptionsInformation', }, + StreamPipeOptions: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'StreamPipeOptions', + }, TextDecodeOptions: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1673,12 +1709,6 @@ export const dom = { isValueVariable: false, name: 'ULongRange', }, - UnderlyingByteSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingByteSource', - }, UnderlyingSink: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -4715,53 +4745,53 @@ export const dom = { isValueVariable: true, name: 'Range', }, - ReadableByteStreamController: { + ReadableStream: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableByteStreamController', + name: 'ReadableStream', }, - ReadableStream: { + ReadableStreamDefaultController: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableStream', + name: 'ReadableStreamDefaultController', }, - ReadableStreamBYOBReader: { + ReadableStreamDefaultReader: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableStreamBYOBReader', + name: 'ReadableStreamDefaultReader', }, - ReadableStreamBYOBRequest: { + ReadableStreamGenericReader: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamBYOBRequest', + isValueVariable: false, + name: 'ReadableStreamGenericReader', }, - ReadableStreamDefaultController: { + Request: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableStreamDefaultController', + name: 'Request', }, - ReadableStreamDefaultReader: { + ResizeObserver: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableStreamDefaultReader', + name: 'ResizeObserver', }, - ReadableStreamReader: { + ResizeObserverEntry: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'ReadableStreamReader', + name: 'ResizeObserverEntry', }, - Request: { + ResizeObserverSize: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, - name: 'Request', + name: 'ResizeObserverSize', }, Response: { eslintImplicitGlobalSetting: 'readonly', @@ -5693,6 +5723,12 @@ export const dom = { isValueVariable: true, name: 'SpeechRecognitionAlternative', }, + SpeechRecognitionErrorEvent: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: true, + name: 'SpeechRecognitionErrorEvent', + }, SpeechRecognitionEvent: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -6593,11 +6629,11 @@ export const dom = { isValueVariable: false, name: 'PositionErrorCallback', }, - QueuingStrategySizeCallback: { + QueuingStrategySize: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'QueuingStrategySizeCallback', + name: 'QueuingStrategySize', }, RTCPeerConnectionErrorCallback: { eslintImplicitGlobalSetting: 'readonly', @@ -6617,65 +6653,77 @@ export const dom = { isValueVariable: false, name: 'RTCStatsCallback', }, - ReadableByteStreamControllerCallback: { + ResizeObserverCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableByteStreamControllerCallback', + name: 'ResizeObserverCallback', }, - ReadableStreamDefaultControllerCallback: { + TransformerFlushCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamDefaultControllerCallback', + name: 'TransformerFlushCallback', }, - ReadableStreamErrorCallback: { + TransformerStartCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamErrorCallback', + name: 'TransformerStartCallback', }, - TransformStreamDefaultControllerCallback: { + TransformerTransformCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'TransformStreamDefaultControllerCallback', + name: 'TransformerTransformCallback', }, - TransformStreamDefaultControllerTransformCallback: { + UnderlyingSinkAbortCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'TransformStreamDefaultControllerTransformCallback', + name: 'UnderlyingSinkAbortCallback', }, - VoidFunction: { + UnderlyingSinkCloseCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'VoidFunction', + name: 'UnderlyingSinkCloseCallback', }, - WritableStreamDefaultControllerCloseCallback: { + UnderlyingSinkStartCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerCloseCallback', + name: 'UnderlyingSinkStartCallback', }, - WritableStreamDefaultControllerStartCallback: { + UnderlyingSinkWriteCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerStartCallback', + name: 'UnderlyingSinkWriteCallback', }, - WritableStreamDefaultControllerWriteCallback: { + UnderlyingSourceCancelCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerWriteCallback', + name: 'UnderlyingSourceCancelCallback', }, - WritableStreamErrorCallback: { + UnderlyingSourcePullCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamErrorCallback', + name: 'UnderlyingSourcePullCallback', + }, + UnderlyingSourceStartCallback: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'UnderlyingSourceStartCallback', + }, + VoidFunction: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'VoidFunction', }, HTMLElementTagNameMap: { eslintImplicitGlobalSetting: 'readonly', @@ -6827,11 +6875,17 @@ export const dom = { isValueVariable: false, name: 'PerformanceEntryList', }, - ReadableStreamReadResult: { + ReadableStreamReader: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadResult', + name: 'ReadableStreamReader', + }, + ReadableStreamController: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableStreamController', }, VibratePattern: { eslintImplicitGlobalSetting: 'readonly', @@ -7055,6 +7109,12 @@ export const dom = { isValueVariable: false, name: 'WindowProxy', }, + ReadableStreamDefaultReadResult: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableStreamDefaultReadResult', + }, AlignSetting: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -7751,6 +7811,12 @@ export const dom = { isValueVariable: false, name: 'ResidentKeyRequirement', }, + ResizeObserverBoxOptions: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ResizeObserverBoxOptions', + }, ResizeQuality: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -7817,6 +7883,12 @@ export const dom = { isValueVariable: false, name: 'ShadowRootMode', }, + SpeechRecognitionErrorCode: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'SpeechRecognitionErrorCode', + }, SpeechSynthesisErrorCode: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index c56ee9885241..3f76351c98f4 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -263,6 +263,12 @@ export const webworker = { isValueVariable: false, name: 'ImageEncodeOptions', }, + ImportMeta: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ImportMeta', + }, JsonWebKey: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -335,12 +341,6 @@ export const webworker = { isValueVariable: false, name: 'PermissionDescriptor', }, - PipeOptions: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'PipeOptions', - }, PostMessageOptions: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -395,17 +395,29 @@ export const webworker = { isValueVariable: false, name: 'QueuingStrategy', }, - ReadableStreamReadDoneResult: { + QueuingStrategyInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadDoneResult', + name: 'QueuingStrategyInit', }, - ReadableStreamReadValueResult: { + ReadableStreamDefaultReadDoneResult: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadValueResult', + name: 'ReadableStreamDefaultReadDoneResult', + }, + ReadableStreamDefaultReadValueResult: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableStreamDefaultReadValueResult', + }, + ReadableWritablePair: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableWritablePair', }, RegistrationOptions: { eslintImplicitGlobalSetting: 'readonly', @@ -467,6 +479,12 @@ export const webworker = { isValueVariable: false, name: 'StorageEstimate', }, + StreamPipeOptions: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'StreamPipeOptions', + }, SyncEventInit: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -497,12 +515,6 @@ export const webworker = { isValueVariable: false, name: 'Transformer', }, - UnderlyingByteSource: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: false, - name: 'UnderlyingByteSource', - }, UnderlyingSink: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1373,30 +1385,12 @@ export const webworker = { isValueVariable: true, name: 'PushSubscriptionOptions', }, - ReadableByteStreamController: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableByteStreamController', - }, ReadableStream: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: true, name: 'ReadableStream', }, - ReadableStreamBYOBReader: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamBYOBReader', - }, - ReadableStreamBYOBRequest: { - eslintImplicitGlobalSetting: 'readonly', - isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamBYOBRequest', - }, ReadableStreamDefaultController: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, @@ -1409,11 +1403,11 @@ export const webworker = { isValueVariable: true, name: 'ReadableStreamDefaultReader', }, - ReadableStreamReader: { + ReadableStreamGenericReader: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, - isValueVariable: true, - name: 'ReadableStreamReader', + isValueVariable: false, + name: 'ReadableStreamGenericReader', }, Request: { eslintImplicitGlobalSetting: 'readonly', @@ -1919,71 +1913,77 @@ export const webworker = { isValueVariable: false, name: 'PerformanceObserverCallback', }, - QueuingStrategySizeCallback: { + QueuingStrategySize: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'QueuingStrategySizeCallback', + name: 'QueuingStrategySize', }, - ReadableByteStreamControllerCallback: { + TransformerFlushCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableByteStreamControllerCallback', + name: 'TransformerFlushCallback', }, - ReadableStreamDefaultControllerCallback: { + TransformerStartCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamDefaultControllerCallback', + name: 'TransformerStartCallback', }, - ReadableStreamErrorCallback: { + TransformerTransformCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamErrorCallback', + name: 'TransformerTransformCallback', }, - TransformStreamDefaultControllerCallback: { + UnderlyingSinkAbortCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'TransformStreamDefaultControllerCallback', + name: 'UnderlyingSinkAbortCallback', }, - TransformStreamDefaultControllerTransformCallback: { + UnderlyingSinkCloseCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'TransformStreamDefaultControllerTransformCallback', + name: 'UnderlyingSinkCloseCallback', }, - VoidFunction: { + UnderlyingSinkStartCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'VoidFunction', + name: 'UnderlyingSinkStartCallback', }, - WritableStreamDefaultControllerCloseCallback: { + UnderlyingSinkWriteCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerCloseCallback', + name: 'UnderlyingSinkWriteCallback', }, - WritableStreamDefaultControllerStartCallback: { + UnderlyingSourceCancelCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerStartCallback', + name: 'UnderlyingSourceCancelCallback', }, - WritableStreamDefaultControllerWriteCallback: { + UnderlyingSourcePullCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamDefaultControllerWriteCallback', + name: 'UnderlyingSourcePullCallback', }, - WritableStreamErrorCallback: { + UnderlyingSourceStartCallback: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'WritableStreamErrorCallback', + name: 'UnderlyingSourceStartCallback', + }, + VoidFunction: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'VoidFunction', }, HeadersInit: { eslintImplicitGlobalSetting: 'readonly', @@ -2063,11 +2063,17 @@ export const webworker = { isValueVariable: false, name: 'PushMessageDataInit', }, - ReadableStreamReadResult: { + ReadableStreamReader: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableStreamReader', + }, + ReadableStreamController: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, isValueVariable: false, - name: 'ReadableStreamReadResult', + name: 'ReadableStreamController', }, VibratePattern: { eslintImplicitGlobalSetting: 'readonly', @@ -2225,6 +2231,12 @@ export const webworker = { isValueVariable: false, name: 'Transferable', }, + ReadableStreamDefaultReadResult: { + eslintImplicitGlobalSetting: 'readonly', + isTypeVariable: true, + isValueVariable: false, + name: 'ReadableStreamDefaultReadResult', + }, BinaryType: { eslintImplicitGlobalSetting: 'readonly', isTypeVariable: true, From 4ca58886adf3fc0fe31c263559990c8a534205f9 Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 1 Mar 2021 03:57:30 +0100 Subject: [PATCH 22/24] fix(eslint-plugin): [no-unused-vars] don't report nested module declaration (#3119) --- .../eslint-plugin/src/rules/no-unused-vars.ts | 17 +++++++++++++++++ .../rules/no-unused-vars/no-unused-vars.test.ts | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index 79709e1df1ee..2e6633afc57f 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -264,6 +264,23 @@ export default util.createRule({ markDeclarationChildAsUsed(node); }, + // module declaration in module declaration should not report unused vars error + // this is workaround as this change should be done in better way + 'TSModuleDeclaration > TSModuleDeclaration'( + node: TSESTree.TSModuleDeclaration, + ): void { + if (node.id.type === AST_NODE_TYPES.Identifier) { + let scope = context.getScope(); + if (scope.upper) { + scope = scope.upper; + } + const superVar = scope.set.get(node.id.name); + if (superVar) { + superVar.eslintUsed = true; + } + } + }, + // children of a namespace that is a child of a declared namespace are auto-exported [ambientDeclarationSelector( 'TSModuleDeclaration[declare = true] > TSModuleBlock TSModuleDeclaration > TSModuleBlock', 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 eaf59a485710..c5b5ef1887f2 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 @@ -688,6 +688,13 @@ export { Foo }; ` export namespace Foo { export const item: Foo = 1; +} + `, + ` +export namespace foo.bar { + export interface User { + name: string; + } } `, // exported self-referencing types From 8c65d30a225a3b99e80326961d0cb0c8189b039c Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Mon, 1 Mar 2021 15:43:02 +0900 Subject: [PATCH 23/24] fix(eslint-plugin): [no-implied-eval] handle conditional expression (#3125) --- .../src/rules/no-implied-eval.ts | 1 + .../tests/rules/no-implied-eval.test.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index 25eac2adbc65..c7caf2d4bef4 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -108,6 +108,7 @@ export default util.createRule({ case AST_NODE_TYPES.MemberExpression: case AST_NODE_TYPES.Identifier: + case AST_NODE_TYPES.ConditionalExpression: return isFunctionType(node); case AST_NODE_TYPES.CallExpression: diff --git a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts index a9867d73018d..de619abbc8b5 100644 --- a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts +++ b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts @@ -251,6 +251,12 @@ const foo = (callback: Function) => { setTimeout(callback, 0); }; `, + ` +const foo = () => {}; +const bar = () => {}; + +setTimeout(Math.radom() > 0.5 ? foo : bar, 0); + `, ], invalid: [ @@ -606,6 +612,21 @@ const fn = (foo: string | any) => { }, { code: ` +const foo = 'foo'; +const bar = () => {}; + +setTimeout(Math.radom() > 0.5 ? foo : bar, 0); + `, + errors: [ + { + messageId: 'noImpliedEvalError', + line: 5, + column: 12, + }, + ], + }, + { + code: ` window.setTimeout(\`\`, 0); window['setTimeout'](\`\`, 0); From 79eb5bce7f1ceb678e583de04a16009647221225 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 1 Mar 2021 18:03:28 +0000 Subject: [PATCH 24/24] chore: publish v4.16.0 --- CHANGELOG.md | 24 ++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 8 +++++++ packages/eslint-plugin-internal/package.json | 4 ++-- packages/eslint-plugin-tslint/CHANGELOG.md | 8 +++++++ packages/eslint-plugin-tslint/package.json | 6 ++--- packages/eslint-plugin/CHANGELOG.md | 21 +++++++++++++++++ packages/eslint-plugin/package.json | 6 ++--- packages/experimental-utils/CHANGELOG.md | 8 +++++++ packages/experimental-utils/package.json | 8 +++---- packages/parser/CHANGELOG.md | 8 +++++++ packages/parser/package.json | 10 ++++---- packages/scope-manager/CHANGELOG.md | 11 +++++++++ packages/scope-manager/package.json | 8 +++---- packages/shared-fixtures/CHANGELOG.md | 11 +++++++++ packages/shared-fixtures/package.json | 2 +- packages/types/CHANGELOG.md | 11 +++++++++ packages/types/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 12 ++++++++++ packages/typescript-estree/package.json | 8 +++---- packages/visitor-keys/CHANGELOG.md | 11 +++++++++ packages/visitor-keys/package.json | 4 ++-- 22 files changed, 163 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cfdbf8471aa..4e18df409baa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Bug Fixes + +* **eslint-plugin:** [consistent-indexed-object-style] do not autofix if interface has extends ([#3009](https://github.com/typescript-eslint/typescript-eslint/issues/3009)) ([b0475af](https://github.com/typescript-eslint/typescript-eslint/commit/b0475aff3920d748fa74b5a6d8a7ad5dd731aec4)) +* **eslint-plugin:** [no-implied-eval] handle conditional expression ([#3125](https://github.com/typescript-eslint/typescript-eslint/issues/3125)) ([8c65d30](https://github.com/typescript-eslint/typescript-eslint/commit/8c65d30a225a3b99e80326961d0cb0c8189b039c)) +* **eslint-plugin:** [no-unused-vars] don't report nested module declaration ([#3119](https://github.com/typescript-eslint/typescript-eslint/issues/3119)) ([4ca5888](https://github.com/typescript-eslint/typescript-eslint/commit/4ca58886adf3fc0fe31c263559990c8a534205f9)) +* **eslint-plugin:** [prefer-function-type] apply existing comments to the fixed code ([#3094](https://github.com/typescript-eslint/typescript-eslint/issues/3094)) ([c32f803](https://github.com/typescript-eslint/typescript-eslint/commit/c32f803d4480acf5ffc88e308b4243e5185c4f48)) +* **eslint-plugin:** [unbound-method] allow `super` expressions in `this` assignments ([#3010](https://github.com/typescript-eslint/typescript-eslint/issues/3010)) ([c65a139](https://github.com/typescript-eslint/typescript-eslint/commit/c65a1391be15bbcf3ae293b1c53686703883d546)) +* **scope-manager:** update libs for typescript 4.2 ([#3118](https://github.com/typescript-eslint/typescript-eslint/issues/3118)) ([0336c79](https://github.com/typescript-eslint/typescript-eslint/commit/0336c798c9502fc250d2eaa045661950da55e52f)) + + +### Features + +* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +* **eslint-plugin:** [member-delimiter-style] Add an option 'multilineDetection' to treat types and interfaces as single line if the last member ends on the same line as the closing bracket ([#2970](https://github.com/typescript-eslint/typescript-eslint/issues/2970)) ([cf86f42](https://github.com/typescript-eslint/typescript-eslint/commit/cf86f427186d58b0fce4bb3ff9571c4301babeb3)) +* **eslint-plugin:** [prom-func-async] report only function head ([#2872](https://github.com/typescript-eslint/typescript-eslint/issues/2872)) ([25f459c](https://github.com/typescript-eslint/typescript-eslint/commit/25f459cdc4f38d44b48554e04cfa1676538ccdfb)) +* **typescript-estree:** throw custom error instead of plain object ([#3011](https://github.com/typescript-eslint/typescript-eslint/issues/3011)) ([ae14bf5](https://github.com/typescript-eslint/typescript-eslint/commit/ae14bf55fe31b0eb982ba17333e4aac550d10342)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/lerna.json b/lerna.json index 0050e613058f..8a264994d358 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.15.2", + "version": "4.16.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 791472ff0f27..c040c895a885 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 2b61e189358c..cc49519d4389 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "4.15.2", + "version": "4.16.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.15.2", + "@typescript-eslint/experimental-utils": "4.16.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 1f434ac3c804..76852cd4d124 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 145bcde18fa7..4a8b5dc1b2bf 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "4.15.2", + "version": "4.16.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.15.2", + "@typescript-eslint/experimental-utils": "4.16.0", "lodash": "^4.17.15" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.15.2" + "@typescript-eslint/parser": "4.16.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index a9235398567e..ae1721d461ef 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Bug Fixes + +* **eslint-plugin:** [consistent-indexed-object-style] do not autofix if interface has extends ([#3009](https://github.com/typescript-eslint/typescript-eslint/issues/3009)) ([b0475af](https://github.com/typescript-eslint/typescript-eslint/commit/b0475aff3920d748fa74b5a6d8a7ad5dd731aec4)) +* **eslint-plugin:** [no-implied-eval] handle conditional expression ([#3125](https://github.com/typescript-eslint/typescript-eslint/issues/3125)) ([8c65d30](https://github.com/typescript-eslint/typescript-eslint/commit/8c65d30a225a3b99e80326961d0cb0c8189b039c)) +* **eslint-plugin:** [no-unused-vars] don't report nested module declaration ([#3119](https://github.com/typescript-eslint/typescript-eslint/issues/3119)) ([4ca5888](https://github.com/typescript-eslint/typescript-eslint/commit/4ca58886adf3fc0fe31c263559990c8a534205f9)) +* **eslint-plugin:** [prefer-function-type] apply existing comments to the fixed code ([#3094](https://github.com/typescript-eslint/typescript-eslint/issues/3094)) ([c32f803](https://github.com/typescript-eslint/typescript-eslint/commit/c32f803d4480acf5ffc88e308b4243e5185c4f48)) +* **eslint-plugin:** [unbound-method] allow `super` expressions in `this` assignments ([#3010](https://github.com/typescript-eslint/typescript-eslint/issues/3010)) ([c65a139](https://github.com/typescript-eslint/typescript-eslint/commit/c65a1391be15bbcf3ae293b1c53686703883d546)) + + +### Features + +* **eslint-plugin:** [member-delimiter-style] Add an option 'multilineDetection' to treat types and interfaces as single line if the last member ends on the same line as the closing bracket ([#2970](https://github.com/typescript-eslint/typescript-eslint/issues/2970)) ([cf86f42](https://github.com/typescript-eslint/typescript-eslint/commit/cf86f427186d58b0fce4bb3ff9571c4301babeb3)) +* **eslint-plugin:** [prom-func-async] report only function head ([#2872](https://github.com/typescript-eslint/typescript-eslint/issues/2872)) ([25f459c](https://github.com/typescript-eslint/typescript-eslint/commit/25f459cdc4f38d44b48554e04cfa1676538ccdfb)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index afea64deacba..3f20831ff502 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.15.2", + "version": "4.16.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -42,8 +42,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.15.2", - "@typescript-eslint/scope-manager": "4.15.2", + "@typescript-eslint/experimental-utils": "4.16.0", + "@typescript-eslint/scope-manager": "4.16.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "lodash": "^4.17.15", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 572aad8c758b..fea22449db8c 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 78b70d58ae43..41976a277c98 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.15.2", + "version": "4.16.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -40,9 +40,9 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.15.2", - "@typescript-eslint/types": "4.15.2", - "@typescript-eslint/typescript-estree": "4.15.2", + "@typescript-eslint/scope-manager": "4.16.0", + "@typescript-eslint/types": "4.16.0", + "@typescript-eslint/typescript-estree": "4.16.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 9de839c086a4..3fa560aa0872 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index d209f7a97e18..a8ef88ee9094 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.15.2", + "version": "4.16.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -44,14 +44,14 @@ "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "4.15.2", - "@typescript-eslint/types": "4.15.2", - "@typescript-eslint/typescript-estree": "4.15.2", + "@typescript-eslint/scope-manager": "4.16.0", + "@typescript-eslint/types": "4.16.0", + "@typescript-eslint/typescript-estree": "4.16.0", "debug": "^4.1.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.15.2", + "@typescript-eslint/experimental-utils": "4.16.0", "glob": "*", "typescript": "*" }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index d362197c9737..29bc89373496 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Bug Fixes + +* **scope-manager:** update libs for typescript 4.2 ([#3118](https://github.com/typescript-eslint/typescript-eslint/issues/3118)) ([0336c79](https://github.com/typescript-eslint/typescript-eslint/commit/0336c798c9502fc250d2eaa045661950da55e52f)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 77f168939548..6effd54dc75d 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.15.2", + "version": "4.16.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.15.2", - "@typescript-eslint/visitor-keys": "4.15.2" + "@typescript-eslint/types": "4.16.0", + "@typescript-eslint/visitor-keys": "4.16.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.15.2", + "@typescript-eslint/typescript-estree": "4.16.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index c5114358f80d..6ff8a81e1e58 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Features + +* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 8faf060c7cd6..9f6fdb3f8000 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.15.2", + "version": "4.16.0", "private": true } diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 42a5128ea057..10e999a3b5ca 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Features + +* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/packages/types/package.json b/packages/types/package.json index 1c3d35f79385..31a33f8e5475 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.15.2", + "version": "4.16.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index ead4936db41e..ba3a7474799b 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Features + +* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) +* **typescript-estree:** throw custom error instead of plain object ([#3011](https://github.com/typescript-eslint/typescript-eslint/issues/3011)) ([ae14bf5](https://github.com/typescript-eslint/typescript-eslint/commit/ae14bf55fe31b0eb982ba17333e4aac550d10342)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 69f2b3823967..fea793261173 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.15.2", + "version": "4.16.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -41,8 +41,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.15.2", - "@typescript-eslint/visitor-keys": "4.15.2", + "@typescript-eslint/types": "4.16.0", + "@typescript-eslint/visitor-keys": "4.16.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -59,7 +59,7 @@ "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "4.15.2", + "@typescript-eslint/shared-fixtures": "4.16.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index ed1ff385041d..ec2f981fba43 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) + + +### Features + +* TypeScript 4.2 syntax support ([#3112](https://github.com/typescript-eslint/typescript-eslint/issues/3112)) ([2ebfb21](https://github.com/typescript-eslint/typescript-eslint/commit/2ebfb21ba6c88c793cfbd0e231e5803b2381694c)) + + + + + ## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index e3a6c00d1a54..209b5db6a826 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.15.2", + "version": "4.16.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.15.2", + "@typescript-eslint/types": "4.16.0", "eslint-visitor-keys": "^2.0.0" }, "devDependencies": { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy