From b4cf0da0232eb7beea00150b5e9a51c11e2b24ab Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 19 Apr 2021 12:45:10 -0400 Subject: [PATCH 01/35] chore: enable `no-unsafe-call` locally (#3281) --- .eslintrc.js | 3 +- package.json | 3 +- .../eslint-plugin-tslint/src/custom-linter.ts | 7 ++-- .../src/eslint-utils/RuleTester.ts | 1 + packages/parser/tests/tools/test-utils.ts | 6 ++-- packages/typescript-estree/src/convert.ts | 2 +- .../tests/lib/convert.test.ts | 2 +- .../typescript-estree/tests/lib/parse.test.ts | 2 +- .../typescript-estree/tools/test-utils.ts | 6 ++-- .../utils/jest-snapshot-resolver.js | 1 - tools/generate-contributors.ts | 2 +- tsconfig.eslint.json | 3 ++ yarn.lock | 32 +++++++++++-------- 13 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bbaf3974244a..5d944cceacbe 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -64,7 +64,6 @@ module.exports = { // TODO - enable these new recommended rules '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/restrict-template-expressions': 'off', @@ -191,6 +190,8 @@ module.exports = { { files: ['tests/**/*.js'], rules: { + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/restrict-plus-operands': 'off', }, }, diff --git a/package.json b/package.json index 6e0dfa9fa28b..431c13ac5668 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "@types/lodash": "^4.14.149", "@types/marked": "^2.0.0", "@types/node": "^14.14.27", + "@types/node-fetch": "^2.5.10", "@types/prettier": "^2.2.1", "@types/rimraf": "^3.0.0", "@types/semver": "^7.3.4", @@ -99,13 +100,13 @@ "eslint-plugin-jest": "^24.1.3", "glob": "^7.1.6", "husky": "^5.0.9", - "isomorphic-fetch": "^3.0.0", "jest": "^26.6.3", "jest-specific-snapshot": "^4.0.0", "lerna": "^3.22.1", "lint-staged": "^10.2.13", "make-dir": "^3.1.0", "markdownlint-cli": "^0.27.1", + "node-fetch": "^2.6.1", "prettier": "^2.2.1", "rimraf": "^3.0.2", "ts-jest": "^26.5.1", diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts index eb8527b99d71..9fcaf9c2b3ed 100644 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ b/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -1,11 +1,8 @@ import { ILinterOptions, Linter, LintResult } from 'tslint'; import { Program, SourceFile } from 'typescript'; -// We need to access the program, but Linter has private program already -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const TSLintLinter = Linter as any; - -export class CustomLinter extends TSLintLinter { +// @ts-expect-error - We need to access the program, but Linter has private program already +export class CustomLinter extends Linter { constructor(options: ILinterOptions, private readonly program: Program) { super(options, program); } diff --git a/packages/experimental-utils/src/eslint-utils/RuleTester.ts b/packages/experimental-utils/src/eslint-utils/RuleTester.ts index 50c3794328be..a3210162e982 100644 --- a/packages/experimental-utils/src/eslint-utils/RuleTester.ts +++ b/packages/experimental-utils/src/eslint-utils/RuleTester.ts @@ -32,6 +32,7 @@ class RuleTester extends TSESLint.RuleTester { try { // instead of creating a hard dependency, just use a soft require // a bit weird, but if they're using this tooling, it'll be installed + // eslint-disable-next-line @typescript-eslint/no-unsafe-call require(parser).clearCaches(); } catch { // ignored diff --git a/packages/parser/tests/tools/test-utils.ts b/packages/parser/tests/tools/test-utils.ts index 0a14468fee0f..575ac1dc5b73 100644 --- a/packages/parser/tests/tools/test-utils.ts +++ b/packages/parser/tests/tools/test-utils.ts @@ -53,13 +53,13 @@ export function createSnapshotTestBlock( try { const result = parse(); expect(result).toMatchSnapshot(); - } catch (e) { + } catch (error) { /** * If we are deliberately throwing because of encountering an unknown * AST_NODE_TYPE, we rethrow to cause the test to fail */ - if (e.message.match('Unknown AST_NODE_TYPE')) { - throw new Error(e); + if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) { + throw new Error(error); } expect(parse).toThrowErrorMatchingSnapshot(); } diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 0c0b552e2d59..e0c34e513ec9 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1,5 +1,5 @@ // There's lots of funny stuff due to the typing of ts.Node -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call */ import * as ts from 'typescript'; import { canContainDirective, diff --git a/packages/typescript-estree/tests/lib/convert.test.ts b/packages/typescript-estree/tests/lib/convert.test.ts index 52bd377a5bfe..a95916138d76 100644 --- a/packages/typescript-estree/tests/lib/convert.test.ts +++ b/packages/typescript-estree/tests/lib/convert.test.ts @@ -1,5 +1,5 @@ // deeplyCopy is private internal -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call */ import { Converter } from '../../src/convert'; import * as ts from 'typescript'; diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index 33b393670d09..d9057c653b7b 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -506,7 +506,7 @@ describe('parseAndGenerateServices', () => { /** * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/` */ - error.message = error.message.replace(/\\(?!["])/gm, '/'); + error.message = (error as Error).message.replace(/\\(?!["])/gm, '/'); throw error; } }; diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index 1b386be14498..362560bc08cc 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -35,13 +35,13 @@ export function createSnapshotTestBlock( try { const result = parse(); expect(result).toMatchSnapshot(); - } catch (e) { + } catch (error) { /** * If we are deliberately throwing because of encountering an unknown * AST_NODE_TYPE, we rethrow to cause the test to fail */ - if (e.message.match('Unknown AST_NODE_TYPE')) { - throw new Error(e); + if (/Unknown AST_NODE_TYPE/.exec((error as Error).message)) { + throw new Error(error); } expect(parse).toThrowErrorMatchingSnapshot(); } diff --git a/tests/integration/utils/jest-snapshot-resolver.js b/tests/integration/utils/jest-snapshot-resolver.js index 366a96118398..3032ef5d575c 100644 --- a/tests/integration/utils/jest-snapshot-resolver.js +++ b/tests/integration/utils/jest-snapshot-resolver.js @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-function-return-type */ /** * Use a jest snapshotResolver to map the test snapshot output back to the * linked volume. This means that even though we are running our tests inside diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index cd5b63ea98fa..343263b88dee 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -3,7 +3,7 @@ // this endpoint returns a list of contributors sorted by number of contributions import * as fs from 'fs'; -import 'isomorphic-fetch'; +import fetch from 'node-fetch'; import * as path from 'path'; const IGNORED_USERS = new Set([ diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 40defd4b3b8d..0cfd463e6b2d 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,4 +1,7 @@ { + "compilerOptions": { + "types": ["@types/node"] + }, "extends": "./tsconfig.base.json", "include": ["tests/**/*.ts", "tools/**/*.ts", ".eslintrc.js"] } diff --git a/yarn.lock b/yarn.lock index d413ec26a3ed..ee93e366ff83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1932,6 +1932,14 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= +"@types/node-fetch@^2.5.10": + version "2.5.10" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.10.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132" + integrity sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.27": version "14.14.37" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e" @@ -2861,7 +2869,7 @@ columnify@^1.5.4: strip-ansi "^3.0.0" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -4179,6 +4187,15 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -5169,14 +5186,6 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-fetch@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" - integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== - dependencies: - node-fetch "^2.6.1" - whatwg-fetch "^3.4.1" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -8898,11 +8907,6 @@ whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@^3.4.1: - version "3.5.0" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.5.0.tgz#605a2cd0a7146e5db141e29d1c62ab84c0c4c868" - integrity sha512-jXkLtsR42xhXg7akoDKvKWE40eJeI+2KZqcp2h3NsOrRnDvtWX36KcKl30dy+hxECivdk2BVUHVNrPtoMBUx6A== - whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" From f661d187b6d9c442db533ba79afd9f515aa6f582 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:24:31 -0700 Subject: [PATCH 02/35] chore: bump @types/node from 14.14.37 to 14.14.41 (#3297) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.37 to 14.14.41. - [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 ee93e366ff83..3b15240298f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,9 +1941,9 @@ form-data "^3.0.0" "@types/node@*", "@types/node@>= 8", "@types/node@^14.14.27": - version "14.14.37" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e" - integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw== + version "14.14.41" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" + integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== "@types/normalize-package-data@^2.4.0": version "2.4.0" From 9dde6a88001991d0ce8c1b95cf9127b776170db6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:24:40 -0700 Subject: [PATCH 03/35] chore: bump @types/marked from 2.0.1 to 2.0.2 (#3298) Bumps [@types/marked](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/marked) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/marked) 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 3b15240298f2..780869ce3f38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1918,9 +1918,9 @@ integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q== "@types/marked@*", "@types/marked@^2.0.0": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.1.tgz#bbb6d1b570a54652a31953c77972f65b6f9235a4" - integrity sha512-/CFe3HvXMkh7YkJS0DGRsC0hgwWZDZbSCmY/X00bSCnZ4ukS2Glk9veIkRoPu2ElMbKpjxseXn1y9MkTwGHVjw== + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.2.tgz#33a15106383f6e42cd6bdd38093e6b19904e29e1" + integrity sha512-P4zanhCQKs4tiWPPBGpB7lHflgFCP9DFGNI5YtpW9MALKoy2qs9rHNWJ+z55cegD9uCfnmsKuaosq9FNvbxrOw== "@types/minimatch@*": version "3.0.3" From f150fa7c645c6ab875caf71ad2a6d8d485b24783 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:24:51 -0700 Subject: [PATCH 04/35] chore: bump eslint-plugin-eslint-plugin from 3.0.0 to 3.0.2 (#3299) Bumps [eslint-plugin-eslint-plugin](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin) from 3.0.0 to 3.0.2. - [Release notes](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/releases) - [Changelog](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/CHANGELOG.md) - [Commits](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 780869ce3f38..797b5e2697ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3730,9 +3730,11 @@ eslint-plugin-eslint-comments@^3.2.0: ignore "^5.0.5" eslint-plugin-eslint-plugin@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.0.tgz#7aac3250ae5e8ee7915fcbb305b4033897588dd5" - integrity sha512-KGBjaO3BErr47Swsf3gBWNOyJFYCCjpzfiZUWdqX6XSI+IFRpnDZy44GxjhxmOuThEi3eRh9HzkW7NLNw4SM1Q== + version "3.0.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.2.tgz#8ce72a1e06bad8c4e6ddc1c932e236b8184c1bce" + integrity sha512-pTJhDCiuwa/NgwjsKrlCnF2ExULcG0xK87HdckFpVbaKb2GOd2UUL4L/HtjUV1N3jlrOdtyTfdX1J+oCD01j4Q== + dependencies: + eslint-utils "^2.1.0" eslint-plugin-import@^2.22.0: version "2.22.1" From 348711cc225758ab6138e5a45f999c584ad99327 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:25:02 -0700 Subject: [PATCH 05/35] chore: bump ts-jest from 26.5.4 to 26.5.5 (#3300) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.4 to 26.5.5. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v26.5.4...v26.5.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 797b5e2697ac..6a9f72346b6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8538,9 +8538,9 @@ trim-off-newlines@^1.0.0: integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= ts-jest@^26.5.1: - version "26.5.4" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.4.tgz#207f4c114812a9c6d5746dd4d1cdf899eafc9686" - integrity sha512-I5Qsddo+VTm94SukBJ4cPimOoFZsYTeElR2xy6H2TOVs+NsvgYglW8KuQgKoApOKuaU/Ix/vrF9ebFZlb5D2Pg== + version "26.5.5" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.5.tgz#e40481b6ee4dd162626ba481a2be05fa57160ea5" + integrity sha512-7tP4m+silwt1NHqzNRAPjW1BswnAhopTdc2K3HEkRZjF0ZG2F/e/ypVH0xiZIMfItFtD3CX0XFbwPzp9fIEUVg== dependencies: bs-logger "0.x" buffer-from "1.x" From 1c1b572c3000d72cfe665b7afbada0ec415e7855 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:25:59 -0700 Subject: [PATCH 06/35] chore: bump ssri from 6.0.1 to 6.0.2 (#3302) Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/npm/ssri/releases) - [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md) - [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2) 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 6a9f72346b6a..6d63f30fdd4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8072,9 +8072,9 @@ sshpk@^1.7.0: tweetnacl "~0.14.0" ssri@^6.0.0, ssri@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" - integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== + version "6.0.2" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5" + integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q== dependencies: figgy-pudding "^3.5.1" From 2523f9974fbfa6e833b4e959ed3306250910b0bf Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 4 May 2021 13:42:40 +0400 Subject: [PATCH 07/35] chore: iterating on contributors generation --- .github/workflows/generate-contributors.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/generate-contributors.yml b/.github/workflows/generate-contributors.yml index 3acc1a98429f..a74dee4ccda9 100644 --- a/.github/workflows/generate-contributors.yml +++ b/.github/workflows/generate-contributors.yml @@ -1,8 +1,7 @@ name: "Generate contributors" on: - schedule: - - cron: "0 0 1 * *" + workflow_dispatch: env: PRIMARY_NODE_VERSION: 12 @@ -37,13 +36,10 @@ jobs: - name: Generate contributors run: yarn generate:contributors - - name: Commit files - run: | - git config --local user.email "actions@github.com" - git config --local user.name "Github Actions" - git commit -am "chore: update contributors [bot]" - - - name: Push changes - uses: ad-m/github-push-action@master + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: update contributors" + title: "chore: update contributors" + branch: auto-update-contributors From 5217c249a872ad5f9384cfc6fac2a15fa17046ca Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 4 May 2021 13:56:10 +0400 Subject: [PATCH 08/35] chore: iterating on contributors generation --- .github/workflows/generate-contributors.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-contributors.yml b/.github/workflows/generate-contributors.yml index a74dee4ccda9..fed052364bc0 100644 --- a/.github/workflows/generate-contributors.yml +++ b/.github/workflows/generate-contributors.yml @@ -21,7 +21,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v1 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -39,7 +39,11 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} + # The standard GITHUB_TOKEN cannot be used as it will not trigger status checks on + # the PR that gets created (this behavior is not specific to this action). + # https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs + token: ${{ secrets.JAMES_HENRY_GH_TOKEN }} commit-message: "chore: update contributors" title: "chore: update contributors" + body: "" branch: auto-update-contributors From 5706e0e53070589c0bb0d53ff2ecb0ded076b704 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 4 May 2021 10:06:26 +0000 Subject: [PATCH 09/35] chore: publish v4.22.1 --- CHANGELOG.md | 8 ++++++++ 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 | 8 ++++++++ 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 | 8 ++++++++ packages/scope-manager/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/types/CHANGELOG.md | 8 ++++++++ packages/types/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 8 ++++++++ packages/typescript-estree/package.json | 8 ++++---- packages/visitor-keys/CHANGELOG.md | 8 ++++++++ packages/visitor-keys/package.json | 4 ++-- 22 files changed, 118 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0dd29fa0e6f..0a1c7c9bdf60 100644 --- a/CHANGELOG.md +++ b/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) diff --git a/lerna.json b/lerna.json index 8726f2b8e5a6..559d00dca269 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.22.0", + "version": "4.22.1", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index b620c1012e17..0d3715d66a7c 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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **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 70155100dd14..f0c64a185df3 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.22.0", + "version": "4.22.1", "private": true, "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.22.0", + "@typescript-eslint/experimental-utils": "4.22.1", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index d9ee27415ed1..d24f79ee7598 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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **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 824b80eac1f3..fcd692ca596e 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.22.0", + "version": "4.22.1", "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.22.0", + "@typescript-eslint/experimental-utils": "4.22.1", "lodash": "^4.17.15" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.22.0" + "@typescript-eslint/parser": "4.22.1" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 8e9fdc4aa5be..fb6b1f65dd07 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index fc36b9aeba66..38db92807b9e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.22.0", + "version": "4.22.1", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -44,8 +44,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.22.0", - "@typescript-eslint/scope-manager": "4.22.0", + "@typescript-eslint/experimental-utils": "4.22.1", + "@typescript-eslint/scope-manager": "4.22.1", "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 1664bc9b1e37..063cc2fbe70f 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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **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 39f3e8c44d0e..b3402e64bde0 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.22.0", + "version": "4.22.1", "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.22.0", - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/typescript-estree": "4.22.0", + "@typescript-eslint/scope-manager": "4.22.1", + "@typescript-eslint/types": "4.22.1", + "@typescript-eslint/typescript-estree": "4.22.1", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 885f266ea661..9cf4c93a41da 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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 5854968fc80d..7aaac815772d 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.22.0", + "version": "4.22.1", "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.22.0", - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/typescript-estree": "4.22.0", + "@typescript-eslint/scope-manager": "4.22.1", + "@typescript-eslint/types": "4.22.1", + "@typescript-eslint/typescript-estree": "4.22.1", "debug": "^4.1.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.22.0", + "@typescript-eslint/experimental-utils": "4.22.1", "glob": "*", "typescript": "*" }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 408236317625..6e810ce89e75 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **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 f68939babb44..51f58e98474b 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.22.0", + "version": "4.22.1", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.22.0", - "@typescript-eslint/visitor-keys": "4.22.0" + "@typescript-eslint/types": "4.22.1", + "@typescript-eslint/visitor-keys": "4.22.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.22.0", + "@typescript-eslint/typescript-estree": "4.22.1", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 69290639ef60..da5b4caeb197 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index f9a9fd59ff88..3c06d355b8fa 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.22.0", + "version": "4.22.1", "private": true } diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 966bdae0d4aa..f62ac84b89d4 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/types diff --git a/packages/types/package.json b/packages/types/package.json index 2f05c0465caa..5251c580de59 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.22.0", + "version": "4.22.1", "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 9dbff83d990b..e6363f7ae2da 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 262e429792b3..4f65000f6bc6 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.22.0", + "version": "4.22.1", "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.22.0", - "@typescript-eslint/visitor-keys": "4.22.0", + "@typescript-eslint/types": "4.22.1", + "@typescript-eslint/visitor-keys": "4.22.1", "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.22.0", + "@typescript-eslint/shared-fixtures": "4.22.1", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 58dc35bbf918..29bc084e5c5d 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/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.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + # [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index ef343471c3db..594ca4ce55b1 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.22.0", + "version": "4.22.1", "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.22.0", + "@typescript-eslint/types": "4.22.1", "eslint-visitor-keys": "^2.0.0" }, "devDependencies": { From f09343a5892e38f671fe03f2623fb527dc5d284c Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 4 May 2021 14:14:11 +0400 Subject: [PATCH 10/35] chore: update contributors (#3343) --- .all-contributorsrc | 53 +++++++++++++++++++++++++++++++-------------- CONTRIBUTORS.md | 28 ++++++++++++++---------- 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3223dd887fc0..9302be7a782e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -58,6 +58,13 @@ "profile": "https://github.com/G-Rath", "contributions": [] }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4", + "profile": "https://github.com/JoshuaKGoldberg", + "contributions": [] + }, { "login": "nzakas", "name": "Nicholas C. Zakas", @@ -73,10 +80,10 @@ "contributions": [] }, { - "login": "JoshuaKGoldberg", - "name": "Josh Goldberg", - "avatar_url": "https://avatars.githubusercontent.com/u/3335181?v=4", - "profile": "https://github.com/JoshuaKGoldberg", + "login": "yeonjuan", + "name": "YeonJuan", + "avatar_url": "https://avatars.githubusercontent.com/u/41323220?v=4", + "profile": "https://github.com/yeonjuan", "contributions": [] }, { @@ -87,10 +94,10 @@ "contributions": [] }, { - "login": "yeonjuan", - "name": "YeonJuan", - "avatar_url": "https://avatars.githubusercontent.com/u/41323220?v=4", - "profile": "https://github.com/yeonjuan", + "login": "phaux", + "name": "Nikita Stefaniak", + "avatar_url": "https://avatars.githubusercontent.com/u/1270987?v=4", + "profile": "https://github.com/phaux", "contributions": [] }, { @@ -135,13 +142,6 @@ "profile": "https://github.com/mysticatea", "contributions": [] }, - { - "login": "phaux", - "name": "Nikita Stefaniak", - "avatar_url": "https://avatars.githubusercontent.com/u/1270987?v=4", - "profile": "https://github.com/phaux", - "contributions": [] - }, { "login": "azz", "name": "Lucas Azzola", @@ -170,6 +170,13 @@ "profile": "https://github.com/macklinu", "contributions": [] }, + { + "login": "JounQin", + "name": "JounQin", + "avatar_url": "https://avatars.githubusercontent.com/u/8336744?v=4", + "profile": "https://github.com/JounQin", + "contributions": [] + }, { "login": "lukyth", "name": "Kanitkorn Sujautra", @@ -207,7 +214,7 @@ }, { "login": "ldrick", - "name": "Ricky Lippmann", + "name": "ldrick", "avatar_url": "https://avatars.githubusercontent.com/u/3674067?v=4", "profile": "https://github.com/ldrick", "contributions": [] @@ -352,6 +359,20 @@ "profile": "https://github.com/timkraut", "contributions": [] }, + { + "login": "magurotuna", + "name": "Yusuke Tanaka", + "avatar_url": "https://avatars.githubusercontent.com/u/23649474?v=4", + "profile": "https://github.com/magurotuna", + "contributions": [] + }, + { + "login": "Zzzen", + "name": "Zzzen", + "avatar_url": "https://avatars.githubusercontent.com/u/6630042?v=4", + "profile": "https://github.com/Zzzen", + "contributions": [] + }, { "login": "koooge", "name": "koooge", diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5616c037282c..0a2e0963cfcc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,75 +16,81 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri
Patricio Trevino


Gareth Jones

+
Josh Goldberg


Nicholas C. Zakas


Jed Fox

-
Josh Goldberg

-
Ben Lichtman


YeonJuan

+
Ben Lichtman

+
Nikita Stefaniak


Scott O'Hara


Retsam

-
Sosuke Suzuki

+
Sosuke Suzuki


Kai Cataldo


Rasmus Eneman


Toru Nagashima

-
Nikita Stefaniak


Lucas Azzola


Danny Fritz


Ika


mackie

+
JounQin


Kanitkorn Sujautra

-
cherryblossom000

+
cherryblossom000


Simen Bekkhus


Anix


Pete Gonzalez

-
Ricky Lippmann

-
Susisu

+
ldrick

+
Susisu


G r e y


Gavin Barron


Kevin Partington


Lucas Duailibe

-
Validark

+
Validark


Pavel Birukov


Shahar Dawn Or


ulrichb


Daniil Dubrava

-
Daniel Nixon

+
Daniel Nixon


Denys Kniazevych


Dimitri Mitropoulos


Ian MacLeod


Jonathan Delgado

-
Philipp A.

+
Philipp A.


Pig Fang


Tadhg McDonald-Jensen


Thomas den Hollander


Tim Kraut

-
koooge

+
Yusuke Tanaka

+
Zzzen

+
koooge


thomas michael wallace


Bence Dányi

+ +
Soobin Bak

+ This list is auto-generated using `yarn generate-contributors`. It shows the top 100 contributors with > 3 contributions. From 0e5cd96b3d15af25d0a36f5efdc26443a0ada285 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 4 May 2021 14:15:11 +0400 Subject: [PATCH 11/35] chore: automate monthly contributors generation --- .github/workflows/generate-contributors.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-contributors.yml b/.github/workflows/generate-contributors.yml index fed052364bc0..e658217d294f 100644 --- a/.github/workflows/generate-contributors.yml +++ b/.github/workflows/generate-contributors.yml @@ -1,7 +1,8 @@ name: "Generate contributors" on: - workflow_dispatch: + schedule: + - cron: "0 0 1 * *" env: PRIMARY_NODE_VERSION: 12 From 209f6d0c85a86ea97f227a05596d655098fe6401 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 5 May 2021 00:57:30 +0400 Subject: [PATCH 12/35] chore: use actions/cache@v2 in all workflows (#3346) --- .github/workflows/ci.yml | 12 ++-- .github/workflows/generate-contributors.yml | 2 +- .github/workflows/manual-release.yml | 65 --------------------- 3 files changed, 7 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/manual-release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cae9596da6e..9e1a349e5aa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -74,7 +74,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -160,7 +160,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -203,7 +203,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -242,7 +242,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -324,7 +324,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} diff --git a/.github/workflows/generate-contributors.yml b/.github/workflows/generate-contributors.yml index e658217d294f..c45a78430669 100644 --- a/.github/workflows/generate-contributors.yml +++ b/.github/workflows/generate-contributors.yml @@ -22,7 +22,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v1 + - uses: actions/cache@v2 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml deleted file mode 100644 index 327d5947236a..000000000000 --- a/.github/workflows/manual-release.yml +++ /dev/null @@ -1,65 +0,0 @@ -# This workflow is used on the rare occassion we need to manually cut a release. -# It can be triggered via the Github UI or the Github API. - -name: Manual publish to Github Releases and NPM - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Check out as an admin to allow for pushing back to master - token: ${{ secrets.JAMES_HENRY_GH_TOKEN }} - # Check out the branch that was specified as part of the trigger - ref: ${{ github.ref }} - # We need to fetch all tags and branches - fetch-depth: 0 - - - name: Verify head of master hasn't changed - run: | - # We ensure that the latest commit on master is still the one we expected when - # we started the release job, otherwise we exit - if [ "$GITHUB_SHA" != "$(git rev-parse --verify HEAD)" ]; then - echo "ERROR: The commit SHA at the HEAD of master has changed" - echo "Expected: $GITHUB_SHA" - echo "Actual: $(git rev-parse --verify HEAD)" - exit 1; - fi - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check:clean-workspace-after-install - - - name: Run build - run: | - yarn build - - - name: Determine what version to release and publish to Github (--yes skips the confirmation prompt) - run: | - # Required for github release to work - git config user.name 'James Henry' - git config user.email 'james@henry.sc' - - GH_TOKEN=${{ secrets.JAMES_HENRY_GH_TOKEN }} npx lerna version --loglevel=silly --yes --conventional-commits --exact --force-publish --github-release -m "chore: publish %s" - - - name: Publish the updated versions to NPM (--yes skips the confirmation prompt) - run: npx lerna publish from-package --yes - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 25ea953cc60b118bd385c71e0a9b61c286c26fcf Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 4 May 2021 16:15:37 -0700 Subject: [PATCH 13/35] feat: refactor to split AST specification out as its own module (#2911) --- .eslintignore | 3 + .eslintrc.js | 23 + .gitignore | 4 + .vscode/settings.json | 4 +- package.json | 3 +- packages/ast-spec/LICENSE | 21 + packages/ast-spec/README.md | 24 + packages/ast-spec/api-extractor.json | 31 + packages/ast-spec/jest.config.js | 20 + packages/ast-spec/package.json | 46 + .../{types => ast-spec}/src/ast-node-types.ts | 22 +- .../src/ast-token-types.ts | 4 +- packages/ast-spec/src/base/Accessibility.ts | 1 + packages/ast-spec/src/base/BaseNode.ts | 22 + packages/ast-spec/src/base/BaseToken.ts | 8 + .../ast-spec/src/base/BinaryExpressionBase.ts | 8 + .../ast-spec/src/base/ClassDeclarationBase.ts | 20 + .../ast-spec/src/base/ClassPropertyBase.ts | 34 + .../src/base/FunctionDeclarationBase.ts | 18 + .../ast-spec/src/base/LineAndColumnData.ts | 10 + packages/ast-spec/src/base/LiteralBase.ts | 6 + .../ast-spec/src/base/MethodDefinitionBase.ts | 35 + .../ast-spec/src/base/OptionalRangeAndLoc.ts | 11 + packages/ast-spec/src/base/Range.ts | 6 + packages/ast-spec/src/base/SourceLocation.ts | 12 + .../src/base/TSFunctionSignatureBase.ts | 10 + packages/ast-spec/src/base/TSHeritageBase.ts | 8 + .../ast-spec/src/base/UnaryExpressionBase.ts | 10 + .../src/declaration/ClassDeclaration/spec.ts | 6 + .../declaration/ExportAllDeclaration/spec.ts | 11 + .../ExportDefaultDeclaration/spec.ts | 10 + .../ExportNamedDeclaration/spec.ts | 13 + .../declaration/FunctionDeclaration/spec.ts | 8 + .../src/declaration/TSDeclareFunction/spec.ts | 6 + .../src/declaration/TSEnumDeclaration/spec.ts | 14 + .../TSImportEqualsDeclaration/spec.ts | 13 + .../TSInterfaceDeclaration/spec.ts | 17 + .../declaration/TSModuleDeclaration/spec.ts | 26 + .../TSNamespaceExportDeclaration/spec.ts | 8 + .../TSTypeAliasDeclaration/spec.ts | 13 + .../declaration/VariableDeclaration/spec.ts | 11 + packages/ast-spec/src/declaration/spec.ts | 13 + .../src/element/ClassProperty/spec.ts | 19 + .../src/element/MethodDefinition/spec.ts | 19 + .../ast-spec/src/element/Property/spec.ts | 37 + .../src/element/SpreadElement/spec.ts | 8 + .../element/TSAbstractClassProperty/spec.ts | 19 + .../TSAbstractMethodDefinition/spec.ts | 19 + .../TSCallSignatureDeclaration/spec.ts | 6 + .../TSConstructSignatureDeclaration/spec.ts | 7 + .../ast-spec/src/element/TSEnumMember/spec.ts | 41 + .../src/element/TSIndexSignature/spec.ts | 15 + .../src/element/TSMethodSignature/spec.ts | 39 + .../src/element/TSPropertySignature/spec.ts | 39 + packages/ast-spec/src/element/spec.ts | 12 + .../src/expression/ArrayExpression/spec.ts | 8 + .../ArrowFunctionExpression/spec.ts | 19 + .../expression/AssignmentExpression/spec.ts | 23 + .../src/expression/AwaitExpression/spec.ts | 16 + .../src/expression/BinaryExpression/spec.ts | 6 + .../src/expression/CallExpression/spec.ts | 13 + .../src/expression/ChainExpression/spec.ts | 8 + .../src/expression/ClassExpression/spec.ts | 6 + .../expression/ConditionalExpression/spec.ts | 10 + .../src/expression/FunctionExpression/spec.ts | 8 + .../src/expression/Identifier/spec.ts | 12 + .../src/expression/ImportExpression/spec.ts | 8 + .../src/expression/JSXElement/spec.ts | 12 + .../src/expression/JSXFragment/spec.ts | 12 + .../src/expression/LogicalExpression/spec.ts | 6 + .../src/expression/MemberExpression/spec.ts | 28 + .../src/expression/MetaProperty/spec.ts | 9 + .../src/expression/NewExpression/spec.ts | 12 + .../src/expression/ObjectExpression/spec.ts | 8 + .../src/expression/SequenceExpression/spec.ts | 8 + .../ast-spec/src/expression/Super/spec.ts | 6 + .../src/expression/TSAsExpression/spec.ts | 10 + .../TSEmptyBodyFunctionExpression/spec.ts | 7 + .../expression/TSNonNullExpression/spec.ts | 8 + .../src/expression/TSTypeAssertion/spec.ts | 10 + .../TaggedTemplateExpression/spec.ts | 12 + .../src/expression/TemplateLiteral/spec.ts | 10 + .../src/expression/ThisExpression/spec.ts | 6 + .../src/expression/UnaryExpression/spec.ts | 7 + .../src/expression/UpdateExpression/spec.ts | 7 + .../src/expression/YieldExpression/spec.ts | 9 + .../expression/literal/BigIntLiteral/spec.ts | 8 + .../expression/literal/BooleanLiteral/spec.ts | 8 + .../expression/literal/NullLiteral/spec.ts | 8 + .../expression/literal/NumberLiteral/spec.ts | 7 + .../expression/literal/RegExpLiteral/spec.ts | 11 + .../expression/literal/StringLiteral/spec.ts | 7 + .../ast-spec/src/expression/literal/spec.ts | 6 + packages/ast-spec/src/expression/spec.ts | 33 + packages/ast-spec/src/index.ts | 52 + .../ast-spec/src/jsx/JSXAttribute/spec.ts | 12 + .../src/jsx/JSXClosingElement/spec.ts | 8 + .../src/jsx/JSXClosingFragment/spec.ts | 6 + .../src/jsx/JSXEmptyExpression/spec.ts | 6 + .../src/jsx/JSXExpressionContainer/spec.ts | 9 + .../ast-spec/src/jsx/JSXIdentifier/spec.ts | 7 + .../src/jsx/JSXMemberExpression/spec.ts | 10 + .../src/jsx/JSXNamespacedName/spec.ts | 9 + .../src/jsx/JSXOpeningElement/spec.ts | 14 + .../src/jsx/JSXOpeningFragment/spec.ts | 6 + .../src/jsx/JSXSpreadAttribute/spec.ts | 8 + .../ast-spec/src/jsx/JSXSpreadChild/spec.ts | 9 + packages/ast-spec/src/jsx/JSXText/spec.ts | 8 + packages/ast-spec/src/jsx/spec.ts | 13 + .../src/parameter/ArrayPattern/spec.ts | 13 + .../src/parameter/AssignmentPattern/spec.ts | 15 + .../src/parameter/ObjectPattern/spec.ts | 14 + .../src/parameter/RestElement/spec.ts | 15 + .../src/parameter/TSParameterProperty/spec.ts | 17 + packages/ast-spec/src/parameter/spec.ts | 5 + .../ast-spec/src/special/CatchClause/spec.ts | 10 + .../ast-spec/src/special/ClassBody/spec.ts | 8 + .../ast-spec/src/special/Decorator/spec.ts | 8 + .../src/special/EmptyStatement/spec.ts | 6 + .../src/special/ExportSpecifier/spec.ts | 9 + .../special/ImportDefaultSpecifier/spec.ts | 8 + .../special/ImportNamespaceSpecifier/spec.ts | 8 + .../src/special/ImportSpecifier/spec.ts | 9 + packages/ast-spec/src/special/Program/spec.ts | 13 + .../ast-spec/src/special/SwitchCase/spec.ts | 10 + .../src/special/TSClassImplements/spec.ts | 6 + .../special/TSExternalModuleReference/spec.ts | 8 + .../src/special/TSInterfaceBody/spec.ts | 8 + .../src/special/TSInterfaceHeritage/spec.ts | 6 + .../src/special/TSModuleBlock/spec.ts | 8 + .../src/special/TSTypeAnnotation/spec.ts | 8 + .../src/special/TSTypeParameter/spec.ts | 11 + .../TSTypeParameterDeclaration/spec.ts | 8 + .../TSTypeParameterInstantiation/spec.ts | 8 + .../src/special/TemplateElement/spec.ts | 11 + .../src/special/VariableDeclarator/spec.ts | 11 + packages/ast-spec/src/special/spec.ts | 21 + .../src/statement/BlockStatement/spec.ts | 8 + .../src/statement/BreakStatement/spec.ts | 8 + .../src/statement/ContinueStatement/spec.ts | 8 + .../src/statement/DebuggerStatement/spec.ts | 6 + .../src/statement/DoWhileStatement/spec.ts | 10 + .../src/statement/ExpressionStatement/spec.ts | 9 + .../src/statement/ForInStatement/spec.ts | 12 + .../src/statement/ForOfStatement/spec.ts | 13 + .../src/statement/ForStatement/spec.ts | 13 + .../src/statement/IfStatement/spec.ts | 11 + .../src/statement/ImportDeclaration/spec.ts | 11 + .../src/statement/LabeledStatement/spec.ts | 10 + .../src/statement/ReturnStatement/spec.ts | 8 + .../src/statement/SwitchStatement/spec.ts | 10 + .../src/statement/TSExportAssignment/spec.ts | 8 + .../src/statement/ThrowStatement/spec.ts | 9 + .../src/statement/TryStatement/spec.ts | 11 + .../src/statement/WhileStatement/spec.ts | 10 + .../src/statement/WithStatement/spec.ts | 10 + packages/ast-spec/src/statement/spec.ts | 19 + .../ast-spec/src/token/BlockComment/spec.ts | 6 + .../ast-spec/src/token/BooleanToken/spec.ts | 6 + .../src/token/IdentifierToken/spec.ts | 6 + .../src/token/JSXIdentifierToken/spec.ts | 6 + .../ast-spec/src/token/JSXTextToken/spec.ts | 6 + .../ast-spec/src/token/KeywordToken/spec.ts | 6 + .../ast-spec/src/token/LineComment/spec.ts | 6 + packages/ast-spec/src/token/NullToken/spec.ts | 6 + .../ast-spec/src/token/NumericToken/spec.ts | 6 + .../src/token/PunctuatorToken/spec.ts | 6 + .../src/token/RegularExpressionToken/spec.ts | 10 + .../ast-spec/src/token/StringToken/spec.ts | 6 + .../src/token/TSAbstractKeyword/spec.ts | 6 + .../ast-spec/src/token/TSAsyncKeyword/spec.ts | 6 + .../src/token/TSDeclareKeyword/spec.ts | 6 + .../src/token/TSExportKeyword/spec.ts | 6 + .../src/token/TSPrivateKeyword/spec.ts | 6 + .../src/token/TSProtectedKeyword/spec.ts | 6 + .../src/token/TSPublicKeyword/spec.ts | 6 + .../src/token/TSReadonlyKeyword/spec.ts | 6 + .../src/token/TSStaticKeyword/spec.ts | 6 + .../ast-spec/src/token/TemplateToken/spec.ts | 6 + packages/ast-spec/src/token/spec.ts | 22 + .../ast-spec/src/type/TSAnyKeyword/spec.ts | 6 + .../ast-spec/src/type/TSArrayType/spec.ts | 8 + .../ast-spec/src/type/TSBigIntKeyword/spec.ts | 6 + .../src/type/TSBooleanKeyword/spec.ts | 6 + .../src/type/TSConditionalType/spec.ts | 11 + .../src/type/TSConstructorType/spec.ts | 7 + .../ast-spec/src/type/TSFunctionType/spec.ts | 6 + .../ast-spec/src/type/TSImportType/spec.ts | 13 + .../src/type/TSIndexedAccessType/spec.ts | 9 + .../ast-spec/src/type/TSInferType/spec.ts | 8 + .../src/type/TSIntersectionType/spec.ts | 8 + .../ast-spec/src/type/TSIntrinsicType/spec.ts | 6 + .../ast-spec/src/type/TSLiteralType/spec.ts | 10 + .../ast-spec/src/type/TSMappedType/spec.ts | 13 + .../src/type/TSNamedTupleMember/spec.ts | 11 + .../ast-spec/src/type/TSNeverKeyword/spec.ts | 6 + .../ast-spec/src/type/TSNullKeyword/spec.ts | 6 + .../ast-spec/src/type/TSNumberKeyword/spec.ts | 6 + .../ast-spec/src/type/TSObjectKeyword/spec.ts | 6 + .../ast-spec/src/type/TSOptionalType/spec.ts | 8 + .../src/type/TSParenthesizedType/spec.ts | 8 + .../ast-spec/src/type/TSQualifiedName/spec.ts | 10 + packages/ast-spec/src/type/TSRestType/spec.ts | 8 + .../ast-spec/src/type/TSStringKeyword/spec.ts | 6 + .../ast-spec/src/type/TSSymbolKeyword/spec.ts | 6 + .../src/type/TSTemplateLiteralType/spec.ts | 10 + packages/ast-spec/src/type/TSThisType/spec.ts | 6 + .../ast-spec/src/type/TSTupleType/spec.ts | 8 + .../ast-spec/src/type/TSTypeLiteral/spec.ts | 8 + .../ast-spec/src/type/TSTypeOperator/spec.ts | 9 + .../ast-spec/src/type/TSTypePredicate/spec.ts | 12 + .../ast-spec/src/type/TSTypeQuery/spec.ts | 8 + .../ast-spec/src/type/TSTypeReference/spec.ts | 10 + .../src/type/TSUndefinedKeyword/spec.ts | 6 + .../ast-spec/src/type/TSUnionType/spec.ts | 8 + .../src/type/TSUnknownKeyword/spec.ts | 6 + .../ast-spec/src/type/TSVoidKeyword/spec.ts | 6 + packages/ast-spec/src/type/spec.ts | 36 + packages/ast-spec/src/unions/BindingName.ts | 4 + .../ast-spec/src/unions/BindingPattern.ts | 4 + .../src/unions/CallExpressionArgument.ts | 4 + packages/ast-spec/src/unions/ChainElement.ts | 8 + packages/ast-spec/src/unions/ClassElement.ts | 12 + packages/ast-spec/src/unions/Comment.ts | 4 + .../src/unions/DeclarationStatement.ts | 29 + .../src/unions/DestructuringPattern.ts | 14 + packages/ast-spec/src/unions/EntityName.ts | 4 + .../ast-spec/src/unions/ExportDeclaration.ts | 20 + packages/ast-spec/src/unions/Expression.ts | 78 + .../ast-spec/src/unions/ForInitialiser.ts | 4 + packages/ast-spec/src/unions/FunctionLike.ts | 12 + packages/ast-spec/src/unions/ImportClause.ts | 8 + .../ast-spec/src/unions/IterationStatement.ts | 12 + packages/ast-spec/src/unions/JSXChild.ts | 6 + packages/ast-spec/src/unions/JSXExpression.ts | 8 + .../src/unions/JSXTagNameExpression.ts | 8 + .../src/unions/LeftHandSideExpression.ts | 44 + packages/ast-spec/src/unions/Literal.ts | 14 + .../ast-spec/src/unions/LiteralExpression.ts | 4 + packages/ast-spec/src/unions/Modifier.ts | 16 + packages/ast-spec/src/unions/Node.ts | 329 +++ .../src/unions/ObjectLiteralElement.ts | 8 + packages/ast-spec/src/unions/Parameter.ts | 14 + .../ast-spec/src/unions/PrimaryExpression.ts | 35 + packages/ast-spec/src/unions/PropertyName.ts | 11 + packages/ast-spec/src/unions/Statement.ts | 78 + .../ast-spec/src/unions/TSUnaryExpression.ts | 13 + packages/ast-spec/src/unions/Token.ts | 26 + packages/ast-spec/src/unions/TypeElement.ts | 12 + packages/ast-spec/src/unions/TypeNode.ts | 74 + .../ast-spec/tests/ast-node-types.test.ts | 16 + packages/ast-spec/tsconfig.build.json | 10 + packages/ast-spec/tsconfig.json | 8 + packages/eslint-plugin-internal/package.json | 2 +- .../src/rules/plugin-test-formatting.ts | 4 +- packages/eslint-plugin-tslint/package.json | 2 +- packages/eslint-plugin/package.json | 2 +- .../src/rules/no-loss-of-precision.ts | 2 +- .../src/rules/no-unnecessary-condition.ts | 2 +- .../src/rules/prefer-regexp-exec.ts | 4 +- .../sort-type-union-intersection-members.ts | 1 - packages/experimental-utils/package.json | 2 +- packages/parser/package.json | 2 +- packages/scope-manager/package.json | 2 +- packages/scope-manager/src/scope/ScopeBase.ts | 24 +- packages/types/package.json | 5 +- packages/types/src/index.ts | 6 +- packages/types/src/ts-estree.ts | 1780 +---------------- packages/types/tools/copy-ast-spec.ts | 59 + packages/types/tsconfig.build.json | 3 +- packages/types/tsconfig.json | 3 +- packages/typescript-estree/package.json | 2 +- packages/typescript-estree/src/convert.ts | 4 +- packages/visitor-keys/package.json | 2 +- tests/integration/docker-compose.yml | 36 +- tests/integration/fixtures/eslint-v6/test.sh | 1 + tests/integration/fixtures/markdown/test.sh | 1 + .../test.sh | 1 + .../test.sh | 1 + tests/integration/fixtures/vue-jsx/test.sh | 1 + tests/integration/fixtures/vue-sfc/test.sh | 1 + yarn.lock | 151 +- 282 files changed, 3647 insertions(+), 1847 deletions(-) create mode 100644 packages/ast-spec/LICENSE create mode 100644 packages/ast-spec/README.md create mode 100644 packages/ast-spec/api-extractor.json create mode 100644 packages/ast-spec/jest.config.js create mode 100644 packages/ast-spec/package.json rename packages/{types => ast-spec}/src/ast-node-types.ts (88%) rename packages/{types => ast-spec}/src/ast-token-types.ts (87%) create mode 100644 packages/ast-spec/src/base/Accessibility.ts create mode 100644 packages/ast-spec/src/base/BaseNode.ts create mode 100644 packages/ast-spec/src/base/BaseToken.ts create mode 100644 packages/ast-spec/src/base/BinaryExpressionBase.ts create mode 100644 packages/ast-spec/src/base/ClassDeclarationBase.ts create mode 100644 packages/ast-spec/src/base/ClassPropertyBase.ts create mode 100644 packages/ast-spec/src/base/FunctionDeclarationBase.ts create mode 100644 packages/ast-spec/src/base/LineAndColumnData.ts create mode 100644 packages/ast-spec/src/base/LiteralBase.ts create mode 100644 packages/ast-spec/src/base/MethodDefinitionBase.ts create mode 100644 packages/ast-spec/src/base/OptionalRangeAndLoc.ts create mode 100644 packages/ast-spec/src/base/Range.ts create mode 100644 packages/ast-spec/src/base/SourceLocation.ts create mode 100644 packages/ast-spec/src/base/TSFunctionSignatureBase.ts create mode 100644 packages/ast-spec/src/base/TSHeritageBase.ts create mode 100644 packages/ast-spec/src/base/UnaryExpressionBase.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/VariableDeclaration/spec.ts create mode 100644 packages/ast-spec/src/declaration/spec.ts create mode 100644 packages/ast-spec/src/element/ClassProperty/spec.ts create mode 100644 packages/ast-spec/src/element/MethodDefinition/spec.ts create mode 100644 packages/ast-spec/src/element/Property/spec.ts create mode 100644 packages/ast-spec/src/element/SpreadElement/spec.ts create mode 100644 packages/ast-spec/src/element/TSAbstractClassProperty/spec.ts create mode 100644 packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts create mode 100644 packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts create mode 100644 packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts create mode 100644 packages/ast-spec/src/element/TSEnumMember/spec.ts create mode 100644 packages/ast-spec/src/element/TSIndexSignature/spec.ts create mode 100644 packages/ast-spec/src/element/TSMethodSignature/spec.ts create mode 100644 packages/ast-spec/src/element/TSPropertySignature/spec.ts create mode 100644 packages/ast-spec/src/element/spec.ts create mode 100644 packages/ast-spec/src/expression/ArrayExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/AssignmentExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/AwaitExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/BinaryExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/CallExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/ChainExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/ClassExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/ConditionalExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/FunctionExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/Identifier/spec.ts create mode 100644 packages/ast-spec/src/expression/ImportExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/JSXElement/spec.ts create mode 100644 packages/ast-spec/src/expression/JSXFragment/spec.ts create mode 100644 packages/ast-spec/src/expression/LogicalExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/MemberExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/MetaProperty/spec.ts create mode 100644 packages/ast-spec/src/expression/NewExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/ObjectExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/SequenceExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/Super/spec.ts create mode 100644 packages/ast-spec/src/expression/TSAsExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/TSNonNullExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/TSTypeAssertion/spec.ts create mode 100644 packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/TemplateLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/ThisExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/UnaryExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/UpdateExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/YieldExpression/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/NullLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/StringLiteral/spec.ts create mode 100644 packages/ast-spec/src/expression/literal/spec.ts create mode 100644 packages/ast-spec/src/expression/spec.ts create mode 100644 packages/ast-spec/src/index.ts create mode 100644 packages/ast-spec/src/jsx/JSXAttribute/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXClosingElement/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXIdentifier/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts create mode 100644 packages/ast-spec/src/jsx/JSXText/spec.ts create mode 100644 packages/ast-spec/src/jsx/spec.ts create mode 100644 packages/ast-spec/src/parameter/ArrayPattern/spec.ts create mode 100644 packages/ast-spec/src/parameter/AssignmentPattern/spec.ts create mode 100644 packages/ast-spec/src/parameter/ObjectPattern/spec.ts create mode 100644 packages/ast-spec/src/parameter/RestElement/spec.ts create mode 100644 packages/ast-spec/src/parameter/TSParameterProperty/spec.ts create mode 100644 packages/ast-spec/src/parameter/spec.ts create mode 100644 packages/ast-spec/src/special/CatchClause/spec.ts create mode 100644 packages/ast-spec/src/special/ClassBody/spec.ts create mode 100644 packages/ast-spec/src/special/Decorator/spec.ts create mode 100644 packages/ast-spec/src/special/EmptyStatement/spec.ts create mode 100644 packages/ast-spec/src/special/ExportSpecifier/spec.ts create mode 100644 packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts create mode 100644 packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts create mode 100644 packages/ast-spec/src/special/ImportSpecifier/spec.ts create mode 100644 packages/ast-spec/src/special/Program/spec.ts create mode 100644 packages/ast-spec/src/special/SwitchCase/spec.ts create mode 100644 packages/ast-spec/src/special/TSClassImplements/spec.ts create mode 100644 packages/ast-spec/src/special/TSExternalModuleReference/spec.ts create mode 100644 packages/ast-spec/src/special/TSInterfaceBody/spec.ts create mode 100644 packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts create mode 100644 packages/ast-spec/src/special/TSModuleBlock/spec.ts create mode 100644 packages/ast-spec/src/special/TSTypeAnnotation/spec.ts create mode 100644 packages/ast-spec/src/special/TSTypeParameter/spec.ts create mode 100644 packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts create mode 100644 packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts create mode 100644 packages/ast-spec/src/special/TemplateElement/spec.ts create mode 100644 packages/ast-spec/src/special/VariableDeclarator/spec.ts create mode 100644 packages/ast-spec/src/special/spec.ts create mode 100644 packages/ast-spec/src/statement/BlockStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/BreakStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ContinueStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/DebuggerStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/DoWhileStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ExpressionStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ForInStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ForOfStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ForStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/IfStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ImportDeclaration/spec.ts create mode 100644 packages/ast-spec/src/statement/LabeledStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/ReturnStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/SwitchStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/TSExportAssignment/spec.ts create mode 100644 packages/ast-spec/src/statement/ThrowStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/TryStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/WhileStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/WithStatement/spec.ts create mode 100644 packages/ast-spec/src/statement/spec.ts create mode 100644 packages/ast-spec/src/token/BlockComment/spec.ts create mode 100644 packages/ast-spec/src/token/BooleanToken/spec.ts create mode 100644 packages/ast-spec/src/token/IdentifierToken/spec.ts create mode 100644 packages/ast-spec/src/token/JSXIdentifierToken/spec.ts create mode 100644 packages/ast-spec/src/token/JSXTextToken/spec.ts create mode 100644 packages/ast-spec/src/token/KeywordToken/spec.ts create mode 100644 packages/ast-spec/src/token/LineComment/spec.ts create mode 100644 packages/ast-spec/src/token/NullToken/spec.ts create mode 100644 packages/ast-spec/src/token/NumericToken/spec.ts create mode 100644 packages/ast-spec/src/token/PunctuatorToken/spec.ts create mode 100644 packages/ast-spec/src/token/RegularExpressionToken/spec.ts create mode 100644 packages/ast-spec/src/token/StringToken/spec.ts create mode 100644 packages/ast-spec/src/token/TSAbstractKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSAsyncKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSDeclareKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSExportKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSPrivateKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSProtectedKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSPublicKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TSStaticKeyword/spec.ts create mode 100644 packages/ast-spec/src/token/TemplateToken/spec.ts create mode 100644 packages/ast-spec/src/token/spec.ts create mode 100644 packages/ast-spec/src/type/TSAnyKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSArrayType/spec.ts create mode 100644 packages/ast-spec/src/type/TSBigIntKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSBooleanKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSConditionalType/spec.ts create mode 100644 packages/ast-spec/src/type/TSConstructorType/spec.ts create mode 100644 packages/ast-spec/src/type/TSFunctionType/spec.ts create mode 100644 packages/ast-spec/src/type/TSImportType/spec.ts create mode 100644 packages/ast-spec/src/type/TSIndexedAccessType/spec.ts create mode 100644 packages/ast-spec/src/type/TSInferType/spec.ts create mode 100644 packages/ast-spec/src/type/TSIntersectionType/spec.ts create mode 100644 packages/ast-spec/src/type/TSIntrinsicType/spec.ts create mode 100644 packages/ast-spec/src/type/TSLiteralType/spec.ts create mode 100644 packages/ast-spec/src/type/TSMappedType/spec.ts create mode 100644 packages/ast-spec/src/type/TSNamedTupleMember/spec.ts create mode 100644 packages/ast-spec/src/type/TSNeverKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSNullKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSNumberKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSObjectKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSOptionalType/spec.ts create mode 100644 packages/ast-spec/src/type/TSParenthesizedType/spec.ts create mode 100644 packages/ast-spec/src/type/TSQualifiedName/spec.ts create mode 100644 packages/ast-spec/src/type/TSRestType/spec.ts create mode 100644 packages/ast-spec/src/type/TSStringKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSSymbolKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts create mode 100644 packages/ast-spec/src/type/TSThisType/spec.ts create mode 100644 packages/ast-spec/src/type/TSTupleType/spec.ts create mode 100644 packages/ast-spec/src/type/TSTypeLiteral/spec.ts create mode 100644 packages/ast-spec/src/type/TSTypeOperator/spec.ts create mode 100644 packages/ast-spec/src/type/TSTypePredicate/spec.ts create mode 100644 packages/ast-spec/src/type/TSTypeQuery/spec.ts create mode 100644 packages/ast-spec/src/type/TSTypeReference/spec.ts create mode 100644 packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSUnionType/spec.ts create mode 100644 packages/ast-spec/src/type/TSUnknownKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/TSVoidKeyword/spec.ts create mode 100644 packages/ast-spec/src/type/spec.ts create mode 100644 packages/ast-spec/src/unions/BindingName.ts create mode 100644 packages/ast-spec/src/unions/BindingPattern.ts create mode 100644 packages/ast-spec/src/unions/CallExpressionArgument.ts create mode 100644 packages/ast-spec/src/unions/ChainElement.ts create mode 100644 packages/ast-spec/src/unions/ClassElement.ts create mode 100644 packages/ast-spec/src/unions/Comment.ts create mode 100644 packages/ast-spec/src/unions/DeclarationStatement.ts create mode 100644 packages/ast-spec/src/unions/DestructuringPattern.ts create mode 100644 packages/ast-spec/src/unions/EntityName.ts create mode 100644 packages/ast-spec/src/unions/ExportDeclaration.ts create mode 100644 packages/ast-spec/src/unions/Expression.ts create mode 100644 packages/ast-spec/src/unions/ForInitialiser.ts create mode 100644 packages/ast-spec/src/unions/FunctionLike.ts create mode 100644 packages/ast-spec/src/unions/ImportClause.ts create mode 100644 packages/ast-spec/src/unions/IterationStatement.ts create mode 100644 packages/ast-spec/src/unions/JSXChild.ts create mode 100644 packages/ast-spec/src/unions/JSXExpression.ts create mode 100644 packages/ast-spec/src/unions/JSXTagNameExpression.ts create mode 100644 packages/ast-spec/src/unions/LeftHandSideExpression.ts create mode 100644 packages/ast-spec/src/unions/Literal.ts create mode 100644 packages/ast-spec/src/unions/LiteralExpression.ts create mode 100644 packages/ast-spec/src/unions/Modifier.ts create mode 100644 packages/ast-spec/src/unions/Node.ts create mode 100644 packages/ast-spec/src/unions/ObjectLiteralElement.ts create mode 100644 packages/ast-spec/src/unions/Parameter.ts create mode 100644 packages/ast-spec/src/unions/PrimaryExpression.ts create mode 100644 packages/ast-spec/src/unions/PropertyName.ts create mode 100644 packages/ast-spec/src/unions/Statement.ts create mode 100644 packages/ast-spec/src/unions/TSUnaryExpression.ts create mode 100644 packages/ast-spec/src/unions/Token.ts create mode 100644 packages/ast-spec/src/unions/TypeElement.ts create mode 100644 packages/ast-spec/src/unions/TypeNode.ts create mode 100644 packages/ast-spec/tests/ast-node-types.test.ts create mode 100644 packages/ast-spec/tsconfig.build.json create mode 100644 packages/ast-spec/tsconfig.json create mode 100644 packages/types/tools/copy-ast-spec.ts diff --git a/.eslintignore b/.eslintignore index 3c9816ccb5cc..255b369df6b0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,6 @@ coverage __snapshots__ packages/eslint-plugin-tslint/tests + +# Files copied as part of the build +packages/types/src/ast-spec.ts diff --git a/.eslintrc.js b/.eslintrc.js index 5d944cceacbe..c02abfbd7a8d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,6 +7,7 @@ module.exports = { 'import', 'eslint-comments', '@typescript-eslint/internal', + 'simple-import-sort', ], env: { es6: true, @@ -261,5 +262,27 @@ module.exports = { '@typescript-eslint/internal/prefer-ast-types-enum': 'off', }, }, + // ast spec specific standardization + { + files: ['packages/ast-spec/src/**/*.ts'], + rules: { + '@typescript-eslint/consistent-type-imports': [ + 'error', + { prefer: 'type-imports', disallowTypeAnnotations: true }, + ], + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/sort-type-union-intersection-members': 'error', + 'import/first': 'error', + 'import/newline-after-import': 'error', + 'import/no-duplicates': 'error', + 'simple-import-sort/imports': 'error', + }, + }, + { + files: ['rollup.config.ts'], + rules: { + 'import/no-default-export': 'off', + }, + }, ], }; diff --git a/.gitignore b/.gitignore index b7d08022ef73..95ec54effa37 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,7 @@ dist _ts3.4 *.tsbuildinfo .watchmanconfig +.rollup.cache + +# Files copied as part of the build +packages/types/src/ast-spec.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 20830a2fa0b8..f0677068d037 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,8 +13,8 @@ // typescript auto-format settings "typescript.tsdk": "node_modules/typescript/lib", - "javascript.preferences.importModuleSpecifier": "auto", - "typescript.preferences.importModuleSpecifier": "auto", + "javascript.preferences.importModuleSpecifier": "project-relative", + "typescript.preferences.importModuleSpecifier": "project-relative", "javascript.preferences.quoteStyle": "single", "typescript.preferences.quoteStyle": "single", "editor.defaultFormatter": "esbenp.prettier-vscode", diff --git a/package.json b/package.json index 431c13ac5668..f93f8088afdc 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "scripts": { - "build": "lerna run build", + "build": "lerna run build --ignore ast-spec", "check:clean-workspace-after-install": "git diff --quiet --exit-code", "check:configs": "lerna run check:configs", "check:docs": "lerna run check:docs", @@ -98,6 +98,7 @@ "eslint-plugin-eslint-plugin": "^3.0.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-jest": "^24.1.3", + "eslint-plugin-simple-import-sort": "^7.0.0", "glob": "^7.1.6", "husky": "^5.0.9", "jest": "^26.6.3", diff --git a/packages/ast-spec/LICENSE b/packages/ast-spec/LICENSE new file mode 100644 index 000000000000..7e7370143b26 --- /dev/null +++ b/packages/ast-spec/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 TypeScript ESLint and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ast-spec/README.md b/packages/ast-spec/README.md new file mode 100644 index 000000000000..7c954398395b --- /dev/null +++ b/packages/ast-spec/README.md @@ -0,0 +1,24 @@ +

TypeScript-ESTree AST Specification

+ +

+ CI + NPM Version + NPM Downloads +

+ +This is the complete specification for the TypeScript-ESTree AST. + +It includes: + +- Node definitions as TypeScript types (the specification) +- Logic for converting from the TypeScript AST to the TypeScript-ESTree AST. +- Tests/Fixtures/Examples for each Node + +**You probably don't want to use it directly.** + +If you're building an ESLint plugin, consider using [`@typescript-eslint/experimental-utils`](../experimental-utils). +If you're parsing TypeScript code, consider using [`@typescript-eslint/typescript-estree`](../typescript-estree). + +## Contributing + +[See the contributing guide here](../../CONTRIBUTING.md) diff --git a/packages/ast-spec/api-extractor.json b/packages/ast-spec/api-extractor.json new file mode 100644 index 000000000000..f474f3bf26fd --- /dev/null +++ b/packages/ast-spec/api-extractor.json @@ -0,0 +1,31 @@ +{ + "mainEntryPointFilePath": "/dist/index.d.ts", + "apiReport": { + "enabled": false + }, + "docModel": { + "enabled": false + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "/dist/ast-spec.ts" + }, + "tsdocMetadata": { + "enabled": false + }, + "messages": { + "extractorMessageReporting": { + "default": { + "logLevel": "none" + }, + "ae-forgotten-export": { + "logLevel": "none" + } + }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + } + } +} diff --git a/packages/ast-spec/jest.config.js b/packages/ast-spec/jest.config.js new file mode 100644 index 000000000000..c23ca67fbc68 --- /dev/null +++ b/packages/ast-spec/jest.config.js @@ -0,0 +1,20 @@ +'use strict'; + +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + globals: { + 'ts-jest': { + isolatedModules: true, + }, + }, + testEnvironment: 'node', + transform: { + ['^.+\\.tsx?$']: 'ts-jest', + }, + testRegex: ['./tests/.+\\.test\\.ts$'], + collectCoverage: false, + collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + coverageReporters: ['text-summary', 'lcov'], +}; diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json new file mode 100644 index 000000000000..c688fcdda2e1 --- /dev/null +++ b/packages/ast-spec/package.json @@ -0,0 +1,46 @@ +{ + "name": "@typescript-eslint/ast-spec", + "version": "4.20.0", + "description": "TypeScript-ESTree AST spec", + "private": true, + "keywords": [ + "eslint", + "typescript", + "estree" + ], + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "files": [ + "dist", + "package.json", + "README.md", + "LICENSE" + ], + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/ast-spec" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "license": "MIT", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc -b tsconfig.build.json && api-extractor run --local", + "clean": "tsc -b tsconfig.build.json --clean", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", + "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "devDependencies": { + "@microsoft/api-extractor": "^7.13.2" + } +} diff --git a/packages/types/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts similarity index 88% rename from packages/types/src/ast-node-types.ts rename to packages/ast-spec/src/ast-node-types.ts index f233d60f8aeb..6aa0087d5eb2 100644 --- a/packages/types/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -1,4 +1,4 @@ -enum AST_NODE_TYPES { +export enum AST_NODE_TYPES { ArrayExpression = 'ArrayExpression', ArrayPattern = 'ArrayPattern', ArrowFunctionExpression = 'ArrowFunctionExpression', @@ -164,23 +164,3 @@ enum AST_NODE_TYPES { TSUnknownKeyword = 'TSUnknownKeyword', TSVoidKeyword = 'TSVoidKeyword', } - -export { AST_NODE_TYPES }; - -// Below is a special type-only test which ensures that we don't accidentally leave unused keys in this enum -// eslint-disable-next-line import/first -- purposely down here to colocate it with this hack of a test -import type { Node } from './ts-estree'; - -type GetKeys = keyof Extract; - -type AllKeys = { - readonly [T in AST_NODE_TYPES]: GetKeys; -}; - -type TakesString> = T; - -// @ts-expect-error: purposely unused -type _Test = - // forcing the test onto a new line so it isn't covered by the expect error - // If there are any enum members that don't have a corresponding TSESTree.Node, then this line will error with "Type 'string | number | symbol' is not assignable to type 'string'." - void | TakesString; diff --git a/packages/types/src/ast-token-types.ts b/packages/ast-spec/src/ast-token-types.ts similarity index 87% rename from packages/types/src/ast-token-types.ts rename to packages/ast-spec/src/ast-token-types.ts index 144befece83e..f839d8dfae59 100644 --- a/packages/types/src/ast-token-types.ts +++ b/packages/ast-spec/src/ast-token-types.ts @@ -1,4 +1,4 @@ -enum AST_TOKEN_TYPES { +export enum AST_TOKEN_TYPES { Boolean = 'Boolean', Identifier = 'Identifier', JSXIdentifier = 'JSXIdentifier', @@ -15,5 +15,3 @@ enum AST_TOKEN_TYPES { Block = 'Block', Line = 'Line', } - -export { AST_TOKEN_TYPES }; diff --git a/packages/ast-spec/src/base/Accessibility.ts b/packages/ast-spec/src/base/Accessibility.ts new file mode 100644 index 000000000000..d52942f43ab2 --- /dev/null +++ b/packages/ast-spec/src/base/Accessibility.ts @@ -0,0 +1 @@ +export type Accessibility = 'private' | 'protected' | 'public'; diff --git a/packages/ast-spec/src/base/BaseNode.ts b/packages/ast-spec/src/base/BaseNode.ts new file mode 100644 index 000000000000..362f156832b4 --- /dev/null +++ b/packages/ast-spec/src/base/BaseNode.ts @@ -0,0 +1,22 @@ +// import type { Node } from '../unions/Node'; +import type { Range } from './Range'; +import type { SourceLocation } from './SourceLocation'; + +export interface BaseNode { + /** + * The source location information of the node. + * @see {SourceLocation} + */ + loc: SourceLocation; + /** + * @see {Range} + */ + range: Range; + /** + * The parent node of the current node + */ + // parent?: Node; + + // every node *will* have a type, but let the nodes define their own exact string + // type: string; +} diff --git a/packages/ast-spec/src/base/BaseToken.ts b/packages/ast-spec/src/base/BaseToken.ts new file mode 100644 index 000000000000..cdf0d1286438 --- /dev/null +++ b/packages/ast-spec/src/base/BaseToken.ts @@ -0,0 +1,8 @@ +import type { BaseNode } from './BaseNode'; + +/* + * Token and Comment are pseudo-nodes to represent pieces of source code + */ +export interface BaseToken extends BaseNode { + value: string; +} diff --git a/packages/ast-spec/src/base/BinaryExpressionBase.ts b/packages/ast-spec/src/base/BinaryExpressionBase.ts new file mode 100644 index 000000000000..926491d49855 --- /dev/null +++ b/packages/ast-spec/src/base/BinaryExpressionBase.ts @@ -0,0 +1,8 @@ +import type { Expression } from '../unions/Expression'; +import type { BaseNode } from './BaseNode'; + +export interface BinaryExpressionBase extends BaseNode { + operator: string; + left: Expression; + right: Expression; +} diff --git a/packages/ast-spec/src/base/ClassDeclarationBase.ts b/packages/ast-spec/src/base/ClassDeclarationBase.ts new file mode 100644 index 000000000000..f104b739b517 --- /dev/null +++ b/packages/ast-spec/src/base/ClassDeclarationBase.ts @@ -0,0 +1,20 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { ClassBody } from '../special/ClassBody/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { TSClassImplements } from '../special/TSClassImplements/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; +import type { BaseNode } from './BaseNode'; + +export interface ClassDeclarationBase extends BaseNode { + typeParameters?: TSTypeParameterDeclaration; + superTypeParameters?: TSTypeParameterInstantiation; + id: Identifier | null; + body: ClassBody; + superClass: LeftHandSideExpression | null; + implements?: TSClassImplements[]; + abstract?: boolean; + declare?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/base/ClassPropertyBase.ts b/packages/ast-spec/src/base/ClassPropertyBase.ts new file mode 100644 index 000000000000..8ac19b05fa55 --- /dev/null +++ b/packages/ast-spec/src/base/ClassPropertyBase.ts @@ -0,0 +1,34 @@ +import type { Decorator } from '../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { Expression } from '../unions/Expression'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../unions/PropertyName'; +import type { Accessibility } from './Accessibility'; +import type { BaseNode } from './BaseNode'; + +interface ClassPropertyBase extends BaseNode { + key: PropertyName; + value: Expression | null; + computed: boolean; + static: boolean; + declare: boolean; + readonly?: boolean; + decorators?: Decorator[]; + accessibility?: Accessibility; + optional?: boolean; + definite?: boolean; + typeAnnotation?: TSTypeAnnotation; +} + +export interface ClassPropertyComputedNameBase extends ClassPropertyBase { + key: PropertyNameComputed; + computed: true; +} + +export interface ClassPropertyNonComputedNameBase extends ClassPropertyBase { + key: PropertyNameNonComputed; + computed: false; +} diff --git a/packages/ast-spec/src/base/FunctionDeclarationBase.ts b/packages/ast-spec/src/base/FunctionDeclarationBase.ts new file mode 100644 index 000000000000..50b7aa97bf2f --- /dev/null +++ b/packages/ast-spec/src/base/FunctionDeclarationBase.ts @@ -0,0 +1,18 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { Parameter } from '../unions/Parameter'; +import type { BaseNode } from './BaseNode'; + +export interface FunctionDeclarationBase extends BaseNode { + id: Identifier | null; + generator: boolean; + expression: boolean; + async: boolean; + params: Parameter[]; + body?: BlockStatement | null; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; + declare?: boolean; +} diff --git a/packages/ast-spec/src/base/LineAndColumnData.ts b/packages/ast-spec/src/base/LineAndColumnData.ts new file mode 100644 index 000000000000..740ebe6fa467 --- /dev/null +++ b/packages/ast-spec/src/base/LineAndColumnData.ts @@ -0,0 +1,10 @@ +export interface LineAndColumnData { + /** + * Line number (1-indexed) + */ + line: number; + /** + * Column number on the line (0-indexed) + */ + column: number; +} diff --git a/packages/ast-spec/src/base/LiteralBase.ts b/packages/ast-spec/src/base/LiteralBase.ts new file mode 100644 index 000000000000..01a480ddc3cb --- /dev/null +++ b/packages/ast-spec/src/base/LiteralBase.ts @@ -0,0 +1,6 @@ +import type { BaseNode } from './BaseNode'; + +export interface LiteralBase extends BaseNode { + raw: string; + value: RegExp | bigint | boolean | number | string | null; +} diff --git a/packages/ast-spec/src/base/MethodDefinitionBase.ts b/packages/ast-spec/src/base/MethodDefinitionBase.ts new file mode 100644 index 000000000000..fe8846062106 --- /dev/null +++ b/packages/ast-spec/src/base/MethodDefinitionBase.ts @@ -0,0 +1,35 @@ +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../unions/PropertyName'; +import type { Accessibility } from './Accessibility'; +import type { BaseNode } from './BaseNode'; + +/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ +interface MethodDefinitionBase extends BaseNode { + key: PropertyName; + value: FunctionExpression | TSEmptyBodyFunctionExpression; + computed: boolean; + static: boolean; + kind: 'constructor' | 'get' | 'method' | 'set'; + optional?: boolean; + decorators?: Decorator[]; + accessibility?: Accessibility; + typeParameters?: TSTypeParameterDeclaration; +} + +export interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { + key: PropertyNameComputed; + computed: true; +} + +export interface MethodDefinitionNonComputedNameBase + extends MethodDefinitionBase { + key: PropertyNameNonComputed; + computed: false; +} diff --git a/packages/ast-spec/src/base/OptionalRangeAndLoc.ts b/packages/ast-spec/src/base/OptionalRangeAndLoc.ts new file mode 100644 index 000000000000..d9b8cc9f874d --- /dev/null +++ b/packages/ast-spec/src/base/OptionalRangeAndLoc.ts @@ -0,0 +1,11 @@ +import type { Range } from './Range'; +import type { SourceLocation } from './SourceLocation'; + +// TODO - breaking change move this into `typescript-estree` +export type OptionalRangeAndLoc = Pick< + T, + Exclude +> & { + range?: Range; + loc?: SourceLocation; +}; diff --git a/packages/ast-spec/src/base/Range.ts b/packages/ast-spec/src/base/Range.ts new file mode 100644 index 000000000000..e78f71e3f747 --- /dev/null +++ b/packages/ast-spec/src/base/Range.ts @@ -0,0 +1,6 @@ +/** + * An array of two numbers. + * Both numbers are a 0-based index which is the position in the array of source code characters. + * The first is the start position of the node, the second is the end position of the node. + */ +export type Range = [number, number]; diff --git a/packages/ast-spec/src/base/SourceLocation.ts b/packages/ast-spec/src/base/SourceLocation.ts new file mode 100644 index 000000000000..e1a8e272a6fc --- /dev/null +++ b/packages/ast-spec/src/base/SourceLocation.ts @@ -0,0 +1,12 @@ +import type { LineAndColumnData } from './LineAndColumnData'; + +export interface SourceLocation { + /** + * The position of the first character of the parsed source region + */ + start: LineAndColumnData; + /** + * The position of the first character after the parsed source region + */ + end: LineAndColumnData; +} diff --git a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts new file mode 100644 index 000000000000..0da1e7b414d6 --- /dev/null +++ b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts @@ -0,0 +1,10 @@ +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { Parameter } from '../unions/Parameter'; +import type { BaseNode } from './BaseNode'; + +export interface TSFunctionSignatureBase extends BaseNode { + params: Parameter[]; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts new file mode 100644 index 000000000000..b3ed1770b674 --- /dev/null +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -0,0 +1,8 @@ +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { Expression } from '../unions/Expression'; +import type { BaseNode } from './BaseNode'; + +export interface TSHeritageBase extends BaseNode { + expression: Expression; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/base/UnaryExpressionBase.ts b/packages/ast-spec/src/base/UnaryExpressionBase.ts new file mode 100644 index 000000000000..feb681ccbc3c --- /dev/null +++ b/packages/ast-spec/src/base/UnaryExpressionBase.ts @@ -0,0 +1,10 @@ +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; +import type { Literal } from '../unions/Literal'; +import type { BaseNode } from './BaseNode'; + +export interface UnaryExpressionBase extends BaseNode { + operator: string; + prefix: boolean; + argument: LeftHandSideExpression | Literal | UnaryExpression; +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts new file mode 100644 index 000000000000..2154b8863a02 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; + +export interface ClassDeclaration extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassDeclaration; +} diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts new file mode 100644 index 000000000000..e9657a7536fa --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface ExportAllDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportAllDeclaration; + source: Expression | null; + exportKind: 'type' | 'value'; + exported: Identifier | null; +} diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts new file mode 100644 index 000000000000..f34b6e44668f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ExportDeclaration } from '../../unions/ExportDeclaration'; +import type { Expression } from '../../unions/Expression'; + +export interface ExportDefaultDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportDefaultDeclaration; + declaration: ExportDeclaration | Expression; + exportKind: 'type' | 'value'; +} diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts new file mode 100644 index 000000000000..021fea1c6330 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ExportSpecifier } from '../../special/ExportSpecifier/spec'; +import type { ExportDeclaration } from '../../unions/ExportDeclaration'; +import type { Expression } from '../../unions/Expression'; + +export interface ExportNamedDeclaration extends BaseNode { + type: AST_NODE_TYPES.ExportNamedDeclaration; + declaration: ExportDeclaration | null; + specifiers: ExportSpecifier[]; + source: Expression | null; + exportKind: 'type' | 'value'; +} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts new file mode 100644 index 000000000000..59d7c4ffe39d --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; + +export interface FunctionDeclaration extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionDeclaration; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts new file mode 100644 index 000000000000..88bd4aff2f21 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; + +export interface TSDeclareFunction extends FunctionDeclarationBase { + type: AST_NODE_TYPES.TSDeclareFunction; +} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts new file mode 100644 index 000000000000..1c1530d501ff --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSEnumMember } from '../../element/TSEnumMember/spec'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { Modifier } from '../../unions/Modifier'; + +export interface TSEnumDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSEnumDeclaration; + id: Identifier; + members: TSEnumMember[]; + const?: boolean; + declare?: boolean; + modifiers?: Modifier[]; +} diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts new file mode 100644 index 000000000000..4c434dded782 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSExternalModuleReference } from '../../special/TSExternalModuleReference/spec'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSImportEqualsDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSImportEqualsDeclaration; + id: Identifier; + moduleReference: EntityName | TSExternalModuleReference; + importKind: 'type' | 'value'; + isExport: boolean; +} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts new file mode 100644 index 000000000000..1e95380c3cbb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts @@ -0,0 +1,17 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSInterfaceBody } from '../../special/TSInterfaceBody/spec'; +import type { TSInterfaceHeritage } from '../../special/TSInterfaceHeritage/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; + +export interface TSInterfaceDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceDeclaration; + body: TSInterfaceBody; + id: Identifier; + typeParameters?: TSTypeParameterDeclaration; + extends?: TSInterfaceHeritage[]; + implements?: TSInterfaceHeritage[]; + abstract?: boolean; + declare?: boolean; +} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts new file mode 100644 index 000000000000..ac63e52a5938 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts @@ -0,0 +1,26 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSModuleBlock } from '../../special/TSModuleBlock/spec'; +import type { Literal } from '../../unions/Literal'; +import type { Modifier } from '../../unions/Modifier'; + +export interface TSModuleDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSModuleDeclaration; + id: Identifier | Literal; + body?: + | TSModuleBlock + /* + TODO - we currently emit this due to bad parser handling of nested modules + namespace Foo.Bar {} + ^^^^^^^^^^^^^^^^^^^^ TSModuleDeclaration + ^^^^^^ TSModuleDeclaration + ^^ TSModuleBlock + + This should instead emit a TSQualifiedName for the `id` and not emit an inner TSModuleDeclaration + */ + | TSModuleDeclaration; + global?: boolean; + declare?: boolean; + modifiers?: Modifier[]; +} diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts new file mode 100644 index 000000000000..6853d4a28544 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface TSNamespaceExportDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSNamespaceExportDeclaration; + id: Identifier; +} diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts new file mode 100644 index 000000000000..61ce986c2a23 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAliasDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeAliasDeclaration; + id: Identifier; + typeAnnotation: TypeNode; + declare?: boolean; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts new file mode 100644 index 000000000000..418a51eb735b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { VariableDeclarator } from '../../special/VariableDeclarator/spec'; + +export interface VariableDeclaration extends BaseNode { + type: AST_NODE_TYPES.VariableDeclaration; + // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` + declarations: VariableDeclarator[]; + kind: 'const' | 'let' | 'var'; + declare?: boolean; +} diff --git a/packages/ast-spec/src/declaration/spec.ts b/packages/ast-spec/src/declaration/spec.ts new file mode 100644 index 000000000000..8d29c3cd70a1 --- /dev/null +++ b/packages/ast-spec/src/declaration/spec.ts @@ -0,0 +1,13 @@ +export * from './ClassDeclaration/spec'; +export * from './ExportAllDeclaration/spec'; +export * from './ExportDefaultDeclaration/spec'; +export * from './ExportNamedDeclaration/spec'; +export * from './FunctionDeclaration/spec'; +export * from './TSDeclareFunction/spec'; +export * from './TSEnumDeclaration/spec'; +export * from './TSImportEqualsDeclaration/spec'; +export * from './TSInterfaceDeclaration/spec'; +export * from './TSModuleDeclaration/spec'; +export * from './TSNamespaceExportDeclaration/spec'; +export * from './TSTypeAliasDeclaration/spec'; +export * from './VariableDeclaration/spec'; diff --git a/packages/ast-spec/src/element/ClassProperty/spec.ts b/packages/ast-spec/src/element/ClassProperty/spec.ts new file mode 100644 index 000000000000..29fe75aa84e6 --- /dev/null +++ b/packages/ast-spec/src/element/ClassProperty/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + ClassPropertyComputedNameBase, + ClassPropertyNonComputedNameBase, +} from '../../base/ClassPropertyBase'; + +export interface ClassPropertyComputedName + extends ClassPropertyComputedNameBase { + type: AST_NODE_TYPES.ClassProperty; +} + +export interface ClassPropertyNonComputedName + extends ClassPropertyNonComputedNameBase { + type: AST_NODE_TYPES.ClassProperty; +} + +export type ClassProperty = + | ClassPropertyComputedName + | ClassPropertyNonComputedName; diff --git a/packages/ast-spec/src/element/MethodDefinition/spec.ts b/packages/ast-spec/src/element/MethodDefinition/spec.ts new file mode 100644 index 000000000000..f097f9f8e854 --- /dev/null +++ b/packages/ast-spec/src/element/MethodDefinition/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + MethodDefinitionComputedNameBase, + MethodDefinitionNonComputedNameBase, +} from '../../base/MethodDefinitionBase'; + +export interface MethodDefinitionComputedName + extends MethodDefinitionComputedNameBase { + type: AST_NODE_TYPES.MethodDefinition; +} + +export interface MethodDefinitionNonComputedName + extends MethodDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.MethodDefinition; +} + +export type MethodDefinition = + | MethodDefinitionComputedName + | MethodDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/Property/spec.ts b/packages/ast-spec/src/element/Property/spec.ts new file mode 100644 index 000000000000..c96a7a26e371 --- /dev/null +++ b/packages/ast-spec/src/element/Property/spec.ts @@ -0,0 +1,37 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSEmptyBodyFunctionExpression } from '../../expression/TSEmptyBodyFunctionExpression/spec'; +import type { AssignmentPattern } from '../../parameter/AssignmentPattern/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface PropertyBase extends BaseNode { + type: AST_NODE_TYPES.Property; + key: PropertyName; + value: + | AssignmentPattern + | BindingName + | Expression + | TSEmptyBodyFunctionExpression; + computed: boolean; + method: boolean; + shorthand: boolean; + optional?: boolean; + kind: 'get' | 'init' | 'set'; +} + +export interface PropertyComputedName extends PropertyBase { + key: PropertyNameComputed; + computed: true; +} +export interface PropertyNonComputedName extends PropertyBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type Property = PropertyComputedName | PropertyNonComputedName; diff --git a/packages/ast-spec/src/element/SpreadElement/spec.ts b/packages/ast-spec/src/element/SpreadElement/spec.ts new file mode 100644 index 000000000000..13a691901710 --- /dev/null +++ b/packages/ast-spec/src/element/SpreadElement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface SpreadElement extends BaseNode { + type: AST_NODE_TYPES.SpreadElement; + argument: Expression; +} diff --git a/packages/ast-spec/src/element/TSAbstractClassProperty/spec.ts b/packages/ast-spec/src/element/TSAbstractClassProperty/spec.ts new file mode 100644 index 000000000000..0d845a893290 --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractClassProperty/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + ClassPropertyComputedNameBase, + ClassPropertyNonComputedNameBase, +} from '../../base/ClassPropertyBase'; + +export interface TSAbstractClassPropertyComputedName + extends ClassPropertyComputedNameBase { + type: AST_NODE_TYPES.TSAbstractClassProperty; +} + +export interface TSAbstractClassPropertyNonComputedName + extends ClassPropertyNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractClassProperty; +} + +export type TSAbstractClassProperty = + | TSAbstractClassPropertyComputedName + | TSAbstractClassPropertyNonComputedName; diff --git a/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts b/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts new file mode 100644 index 000000000000..a8f5a05c50ab --- /dev/null +++ b/packages/ast-spec/src/element/TSAbstractMethodDefinition/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { + MethodDefinitionComputedNameBase, + MethodDefinitionNonComputedNameBase, +} from '../../base/MethodDefinitionBase'; + +export interface TSAbstractMethodDefinitionComputedName + extends MethodDefinitionComputedNameBase { + type: AST_NODE_TYPES.TSAbstractMethodDefinition; +} + +export interface TSAbstractMethodDefinitionNonComputedName + extends MethodDefinitionNonComputedNameBase { + type: AST_NODE_TYPES.TSAbstractMethodDefinition; +} + +export type TSAbstractMethodDefinition = + | TSAbstractMethodDefinitionComputedName + | TSAbstractMethodDefinitionNonComputedName; diff --git a/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts b/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts new file mode 100644 index 000000000000..8ba015661ccb --- /dev/null +++ b/packages/ast-spec/src/element/TSCallSignatureDeclaration/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSCallSignatureDeclaration extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSCallSignatureDeclaration; +} diff --git a/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts b/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts new file mode 100644 index 000000000000..21feddb824d1 --- /dev/null +++ b/packages/ast-spec/src/element/TSConstructSignatureDeclaration/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSConstructSignatureDeclaration + extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructSignatureDeclaration; +} diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts new file mode 100644 index 000000000000..97d8e49fcd94 --- /dev/null +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -0,0 +1,41 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSEnumMemberBase extends BaseNode { + type: AST_NODE_TYPES.TSEnumMember; + id: + | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) + | PropertyNameNonComputed; + initializer?: Expression; + computed?: boolean; +} + +/** + * this should only really happen in semantically invalid code (errors 1164 and 2452) + * + * VALID: + * enum Foo { ['a'] } + * + * INVALID: + * const x = 'a'; + * enum Foo { [x] } + * enum Bar { ['a' + 'b'] } + */ +export interface TSEnumMemberComputedName extends TSEnumMemberBase { + id: PropertyNameComputed; + computed: true; +} + +export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { + id: PropertyNameNonComputed; + computed?: false; +} + +export type TSEnumMember = + | TSEnumMemberComputedName + | TSEnumMemberNonComputedName; diff --git a/packages/ast-spec/src/element/TSIndexSignature/spec.ts b/packages/ast-spec/src/element/TSIndexSignature/spec.ts new file mode 100644 index 000000000000..38002bec2951 --- /dev/null +++ b/packages/ast-spec/src/element/TSIndexSignature/spec.ts @@ -0,0 +1,15 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { Accessibility } from '../../base/Accessibility'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { Parameter } from '../../unions/Parameter'; + +export interface TSIndexSignature extends BaseNode { + type: AST_NODE_TYPES.TSIndexSignature; + parameters: Parameter[]; + typeAnnotation?: TSTypeAnnotation; + readonly?: boolean; + accessibility?: Accessibility; + export?: boolean; + static?: boolean; +} diff --git a/packages/ast-spec/src/element/TSMethodSignature/spec.ts b/packages/ast-spec/src/element/TSMethodSignature/spec.ts new file mode 100644 index 000000000000..76b2e71ab3ad --- /dev/null +++ b/packages/ast-spec/src/element/TSMethodSignature/spec.ts @@ -0,0 +1,39 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { Accessibility } from '../../base/Accessibility'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { Parameter } from '../../unions/Parameter'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSMethodSignatureBase extends BaseNode { + type: AST_NODE_TYPES.TSMethodSignature; + key: PropertyName; + computed: boolean; + params: Parameter[]; + optional?: boolean; + returnType?: TSTypeAnnotation; + readonly?: boolean; + typeParameters?: TSTypeParameterDeclaration; + accessibility?: Accessibility; + export?: boolean; + static?: boolean; +} + +export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { + key: PropertyNameComputed; + computed: true; +} +export interface TSMethodSignatureNonComputedName + extends TSMethodSignatureBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type TSMethodSignature = + | TSMethodSignatureComputedName + | TSMethodSignatureNonComputedName; diff --git a/packages/ast-spec/src/element/TSPropertySignature/spec.ts b/packages/ast-spec/src/element/TSPropertySignature/spec.ts new file mode 100644 index 000000000000..a3f91ac26807 --- /dev/null +++ b/packages/ast-spec/src/element/TSPropertySignature/spec.ts @@ -0,0 +1,39 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { Accessibility } from '../../base/Accessibility'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { Expression } from '../../unions/Expression'; +import type { + PropertyName, + PropertyNameComputed, + PropertyNameNonComputed, +} from '../../unions/PropertyName'; + +interface TSPropertySignatureBase extends BaseNode { + type: AST_NODE_TYPES.TSPropertySignature; + key: PropertyName; + optional?: boolean; + computed: boolean; + typeAnnotation?: TSTypeAnnotation; + initializer?: Expression; + readonly?: boolean; + static?: boolean; + export?: boolean; + accessibility?: Accessibility; +} + +export interface TSPropertySignatureComputedName + extends TSPropertySignatureBase { + key: PropertyNameComputed; + computed: true; +} + +export interface TSPropertySignatureNonComputedName + extends TSPropertySignatureBase { + key: PropertyNameNonComputed; + computed: false; +} + +export type TSPropertySignature = + | TSPropertySignatureComputedName + | TSPropertySignatureNonComputedName; diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts new file mode 100644 index 000000000000..5ee18d914024 --- /dev/null +++ b/packages/ast-spec/src/element/spec.ts @@ -0,0 +1,12 @@ +export * from './ClassProperty/spec'; +export * from './MethodDefinition/spec'; +export * from './Property/spec'; +export * from './SpreadElement/spec'; +export * from './TSAbstractClassProperty/spec'; +export * from './TSAbstractMethodDefinition/spec'; +export * from './TSCallSignatureDeclaration/spec'; +export * from './TSConstructSignatureDeclaration/spec'; +export * from './TSEnumMember/spec'; +export * from './TSIndexSignature/spec'; +export * from './TSMethodSignature/spec'; +export * from './TSPropertySignature/spec'; diff --git a/packages/ast-spec/src/expression/ArrayExpression/spec.ts b/packages/ast-spec/src/expression/ArrayExpression/spec.ts new file mode 100644 index 000000000000..7da330e231a4 --- /dev/null +++ b/packages/ast-spec/src/expression/ArrayExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ArrayExpression extends BaseNode { + type: AST_NODE_TYPES.ArrayExpression; + elements: Expression[]; +} diff --git a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts new file mode 100644 index 000000000000..347ee8541371 --- /dev/null +++ b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts @@ -0,0 +1,19 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDeclaration/spec'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; +import type { Expression } from '../../unions/Expression'; +import type { Parameter } from '../../unions/Parameter'; + +export interface ArrowFunctionExpression extends BaseNode { + type: AST_NODE_TYPES.ArrowFunctionExpression; + generator: boolean; + id: null; + params: Parameter[]; + body: BlockStatement | Expression; + async: boolean; + expression: boolean; + returnType?: TSTypeAnnotation; + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/expression/AssignmentExpression/spec.ts b/packages/ast-spec/src/expression/AssignmentExpression/spec.ts new file mode 100644 index 000000000000..8d76be21bdcc --- /dev/null +++ b/packages/ast-spec/src/expression/AssignmentExpression/spec.ts @@ -0,0 +1,23 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface AssignmentExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.AssignmentExpression; + operator: + | '-=' + | '??=' + | '**=' + | '*=' + | '/=' + | '&&=' + | '&=' + | '%=' + | '^=' + | '+=' + | '<<=' + | '=' + | '>>=' + | '>>>=' + | '|=' + | '||='; +} diff --git a/packages/ast-spec/src/expression/AwaitExpression/spec.ts b/packages/ast-spec/src/expression/AwaitExpression/spec.ts new file mode 100644 index 000000000000..248e371e871b --- /dev/null +++ b/packages/ast-spec/src/expression/AwaitExpression/spec.ts @@ -0,0 +1,16 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { TSTypeAssertion } from '../TSTypeAssertion/spec'; +import type { UnaryExpression } from '../UnaryExpression/spec'; +import type { UpdateExpression } from '../UpdateExpression/spec'; + +export interface AwaitExpression extends BaseNode { + type: AST_NODE_TYPES.AwaitExpression; + argument: + | AwaitExpression + | LeftHandSideExpression + | TSTypeAssertion + | UnaryExpression + | UpdateExpression; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/spec.ts b/packages/ast-spec/src/expression/BinaryExpression/spec.ts new file mode 100644 index 000000000000..5df33cc3e16a --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface BinaryExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.BinaryExpression; +} diff --git a/packages/ast-spec/src/expression/CallExpression/spec.ts b/packages/ast-spec/src/expression/CallExpression/spec.ts new file mode 100644 index 000000000000..bd71773a1be8 --- /dev/null +++ b/packages/ast-spec/src/expression/CallExpression/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { CallExpressionArgument } from '../../unions/CallExpressionArgument'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface CallExpression extends BaseNode { + type: AST_NODE_TYPES.CallExpression; + callee: LeftHandSideExpression; + arguments: CallExpressionArgument[]; + typeParameters?: TSTypeParameterInstantiation; + optional: boolean; +} diff --git a/packages/ast-spec/src/expression/ChainExpression/spec.ts b/packages/ast-spec/src/expression/ChainExpression/spec.ts new file mode 100644 index 000000000000..dfad50f3580f --- /dev/null +++ b/packages/ast-spec/src/expression/ChainExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ChainElement } from '../../unions/ChainElement'; + +export interface ChainExpression extends BaseNode { + type: AST_NODE_TYPES.ChainExpression; + expression: ChainElement; +} diff --git a/packages/ast-spec/src/expression/ClassExpression/spec.ts b/packages/ast-spec/src/expression/ClassExpression/spec.ts new file mode 100644 index 000000000000..15215c31f1b6 --- /dev/null +++ b/packages/ast-spec/src/expression/ClassExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; + +export interface ClassExpression extends ClassDeclarationBase { + type: AST_NODE_TYPES.ClassExpression; +} diff --git a/packages/ast-spec/src/expression/ConditionalExpression/spec.ts b/packages/ast-spec/src/expression/ConditionalExpression/spec.ts new file mode 100644 index 000000000000..545fc9497b77 --- /dev/null +++ b/packages/ast-spec/src/expression/ConditionalExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ConditionalExpression extends BaseNode { + type: AST_NODE_TYPES.ConditionalExpression; + test: Expression; + consequent: Expression; + alternate: Expression; +} diff --git a/packages/ast-spec/src/expression/FunctionExpression/spec.ts b/packages/ast-spec/src/expression/FunctionExpression/spec.ts new file mode 100644 index 000000000000..111be168b024 --- /dev/null +++ b/packages/ast-spec/src/expression/FunctionExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; + +export interface FunctionExpression extends FunctionDeclarationBase { + type: AST_NODE_TYPES.FunctionExpression; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/expression/Identifier/spec.ts b/packages/ast-spec/src/expression/Identifier/spec.ts new file mode 100644 index 000000000000..384922a061a1 --- /dev/null +++ b/packages/ast-spec/src/expression/Identifier/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; + +export interface Identifier extends BaseNode { + type: AST_NODE_TYPES.Identifier; + name: string; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/expression/ImportExpression/spec.ts b/packages/ast-spec/src/expression/ImportExpression/spec.ts new file mode 100644 index 000000000000..c381802571a6 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ImportExpression extends BaseNode { + type: AST_NODE_TYPES.ImportExpression; + source: Expression; +} diff --git a/packages/ast-spec/src/expression/JSXElement/spec.ts b/packages/ast-spec/src/expression/JSXElement/spec.ts new file mode 100644 index 000000000000..32a514f677a3 --- /dev/null +++ b/packages/ast-spec/src/expression/JSXElement/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXClosingElement } from '../../jsx/JSXClosingElement/spec'; +import type { JSXOpeningElement } from '../../jsx/JSXOpeningElement/spec'; +import type { JSXChild } from '../../unions/JSXChild'; + +export interface JSXElement extends BaseNode { + type: AST_NODE_TYPES.JSXElement; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement | null; + children: JSXChild[]; +} diff --git a/packages/ast-spec/src/expression/JSXFragment/spec.ts b/packages/ast-spec/src/expression/JSXFragment/spec.ts new file mode 100644 index 000000000000..9adce12ada58 --- /dev/null +++ b/packages/ast-spec/src/expression/JSXFragment/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXClosingFragment } from '../../jsx/JSXClosingFragment/spec'; +import type { JSXOpeningFragment } from '../../jsx/JSXOpeningFragment/spec'; +import type { JSXChild } from '../../unions/JSXChild'; + +export interface JSXFragment extends BaseNode { + type: AST_NODE_TYPES.JSXFragment; + openingFragment: JSXOpeningFragment; + closingFragment: JSXClosingFragment; + children: JSXChild[]; +} diff --git a/packages/ast-spec/src/expression/LogicalExpression/spec.ts b/packages/ast-spec/src/expression/LogicalExpression/spec.ts new file mode 100644 index 000000000000..a9bd50e1dfe1 --- /dev/null +++ b/packages/ast-spec/src/expression/LogicalExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BinaryExpressionBase } from '../../base/BinaryExpressionBase'; + +export interface LogicalExpression extends BinaryExpressionBase { + type: AST_NODE_TYPES.LogicalExpression; +} diff --git a/packages/ast-spec/src/expression/MemberExpression/spec.ts b/packages/ast-spec/src/expression/MemberExpression/spec.ts new file mode 100644 index 000000000000..92bad8cf3dc3 --- /dev/null +++ b/packages/ast-spec/src/expression/MemberExpression/spec.ts @@ -0,0 +1,28 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { Identifier } from '../Identifier/spec'; + +interface MemberExpressionBase extends BaseNode { + object: LeftHandSideExpression; + property: Expression | Identifier; + computed: boolean; + optional: boolean; +} + +export interface MemberExpressionComputedName extends MemberExpressionBase { + type: AST_NODE_TYPES.MemberExpression; + property: Expression; + computed: true; +} + +export interface MemberExpressionNonComputedName extends MemberExpressionBase { + type: AST_NODE_TYPES.MemberExpression; + property: Identifier; + computed: false; +} + +export type MemberExpression = + | MemberExpressionComputedName + | MemberExpressionNonComputedName; diff --git a/packages/ast-spec/src/expression/MetaProperty/spec.ts b/packages/ast-spec/src/expression/MetaProperty/spec.ts new file mode 100644 index 000000000000..5bc9afb81113 --- /dev/null +++ b/packages/ast-spec/src/expression/MetaProperty/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../Identifier/spec'; + +export interface MetaProperty extends BaseNode { + type: AST_NODE_TYPES.MetaProperty; + meta: Identifier; + property: Identifier; +} diff --git a/packages/ast-spec/src/expression/NewExpression/spec.ts b/packages/ast-spec/src/expression/NewExpression/spec.ts new file mode 100644 index 000000000000..bb75ae3f4b8f --- /dev/null +++ b/packages/ast-spec/src/expression/NewExpression/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { Expression } from '../../unions/Expression'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface NewExpression extends BaseNode { + type: AST_NODE_TYPES.NewExpression; + callee: LeftHandSideExpression; + arguments: Expression[]; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/expression/ObjectExpression/spec.ts b/packages/ast-spec/src/expression/ObjectExpression/spec.ts new file mode 100644 index 000000000000..0573a2a76faf --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ObjectLiteralElement } from '../../unions/ObjectLiteralElement'; + +export interface ObjectExpression extends BaseNode { + type: AST_NODE_TYPES.ObjectExpression; + properties: ObjectLiteralElement[]; +} diff --git a/packages/ast-spec/src/expression/SequenceExpression/spec.ts b/packages/ast-spec/src/expression/SequenceExpression/spec.ts new file mode 100644 index 000000000000..fa571adb4f08 --- /dev/null +++ b/packages/ast-spec/src/expression/SequenceExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface SequenceExpression extends BaseNode { + type: AST_NODE_TYPES.SequenceExpression; + expressions: Expression[]; +} diff --git a/packages/ast-spec/src/expression/Super/spec.ts b/packages/ast-spec/src/expression/Super/spec.ts new file mode 100644 index 000000000000..eb310620d8ed --- /dev/null +++ b/packages/ast-spec/src/expression/Super/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface Super extends BaseNode { + type: AST_NODE_TYPES.Super; +} diff --git a/packages/ast-spec/src/expression/TSAsExpression/spec.ts b/packages/ast-spec/src/expression/TSAsExpression/spec.ts new file mode 100644 index 000000000000..b90925a53ca7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSAsExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSAsExpression extends BaseNode { + type: AST_NODE_TYPES.TSAsExpression; + expression: Expression; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts new file mode 100644 index 000000000000..2cc413c01095 --- /dev/null +++ b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; + +export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { + type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; + body: null; +} diff --git a/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts b/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts new file mode 100644 index 000000000000..fd25d33d372f --- /dev/null +++ b/packages/ast-spec/src/expression/TSNonNullExpression/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSNonNullExpression extends BaseNode { + type: AST_NODE_TYPES.TSNonNullExpression; + expression: Expression; +} diff --git a/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts b/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts new file mode 100644 index 000000000000..d820f8fcc378 --- /dev/null +++ b/packages/ast-spec/src/expression/TSTypeAssertion/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAssertion extends BaseNode { + type: AST_NODE_TYPES.TSTypeAssertion; + typeAnnotation: TypeNode; + expression: Expression; +} diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts new file mode 100644 index 000000000000..e3438484d9dd --- /dev/null +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; +import type { TemplateLiteral } from '../TemplateLiteral/spec'; + +export interface TaggedTemplateExpression extends BaseNode { + type: AST_NODE_TYPES.TaggedTemplateExpression; + typeParameters?: TSTypeParameterInstantiation; + tag: LeftHandSideExpression; + quasi: TemplateLiteral; +} diff --git a/packages/ast-spec/src/expression/TemplateLiteral/spec.ts b/packages/ast-spec/src/expression/TemplateLiteral/spec.ts new file mode 100644 index 000000000000..4d92ef79176d --- /dev/null +++ b/packages/ast-spec/src/expression/TemplateLiteral/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TemplateElement } from '../../special/TemplateElement/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface TemplateLiteral extends BaseNode { + type: AST_NODE_TYPES.TemplateLiteral; + quasis: TemplateElement[]; + expressions: Expression[]; +} diff --git a/packages/ast-spec/src/expression/ThisExpression/spec.ts b/packages/ast-spec/src/expression/ThisExpression/spec.ts new file mode 100644 index 000000000000..63b5a213a883 --- /dev/null +++ b/packages/ast-spec/src/expression/ThisExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface ThisExpression extends BaseNode { + type: AST_NODE_TYPES.ThisExpression; +} diff --git a/packages/ast-spec/src/expression/UnaryExpression/spec.ts b/packages/ast-spec/src/expression/UnaryExpression/spec.ts new file mode 100644 index 000000000000..26ec8a0e9cdf --- /dev/null +++ b/packages/ast-spec/src/expression/UnaryExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { UnaryExpressionBase } from '../../base/UnaryExpressionBase'; + +export interface UnaryExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UnaryExpression; + operator: '-' | '!' | '+' | '~' | 'delete' | 'typeof' | 'void'; +} diff --git a/packages/ast-spec/src/expression/UpdateExpression/spec.ts b/packages/ast-spec/src/expression/UpdateExpression/spec.ts new file mode 100644 index 000000000000..909815fdabf3 --- /dev/null +++ b/packages/ast-spec/src/expression/UpdateExpression/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { UnaryExpressionBase } from '../../base/UnaryExpressionBase'; + +export interface UpdateExpression extends UnaryExpressionBase { + type: AST_NODE_TYPES.UpdateExpression; + operator: '--' | '++'; +} diff --git a/packages/ast-spec/src/expression/YieldExpression/spec.ts b/packages/ast-spec/src/expression/YieldExpression/spec.ts new file mode 100644 index 000000000000..1f07e4f78e32 --- /dev/null +++ b/packages/ast-spec/src/expression/YieldExpression/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface YieldExpression extends BaseNode { + type: AST_NODE_TYPES.YieldExpression; + delegate: boolean; + argument?: Expression; +} diff --git a/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts b/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts new file mode 100644 index 000000000000..c27a85543ff8 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/BigIntLiteral/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface BigIntLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: bigint | null; + bigint: string; +} diff --git a/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts b/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts new file mode 100644 index 000000000000..a2310a698d02 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/BooleanLiteral/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface BooleanLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: boolean; + raw: 'false' | 'true'; +} diff --git a/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts b/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts new file mode 100644 index 000000000000..f520b7b3d454 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/NullLiteral/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface NullLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: null; + raw: 'null'; +} diff --git a/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts b/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts new file mode 100644 index 000000000000..8155bb45cafc --- /dev/null +++ b/packages/ast-spec/src/expression/literal/NumberLiteral/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface NumberLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: number; +} diff --git a/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts b/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts new file mode 100644 index 000000000000..ab45f651b768 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/RegExpLiteral/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface RegExpLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: RegExp | null; + regex: { + pattern: string; + flags: string; + }; +} diff --git a/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts b/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts new file mode 100644 index 000000000000..de83d9d20e1d --- /dev/null +++ b/packages/ast-spec/src/expression/literal/StringLiteral/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../../ast-node-types'; +import type { LiteralBase } from '../../../base/LiteralBase'; + +export interface StringLiteral extends LiteralBase { + type: AST_NODE_TYPES.Literal; + value: string; +} diff --git a/packages/ast-spec/src/expression/literal/spec.ts b/packages/ast-spec/src/expression/literal/spec.ts new file mode 100644 index 000000000000..d40804b424e1 --- /dev/null +++ b/packages/ast-spec/src/expression/literal/spec.ts @@ -0,0 +1,6 @@ +export * from './BigIntLiteral/spec'; +export * from './BooleanLiteral/spec'; +export * from './NullLiteral/spec'; +export * from './NumberLiteral/spec'; +export * from './RegExpLiteral/spec'; +export * from './StringLiteral/spec'; diff --git a/packages/ast-spec/src/expression/spec.ts b/packages/ast-spec/src/expression/spec.ts new file mode 100644 index 000000000000..9ea054546202 --- /dev/null +++ b/packages/ast-spec/src/expression/spec.ts @@ -0,0 +1,33 @@ +export * from './ArrayExpression/spec'; +export * from './ArrowFunctionExpression/spec'; +export * from './AssignmentExpression/spec'; +export * from './AwaitExpression/spec'; +export * from './BinaryExpression/spec'; +export * from './CallExpression/spec'; +export * from './ChainExpression/spec'; +export * from './ClassExpression/spec'; +export * from './ConditionalExpression/spec'; +export * from './FunctionExpression/spec'; +export * from './Identifier/spec'; +export * from './ImportExpression/spec'; +export * from './JSXElement/spec'; +export * from './JSXFragment/spec'; +export * from './LogicalExpression/spec'; +export * from './MemberExpression/spec'; +export * from './MetaProperty/spec'; +export * from './NewExpression/spec'; +export * from './ObjectExpression/spec'; +export * from './SequenceExpression/spec'; +export * from './Super/spec'; +export * from './TSAsExpression/spec'; +export * from './TSEmptyBodyFunctionExpression/spec'; +export * from './TSNonNullExpression/spec'; +export * from './TSTypeAssertion/spec'; +export * from './TaggedTemplateExpression/spec'; +export * from './TemplateLiteral/spec'; +export * from './ThisExpression/spec'; +export * from './UnaryExpression/spec'; +export * from './UpdateExpression/spec'; +export * from './YieldExpression/spec'; + +export * from './literal/spec'; diff --git a/packages/ast-spec/src/index.ts b/packages/ast-spec/src/index.ts new file mode 100644 index 000000000000..bd4b6584482d --- /dev/null +++ b/packages/ast-spec/src/index.ts @@ -0,0 +1,52 @@ +export * from './base/Accessibility'; +export * from './base/BaseNode'; // this is exported so that the `types` package can merge the decl and add the `parent` property +export * from './base/OptionalRangeAndLoc'; +export * from './base/LineAndColumnData'; +export * from './base/Range'; +export * from './base/SourceLocation'; + +export * from './unions/BindingName'; +export * from './unions/BindingPattern'; +export * from './unions/CallExpressionArgument'; +export * from './unions/ChainElement'; +export * from './unions/ClassElement'; +export * from './unions/Comment'; +export * from './unions/DeclarationStatement'; +export * from './unions/DestructuringPattern'; +export * from './unions/EntityName'; +export * from './unions/ExportDeclaration'; +export * from './unions/Expression'; +export * from './unions/ForInitialiser'; +export * from './unions/FunctionLike'; +export * from './unions/ImportClause'; +export * from './unions/IterationStatement'; +export * from './unions/JSXChild'; +export * from './unions/JSXExpression'; +export * from './unions/JSXTagNameExpression'; +export * from './unions/LeftHandSideExpression'; +export * from './unions/Literal'; +export * from './unions/LiteralExpression'; +export * from './unions/Modifier'; +export * from './unions/Node'; +export * from './unions/ObjectLiteralElement'; +export * from './unions/Parameter'; +export * from './unions/PrimaryExpression'; +export * from './unions/PropertyName'; +export * from './unions/Statement'; +export * from './unions/TSUnaryExpression'; +export * from './unions/Token'; +export * from './unions/TypeElement'; +export * from './unions/TypeNode'; + +export * from './declaration/spec'; +export * from './element/spec'; +export * from './expression/spec'; +export * from './jsx/spec'; +export * from './parameter/spec'; +export * from './special/spec'; +export * from './statement/spec'; +export * from './token/spec'; +export * from './type/spec'; + +export * from './ast-node-types'; +export * from './ast-token-types'; diff --git a/packages/ast-spec/src/jsx/JSXAttribute/spec.ts b/packages/ast-spec/src/jsx/JSXAttribute/spec.ts new file mode 100644 index 000000000000..8fc8364c05fd --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXAttribute/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXExpression } from '../../unions/JSXExpression'; +import type { Literal } from '../../unions/Literal'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; +import type { JSXNamespacedName } from '../JSXNamespacedName/spec'; + +export interface JSXAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXAttribute; + name: JSXIdentifier | JSXNamespacedName; + value: JSXExpression | Literal | null; +} diff --git a/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts b/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts new file mode 100644 index 000000000000..ea698d6059ed --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXClosingElement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; + +export interface JSXClosingElement extends BaseNode { + type: AST_NODE_TYPES.JSXClosingElement; + name: JSXTagNameExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts b/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts new file mode 100644 index 000000000000..8edd7c4e958f --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXClosingFragment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXClosingFragment extends BaseNode { + type: AST_NODE_TYPES.JSXClosingFragment; +} diff --git a/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts b/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts new file mode 100644 index 000000000000..36e3c16069c4 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXEmptyExpression/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXEmptyExpression extends BaseNode { + type: AST_NODE_TYPES.JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts b/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts new file mode 100644 index 000000000000..1a0673e6fd15 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXExpressionContainer/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { JSXEmptyExpression } from '../JSXEmptyExpression/spec'; + +export interface JSXExpressionContainer extends BaseNode { + type: AST_NODE_TYPES.JSXExpressionContainer; + expression: Expression | JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts b/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts new file mode 100644 index 000000000000..1d7b71d67ab0 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXIdentifier/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXIdentifier extends BaseNode { + type: AST_NODE_TYPES.JSXIdentifier; + name: string; +} diff --git a/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts b/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts new file mode 100644 index 000000000000..e0cda9c16ee4 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXMemberExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; + +export interface JSXMemberExpression extends BaseNode { + type: AST_NODE_TYPES.JSXMemberExpression; + object: JSXTagNameExpression; + property: JSXIdentifier; +} diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts b/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts new file mode 100644 index 000000000000..22443d938eca --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { JSXIdentifier } from '../JSXIdentifier/spec'; + +export interface JSXNamespacedName extends BaseNode { + type: AST_NODE_TYPES.JSXNamespacedName; + namespace: JSXIdentifier; + name: JSXIdentifier; +} diff --git a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts new file mode 100644 index 000000000000..710fade02fa5 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { JSXTagNameExpression } from '../../unions/JSXTagNameExpression'; +import type { JSXAttribute } from '../JSXAttribute/spec'; +import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec'; + +export interface JSXOpeningElement extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningElement; + typeParameters?: TSTypeParameterInstantiation; + selfClosing: boolean; + name: JSXTagNameExpression; + attributes: (JSXAttribute | JSXSpreadAttribute)[]; +} diff --git a/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts new file mode 100644 index 000000000000..9b972a237f22 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXOpeningFragment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXOpeningFragment extends BaseNode { + type: AST_NODE_TYPES.JSXOpeningFragment; +} diff --git a/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts b/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts new file mode 100644 index 000000000000..db6e6fc1d1bc --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXSpreadAttribute/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface JSXSpreadAttribute extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadAttribute; + argument: Expression; +} diff --git a/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts b/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts new file mode 100644 index 000000000000..53fe53555c30 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXSpreadChild/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { JSXEmptyExpression } from '../JSXEmptyExpression/spec'; + +export interface JSXSpreadChild extends BaseNode { + type: AST_NODE_TYPES.JSXSpreadChild; + expression: Expression | JSXEmptyExpression; +} diff --git a/packages/ast-spec/src/jsx/JSXText/spec.ts b/packages/ast-spec/src/jsx/JSXText/spec.ts new file mode 100644 index 000000000000..a323493fba90 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXText/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface JSXText extends BaseNode { + type: AST_NODE_TYPES.JSXText; + value: string; + raw: string; +} diff --git a/packages/ast-spec/src/jsx/spec.ts b/packages/ast-spec/src/jsx/spec.ts new file mode 100644 index 000000000000..1efb134bed7f --- /dev/null +++ b/packages/ast-spec/src/jsx/spec.ts @@ -0,0 +1,13 @@ +export * from './JSXAttribute/spec'; +export * from './JSXClosingElement/spec'; +export * from './JSXClosingFragment/spec'; +export * from './JSXEmptyExpression/spec'; +export * from './JSXExpressionContainer/spec'; +export * from './JSXIdentifier/spec'; +export * from './JSXMemberExpression/spec'; +export * from './JSXNamespacedName/spec'; +export * from './JSXOpeningElement/spec'; +export * from './JSXOpeningFragment/spec'; +export * from './JSXSpreadAttribute/spec'; +export * from './JSXSpreadChild/spec'; +export * from './JSXText/spec'; diff --git a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts new file mode 100644 index 000000000000..420a93278731 --- /dev/null +++ b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { DestructuringPattern } from '../../unions/DestructuringPattern'; + +export interface ArrayPattern extends BaseNode { + type: AST_NODE_TYPES.ArrayPattern; + elements: (DestructuringPattern | null)[]; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts new file mode 100644 index 000000000000..ee558c2167c2 --- /dev/null +++ b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts @@ -0,0 +1,15 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; + +export interface AssignmentPattern extends BaseNode { + type: AST_NODE_TYPES.AssignmentPattern; + left: BindingName; + right: Expression; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts new file mode 100644 index 000000000000..12c89878794e --- /dev/null +++ b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts @@ -0,0 +1,14 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Property } from '../../element/Property/spec'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { RestElement } from '../RestElement/spec'; + +export interface ObjectPattern extends BaseNode { + type: AST_NODE_TYPES.ObjectPattern; + properties: (Property | RestElement)[]; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/RestElement/spec.ts b/packages/ast-spec/src/parameter/RestElement/spec.ts new file mode 100644 index 000000000000..006f5e48ba3b --- /dev/null +++ b/packages/ast-spec/src/parameter/RestElement/spec.ts @@ -0,0 +1,15 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { DestructuringPattern } from '../../unions/DestructuringPattern'; +import type { AssignmentPattern } from '../AssignmentPattern/spec'; + +export interface RestElement extends BaseNode { + type: AST_NODE_TYPES.RestElement; + argument: DestructuringPattern; + typeAnnotation?: TSTypeAnnotation; + optional?: boolean; + value?: AssignmentPattern; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts new file mode 100644 index 000000000000..d04e49fd98b8 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts @@ -0,0 +1,17 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { Accessibility } from '../../base/Accessibility'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Decorator } from '../../special/Decorator/spec'; +import type { BindingName } from '../../unions/BindingName'; +import type { AssignmentPattern } from '../AssignmentPattern/spec'; +import type { RestElement } from '../RestElement/spec'; + +export interface TSParameterProperty extends BaseNode { + type: AST_NODE_TYPES.TSParameterProperty; + accessibility?: Accessibility; + readonly?: boolean; + static?: boolean; + export?: boolean; + parameter: AssignmentPattern | BindingName | RestElement; + decorators?: Decorator[]; +} diff --git a/packages/ast-spec/src/parameter/spec.ts b/packages/ast-spec/src/parameter/spec.ts new file mode 100644 index 000000000000..b006664a36ae --- /dev/null +++ b/packages/ast-spec/src/parameter/spec.ts @@ -0,0 +1,5 @@ +export * from './ArrayPattern/spec'; +export * from './AssignmentPattern/spec'; +export * from './ObjectPattern/spec'; +export * from './RestElement/spec'; +export * from './TSParameterProperty/spec'; diff --git a/packages/ast-spec/src/special/CatchClause/spec.ts b/packages/ast-spec/src/special/CatchClause/spec.ts new file mode 100644 index 000000000000..dea8168acda0 --- /dev/null +++ b/packages/ast-spec/src/special/CatchClause/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; +import type { BindingName } from '../../unions/BindingName'; + +export interface CatchClause extends BaseNode { + type: AST_NODE_TYPES.CatchClause; + param: BindingName | null; + body: BlockStatement; +} diff --git a/packages/ast-spec/src/special/ClassBody/spec.ts b/packages/ast-spec/src/special/ClassBody/spec.ts new file mode 100644 index 000000000000..11c93d540fb3 --- /dev/null +++ b/packages/ast-spec/src/special/ClassBody/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ClassElement } from '../../unions/ClassElement'; + +export interface ClassBody extends BaseNode { + type: AST_NODE_TYPES.ClassBody; + body: ClassElement[]; +} diff --git a/packages/ast-spec/src/special/Decorator/spec.ts b/packages/ast-spec/src/special/Decorator/spec.ts new file mode 100644 index 000000000000..3c8d1e819042 --- /dev/null +++ b/packages/ast-spec/src/special/Decorator/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { LeftHandSideExpression } from '../../unions/LeftHandSideExpression'; + +export interface Decorator extends BaseNode { + type: AST_NODE_TYPES.Decorator; + expression: LeftHandSideExpression; +} diff --git a/packages/ast-spec/src/special/EmptyStatement/spec.ts b/packages/ast-spec/src/special/EmptyStatement/spec.ts new file mode 100644 index 000000000000..530283d3bdc1 --- /dev/null +++ b/packages/ast-spec/src/special/EmptyStatement/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface EmptyStatement extends BaseNode { + type: AST_NODE_TYPES.EmptyStatement; +} diff --git a/packages/ast-spec/src/special/ExportSpecifier/spec.ts b/packages/ast-spec/src/special/ExportSpecifier/spec.ts new file mode 100644 index 000000000000..8fd038e92be6 --- /dev/null +++ b/packages/ast-spec/src/special/ExportSpecifier/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ExportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ExportSpecifier; + local: Identifier; + exported: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts b/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts new file mode 100644 index 000000000000..c4ad22f20340 --- /dev/null +++ b/packages/ast-spec/src/special/ImportDefaultSpecifier/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportDefaultSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportDefaultSpecifier; + local: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts b/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts new file mode 100644 index 000000000000..eec79636f1fc --- /dev/null +++ b/packages/ast-spec/src/special/ImportNamespaceSpecifier/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportNamespaceSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportNamespaceSpecifier; + local: Identifier; +} diff --git a/packages/ast-spec/src/special/ImportSpecifier/spec.ts b/packages/ast-spec/src/special/ImportSpecifier/spec.ts new file mode 100644 index 000000000000..326df7db6b65 --- /dev/null +++ b/packages/ast-spec/src/special/ImportSpecifier/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ImportSpecifier extends BaseNode { + type: AST_NODE_TYPES.ImportSpecifier; + local: Identifier; + imported: Identifier; +} diff --git a/packages/ast-spec/src/special/Program/spec.ts b/packages/ast-spec/src/special/Program/spec.ts new file mode 100644 index 000000000000..81d69e1e604d --- /dev/null +++ b/packages/ast-spec/src/special/Program/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Comment } from '../../unions/Comment'; +import type { ProgramStatement } from '../../unions/Statement'; +import type { Token } from '../../unions/Token'; + +export interface Program extends BaseNode { + type: AST_NODE_TYPES.Program; + body: ProgramStatement[]; + sourceType: 'module' | 'script'; + comments?: Comment[]; + tokens?: Token[]; +} diff --git a/packages/ast-spec/src/special/SwitchCase/spec.ts b/packages/ast-spec/src/special/SwitchCase/spec.ts new file mode 100644 index 000000000000..f48f323536a4 --- /dev/null +++ b/packages/ast-spec/src/special/SwitchCase/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface SwitchCase extends BaseNode { + type: AST_NODE_TYPES.SwitchCase; + test: Expression | null; + consequent: Statement[]; +} diff --git a/packages/ast-spec/src/special/TSClassImplements/spec.ts b/packages/ast-spec/src/special/TSClassImplements/spec.ts new file mode 100644 index 000000000000..98213713edc4 --- /dev/null +++ b/packages/ast-spec/src/special/TSClassImplements/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSHeritageBase } from '../../base/TSHeritageBase'; + +export interface TSClassImplements extends TSHeritageBase { + type: AST_NODE_TYPES.TSClassImplements; +} diff --git a/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts new file mode 100644 index 000000000000..e634d4d0d6e9 --- /dev/null +++ b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSExternalModuleReference extends BaseNode { + type: AST_NODE_TYPES.TSExternalModuleReference; + expression: Expression; +} diff --git a/packages/ast-spec/src/special/TSInterfaceBody/spec.ts b/packages/ast-spec/src/special/TSInterfaceBody/spec.ts new file mode 100644 index 000000000000..1ee1c901c14d --- /dev/null +++ b/packages/ast-spec/src/special/TSInterfaceBody/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeElement } from '../../unions/TypeElement'; + +export interface TSInterfaceBody extends BaseNode { + type: AST_NODE_TYPES.TSInterfaceBody; + body: TypeElement[]; +} diff --git a/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts b/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts new file mode 100644 index 000000000000..29382acd5460 --- /dev/null +++ b/packages/ast-spec/src/special/TSInterfaceHeritage/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSHeritageBase } from '../../base/TSHeritageBase'; + +export interface TSInterfaceHeritage extends TSHeritageBase { + type: AST_NODE_TYPES.TSInterfaceHeritage; +} diff --git a/packages/ast-spec/src/special/TSModuleBlock/spec.ts b/packages/ast-spec/src/special/TSModuleBlock/spec.ts new file mode 100644 index 000000000000..9fed19af3b80 --- /dev/null +++ b/packages/ast-spec/src/special/TSModuleBlock/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ProgramStatement } from '../../unions/Statement'; + +export interface TSModuleBlock extends BaseNode { + type: AST_NODE_TYPES.TSModuleBlock; + body: ProgramStatement[]; +} diff --git a/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts b/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts new file mode 100644 index 000000000000..bb9272353cbc --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeAnnotation/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeAnnotation extends BaseNode { + type: AST_NODE_TYPES.TSTypeAnnotation; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/special/TSTypeParameter/spec.ts b/packages/ast-spec/src/special/TSTypeParameter/spec.ts new file mode 100644 index 000000000000..61d75a6a29ed --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameter/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeParameter extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameter; + name: Identifier; + constraint?: TypeNode; + default?: TypeNode; +} diff --git a/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts b/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts new file mode 100644 index 000000000000..ac8971e38a0c --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameterDeclaration/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../TSTypeParameter/spec'; + +export interface TSTypeParameterDeclaration extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterDeclaration; + params: TSTypeParameter[]; +} diff --git a/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts b/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts new file mode 100644 index 000000000000..e5122c2f6a5c --- /dev/null +++ b/packages/ast-spec/src/special/TSTypeParameterInstantiation/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeParameterInstantiation extends BaseNode { + type: AST_NODE_TYPES.TSTypeParameterInstantiation; + params: TypeNode[]; +} diff --git a/packages/ast-spec/src/special/TemplateElement/spec.ts b/packages/ast-spec/src/special/TemplateElement/spec.ts new file mode 100644 index 000000000000..abf4dc910457 --- /dev/null +++ b/packages/ast-spec/src/special/TemplateElement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TemplateElement extends BaseNode { + type: AST_NODE_TYPES.TemplateElement; + value: { + raw: string; + cooked: string; + }; + tail: boolean; +} diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts new file mode 100644 index 000000000000..619c6a57d5dc --- /dev/null +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { BindingName } from '../../unions/BindingName'; +import type { Expression } from '../../unions/Expression'; + +export interface VariableDeclarator extends BaseNode { + type: AST_NODE_TYPES.VariableDeclarator; + id: BindingName; + init: Expression | null; + definite?: boolean; +} diff --git a/packages/ast-spec/src/special/spec.ts b/packages/ast-spec/src/special/spec.ts new file mode 100644 index 000000000000..07142e15c8f9 --- /dev/null +++ b/packages/ast-spec/src/special/spec.ts @@ -0,0 +1,21 @@ +export * from './CatchClause/spec'; +export * from './ClassBody/spec'; +export * from './Decorator/spec'; +export * from './EmptyStatement/spec'; +export * from './ExportSpecifier/spec'; +export * from './ImportDefaultSpecifier/spec'; +export * from './ImportNamespaceSpecifier/spec'; +export * from './ImportSpecifier/spec'; +export * from './Program/spec'; +export * from './SwitchCase/spec'; +export * from './TSClassImplements/spec'; +export * from './TSExternalModuleReference/spec'; +export * from './TSInterfaceBody/spec'; +export * from './TSInterfaceHeritage/spec'; +export * from './TSModuleBlock/spec'; +export * from './TSTypeAnnotation/spec'; +export * from './TSTypeParameter/spec'; +export * from './TSTypeParameterDeclaration/spec'; +export * from './TSTypeParameterInstantiation/spec'; +export * from './TemplateElement/spec'; +export * from './VariableDeclarator/spec'; diff --git a/packages/ast-spec/src/statement/BlockStatement/spec.ts b/packages/ast-spec/src/statement/BlockStatement/spec.ts new file mode 100644 index 000000000000..298a962e5161 --- /dev/null +++ b/packages/ast-spec/src/statement/BlockStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Statement } from '../../unions/Statement'; + +export interface BlockStatement extends BaseNode { + type: AST_NODE_TYPES.BlockStatement; + body: Statement[]; +} diff --git a/packages/ast-spec/src/statement/BreakStatement/spec.ts b/packages/ast-spec/src/statement/BreakStatement/spec.ts new file mode 100644 index 000000000000..0441c298d365 --- /dev/null +++ b/packages/ast-spec/src/statement/BreakStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface BreakStatement extends BaseNode { + type: AST_NODE_TYPES.BreakStatement; + label: Identifier | null; +} diff --git a/packages/ast-spec/src/statement/ContinueStatement/spec.ts b/packages/ast-spec/src/statement/ContinueStatement/spec.ts new file mode 100644 index 000000000000..70f2373dc217 --- /dev/null +++ b/packages/ast-spec/src/statement/ContinueStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; + +export interface ContinueStatement extends BaseNode { + type: AST_NODE_TYPES.ContinueStatement; + label: Identifier | null; +} diff --git a/packages/ast-spec/src/statement/DebuggerStatement/spec.ts b/packages/ast-spec/src/statement/DebuggerStatement/spec.ts new file mode 100644 index 000000000000..f28b7fc41b72 --- /dev/null +++ b/packages/ast-spec/src/statement/DebuggerStatement/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface DebuggerStatement extends BaseNode { + type: AST_NODE_TYPES.DebuggerStatement; +} diff --git a/packages/ast-spec/src/statement/DoWhileStatement/spec.ts b/packages/ast-spec/src/statement/DoWhileStatement/spec.ts new file mode 100644 index 000000000000..933ce61b2c4c --- /dev/null +++ b/packages/ast-spec/src/statement/DoWhileStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface DoWhileStatement extends BaseNode { + type: AST_NODE_TYPES.DoWhileStatement; + test: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts new file mode 100644 index 000000000000..f5fd336a9604 --- /dev/null +++ b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ExpressionStatement extends BaseNode { + type: AST_NODE_TYPES.ExpressionStatement; + expression: Expression; + directive?: string; +} diff --git a/packages/ast-spec/src/statement/ForInStatement/spec.ts b/packages/ast-spec/src/statement/ForInStatement/spec.ts new file mode 100644 index 000000000000..7abe3b2f5fad --- /dev/null +++ b/packages/ast-spec/src/statement/ForInStatement/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForInStatement extends BaseNode { + type: AST_NODE_TYPES.ForInStatement; + left: ForInitialiser; + right: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ForOfStatement/spec.ts b/packages/ast-spec/src/statement/ForOfStatement/spec.ts new file mode 100644 index 000000000000..963261eaaac8 --- /dev/null +++ b/packages/ast-spec/src/statement/ForOfStatement/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForOfStatement extends BaseNode { + type: AST_NODE_TYPES.ForOfStatement; + left: ForInitialiser; + right: Expression; + body: Statement; + await: boolean; +} diff --git a/packages/ast-spec/src/statement/ForStatement/spec.ts b/packages/ast-spec/src/statement/ForStatement/spec.ts new file mode 100644 index 000000000000..1b56756b3a50 --- /dev/null +++ b/packages/ast-spec/src/statement/ForStatement/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { ForInitialiser } from '../../unions/ForInitialiser'; +import type { Statement } from '../../unions/Statement'; + +export interface ForStatement extends BaseNode { + type: AST_NODE_TYPES.ForStatement; + init: Expression | ForInitialiser | null; + test: Expression | null; + update: Expression | null; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/IfStatement/spec.ts b/packages/ast-spec/src/statement/IfStatement/spec.ts new file mode 100644 index 000000000000..f9081923e64a --- /dev/null +++ b/packages/ast-spec/src/statement/IfStatement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface IfStatement extends BaseNode { + type: AST_NODE_TYPES.IfStatement; + test: Expression; + consequent: Statement; + alternate: Statement | null; +} diff --git a/packages/ast-spec/src/statement/ImportDeclaration/spec.ts b/packages/ast-spec/src/statement/ImportDeclaration/spec.ts new file mode 100644 index 000000000000..eaaad5f53e32 --- /dev/null +++ b/packages/ast-spec/src/statement/ImportDeclaration/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { ImportClause } from '../../unions/ImportClause'; +import type { Literal } from '../../unions/Literal'; + +export interface ImportDeclaration extends BaseNode { + type: AST_NODE_TYPES.ImportDeclaration; + source: Literal; + specifiers: ImportClause[]; + importKind: 'type' | 'value'; +} diff --git a/packages/ast-spec/src/statement/LabeledStatement/spec.ts b/packages/ast-spec/src/statement/LabeledStatement/spec.ts new file mode 100644 index 000000000000..d007008d3a4b --- /dev/null +++ b/packages/ast-spec/src/statement/LabeledStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { Statement } from '../../unions/Statement'; + +export interface LabeledStatement extends BaseNode { + type: AST_NODE_TYPES.LabeledStatement; + label: Identifier; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/ReturnStatement/spec.ts b/packages/ast-spec/src/statement/ReturnStatement/spec.ts new file mode 100644 index 000000000000..d7758715c8dd --- /dev/null +++ b/packages/ast-spec/src/statement/ReturnStatement/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface ReturnStatement extends BaseNode { + type: AST_NODE_TYPES.ReturnStatement; + argument: Expression | null; +} diff --git a/packages/ast-spec/src/statement/SwitchStatement/spec.ts b/packages/ast-spec/src/statement/SwitchStatement/spec.ts new file mode 100644 index 000000000000..9c76f81455c8 --- /dev/null +++ b/packages/ast-spec/src/statement/SwitchStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { SwitchCase } from '../../special/SwitchCase/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface SwitchStatement extends BaseNode { + type: AST_NODE_TYPES.SwitchStatement; + discriminant: Expression; + cases: SwitchCase[]; +} diff --git a/packages/ast-spec/src/statement/TSExportAssignment/spec.ts b/packages/ast-spec/src/statement/TSExportAssignment/spec.ts new file mode 100644 index 000000000000..3792bc5012b1 --- /dev/null +++ b/packages/ast-spec/src/statement/TSExportAssignment/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; + +export interface TSExportAssignment extends BaseNode { + type: AST_NODE_TYPES.TSExportAssignment; + expression: Expression; +} diff --git a/packages/ast-spec/src/statement/ThrowStatement/spec.ts b/packages/ast-spec/src/statement/ThrowStatement/spec.ts new file mode 100644 index 000000000000..ac47bd98778c --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSAsExpression } from '../../expression/TSAsExpression/spec'; +import type { Statement } from '../../unions/Statement'; + +export interface ThrowStatement extends BaseNode { + type: AST_NODE_TYPES.ThrowStatement; + argument: Statement | TSAsExpression | null; +} diff --git a/packages/ast-spec/src/statement/TryStatement/spec.ts b/packages/ast-spec/src/statement/TryStatement/spec.ts new file mode 100644 index 000000000000..0435fbeb2100 --- /dev/null +++ b/packages/ast-spec/src/statement/TryStatement/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { CatchClause } from '../../special/CatchClause/spec'; +import type { BlockStatement } from '../BlockStatement/spec'; + +export interface TryStatement extends BaseNode { + type: AST_NODE_TYPES.TryStatement; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement | null; +} diff --git a/packages/ast-spec/src/statement/WhileStatement/spec.ts b/packages/ast-spec/src/statement/WhileStatement/spec.ts new file mode 100644 index 000000000000..1c9492c77140 --- /dev/null +++ b/packages/ast-spec/src/statement/WhileStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface WhileStatement extends BaseNode { + type: AST_NODE_TYPES.WhileStatement; + test: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/WithStatement/spec.ts b/packages/ast-spec/src/statement/WithStatement/spec.ts new file mode 100644 index 000000000000..c661a5175b9a --- /dev/null +++ b/packages/ast-spec/src/statement/WithStatement/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { Statement } from '../../unions/Statement'; + +export interface WithStatement extends BaseNode { + type: AST_NODE_TYPES.WithStatement; + object: Expression; + body: Statement; +} diff --git a/packages/ast-spec/src/statement/spec.ts b/packages/ast-spec/src/statement/spec.ts new file mode 100644 index 000000000000..d1ce293283e4 --- /dev/null +++ b/packages/ast-spec/src/statement/spec.ts @@ -0,0 +1,19 @@ +export * from './BlockStatement/spec'; +export * from './BreakStatement/spec'; +export * from './ContinueStatement/spec'; +export * from './DebuggerStatement/spec'; +export * from './DoWhileStatement/spec'; +export * from './ExpressionStatement/spec'; +export * from './ForInStatement/spec'; +export * from './ForOfStatement/spec'; +export * from './ForStatement/spec'; +export * from './IfStatement/spec'; +export * from './ImportDeclaration/spec'; +export * from './LabeledStatement/spec'; +export * from './ReturnStatement/spec'; +export * from './SwitchStatement/spec'; +export * from './TSExportAssignment/spec'; +export * from './ThrowStatement/spec'; +export * from './TryStatement/spec'; +export * from './WhileStatement/spec'; +export * from './WithStatement/spec'; diff --git a/packages/ast-spec/src/token/BlockComment/spec.ts b/packages/ast-spec/src/token/BlockComment/spec.ts new file mode 100644 index 000000000000..c2c7db298a4f --- /dev/null +++ b/packages/ast-spec/src/token/BlockComment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface BlockComment extends BaseToken { + type: AST_TOKEN_TYPES.Block; +} diff --git a/packages/ast-spec/src/token/BooleanToken/spec.ts b/packages/ast-spec/src/token/BooleanToken/spec.ts new file mode 100644 index 000000000000..eeace18c8cd9 --- /dev/null +++ b/packages/ast-spec/src/token/BooleanToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface BooleanToken extends BaseToken { + type: AST_TOKEN_TYPES.Boolean; +} diff --git a/packages/ast-spec/src/token/IdentifierToken/spec.ts b/packages/ast-spec/src/token/IdentifierToken/spec.ts new file mode 100644 index 000000000000..9df6e14c3c99 --- /dev/null +++ b/packages/ast-spec/src/token/IdentifierToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface IdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.Identifier; +} diff --git a/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts b/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts new file mode 100644 index 000000000000..858775073735 --- /dev/null +++ b/packages/ast-spec/src/token/JSXIdentifierToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface JSXIdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXIdentifier; +} diff --git a/packages/ast-spec/src/token/JSXTextToken/spec.ts b/packages/ast-spec/src/token/JSXTextToken/spec.ts new file mode 100644 index 000000000000..6a8d3aa5d50d --- /dev/null +++ b/packages/ast-spec/src/token/JSXTextToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface JSXTextToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXText; +} diff --git a/packages/ast-spec/src/token/KeywordToken/spec.ts b/packages/ast-spec/src/token/KeywordToken/spec.ts new file mode 100644 index 000000000000..b7e9c058f692 --- /dev/null +++ b/packages/ast-spec/src/token/KeywordToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface KeywordToken extends BaseToken { + type: AST_TOKEN_TYPES.Keyword; +} diff --git a/packages/ast-spec/src/token/LineComment/spec.ts b/packages/ast-spec/src/token/LineComment/spec.ts new file mode 100644 index 000000000000..82db26f07442 --- /dev/null +++ b/packages/ast-spec/src/token/LineComment/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface LineComment extends BaseToken { + type: AST_TOKEN_TYPES.Line; +} diff --git a/packages/ast-spec/src/token/NullToken/spec.ts b/packages/ast-spec/src/token/NullToken/spec.ts new file mode 100644 index 000000000000..d5ae492de83a --- /dev/null +++ b/packages/ast-spec/src/token/NullToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface NullToken extends BaseToken { + type: AST_TOKEN_TYPES.Null; +} diff --git a/packages/ast-spec/src/token/NumericToken/spec.ts b/packages/ast-spec/src/token/NumericToken/spec.ts new file mode 100644 index 000000000000..a00fd383df75 --- /dev/null +++ b/packages/ast-spec/src/token/NumericToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface NumericToken extends BaseToken { + type: AST_TOKEN_TYPES.Numeric; +} diff --git a/packages/ast-spec/src/token/PunctuatorToken/spec.ts b/packages/ast-spec/src/token/PunctuatorToken/spec.ts new file mode 100644 index 000000000000..39b9507348c2 --- /dev/null +++ b/packages/ast-spec/src/token/PunctuatorToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface PunctuatorToken extends BaseToken { + type: AST_TOKEN_TYPES.Punctuator; +} diff --git a/packages/ast-spec/src/token/RegularExpressionToken/spec.ts b/packages/ast-spec/src/token/RegularExpressionToken/spec.ts new file mode 100644 index 000000000000..7b0bb09d5262 --- /dev/null +++ b/packages/ast-spec/src/token/RegularExpressionToken/spec.ts @@ -0,0 +1,10 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface RegularExpressionToken extends BaseToken { + type: AST_TOKEN_TYPES.RegularExpression; + regex: { + pattern: string; + flags: string; + }; +} diff --git a/packages/ast-spec/src/token/StringToken/spec.ts b/packages/ast-spec/src/token/StringToken/spec.ts new file mode 100644 index 000000000000..6b6535c6208d --- /dev/null +++ b/packages/ast-spec/src/token/StringToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface StringToken extends BaseToken { + type: AST_TOKEN_TYPES.String; +} diff --git a/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts b/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts new file mode 100644 index 000000000000..d15a55443c57 --- /dev/null +++ b/packages/ast-spec/src/token/TSAbstractKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAbstractKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAbstractKeyword; +} diff --git a/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts b/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts new file mode 100644 index 000000000000..26baddf7ad64 --- /dev/null +++ b/packages/ast-spec/src/token/TSAsyncKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAsyncKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAsyncKeyword; +} diff --git a/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts b/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts new file mode 100644 index 000000000000..8b6e6606b3e8 --- /dev/null +++ b/packages/ast-spec/src/token/TSDeclareKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSDeclareKeyword extends BaseNode { + type: AST_NODE_TYPES.TSDeclareKeyword; +} diff --git a/packages/ast-spec/src/token/TSExportKeyword/spec.ts b/packages/ast-spec/src/token/TSExportKeyword/spec.ts new file mode 100644 index 000000000000..016664d11b03 --- /dev/null +++ b/packages/ast-spec/src/token/TSExportKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSExportKeyword extends BaseNode { + type: AST_NODE_TYPES.TSExportKeyword; +} diff --git a/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts b/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts new file mode 100644 index 000000000000..ae57db0a066c --- /dev/null +++ b/packages/ast-spec/src/token/TSPrivateKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSPrivateKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPrivateKeyword; +} diff --git a/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts b/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts new file mode 100644 index 000000000000..815b28a1c2c1 --- /dev/null +++ b/packages/ast-spec/src/token/TSProtectedKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSProtectedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSProtectedKeyword; +} diff --git a/packages/ast-spec/src/token/TSPublicKeyword/spec.ts b/packages/ast-spec/src/token/TSPublicKeyword/spec.ts new file mode 100644 index 000000000000..3409fc6d689a --- /dev/null +++ b/packages/ast-spec/src/token/TSPublicKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSPublicKeyword extends BaseNode { + type: AST_NODE_TYPES.TSPublicKeyword; +} diff --git a/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts b/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts new file mode 100644 index 000000000000..462849972785 --- /dev/null +++ b/packages/ast-spec/src/token/TSReadonlyKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSReadonlyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSReadonlyKeyword; +} diff --git a/packages/ast-spec/src/token/TSStaticKeyword/spec.ts b/packages/ast-spec/src/token/TSStaticKeyword/spec.ts new file mode 100644 index 000000000000..1c2417eeb589 --- /dev/null +++ b/packages/ast-spec/src/token/TSStaticKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSStaticKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStaticKeyword; +} diff --git a/packages/ast-spec/src/token/TemplateToken/spec.ts b/packages/ast-spec/src/token/TemplateToken/spec.ts new file mode 100644 index 000000000000..da64ef0b6e98 --- /dev/null +++ b/packages/ast-spec/src/token/TemplateToken/spec.ts @@ -0,0 +1,6 @@ +import type { AST_TOKEN_TYPES } from '../../ast-token-types'; +import type { BaseToken } from '../../base/BaseToken'; + +export interface TemplateToken extends BaseToken { + type: AST_TOKEN_TYPES.Template; +} diff --git a/packages/ast-spec/src/token/spec.ts b/packages/ast-spec/src/token/spec.ts new file mode 100644 index 000000000000..45df05189eb2 --- /dev/null +++ b/packages/ast-spec/src/token/spec.ts @@ -0,0 +1,22 @@ +export * from './BlockComment/spec'; +export * from './BooleanToken/spec'; +export * from './IdentifierToken/spec'; +export * from './JSXIdentifierToken/spec'; +export * from './JSXTextToken/spec'; +export * from './KeywordToken/spec'; +export * from './LineComment/spec'; +export * from './NullToken/spec'; +export * from './NumericToken/spec'; +export * from './PunctuatorToken/spec'; +export * from './RegularExpressionToken/spec'; +export * from './StringToken/spec'; +export * from './TSAbstractKeyword/spec'; +export * from './TSAsyncKeyword/spec'; +export * from './TSDeclareKeyword/spec'; +export * from './TSExportKeyword/spec'; +export * from './TSPrivateKeyword/spec'; +export * from './TSProtectedKeyword/spec'; +export * from './TSPublicKeyword/spec'; +export * from './TSReadonlyKeyword/spec'; +export * from './TSStaticKeyword/spec'; +export * from './TemplateToken/spec'; diff --git a/packages/ast-spec/src/type/TSAnyKeyword/spec.ts b/packages/ast-spec/src/type/TSAnyKeyword/spec.ts new file mode 100644 index 000000000000..a9e2ba977f1d --- /dev/null +++ b/packages/ast-spec/src/type/TSAnyKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSAnyKeyword extends BaseNode { + type: AST_NODE_TYPES.TSAnyKeyword; +} diff --git a/packages/ast-spec/src/type/TSArrayType/spec.ts b/packages/ast-spec/src/type/TSArrayType/spec.ts new file mode 100644 index 000000000000..f7aa4f16a596 --- /dev/null +++ b/packages/ast-spec/src/type/TSArrayType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSArrayType extends BaseNode { + type: AST_NODE_TYPES.TSArrayType; + elementType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts b/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts new file mode 100644 index 000000000000..fc18a9519dee --- /dev/null +++ b/packages/ast-spec/src/type/TSBigIntKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSBigIntKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBigIntKeyword; +} diff --git a/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts b/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts new file mode 100644 index 000000000000..89438151de1f --- /dev/null +++ b/packages/ast-spec/src/type/TSBooleanKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSBooleanKeyword extends BaseNode { + type: AST_NODE_TYPES.TSBooleanKeyword; +} diff --git a/packages/ast-spec/src/type/TSConditionalType/spec.ts b/packages/ast-spec/src/type/TSConditionalType/spec.ts new file mode 100644 index 000000000000..979fcb3e6026 --- /dev/null +++ b/packages/ast-spec/src/type/TSConditionalType/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSConditionalType extends BaseNode { + type: AST_NODE_TYPES.TSConditionalType; + checkType: TypeNode; + extendsType: TypeNode; + trueType: TypeNode; + falseType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSConstructorType/spec.ts b/packages/ast-spec/src/type/TSConstructorType/spec.ts new file mode 100644 index 000000000000..08e19757d14a --- /dev/null +++ b/packages/ast-spec/src/type/TSConstructorType/spec.ts @@ -0,0 +1,7 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSConstructorType extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSConstructorType; + abstract: boolean; +} diff --git a/packages/ast-spec/src/type/TSFunctionType/spec.ts b/packages/ast-spec/src/type/TSFunctionType/spec.ts new file mode 100644 index 000000000000..4388b097efd5 --- /dev/null +++ b/packages/ast-spec/src/type/TSFunctionType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { TSFunctionSignatureBase } from '../../base/TSFunctionSignatureBase'; + +export interface TSFunctionType extends TSFunctionSignatureBase { + type: AST_NODE_TYPES.TSFunctionType; +} diff --git a/packages/ast-spec/src/type/TSImportType/spec.ts b/packages/ast-spec/src/type/TSImportType/spec.ts new file mode 100644 index 000000000000..b2eea1a78e01 --- /dev/null +++ b/packages/ast-spec/src/type/TSImportType/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { EntityName } from '../../unions/EntityName'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSImportType extends BaseNode { + type: AST_NODE_TYPES.TSImportType; + isTypeOf: boolean; + parameter: TypeNode; + qualifier: EntityName | null; + typeParameters: TSTypeParameterInstantiation | null; +} diff --git a/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts b/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts new file mode 100644 index 000000000000..86a22e22a16e --- /dev/null +++ b/packages/ast-spec/src/type/TSIndexedAccessType/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSIndexedAccessType extends BaseNode { + type: AST_NODE_TYPES.TSIndexedAccessType; + objectType: TypeNode; + indexType: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSInferType/spec.ts b/packages/ast-spec/src/type/TSInferType/spec.ts new file mode 100644 index 000000000000..11cdacb25d20 --- /dev/null +++ b/packages/ast-spec/src/type/TSInferType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../../special/TSTypeParameter/spec'; + +export interface TSInferType extends BaseNode { + type: AST_NODE_TYPES.TSInferType; + typeParameter: TSTypeParameter; +} diff --git a/packages/ast-spec/src/type/TSIntersectionType/spec.ts b/packages/ast-spec/src/type/TSIntersectionType/spec.ts new file mode 100644 index 000000000000..b84834143a0e --- /dev/null +++ b/packages/ast-spec/src/type/TSIntersectionType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSIntersectionType extends BaseNode { + type: AST_NODE_TYPES.TSIntersectionType; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSIntrinsicType/spec.ts b/packages/ast-spec/src/type/TSIntrinsicType/spec.ts new file mode 100644 index 000000000000..b7158c2803c0 --- /dev/null +++ b/packages/ast-spec/src/type/TSIntrinsicType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSIntrinsicKeyword extends BaseNode { + type: AST_NODE_TYPES.TSIntrinsicKeyword; +} diff --git a/packages/ast-spec/src/type/TSLiteralType/spec.ts b/packages/ast-spec/src/type/TSLiteralType/spec.ts new file mode 100644 index 000000000000..39f6ae0d2961 --- /dev/null +++ b/packages/ast-spec/src/type/TSLiteralType/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { UnaryExpression } from '../../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../../expression/UpdateExpression/spec'; +import type { LiteralExpression } from '../../unions/LiteralExpression'; + +export interface TSLiteralType extends BaseNode { + type: AST_NODE_TYPES.TSLiteralType; + literal: LiteralExpression | UnaryExpression | UpdateExpression; +} diff --git a/packages/ast-spec/src/type/TSMappedType/spec.ts b/packages/ast-spec/src/type/TSMappedType/spec.ts new file mode 100644 index 000000000000..db5abd4063a1 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/spec.ts @@ -0,0 +1,13 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameter } from '../../special/TSTypeParameter/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSMappedType extends BaseNode { + type: AST_NODE_TYPES.TSMappedType; + typeParameter: TSTypeParameter; + readonly?: boolean | '-' | '+'; + optional?: boolean | '-' | '+'; + typeAnnotation?: TypeNode; + nameType: TypeNode | null; +} diff --git a/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts b/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts new file mode 100644 index 000000000000..540d8bf19db5 --- /dev/null +++ b/packages/ast-spec/src/type/TSNamedTupleMember/spec.ts @@ -0,0 +1,11 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSNamedTupleMember extends BaseNode { + type: AST_NODE_TYPES.TSNamedTupleMember; + elementType: TypeNode; + label: Identifier; + optional: boolean; +} diff --git a/packages/ast-spec/src/type/TSNeverKeyword/spec.ts b/packages/ast-spec/src/type/TSNeverKeyword/spec.ts new file mode 100644 index 000000000000..59fe839e3473 --- /dev/null +++ b/packages/ast-spec/src/type/TSNeverKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNeverKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNeverKeyword; +} diff --git a/packages/ast-spec/src/type/TSNullKeyword/spec.ts b/packages/ast-spec/src/type/TSNullKeyword/spec.ts new file mode 100644 index 000000000000..254d5cc592d5 --- /dev/null +++ b/packages/ast-spec/src/type/TSNullKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNullKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNullKeyword; +} diff --git a/packages/ast-spec/src/type/TSNumberKeyword/spec.ts b/packages/ast-spec/src/type/TSNumberKeyword/spec.ts new file mode 100644 index 000000000000..768742a425dc --- /dev/null +++ b/packages/ast-spec/src/type/TSNumberKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSNumberKeyword extends BaseNode { + type: AST_NODE_TYPES.TSNumberKeyword; +} diff --git a/packages/ast-spec/src/type/TSObjectKeyword/spec.ts b/packages/ast-spec/src/type/TSObjectKeyword/spec.ts new file mode 100644 index 000000000000..3472bc9191ff --- /dev/null +++ b/packages/ast-spec/src/type/TSObjectKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSObjectKeyword extends BaseNode { + type: AST_NODE_TYPES.TSObjectKeyword; +} diff --git a/packages/ast-spec/src/type/TSOptionalType/spec.ts b/packages/ast-spec/src/type/TSOptionalType/spec.ts new file mode 100644 index 000000000000..9cdb0f636d32 --- /dev/null +++ b/packages/ast-spec/src/type/TSOptionalType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSOptionalType extends BaseNode { + type: AST_NODE_TYPES.TSOptionalType; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSParenthesizedType/spec.ts b/packages/ast-spec/src/type/TSParenthesizedType/spec.ts new file mode 100644 index 000000000000..2d20d5d2f2bc --- /dev/null +++ b/packages/ast-spec/src/type/TSParenthesizedType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSParenthesizedType extends BaseNode { + type: AST_NODE_TYPES.TSParenthesizedType; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSQualifiedName/spec.ts b/packages/ast-spec/src/type/TSQualifiedName/spec.ts new file mode 100644 index 000000000000..cdd6feeee0ef --- /dev/null +++ b/packages/ast-spec/src/type/TSQualifiedName/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSQualifiedName extends BaseNode { + type: AST_NODE_TYPES.TSQualifiedName; + left: EntityName; + right: Identifier; +} diff --git a/packages/ast-spec/src/type/TSRestType/spec.ts b/packages/ast-spec/src/type/TSRestType/spec.ts new file mode 100644 index 000000000000..f1b4f2ecfa85 --- /dev/null +++ b/packages/ast-spec/src/type/TSRestType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSRestType extends BaseNode { + type: AST_NODE_TYPES.TSRestType; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSStringKeyword/spec.ts b/packages/ast-spec/src/type/TSStringKeyword/spec.ts new file mode 100644 index 000000000000..35721dd44137 --- /dev/null +++ b/packages/ast-spec/src/type/TSStringKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSStringKeyword extends BaseNode { + type: AST_NODE_TYPES.TSStringKeyword; +} diff --git a/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts b/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts new file mode 100644 index 000000000000..6b8b949dd0b8 --- /dev/null +++ b/packages/ast-spec/src/type/TSSymbolKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSSymbolKeyword extends BaseNode { + type: AST_NODE_TYPES.TSSymbolKeyword; +} diff --git a/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts b/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts new file mode 100644 index 000000000000..c2e8783da873 --- /dev/null +++ b/packages/ast-spec/src/type/TSTemplateLiteralType/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TemplateElement } from '../../special/TemplateElement/spec'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTemplateLiteralType extends BaseNode { + type: AST_NODE_TYPES.TSTemplateLiteralType; + quasis: TemplateElement[]; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSThisType/spec.ts b/packages/ast-spec/src/type/TSThisType/spec.ts new file mode 100644 index 000000000000..319e82460f67 --- /dev/null +++ b/packages/ast-spec/src/type/TSThisType/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSThisType extends BaseNode { + type: AST_NODE_TYPES.TSThisType; +} diff --git a/packages/ast-spec/src/type/TSTupleType/spec.ts b/packages/ast-spec/src/type/TSTupleType/spec.ts new file mode 100644 index 000000000000..641a0c15b4c6 --- /dev/null +++ b/packages/ast-spec/src/type/TSTupleType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTupleType extends BaseNode { + type: AST_NODE_TYPES.TSTupleType; + elementTypes: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSTypeLiteral/spec.ts b/packages/ast-spec/src/type/TSTypeLiteral/spec.ts new file mode 100644 index 000000000000..243179d23d9f --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeLiteral/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeElement } from '../../unions/TypeElement'; + +export interface TSTypeLiteral extends BaseNode { + type: AST_NODE_TYPES.TSTypeLiteral; + members: TypeElement[]; +} diff --git a/packages/ast-spec/src/type/TSTypeOperator/spec.ts b/packages/ast-spec/src/type/TSTypeOperator/spec.ts new file mode 100644 index 000000000000..c83b8721eed9 --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeOperator/spec.ts @@ -0,0 +1,9 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSTypeOperator extends BaseNode { + type: AST_NODE_TYPES.TSTypeOperator; + operator: 'keyof' | 'readonly' | 'unique'; + typeAnnotation?: TypeNode; +} diff --git a/packages/ast-spec/src/type/TSTypePredicate/spec.ts b/packages/ast-spec/src/type/TSTypePredicate/spec.ts new file mode 100644 index 000000000000..cd34a31bcaf0 --- /dev/null +++ b/packages/ast-spec/src/type/TSTypePredicate/spec.ts @@ -0,0 +1,12 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Identifier } from '../../expression/Identifier/spec'; +import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; +import type { TSThisType } from '../TSThisType/spec'; + +export interface TSTypePredicate extends BaseNode { + type: AST_NODE_TYPES.TSTypePredicate; + asserts: boolean; + parameterName: Identifier | TSThisType; + typeAnnotation: TSTypeAnnotation | null; +} diff --git a/packages/ast-spec/src/type/TSTypeQuery/spec.ts b/packages/ast-spec/src/type/TSTypeQuery/spec.ts new file mode 100644 index 000000000000..bf1cd3e192df --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeQuery/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSTypeQuery extends BaseNode { + type: AST_NODE_TYPES.TSTypeQuery; + exprName: EntityName; +} diff --git a/packages/ast-spec/src/type/TSTypeReference/spec.ts b/packages/ast-spec/src/type/TSTypeReference/spec.ts new file mode 100644 index 000000000000..9d88fe7f6b4f --- /dev/null +++ b/packages/ast-spec/src/type/TSTypeReference/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/TSTypeParameterInstantiation/spec'; +import type { EntityName } from '../../unions/EntityName'; + +export interface TSTypeReference extends BaseNode { + type: AST_NODE_TYPES.TSTypeReference; + typeName: EntityName; + typeParameters?: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts b/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts new file mode 100644 index 000000000000..0aa062c84212 --- /dev/null +++ b/packages/ast-spec/src/type/TSUndefinedKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSUndefinedKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUndefinedKeyword; +} diff --git a/packages/ast-spec/src/type/TSUnionType/spec.ts b/packages/ast-spec/src/type/TSUnionType/spec.ts new file mode 100644 index 000000000000..a286f796a23d --- /dev/null +++ b/packages/ast-spec/src/type/TSUnionType/spec.ts @@ -0,0 +1,8 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSUnionType extends BaseNode { + type: AST_NODE_TYPES.TSUnionType; + types: TypeNode[]; +} diff --git a/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts b/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts new file mode 100644 index 000000000000..c8c1f9340c6e --- /dev/null +++ b/packages/ast-spec/src/type/TSUnknownKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSUnknownKeyword extends BaseNode { + type: AST_NODE_TYPES.TSUnknownKeyword; +} diff --git a/packages/ast-spec/src/type/TSVoidKeyword/spec.ts b/packages/ast-spec/src/type/TSVoidKeyword/spec.ts new file mode 100644 index 000000000000..abf0c14c5ab3 --- /dev/null +++ b/packages/ast-spec/src/type/TSVoidKeyword/spec.ts @@ -0,0 +1,6 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; + +export interface TSVoidKeyword extends BaseNode { + type: AST_NODE_TYPES.TSVoidKeyword; +} diff --git a/packages/ast-spec/src/type/spec.ts b/packages/ast-spec/src/type/spec.ts new file mode 100644 index 000000000000..bbbea76cbd8e --- /dev/null +++ b/packages/ast-spec/src/type/spec.ts @@ -0,0 +1,36 @@ +export * from './TSAnyKeyword/spec'; +export * from './TSArrayType/spec'; +export * from './TSBigIntKeyword/spec'; +export * from './TSBooleanKeyword/spec'; +export * from './TSConditionalType/spec'; +export * from './TSConstructorType/spec'; +export * from './TSFunctionType/spec'; +export * from './TSImportType/spec'; +export * from './TSIndexedAccessType/spec'; +export * from './TSInferType/spec'; +export * from './TSIntersectionType/spec'; +export * from './TSLiteralType/spec'; +export * from './TSMappedType/spec'; +export * from './TSNamedTupleMember/spec'; +export * from './TSNeverKeyword/spec'; +export * from './TSNullKeyword/spec'; +export * from './TSNumberKeyword/spec'; +export * from './TSObjectKeyword/spec'; +export * from './TSOptionalType/spec'; +export * from './TSParenthesizedType/spec'; +export * from './TSQualifiedName/spec'; +export * from './TSRestType/spec'; +export * from './TSStringKeyword/spec'; +export * from './TSSymbolKeyword/spec'; +export * from './TSTemplateLiteralType/spec'; +export * from './TSThisType/spec'; +export * from './TSTupleType/spec'; +export * from './TSTypeLiteral/spec'; +export * from './TSTypeOperator/spec'; +export * from './TSTypePredicate/spec'; +export * from './TSTypeQuery/spec'; +export * from './TSTypeReference/spec'; +export * from './TSUndefinedKeyword/spec'; +export * from './TSUnionType/spec'; +export * from './TSUnknownKeyword/spec'; +export * from './TSVoidKeyword/spec'; diff --git a/packages/ast-spec/src/unions/BindingName.ts b/packages/ast-spec/src/unions/BindingName.ts new file mode 100644 index 000000000000..2da273d80476 --- /dev/null +++ b/packages/ast-spec/src/unions/BindingName.ts @@ -0,0 +1,4 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { BindingPattern } from './BindingPattern'; + +export type BindingName = BindingPattern | Identifier; diff --git a/packages/ast-spec/src/unions/BindingPattern.ts b/packages/ast-spec/src/unions/BindingPattern.ts new file mode 100644 index 000000000000..ef39d0af1126 --- /dev/null +++ b/packages/ast-spec/src/unions/BindingPattern.ts @@ -0,0 +1,4 @@ +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; + +export type BindingPattern = ArrayPattern | ObjectPattern; diff --git a/packages/ast-spec/src/unions/CallExpressionArgument.ts b/packages/ast-spec/src/unions/CallExpressionArgument.ts new file mode 100644 index 000000000000..42a419b4b25b --- /dev/null +++ b/packages/ast-spec/src/unions/CallExpressionArgument.ts @@ -0,0 +1,4 @@ +import type { SpreadElement } from '../element/SpreadElement/spec'; +import type { Expression } from './Expression'; + +export type CallExpressionArgument = Expression | SpreadElement; diff --git a/packages/ast-spec/src/unions/ChainElement.ts b/packages/ast-spec/src/unions/ChainElement.ts new file mode 100644 index 000000000000..fccde99ed8c6 --- /dev/null +++ b/packages/ast-spec/src/unions/ChainElement.ts @@ -0,0 +1,8 @@ +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; + +export type ChainElement = + | CallExpression + | MemberExpression + | TSNonNullExpression; diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts new file mode 100644 index 000000000000..a4d986d09c73 --- /dev/null +++ b/packages/ast-spec/src/unions/ClassElement.ts @@ -0,0 +1,12 @@ +import type { ClassProperty } from '../element/ClassProperty/spec'; +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { TSAbstractClassProperty } from '../element/TSAbstractClassProperty/spec'; +import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; + +export type ClassElement = + | ClassProperty + | MethodDefinition + | TSAbstractClassProperty + | TSAbstractMethodDefinition + | TSIndexSignature; diff --git a/packages/ast-spec/src/unions/Comment.ts b/packages/ast-spec/src/unions/Comment.ts new file mode 100644 index 000000000000..d5cdca042476 --- /dev/null +++ b/packages/ast-spec/src/unions/Comment.ts @@ -0,0 +1,4 @@ +import type { BlockComment } from '../token/BlockComment/spec'; +import type { LineComment } from '../token/LineComment/spec'; + +export type Comment = BlockComment | LineComment; diff --git a/packages/ast-spec/src/unions/DeclarationStatement.ts b/packages/ast-spec/src/unions/DeclarationStatement.ts new file mode 100644 index 000000000000..be0637254ae7 --- /dev/null +++ b/packages/ast-spec/src/unions/DeclarationStatement.ts @@ -0,0 +1,29 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSImportEqualsDeclaration } from '../declaration/TSImportEqualsDeclaration/spec'; +import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; +import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; +import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; + +// TODO - breaking change remove this +export type DeclarationStatement = + | ClassDeclaration + | ClassExpression + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | FunctionDeclaration + | TSDeclareFunction + | TSEnumDeclaration + | TSImportEqualsDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSTypeAliasDeclaration; diff --git a/packages/ast-spec/src/unions/DestructuringPattern.ts b/packages/ast-spec/src/unions/DestructuringPattern.ts new file mode 100644 index 000000000000..40d07009651c --- /dev/null +++ b/packages/ast-spec/src/unions/DestructuringPattern.ts @@ -0,0 +1,14 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; + +export type DestructuringPattern = + | ArrayPattern + | AssignmentPattern + | Identifier + | MemberExpression + | ObjectPattern + | RestElement; diff --git a/packages/ast-spec/src/unions/EntityName.ts b/packages/ast-spec/src/unions/EntityName.ts new file mode 100644 index 000000000000..82f7b1c9b0ca --- /dev/null +++ b/packages/ast-spec/src/unions/EntityName.ts @@ -0,0 +1,4 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; + +export type EntityName = Identifier | TSQualifiedName; diff --git a/packages/ast-spec/src/unions/ExportDeclaration.ts b/packages/ast-spec/src/unions/ExportDeclaration.ts new file mode 100644 index 000000000000..1ae9d9ddb9f8 --- /dev/null +++ b/packages/ast-spec/src/unions/ExportDeclaration.ts @@ -0,0 +1,20 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; +import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; + +export type ExportDeclaration = + | ClassDeclaration + | ClassExpression + | FunctionDeclaration + | TSDeclareFunction + | TSEnumDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSTypeAliasDeclaration + | VariableDeclaration; diff --git a/packages/ast-spec/src/unions/Expression.ts b/packages/ast-spec/src/unions/Expression.ts new file mode 100644 index 000000000000..fd1a14b114e2 --- /dev/null +++ b/packages/ast-spec/src/unions/Expression.ts @@ -0,0 +1,78 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { AssignmentExpression } from '../expression/AssignmentExpression/spec'; +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { BinaryExpression } from '../expression/BinaryExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ChainExpression } from '../expression/ChainExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { ConditionalExpression } from '../expression/ConditionalExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { ImportExpression } from '../expression/ImportExpression/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { LogicalExpression } from '../expression/LogicalExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { NewExpression } from '../expression/NewExpression/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { SequenceExpression } from '../expression/SequenceExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { YieldExpression } from '../expression/YieldExpression/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +/* +This isn't technically correct, as it includes ArrayPattern and ObjectPattern - which are only valid +in a LeftHandSideExpression, and not in a general expression location. + +However most of the time that this type is used, the intention will be to assign a LeftHandSideExpression to this type. +So excluding the Pattern types just makes it a pain, as people have to write Expression | LeftHandSideExpression everywhere. +*/ + +export type Expression = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | ClassExpression + | ClassExpression + | ConditionalExpression + | FunctionExpression + | FunctionExpression + | Identifier + | ImportExpression + | JSXElement + | JSXFragment + | LiteralExpression + | LogicalExpression + | MemberExpression + | MetaProperty + | NewExpression + | ObjectExpression + | ObjectPattern + | SequenceExpression + | Super + | TaggedTemplateExpression + | TemplateLiteral + | ThisExpression + | TSAsExpression + | TSNonNullExpression + | TSTypeAssertion + | UnaryExpression + | UpdateExpression + | YieldExpression; diff --git a/packages/ast-spec/src/unions/ForInitialiser.ts b/packages/ast-spec/src/unions/ForInitialiser.ts new file mode 100644 index 000000000000..05138cb52fbc --- /dev/null +++ b/packages/ast-spec/src/unions/ForInitialiser.ts @@ -0,0 +1,4 @@ +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { Expression } from './Expression'; + +export type ForInitialiser = Expression | VariableDeclaration; diff --git a/packages/ast-spec/src/unions/FunctionLike.ts b/packages/ast-spec/src/unions/FunctionLike.ts new file mode 100644 index 000000000000..6ab06d834960 --- /dev/null +++ b/packages/ast-spec/src/unions/FunctionLike.ts @@ -0,0 +1,12 @@ +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; + +export type FunctionLike = + | ArrowFunctionExpression + | FunctionDeclaration + | FunctionExpression + | TSDeclareFunction + | TSEmptyBodyFunctionExpression; diff --git a/packages/ast-spec/src/unions/ImportClause.ts b/packages/ast-spec/src/unions/ImportClause.ts new file mode 100644 index 000000000000..80b40826ff6d --- /dev/null +++ b/packages/ast-spec/src/unions/ImportClause.ts @@ -0,0 +1,8 @@ +import type { ImportDefaultSpecifier } from '../special/ImportDefaultSpecifier/spec'; +import type { ImportNamespaceSpecifier } from '../special/ImportNamespaceSpecifier/spec'; +import type { ImportSpecifier } from '../special/ImportSpecifier/spec'; + +export type ImportClause = + | ImportDefaultSpecifier + | ImportNamespaceSpecifier + | ImportSpecifier; diff --git a/packages/ast-spec/src/unions/IterationStatement.ts b/packages/ast-spec/src/unions/IterationStatement.ts new file mode 100644 index 000000000000..6a611431ca05 --- /dev/null +++ b/packages/ast-spec/src/unions/IterationStatement.ts @@ -0,0 +1,12 @@ +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; + +export type IterationStatement = + | DoWhileStatement + | ForInStatement + | ForOfStatement + | ForStatement + | WhileStatement; diff --git a/packages/ast-spec/src/unions/JSXChild.ts b/packages/ast-spec/src/unions/JSXChild.ts new file mode 100644 index 000000000000..2b38836c82ef --- /dev/null +++ b/packages/ast-spec/src/unions/JSXChild.ts @@ -0,0 +1,6 @@ +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { JSXText } from '../jsx/JSXText/spec'; +import type { JSXExpression } from './JSXExpression'; + +export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; diff --git a/packages/ast-spec/src/unions/JSXExpression.ts b/packages/ast-spec/src/unions/JSXExpression.ts new file mode 100644 index 000000000000..78dfad53525b --- /dev/null +++ b/packages/ast-spec/src/unions/JSXExpression.ts @@ -0,0 +1,8 @@ +import type { JSXEmptyExpression } from '../jsx/JSXEmptyExpression/spec'; +import type { JSXExpressionContainer } from '../jsx/JSXExpressionContainer/spec'; +import type { JSXSpreadChild } from '../jsx/JSXSpreadChild/spec'; + +export type JSXExpression = + | JSXEmptyExpression + | JSXExpressionContainer + | JSXSpreadChild; diff --git a/packages/ast-spec/src/unions/JSXTagNameExpression.ts b/packages/ast-spec/src/unions/JSXTagNameExpression.ts new file mode 100644 index 000000000000..05a831f68b45 --- /dev/null +++ b/packages/ast-spec/src/unions/JSXTagNameExpression.ts @@ -0,0 +1,8 @@ +import type { JSXIdentifier } from '../jsx/JSXIdentifier/spec'; +import type { JSXMemberExpression } from '../jsx/JSXMemberExpression/spec'; +import type { JSXNamespacedName } from '../jsx/JSXNamespacedName/spec'; + +export type JSXTagNameExpression = + | JSXIdentifier + | JSXMemberExpression + | JSXNamespacedName; diff --git a/packages/ast-spec/src/unions/LeftHandSideExpression.ts b/packages/ast-spec/src/unions/LeftHandSideExpression.ts new file mode 100644 index 000000000000..a8a24bb08d2d --- /dev/null +++ b/packages/ast-spec/src/unions/LeftHandSideExpression.ts @@ -0,0 +1,44 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +export type LeftHandSideExpression = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | CallExpression + | ClassExpression + | FunctionExpression + | Identifier + | JSXElement + | JSXFragment + | LiteralExpression + | MemberExpression + | MetaProperty + | ObjectExpression + | ObjectPattern + | Super + | TaggedTemplateExpression + | TemplateLiteral + | ThisExpression + | TSAsExpression + | TSNonNullExpression + | TSTypeAssertion; diff --git a/packages/ast-spec/src/unions/Literal.ts b/packages/ast-spec/src/unions/Literal.ts new file mode 100644 index 000000000000..4da361d88423 --- /dev/null +++ b/packages/ast-spec/src/unions/Literal.ts @@ -0,0 +1,14 @@ +import type { BigIntLiteral } from '../expression/literal/BigIntLiteral/spec'; +import type { BooleanLiteral } from '../expression/literal/BooleanLiteral/spec'; +import type { NullLiteral } from '../expression/literal/NullLiteral/spec'; +import type { NumberLiteral } from '../expression/literal/NumberLiteral/spec'; +import type { RegExpLiteral } from '../expression/literal/RegExpLiteral/spec'; +import type { StringLiteral } from '../expression/literal/StringLiteral/spec'; + +export type Literal = + | BigIntLiteral + | BooleanLiteral + | NullLiteral + | NumberLiteral + | RegExpLiteral + | StringLiteral; diff --git a/packages/ast-spec/src/unions/LiteralExpression.ts b/packages/ast-spec/src/unions/LiteralExpression.ts new file mode 100644 index 000000000000..e29ddeec7ee5 --- /dev/null +++ b/packages/ast-spec/src/unions/LiteralExpression.ts @@ -0,0 +1,4 @@ +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { Literal } from './Literal'; + +export type LiteralExpression = Literal | TemplateLiteral; diff --git a/packages/ast-spec/src/unions/Modifier.ts b/packages/ast-spec/src/unions/Modifier.ts new file mode 100644 index 000000000000..0922a52eca2e --- /dev/null +++ b/packages/ast-spec/src/unions/Modifier.ts @@ -0,0 +1,16 @@ +import type { TSAbstractKeyword } from '../token/TSAbstractKeyword/spec'; +import type { TSAsyncKeyword } from '../token/TSAsyncKeyword/spec'; +import type { TSPrivateKeyword } from '../token/TSPrivateKeyword/spec'; +import type { TSProtectedKeyword } from '../token/TSProtectedKeyword/spec'; +import type { TSPublicKeyword } from '../token/TSPublicKeyword/spec'; +import type { TSReadonlyKeyword } from '../token/TSReadonlyKeyword/spec'; +import type { TSStaticKeyword } from '../token/TSStaticKeyword/spec'; + +export type Modifier = + | TSAbstractKeyword + | TSAsyncKeyword + | TSPrivateKeyword + | TSProtectedKeyword + | TSPublicKeyword + | TSReadonlyKeyword + | TSStaticKeyword; diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts new file mode 100644 index 000000000000..fe3435596a98 --- /dev/null +++ b/packages/ast-spec/src/unions/Node.ts @@ -0,0 +1,329 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSImportEqualsDeclaration } from '../declaration/TSImportEqualsDeclaration/spec'; +import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; +import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; +import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { ClassProperty } from '../element/ClassProperty/spec'; +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { Property } from '../element/Property/spec'; +import type { SpreadElement } from '../element/SpreadElement/spec'; +import type { TSAbstractClassProperty } from '../element/TSAbstractClassProperty/spec'; +import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec'; +import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; +import type { TSConstructSignatureDeclaration } from '../element/TSConstructSignatureDeclaration/spec'; +import type { TSEnumMember } from '../element/TSEnumMember/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; +import type { TSMethodSignature } from '../element/TSMethodSignature/spec'; +import type { TSPropertySignature } from '../element/TSPropertySignature/spec'; +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ArrowFunctionExpression } from '../expression/ArrowFunctionExpression/spec'; +import type { AssignmentExpression } from '../expression/AssignmentExpression/spec'; +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { BinaryExpression } from '../expression/BinaryExpression/spec'; +import type { CallExpression } from '../expression/CallExpression/spec'; +import type { ChainExpression } from '../expression/ChainExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { ConditionalExpression } from '../expression/ConditionalExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { ImportExpression } from '../expression/ImportExpression/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { LogicalExpression } from '../expression/LogicalExpression/spec'; +import type { MemberExpression } from '../expression/MemberExpression/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { NewExpression } from '../expression/NewExpression/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { SequenceExpression } from '../expression/SequenceExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpression/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; +import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { YieldExpression } from '../expression/YieldExpression/spec'; +import type { JSXAttribute } from '../jsx/JSXAttribute/spec'; +import type { JSXClosingElement } from '../jsx/JSXClosingElement/spec'; +import type { JSXClosingFragment } from '../jsx/JSXClosingFragment/spec'; +import type { JSXEmptyExpression } from '../jsx/JSXEmptyExpression/spec'; +import type { JSXExpressionContainer } from '../jsx/JSXExpressionContainer/spec'; +import type { JSXIdentifier } from '../jsx/JSXIdentifier/spec'; +import type { JSXMemberExpression } from '../jsx/JSXMemberExpression/spec'; +import type { JSXNamespacedName } from '../jsx/JSXNamespacedName/spec'; +import type { JSXOpeningElement } from '../jsx/JSXOpeningElement/spec'; +import type { JSXOpeningFragment } from '../jsx/JSXOpeningFragment/spec'; +import type { JSXSpreadAttribute } from '../jsx/JSXSpreadAttribute/spec'; +import type { JSXSpreadChild } from '../jsx/JSXSpreadChild/spec'; +import type { JSXText } from '../jsx/JSXText/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; +import type { TSParameterProperty } from '../parameter/TSParameterProperty/spec'; +import type { CatchClause } from '../special/CatchClause/spec'; +import type { ClassBody } from '../special/ClassBody/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { EmptyStatement } from '../special/EmptyStatement/spec'; +import type { ExportSpecifier } from '../special/ExportSpecifier/spec'; +import type { ImportDefaultSpecifier } from '../special/ImportDefaultSpecifier/spec'; +import type { ImportNamespaceSpecifier } from '../special/ImportNamespaceSpecifier/spec'; +import type { ImportSpecifier } from '../special/ImportSpecifier/spec'; +import type { Program } from '../special/Program/spec'; +import type { SwitchCase } from '../special/SwitchCase/spec'; +import type { TemplateElement } from '../special/TemplateElement/spec'; +import type { TSClassImplements } from '../special/TSClassImplements/spec'; +import type { TSExternalModuleReference } from '../special/TSExternalModuleReference/spec'; +import type { TSInterfaceBody } from '../special/TSInterfaceBody/spec'; +import type { TSInterfaceHeritage } from '../special/TSInterfaceHeritage/spec'; +import type { TSModuleBlock } from '../special/TSModuleBlock/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameter } from '../special/TSTypeParameter/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { VariableDeclarator } from '../special/VariableDeclarator/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { BreakStatement } from '../statement/BreakStatement/spec'; +import type { ContinueStatement } from '../statement/ContinueStatement/spec'; +import type { DebuggerStatement } from '../statement/DebuggerStatement/spec'; +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ExpressionStatement } from '../statement/ExpressionStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { IfStatement } from '../statement/IfStatement/spec'; +import type { ImportDeclaration } from '../statement/ImportDeclaration/spec'; +import type { LabeledStatement } from '../statement/LabeledStatement/spec'; +import type { ReturnStatement } from '../statement/ReturnStatement/spec'; +import type { SwitchStatement } from '../statement/SwitchStatement/spec'; +import type { ThrowStatement } from '../statement/ThrowStatement/spec'; +import type { TryStatement } from '../statement/TryStatement/spec'; +import type { TSExportAssignment } from '../statement/TSExportAssignment/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; +import type { WithStatement } from '../statement/WithStatement/spec'; +import type { TSAbstractKeyword } from '../token/TSAbstractKeyword/spec'; +import type { TSAsyncKeyword } from '../token/TSAsyncKeyword/spec'; +import type { TSDeclareKeyword } from '../token/TSDeclareKeyword/spec'; +import type { TSExportKeyword } from '../token/TSExportKeyword/spec'; +import type { TSPrivateKeyword } from '../token/TSPrivateKeyword/spec'; +import type { TSProtectedKeyword } from '../token/TSProtectedKeyword/spec'; +import type { TSPublicKeyword } from '../token/TSPublicKeyword/spec'; +import type { TSReadonlyKeyword } from '../token/TSReadonlyKeyword/spec'; +import type { TSStaticKeyword } from '../token/TSStaticKeyword/spec'; +import type { TSAnyKeyword } from '../type/TSAnyKeyword/spec'; +import type { TSArrayType } from '../type/TSArrayType/spec'; +import type { TSBigIntKeyword } from '../type/TSBigIntKeyword/spec'; +import type { TSBooleanKeyword } from '../type/TSBooleanKeyword/spec'; +import type { TSConditionalType } from '../type/TSConditionalType/spec'; +import type { TSConstructorType } from '../type/TSConstructorType/spec'; +import type { TSFunctionType } from '../type/TSFunctionType/spec'; +import type { TSImportType } from '../type/TSImportType/spec'; +import type { TSIndexedAccessType } from '../type/TSIndexedAccessType/spec'; +import type { TSInferType } from '../type/TSInferType/spec'; +import type { TSIntersectionType } from '../type/TSIntersectionType/spec'; +import type { TSIntrinsicKeyword } from '../type/TSIntrinsicType/spec'; +import type { TSLiteralType } from '../type/TSLiteralType/spec'; +import type { TSMappedType } from '../type/TSMappedType/spec'; +import type { TSNamedTupleMember } from '../type/TSNamedTupleMember/spec'; +import type { TSNeverKeyword } from '../type/TSNeverKeyword/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; +import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; +import type { TSOptionalType } from '../type/TSOptionalType/spec'; +import type { TSParenthesizedType } from '../type/TSParenthesizedType/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; +import type { TSRestType } from '../type/TSRestType/spec'; +import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; +import type { TSSymbolKeyword } from '../type/TSSymbolKeyword/spec'; +import type { TSTemplateLiteralType } from '../type/TSTemplateLiteralType/spec'; +import type { TSThisType } from '../type/TSThisType/spec'; +import type { TSTupleType } from '../type/TSTupleType/spec'; +import type { TSTypeLiteral } from '../type/TSTypeLiteral/spec'; +import type { TSTypeOperator } from '../type/TSTypeOperator/spec'; +import type { TSTypePredicate } from '../type/TSTypePredicate/spec'; +import type { TSTypeQuery } from '../type/TSTypeQuery/spec'; +import type { TSTypeReference } from '../type/TSTypeReference/spec'; +import type { TSUndefinedKeyword } from '../type/TSUndefinedKeyword/spec'; +import type { TSUnionType } from '../type/TSUnionType/spec'; +import type { TSUnknownKeyword } from '../type/TSUnknownKeyword/spec'; +import type { TSVoidKeyword } from '../type/TSVoidKeyword/spec'; +import type { Literal } from './Literal'; + +/* + * NOTE: + * Tokens are not included in the `Node` union below on purpose because they are not ever included as part of the standard AST tree. + */ + +export type Node = + | ArrayExpression + | ArrayPattern + | ArrowFunctionExpression + | AssignmentExpression + | AssignmentPattern + | AwaitExpression + | BinaryExpression + | BlockStatement + | BreakStatement + | CallExpression + | CatchClause + | ChainExpression + | ClassBody + | ClassDeclaration + | ClassExpression + | ClassProperty + | ConditionalExpression + | ContinueStatement + | DebuggerStatement + | Decorator + | DoWhileStatement + | EmptyStatement + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ExportSpecifier + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | FunctionDeclaration + | FunctionExpression + | Identifier + | IfStatement + | ImportDeclaration + | ImportDefaultSpecifier + | ImportExpression + | ImportNamespaceSpecifier + | ImportSpecifier + | JSXAttribute + | JSXClosingElement + | JSXClosingFragment + | JSXElement + | JSXEmptyExpression + | JSXExpressionContainer + | JSXFragment + | JSXIdentifier + | JSXMemberExpression + | JSXNamespacedName + | JSXOpeningElement + | JSXOpeningFragment + | JSXSpreadAttribute + | JSXSpreadChild + | JSXText + | LabeledStatement + | Literal + | LogicalExpression + | MemberExpression + | MetaProperty + | MethodDefinition + | NewExpression + | ObjectExpression + | ObjectPattern + | Program + | Property + | RestElement + | ReturnStatement + | SequenceExpression + | SpreadElement + | Super + | SwitchCase + | SwitchStatement + | TaggedTemplateExpression + | TemplateElement + | TemplateLiteral + | ThisExpression + | ThrowStatement + | TryStatement + | TSAbstractClassProperty + | TSAbstractKeyword + | TSAbstractMethodDefinition + | TSAnyKeyword + | TSArrayType + | TSAsExpression + | TSAsyncKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSCallSignatureDeclaration + | TSClassImplements + | TSConditionalType + | TSConstructorType + | TSConstructSignatureDeclaration + | TSDeclareFunction + | TSDeclareKeyword + | TSEmptyBodyFunctionExpression + | TSEnumDeclaration + | TSEnumMember + | TSExportAssignment + | TSExportKeyword + | TSExternalModuleReference + | TSFunctionType + | TSImportEqualsDeclaration + | TSImportType + | TSIndexedAccessType + | TSIndexSignature + | TSInferType + | TSInterfaceBody + | TSInterfaceDeclaration + | TSInterfaceHeritage + | TSIntersectionType + | TSIntrinsicKeyword + | TSLiteralType + | TSMappedType + | TSMethodSignature + | TSModuleBlock + | TSModuleDeclaration + | TSNamedTupleMember + | TSNamespaceExportDeclaration + | TSNeverKeyword + | TSNonNullExpression + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSParameterProperty + | TSParenthesizedType + | TSPrivateKeyword + | TSPropertySignature + | TSProtectedKeyword + | TSPublicKeyword + | TSQualifiedName + | TSReadonlyKeyword + | TSRestType + | TSStaticKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeAliasDeclaration + | TSTypeAnnotation + | TSTypeAssertion + | TSTypeLiteral + | TSTypeOperator + | TSTypeParameter + | TSTypeParameterDeclaration + | TSTypeParameterInstantiation + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword + | UnaryExpression + | UpdateExpression + | VariableDeclaration + | VariableDeclarator + | WhileStatement + | WithStatement + | YieldExpression; diff --git a/packages/ast-spec/src/unions/ObjectLiteralElement.ts b/packages/ast-spec/src/unions/ObjectLiteralElement.ts new file mode 100644 index 000000000000..d7575c80c1b9 --- /dev/null +++ b/packages/ast-spec/src/unions/ObjectLiteralElement.ts @@ -0,0 +1,8 @@ +import type { MethodDefinition } from '../element/MethodDefinition/spec'; +import type { Property } from '../element/Property/spec'; +import type { SpreadElement } from '../element/SpreadElement/spec'; + +export type ObjectLiteralElement = MethodDefinition | Property | SpreadElement; + +// TODO - breaking change remove this +export type ObjectLiteralElementLike = ObjectLiteralElement; diff --git a/packages/ast-spec/src/unions/Parameter.ts b/packages/ast-spec/src/unions/Parameter.ts new file mode 100644 index 000000000000..766a8dedbe7e --- /dev/null +++ b/packages/ast-spec/src/unions/Parameter.ts @@ -0,0 +1,14 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { AssignmentPattern } from '../parameter/AssignmentPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { RestElement } from '../parameter/RestElement/spec'; +import type { TSParameterProperty } from '../parameter/TSParameterProperty/spec'; + +export type Parameter = + | ArrayPattern + | AssignmentPattern + | Identifier + | ObjectPattern + | RestElement + | TSParameterProperty; diff --git a/packages/ast-spec/src/unions/PrimaryExpression.ts b/packages/ast-spec/src/unions/PrimaryExpression.ts new file mode 100644 index 000000000000..3c1dbf07fb85 --- /dev/null +++ b/packages/ast-spec/src/unions/PrimaryExpression.ts @@ -0,0 +1,35 @@ +import type { ArrayExpression } from '../expression/ArrayExpression/spec'; +import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { FunctionExpression } from '../expression/FunctionExpression/spec'; +import type { Identifier } from '../expression/Identifier/spec'; +import type { JSXElement } from '../expression/JSXElement/spec'; +import type { JSXFragment } from '../expression/JSXFragment/spec'; +import type { MetaProperty } from '../expression/MetaProperty/spec'; +import type { ObjectExpression } from '../expression/ObjectExpression/spec'; +import type { Super } from '../expression/Super/spec'; +import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; +import type { ThisExpression } from '../expression/ThisExpression/spec'; +import type { JSXOpeningElement } from '../jsx/JSXOpeningElement/spec'; +import type { ArrayPattern } from '../parameter/ArrayPattern/spec'; +import type { ObjectPattern } from '../parameter/ObjectPattern/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { LiteralExpression } from './LiteralExpression'; + +// TODO - breaking change remove this +export type PrimaryExpression = + | ArrayExpression + | ArrayPattern + | ClassExpression + | FunctionExpression + | Identifier + | JSXElement + | JSXFragment + | JSXOpeningElement + | LiteralExpression + | MetaProperty + | ObjectExpression + | ObjectPattern + | Super + | TemplateLiteral + | ThisExpression + | TSNullKeyword; diff --git a/packages/ast-spec/src/unions/PropertyName.ts b/packages/ast-spec/src/unions/PropertyName.ts new file mode 100644 index 000000000000..56ba04cabbea --- /dev/null +++ b/packages/ast-spec/src/unions/PropertyName.ts @@ -0,0 +1,11 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { NumberLiteral } from '../expression/literal/NumberLiteral/spec'; +import type { StringLiteral } from '../expression/literal/StringLiteral/spec'; +import type { Expression } from '../unions/Expression'; + +export type PropertyName = PropertyNameComputed | PropertyNameNonComputed; +export type PropertyNameComputed = Expression; +export type PropertyNameNonComputed = + | Identifier + | NumberLiteral + | StringLiteral; diff --git a/packages/ast-spec/src/unions/Statement.ts b/packages/ast-spec/src/unions/Statement.ts new file mode 100644 index 000000000000..7345a159982e --- /dev/null +++ b/packages/ast-spec/src/unions/Statement.ts @@ -0,0 +1,78 @@ +import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; +import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; +import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; +import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; +import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSImportEqualsDeclaration } from '../declaration/TSImportEqualsDeclaration/spec'; +import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; +import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; +import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec'; +import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; +import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { BreakStatement } from '../statement/BreakStatement/spec'; +import type { ContinueStatement } from '../statement/ContinueStatement/spec'; +import type { DebuggerStatement } from '../statement/DebuggerStatement/spec'; +import type { DoWhileStatement } from '../statement/DoWhileStatement/spec'; +import type { ExpressionStatement } from '../statement/ExpressionStatement/spec'; +import type { ForInStatement } from '../statement/ForInStatement/spec'; +import type { ForOfStatement } from '../statement/ForOfStatement/spec'; +import type { ForStatement } from '../statement/ForStatement/spec'; +import type { IfStatement } from '../statement/IfStatement/spec'; +import type { ImportDeclaration } from '../statement/ImportDeclaration/spec'; +import type { LabeledStatement } from '../statement/LabeledStatement/spec'; +import type { ReturnStatement } from '../statement/ReturnStatement/spec'; +import type { SwitchStatement } from '../statement/SwitchStatement/spec'; +import type { ThrowStatement } from '../statement/ThrowStatement/spec'; +import type { TryStatement } from '../statement/TryStatement/spec'; +import type { TSExportAssignment } from '../statement/TSExportAssignment/spec'; +import type { WhileStatement } from '../statement/WhileStatement/spec'; +import type { WithStatement } from '../statement/WithStatement/spec'; + +export type Statement = + | BlockStatement + | BreakStatement + | ClassDeclaration + | ContinueStatement + | DebuggerStatement + | DoWhileStatement + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | FunctionDeclaration + | IfStatement + | ImportDeclaration + | LabeledStatement + | ReturnStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | TSDeclareFunction + | TSEnumDeclaration + | TSExportAssignment + | TSImportEqualsDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSNamespaceExportDeclaration + | TSTypeAliasDeclaration + | VariableDeclaration + | WhileStatement + | WithStatement; + +// These nodes are ***only*** allowed at the top-level +export type ProgramStatement = + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | ImportDeclaration + | Statement + | TSImportEqualsDeclaration + | TSNamespaceExportDeclaration; + +// TODO - once we have syntax errors, the types in ProgramStatement should not be in Statement diff --git a/packages/ast-spec/src/unions/TSUnaryExpression.ts b/packages/ast-spec/src/unions/TSUnaryExpression.ts new file mode 100644 index 000000000000..b4dd05627bf6 --- /dev/null +++ b/packages/ast-spec/src/unions/TSUnaryExpression.ts @@ -0,0 +1,13 @@ +import type { AwaitExpression } from '../expression/AwaitExpression/spec'; +import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; +import type { UnaryExpression } from '../expression/UnaryExpression/spec'; +import type { UpdateExpression } from '../expression/UpdateExpression/spec'; +import type { LeftHandSideExpression } from './LeftHandSideExpression'; + +// TODO - breaking change remove this +export type TSUnaryExpression = + | AwaitExpression + | LeftHandSideExpression + | TSTypeAssertion + | UnaryExpression + | UpdateExpression; diff --git a/packages/ast-spec/src/unions/Token.ts b/packages/ast-spec/src/unions/Token.ts new file mode 100644 index 000000000000..3d71cb019a7f --- /dev/null +++ b/packages/ast-spec/src/unions/Token.ts @@ -0,0 +1,26 @@ +import type { BooleanToken } from '../token/BooleanToken/spec'; +import type { IdentifierToken } from '../token/IdentifierToken/spec'; +import type { JSXIdentifierToken } from '../token/JSXIdentifierToken/spec'; +import type { JSXTextToken } from '../token/JSXTextToken/spec'; +import type { KeywordToken } from '../token/KeywordToken/spec'; +import type { NullToken } from '../token/NullToken/spec'; +import type { NumericToken } from '../token/NumericToken/spec'; +import type { PunctuatorToken } from '../token/PunctuatorToken/spec'; +import type { RegularExpressionToken } from '../token/RegularExpressionToken/spec'; +import type { StringToken } from '../token/StringToken/spec'; +import type { TemplateToken } from '../token/TemplateToken/spec'; +import type { Comment } from './Comment'; + +export type Token = + | BooleanToken + | Comment + | IdentifierToken + | JSXIdentifierToken + | JSXTextToken + | KeywordToken + | NullToken + | NumericToken + | PunctuatorToken + | RegularExpressionToken + | StringToken + | TemplateToken; diff --git a/packages/ast-spec/src/unions/TypeElement.ts b/packages/ast-spec/src/unions/TypeElement.ts new file mode 100644 index 000000000000..9a4bbc99c223 --- /dev/null +++ b/packages/ast-spec/src/unions/TypeElement.ts @@ -0,0 +1,12 @@ +import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec'; +import type { TSConstructSignatureDeclaration } from '../element/TSConstructSignatureDeclaration/spec'; +import type { TSIndexSignature } from '../element/TSIndexSignature/spec'; +import type { TSMethodSignature } from '../element/TSMethodSignature/spec'; +import type { TSPropertySignature } from '../element/TSPropertySignature/spec'; + +export type TypeElement = + | TSCallSignatureDeclaration + | TSConstructSignatureDeclaration + | TSIndexSignature + | TSMethodSignature + | TSPropertySignature; diff --git a/packages/ast-spec/src/unions/TypeNode.ts b/packages/ast-spec/src/unions/TypeNode.ts new file mode 100644 index 000000000000..c50630e6cd6a --- /dev/null +++ b/packages/ast-spec/src/unions/TypeNode.ts @@ -0,0 +1,74 @@ +import type { TSAnyKeyword } from '../type/TSAnyKeyword/spec'; +import type { TSArrayType } from '../type/TSArrayType/spec'; +import type { TSBigIntKeyword } from '../type/TSBigIntKeyword/spec'; +import type { TSBooleanKeyword } from '../type/TSBooleanKeyword/spec'; +import type { TSConditionalType } from '../type/TSConditionalType/spec'; +import type { TSConstructorType } from '../type/TSConstructorType/spec'; +import type { TSFunctionType } from '../type/TSFunctionType/spec'; +import type { TSImportType } from '../type/TSImportType/spec'; +import type { TSIndexedAccessType } from '../type/TSIndexedAccessType/spec'; +import type { TSInferType } from '../type/TSInferType/spec'; +import type { TSIntersectionType } from '../type/TSIntersectionType/spec'; +import type { TSIntrinsicKeyword } from '../type/TSIntrinsicType/spec'; +import type { TSLiteralType } from '../type/TSLiteralType/spec'; +import type { TSMappedType } from '../type/TSMappedType/spec'; +import type { TSNamedTupleMember } from '../type/TSNamedTupleMember/spec'; +import type { TSNeverKeyword } from '../type/TSNeverKeyword/spec'; +import type { TSNullKeyword } from '../type/TSNullKeyword/spec'; +import type { TSNumberKeyword } from '../type/TSNumberKeyword/spec'; +import type { TSObjectKeyword } from '../type/TSObjectKeyword/spec'; +import type { TSOptionalType } from '../type/TSOptionalType/spec'; +import type { TSParenthesizedType } from '../type/TSParenthesizedType/spec'; +import type { TSRestType } from '../type/TSRestType/spec'; +import type { TSStringKeyword } from '../type/TSStringKeyword/spec'; +import type { TSSymbolKeyword } from '../type/TSSymbolKeyword/spec'; +import type { TSTemplateLiteralType } from '../type/TSTemplateLiteralType/spec'; +import type { TSThisType } from '../type/TSThisType/spec'; +import type { TSTupleType } from '../type/TSTupleType/spec'; +import type { TSTypeLiteral } from '../type/TSTypeLiteral/spec'; +import type { TSTypeOperator } from '../type/TSTypeOperator/spec'; +import type { TSTypePredicate } from '../type/TSTypePredicate/spec'; +import type { TSTypeQuery } from '../type/TSTypeQuery/spec'; +import type { TSTypeReference } from '../type/TSTypeReference/spec'; +import type { TSUndefinedKeyword } from '../type/TSUndefinedKeyword/spec'; +import type { TSUnionType } from '../type/TSUnionType/spec'; +import type { TSUnknownKeyword } from '../type/TSUnknownKeyword/spec'; +import type { TSVoidKeyword } from '../type/TSVoidKeyword/spec'; + +export type TypeNode = + | TSAnyKeyword + | TSArrayType + | TSBigIntKeyword + | TSBooleanKeyword + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSIntersectionType + | TSIntrinsicKeyword + | TSLiteralType + | TSMappedType + | TSNamedTupleMember + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSOptionalType + | TSParenthesizedType + | TSRestType + | TSStringKeyword + | TSSymbolKeyword + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUndefinedKeyword + | TSUnionType + | TSUnknownKeyword + | TSVoidKeyword; diff --git a/packages/ast-spec/tests/ast-node-types.test.ts b/packages/ast-spec/tests/ast-node-types.test.ts new file mode 100644 index 000000000000..7cc247f2d094 --- /dev/null +++ b/packages/ast-spec/tests/ast-node-types.test.ts @@ -0,0 +1,16 @@ +import type { AST_NODE_TYPES } from '../src/ast-node-types'; +import type { Node } from '../src/unions/Node'; + +type GetKeys = keyof Extract; + +type AllKeys = { + readonly [T in AST_NODE_TYPES]: GetKeys; +}; + +type TakesString> = T; + +// @ts-expect-error: purposely unused +type _Test = + // forcing the test onto a new line so it isn't covered by the expect error + // If there are any enum members that don't have a corresponding TSESTree.Node, then this line will error with "Type 'string | number | symbol' is not assignable to type 'string'." + TakesString | void; diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json new file mode 100644 index 000000000000..215a0282df2b --- /dev/null +++ b/packages/ast-spec/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"] +} diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json new file mode 100644 index 000000000000..4b76ef4253b9 --- /dev/null +++ b/packages/ast-spec/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"] +} diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index f0c64a185df3..ed377ea25988 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index bc26d9d9d9a1..64fefc08f8ef 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -408,7 +408,9 @@ export default createRule({ } } - function isNoFormatTemplateTag(tag: TSESTree.Expression): boolean { + function isNoFormatTemplateTag( + tag: TSESTree.LeftHandSideExpression, + ): boolean { return tag.type === AST_NODE_TYPES.Identifier && tag.name === 'noFormat'; } diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index fcd692ca596e..b35badc6bfd4 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -31,7 +31,7 @@ "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 38db92807b9e..72ca9feaf597 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -35,7 +35,7 @@ "check:docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand", "check:configs": "jest tests/configs.test.ts --runTestsByPath --silent --runInBand", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", "generate:rules-lists": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-rules-lists.ts", diff --git a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts index 47ab5b1a74fa..1e04d080e747 100644 --- a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts +++ b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts @@ -46,7 +46,7 @@ export default util.createRule({ rules.Literal({ ...node, raw: isSeperatedNumeric(node) ? node.raw.replace(/_/g, '') : node.raw, - }); + } as never); }, }; }, diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index aee4963a0c05..f5ca89e88d60 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -167,7 +167,7 @@ export default createRule({ }); } - function getNodeType(node: TSESTree.Expression): ts.Type { + function getNodeType(node: TSESTree.Node): ts.Type { const tsNode = service.esTreeNodeToTSNodeMap.get(node); return getConstrainedTypeAtLocation(checker, tsNode); } diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index d78c4496164d..636fe2b3825a 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -40,7 +40,7 @@ export default createRule({ * Check if a given node is a string. * @param node The node to check. */ - function isStringType(node: TSESTree.Expression): boolean { + function isStringType(node: TSESTree.Node): boolean { const objectType = typeChecker.getTypeAtLocation( parserServices.esTreeNodeToTSNodeMap.get(node), ); @@ -51,7 +51,7 @@ export default createRule({ * Check if a given node is a RegExp. * @param node The node to check. */ - function isRegExpType(node: TSESTree.Expression): boolean { + function isRegExpType(node: TSESTree.Node): boolean { const objectType = typeChecker.getTypeAtLocation( parserServices.esTreeNodeToTSNodeMap.get(node), ); diff --git a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts index fb83da6f318b..af80720c2904 100644 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts @@ -82,7 +82,6 @@ function getGroup(node: TSESTree.TypeNode): Group { return Group.union; // These types should never occur as part of a union/intersection - case AST_NODE_TYPES.TSInterfaceHeritage: case AST_NODE_TYPES.TSNamedTupleMember: case AST_NODE_TYPES.TSOptionalType: case AST_NODE_TYPES.TSRestType: diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index b3402e64bde0..d2ebd2a40720 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -32,7 +32,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/packages/parser/package.json b/packages/parser/package.json index 7aaac815772d..9e9fd7f81858 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -34,7 +34,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 51f58e98474b..b130cdea237e 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -31,7 +31,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-lib.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", diff --git a/packages/scope-manager/src/scope/ScopeBase.ts b/packages/scope-manager/src/scope/ScopeBase.ts index 04f38e8a65f3..602dd81a206a 100644 --- a/packages/scope-manager/src/scope/ScopeBase.ts +++ b/packages/scope-manager/src/scope/ScopeBase.ts @@ -87,22 +87,20 @@ function isStrictScope( if (stmt.type !== AST_NODE_TYPES.ExpressionStatement) { break; } - const expr = stmt.expression; - if ( - expr.type !== AST_NODE_TYPES.Literal || - typeof expr.value !== 'string' - ) { + if (stmt.directive === 'use strict') { + return true; + } + + const expr = stmt.expression; + if (expr.type !== AST_NODE_TYPES.Literal) { break; } - if (expr.raw !== null && expr.raw !== undefined) { - if (expr.raw === '"use strict"' || expr.raw === "'use strict'") { - return true; - } - } else { - if (expr.value === 'use strict') { - return true; - } + if (expr.raw === '"use strict"' || expr.raw === "'use strict'") { + return true; + } + if (expr.value === 'use strict') { + return true; } } return false; diff --git a/packages/types/package.json b/packages/types/package.json index 5251c580de59..cd37019cbf4b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -19,7 +19,7 @@ "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", - "directory": "packages/visitor-keys" + "directory": "packages/types" }, "bugs": { "url": "https://github.com/typescript-eslint/typescript-eslint/issues" @@ -28,10 +28,11 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { + "prebuild": "yarn ts-node --transpile-only ./tools/copy-ast-spec.ts", "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only ../scope-manager/tools/generate-lib.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 59df48302df5..4bda24b13818 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,5 +1,5 @@ -export { AST_NODE_TYPES } from './ast-node-types'; -export { AST_TOKEN_TYPES } from './ast-token-types'; +export { AST_NODE_TYPES } from './ast-spec'; +export { AST_TOKEN_TYPES } from './ast-spec'; export * from './lib'; export * from './parser-options'; -export * as TSESTree from './ts-estree'; +export * from './ts-estree'; diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index e296b5668ae0..037bd3f92c97 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -1,1769 +1,21 @@ -import { AST_NODE_TYPES } from './ast-node-types'; -import { AST_TOKEN_TYPES } from './ast-token-types'; +import * as TSESTree from './ast-spec'; -export interface LineAndColumnData { - /** - * Line number (1-indexed) - */ - line: number; - /** - * Column number on the line (0-indexed) - */ - column: number; -} -export interface SourceLocation { - /** - * The position of the first character of the parsed source region - */ - start: LineAndColumnData; - /** - * The position of the first character after the parsed source region - */ - end: LineAndColumnData; -} -export type Range = [number, number]; - -export interface BaseNode { - /** - * The source location information of the node. - */ - loc: SourceLocation; - /** - * An array of two numbers. - * Both numbers are a 0-based index which is the position in the array of source code characters. - * The first is the start position of the node, the second is the end position of the node. - */ - range: Range; - /** - * The parent node of the current node - */ - parent?: Node; - - // every node *will* have a type, but let the nodes define their own exact string - // type: string; - - // we don't ever set this from within ts-estree - // source?: string | null; -} - -/* - * Token and Comment are pseudo-nodes to represent pieces of source code - * - * NOTE: - * They are not included in the `Node` union below on purpose because they - * are not ever included as part of the standard AST tree. - */ -interface BaseToken extends BaseNode { - value: string; -} - -export interface BooleanToken extends BaseToken { - type: AST_TOKEN_TYPES.Boolean; -} - -export interface IdentifierToken extends BaseToken { - type: AST_TOKEN_TYPES.Identifier; -} - -export interface JSXIdentifierToken extends BaseToken { - type: AST_TOKEN_TYPES.JSXIdentifier; -} - -export interface JSXTextToken extends BaseToken { - type: AST_TOKEN_TYPES.JSXText; -} - -export interface KeywordToken extends BaseToken { - type: AST_TOKEN_TYPES.Keyword; -} - -export interface NullToken extends BaseToken { - type: AST_TOKEN_TYPES.Null; -} - -export interface NumericToken extends BaseToken { - type: AST_TOKEN_TYPES.Numeric; -} - -export interface PunctuatorToken extends BaseToken { - type: AST_TOKEN_TYPES.Punctuator; -} - -export interface RegularExpressionToken extends BaseToken { - type: AST_TOKEN_TYPES.RegularExpression; - regex: { - pattern: string; - flags: string; - }; -} - -export interface StringToken extends BaseToken { - type: AST_TOKEN_TYPES.String; -} - -export interface TemplateToken extends BaseToken { - type: AST_TOKEN_TYPES.Template; -} - -export interface BlockComment extends BaseToken { - type: AST_TOKEN_TYPES.Block; -} - -export interface LineComment extends BaseToken { - type: AST_TOKEN_TYPES.Line; -} - -export type Comment = BlockComment | LineComment; -export type Token = - | BooleanToken - | Comment - | IdentifierToken - | JSXIdentifierToken - | JSXTextToken - | KeywordToken - | NullToken - | NumericToken - | PunctuatorToken - | RegularExpressionToken - | StringToken - | TemplateToken; - -export type OptionalRangeAndLoc = Pick< - T, - Exclude -> & { - range?: Range; - loc?: SourceLocation; -}; - -// Every single valid AST Node -// Please keep it sorted alphabetically. -export type Node = - | ArrayExpression - | ArrayPattern - | ArrowFunctionExpression - | AssignmentExpression - | AssignmentPattern - | AwaitExpression - | BigIntLiteral - | BinaryExpression - | BlockStatement - | BreakStatement - | CallExpression - | CatchClause - | ChainExpression - | ClassBody - | ClassDeclaration - | ClassExpression - | ClassProperty - | ConditionalExpression - | ContinueStatement - | DebuggerStatement - | Decorator - | DoWhileStatement - | EmptyStatement - | ExportAllDeclaration - | ExportDefaultDeclaration - | ExportNamedDeclaration - | ExportSpecifier - | ExpressionStatement - | ForInStatement - | ForOfStatement - | ForStatement - | FunctionDeclaration - | FunctionExpression - | Identifier - | IfStatement - | ImportDeclaration - | ImportDefaultSpecifier - | ImportExpression - | ImportNamespaceSpecifier - | ImportSpecifier - | JSXAttribute - | JSXClosingElement - | JSXClosingFragment - | JSXElement - | JSXEmptyExpression - | JSXExpressionContainer - | JSXFragment - | JSXIdentifier - | JSXMemberExpression - | JSXNamespacedName - | JSXOpeningElement - | JSXOpeningFragment - | JSXSpreadAttribute - | JSXSpreadChild - | JSXText - | LabeledStatement - | Literal - | LogicalExpression - | MemberExpression - | MetaProperty - | MethodDefinition - | NewExpression - | ObjectExpression - | ObjectPattern - | Program - | Property - | RestElement - | ReturnStatement - | SequenceExpression - | SpreadElement - | Super - | SwitchCase - | SwitchStatement - | TaggedTemplateExpression - | TemplateElement - | TemplateLiteral - | ThisExpression - | ThrowStatement - | TryStatement - | TSAbstractClassProperty - | TSAbstractKeyword - | TSAbstractMethodDefinition - | TSAnyKeyword - | TSArrayType - | TSAsExpression - | TSAsyncKeyword - | TSBigIntKeyword - | TSBooleanKeyword - | TSCallSignatureDeclaration - | TSClassImplements - | TSConditionalType - | TSConstructorType - | TSConstructSignatureDeclaration - | TSDeclareFunction - | TSDeclareKeyword - | TSEmptyBodyFunctionExpression - | TSEnumDeclaration - | TSEnumMember - | TSExportAssignment - | TSExportKeyword - | TSExternalModuleReference - | TSFunctionType - | TSImportEqualsDeclaration - | TSImportType - | TSIndexedAccessType - | TSIndexSignature - | TSInferType - | TSInterfaceBody - | TSInterfaceDeclaration - | TSInterfaceHeritage - | TSIntersectionType - | TSIntrinsicKeyword - | TSLiteralType - | TSMappedType - | TSMethodSignature - | TSModuleBlock - | TSModuleDeclaration - | TSNamedTupleMember - | TSNamespaceExportDeclaration - | TSNeverKeyword - | TSNonNullExpression - | TSNullKeyword - | TSNumberKeyword - | TSObjectKeyword - | TSOptionalType - | TSParameterProperty - | TSParenthesizedType - | TSPrivateKeyword - | TSPropertySignature - | TSProtectedKeyword - | TSPublicKeyword - | TSQualifiedName - | TSReadonlyKeyword - | TSRestType - | TSStaticKeyword - | TSStringKeyword - | TSSymbolKeyword - | TSTemplateLiteralType - | TSThisType - | TSTupleType - | TSTypeAliasDeclaration - | TSTypeAnnotation - | TSTypeAssertion - | TSTypeLiteral - | TSTypeOperator - | TSTypeParameter - | TSTypeParameterDeclaration - | TSTypeParameterInstantiation - | TSTypePredicate - | TSTypeQuery - | TSTypeReference - | TSUndefinedKeyword - | TSUnionType - | TSUnknownKeyword - | TSVoidKeyword - | UnaryExpression - | UpdateExpression - | VariableDeclaration - | VariableDeclarator - | WhileStatement - | WithStatement - | YieldExpression; - -////////// -// Reusable Unions -// These are based off of types used in the Typescript AST definitions -// **Ensure you sort the union members alphabetically** -////////// - -export type Accessibility = 'public' | 'protected' | 'private'; -export type BindingPattern = ArrayPattern | ObjectPattern; -export type BindingName = BindingPattern | Identifier; -export type ChainElement = - | CallExpression - | MemberExpression - | TSNonNullExpression; -export type ClassElement = - | ClassProperty - | MethodDefinition - | TSAbstractClassProperty - | TSAbstractMethodDefinition - | TSIndexSignature; -export type ClassProperty = - | ClassPropertyComputedName - | ClassPropertyNonComputedName; -export type DeclarationStatement = - | ClassDeclaration - | ClassExpression - | ExportDefaultDeclaration - | ExportAllDeclaration - | ExportNamedDeclaration - | FunctionDeclaration - | TSDeclareFunction - | TSImportEqualsDeclaration - | TSInterfaceDeclaration - | TSModuleDeclaration - | TSNamespaceExportDeclaration - | TSTypeAliasDeclaration - | TSEnumDeclaration; -export type DestructuringPattern = - | Identifier - | ObjectPattern - | ArrayPattern - | RestElement - | AssignmentPattern - | MemberExpression; -export type EntityName = Identifier | TSQualifiedName; -export type ExportDeclaration = - | ClassDeclaration - | ClassExpression - | FunctionDeclaration - | TSDeclareFunction - | TSEnumDeclaration - | TSInterfaceDeclaration - | TSModuleDeclaration - | TSTypeAliasDeclaration - | VariableDeclaration; -export type Expression = - | ArrowFunctionExpression - | AssignmentExpression - | BinaryExpression - | ChainExpression - | ConditionalExpression - | ImportExpression - | JSXClosingElement - | JSXClosingFragment - | JSXExpressionContainer - | JSXOpeningElement - | JSXOpeningFragment - | JSXSpreadChild - | LogicalExpression - | NewExpression - | RestElement - | SequenceExpression - | SpreadElement - | TSAsExpression - | TSTypeAssertion - | TSUnaryExpression - | YieldExpression; -export type ForInitialiser = Expression | VariableDeclaration; -export type FunctionLike = - | ArrowFunctionExpression - | FunctionDeclaration - | FunctionExpression - | TSDeclareFunction - | TSEmptyBodyFunctionExpression; -export type ImportClause = - | ImportDefaultSpecifier - | ImportNamespaceSpecifier - | ImportSpecifier; -export type IterationStatement = - | DoWhileStatement - | ForInStatement - | ForOfStatement - | ForStatement - | WhileStatement; -export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText; -export type JSXExpression = - | JSXEmptyExpression - | JSXSpreadChild - | JSXExpressionContainer; -export type JSXTagNameExpression = - | JSXIdentifier - | JSXMemberExpression - | JSXNamespacedName; -export type LeftHandSideExpression = - | CallExpression - | ClassExpression - | ClassDeclaration - | FunctionExpression - | LiteralExpression - | MemberExpression - | PrimaryExpression - | TaggedTemplateExpression - | TSNonNullExpression - | TSAsExpression - | ArrowFunctionExpression; -export type Literal = - | BigIntLiteral - | BooleanLiteral - | NumberLiteral - | NullLiteral - | RegExpLiteral - | StringLiteral; -export type LiteralExpression = Literal | TemplateLiteral; -export type MemberExpression = - | MemberExpressionComputedName - | MemberExpressionNonComputedName; -export type MethodDefinition = - | MethodDefinitionComputedName - | MethodDefinitionNonComputedName; -export type Modifier = - | TSAbstractKeyword - | TSAsyncKeyword - | TSPrivateKeyword - | TSProtectedKeyword - | TSPublicKeyword - | TSReadonlyKeyword - | TSStaticKeyword; -export type ObjectLiteralElementLike = - | MethodDefinition - | Property - | SpreadElement - | TSAbstractMethodDefinition; -export type Parameter = - | ArrayPattern - | AssignmentPattern - | Identifier - | ObjectPattern - | RestElement - | TSParameterProperty; -export type PrimaryExpression = - | ArrayExpression - | ArrayPattern - | ClassExpression - | FunctionExpression - | Identifier - | JSXElement - | JSXFragment - | JSXOpeningElement - | Literal - | LiteralExpression - | MetaProperty - | ObjectExpression - | ObjectPattern - | Super - | TemplateLiteral - | ThisExpression - | TSNullKeyword; -/** TODO: re-align this with EStree spec in next major release */ -export type ProgramStatement = Statement; -export type Property = PropertyComputedName | PropertyNonComputedName; -export type PropertyName = PropertyNameComputed | PropertyNameNonComputed; -export type PropertyNameComputed = Expression; -export type PropertyNameNonComputed = - | Identifier - | StringLiteral - | NumberLiteral; -export type Statement = - | BlockStatement - | BreakStatement - | ClassDeclaration - | ContinueStatement - | DebuggerStatement - | DeclarationStatement - | EmptyStatement - | ExportAllDeclaration - | ExportDefaultDeclaration - | ExportNamedDeclaration - | ExpressionStatement - | IfStatement - | IterationStatement - | ImportDeclaration - | LabeledStatement - | TSDeclareFunction - | TSEnumDeclaration - | TSExportAssignment - | TSImportEqualsDeclaration - | TSInterfaceDeclaration - | TSModuleBlock - | TSNamespaceExportDeclaration - | TSTypeAliasDeclaration - | ReturnStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | VariableDeclaration - | WithStatement; -export type TSAbstractClassProperty = - | TSAbstractClassPropertyComputedName - | TSAbstractClassPropertyNonComputedName; -export type TSAbstractMethodDefinition = - | TSAbstractMethodDefinitionComputedName - | TSAbstractMethodDefinitionNonComputedName; -export type TSMethodSignature = - | TSMethodSignatureComputedName - | TSMethodSignatureNonComputedName; -export type TSPropertySignature = - | TSPropertySignatureComputedName - | TSPropertySignatureNonComputedName; -export type TSEnumMember = - | TSEnumMemberComputedName - | TSEnumMemberNonComputedName; -export type TSUnaryExpression = - | AwaitExpression - | LeftHandSideExpression - | TSTypeAssertion - | UnaryExpression - | UpdateExpression; -export type TypeElement = - | TSCallSignatureDeclaration - | TSConstructSignatureDeclaration - | TSIndexSignature - | TSMethodSignature - | TSPropertySignature; -export type TypeNode = - | TSAnyKeyword - | TSArrayType - | TSBigIntKeyword - | TSBooleanKeyword - | TSConditionalType - | TSConstructorType - | TSFunctionType - | TSImportType - | TSIndexedAccessType - | TSInferType - | TSInterfaceHeritage - | TSIntersectionType - | TSIntrinsicKeyword - | TSLiteralType - | TSMappedType - | TSNamedTupleMember - | TSNeverKeyword - | TSNullKeyword - | TSNumberKeyword - | TSObjectKeyword - | TSOptionalType - | TSParenthesizedType - | TSRestType - | TSStringKeyword - | TSSymbolKeyword - | TSTemplateLiteralType - | TSThisType - | TSTupleType - | TSTypeLiteral - | TSTypeOperator - | TSTypePredicate - | TSTypeQuery - | TSTypeReference - | TSUndefinedKeyword - | TSUnionType - | TSUnknownKeyword - | TSVoidKeyword; - -/////////////// -// Base, common types -// **Ensure you sort the interfaces alphabetically** -/////////////// - -interface BinaryExpressionBase extends BaseNode { - operator: string; - left: Expression; - right: Expression; -} - -interface CallExpressionBase extends BaseNode { - callee: LeftHandSideExpression; - arguments: Expression[]; - typeParameters?: TSTypeParameterInstantiation; - optional: boolean; -} - -interface ClassDeclarationBase extends BaseNode { - typeParameters?: TSTypeParameterDeclaration; - superTypeParameters?: TSTypeParameterInstantiation; - id: Identifier | null; - body: ClassBody; - superClass: LeftHandSideExpression | null; - implements?: TSClassImplements[]; - abstract?: boolean; - declare?: boolean; - decorators?: Decorator[]; -} - -/** this should not be directly used - instead use ClassPropertyComputedNameBase or ClassPropertyNonComputedNameBase */ -interface ClassPropertyBase extends BaseNode { - key: PropertyName; - value: Expression | null; - computed: boolean; - static: boolean; - declare: boolean; - readonly?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - optional?: boolean; - definite?: boolean; - typeAnnotation?: TSTypeAnnotation; -} - -interface ClassPropertyComputedNameBase extends ClassPropertyBase { - key: PropertyNameComputed; - computed: true; -} - -interface ClassPropertyNonComputedNameBase extends ClassPropertyBase { - key: PropertyNameNonComputed; - computed: false; -} - -interface FunctionDeclarationBase extends BaseNode { - id: Identifier | null; - generator: boolean; - expression: boolean; - async: boolean; - params: Parameter[]; - body?: BlockStatement | null; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; - declare?: boolean; -} +// augment to add the parent property, which isn't part of the spec +declare module './ast-spec' { + interface BaseNode { + parent?: TSESTree.Node; + } -interface FunctionSignatureBase extends BaseNode { - params: Parameter[]; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; -} - -interface LiteralBase extends BaseNode { - raw: string; - value: string | boolean | null | number | RegExp | bigint; - regex?: { - pattern: string; - flags: string; - }; -} - -/** this should not be directly used - instead use MemberExpressionComputedNameBase or MemberExpressionNonComputedNameBase */ -interface MemberExpressionBase extends BaseNode { - object: LeftHandSideExpression; - property: Expression | Identifier; - computed: boolean; - optional: boolean; -} - -interface MemberExpressionComputedNameBase extends MemberExpressionBase { - property: Expression; - computed: true; -} - -interface MemberExpressionNonComputedNameBase extends MemberExpressionBase { - property: Identifier; - computed: false; -} - -/** this should not be directly used - instead use MethodDefinitionComputedNameBase or MethodDefinitionNonComputedNameBase */ -interface MethodDefinitionBase extends BaseNode { - key: PropertyName; - value: FunctionExpression | TSEmptyBodyFunctionExpression; - computed: boolean; - static: boolean; - kind: 'method' | 'get' | 'set' | 'constructor'; - optional?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - typeParameters?: TSTypeParameterDeclaration; -} - -interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { - key: PropertyNameComputed; - computed: true; -} - -interface MethodDefinitionNonComputedNameBase extends MethodDefinitionBase { - key: PropertyNameNonComputed; - computed: false; -} - -interface PropertyBase extends BaseNode { - type: AST_NODE_TYPES.Property; - key: PropertyName; - value: - | Expression - | AssignmentPattern - | BindingName - | TSEmptyBodyFunctionExpression; - computed: boolean; - method: boolean; - shorthand: boolean; - optional?: boolean; - kind: 'init' | 'get' | 'set'; -} - -interface TSEnumMemberBase extends BaseNode { - type: AST_NODE_TYPES.TSEnumMember; - id: - | PropertyNameNonComputed - // this should only happen in semantically invalid code (ts error 1164) - | PropertyNameComputed; - initializer?: Expression; - computed?: boolean; -} - -interface TSHeritageBase extends BaseNode { - expression: Expression; - typeParameters?: TSTypeParameterInstantiation; -} - -interface TSMethodSignatureBase extends BaseNode { - type: AST_NODE_TYPES.TSMethodSignature; - key: PropertyName; - computed: boolean; - params: Parameter[]; - optional?: boolean; - returnType?: TSTypeAnnotation; - readonly?: boolean; - typeParameters?: TSTypeParameterDeclaration; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; -} - -interface TSPropertySignatureBase extends BaseNode { - type: AST_NODE_TYPES.TSPropertySignature; - key: PropertyName; - optional?: boolean; - computed: boolean; - typeAnnotation?: TSTypeAnnotation; - initializer?: Expression; - readonly?: boolean; - static?: boolean; - export?: boolean; - accessibility?: Accessibility; -} - -interface UnaryExpressionBase extends BaseNode { - operator: string; - prefix: boolean; - argument: LeftHandSideExpression | Literal | UnaryExpression; -} - -/////////////// -// Typescript ESTree Nodes -// **Ensure you sort the interfaces alphabetically** -/////////////// - -export interface ArrayExpression extends BaseNode { - type: AST_NODE_TYPES.ArrayExpression; - elements: Expression[]; -} - -export interface ArrayPattern extends BaseNode { - type: AST_NODE_TYPES.ArrayPattern; - elements: (DestructuringPattern | null)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface ArrowFunctionExpression extends BaseNode { - type: AST_NODE_TYPES.ArrowFunctionExpression; - generator: boolean; - id: null; - params: Parameter[]; - body: Expression | BlockStatement; - async: boolean; - expression: boolean; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; -} - -export interface AssignmentExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.AssignmentExpression; - operator: - | '-=' - | '??=' - | '**=' - | '*=' - | '/=' - | '&&=' - | '&=' - | '%=' - | '^=' - | '+=' - | '<<=' - | '=' - | '>>=' - | '>>>=' - | '|=' - | '||='; -} - -export interface AssignmentPattern extends BaseNode { - type: AST_NODE_TYPES.AssignmentPattern; - left: BindingName; - right: Expression; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface AwaitExpression extends BaseNode { - type: AST_NODE_TYPES.AwaitExpression; - argument: TSUnaryExpression; -} - -export interface BigIntLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: bigint | null; - bigint: string; -} - -export interface BinaryExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.BinaryExpression; -} - -export interface BlockStatement extends BaseNode { - type: AST_NODE_TYPES.BlockStatement; - body: Statement[]; -} - -export interface BooleanLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: boolean; -} - -export interface BreakStatement extends BaseNode { - type: AST_NODE_TYPES.BreakStatement; - label: Identifier | null; -} - -export interface ChainExpression extends BaseNode { - type: AST_NODE_TYPES.ChainExpression; - expression: ChainElement; -} - -export interface CallExpression extends CallExpressionBase { - type: AST_NODE_TYPES.CallExpression; -} + // TODO - make this change as a breaking change + /* + interface BaseNode { + parent: TSESTree.Node; + } -export interface CatchClause extends BaseNode { - type: AST_NODE_TYPES.CatchClause; - param: BindingName | null; - body: BlockStatement; + interface Program { + parent?: undefined; + } + */ } -export interface ClassBody extends BaseNode { - type: AST_NODE_TYPES.ClassBody; - body: ClassElement[]; -} - -export interface ClassDeclaration extends ClassDeclarationBase { - type: AST_NODE_TYPES.ClassDeclaration; -} - -export interface ClassExpression extends ClassDeclarationBase { - type: AST_NODE_TYPES.ClassExpression; -} - -export interface ClassPropertyComputedName - extends ClassPropertyComputedNameBase { - type: AST_NODE_TYPES.ClassProperty; -} - -export interface ClassPropertyNonComputedName - extends ClassPropertyNonComputedNameBase { - type: AST_NODE_TYPES.ClassProperty; -} - -export interface ConditionalExpression extends BaseNode { - type: AST_NODE_TYPES.ConditionalExpression; - test: Expression; - consequent: Expression; - alternate: Expression; -} - -export interface ContinueStatement extends BaseNode { - type: AST_NODE_TYPES.ContinueStatement; - label: Identifier | null; -} - -export interface DebuggerStatement extends BaseNode { - type: AST_NODE_TYPES.DebuggerStatement; -} - -export interface Decorator extends BaseNode { - type: AST_NODE_TYPES.Decorator; - expression: LeftHandSideExpression; -} - -export interface DoWhileStatement extends BaseNode { - type: AST_NODE_TYPES.DoWhileStatement; - test: Expression; - body: Statement; -} - -export interface EmptyStatement extends BaseNode { - type: AST_NODE_TYPES.EmptyStatement; -} - -export interface ExportAllDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportAllDeclaration; - source: Expression | null; - exportKind: 'type' | 'value'; - exported: Identifier | null; -} - -export interface ExportDefaultDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportDefaultDeclaration; - declaration: ExportDeclaration | Expression; - exportKind: 'type' | 'value'; -} - -export interface ExportNamedDeclaration extends BaseNode { - type: AST_NODE_TYPES.ExportNamedDeclaration; - declaration: ExportDeclaration | null; - specifiers: ExportSpecifier[]; - source: Expression | null; - exportKind: 'type' | 'value'; -} - -export interface ExportSpecifier extends BaseNode { - type: AST_NODE_TYPES.ExportSpecifier; - local: Identifier; - exported: Identifier; -} - -export interface ExpressionStatement extends BaseNode { - type: AST_NODE_TYPES.ExpressionStatement; - expression: Expression; - directive?: string; -} - -export interface ForInStatement extends BaseNode { - type: AST_NODE_TYPES.ForInStatement; - left: ForInitialiser; - right: Expression; - body: Statement; -} - -export interface ForOfStatement extends BaseNode { - type: AST_NODE_TYPES.ForOfStatement; - left: ForInitialiser; - right: Expression; - body: Statement; - await: boolean; -} - -export interface ForStatement extends BaseNode { - type: AST_NODE_TYPES.ForStatement; - init: Expression | ForInitialiser | null; - test: Expression | null; - update: Expression | null; - body: Statement; -} - -export interface FunctionDeclaration extends FunctionDeclarationBase { - type: AST_NODE_TYPES.FunctionDeclaration; - body: BlockStatement; -} - -export interface FunctionExpression extends FunctionDeclarationBase { - type: AST_NODE_TYPES.FunctionExpression; - body: BlockStatement; -} - -export interface Identifier extends BaseNode { - type: AST_NODE_TYPES.Identifier; - name: string; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface IfStatement extends BaseNode { - type: AST_NODE_TYPES.IfStatement; - test: Expression; - consequent: Statement; - alternate: Statement | null; -} - -export interface ImportDeclaration extends BaseNode { - type: AST_NODE_TYPES.ImportDeclaration; - source: Literal; - specifiers: ImportClause[]; - importKind: 'type' | 'value'; -} - -export interface ImportDefaultSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportDefaultSpecifier; - local: Identifier; -} - -export interface ImportExpression extends BaseNode { - type: AST_NODE_TYPES.ImportExpression; - source: Expression; -} - -export interface ImportNamespaceSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportNamespaceSpecifier; - local: Identifier; -} - -export interface ImportSpecifier extends BaseNode { - type: AST_NODE_TYPES.ImportSpecifier; - local: Identifier; - imported: Identifier; -} - -export interface JSXAttribute extends BaseNode { - type: AST_NODE_TYPES.JSXAttribute; - name: JSXIdentifier | JSXNamespacedName; - value: Literal | JSXExpression | null; -} - -export interface JSXClosingElement extends BaseNode { - type: AST_NODE_TYPES.JSXClosingElement; - name: JSXTagNameExpression; -} - -export interface JSXClosingFragment extends BaseNode { - type: AST_NODE_TYPES.JSXClosingFragment; -} - -export interface JSXElement extends BaseNode { - type: AST_NODE_TYPES.JSXElement; - openingElement: JSXOpeningElement; - closingElement: JSXClosingElement | null; - children: JSXChild[]; -} - -export interface JSXEmptyExpression extends BaseNode { - type: AST_NODE_TYPES.JSXEmptyExpression; -} - -export interface JSXExpressionContainer extends BaseNode { - type: AST_NODE_TYPES.JSXExpressionContainer; - expression: Expression | JSXEmptyExpression; -} - -export interface JSXFragment extends BaseNode { - type: AST_NODE_TYPES.JSXFragment; - openingFragment: JSXOpeningFragment; - closingFragment: JSXClosingFragment; - children: JSXChild[]; -} - -export interface JSXIdentifier extends BaseNode { - type: AST_NODE_TYPES.JSXIdentifier; - name: string; -} - -export interface JSXMemberExpression extends BaseNode { - type: AST_NODE_TYPES.JSXMemberExpression; - object: JSXTagNameExpression; - 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; - selfClosing: boolean; - name: JSXTagNameExpression; - attributes: (JSXAttribute | JSXSpreadAttribute)[]; -} - -export interface JSXOpeningFragment extends BaseNode { - type: AST_NODE_TYPES.JSXOpeningFragment; -} - -export interface JSXSpreadAttribute extends BaseNode { - type: AST_NODE_TYPES.JSXSpreadAttribute; - argument: Expression; -} - -export interface JSXSpreadChild extends BaseNode { - type: AST_NODE_TYPES.JSXSpreadChild; - expression: Expression | JSXEmptyExpression; -} - -export interface JSXText extends BaseNode { - type: AST_NODE_TYPES.JSXText; - value: string; - raw: string; -} - -export interface LabeledStatement extends BaseNode { - type: AST_NODE_TYPES.LabeledStatement; - label: Identifier; - body: Statement; -} - -export interface LogicalExpression extends BinaryExpressionBase { - type: AST_NODE_TYPES.LogicalExpression; -} - -export interface MemberExpressionComputedName - extends MemberExpressionComputedNameBase { - type: AST_NODE_TYPES.MemberExpression; -} - -export interface MemberExpressionNonComputedName - extends MemberExpressionNonComputedNameBase { - type: AST_NODE_TYPES.MemberExpression; -} - -export interface MetaProperty extends BaseNode { - type: AST_NODE_TYPES.MetaProperty; - meta: Identifier; - property: Identifier; -} - -export interface MethodDefinitionComputedName - extends MethodDefinitionComputedNameBase { - type: AST_NODE_TYPES.MethodDefinition; -} - -export interface MethodDefinitionNonComputedName - extends MethodDefinitionNonComputedNameBase { - type: AST_NODE_TYPES.MethodDefinition; -} - -export interface NewExpression extends BaseNode { - type: AST_NODE_TYPES.NewExpression; - callee: LeftHandSideExpression; - arguments: Expression[]; - typeParameters?: TSTypeParameterInstantiation; -} - -export interface NumberLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: number; -} - -export interface NullLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: null; -} - -export interface ObjectExpression extends BaseNode { - type: AST_NODE_TYPES.ObjectExpression; - properties: ObjectLiteralElementLike[]; -} - -export interface ObjectPattern extends BaseNode { - type: AST_NODE_TYPES.ObjectPattern; - properties: (Property | RestElement)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; -} - -export interface Program extends BaseNode { - type: AST_NODE_TYPES.Program; - body: Statement[]; - sourceType: 'module' | 'script'; - comments?: Comment[]; - tokens?: Token[]; -} - -export interface PropertyComputedName extends PropertyBase { - key: PropertyNameComputed; - computed: true; -} - -export interface PropertyNonComputedName extends PropertyBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface RegExpLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: RegExp | null; -} - -export interface RestElement extends BaseNode { - type: AST_NODE_TYPES.RestElement; - argument: DestructuringPattern; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - value?: AssignmentPattern; - decorators?: Decorator[]; -} - -export interface ReturnStatement extends BaseNode { - type: AST_NODE_TYPES.ReturnStatement; - argument: Expression | null; -} - -export interface SequenceExpression extends BaseNode { - type: AST_NODE_TYPES.SequenceExpression; - expressions: Expression[]; -} - -export interface SpreadElement extends BaseNode { - type: AST_NODE_TYPES.SpreadElement; - argument: Expression; -} - -export interface StringLiteral extends LiteralBase { - type: AST_NODE_TYPES.Literal; - value: string; -} - -export interface Super extends BaseNode { - type: AST_NODE_TYPES.Super; -} - -export interface SwitchCase extends BaseNode { - type: AST_NODE_TYPES.SwitchCase; - test: Expression | null; - consequent: Statement[]; -} - -export interface SwitchStatement extends BaseNode { - type: AST_NODE_TYPES.SwitchStatement; - discriminant: Expression; - cases: SwitchCase[]; -} - -export interface TaggedTemplateExpression extends BaseNode { - type: AST_NODE_TYPES.TaggedTemplateExpression; - typeParameters?: TSTypeParameterInstantiation; - tag: LeftHandSideExpression; - quasi: TemplateLiteral; -} - -export interface TemplateElement extends BaseNode { - type: AST_NODE_TYPES.TemplateElement; - value: { - raw: string; - cooked: string; - }; - tail: boolean; -} - -export interface TemplateLiteral extends BaseNode { - type: AST_NODE_TYPES.TemplateLiteral; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -export interface ThisExpression extends BaseNode { - type: AST_NODE_TYPES.ThisExpression; -} - -export interface ThrowStatement extends BaseNode { - type: AST_NODE_TYPES.ThrowStatement; - argument: Statement | TSAsExpression | null; -} - -export interface TryStatement extends BaseNode { - type: AST_NODE_TYPES.TryStatement; - block: BlockStatement; - handler: CatchClause | null; - finalizer: BlockStatement | null; -} - -export interface TSAbstractClassPropertyComputedName - extends ClassPropertyComputedNameBase { - type: AST_NODE_TYPES.TSAbstractClassProperty; -} - -export interface TSAbstractClassPropertyNonComputedName - extends ClassPropertyNonComputedNameBase { - type: AST_NODE_TYPES.TSAbstractClassProperty; -} - -export interface TSAbstractKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAbstractKeyword; -} - -export interface TSAbstractMethodDefinitionComputedName - extends MethodDefinitionComputedNameBase { - type: AST_NODE_TYPES.TSAbstractMethodDefinition; -} - -export interface TSAbstractMethodDefinitionNonComputedName - extends MethodDefinitionNonComputedNameBase { - type: AST_NODE_TYPES.TSAbstractMethodDefinition; -} - -export interface TSAnyKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAnyKeyword; -} - -export interface TSArrayType extends BaseNode { - type: AST_NODE_TYPES.TSArrayType; - elementType: TypeNode; -} - -export interface TSAsExpression extends BaseNode { - type: AST_NODE_TYPES.TSAsExpression; - expression: Expression; - typeAnnotation: TypeNode; -} - -export interface TSAsyncKeyword extends BaseNode { - type: AST_NODE_TYPES.TSAsyncKeyword; -} - -export interface TSBigIntKeyword extends BaseNode { - type: AST_NODE_TYPES.TSBigIntKeyword; -} - -export interface TSBooleanKeyword extends BaseNode { - type: AST_NODE_TYPES.TSBooleanKeyword; -} - -export interface TSCallSignatureDeclaration extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSCallSignatureDeclaration; -} - -export interface TSClassImplements extends TSHeritageBase { - type: AST_NODE_TYPES.TSClassImplements; -} - -export interface TSConditionalType extends BaseNode { - type: AST_NODE_TYPES.TSConditionalType; - checkType: TypeNode; - extendsType: TypeNode; - trueType: TypeNode; - falseType: TypeNode; -} - -export interface TSConstructorType extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSConstructorType; - abstract: boolean; -} - -export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSConstructSignatureDeclaration; -} - -export interface TSDeclareFunction extends FunctionDeclarationBase { - type: AST_NODE_TYPES.TSDeclareFunction; -} - -export interface TSDeclareKeyword extends BaseNode { - type: AST_NODE_TYPES.TSDeclareKeyword; -} - -export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { - type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; - body: null; -} - -export interface TSEnumDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSEnumDeclaration; - id: Identifier; - members: TSEnumMember[]; - const?: boolean; - declare?: boolean; - modifiers?: Modifier[]; -} - -/** - * this should only really happen in semantically invalid code (errors 1164 and 2452) - * - * VALID: - * enum Foo { ['a'] } - * - * INVALID: - * const x = 'a'; - * enum Foo { [x] } - * enum Bar { ['a' + 'b'] } - */ -export interface TSEnumMemberComputedName extends TSEnumMemberBase { - id: PropertyNameComputed; - computed: true; -} - -export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { - id: PropertyNameNonComputed; - computed?: false; -} - -export interface TSExportAssignment extends BaseNode { - type: AST_NODE_TYPES.TSExportAssignment; - expression: Expression; -} - -export interface TSExportKeyword extends BaseNode { - type: AST_NODE_TYPES.TSExportKeyword; -} - -export interface TSExternalModuleReference extends BaseNode { - type: AST_NODE_TYPES.TSExternalModuleReference; - expression: Expression; -} - -export interface TSFunctionType extends FunctionSignatureBase { - type: AST_NODE_TYPES.TSFunctionType; -} - -export interface TSImportEqualsDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSImportEqualsDeclaration; - id: Identifier; - moduleReference: EntityName | TSExternalModuleReference; - importKind: 'type' | 'value'; - isExport: boolean; -} - -export interface TSImportType extends BaseNode { - type: AST_NODE_TYPES.TSImportType; - isTypeOf: boolean; - parameter: TypeNode; - qualifier: EntityName | null; - typeParameters: TSTypeParameterInstantiation | null; -} - -export interface TSIndexedAccessType extends BaseNode { - type: AST_NODE_TYPES.TSIndexedAccessType; - objectType: TypeNode; - indexType: TypeNode; -} - -export interface TSIndexSignature extends BaseNode { - type: AST_NODE_TYPES.TSIndexSignature; - parameters: Parameter[]; - typeAnnotation?: TSTypeAnnotation; - readonly?: boolean; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; -} - -export interface TSInferType extends BaseNode { - type: AST_NODE_TYPES.TSInferType; - typeParameter: TSTypeParameter; -} - -export interface TSInterfaceDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSInterfaceDeclaration; - body: TSInterfaceBody; - id: Identifier; - typeParameters?: TSTypeParameterDeclaration; - extends?: TSInterfaceHeritage[]; - implements?: TSInterfaceHeritage[]; - abstract?: boolean; - declare?: boolean; -} - -export interface TSInterfaceBody extends BaseNode { - type: AST_NODE_TYPES.TSInterfaceBody; - body: TypeElement[]; -} - -export interface TSInterfaceHeritage extends TSHeritageBase { - type: AST_NODE_TYPES.TSInterfaceHeritage; -} - -export interface TSIntersectionType extends BaseNode { - type: AST_NODE_TYPES.TSIntersectionType; - types: TypeNode[]; -} - -export interface TSIntrinsicKeyword extends BaseNode { - type: AST_NODE_TYPES.TSIntrinsicKeyword; -} - -export interface TSLiteralType extends BaseNode { - type: AST_NODE_TYPES.TSLiteralType; - literal: LiteralExpression | UnaryExpression | UpdateExpression; -} - -export interface TSMappedType extends BaseNode { - type: AST_NODE_TYPES.TSMappedType; - typeParameter: TSTypeParameter; - readonly?: boolean | '-' | '+'; - optional?: boolean | '-' | '+'; - typeAnnotation?: TypeNode; - nameType: TypeNode | null; -} - -export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { - key: PropertyNameComputed; - computed: true; -} - -export interface TSMethodSignatureNonComputedName - extends TSMethodSignatureBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface TSModuleBlock extends BaseNode { - type: AST_NODE_TYPES.TSModuleBlock; - body: Statement[]; -} - -export interface TSModuleDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSModuleDeclaration; - id: Identifier | Literal; - body?: TSModuleBlock | TSModuleDeclaration; - global?: boolean; - declare?: boolean; - modifiers?: Modifier[]; -} - -export interface TSNamedTupleMember extends BaseNode { - type: AST_NODE_TYPES.TSNamedTupleMember; - elementType: TypeNode; - label: Identifier; - optional: boolean; -} - -export interface TSNamespaceExportDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSNamespaceExportDeclaration; - id: Identifier; -} - -export interface TSNeverKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNeverKeyword; -} - -export interface TSNonNullExpression extends BaseNode { - type: AST_NODE_TYPES.TSNonNullExpression; - expression: Expression; -} - -export interface TSNullKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNullKeyword; -} - -export interface TSNumberKeyword extends BaseNode { - type: AST_NODE_TYPES.TSNumberKeyword; -} - -export interface TSObjectKeyword extends BaseNode { - type: AST_NODE_TYPES.TSObjectKeyword; -} - -export interface TSOptionalType extends BaseNode { - type: AST_NODE_TYPES.TSOptionalType; - typeAnnotation: TypeNode; -} - -export interface TSParameterProperty extends BaseNode { - type: AST_NODE_TYPES.TSParameterProperty; - accessibility?: Accessibility; - readonly?: boolean; - static?: boolean; - export?: boolean; - parameter: AssignmentPattern | BindingName | RestElement; - decorators?: Decorator[]; -} - -export interface TSParenthesizedType extends BaseNode { - type: AST_NODE_TYPES.TSParenthesizedType; - typeAnnotation: TypeNode; -} - -export interface TSPropertySignatureComputedName - extends TSPropertySignatureBase { - key: PropertyNameComputed; - computed: true; -} - -export interface TSPropertySignatureNonComputedName - extends TSPropertySignatureBase { - key: PropertyNameNonComputed; - computed: false; -} - -export interface TSPublicKeyword extends BaseNode { - type: AST_NODE_TYPES.TSPublicKeyword; -} - -export interface TSPrivateKeyword extends BaseNode { - type: AST_NODE_TYPES.TSPrivateKeyword; -} - -export interface TSProtectedKeyword extends BaseNode { - type: AST_NODE_TYPES.TSProtectedKeyword; -} - -export interface TSQualifiedName extends BaseNode { - type: AST_NODE_TYPES.TSQualifiedName; - left: EntityName; - right: Identifier; -} - -export interface TSReadonlyKeyword extends BaseNode { - type: AST_NODE_TYPES.TSReadonlyKeyword; -} - -export interface TSRestType extends BaseNode { - type: AST_NODE_TYPES.TSRestType; - typeAnnotation: TypeNode; -} - -export interface TSStaticKeyword extends BaseNode { - type: AST_NODE_TYPES.TSStaticKeyword; -} - -export interface TSStringKeyword extends BaseNode { - type: AST_NODE_TYPES.TSStringKeyword; -} - -export interface TSSymbolKeyword extends BaseNode { - type: AST_NODE_TYPES.TSSymbolKeyword; -} - -export interface TSTemplateLiteralType extends BaseNode { - type: AST_NODE_TYPES.TSTemplateLiteralType; - quasis: TemplateElement[]; - types: TypeNode[]; -} - -export interface TSThisType extends BaseNode { - type: AST_NODE_TYPES.TSThisType; -} - -export interface TSTupleType extends BaseNode { - type: AST_NODE_TYPES.TSTupleType; - elementTypes: TypeNode[]; -} - -export interface TSTypeAliasDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSTypeAliasDeclaration; - id: Identifier; - typeAnnotation: TypeNode; - declare?: boolean; - typeParameters?: TSTypeParameterDeclaration; -} - -export interface TSTypeAnnotation extends BaseNode { - type: AST_NODE_TYPES.TSTypeAnnotation; - typeAnnotation: TypeNode; -} - -export interface TSTypeAssertion extends BaseNode { - type: AST_NODE_TYPES.TSTypeAssertion; - typeAnnotation: TypeNode; - expression: Expression; -} - -export interface TSTypeLiteral extends BaseNode { - type: AST_NODE_TYPES.TSTypeLiteral; - members: TypeElement[]; -} - -export interface TSTypeOperator extends BaseNode { - type: AST_NODE_TYPES.TSTypeOperator; - operator: 'keyof' | 'unique' | 'readonly'; - typeAnnotation?: TypeNode; -} - -export interface TSTypeParameter extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameter; - name: Identifier; - constraint?: TypeNode; - default?: TypeNode; -} - -export interface TSTypeParameterDeclaration extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameterDeclaration; - params: TSTypeParameter[]; -} - -export interface TSTypeParameterInstantiation extends BaseNode { - type: AST_NODE_TYPES.TSTypeParameterInstantiation; - params: TypeNode[]; -} - -export interface TSTypePredicate extends BaseNode { - type: AST_NODE_TYPES.TSTypePredicate; - asserts: boolean; - parameterName: Identifier | TSThisType; - typeAnnotation: TSTypeAnnotation | null; -} - -export interface TSTypeQuery extends BaseNode { - type: AST_NODE_TYPES.TSTypeQuery; - exprName: EntityName; -} - -export interface TSTypeReference extends BaseNode { - type: AST_NODE_TYPES.TSTypeReference; - typeName: EntityName; - typeParameters?: TSTypeParameterInstantiation; -} - -export interface TSUndefinedKeyword extends BaseNode { - type: AST_NODE_TYPES.TSUndefinedKeyword; -} - -export interface TSUnionType extends BaseNode { - type: AST_NODE_TYPES.TSUnionType; - types: TypeNode[]; -} - -export interface TSUnknownKeyword extends BaseNode { - type: AST_NODE_TYPES.TSUnknownKeyword; -} - -export interface TSVoidKeyword extends BaseNode { - type: AST_NODE_TYPES.TSVoidKeyword; -} - -export interface UpdateExpression extends UnaryExpressionBase { - type: AST_NODE_TYPES.UpdateExpression; - operator: '++' | '--'; -} - -export interface UnaryExpression extends UnaryExpressionBase { - type: AST_NODE_TYPES.UnaryExpression; - operator: '+' | '-' | '!' | '~' | 'delete' | 'void' | 'typeof'; -} - -export interface VariableDeclaration extends BaseNode { - type: AST_NODE_TYPES.VariableDeclaration; - // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` - declarations: VariableDeclarator[]; - kind: 'let' | 'const' | 'var'; - declare?: boolean; -} - -export interface VariableDeclarator extends BaseNode { - type: AST_NODE_TYPES.VariableDeclarator; - id: BindingName; - init: Expression | null; - definite?: boolean; -} - -export interface WhileStatement extends BaseNode { - type: AST_NODE_TYPES.WhileStatement; - test: Expression; - body: Statement; -} - -export interface WithStatement extends BaseNode { - type: AST_NODE_TYPES.WithStatement; - object: Expression; - body: Statement; -} - -export interface YieldExpression extends BaseNode { - type: AST_NODE_TYPES.YieldExpression; - delegate: boolean; - argument?: Expression; -} +export * as TSESTree from './ast-spec'; diff --git a/packages/types/tools/copy-ast-spec.ts b/packages/types/tools/copy-ast-spec.ts new file mode 100644 index 000000000000..ed231195eeb4 --- /dev/null +++ b/packages/types/tools/copy-ast-spec.ts @@ -0,0 +1,59 @@ +import chlidProcess from 'child_process'; +import fs from 'fs'; +import path from 'path'; +import { promisify } from 'util'; + +const readFile = promisify(fs.readFile); +const writeFile = promisify(fs.writeFile); +const execAsync = promisify(chlidProcess.exec); + +const AST_SPEC_PATH = path.resolve(__dirname, '../../ast-spec'); +const OUTPUT_PATH = path.join(path.resolve(__dirname, '../src/')); + +// ensure the package is built +chlidProcess.execSync('yarn build', { cwd: AST_SPEC_PATH }); + +const HEADER = `\ +/********************************************** + * DO NOT MODIFY THIS FILE MANUALLY * + * * + * THIS FILE HAS BEEN COPIED FROM ast-spec. * + * ANY CHANGES WILL BE LOST ON THE NEXT BUILD * + * * + * MAKE CHANGES TO ast-spec AND THEN RUN * + * yarn build * + **********************************************/ + +`; + +async function copyFile( + folderName: string, + fileName: string, + transformer: (code: string) => string = (s): string => s, +): Promise { + const code = await readFile( + path.join(AST_SPEC_PATH, folderName, fileName), + 'utf-8', + ); + + const transformedCode = transformer(code); + + const outpath = path.join(OUTPUT_PATH, fileName); + await writeFile(outpath, HEADER + transformedCode, { + encoding: 'utf-8', + }); + + await execAsync(`yarn prettier --write ${outpath}`); + + console.log('Copied', fileName); +} + +async function main(): Promise { + await Promise.all([ + copyFile('dist', 'ast-spec.ts', code => + code.replace(/export declare enum/g, 'export enum'), + ), + ]); +} + +void main(); diff --git a/packages/types/tsconfig.build.json b/packages/types/tsconfig.build.json index 215a0282df2b..b9ac3e1b9770 100644 --- a/packages/types/tsconfig.build.json +++ b/packages/types/tsconfig.build.json @@ -6,5 +6,6 @@ "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "typings"] + "include": ["src", "typings"], + "references": [] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 9cea515ba6b2..d1305674c8bb 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -4,5 +4,6 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [] } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 4f65000f6bc6..61d6febc6d67 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -34,7 +34,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index e0c34e513ec9..aad29f9b1467 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1987,7 +1987,7 @@ export class Converter { let regex = null; try { regex = new RegExp(pattern, flags); - } catch (exception) { + } catch (exception: unknown) { regex = null; } @@ -2166,7 +2166,7 @@ export class Converter { range: [start, end], }); } else { - return this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: unescapeStringLiteralText(text), raw: text, diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 594ca4ce55b1..e4a90301784d 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -31,7 +31,7 @@ "build": "tsc -b tsconfig.build.json", "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index abe82a67cfb6..b1df8c206699 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -22,9 +22,11 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/typescript-and-tslint-plugins-together:/usr/linked @@ -47,9 +49,11 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/vue-sfc:/usr/linked @@ -72,9 +76,11 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/vue-jsx:/usr/linked @@ -97,9 +103,11 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/recommended-does-not-require-program:/usr/linked @@ -122,9 +130,11 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/markdown:/usr/linked @@ -147,8 +157,10 @@ services: - ../../packages/types/:/usr/types - /usr/types/tests - ../../packages/visitor-keys/:/usr/visitor-keys - - /usr/types/visitor-keys + - /usr/visitor-keys/tests - ../../packages/scope-manager/:/usr/scope-manager - - /usr/types/scope-manager + - /usr/scope-manager/tests + - ../../packages/ast-spec/:/usr/ast-spec + - /usr/ast-spec/tests # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/eslint-v6:/usr/linked diff --git a/tests/integration/fixtures/eslint-v6/test.sh b/tests/integration/fixtures/eslint-v6/test.sh index ab184f9ceb15..e2c988854164 100755 --- a/tests/integration/fixtures/eslint-v6/test.sh +++ b/tests/integration/fixtures/eslint-v6/test.sh @@ -9,6 +9,7 @@ npm install npm install eslint@6.0.0 # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/tests/integration/fixtures/markdown/test.sh b/tests/integration/fixtures/markdown/test.sh index 30cd435eaac7..91e4c4f0a045 100755 --- a/tests/integration/fixtures/markdown/test.sh +++ b/tests/integration/fixtures/markdown/test.sh @@ -8,6 +8,7 @@ node /usr/utils/generate-package-json.js npm install # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.sh b/tests/integration/fixtures/recommended-does-not-require-program/test.sh index cfe4d0e6d570..ea25b6d7292d 100755 --- a/tests/integration/fixtures/recommended-does-not-require-program/test.sh +++ b/tests/integration/fixtures/recommended-does-not-require-program/test.sh @@ -8,6 +8,7 @@ node /usr/utils/generate-package-json.js npm install # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh index 6abbeb42aa61..27c243e38081 100755 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh +++ b/tests/integration/fixtures/typescript-and-tslint-plugins-together/test.sh @@ -8,6 +8,7 @@ node /usr/utils/generate-package-json.js npm install # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/tests/integration/fixtures/vue-jsx/test.sh b/tests/integration/fixtures/vue-jsx/test.sh index 96376fb0f83c..fc41933a87ec 100755 --- a/tests/integration/fixtures/vue-jsx/test.sh +++ b/tests/integration/fixtures/vue-jsx/test.sh @@ -8,6 +8,7 @@ node /usr/utils/generate-package-json.js npm install # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/tests/integration/fixtures/vue-sfc/test.sh b/tests/integration/fixtures/vue-sfc/test.sh index 80f7cfe4adf4..e22a51a62c62 100755 --- a/tests/integration/fixtures/vue-sfc/test.sh +++ b/tests/integration/fixtures/vue-sfc/test.sh @@ -8,6 +8,7 @@ node /usr/utils/generate-package-json.js npm install # Use the local volumes for our own packages +npm install $(npm pack /usr/ast-spec | tail -1) npm install $(npm pack /usr/types | tail -1) npm install $(npm pack /usr/visitor-keys | tail -1) npm install $(npm pack /usr/scope-manager | tail -1) diff --git a/yarn.lock b/yarn.lock index 6d63f30fdd4b..589b6e6b4e17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1638,6 +1638,36 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" +"@microsoft/api-extractor-model@7.12.2": + version "7.12.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.12.2.tgz#d48b35e8ed20643b1c19d7a4f80c90c42dc7d1d8" + integrity sha512-EU+U09Mj65zUH0qwPF4PFJiL6Y+PQQE/RRGEHEDGJJzab/mRQDpKOyrzSdb00xvcd/URehIHJqC55cY2Y4jGOA== + dependencies: + "@microsoft/tsdoc" "0.12.24" + "@rushstack/node-core-library" "3.36.0" + +"@microsoft/api-extractor@^7.13.2": + version "7.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.13.2.tgz#c44762d27aee05c4da16c03fc8786bd0fa31c7eb" + integrity sha512-2fD0c8OxZW+e6NTaxbtrdNxXVuX7aqil3+cqig3pKsHymvUuRJVCEAcAJmZrJ/ENqYXNiB265EyqOT6VxbMysw== + dependencies: + "@microsoft/api-extractor-model" "7.12.2" + "@microsoft/tsdoc" "0.12.24" + "@rushstack/node-core-library" "3.36.0" + "@rushstack/rig-package" "0.2.10" + "@rushstack/ts-command-line" "4.7.8" + colors "~1.2.1" + lodash "~4.17.15" + resolve "~1.17.0" + semver "~7.3.0" + source-map "~0.6.1" + typescript "~4.1.3" + +"@microsoft/tsdoc@0.12.24": + version "0.12.24" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.24.tgz#30728e34ebc90351dd3aff4e18d038eed2c3e098" + integrity sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg== + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -1781,6 +1811,39 @@ dependencies: "@types/node" ">= 8" +"@rushstack/node-core-library@3.36.0": + version "3.36.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.36.0.tgz#95dace39d763c8695d6607c421f95c6ac65b0ed4" + integrity sha512-bID2vzXpg8zweXdXgQkKToEdZwVrVCN9vE9viTRk58gqzYaTlz4fMId6V3ZfpXN6H0d319uGi2KDlm+lUEeqCg== + dependencies: + "@types/node" "10.17.13" + colors "~1.2.1" + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.17.0" + semver "~7.3.0" + timsort "~0.3.0" + z-schema "~3.18.3" + +"@rushstack/rig-package@0.2.10": + version "0.2.10" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.2.10.tgz#e861eb94953d8c22c509dc3e9d91d6f337eab3cd" + integrity sha512-WXYerEJEPf8bS3ruqfM57NnwXtA7ehn8VJjLjrjls6eSduE5CRydcob/oBTzlHKsQ7N196XKlqQl9P6qIyYG2A== + dependencies: + resolve "~1.17.0" + strip-json-comments "~3.1.1" + +"@rushstack/ts-command-line@4.7.8": + version "4.7.8" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.7.8.tgz#3aa77cf544c571be3206fc2bcba20c7a096ed254" + integrity sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA== + dependencies: + "@types/argparse" "1.0.38" + argparse "~1.0.9" + colors "~1.2.1" + string-argv "~0.3.1" + "@sinonjs/commons@^1.7.0": version "1.8.2" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.2.tgz#858f5c4b48d80778fde4b9d541f27edc0d56488b" @@ -1795,6 +1858,11 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== + "@types/babel__code-frame@*", "@types/babel__code-frame@^7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.2.tgz#e0c0f1648cbc09a9d4e5b4ed2ae9a6f7c8f5aeb0" @@ -1945,6 +2013,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== +"@types/node@10.17.13": + version "10.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" + integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -2206,7 +2279,7 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -2861,6 +2934,11 @@ colorette@^1.2.1: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== +colors@~1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" + integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg== + columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" @@ -2876,7 +2954,7 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.12.1: +commander@^2.12.1, commander@^2.7.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -3762,6 +3840,11 @@ eslint-plugin-jest@^24.1.3: dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" +eslint-plugin-simple-import-sort@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz#a1dad262f46d2184a90095a60c66fef74727f0f8" + integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw== + eslint-scope@^5.0.0, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -4241,6 +4324,15 @@ fs-extra@^9.0.0, fs-extra@^9.1.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@~7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.5: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" @@ -4776,6 +4868,11 @@ import-from@3.0.0: dependencies: resolve-from "^5.0.0" +import-lazy@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" + integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== + import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -5619,6 +5716,11 @@ jest@^26.6.3: import-local "^3.0.2" jest-cli "^26.6.3" +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo= + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -5989,11 +6091,16 @@ lodash.flatten@~4.4.0: resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= -lodash.get@^4.4.2: +lodash.get@^4.0.0, lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.isequal@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -6034,7 +6141,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" 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: +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, lodash@~4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -7664,6 +7771,13 @@ resolve@^1.1.6, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.18 is-core-module "^2.1.0" path-parse "^1.0.6" +resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -7792,7 +7906,7 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.3.5, semver@7.x, semver@^7.2.1, semver@^7.3.2: +semver@7.3.5, semver@7.x, semver@^7.2.1, semver@^7.3.2, semver@~7.3.0: version "7.3.5" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -8111,7 +8225,7 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -string-argv@0.3.1: +string-argv@0.3.1, string-argv@~0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== @@ -8277,7 +8391,7 @@ strip-json-comments@3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -8430,6 +8544,11 @@ through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -8681,7 +8800,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026: +typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026, typescript@~4.1.3: version "4.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c" integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ== @@ -8845,6 +8964,11 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +validator@^8.0.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-8.2.0.tgz#3c1237290e37092355344fef78c231249dab77b9" + integrity sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA== + verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" @@ -9185,3 +9309,14 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +z-schema@~3.18.3: + version "3.18.4" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-3.18.4.tgz#ea8132b279533ee60be2485a02f7e3e42541a9a2" + integrity sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw== + dependencies: + lodash.get "^4.0.0" + lodash.isequal "^4.0.0" + validator "^8.0.0" + optionalDependencies: + commander "^2.7.1" From 89f4d439a531d378ab1f5385e7c34b7c8b382461 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 22:27:49 -0700 Subject: [PATCH 14/35] chore: bump @babel/types from 7.13.14 to 7.14.1 (#3345) Bumps [@babel/types](https://github.com/babel/babel/tree/HEAD/packages/babel-types) from 7.13.14 to 7.14.1. - [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.14.1/packages/babel-types) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 589b6e6b4e17..f660ec1e4f82 100644 --- a/yarn.lock +++ b/yarn.lock @@ -143,10 +143,10 @@ dependencies: "@babel/types" "^7.12.13" -"@babel/helper-validator-identifier@^7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" - integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== +"@babel/helper-validator-identifier@^7.12.11", "@babel/helper-validator-identifier@^7.14.0": + version "7.14.0" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz#d26cad8a47c65286b15df1547319a5d0bcf27288" + integrity sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A== "@babel/helper-validator-option@^7.12.17": version "7.12.17" @@ -292,12 +292,11 @@ lodash "^4.17.19" "@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.14" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.14.tgz#c35a4abb15c7cd45a2746d78ab328e362cbace0d" - integrity sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ== + version "7.14.1" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.1.tgz#095bd12f1c08ab63eff6e8f7745fa7c9cc15a9db" + integrity sha512-S13Qe85fzLs3gYRUnrpyeIrBJIMYv33qSTg1qoBwiG6nPKwUWAD9odSzWhEedpwOIzSEI6gbdQIWEMiCI42iBA== dependencies: - "@babel/helper-validator-identifier" "^7.12.11" - lodash "^4.17.19" + "@babel/helper-validator-identifier" "^7.14.0" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": From c3bc0bbe408a01279705bdc6044cba137c69a871 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 22:28:05 -0700 Subject: [PATCH 15/35] chore: bump eslint-plugin-jest from 24.3.5 to 24.3.6 (#3313) Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.3.5 to 24.3.6. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.5...v24.3.6) 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 f660ec1e4f82..df72078fe908 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3833,9 +3833,9 @@ eslint-plugin-import@^2.22.0: tsconfig-paths "^3.9.0" eslint-plugin-jest@^24.1.3: - version "24.3.5" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.5.tgz#71f0b580f87915695c286c3f0eb88cf23664d044" - integrity sha512-XG4rtxYDuJykuqhsOqokYIR84/C8pRihRtEpVskYLbIIKGwPNW2ySxdctuVzETZE+MbF/e7wmsnbNVpzM0rDug== + version "24.3.6" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.6.tgz#5f0ca019183c3188c5ad3af8e80b41de6c8e9173" + integrity sha512-WOVH4TIaBLIeCX576rLcOgjNXqP+jNlCiEmRgFTfQtJ52DpwnIQKAVGlGPAN7CZ33bW6eNfHD6s8ZbEUTQubJg== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" From ddfab95841814351db0bf3d89281a964ee9daa43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 22:28:14 -0700 Subject: [PATCH 16/35] chore: bump @types/node from 14.14.41 to 15.0.2 (#3351) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.41 to 15.0.2. - [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> --- package.json | 2 +- yarn.lock | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f93f8088afdc..4464751bb450 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "@types/jest-specific-snapshot": "^0.5.5", "@types/lodash": "^4.14.149", "@types/marked": "^2.0.0", - "@types/node": "^14.14.27", + "@types/node": "^15.0.2", "@types/node-fetch": "^2.5.10", "@types/prettier": "^2.2.1", "@types/rimraf": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index df72078fe908..ab703f24418c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2007,10 +2007,15 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@>= 8", "@types/node@^14.14.27": - version "14.14.41" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" - integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== +"@types/node@*", "@types/node@>= 8", "@types/node@^15.0.2": + version "15.0.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-15.0.2.tgz#51e9c0920d1b45936ea04341aa3e2e58d339fb67" + integrity sha512-p68+a+KoxpoB47015IeYZYRrdqMUcpbK8re/zpFB8Ld46LHC1lPEbp3EXgkEhAYEcPvjJF6ZO+869SQ0aH1dcA== + +"@types/node@10.17.13": + version "10.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" + integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== "@types/node@10.17.13": version "10.17.13" From 87521a024103bc5fc643861649bee9a288f55b7b Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Mon, 10 May 2021 02:05:05 +0900 Subject: [PATCH 17/35] fix(scope-manager): fix visiting TSAsExpression in assignment (#3355) --- packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts | 7 +++++++ packages/scope-manager/src/referencer/Referencer.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts index 020a4e715d67..4f2c9702411b 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts @@ -139,6 +139,13 @@ function predicate(arg: any): asserts arg is T { throw 'oops'; } } + `, + ` +interface ITest { + attr: string; +} +let test: unknown; +(test as ITest) = { attr: '' }; `, { code: ` diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index b0e7557ee7eb..ef8bb513822f 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -320,7 +320,7 @@ class Referencer extends Visitor { case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: // explicitly visit the type annotation - this.visit(left.typeAnnotation); + this.visitType(left.typeAnnotation); // intentional fallthrough case AST_NODE_TYPES.TSNonNullExpression: // unwrap the expression From 2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3 Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Mon, 10 May 2021 03:21:35 +1000 Subject: [PATCH 18/35] feat(experimental-utils): Include `getCwd()` in `RuleContext` type (#3308) --- packages/experimental-utils/src/ts-eslint/Rule.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index d74af833121e..19f457201ef1 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -211,6 +211,14 @@ interface RuleContext< */ getDeclaredVariables(node: TSESTree.Node): Scope.Variable[]; + /** + * Returns the current working directory passed to Linter. + * It is a path to a directory that should be considered as the current working directory. + * This was added in v6.6.0 + * @since 6.6.0 + */ + getCwd?(): string; + /** * Returns the filename associated with the source. */ From 299d86f470ee950bbcb6fb77552e90288ecf712a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 9 May 2021 21:14:38 -0700 Subject: [PATCH 19/35] chore: bump hosted-git-info from 2.8.8 to 2.8.9 (#3364) Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index ab703f24418c..3f720199bc2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2017,11 +2017,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== -"@types/node@10.17.13": - version "10.17.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" - integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== - "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -4750,9 +4745,9 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: - version "2.8.8" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== html-encoding-sniffer@^2.0.1: version "2.0.1" From 18d8151e54f0ee7015ed4a4d83c0a7bd8887396c Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 10 May 2021 17:03:06 +0000 Subject: [PATCH 20/35] chore: publish v4.23.0 --- CHANGELOG.md | 17 +++++++++++++++++ lerna.json | 2 +- packages/ast-spec/CHANGELOG.md | 11 +++++++++++ packages/ast-spec/package.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 11 +++++++++++ packages/eslint-plugin-internal/package.json | 4 ++-- packages/eslint-plugin-tslint/CHANGELOG.md | 11 +++++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 16 ++++++++++++++++ packages/eslint-plugin/package.json | 6 +++--- packages/experimental-utils/CHANGELOG.md | 12 ++++++++++++ packages/experimental-utils/package.json | 8 ++++---- packages/parser/CHANGELOG.md | 11 +++++++++++ packages/parser/package.json | 10 +++++----- packages/scope-manager/CHANGELOG.md | 16 ++++++++++++++++ packages/scope-manager/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/types/CHANGELOG.md | 11 +++++++++++ packages/types/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 11 +++++++++++ packages/typescript-estree/package.json | 8 ++++---- packages/visitor-keys/CHANGELOG.md | 11 +++++++++++ packages/visitor-keys/package.json | 4 ++-- 24 files changed, 177 insertions(+), 31 deletions(-) create mode 100644 packages/ast-spec/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1c7c9bdf60..288eede8e2cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Bug Fixes + +* **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) + + +### Features + +* **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/typescript-eslint diff --git a/lerna.json b/lerna.json index 559d00dca269..222524221fd6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.22.1", + "version": "4.23.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md new file mode 100644 index 000000000000..d892d6b7659d --- /dev/null +++ b/packages/ast-spec/CHANGELOG.md @@ -0,0 +1,11 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index c688fcdda2e1..646db4030555 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "4.20.0", + "version": "4.23.0", "description": "TypeScript-ESTree AST spec", "private": true, "keywords": [ diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 0d3715d66a7c..eabb843ecc74 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **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 ed377ea25988..19c94ac2096e 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.22.1", + "version": "4.23.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.22.1", + "@typescript-eslint/experimental-utils": "4.23.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index d24f79ee7598..42674a224c72 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **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 b35badc6bfd4..b623a32ad7b6 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.22.1", + "version": "4.23.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.22.1", + "@typescript-eslint/experimental-utils": "4.23.0", "lodash": "^4.17.15" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.22.1" + "@typescript-eslint/parser": "4.23.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index fb6b1f65dd07..8e6b83868d96 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Bug Fixes + +* **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/eslint-plugin diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 72ca9feaf597..486d0bb75c1a 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.22.1", + "version": "4.23.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -44,8 +44,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.22.1", - "@typescript-eslint/scope-manager": "4.22.1", + "@typescript-eslint/experimental-utils": "4.23.0", + "@typescript-eslint/scope-manager": "4.23.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 063cc2fbe70f..eeb5bdce9315 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **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 d2ebd2a40720..b6b957d9fbd4 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.22.1", + "version": "4.23.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.22.1", - "@typescript-eslint/types": "4.22.1", - "@typescript-eslint/typescript-estree": "4.22.1", + "@typescript-eslint/scope-manager": "4.23.0", + "@typescript-eslint/types": "4.23.0", + "@typescript-eslint/typescript-estree": "4.23.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 9cf4c93a41da..24ee584b6616 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 9e9fd7f81858..3d1d4e994c68 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.22.1", + "version": "4.23.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.22.1", - "@typescript-eslint/types": "4.22.1", - "@typescript-eslint/typescript-estree": "4.22.1", + "@typescript-eslint/scope-manager": "4.23.0", + "@typescript-eslint/types": "4.23.0", + "@typescript-eslint/typescript-estree": "4.23.0", "debug": "^4.1.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.22.1", + "@typescript-eslint/experimental-utils": "4.23.0", "glob": "*", "typescript": "*" }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 6e810ce89e75..0ed98170f798 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Bug Fixes + +* **scope-manager:** fix visiting TSAsExpression in assignment ([#3355](https://github.com/typescript-eslint/typescript-eslint/issues/3355)) ([87521a0](https://github.com/typescript-eslint/typescript-eslint/commit/87521a024103bc5fc643861649bee9a288f55b7b)) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **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 b130cdea237e..0950b9c97ace 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.22.1", + "version": "4.23.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.22.1", - "@typescript-eslint/visitor-keys": "4.22.1" + "@typescript-eslint/types": "4.23.0", + "@typescript-eslint/visitor-keys": "4.23.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.22.1", + "@typescript-eslint/typescript-estree": "4.23.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index da5b4caeb197..6419ab67f15f 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 3c06d355b8fa..a8e0d833683c 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.22.1", + "version": "4.23.0", "private": true } diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index f62ac84b89d4..0e43ee7cd8af 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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/types diff --git a/packages/types/package.json b/packages/types/package.json index cd37019cbf4b..46b53fd9fd9d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.22.1", + "version": "4.23.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 e6363f7ae2da..6f3659179752 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 61d6febc6d67..4a3f520faed9 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.22.1", + "version": "4.23.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.22.1", - "@typescript-eslint/visitor-keys": "4.22.1", + "@typescript-eslint/types": "4.23.0", + "@typescript-eslint/visitor-keys": "4.23.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.22.1", + "@typescript-eslint/shared-fixtures": "4.23.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 29bc084e5c5d..ee37f1a8cc19 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.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) + + +### Features + +* refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) + + + + + ## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index e4a90301784d..018dd006a0cb 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.22.1", + "version": "4.23.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.22.1", + "@typescript-eslint/types": "4.23.0", "eslint-visitor-keys": "^2.0.0" }, "devDependencies": { From 2dd2d9e844b7ccec45802d96f20dd5003332b0d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 10:27:35 -0700 Subject: [PATCH 21/35] chore: bump handlebars from 4.7.6 to 4.7.7 (#3356) Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7. - [Release notes](https://github.com/wycats/handlebars.js/releases) - [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md) - [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 3f720199bc2c..d933980c8bea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4645,9 +4645,9 @@ growly@^1.3.0: integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= handlebars@^4.7.6: - version "4.7.6" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" - integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== + version "4.7.7" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== dependencies: minimist "^1.2.5" neo-async "^2.6.0" @@ -8810,9 +8810,9 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== uglify-js@^3.1.4: - version "3.10.2" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.10.2.tgz#8cfa1209fd04199cc8a7f9930ddedb30b0f1912d" - integrity sha512-GXCYNwqoo0MbLARghYjxVBxDCnU0tLqN7IPLdHHbibCb1NI5zBkU2EPcy/GaVxc0BtTjqyGXJCINe6JMR2Dpow== + version "3.13.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.5.tgz#5d71d6dbba64cf441f32929b1efce7365bb4f113" + integrity sha512-xtB8yEqIkn7zmOyS2zUNBsYCBRhDkvlNxMMY2smuJ/qA8NCHeQvKCF3i9Z4k8FJH4+PJvZRtMrPynfZ75+CSZw== uid-number@0.0.6: version "0.0.6" From 80f8a571b7bfc6fb56c2008b88f0f5e091be5f23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 10:27:58 -0700 Subject: [PATCH 22/35] chore: bump @microsoft/api-extractor from 7.13.2 to 7.15.1 (#3367) Bumps [@microsoft/api-extractor](https://github.com/microsoft/rushstack) from 7.13.2 to 7.15.1. - [Release notes](https://github.com/microsoft/rushstack/releases) - [Commits](https://github.com/microsoft/rushstack/compare/@microsoft/api-extractor_v7.13.2...@microsoft/api-extractor_v7.15.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 82 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/yarn.lock b/yarn.lock index d933980c8bea..9132c0799bde 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1637,35 +1637,47 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" -"@microsoft/api-extractor-model@7.12.2": - version "7.12.2" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.12.2.tgz#d48b35e8ed20643b1c19d7a4f80c90c42dc7d1d8" - integrity sha512-EU+U09Mj65zUH0qwPF4PFJiL6Y+PQQE/RRGEHEDGJJzab/mRQDpKOyrzSdb00xvcd/URehIHJqC55cY2Y4jGOA== +"@microsoft/api-extractor-model@7.13.1": + version "7.13.1" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.13.1.tgz#6dd9c4bd49b5d0d32b44c564a94c34b3c3aa2a87" + integrity sha512-PKAjDmAJ6X07tvqCHSN1PRaKq8bZQXF9QI6WGEMnCHNFWwXUoITOAcvFW0Ol3TzwHO5rLbuy/CqWebfhv8eOtw== dependencies: - "@microsoft/tsdoc" "0.12.24" - "@rushstack/node-core-library" "3.36.0" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.37.0" "@microsoft/api-extractor@^7.13.2": - version "7.13.2" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.13.2.tgz#c44762d27aee05c4da16c03fc8786bd0fa31c7eb" - integrity sha512-2fD0c8OxZW+e6NTaxbtrdNxXVuX7aqil3+cqig3pKsHymvUuRJVCEAcAJmZrJ/ENqYXNiB265EyqOT6VxbMysw== - dependencies: - "@microsoft/api-extractor-model" "7.12.2" - "@microsoft/tsdoc" "0.12.24" - "@rushstack/node-core-library" "3.36.0" - "@rushstack/rig-package" "0.2.10" - "@rushstack/ts-command-line" "4.7.8" + version "7.15.1" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.15.1.tgz#c3791933367ddded72a2f1d3c437e17fa050eac5" + integrity sha512-PYbGAvxbM5B6HbafXY7tJ4ObYpeUZrZFt9vlN68tpYG/7aeldMLAZSjTyB30VFXaGlArjeEooKZIcs2ZnVAbNg== + dependencies: + "@microsoft/api-extractor-model" "7.13.1" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.37.0" + "@rushstack/rig-package" "0.2.12" + "@rushstack/ts-command-line" "4.7.10" colors "~1.2.1" lodash "~4.17.15" resolve "~1.17.0" semver "~7.3.0" source-map "~0.6.1" - typescript "~4.1.3" + typescript "~4.2.4" -"@microsoft/tsdoc@0.12.24": - version "0.12.24" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.24.tgz#30728e34ebc90351dd3aff4e18d038eed2c3e098" - integrity sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg== +"@microsoft/tsdoc-config@~0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" + integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== + dependencies: + "@microsoft/tsdoc" "0.13.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.13.2": + version "0.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" + integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" @@ -1810,10 +1822,10 @@ dependencies: "@types/node" ">= 8" -"@rushstack/node-core-library@3.36.0": - version "3.36.0" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.36.0.tgz#95dace39d763c8695d6607c421f95c6ac65b0ed4" - integrity sha512-bID2vzXpg8zweXdXgQkKToEdZwVrVCN9vE9viTRk58gqzYaTlz4fMId6V3ZfpXN6H0d319uGi2KDlm+lUEeqCg== +"@rushstack/node-core-library@3.37.0": + version "3.37.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.37.0.tgz#6e8ebfdbe2829d380bc827bbb450361fb48e142c" + integrity sha512-b0OGvl20zfepytLBnKsOtemtiadNZAVolXxaSYssV9VjXaLPF97oLvtLfwc58BX05ufIsrKZgXatnRo8YeffNg== dependencies: "@types/node" "10.17.13" colors "~1.2.1" @@ -1825,18 +1837,18 @@ timsort "~0.3.0" z-schema "~3.18.3" -"@rushstack/rig-package@0.2.10": - version "0.2.10" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.2.10.tgz#e861eb94953d8c22c509dc3e9d91d6f337eab3cd" - integrity sha512-WXYerEJEPf8bS3ruqfM57NnwXtA7ehn8VJjLjrjls6eSduE5CRydcob/oBTzlHKsQ7N196XKlqQl9P6qIyYG2A== +"@rushstack/rig-package@0.2.12": + version "0.2.12" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.2.12.tgz#c434d62b28e0418a040938226f8913971d0424c7" + integrity sha512-nbePcvF8hQwv0ql9aeQxcaMPK/h1OLAC00W7fWCRWIvD2MchZOE8jumIIr66HGrfG2X1sw++m/ZYI4D+BM5ovQ== dependencies: resolve "~1.17.0" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.7.8": - version "4.7.8" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.7.8.tgz#3aa77cf544c571be3206fc2bcba20c7a096ed254" - integrity sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA== +"@rushstack/ts-command-line@4.7.10": + version "4.7.10" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.7.10.tgz#a2ec6efb1945b79b496671ce90eb1be4f1397d31" + integrity sha512-8t042g8eerypNOEcdpxwRA3uCmz0duMo21rG4Z2mdz7JxJeylDmzjlU3wDdef2t3P1Z61JCdZB6fbm1Mh0zi7w== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -2146,7 +2158,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, ajv@~6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -7762,7 +7774,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.3.2: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.3.2, resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== @@ -8799,7 +8811,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026, typescript@~4.1.3: +typescript@*, typescript@4.2.2, "typescript@>=3.3.1 <4.3.0", typescript@^4.1.0-dev.20201026, typescript@~4.2.4: version "4.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.2.tgz#1450f020618f872db0ea17317d16d8da8ddb8c4c" integrity sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ== From c7f90e43d9bd69c127ccf3daf655eed7281c49bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 10:28:07 -0700 Subject: [PATCH 23/35] chore: bump ts-jest from 26.5.5 to 26.5.6 (#3366) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.5 to 26.5.6. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md) - [Commits](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) 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 9132c0799bde..597100ac5d11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8668,9 +8668,9 @@ trim-off-newlines@^1.0.0: integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= ts-jest@^26.5.1: - version "26.5.5" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.5.tgz#e40481b6ee4dd162626ba481a2be05fa57160ea5" - integrity sha512-7tP4m+silwt1NHqzNRAPjW1BswnAhopTdc2K3HEkRZjF0ZG2F/e/ypVH0xiZIMfItFtD3CX0XFbwPzp9fIEUVg== + version "26.5.6" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.6.tgz#c32e0746425274e1dfe333f43cd3c800e014ec35" + integrity sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA== dependencies: bs-logger "0.x" buffer-from "1.x" From c6f834fdd2c7192e4d35efb49925d4da7bfd0f76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 10:28:15 -0700 Subject: [PATCH 24/35] chore: bump cspell from 5.3.12 to 5.4.0 (#3369) Bumps [cspell](https://github.com/streetsidesoftware/cspell) from 5.3.12 to 5.4.0. - [Release notes](https://github.com/streetsidesoftware/cspell/releases) - [Changelog](https://github.com/streetsidesoftware/cspell/blob/master/CHANGELOG.md) - [Commits](https://github.com/streetsidesoftware/cspell/compare/v5.3.12...v5.4.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 125 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/yarn.lock b/yarn.lock index 597100ac5d11..1a872f11f8e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -460,15 +460,15 @@ dependencies: chalk "^4.0.0" -"@cspell/cspell-bundled-dicts@^5.3.12": - version "5.3.12" - resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.3.12.tgz#5ade1c920a778da90af89da27faa7836118e9125" - integrity sha512-epDAs9OsULLZP3tPkqVIZ/5OMpE77J6ACnzMEJVN/oVOSgIncKuAzHXG6Qnw1egeCZ+hsZNl8hG09dJ4lxI0Nw== +"@cspell/cspell-bundled-dicts@^5.4.0": + version "5.4.0" + resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.4.0.tgz#ef241c9cee00e674fd8ac034bd1dacec77d94f5c" + integrity sha512-aZyml0UaJ2BXmqcrjdMJWyKGQVu33FQ1eRsnV2SZ4WkdkRsxPtdQoFDi+lKSSvIEYSfRkis6lffzwvp0CPQOmw== dependencies: "@cspell/dict-ada" "^1.1.2" "@cspell/dict-aws" "^1.0.14" "@cspell/dict-bash" "^1.0.12" - "@cspell/dict-companies" "^1.0.36" + "@cspell/dict-companies" "^1.0.37" "@cspell/dict-cpp" "^1.1.38" "@cspell/dict-cryptocurrencies" "^1.0.10" "@cspell/dict-csharp" "^1.0.11" @@ -493,17 +493,17 @@ "@cspell/dict-npm" "^1.0.11" "@cspell/dict-php" "^1.0.23" "@cspell/dict-powershell" "^1.0.14" - "@cspell/dict-python" "^1.0.33" + "@cspell/dict-python" "^1.0.34" "@cspell/dict-ruby" "^1.0.13" "@cspell/dict-rust" "^1.0.22" "@cspell/dict-scala" "^1.0.21" - "@cspell/dict-software-terms" "^1.0.27" + "@cspell/dict-software-terms" "^1.0.28" "@cspell/dict-typescript" "^1.0.17" -"@cspell/cspell-types@^5.3.12": - version "5.3.12" - resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-5.3.12.tgz#f02a6102901f77c4f1f601cf62be0fd788a50648" - integrity sha512-XiTQ6ngDvclfz/uzTpvukCgaoLmk+L2tGZPNDQmL2m5ylBs7eiqUwtnFyCl5NTvuZ7PCu/n7NrAsC5brqWezCA== +"@cspell/cspell-types@^5.4.0": + version "5.4.0" + resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-5.4.0.tgz#af555d9a9c08a75cdd2b38bac259a5127a59cb31" + integrity sha512-mQM+65u0jbTilhj0Mrnufk3jC7dWRymlWdxVK9phLRqtJsDJsxpa0opumVw1CnoBHfPj6HnW7SBGufmcCQp/PQ== "@cspell/dict-ada@^1.1.2": version "1.1.2" @@ -520,10 +520,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-bash/-/dict-bash-1.0.12.tgz#fdf828c520dfd274f1cee6a4a90a0f6d86a703ac" integrity sha512-BOMHVW/m281mqUSJkZ3oiJiUUItLd7QdzpMjm428V9yBYFwIdbds1CeatS7C6kgpI2eBE4RXmy1Hjk/lR63Jew== -"@cspell/dict-companies@^1.0.36": - version "1.0.36" - resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.36.tgz#c85bcc1f23ac991c56dd25eea5623078aaa513c2" - integrity sha512-Bk9mMJs9spzrtLxZsxBZIK6ukD9REfQYpuTBNJk/IiTViHVQ6ertHAgw1vRVtJAMxViv8dMLNtDyTpEXeaYm7w== +"@cspell/dict-companies@^1.0.37": + version "1.0.37" + resolved "https://registry.yarnpkg.com/@cspell/dict-companies/-/dict-companies-1.0.37.tgz#eaaf51c5356e6949071f78f6bc8a32c0dda7ef80" + integrity sha512-7DuwT64u88v0qvvuhHK23zn8zyX7S3lIYj0ntAoMvErr1+O0SuUopZrw4Y1pm1pgcVAv6+ny80RDDhSD1h565w== "@cspell/dict-cpp@^1.1.38": version "1.1.38" @@ -645,10 +645,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-powershell/-/dict-powershell-1.0.14.tgz#f8998f2f413b3b94e69a512117de89552cfa1834" integrity sha512-hisOXXi5PBXB5YKtrJQIis2FIRHgSW1U0/sd4yI36lzb3ZMEvGJwdAdyhXN3IGiqRUNxMzJiXAeXfhnia4xPtQ== -"@cspell/dict-python@^1.0.33": - version "1.0.33" - resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-1.0.33.tgz#39ddf401f63ee9b0f95e606d70693e61976a073b" - integrity sha512-tRmE4TzHDFPs7sJ1a3XbfyFrvRHwefVz+z1wkm6tkXK9TPrCbIS+rV/T8xhj205q4lpZQ/TkNB3lT40eLB9O8A== +"@cspell/dict-python@^1.0.34": + version "1.0.34" + resolved "https://registry.yarnpkg.com/@cspell/dict-python/-/dict-python-1.0.34.tgz#26601cbc78e937b6f5c45110722c720cde4ca7c3" + integrity sha512-1VvyvvEv3ToVdlFIPzD6sOh+bFVrYMHoAL6VnJYfFMnCxw/YftHIc7INg9LEUWcolovVFoUHFOhBN8saXw8bzA== "@cspell/dict-ruby@^1.0.13": version "1.0.13" @@ -665,10 +665,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-scala/-/dict-scala-1.0.21.tgz#bfda392329061e2352fbcd33d228617742c93831" integrity sha512-5V/R7PRbbminTpPS3ywgdAalI9BHzcEjEj9ug4kWYvBIGwSnS7T6QCFCiu+e9LvEGUqQC+NHgLY4zs1NaBj2vA== -"@cspell/dict-software-terms@^1.0.27": - version "1.0.27" - resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.27.tgz#fe3db2ea4aff05ea5f72966370c0025c89c39be7" - integrity sha512-O6wCGuFSnr9G9Sr62zc7/XyruRRPI0/PJ0xZj8/R+hr+vFjDaScQnkqj10gTVoLAshk1TjL5Firnzyz3ibfgdQ== +"@cspell/dict-software-terms@^1.0.28": + version "1.0.28" + resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-1.0.28.tgz#0c26bbfa89546d257b52cd433000ba7fe86a1901" + integrity sha512-N/5H+J68CgToDSZiMMSJl3ws5qU7GJOj1sXZ9oXr1wojvu/qifCp32zDh8hzFWrZF1VUdnStusNVTeW1Wq4Pog== "@cspell/dict-typescript@^1.0.17": version "1.0.17" @@ -2772,10 +2772,10 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" + integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" @@ -3261,59 +3261,59 @@ crypto-random-string@^2.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== -cspell-glob@^5.3.12: - version "5.3.12" - resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-5.3.12.tgz#c40af7fb0f06954ec93a2783720eaf19c7ab40c5" - integrity sha512-A/a5WaZhxzzwfVzkCPVHbVY+SejkDLOI6FAd8zcHDIsIkoBxfJ8FZhoEEspY6VjpHuPGgMxUu/MVbzcaQJwkGQ== +cspell-glob@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-5.4.0.tgz#13a2948e9e1defc59f25d76a9a95134521057cfe" + integrity sha512-4CwXDdO3Z0VdfZcD7OS7zFM8h5ay2ZHtzoc5oPLmxSs+tNQdRGNeFSPIv6CNt80AqILtZrlO7nVIbA6KtARqYA== dependencies: - micromatch "^4.0.2" + micromatch "^4.0.4" -cspell-io@^5.3.12: - version "5.3.12" - resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-5.3.12.tgz#9eef76d4691f0b99016275a7d02abd0afe2964a2" - integrity sha512-SMVG07ctDUvOADuo+jCAo759eKpqVKXFClDiHUX3DOHowOdnjiZJozK9zh1uGVzCPZDjmoIueFxN4daPIcyRmw== +cspell-io@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-5.4.0.tgz#b2b74f3cf20db86ca37b4c3a7f648b8db7184f4e" + integrity sha512-VIPb/TmTNK/dG5nrbGhuhvWZQYAFXpYQQJ4hmlmuczhhQ2Qw1YSkRgoEB4Ir0neoRJTeEM2x5tgvSJCOwflSuA== dependencies: iconv-lite "^0.6.2" iterable-to-stream "^1.0.1" -cspell-lib@^5.3.12: - version "5.3.12" - resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-5.3.12.tgz#4c89638cb9383d8a0c390b5004f8aec0658d8d33" - integrity sha512-Dw8dTeB//5aYK8b5o+ulBJg0iFp+seBQoQKvstPer1tbU3JJTBXx8JJIZlJ5h8934oUYh4IWPyX/JpARaNekQw== +cspell-lib@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-5.4.0.tgz#8e60a2ad7d46e79965bcb95cff9f1d97c37b65f1" + integrity sha512-ja1zvRF+pNi+hioWYZUGpWGXPFfhDujd+qbAoQ08It4xMTVER8cDYQpSo2ll4DPJ2YphPW//2Br6TBvQ5xO50Q== dependencies: - "@cspell/cspell-bundled-dicts" "^5.3.12" - "@cspell/cspell-types" "^5.3.12" + "@cspell/cspell-bundled-dicts" "^5.4.0" + "@cspell/cspell-types" "^5.4.0" comment-json "^4.1.0" configstore "^5.0.1" cosmiconfig "^7.0.0" - cspell-glob "^5.3.12" - cspell-io "^5.3.12" - cspell-trie-lib "^5.3.12" + cspell-glob "^5.4.0" + cspell-io "^5.4.0" + cspell-trie-lib "^5.4.0" fs-extra "^9.1.0" gensequence "^3.1.1" resolve-from "^5.0.0" resolve-global "^1.0.0" vscode-uri "^3.0.2" -cspell-trie-lib@^5.3.12: - version "5.3.12" - resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-5.3.12.tgz#2518e6504d252fbbcfb0de85ce162f1698096dee" - integrity sha512-s26GqQhwPRuOP2KPLGhaRdPMlMqOSR1K06q/H1K5RW31ISrA67Gy/O/wTsFcz3j3gjB9yFjsxWYrrjD/inDjsQ== +cspell-trie-lib@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-5.4.0.tgz#bfe721b6a5e5885f3edb73b5861500c142f3b46b" + integrity sha512-IpDFdOoUEdiyzDGEUCIAoAUenIMy0FjOKotmsl9GTbOyq0XPHE6s7Yz5s9pFzX9IHxvsJ7Plhvn627k7QAC6DQ== dependencies: fs-extra "^9.1.0" gensequence "^3.1.1" cspell@^5.2.4: - version "5.3.12" - resolved "https://registry.yarnpkg.com/cspell/-/cspell-5.3.12.tgz#80621be7971e475d19c412ee295474ffe90c27f6" - integrity sha512-lwBVphwIvD/TkDZAjzNStpKqk9hAUfKTA5VlnXHCF4l0inw0r8LL17OnxcAAMo44tewxfo9UMEhx0ql68dSNrw== + version "5.4.0" + resolved "https://registry.yarnpkg.com/cspell/-/cspell-5.4.0.tgz#3cafddc67b445deaea52b72af318b8c716891748" + integrity sha512-613oEbxry/xJWrFf/r6RS3jQ88Az0W3LRazGi0s+tcIAlprJn78inTKUn23oQslhoF0dhYADJdFaR6Q4Fd6+zw== dependencies: - "@cspell/cspell-types" "^5.3.12" - chalk "^4.1.0" + "@cspell/cspell-types" "^5.4.0" + chalk "^4.1.1" commander "^7.2.0" comment-json "^4.1.0" - cspell-glob "^5.3.12" - cspell-lib "^5.3.12" + cspell-glob "^5.4.0" + cspell-lib "^5.4.0" fs-extra "^9.1.0" get-stdin "^8.0.0" glob "^7.1.6" @@ -6427,6 +6427,14 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + mime-db@1.44.0: version "1.44.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" @@ -7233,6 +7241,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picomatch@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.3.tgz#465547f359ccc206d3c48e46a1bcb89bf7ee619d" + integrity sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" From 7307e8ff68b759b9f9e6ccfbdec328a89727ea2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 11:53:27 -0700 Subject: [PATCH 25/35] chore: bump @types/semver from 7.3.4 to 7.3.5 (#3368) Bumps [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) from 7.3.4 to 7.3.5. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) 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 1a872f11f8e4..f78d6dea29a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2053,9 +2053,9 @@ "@types/node" "*" "@types/semver@*", "@types/semver@^7.3.4": - version "7.3.4" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb" - integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ== + version "7.3.5" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.5.tgz#74deebbbcb1e86634dbf10a5b5e8798626f5a597" + integrity sha512-iotVxtCCsPLRAvxMFFgxL8HD2l4mAZ2Oin7/VJ2ooWO0VOK4EGOGmZWZn1uCq7RofR3I/1IOSjCHlFT71eVK0Q== "@types/stack-utils@^2.0.0": version "2.0.0" From 1be9302c3b17e13773852e880b45a8e4d32aa1c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:39:03 -0700 Subject: [PATCH 26/35] chore: bump lint-staged from 10.5.4 to 11.0.0 (#3372) Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.5.4 to 11.0.0. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v10.5.4...v11.0.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 113 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 70 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 4464751bb450..61fff8533211 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "jest": "^26.6.3", "jest-specific-snapshot": "^4.0.0", "lerna": "^3.22.1", - "lint-staged": "^10.2.13", + "lint-staged": "^11.0.0", "make-dir": "^3.1.0", "markdownlint-cli": "^0.27.1", "node-fetch": "^2.6.1", diff --git a/yarn.lock b/yarn.lock index f78d6dea29a7..3414bd6c7a30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2970,11 +2970,6 @@ commander@^2.12.1, commander@^2.7.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^6.2.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" - integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== - commander@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" @@ -3247,7 +3242,7 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.2: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -3430,7 +3425,7 @@ debug@^3.1.0: dependencies: ms "^2.1.1" -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0: +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -3990,7 +3985,7 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^4.0.0, execa@^4.1.0: +execa@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== @@ -4005,6 +4000,21 @@ execa@^4.0.0, execa@^4.1.0: signal-exit "^3.0.2" strip-final-newline "^2.0.0" +execa@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.0.0.tgz#4029b0007998a841fbd1032e5f4de86a3c1e3376" + integrity sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -4465,6 +4475,11 @@ get-stream@^5.0.0: dependencies: pump "^3.0.0" +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -4808,6 +4823,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" @@ -5257,6 +5277,11 @@ is-typedarray@^1.0.0, is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== + is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" @@ -5974,39 +5999,39 @@ linkify-it@^3.0.1: dependencies: uc.micro "^1.0.1" -lint-staged@^10.2.13: - version "10.5.4" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.4.tgz#cd153b5f0987d2371fc1d2847a409a2fe705b665" - integrity sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg== +lint-staged@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-11.0.0.tgz#24d0a95aa316ba28e257f5c4613369a75a10c712" + integrity sha512-3rsRIoyaE8IphSUtO1RVTFl1e0SLBtxxUOPBtHxQgBHS5/i6nqvjcUfNioMa4BU9yGnPzbO+xkfLtXtxBpCzjw== dependencies: - chalk "^4.1.0" + chalk "^4.1.1" cli-truncate "^2.1.0" - commander "^6.2.0" + commander "^7.2.0" cosmiconfig "^7.0.0" - debug "^4.2.0" + debug "^4.3.1" dedent "^0.7.0" enquirer "^2.3.6" - execa "^4.1.0" - listr2 "^3.2.2" - log-symbols "^4.0.0" - micromatch "^4.0.2" + execa "^5.0.0" + listr2 "^3.8.2" + log-symbols "^4.1.0" + micromatch "^4.0.4" normalize-path "^3.0.0" please-upgrade-node "^3.2.0" string-argv "0.3.1" stringify-object "^3.3.0" -listr2@^3.2.2: - version "3.3.1" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.3.1.tgz#87b57cc0b8541fa794b814c8bcb76f1211cfbf5c" - integrity sha512-8Zoxe7s/8nNr4bJ8bdAduHD8uJce+exmMmUWTXlq0WuUdffnH3muisHPHPFtW2vvOfohIsq7FGCaguUxN/h3Iw== +listr2@^3.8.2: + version "3.8.2" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.8.2.tgz#99b138ad1cfb08f1b0aacd422972e49b2d814b99" + integrity sha512-E28Fw7Zd3HQlCJKzb9a8C8M0HtFWQeucE+S8YrSrqZObuCLPRHMRrR8gNmYt65cU9orXYHwvN5agXC36lYt7VQ== dependencies: - chalk "^4.1.0" + chalk "^4.1.1" cli-truncate "^2.1.0" figures "^3.2.0" indent-string "^4.0.0" log-update "^4.0.0" p-map "^4.0.0" - rxjs "^6.6.3" + rxjs "^6.6.7" through "^2.3.8" wrap-ansi "^7.0.0" @@ -6157,12 +6182,13 @@ lodash@4.x, lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, l 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" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" - integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== +log-symbols@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== dependencies: - chalk "^4.0.0" + chalk "^4.1.0" + is-unicode-supported "^0.1.0" log-update@^4.0.0: version "4.0.0" @@ -6419,15 +6445,7 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" - integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== - dependencies: - braces "^3.0.1" - picomatch "^2.0.5" - -micromatch@^4.0.4: +micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== @@ -6791,7 +6809,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^4.0.0: +npm-run-path@^4.0.0, npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== @@ -6908,7 +6926,7 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -onetime@^5.1.0: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -7236,7 +7254,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: +picomatch@^2.0.4, picomatch@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== @@ -7869,13 +7887,20 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@^6.4.0, rxjs@^6.6.0, rxjs@^6.6.3: +rxjs@^6.4.0, rxjs@^6.6.0: version "6.6.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== dependencies: tslib "^1.9.0" +rxjs@^6.6.7: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -8002,7 +8027,7 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== -signal-exit@^3.0.0, signal-exit@^3.0.2: +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== From 0fe85792d07c34cc1c13c9957a3601c2c98414e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 13:29:16 -0700 Subject: [PATCH 27/35] chore: bump eslint-plugin-eslint-plugin from 3.0.2 to 3.0.3 (#3373) Bumps [eslint-plugin-eslint-plugin](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin) from 3.0.2 to 3.0.3. - [Release notes](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/releases) - [Changelog](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/CHANGELOG.md) - [Commits](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/compare/v3.0.2...v3.0.3) 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 3414bd6c7a30..7569a2ab499c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3814,9 +3814,9 @@ eslint-plugin-eslint-comments@^3.2.0: ignore "^5.0.5" eslint-plugin-eslint-plugin@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.2.tgz#8ce72a1e06bad8c4e6ddc1c932e236b8184c1bce" - integrity sha512-pTJhDCiuwa/NgwjsKrlCnF2ExULcG0xK87HdckFpVbaKb2GOd2UUL4L/HtjUV1N3jlrOdtyTfdX1J+oCD01j4Q== + version "3.0.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.0.3.tgz#3356adec58bd4904f98001779f61eff5b7006ec8" + integrity sha512-vVNx9qexy0iQwqtOzzJPFAfC6j6i4L6QE//JqwJOnAC5aUHJA4yFQy56kX9JOJ2rx3iKlpTt3h/adErgbqU/SA== dependencies: eslint-utils "^2.1.0" From dc2072df6de963e5c0a7c5c870431d5573d96247 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 13:29:26 -0700 Subject: [PATCH 28/35] chore: bump @types/jest from 26.0.22 to 26.0.23 (#3377) Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.22 to 26.0.23. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) 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 7569a2ab499c..7d2672dcb383 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1974,9 +1974,9 @@ "@types/jest" "*" "@types/jest@*", "@types/jest@^26.0.20": - version "26.0.22" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.22.tgz#8308a1debdf1b807aa47be2838acdcd91e88fbe6" - integrity sha512-eeWwWjlqxvBxc4oQdkueW5OF/gtfSceKk4OnOAGlUSwS/liBRtZppbJuz1YkgbrbfGOoeBHun9fOvXnjNwrSOw== + version "26.0.23" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.23.tgz#a1b7eab3c503b80451d019efb588ec63522ee4e7" + integrity sha512-ZHLmWMJ9jJ9PTiT58juykZpL7KjwJywFN3Rr2pTSkyQfydf/rk22yS7W8p5DaVUMQ2BQC7oYiU3FjbTM/mYrOA== dependencies: jest-diff "^26.0.0" pretty-format "^26.0.0" From e8c4b9ba81228149ad213b3157dfcf275f1af492 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 13:29:34 -0700 Subject: [PATCH 29/35] chore: bump glob from 7.1.6 to 7.1.7 (#3374) Bumps [glob](https://github.com/isaacs/node-glob) from 7.1.6 to 7.1.7. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/master/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v7.1.6...v7.1.7) 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 7d2672dcb383..3facce7c4413 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4573,9 +4573,9 @@ glob-to-regexp@^0.3.0: integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= glob@*, glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" From c80b5f2830d2915a0ac902dbec23ccdee14df8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Sat, 15 May 2021 20:44:41 +0200 Subject: [PATCH 30/35] chore(experimental-utils): remove useless union types `ast-utils` predicates (#3289) --- .../experimental-utils/src/ast-utils/predicates.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/experimental-utils/src/ast-utils/predicates.ts b/packages/experimental-utils/src/ast-utils/predicates.ts index bf62a6f77cb2..a7f722b810c6 100644 --- a/packages/experimental-utils/src/ast-utils/predicates.ts +++ b/packages/experimental-utils/src/ast-utils/predicates.ts @@ -1,24 +1,20 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree'; function isOptionalChainPunctuator( - token: TSESTree.Token | TSESTree.Comment, + token: TSESTree.Token, ): token is TSESTree.PunctuatorToken & { value: '?.' } { return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '?.'; } -function isNotOptionalChainPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): boolean { +function isNotOptionalChainPunctuator(token: TSESTree.Token): boolean { return !isOptionalChainPunctuator(token); } function isNonNullAssertionPunctuator( - token: TSESTree.Token | TSESTree.Comment, + token: TSESTree.Token, ): token is TSESTree.PunctuatorToken & { value: '!' } { return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '!'; } -function isNotNonNullAssertionPunctuator( - token: TSESTree.Token | TSESTree.Comment, -): boolean { +function isNotNonNullAssertionPunctuator(token: TSESTree.Token): boolean { return !isNonNullAssertionPunctuator(token); } @@ -209,7 +205,7 @@ function isAwaitExpression( * Checks if a possible token is the `await` keyword. */ function isAwaitKeyword( - node: TSESTree.Token | TSESTree.Comment | undefined | null, + node: TSESTree.Token | undefined | null, ): node is TSESTree.KeywordToken & { value: 'await' } { return node?.type === AST_TOKEN_TYPES.Identifier && node.value === 'await'; } From df7a0d66607c2e00242aaa01314e4322fb68d826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 15 May 2021 21:42:41 +0200 Subject: [PATCH 31/35] chore(eslint-plugin): [no-loss-of-precision] fix spelling of `isSeparatedNumeric` (#3390) --- packages/eslint-plugin/src/rules/no-loss-of-precision.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts index 1e04d080e747..f6b15c0430c1 100644 --- a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts +++ b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts @@ -38,14 +38,14 @@ export default util.createRule({ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion const rules = baseRule!.create(context); - function isSeperatedNumeric(node: TSESTree.Literal): boolean { + function isSeparatedNumeric(node: TSESTree.Literal): boolean { return typeof node.value === 'number' && node.raw.includes('_'); } return { Literal(node: TSESTree.Literal): void { rules.Literal({ ...node, - raw: isSeperatedNumeric(node) ? node.raw.replace(/_/g, '') : node.raw, + raw: isSeparatedNumeric(node) ? node.raw.replace(/_/g, '') : node.raw, } as never); }, }; From b85261c20951c6319694e57a0c3e3a060bc8eee5 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Sat, 15 May 2021 21:39:24 +0100 Subject: [PATCH 32/35] docs(eslint-plugin): update justification for `prefer-regexp-exec` (#3392) --- packages/eslint-plugin/docs/rules/prefer-regexp-exec.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md index 4640d35a98ec..3f3d149a7f7a 100644 --- a/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md +++ b/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md @@ -1,18 +1,16 @@ # Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided (`prefer-regexp-exec`) -`RegExp#exec` is faster than `String#match` and both work the same when not using the `/g` flag. +As `String#match` is defined to be the same as `RegExp#exec` when the regular expression does not include the `g` flag, prefer a consistent usage. ## Rule Details -This rule is aimed at enforcing the more performant way of applying regular expressions on strings. +This rule is aimed at enforcing a consistent way to apply regular expressions to strings. From [`String#match` on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match): > If the regular expression does not include the g flag, returns the same result as `RegExp.exec()`. -From [Stack Overflow](https://stackoverflow.com/questions/9214754/what-is-the-difference-between-regexp-s-exec-function-and-string-s-match-fun) - -> `RegExp.prototype.exec` is a lot faster than `String.prototype.match`, but that’s because they are not exactly the same thing, they are different. +`RegExp#exec` may also be slightly faster than `String#match`; this is the reason to choose it as the preferred usage. Examples of **incorrect** code for this rule: From b1e1c8a44695a58d29d19cf32ce35a8267bf506f Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 15 May 2021 14:11:12 -0700 Subject: [PATCH 33/35] fix(eslint-plugin): [no-shadow] fix static class method generics shadowing class generics (#3393) Fixes #2592 Unfortunately I think this is impossible to solve from the scope analysis side.. So I opted instead to just ignore it from the lint rule. --- packages/eslint-plugin/src/rules/no-shadow.ts | 85 +++++++++++++++++++ .../tests/rules/no-shadow.test.ts | 13 +++ 2 files changed, 98 insertions(+) diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index 1d1f894b651f..6eb2ef38f7c8 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -126,6 +126,84 @@ export default util.createRule({ return util.isFunctionType(id.parent); } + function isGenericOfStaticMethod( + variable: TSESLint.Scope.Variable, + ): boolean { + if (!('isTypeVariable' in variable)) { + // this shouldn't happen... + return false; + } + + if (!variable.isTypeVariable) { + return false; + } + + if (variable.identifiers.length === 0) { + return false; + } + + const typeParameter = variable.identifiers[0].parent; + if (typeParameter?.type !== AST_NODE_TYPES.TSTypeParameter) { + return false; + } + const typeParameterDecl = typeParameter.parent; + if ( + typeParameterDecl?.type !== AST_NODE_TYPES.TSTypeParameterDeclaration + ) { + return false; + } + const functionExpr = typeParameterDecl.parent; + if ( + !functionExpr || + (functionExpr.type !== AST_NODE_TYPES.FunctionExpression && + functionExpr.type !== AST_NODE_TYPES.TSEmptyBodyFunctionExpression) + ) { + return false; + } + const methodDefinition = functionExpr.parent; + if (methodDefinition?.type !== AST_NODE_TYPES.MethodDefinition) { + return false; + } + return methodDefinition.static; + } + + function isGenericOfClassDecl(variable: TSESLint.Scope.Variable): boolean { + if (!('isTypeVariable' in variable)) { + // this shouldn't happen... + return false; + } + + if (!variable.isTypeVariable) { + return false; + } + + if (variable.identifiers.length === 0) { + return false; + } + + const typeParameter = variable.identifiers[0].parent; + if (typeParameter?.type !== AST_NODE_TYPES.TSTypeParameter) { + return false; + } + const typeParameterDecl = typeParameter.parent; + if ( + typeParameterDecl?.type !== AST_NODE_TYPES.TSTypeParameterDeclaration + ) { + return false; + } + const classDecl = typeParameterDecl.parent; + return classDecl?.type === AST_NODE_TYPES.ClassDeclaration; + } + + function isGenericOfAStaticMethodShadow( + variable: TSESLint.Scope.Variable, + shadowed: TSESLint.Scope.Variable, + ): boolean { + return ( + isGenericOfStaticMethod(variable) && isGenericOfClassDecl(shadowed) + ); + } + /** * Check if variable name is allowed. * @param variable The variable to check. @@ -321,6 +399,13 @@ export default util.createRule({ continue; } + // ignore static class method generic shadowing class generic + // this is impossible for the scope analyser to understand + // so we have to handle this manually in this rule + if (isGenericOfAStaticMethodShadow(variable, shadowed)) { + continue; + } + const isESLintGlobal = 'writeable' in shadowed; if ( (shadowed.identifiers.length > 0 || diff --git a/packages/eslint-plugin/tests/rules/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow.test.ts index abc78ee5f3ec..f48adfc1b57c 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow.test.ts @@ -159,6 +159,19 @@ type Fn = (Foo: string) => typeof Foo; `, options: [{ ignoreFunctionTypeParameterNameValueShadow: false }], }, + ` +export class Wrapper { + private constructor(private readonly wrapped: Wrapped) {} + + unwrap(): Wrapped { + return this.wrapped; + } + + static create(wrapped: Wrapped) { + return new Wrapper(wrapped); + } +} + `, ], invalid: [ { From 37ec2c2264add3e6ce20ac4e02d48644afda3fa8 Mon Sep 17 00:00:00 2001 From: Daniel Cassidy Date: Sat, 15 May 2021 22:13:12 +0100 Subject: [PATCH 34/35] feat(eslint-plugin): [dot-notation] optionally allow square bracket notation where an index signature exists in conjunction with `noPropertyAccessFromIndexSignature` (#3361) --- .../eslint-plugin/docs/rules/dot-notation.md | 24 ++++++++- .../eslint-plugin/src/rules/dot-notation.ts | 49 +++++++++++++++---- .../tests/rules/dot-notation.test.ts | 34 +++++++++++++ .../eslint-plugin/typings/eslint-rules.d.ts | 1 + 4 files changed, 97 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/dot-notation.md b/packages/eslint-plugin/docs/rules/dot-notation.md index 56097090e2e0..094e2e4fc673 100644 --- a/packages/eslint-plugin/docs/rules/dot-notation.md +++ b/packages/eslint-plugin/docs/rules/dot-notation.md @@ -3,7 +3,10 @@ ## Rule Details This rule extends the base [`eslint/dot-notation`](https://eslint.org/docs/rules/dot-notation) rule. -It adds support for optionally ignoring computed `private` member access. +It adds: + +- Support for optionally ignoring computed `private` and/or `protected` member access. +- Compatibility with TypeScript's `noPropertyAccessFromIndexSignature` option. ## How to use @@ -24,14 +27,18 @@ This rule adds the following options: interface Options extends BaseDotNotationOptions { allowPrivateClassPropertyAccess?: boolean; allowProtectedClassPropertyAccess?: boolean; + allowIndexSignaturePropertyAccess?: boolean; } const defaultOptions: Options = { ...baseDotNotationDefaultOptions, allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, + allowIndexSignaturePropertyAccess: false, }; ``` +If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to `true`, then this rule always allows the use of square bracket notation to access properties of types that have a `string` index signature, even if `allowIndexSignaturePropertyAccess` is `false`. + ### `allowPrivateClassPropertyAccess` Example of a correct code when `allowPrivateClassPropertyAccess` is set to `true` @@ -58,4 +65,19 @@ const x = new X(); x['protected_prop'] = 123; ``` +### `allowIndexSignaturePropertyAccess` + +Example of correct code when `allowIndexSignaturePropertyAccess` is set to `true` + +```ts +class X { + [key: string]: number; +} + +const x = new X(); +x['hello'] = 123; +``` + +If the TypeScript compiler option `noPropertyAccessFromIndexSignature` is set to `true`, then the above code is always allowed, even if `allowIndexSignaturePropertyAccess` is `false`. + Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/dot-notation.md) diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 2c9dd9f23514..055b97ecab25 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -1,11 +1,12 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as ts from 'typescript'; +import * as tsutils from 'tsutils'; import baseRule from 'eslint/lib/rules/dot-notation'; import { - InferOptionsTypeFromRule, - InferMessageIdsTypeFromRule, createRule, getParserServices, + InferMessageIdsTypeFromRule, + InferOptionsTypeFromRule, } from '../util'; export type Options = InferOptionsTypeFromRule; @@ -42,6 +43,10 @@ export default createRule({ type: 'boolean', default: false, }, + allowIndexSignaturePropertyAccess: { + type: 'boolean', + default: false, + }, }, additionalProperties: false, }, @@ -53,32 +58,41 @@ export default createRule({ { allowPrivateClassPropertyAccess: false, allowProtectedClassPropertyAccess: false, + allowIndexSignaturePropertyAccess: false, allowKeywords: true, allowPattern: '', }, ], create(context, [options]) { const rules = baseRule.create(context); + + const { program, esTreeNodeToTSNodeMap } = getParserServices(context); + const typeChecker = program.getTypeChecker(); + const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess; const allowProtectedClassPropertyAccess = options.allowProtectedClassPropertyAccess; - - const parserServices = getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const allowIndexSignaturePropertyAccess = + (options.allowIndexSignaturePropertyAccess ?? false) || + tsutils.isCompilerOptionEnabled( + program.getCompilerOptions(), + 'noPropertyAccessFromIndexSignature', + ); return { MemberExpression(node: TSESTree.MemberExpression): void { if ( (allowPrivateClassPropertyAccess || - allowProtectedClassPropertyAccess) && + allowProtectedClassPropertyAccess || + allowIndexSignaturePropertyAccess) && node.computed ) { - // for perf reasons - only fetch the symbol if we have to - const objectSymbol = typeChecker.getSymbolAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.property), + // for perf reasons - only fetch symbols if we have to + const propertySymbol = typeChecker.getSymbolAtLocation( + esTreeNodeToTSNodeMap.get(node.property), ); - const modifierKind = objectSymbol?.getDeclarations()?.[0] + const modifierKind = propertySymbol?.getDeclarations()?.[0] ?.modifiers?.[0].kind; if ( (allowPrivateClassPropertyAccess && @@ -88,6 +102,21 @@ export default createRule({ ) { return; } + if ( + propertySymbol === undefined && + allowIndexSignaturePropertyAccess + ) { + const objectType = typeChecker.getTypeAtLocation( + esTreeNodeToTSNodeMap.get(node.object), + ); + const indexType = typeChecker.getIndexTypeOfType( + objectType, + ts.IndexKind.String, + ); + if (indexType != undefined) { + return; + } + } } rules.MemberExpression(node); }, diff --git a/packages/eslint-plugin/tests/rules/dot-notation.test.ts b/packages/eslint-plugin/tests/rules/dot-notation.test.ts index 0d1f755b4829..cbdb2d523425 100644 --- a/packages/eslint-plugin/tests/rules/dot-notation.test.ts +++ b/packages/eslint-plugin/tests/rules/dot-notation.test.ts @@ -87,6 +87,18 @@ x['protected_prop'] = 123; `, options: [{ allowProtectedClassPropertyAccess: true }], }, + { + code: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x['hello'] = 3; + `, + options: [{ allowIndexSignaturePropertyAccess: true }], + }, ], invalid: [ { @@ -287,5 +299,27 @@ x.protected_prop = 123; `, errors: [{ messageId: 'useDot' }], }, + { + code: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x['prop'] = 'hello'; + `, + options: [{ allowIndexSignaturePropertyAccess: true }], + errors: [{ messageId: 'useDot' }], + output: ` +class X { + prop: string; + [key: string]: number; +} + +const x = new X(); +x.prop = 'hello'; + `, + }, ], }); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 425956e1f256..d6677e9dc93a 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -713,6 +713,7 @@ declare module 'eslint/lib/rules/dot-notation' { allowPattern?: string; allowPrivateClassPropertyAccess?: boolean; allowProtectedClassPropertyAccess?: boolean; + allowIndexSignaturePropertyAccess?: boolean; }, ], { From cae4f4a0f33f8c954b1670d0abcfc8edd6193a06 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 15 May 2021 14:52:27 -0700 Subject: [PATCH 35/35] fix(eslint-plugin): [no-unsafe-*] special case handling for the empty map constructor with no generics (#3394) Fixes #2109 Sucks that it had to be this way, but oh well. --- .../src/rules/no-unsafe-argument.ts | 4 ++ .../src/rules/no-unsafe-assignment.ts | 7 ++- .../src/rules/no-unsafe-return.ts | 1 + packages/eslint-plugin/src/util/types.ts | 20 +++++++- .../tests/rules/no-unsafe-argument.test.ts | 5 ++ .../tests/rules/no-unsafe-assignment.test.ts | 2 + .../tests/rules/no-unsafe-return.test.ts | 6 +++ .../tests/util/isUnsafeAssignment.test.ts | 49 +++++++++++++------ 8 files changed, 76 insertions(+), 18 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts index 160519e27683..84887bd8d658 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts @@ -220,6 +220,9 @@ export default util.createRule<[], MessageIds>({ tupleType, parameterType, checker, + // we can't pass the individual tuple members in here as this will most likely be a spread variable + // not a spread array + null, ); if (result) { context.report({ @@ -258,6 +261,7 @@ export default util.createRule<[], MessageIds>({ argumentType, parameterType, checker, + argument, ); if (result) { context.report({ diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index ac8152085449..ae900b14f0cd 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -283,7 +283,12 @@ export default util.createRule({ return false; } - const result = util.isUnsafeAssignment(senderType, receiverType, checker); + const result = util.isUnsafeAssignment( + senderType, + receiverType, + checker, + senderNode, + ); if (!result) { return false; } diff --git a/packages/eslint-plugin/src/rules/no-unsafe-return.ts b/packages/eslint-plugin/src/rules/no-unsafe-return.ts index a818be4ef4ee..4d65ce529af0 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-return.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-return.ts @@ -151,6 +151,7 @@ export default util.createRule({ returnNodeType, functionReturnType, checker, + returnNode, ); if (!result) { return; diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index 920ce66de02f..089620e702a3 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -1,3 +1,7 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; import debug from 'debug'; import { isCallExpression, @@ -419,6 +423,7 @@ export function isUnsafeAssignment( type: ts.Type, receiver: ts.Type, checker: ts.TypeChecker, + senderNode: TSESTree.Node | null, ): false | { sender: ts.Type; receiver: ts.Type } { if (isTypeAnyType(type)) { // Allow assignment of any ==> unknown. @@ -451,6 +456,19 @@ export function isUnsafeAssignment( return false; } + if ( + senderNode?.type === AST_NODE_TYPES.NewExpression && + senderNode.callee.type === AST_NODE_TYPES.Identifier && + senderNode.callee.name === 'Map' && + senderNode.arguments.length === 0 && + senderNode.typeParameters == null + ) { + // special case to handle `new Map()` + // unfortunately Map's default empty constructor is typed to return `Map` :( + // https://github.com/typescript-eslint/typescript-eslint/issues/2109#issuecomment-634144396 + return false; + } + const typeArguments = type.typeArguments ?? []; const receiverTypeArguments = receiver.typeArguments ?? []; @@ -458,7 +476,7 @@ export function isUnsafeAssignment( const arg = typeArguments[i]; const receiverArg = receiverTypeArguments[i]; - const unsafe = isUnsafeAssignment(arg, receiverArg, checker); + const unsafe = isUnsafeAssignment(arg, receiverArg, checker, senderNode); if (unsafe) { return { sender: type, receiver }; } diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts index a9a6bc3eacca..6205a371a14a 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts @@ -85,6 +85,11 @@ foo('a', 'b', 1 as any); declare function toHaveBeenCalledWith(...params: E): void; toHaveBeenCalledWith(1 as any); `, + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + ` +declare function acceptsMap(arg: Map): void; +acceptsMap(new Map()); + `, ], invalid: [ { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts index b0f8ec612333..f9594fc93481 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts @@ -141,6 +141,8 @@ declare function Foo(props: { a: string }): never; 'const x: unknown = y as any;', 'const x: unknown[] = y as any[];', 'const x: Set = y as Set;', + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + 'const x: Map = new Map();', ], invalid: [ ...batchedSingleLineTests({ diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts index 5cfd965ab8e1..0f533917d54c 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts @@ -92,6 +92,12 @@ function foo(): Set { return x as Set; } `, + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + ` + function test(): Map { + return new Map(); + } + `, ], invalid: [ ...batchedSingleLineTests({ diff --git a/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts b/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts index efe1fe9d1bad..ece61a1c149c 100644 --- a/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts +++ b/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts @@ -10,7 +10,12 @@ describe('isUnsafeAssignment', () => { function getTypes( code: string, - ): { sender: ts.Type; receiver: ts.Type; checker: ts.TypeChecker } { + ): { + sender: ts.Type; + senderNode: TSESTree.Node; + receiver: ts.Type; + checker: ts.TypeChecker; + } { const { ast, services } = parseForESLint(code, { project: './tsconfig.json', filePath: path.join(rootDir, 'file.ts'), @@ -28,6 +33,7 @@ describe('isUnsafeAssignment', () => { sender: checker.getTypeAtLocation( esTreeNodeToTSNodeMap.get(declarator.init!), ), + senderNode: declarator.init!, checker, }; } @@ -52,7 +58,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'any', 'string', @@ -65,7 +71,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set', 'Set', @@ -78,7 +84,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Map', 'Map', @@ -91,7 +97,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set', 'Set', @@ -104,7 +110,7 @@ describe('isUnsafeAssignment', () => { ); expectTypesAre( - isUnsafeAssignment(sender, receiver, checker), + isUnsafeAssignment(sender, receiver, checker, null), checker, 'Set>>', 'Set>>', @@ -118,13 +124,13 @@ describe('isUnsafeAssignment', () => { 'const test: string = "";', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any to a any', () => { const { sender, receiver, checker } = getTypes('const test: any = "";'); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any', () => { @@ -132,7 +138,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set = new Set();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (multiple generics)', () => { @@ -140,7 +146,7 @@ describe('isUnsafeAssignment', () => { 'const test: Map = new Map();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any[] in a generic position to a non-any[]', () => { @@ -148,7 +154,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set = new Set();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (nested)', () => { @@ -156,7 +162,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a any (nested)', () => { @@ -164,7 +170,7 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any to a unknown', () => { @@ -172,7 +178,7 @@ describe('isUnsafeAssignment', () => { 'const test: unknown = [] as any;', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any[] in a generic position to a unknown[]', () => { @@ -180,7 +186,7 @@ describe('isUnsafeAssignment', () => { 'const test: unknown[] = [] as any[]', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any in a generic position to a unknown (nested)', () => { @@ -188,7 +194,18 @@ describe('isUnsafeAssignment', () => { 'const test: Set>> = new Set>>();', ); - expect(isUnsafeAssignment(sender, receiver, checker)).toBeFalsy(); + expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); + }); + + // https://github.com/typescript-eslint/typescript-eslint/issues/2109 + it('special cases the empty map constructor with no generics', () => { + const { sender, senderNode, receiver, checker } = getTypes( + 'const test: Map = new Map();', + ); + + expect( + isUnsafeAssignment(sender, receiver, checker, senderNode), + ).toBeFalsy(); }); }); });