From 81450ed7eaede74b384e9a91a84e9b4d34513866 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 29 Aug 2022 21:24:05 +0930 Subject: [PATCH] feat: support TypeScript 4.8 (#5551) --- .eslintrc.js | 12 +- .github/actions/prepare-install/action.yml | 1 + README.md | 2 +- _redirects | 4 - netlify.toml | 25 +++ package.json | 11 +- .../src/rules/plugin-test-formatting.ts | 6 +- .../src/rules/class-literal-property-style.ts | 2 +- .../eslint-plugin/src/rules/comma-spacing.ts | 2 + .../eslint-plugin/src/rules/dot-notation.ts | 12 +- .../src/rules/prefer-optional-chain.ts | 2 +- .../src/rules/space-before-blocks.ts | 1 + .../src/rules/space-before-function-paren.ts | 1 + .../src/rules/type-annotation-spacing.ts | 1 + .../eslint-plugin/src/rules/unbound-method.ts | 3 +- packages/eslint-plugin/src/util/index.ts | 6 +- .../rules/consistent-type-assertions.test.ts | 8 +- .../tests/rules/prefer-as-const.test.ts | 20 +-- .../scope-manager/src/lib/dom.iterable.ts | 3 - packages/scope-manager/src/lib/dom.ts | 31 +--- packages/scope-manager/src/lib/es2020.intl.ts | 2 + packages/scope-manager/src/lib/es2022.intl.ts | 11 ++ .../src/lib/es2022.sharedmemory.ts | 11 ++ packages/scope-manager/src/lib/es2022.ts | 4 + packages/scope-manager/src/lib/index.ts | 4 + packages/scope-manager/src/lib/webworker.ts | 13 +- packages/type-utils/package.json | 1 + packages/type-utils/src/index.ts | 5 + packages/types/src/lib.ts | 2 + packages/typescript-estree/src/convert.ts | 106 ++++++++----- .../typescript-estree/src/getModifiers.ts | 52 +++++++ packages/typescript-estree/src/index.ts | 2 + packages/typescript-estree/src/node-utils.ts | 23 ++- packages/typescript-estree/src/parser.ts | 2 +- .../typescript-estree/src/version-check.ts | 9 +- .../tests/ast-alignment/fixtures-to-test.ts | 2 +- .../tests/ast-alignment/spec.ts | 26 ++-- .../lib/__snapshots__/convert.test.ts.snap | 17 --- .../semantic-diagnostics-enabled.test.ts.snap | 8 +- .../tests/lib/convert.test.ts | 52 ++++--- .../snapshots/jsx/embedded-tags.src.js.shot | 6 +- .../jsx/invalid-attribute.src.js.shot | 2 +- .../decorator-on-variable.src.ts.shot | 56 ------- packages/utils/src/ts-eslint/CLIEngine.ts | 1 + .../website/src/components/modals/Modal.tsx | 6 +- patches/tsutils+3.21.0.patch | 13 ++ patches/typescript+4.8.2.patch | 42 +++++ yarn.lock | 144 +++++++++++++++--- 48 files changed, 516 insertions(+), 259 deletions(-) delete mode 100644 _redirects create mode 100644 netlify.toml create mode 100644 packages/scope-manager/src/lib/es2022.intl.ts create mode 100644 packages/scope-manager/src/lib/es2022.sharedmemory.ts create mode 100644 packages/typescript-estree/src/getModifiers.ts create mode 100644 patches/tsutils+3.21.0.patch create mode 100644 patches/typescript+4.8.2.patch diff --git a/.eslintrc.js b/.eslintrc.js index f3f97eebf54..3c25f781dfc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,12 +1,13 @@ module.exports = { root: true, plugins: [ - 'eslint-plugin', '@typescript-eslint', - 'jest', - 'import', - 'eslint-comments', '@typescript-eslint/internal', + 'deprecation', + 'eslint-comments', + 'eslint-plugin', + 'import', + 'jest', 'simple-import-sort', ], env: { @@ -41,6 +42,9 @@ module.exports = { EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, }, rules: { + // make sure we're not leveraging any deprecated APIs + 'deprecation/deprecation': 'error', + // // our plugin :D // diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml index bcb843c9a61..85051b4885d 100644 --- a/.github/actions/prepare-install/action.yml +++ b/.github/actions/prepare-install/action.yml @@ -44,3 +44,4 @@ runs: run: | yarn --ignore-engines --frozen-lockfile --ignore-scripts yarn check-clean-workspace-after-install + yarn patch-package diff --git a/README.md b/README.md index 10c836bcfdf..bddf59d198b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ The latest version under the `canary` tag **(latest commit to `main`)** is: ### Supported TypeScript Version -**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.8.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.3.1 <4.9.0`.** These versions are what we test against. diff --git a/_redirects b/_redirects deleted file mode 100644 index 1b61a020ea0..00000000000 --- a/_redirects +++ /dev/null @@ -1,4 +0,0 @@ -/docs/linting /docs -/docs/linting/type-linting /docs/linting/typed-linting -/docs/linting/monorepo /docs/linting/typed-linting/monorepos -/docs/linting/tslint /docs/linting/troubleshooting/tslint diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000000..7ac5b981148 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,25 @@ +# https://docs.netlify.com/configure-builds/file-based-configuration/#build-settings +[build] + base = "" + publish = "packages/website/build" + command = "NX_VERBOSE_LOGGING=true yarn patch-package && yarn nx build website" +[build.environment] + NETLIFY_USE_YARN = "true" + YARN_FLAGS = "--ignore-scripts" + +# https://docs.netlify.com/configure-builds/file-based-configuration/#redirects +[[redirects]] + from = "/docs/linting" + to = "/docs" + +[[redirects]] + from = "/docs/linting/type-linting" + to = "/docs/linting/typed-linting" + +[[redirects]] + from = "/docs/linting/monorepo" + to = "/docs/linting/typed-linting/monorepos" + +[[redirects]] + from = "/docs/linting/tslint" + to = "/docs/linting/troubleshooting/tslint" diff --git a/package.json b/package.json index 036dd42f60d..d40e7bb08fd 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,12 @@ "generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts", "generate-sponsors": "yarn ts-node --transpile-only ./tools/generate-sponsors.ts", "generate-website-dts": "yarn ts-node --transpile-only ./tools/generate-website-dts.ts", + "generate-lib": "nx generate-lib @typescript-eslint/scope-manager", "lint-fix": "eslint . --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", "lint": "cross-env NODE_OPTIONS=\"--max-old-space-size=16384\" eslint .", - "postinstall": "yarn husky install && yarn build", + "postinstall": "yarn patch-package && yarn husky install && yarn build", "pre-commit": "yarn lint-staged", "start": "nx run website:start", "test": "nx run-many --target=test --all --parallel", @@ -77,9 +78,10 @@ "cross-env": "^7.0.3", "cross-fetch": "^3.1.5", "cspell": "^5.20.0", - "downlevel-dts": "^0.9.0", + "downlevel-dts": ">=0.10.0", "enhanced-resolve": "^5.9.3", "eslint": "^8.15.0", + "eslint-plugin-deprecation": "^1.3.2", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-plugin": "^5.0.1", "eslint-plugin-import": "^2.26.0", @@ -96,16 +98,17 @@ "make-dir": "^3.1.0", "markdownlint-cli": "^0.31.1", "ncp": "^2.0.0", + "patch-package": "^6.4.7", "prettier": "2.7.1", "pretty-format": "^28.1.0", "rimraf": "^3.0.2", "tmp": "^0.2.1", "ts-node": "^10.7.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.8.0" + "typescript": ">=3.3.1 <4.9.0" }, "resolutions": { - "typescript": "4.7.4", + "typescript": "4.8.2", "@types/node": "^17.0.31", "pretty-format": "^28.1.0", "//": "Pin jest to v28 across the repo", 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 2ee9b80302e..7dc29a4a1c8 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -157,7 +157,7 @@ export default createRule({ return format(code, { ...prettierConfig, parser: 'typescript', - }).trimRight(); // prettier will insert a new line at the end of the code + }).trimEnd(); // prettier will insert a new line at the end of the code } catch (ex) { // adapted from https://github.com/prettier/eslint-plugin-prettier/blob/185b1064d3dd674538456fb2fad97fbfcde49e0d/eslint-plugin-prettier.js#L242-L257 if (!(ex instanceof SyntaxError)) { @@ -282,9 +282,9 @@ export default createRule({ const lines = text.split('\n'); const lastLine = lines[lines.length - 1]; // prettier will trim out the end of line on save, but eslint will check before then - const isStartEmpty = lines[0].trimRight() === ''; + const isStartEmpty = lines[0].trimEnd() === ''; // last line can be indented - const isEndEmpty = lastLine.trimLeft() === ''; + const isEndEmpty = lastLine.trimStart() === ''; if (!isStartEmpty || !isEndEmpty) { // multiline template strings must have an empty first/last line return context.report({ diff --git a/packages/eslint-plugin/src/rules/class-literal-property-style.ts b/packages/eslint-plugin/src/rules/class-literal-property-style.ts index 1dc876a821b..716d625370d 100644 --- a/packages/eslint-plugin/src/rules/class-literal-property-style.ts +++ b/packages/eslint-plugin/src/rules/class-literal-property-style.ts @@ -15,7 +15,7 @@ const printNodeModifiers = ( ): string => `${node.accessibility ?? ''}${ node.static ? ' static' : '' - } ${final} `.trimLeft(); + } ${final} `.trimStart(); const isSupportedLiteral = ( node: TSESTree.Node, diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts index ac9520440f3..773f8689faf 100644 --- a/packages/eslint-plugin/src/rules/comma-spacing.ts +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -110,6 +110,7 @@ export default createRule({ if ( prevToken && isTokenOnSameLine(prevToken, commaToken) && + // eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0 spaceBefore !== sourceCode.isSpaceBetweenTokens(prevToken, commaToken) ) { context.report({ @@ -139,6 +140,7 @@ export default createRule({ if ( nextToken && isTokenOnSameLine(commaToken, nextToken) && + // eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0 spaceAfter !== sourceCode.isSpaceBetweenTokens(commaToken, nextToken) ) { context.report({ diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 8b9d82d6362..803d2679fc4 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -4,6 +4,7 @@ import * as tsutils from 'tsutils'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; import { createRule, + getModifiers, getParserServices, InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, @@ -95,13 +96,14 @@ export default createRule({ const propertySymbol = typeChecker.getSymbolAtLocation( esTreeNodeToTSNodeMap.get(node.property), ); - const modifierKind = - propertySymbol?.getDeclarations()?.[0]?.modifiers?.[0].kind; + const modifierKind = getModifiers( + propertySymbol?.getDeclarations()?.[0], + )?.[0].kind; if ( (allowPrivateClassPropertyAccess && - modifierKind == ts.SyntaxKind.PrivateKeyword) || + modifierKind === ts.SyntaxKind.PrivateKeyword) || (allowProtectedClassPropertyAccess && - modifierKind == ts.SyntaxKind.ProtectedKeyword) + modifierKind === ts.SyntaxKind.ProtectedKeyword) ) { return; } @@ -115,7 +117,7 @@ export default createRule({ const indexType = objectType .getNonNullableType() .getStringIndexType(); - if (indexType != undefined) { + if (indexType !== undefined) { return; } } diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index aeb4ff9146d..d33729d5eba 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -230,7 +230,7 @@ export default util.createRule({ break; } const { rightText, shouldBreak } = breakIfInvalid({ - rightNode: current.right as ValidChainTarget, + rightNode: current.right, previousLeftText, }); if (shouldBreak) { diff --git a/packages/eslint-plugin/src/rules/space-before-blocks.ts b/packages/eslint-plugin/src/rules/space-before-blocks.ts index f4d4d28ef6a..98dd47b91fe 100644 --- a/packages/eslint-plugin/src/rules/space-before-blocks.ts +++ b/packages/eslint-plugin/src/rules/space-before-blocks.ts @@ -46,6 +46,7 @@ export default util.createRule({ ): void { const precedingToken = sourceCode.getTokenBefore(node); if (precedingToken && util.isTokenOnSameLine(precedingToken, node)) { + // eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0 const hasSpace = sourceCode.isSpaceBetweenTokens( precedingToken, node as TSESTree.Token, diff --git a/packages/eslint-plugin/src/rules/space-before-function-paren.ts b/packages/eslint-plugin/src/rules/space-before-function-paren.ts index 2b34036b832..c6e277dbf30 100644 --- a/packages/eslint-plugin/src/rules/space-before-function-paren.ts +++ b/packages/eslint-plugin/src/rules/space-before-function-paren.ts @@ -146,6 +146,7 @@ export default util.createRule({ rightToken = sourceCode.getFirstToken(node, util.isOpeningParenToken)!; leftToken = sourceCode.getTokenBefore(rightToken)!; } + // eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0 const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken); if (hasSpacing && functionConfig === 'never') { diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index d10040fdf8d..cb87389b795 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -180,6 +180,7 @@ export default util.createRule({ if (type === ':' && previousToken.value === '?') { if ( + // eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0 sourceCode.isSpaceBetweenTokens(previousToken, punctuatorTokenStart) ) { context.report({ diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 2151cd7b3e8..568b7e2e1b3 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -2,6 +2,7 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; import * as tsutils from 'tsutils'; import * as ts from 'typescript'; import * as util from '../util'; +import { getModifiers } from '../util'; //------------------------------------------------------------------------------ // Rule Definition @@ -285,7 +286,7 @@ function checkMethod( !( ignoreStatic && tsutils.hasModifier( - valueDeclaration.modifiers, + getModifiers(valueDeclaration), ts.SyntaxKind.StaticKeyword, ) ), diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index 98ef1cf8707..b2ad2927773 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -7,11 +7,11 @@ export * from './getFunctionHeadLoc'; export * from './getOperatorPrecedence'; export * from './getThisExpression'; export * from './getWrappingFixer'; -export * from './misc'; -export * from './objectIterators'; +export * from './isNodeEqual'; export * from './isNullLiteral'; export * from './isUndefinedIdentifier'; -export * from './isNodeEqual'; +export * from './misc'; +export * from './objectIterators'; // this is done for convenience - saves migrating all of the old rules export * from '@typescript-eslint/type-utils'; diff --git a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts index a1d8e47645a..6f03cd73181 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts @@ -69,7 +69,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_AS_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, + code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, options: [ { assertionStyle: 'as', @@ -78,7 +78,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, + code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, options: [ { assertionStyle: 'angle-bracket', @@ -287,7 +287,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_AS_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, + code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, options: [ { assertionStyle: 'as', @@ -330,7 +330,7 @@ ruleTester.run('consistent-type-assertions', rule, { ], }), ...batchedSingleLineTests({ - code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimRight()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, + code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, options: [ { assertionStyle: 'angle-bracket', diff --git a/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts index 7cfdc209411..f4e2f46d998 100644 --- a/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts @@ -217,7 +217,7 @@ ruleTester.run('prefer-as-const', rule, { class foo { bar: 'baz' = 'baz'; } - `.trimRight(), + `, output: null, errors: [ { @@ -231,7 +231,7 @@ class foo { class foo { bar = 'baz' as const; } - `.trimRight(), + `, }, ], }, @@ -242,7 +242,7 @@ class foo { class foo { bar: 2 = 2; } - `.trimRight(), + `, output: null, errors: [ { @@ -256,7 +256,7 @@ class foo { class foo { bar = 2 as const; } - `.trimRight(), + `, }, ], }, @@ -267,12 +267,12 @@ class foo { class foo { foo = <'bar'>'bar'; } - `.trimRight(), + `, output: ` class foo { foo = 'bar'; } - `.trimRight(), + `, errors: [ { messageId: 'preferConstAssertion', @@ -286,12 +286,12 @@ class foo { class foo { foo = 'bar' as 'bar'; } - `.trimRight(), + `, output: ` class foo { foo = 'bar' as const; } - `.trimRight(), + `, errors: [ { messageId: 'preferConstAssertion', @@ -305,12 +305,12 @@ class foo { class foo { foo = 5 as 5; } - `.trimRight(), + `, output: ` class foo { foo = 5 as const; } - `.trimRight(), + `, errors: [ { messageId: 'preferConstAssertion', diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index 094303434e3..225c4f28b84 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -30,9 +30,6 @@ export const dom_iterable = { Headers: TYPE, IDBDatabase: TYPE, IDBObjectStore: TYPE, - MIDIInputMap: TYPE, - MIDIOutput: TYPE, - MIDIOutputMap: TYPE, MediaKeyStatusMap: TYPE, MediaList: TYPE, MessageEvent: TYPE, diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index e862fbc92d4..14b2143e424 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -108,6 +108,7 @@ export const dom = { IDBDatabaseInfo: TYPE, IDBIndexParameters: TYPE, IDBObjectStoreParameters: TYPE, + IDBTransactionOptions: TYPE, IDBVersionChangeEventInit: TYPE, IIRFilterOptions: TYPE, IdleRequestOptions: TYPE, @@ -127,9 +128,6 @@ export const dom = { LockInfo: TYPE, LockManagerSnapshot: TYPE, LockOptions: TYPE, - MIDIConnectionEventInit: TYPE, - MIDIMessageEventInit: TYPE, - MIDIOptions: TYPE, MediaCapabilitiesDecodingInfo: TYPE, MediaCapabilitiesEncodingInfo: TYPE, MediaCapabilitiesInfo: TYPE, @@ -245,8 +243,8 @@ export const dom = { RTCStats: TYPE, RTCTrackEventInit: TYPE, RTCTransportStats: TYPE, - ReadableStreamDefaultReadDoneResult: TYPE, - ReadableStreamDefaultReadValueResult: TYPE, + ReadableStreamReadDoneResult: TYPE, + ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, RegistrationOptions: TYPE, RequestInit: TYPE, @@ -288,6 +286,7 @@ export const dom = { ULongRange: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, + ValidityStateFlags: TYPE, VideoColorSpaceInit: TYPE, VideoConfiguration: TYPE, VideoFrameMetadata: TYPE, @@ -620,17 +619,6 @@ export const dom = { Location: TYPE_VALUE, Lock: TYPE_VALUE, LockManager: TYPE_VALUE, - MIDIAccessEventMap: TYPE, - MIDIAccess: TYPE_VALUE, - MIDIConnectionEvent: TYPE_VALUE, - MIDIInputEventMap: TYPE, - MIDIInput: TYPE_VALUE, - MIDIInputMap: TYPE_VALUE, - MIDIMessageEvent: TYPE_VALUE, - MIDIOutput: TYPE_VALUE, - MIDIOutputMap: TYPE_VALUE, - MIDIPortEventMap: TYPE, - MIDIPort: TYPE_VALUE, MathMLElementEventMap: TYPE, MathMLElement: TYPE_VALUE, MediaCapabilities: TYPE_VALUE, @@ -684,11 +672,9 @@ export const dom = { NavigatorID: TYPE, NavigatorLanguage: TYPE, NavigatorLocks: TYPE, - NavigatorNetworkInformation: TYPE, NavigatorOnLine: TYPE, NavigatorPlugins: TYPE, NavigatorStorage: TYPE, - NetworkInformation: TYPE_VALUE, Node: TYPE_VALUE, NodeIterator: TYPE_VALUE, NodeList: TYPE_VALUE, @@ -781,7 +767,10 @@ export const dom = { RTCTrackEvent: TYPE_VALUE, RadioNodeList: TYPE_VALUE, Range: TYPE_VALUE, + ReadableByteStreamController: TYPE_VALUE, ReadableStream: TYPE_VALUE, + ReadableStreamBYOBReader: TYPE_VALUE, + ReadableStreamBYOBRequest: TYPE_VALUE, ReadableStreamDefaultController: TYPE_VALUE, ReadableStreamDefaultReader: TYPE_VALUE, ReadableStreamGenericReader: TYPE, @@ -1126,7 +1115,7 @@ export const dom = { OnErrorEventHandler: TYPE, PerformanceEntryList: TYPE, ReadableStreamController: TYPE, - ReadableStreamDefaultReadResult: TYPE, + ReadableStreamReadResult: TYPE, ReadableStreamReader: TYPE, RenderingContext: TYPE, RequestInfo: TYPE, @@ -1170,7 +1159,6 @@ export const dom = { ColorSpaceConversion: TYPE, CompositeOperation: TYPE, CompositeOperationOrAuto: TYPE, - ConnectionType: TYPE, CredentialMediationRequirement: TYPE, DOMParserSupportedType: TYPE, DirectionSetting: TYPE, @@ -1201,9 +1189,6 @@ export const dom = { KeyUsage: TYPE, LineAlignSetting: TYPE, LockMode: TYPE, - MIDIPortConnectionState: TYPE, - MIDIPortDeviceState: TYPE, - MIDIPortType: TYPE, MediaDecodingType: TYPE, MediaDeviceKind: TYPE, MediaEncodingType: TYPE, diff --git a/packages/scope-manager/src/lib/es2020.intl.ts b/packages/scope-manager/src/lib/es2020.intl.ts index a6ba13fec03..6cf997c0ca3 100644 --- a/packages/scope-manager/src/lib/es2020.intl.ts +++ b/packages/scope-manager/src/lib/es2020.intl.ts @@ -4,8 +4,10 @@ // npx nx generate-lib @typescript-eslint/scope-manager import { ImplicitLibVariableOptions } from '../variable'; +import { es2018_intl } from './es2018.intl'; import { TYPE_VALUE } from './base-config'; export const es2020_intl = { + ...es2018_intl, Intl: TYPE_VALUE, } as Record; diff --git a/packages/scope-manager/src/lib/es2022.intl.ts b/packages/scope-manager/src/lib/es2022.intl.ts new file mode 100644 index 00000000000..f91ef8640a0 --- /dev/null +++ b/packages/scope-manager/src/lib/es2022.intl.ts @@ -0,0 +1,11 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib @typescript-eslint/scope-manager + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; + +export const es2022_intl = { + Intl: TYPE_VALUE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2022.sharedmemory.ts b/packages/scope-manager/src/lib/es2022.sharedmemory.ts new file mode 100644 index 00000000000..8efb4b9d8c9 --- /dev/null +++ b/packages/scope-manager/src/lib/es2022.sharedmemory.ts @@ -0,0 +1,11 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib @typescript-eslint/scope-manager + +import { ImplicitLibVariableOptions } from '../variable'; +import { TYPE } from './base-config'; + +export const es2022_sharedmemory = { + Atomics: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2022.ts b/packages/scope-manager/src/lib/es2022.ts index a81f7b70b47..6f23b9dcd57 100644 --- a/packages/scope-manager/src/lib/es2022.ts +++ b/packages/scope-manager/src/lib/es2022.ts @@ -7,13 +7,17 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2021 } from './es2021'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; +import { es2022_intl } from './es2022.intl'; import { es2022_object } from './es2022.object'; +import { es2022_sharedmemory } from './es2022.sharedmemory'; import { es2022_string } from './es2022.string'; export const es2022 = { ...es2021, ...es2022_array, ...es2022_error, + ...es2022_intl, ...es2022_object, + ...es2022_sharedmemory, ...es2022_string, } as Record; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index ab0328f7cf0..6e8e0ad7301 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -59,7 +59,9 @@ import { es2021_weakref } from './es2021.weakref'; import { es2021_intl } from './es2021.intl'; import { es2022_array } from './es2022.array'; import { es2022_error } from './es2022.error'; +import { es2022_intl } from './es2022.intl'; import { es2022_object } from './es2022.object'; +import { es2022_sharedmemory } from './es2022.sharedmemory'; import { es2022_string } from './es2022.string'; import { esnext_array } from './esnext.array'; import { esnext_symbol } from './esnext.symbol'; @@ -136,7 +138,9 @@ const lib = { 'es2021.intl': es2021_intl, 'es2022.array': es2022_array, 'es2022.error': es2022_error, + 'es2022.intl': es2022_intl, 'es2022.object': es2022_object, + 'es2022.sharedmemory': es2022_sharedmemory, 'es2022.string': es2022_string, 'esnext.array': esnext_array, 'esnext.symbol': esnext_symbol, diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index 55e4f2b58c5..4a0135864c8 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -51,6 +51,7 @@ export const webworker = { IDBDatabaseInfo: TYPE, IDBIndexParameters: TYPE, IDBObjectStoreParameters: TYPE, + IDBTransactionOptions: TYPE, IDBVersionChangeEventInit: TYPE, ImageBitmapOptions: TYPE, ImageBitmapRenderingContextSettings: TYPE, @@ -87,8 +88,8 @@ export const webworker = { QueuingStrategyInit: TYPE, RTCEncodedAudioFrameMetadata: TYPE, RTCEncodedVideoFrameMetadata: TYPE, - ReadableStreamDefaultReadDoneResult: TYPE, - ReadableStreamDefaultReadValueResult: TYPE, + ReadableStreamReadDoneResult: TYPE, + ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, RegistrationOptions: TYPE, RequestInit: TYPE, @@ -215,10 +216,8 @@ export const webworker = { NavigatorID: TYPE, NavigatorLanguage: TYPE, NavigatorLocks: TYPE, - NavigatorNetworkInformation: TYPE, NavigatorOnLine: TYPE, NavigatorStorage: TYPE, - NetworkInformation: TYPE_VALUE, NotificationEventMap: TYPE, Notification: TYPE_VALUE, NotificationEvent: TYPE_VALUE, @@ -254,7 +253,10 @@ export const webworker = { PushSubscriptionOptions: TYPE_VALUE, RTCEncodedAudioFrame: TYPE_VALUE, RTCEncodedVideoFrame: TYPE_VALUE, + ReadableByteStreamController: TYPE_VALUE, ReadableStream: TYPE_VALUE, + ReadableStreamBYOBReader: TYPE_VALUE, + ReadableStreamBYOBRequest: TYPE_VALUE, ReadableStreamDefaultController: TYPE_VALUE, ReadableStreamDefaultReader: TYPE_VALUE, ReadableStreamGenericReader: TYPE, @@ -390,7 +392,7 @@ export const webworker = { PerformanceEntryList: TYPE, PushMessageDataInit: TYPE, ReadableStreamController: TYPE, - ReadableStreamDefaultReadResult: TYPE, + ReadableStreamReadResult: TYPE, ReadableStreamReader: TYPE, RequestInfo: TYPE, TexImageSource: TYPE, @@ -403,7 +405,6 @@ export const webworker = { ClientTypes: TYPE, ColorGamut: TYPE, ColorSpaceConversion: TYPE, - ConnectionType: TYPE, DocumentVisibilityState: TYPE, EndingType: TYPE, FileSystemHandleKind: TYPE, diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index c9e153f70f5..1d2a3756180 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -39,6 +39,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { + "@typescript-eslint/typescript-estree": "5.35.1", "@typescript-eslint/utils": "5.35.1", "debug": "^4.3.4", "tsutils": "^3.21.0" diff --git a/packages/type-utils/src/index.ts b/packages/type-utils/src/index.ts index 44eb35ec945..dde032e1770 100644 --- a/packages/type-utils/src/index.ts +++ b/packages/type-utils/src/index.ts @@ -12,3 +12,8 @@ export * from './predicates'; export * from './propertyTypes'; export * from './requiresQuoting'; export * from './typeFlagUtils'; +export { + getDecorators, + getModifiers, + typescriptVersionIsAtLeast, +} from '@typescript-eslint/typescript-estree'; diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 9310996e516..0d92717fcb5 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -60,7 +60,9 @@ type Lib = | 'es2021.intl' | 'es2022.array' | 'es2022.error' + | 'es2022.intl' | 'es2022.object' + | 'es2022.sharedmemory' | 'es2022.string' | 'esnext.array' | 'esnext.symbol' diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 81c17185743..4f69728b66a 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1,6 +1,7 @@ // There's lots of funny stuff due to the typing of ts.Node /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */ import * as ts from 'typescript'; +import { getDecorators, getModifiers } from './getModifiers'; import { canContainDirective, createError, @@ -160,14 +161,15 @@ export class Converter { result: T, ): TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | T { // check for exports - if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { + const modifiers = getModifiers(node); + if (modifiers?.[0].kind === SyntaxKind.ExportKeyword) { /** * Make sure that original node is registered instead of export */ this.registerTSNodeInNodeMap(node, result); - const exportKeyword = node.modifiers[0]; - const nextModifier = node.modifiers[1]; + const exportKeyword = modifiers[0]; + const nextModifier = modifiers[1]; const declarationIsDefault = nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; @@ -408,10 +410,9 @@ export class Converter { return parameters.map(param => { const convertedParam = this.convertChild(param) as TSESTree.Parameter; - if (param.decorators?.length) { - convertedParam.decorators = param.decorators.map(el => - this.convertChild(el), - ); + const decorators = getDecorators(param); + if (decorators?.length) { + convertedParam.decorators = decorators.map(el => this.convertChild(el)); } return convertedParam; }); @@ -509,17 +510,38 @@ export class Converter { ) : null; } - if ('decorators' in node && node.decorators && node.decorators.length) { - result.decorators = node.decorators.map(el => this.convertChild(el)); + const decorators = getDecorators(node); + if (decorators?.length) { + result.decorators = decorators.map(el => this.convertChild(el)); } + // keys we never want to clone from the base typescript node as they + // introduce garbage into our AST + const KEYS_TO_NOT_COPY = new Set([ + '_children', + 'decorators', + 'end', + 'flags', + 'illegalDecorators', + 'heritageClauses', + 'locals', + 'localSymbol', + 'jsDoc', + 'kind', + 'modifierFlagsCache', + 'modifiers', + 'nextContainer', + 'parent', + 'pos', + 'symbol', + 'transformFlags', + 'type', + 'typeArguments', + 'typeParameters', + ]); + Object.entries(node) - .filter( - ([key]) => - !/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc|type|typeArguments|typeParameters|decorators|transformFlags)$/.test( - key, - ), - ) + .filter(([key]) => !KEYS_TO_NOT_COPY.has(key)) .forEach(([key, value]) => { if (Array.isArray(value)) { result[key] = value.map(el => this.convertChild(el as TSNode)); @@ -679,18 +701,21 @@ export class Converter { /** * Applies the given TS modifiers to the given result object. + * + * This method adds not standardized `modifiers` property in nodes + * * @param result * @param modifiers original ts.Nodes from the node.modifiers array * @returns the current result object will be mutated - * @deprecated This method adds not standardized `modifiers` property in nodes */ private applyModifiersToResult( result: TSESTree.TSEnumDeclaration | TSESTree.TSModuleDeclaration, - modifiers?: ts.ModifiersArray, + modifiers: Iterable | undefined, ): void { - if (!modifiers?.length) { + if (!modifiers) { return; } + const remainingModifiers: TSESTree.Modifier[] = []; /** * Some modifiers are explicitly handled by applying them as @@ -725,7 +750,7 @@ export class Converter { * not been explicitly handled above, we just convert and * add the modifiers array to the result node. */ - if (remainingModifiers.length) { + if (remainingModifiers.length > 0) { result.modifiers = remainingModifiers; } } @@ -1034,8 +1059,9 @@ export class Converter { * but the TypeScript compiler will parse them and produce a valid AST, * so we handle them here too. */ - if (node.decorators) { - (result as any).decorators = node.decorators.map(el => + const decorators = getDecorators(node); + if (decorators) { + (result as any).decorators = decorators.map(el => this.convertChild(el), ); } @@ -1167,8 +1193,9 @@ export class Converter { result.typeAnnotation = this.convertTypeAnnotation(node.type, node); } - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); + const decorators = getDecorators(node); + if (decorators) { + result.decorators = decorators.map(el => this.convertChild(el)); } const accessibility = getTSNodeAccessibility(node); @@ -1281,10 +1308,9 @@ export class Converter { override: hasModifier(SyntaxKind.OverrideKeyword, node), }); - if (node.decorators) { - result.decorators = node.decorators.map(el => - this.convertChild(el), - ); + const decorators = getDecorators(node); + if (decorators) { + result.decorators = decorators.map(el => this.convertChild(el)); } const accessibility = getTSNodeAccessibility(node); @@ -1618,7 +1644,8 @@ export class Converter { right: this.convertChild(node.initializer), }); - if (node.modifiers) { + const modifiers = getModifiers(node); + if (modifiers) { // AssignmentPattern should not contain modifiers in range result.range[0] = parameter.range[0]; result.loc = getLocFor(result.range[0], result.range[1], this.ast); @@ -1646,7 +1673,13 @@ export class Converter { parameter.optional = true; } - if (node.modifiers) { + const decorators = getDecorators(node); + if (decorators) { + parameter.decorators = decorators.map(d => this.convertChild(d)); + } + + const modifiers = getModifiers(node); + if (modifiers) { return this.createNode(node, { type: AST_NODE_TYPES.TSParameterProperty, accessibility: getTSNodeAccessibility(node) ?? undefined, @@ -1737,8 +1770,9 @@ export class Converter { result.declare = true; } - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); + const decorators = getDecorators(node); + if (decorators) { + result.decorators = decorators.map(el => this.convertChild(el)); } const filteredMembers = node.members.filter(isESTreeClassMember); @@ -2511,7 +2545,11 @@ export class Converter { typeAnnotation: node.type ? this.convertTypeAnnotation(node.type, node) : undefined, - initializer: this.convertChild(node.initializer) || undefined, + initializer: + this.convertChild( + // eslint-disable-next-line deprecation/deprecation -- TODO breaking change remove this from the AST + node.initializer, + ) || undefined, readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined, @@ -2725,7 +2763,7 @@ export class Converter { members: node.members.map(el => this.convertChild(el)), }); // apply modifiers first... - this.applyModifiersToResult(result, node.modifiers); + this.applyModifiersToResult(result, getModifiers(node)); // ...then check for exports return this.fixExports(node, result); } @@ -2753,7 +2791,7 @@ export class Converter { result.body = this.convertChild(node.body); } // apply modifiers first... - this.applyModifiersToResult(result, node.modifiers); + this.applyModifiersToResult(result, getModifiers(node)); if (node.flags & ts.NodeFlags.GlobalAugmentation) { result.global = true; } diff --git a/packages/typescript-estree/src/getModifiers.ts b/packages/typescript-estree/src/getModifiers.ts new file mode 100644 index 00000000000..24f119f9e8a --- /dev/null +++ b/packages/typescript-estree/src/getModifiers.ts @@ -0,0 +1,52 @@ +import * as ts from 'typescript'; +import { typescriptVersionIsAtLeast } from './version-check'; + +const isAtLeast48 = typescriptVersionIsAtLeast['4.8']; + +export function getModifiers( + node: ts.Node | null | undefined, +): undefined | ts.Modifier[] { + if (node == null) { + return undefined; + } + + if (isAtLeast48) { + // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded + if (ts.canHaveModifiers(node)) { + // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded + const modifiers = ts.getModifiers(node); + return modifiers ? Array.from(modifiers) : undefined; + } + + return undefined; + } + + return ( + // eslint-disable-next-line deprecation/deprecation -- intentional fallback for older TS versions + node.modifiers?.filter((m): m is ts.Modifier => !ts.isDecorator(m)) + ); +} + +export function getDecorators( + node: ts.Node | null | undefined, +): undefined | ts.Decorator[] { + if (node == undefined) { + return undefined; + } + + if (isAtLeast48) { + // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded + if (ts.canHaveDecorators(node)) { + // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded + const decorators = ts.getDecorators(node); + return decorators ? Array.from(decorators) : undefined; + } + + return undefined; + } + + return ( + // eslint-disable-next-line deprecation/deprecation -- intentional fallback for older TS versions + node.modifiers?.filter(ts.isDecorator) + ); +} diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index fda8b30032f..48c9fb1ab88 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -13,6 +13,8 @@ export * from './ts-estree'; export { clearWatchCaches as clearCaches } from './create-program/createWatchProgram'; export { createProgramFromConfigFile as createProgram } from './create-program/useProvidedPrograms'; export * from './create-program/getScriptKind'; +export { typescriptVersionIsAtLeast } from './version-check'; +export * from './getModifiers'; // re-export for backwards-compat export { visitorKeys } from '@typescript-eslint/visitor-keys'; diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 1f7b75651d5..7412704f3e1 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -1,6 +1,7 @@ import * as ts from 'typescript'; import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from './ts-estree'; import { xhtmlEntities } from './jsx/xhtml-entities'; +import { getModifiers } from './getModifiers'; const SyntaxKind = ts.SyntaxKind; @@ -80,11 +81,8 @@ export function hasModifier( modifierKind: ts.KeywordSyntaxKind, node: ts.Node, ): boolean { - return ( - !!node.modifiers && - !!node.modifiers.length && - node.modifiers.some(modifier => modifier.kind === modifierKind) - ); + const modifiers = getModifiers(node); + return modifiers?.some(modifier => modifier.kind === modifierKind) === true; } /** @@ -93,12 +91,11 @@ export function hasModifier( * @returns returns last modifier if present or null */ export function getLastModifier(node: ts.Node): ts.Modifier | null { - return ( - (!!node.modifiers && - !!node.modifiers.length && - node.modifiers[node.modifiers.length - 1]) || - null - ); + const modifiers = getModifiers(node); + if (modifiers == null) { + return null; + } + return modifiers[modifiers.length - 1] ?? null; } /** @@ -274,8 +271,8 @@ export function getDeclarationKind( export function getTSNodeAccessibility( node: ts.Node, ): 'public' | 'protected' | 'private' | null { - const modifiers = node.modifiers; - if (!modifiers) { + const modifiers = getModifiers(node); + if (modifiers == null) { return null; } for (const modifier of modifiers) { diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index f734c402eeb..765de397828 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -30,7 +30,7 @@ const log = debug('typescript-eslint:typescript-estree:parser'); * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.8.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.9.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string diff --git a/packages/typescript-estree/src/version-check.ts b/packages/typescript-estree/src/version-check.ts index d26f96bc31a..194636cb587 100644 --- a/packages/typescript-estree/src/version-check.ts +++ b/packages/typescript-estree/src/version-check.ts @@ -12,11 +12,18 @@ function semverCheck(version: string): boolean { } const versions = [ - // '3.7', '3.8', '3.9', '4.0', + '4.1', + '4.2', + '4.3', + '4.4', + '4.5', + '4.6', + '4.7', + '4.8', ] as const; type Versions = typeof versions extends ArrayLike ? U : never; diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 08755211aa0..10c42e4dd02 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -24,7 +24,7 @@ interface CreateFixturePatternConfig { } const fixturesDirPath = path.join(__dirname, '../fixtures'); -const sharedFixturesDirPath = path.join( +export const sharedFixturesDirPath = path.join( __dirname, '../../../shared-fixtures/fixtures', ); diff --git a/packages/typescript-estree/tests/ast-alignment/spec.ts b/packages/typescript-estree/tests/ast-alignment/spec.ts index 57ab33710be..3047c124f65 100644 --- a/packages/typescript-estree/tests/ast-alignment/spec.ts +++ b/packages/typescript-estree/tests/ast-alignment/spec.ts @@ -1,6 +1,7 @@ import fs from 'fs'; +import path from 'path'; import type { File } from '@babel/types'; -import { fixturesToTest } from './fixtures-to-test'; +import { fixturesToTest, sharedFixturesDirPath } from './fixtures-to-test'; import { parse } from './parse'; import { preprocessBabylonAST, @@ -70,22 +71,23 @@ fixturesToTest.forEach(fixture => { /** * No errors, assert the two ASTs match */ - it(`${filename}`, () => { + const relativeFilename = path.relative(sharedFixturesDirPath, filename); + it(`${relativeFilename}`, () => { expect(babelParserResult.ast).toBeTruthy(); expect(typeScriptESTreeResult.ast).toBeTruthy(); /** * Perform some extra formatting steps on the babel AST before comparing */ - expect( - removeLocationDataAndSourceTypeFromProgramNode( - preprocessBabylonAST(babelParserResult.ast as File), - fixture.ignoreSourceType, - ), - ).toEqual( - removeLocationDataAndSourceTypeFromProgramNode( - preprocessTypescriptAST(typeScriptESTreeResult.ast), - fixture.ignoreSourceType, - ), + const babelAst = removeLocationDataAndSourceTypeFromProgramNode( + preprocessBabylonAST(babelParserResult.ast as File), + fixture.ignoreSourceType, ); + const tsestreeAst = removeLocationDataAndSourceTypeFromProgramNode( + preprocessTypescriptAST(typeScriptESTreeResult.ast), + fixture.ignoreSourceType, + ); + + // Received = Babel, Expected = TSESTree + expect(babelAst).toEqual(tsestreeAst); }); }); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap index 0f40740978e..db90bccee68 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -189,9 +189,6 @@ Object { "line": 1, }, }, - "localSymbol": undefined, - "locals": undefined, - "modifiers": undefined, "name": Object { "escapedText": "foo", "loc": Object { @@ -211,12 +208,10 @@ Object { ], "type": "TSUnparsedPrologue", }, - "nextContainer": undefined, "range": Array [ 0, 35, ], - "symbol": undefined, "type": "TSUnparsedPrologue", "typeAnnotation": null, "typeParameters": null, @@ -280,7 +275,6 @@ Object { "type": "Decorator", }, ], - "heritageClauses": undefined, "loc": Object { "end": Object { "column": 18, @@ -291,10 +285,7 @@ Object { "line": 1, }, }, - "localSymbol": undefined, - "locals": undefined, "members": Array [], - "modifiers": undefined, "name": Object { "loc": Object { "end": Object { @@ -313,12 +304,10 @@ Object { ], "type": "Identifier", }, - "nextContainer": undefined, "range": Array [ 0, 18, ], - "symbol": undefined, "type": "TSClassDeclaration", "typeParameters": null, } @@ -420,7 +409,6 @@ Object { exports[`convert deeplyCopy should convert node with type parameters correctly 1`] = ` Object { - "heritageClauses": undefined, "loc": Object { "end": Object { "column": 15, @@ -431,10 +419,7 @@ Object { "line": 1, }, }, - "localSymbol": undefined, - "locals": undefined, "members": Array [], - "modifiers": undefined, "name": Object { "loc": Object { "end": Object { @@ -453,12 +438,10 @@ Object { ], "type": "Identifier", }, - "nextContainer": undefined, "range": Array [ 0, 15, ], - "symbol": undefined, "type": "TSClassDeclaration", "typeParameters": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index e5f3da4da62..5b2338cd4c3 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -1346,10 +1346,10 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/jsx/embedded-tags.src 1`] = ` TSError { - "column": 16, - "index": 16, + "column": 40, + "index": 40, "lineNumber": 1, - "message": "'{' expected.", + "message": "Unexpected token. Did you mean \`{'>'}\` or \`>\`?", } `; @@ -1368,7 +1368,7 @@ TSError { "column": 5, "index": 5, "lineNumber": 1, - "message": "'{' expected.", + "message": "'{' or JSX element expected.", } `; diff --git a/packages/typescript-estree/tests/lib/convert.test.ts b/packages/typescript-estree/tests/lib/convert.test.ts index ad60019b200..5bd3c5670cb 100644 --- a/packages/typescript-estree/tests/lib/convert.test.ts +++ b/packages/typescript-estree/tests/lib/convert.test.ts @@ -1,5 +1,4 @@ -// deeplyCopy is private internal -/* eslint-disable @typescript-eslint/no-explicit-any */ +import { AST_NODE_TYPES } from '@typescript-eslint/types'; import * as ts from 'typescript'; import type { TSNode } from '../../src'; import { Converter } from '../../src/convert'; @@ -39,9 +38,11 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, shouldPreserveNodeMaps: false, - }) as any; + }); - expect(instance.deeplyCopy(ast.statements[0])).toMatchSnapshot(); + expect( + instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), + ).toMatchSnapshot(); }); it('deeplyCopy should convert node with type parameters correctly', () => { @@ -50,9 +51,11 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, shouldPreserveNodeMaps: false, - }) as any; + }); - expect(instance.deeplyCopy(ast.statements[0])).toMatchSnapshot(); + expect( + instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), + ).toMatchSnapshot(); }); it('deeplyCopy should convert node with type arguments correctly', () => { @@ -61,10 +64,13 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, shouldPreserveNodeMaps: false, - }) as any; + }); expect( - instance.deeplyCopy((ast.statements[0] as any).expression), + instance['deeplyCopy']( + (ast.statements[0] as ts.ExpressionStatement) + .expression as ts.NewExpression, + ), ).toMatchSnapshot(); }); @@ -74,8 +80,8 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: false, shouldPreserveNodeMaps: false, - }) as any; - expect(instance.deeplyCopy(ast)).toMatchSnapshot(); + }); + expect(instance['deeplyCopy'](ast)).toMatchSnapshot(); }); it('deeplyCopy should fail on unknown node', () => { @@ -84,9 +90,9 @@ describe('convert', () => { const instance = new Converter(ast, { errorOnUnknownASTType: true, shouldPreserveNodeMaps: false, - }) as any; + }); - expect(() => instance.deeplyCopy(ast)).toThrow( + expect(() => instance['deeplyCopy'](ast)).toThrow( 'Unknown AST_NODE_TYPE: "TSSourceFile"', ); }); @@ -200,8 +206,13 @@ describe('convert', () => { shouldPreserveNodeMaps: true, }); - const tsNode = ts.createNode(ts.SyntaxKind.AsKeyword, 0, 10); - const convertedNode = (instance as any).createNode(tsNode, { + const tsNode: ts.KeywordToken = { + ...ts.factory.createToken(ts.SyntaxKind.AbstractKeyword), + end: 10, + pos: 0, + }; + const convertedNode = instance['createNode'](tsNode, { + type: AST_NODE_TYPES.TSAbstractKeyword, range: [0, 20], loc: { start: { @@ -215,17 +226,18 @@ describe('convert', () => { }, }); expect(convertedNode).toEqual({ + type: AST_NODE_TYPES.TSAbstractKeyword, + range: [0, 20], loc: { - end: { - column: 25, - line: 15, - }, start: { - column: 20, line: 10, + column: 20, + }, + end: { + line: 15, + column: 25, }, }, - range: [0, 20], }); }); diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot index d778d382e99..02c6e82f663 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot @@ -2,9 +2,9 @@ exports[`jsx embedded-tags.src 1`] = ` TSError { - "column": 16, - "index": 16, + "column": 40, + "index": 40, "lineNumber": 1, - "message": "'{' expected.", + "message": "Unexpected token. Did you mean \`{'>'}\` or \`>\`?", } `; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot index b0eaf47f8e9..0a637a76255 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot @@ -5,6 +5,6 @@ TSError { "column": 5, "index": 5, "lineNumber": 1, - "message": "'{' expected.", + "message": "'{' or JSX element expected.", } `; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot index aa52b8264e8..da9ce1e5a23 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot @@ -60,62 +60,6 @@ Object { "type": "VariableDeclarator", }, ], - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "deco", - "range": Array [ - 1, - 5, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "optional": false, - "range": Array [ - 1, - 7, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", - }, - ], "kind": "const", "loc": Object { "end": Object { diff --git a/packages/utils/src/ts-eslint/CLIEngine.ts b/packages/utils/src/ts-eslint/CLIEngine.ts index 9cc1c97b5c7..e8db733d9f5 100644 --- a/packages/utils/src/ts-eslint/CLIEngine.ts +++ b/packages/utils/src/ts-eslint/CLIEngine.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable deprecation/deprecation -- "uses" deprecated API to define the deprecated API */ import { CLIEngine as ESLintCLIEngine } from 'eslint'; import { Linter } from './Linter'; diff --git a/packages/website/src/components/modals/Modal.tsx b/packages/website/src/components/modals/Modal.tsx index 6e95d4ea858..535942f88b5 100644 --- a/packages/website/src/components/modals/Modal.tsx +++ b/packages/website/src/components/modals/Modal.tsx @@ -14,7 +14,11 @@ interface ModalProps { function Modal(props: ModalProps): JSX.Element { useEffect(() => { const closeOnEscapeKeyDown = (e: KeyboardEvent): void => { - if (e.key === 'Escape' || e.keyCode === 27) { + if ( + e.key === 'Escape' || + // eslint-disable-next-line deprecation/deprecation -- intentional fallback for old browsers + e.keyCode === 27 + ) { props.onClose(); } }; diff --git a/patches/tsutils+3.21.0.patch b/patches/tsutils+3.21.0.patch new file mode 100644 index 00000000000..0b2e3ee1036 --- /dev/null +++ b/patches/tsutils+3.21.0.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/tsutils/util/util.d.ts b/node_modules/tsutils/util/util.d.ts +index 97cedda..4a63900 100644 +--- a/node_modules/tsutils/util/util.d.ts ++++ b/node_modules/tsutils/util/util.d.ts +@@ -9,7 +9,7 @@ export declare function isJsDocKind(kind: ts.SyntaxKind): boolean; + export declare function isKeywordKind(kind: ts.SyntaxKind): boolean; + export declare function isThisParameter(parameter: ts.ParameterDeclaration): boolean; + export declare function getModifier(node: ts.Node, kind: ts.Modifier['kind']): ts.Modifier | undefined; +-export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...kinds: Array): boolean; ++export declare function hasModifier(modifiers: Iterable | undefined, ...kinds: Array): boolean; + export declare function isParameterProperty(node: ts.ParameterDeclaration): boolean; + export declare function hasAccessModifier(node: ts.ClassElement | ts.ParameterDeclaration): boolean; + export declare const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean; diff --git a/patches/typescript+4.8.2.patch b/patches/typescript+4.8.2.patch new file mode 100644 index 00000000000..42f28d47ece --- /dev/null +++ b/patches/typescript+4.8.2.patch @@ -0,0 +1,42 @@ +diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts +index 0fd60ae..b3610b8 100644 +--- a/node_modules/typescript/lib/typescript.d.ts ++++ b/node_modules/typescript/lib/typescript.d.ts +@@ -425,8 +425,8 @@ declare namespace ts { + JSDocFunctionType = 317, + JSDocVariadicType = 318, + JSDocNamepathType = 319, ++ /** @deprecated This was only added in 4.7 */ + JSDoc = 320, +- /** @deprecated Use SyntaxKind.JSDoc */ + JSDocComment = 320, + JSDocText = 321, + JSDocTypeLiteral = 322, +@@ -4374,7 +4374,13 @@ declare namespace ts { + function symbolName(symbol: Symbol): string; + function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; + function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. ++ */ + function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. ++ */ + function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; + /** + * Gets the JSDoc parameter tags for the node if present. +@@ -4834,7 +4840,13 @@ declare namespace ts { + } + declare namespace ts { + function setTextRange(range: T, location: TextRange | undefined): T; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. ++ */ + function canHaveModifiers(node: Node): node is HasModifiers; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. ++ */ + function canHaveDecorators(node: Node): node is HasDecorators; + } + declare namespace ts { diff --git a/yarn.lock b/yarn.lock index 1dca483e094..468781197a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4428,6 +4428,11 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== +"@yarnpkg/lockfile@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + JSONStream@^1.0.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -5329,7 +5334,7 @@ chalk@4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^2.0.0, chalk@^2.3.0: +chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -5993,6 +5998,17 @@ cross-fetch@^3.0.4, cross-fetch@^3.1.5: dependencies: node-fetch "2.6.7" +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cross-spawn@^7.0.0, cross-spawn@^7.0.1, 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" @@ -6643,14 +6659,14 @@ dotenv@~10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== -downlevel-dts@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.9.0.tgz#23c71e5bdf825a073f80a7ed077553c81aabdf01" - integrity sha512-XDYaZ7yY4yPLlNx3txbYRzUF6WiElAgMJQ/ACIaZnKISwuWw2eAHD7Ecp3u60ntej6i1yaMtjsN02hhA4FakFw== +downlevel-dts@>=0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/downlevel-dts/-/downlevel-dts-0.10.0.tgz#d2be7b4408a1f9eb3a39e15a361f8ea4f175facc" + integrity sha512-AZ7tnUy4XJArsjv6Bcuivvxx+weMvOGHF6seu7e7PVOqMDHMSlfgMl1kt+F4Y2+5TmDwKWHOdimM1DZKihQs8Q== dependencies: semver "^7.3.2" shelljs "^0.8.3" - typescript "^4.5.5" + typescript next duplexer3@^0.1.4: version "0.1.4" @@ -6930,6 +6946,15 @@ eslint-module-utils@^2.7.3: debug "^3.2.7" find-up "^2.1.0" +eslint-plugin-deprecation@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.3.2.tgz#a8125d28c56158cdfa1a685197e6be8ed86f189e" + integrity sha512-z93wbx9w7H/E3ogPw6AZMkkNJ6m51fTZRNZPNQqxQLmx+KKt7aLkMU9wN67s71i+VVHN4tLOZ3zT3QLbnlC0Mg== + dependencies: + "@typescript-eslint/experimental-utils" "^5.0.0" + tslib "^2.3.1" + tsutils "^3.21.0" + eslint-plugin-eslint-comments@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.2.0.tgz#9e1cd7b4413526abb313933071d7aba05ca12ffa" @@ -7545,6 +7570,13 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-yarn-workspace-root@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" + integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== + dependencies: + micromatch "^4.0.2" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -7638,6 +7670,15 @@ fs-extra@^10.1.0: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^7.0.1, 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-extra@^9.0.0, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" @@ -7648,15 +7689,6 @@ 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@^2.0.0, fs-minipass@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -8951,7 +8983,7 @@ is-word-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-word-character/-/is-word-character-1.0.4.tgz#ce0e73216f98599060592f62ff31354ddbeb0230" integrity sha512-5SMO8RVennx3nZrqtKwCGyyetPE9VDba5ugvKLaD4KopPG5kR4mQ7tNt/r7feL5yt5h3lpuBbIUmCOG2eSzXHA== -is-wsl@^2.2.0: +is-wsl@^2.1.1, is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -9617,6 +9649,13 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw-sync@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" + integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== + dependencies: + graceful-fs "^4.1.11" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -10502,6 +10541,11 @@ next-tick@1, next-tick@^1.1.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + no-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" @@ -10934,6 +10978,14 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" +open@^7.4.2: + version "7.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" + integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== + dependencies: + is-docker "^2.0.0" + is-wsl "^2.1.1" + open@^8.0.9, open@^8.4.0: version "8.4.0" resolved "https://registry.yarnpkg.com/open/-/open-8.4.0.tgz#345321ae18f8138f82565a910fdc6b39e8c244f8" @@ -11286,6 +11338,25 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" +patch-package@^6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148" + integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ== + dependencies: + "@yarnpkg/lockfile" "^1.1.0" + chalk "^2.4.2" + cross-spawn "^6.0.5" + find-yarn-workspace-root "^2.0.0" + fs-extra "^7.0.1" + is-ci "^2.0.0" + klaw-sync "^6.0.0" + minimist "^1.2.0" + open "^7.4.2" + rimraf "^2.6.3" + semver "^5.6.0" + slash "^2.0.0" + tmp "^0.0.33" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -11306,6 +11377,11 @@ path-is-inside@1.0.2: resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= +path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== + path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -12549,6 +12625,13 @@ rimraf@*, rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + rollup-plugin-terser@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" @@ -12713,7 +12796,7 @@ semver-diff@^3.1.1: dependencies: semver "^6.3.0" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -12844,6 +12927,13 @@ shallowequal@^1.1.0: resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== + dependencies: + shebang-regex "^1.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -12851,6 +12941,11 @@ shebang-command@^2.0.0: dependencies: shebang-regex "^3.0.0" +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== + shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" @@ -12908,6 +13003,11 @@ sitemap@^7.1.1: arg "^5.0.0" sax "^1.2.4" +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -13792,10 +13892,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.7.4, "typescript@>=3.3.1 <4.8.0", typescript@^4.5.3, typescript@^4.5.5, typescript@~4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@*, typescript@4.8.2, "typescript@>=3.3.1 <4.9.0", typescript@^4.5.3, typescript@next, typescript@~4.7.4: + version "4.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== ua-parser-js@^0.7.30: version "0.7.31" @@ -14395,7 +14495,7 @@ which-boxed-primitive@^1.0.2: is-string "^1.0.5" is-symbol "^1.0.3" -which@^1.3.1: +which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==