From 054df278d6b7064a44b5f78fec453bf9ae6ad281 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 7 Oct 2019 17:02:23 +0000 Subject: [PATCH 01/47] chore: publish v2.3.3 --- CHANGELOG.md | 13 +++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 12 ++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 11 +++++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 8 ++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 8 ++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 83 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac7f8e0ca8a1..fd6a1421944f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **eslint-plugin:** [class-name-casing] allow unicode letters ([#1043](https://github.com/typescript-eslint/typescript-eslint/issues/1043)) ([47895c0](https://github.com/typescript-eslint/typescript-eslint/commit/47895c0)) +* **eslint-plugin:** [efrt] support constructor arguments ([#1021](https://github.com/typescript-eslint/typescript-eslint/issues/1021)) ([60943e6](https://github.com/typescript-eslint/typescript-eslint/commit/60943e6)) +* **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/lerna.json b/lerna.json index 16ca1c0d0e88..093a7b7253e4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.3.2", + "version": "2.3.3", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index bebccf5ca5ef..50d3ff8d511a 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **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 0d1dd95c219c..1944e16e02e9 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": "2.3.2", + "version": "2.3.3", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.3.2" + "@typescript-eslint/parser": "2.3.3" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index d9be8637d98c..ecbd6059dfb2 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **eslint-plugin:** [class-name-casing] allow unicode letters ([#1043](https://github.com/typescript-eslint/typescript-eslint/issues/1043)) ([47895c0](https://github.com/typescript-eslint/typescript-eslint/commit/47895c0)) +* **eslint-plugin:** [efrt] support constructor arguments ([#1021](https://github.com/typescript-eslint/typescript-eslint/issues/1021)) ([60943e6](https://github.com/typescript-eslint/typescript-eslint/commit/60943e6)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 3251f3b93cd9..2458e18eb1be 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.3.2", + "version": "2.3.3", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 598085cefc86..43271d72e814 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + + +### Bug Fixes + +* **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) **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 753fd606a288..b17f79a2ca30 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.3.2", + "version": "2.3.3", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.3.2", + "@typescript-eslint/typescript-estree": "2.3.3", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 1098745e1301..9ccea9c2f802 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/parser/package.json b/packages/parser/package.json index aa14e9e3f770..a5a641ef5170 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.3.2", + "version": "2.3.3", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.3.2", - "@typescript-eslint/typescript-estree": "2.3.2", + "@typescript-eslint/experimental-utils": "2.3.3", + "@typescript-eslint/typescript-estree": "2.3.3", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.3.2", + "@typescript-eslint/shared-fixtures": "2.3.3", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 938f88a906bc..959a366b0e61 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index fc7944ea50d3..6b55d5122d85 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.3.2", + "version": "2.3.3", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index ae3e39147edb..0bf4baa176b7 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. +## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + ## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 906c23639a36..b5918d8d939e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.3.2", + "version": "2.3.3", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -56,7 +56,7 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.3.2", + "@typescript-eslint/shared-fixtures": "2.3.3", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From a3f84e196dfe57c380f90f6222a3cdcf25a62bfc Mon Sep 17 00:00:00 2001 From: Niles Date: Wed, 9 Oct 2019 17:22:42 -0500 Subject: [PATCH 02/47] chore(eslint-plugin): Add missing rule function types (#1047) --- .../src/rules/indent-new-do-not-use/index.ts | 3 +-- packages/eslint-plugin/src/rules/indent.ts | 2 +- packages/experimental-utils/src/ts-eslint/Rule.ts | 12 ++++++++++++ packages/parser/src/visitor-keys.ts | 1 - .../src/ts-estree/ast-node-types.ts | 2 -- .../typescript-estree/src/ts-estree/ts-estree.ts | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts index 56909f15fa7e..7bbdd6522e00 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts @@ -92,7 +92,6 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.WithStatement, AST_NODE_TYPES.YieldExpression, AST_NODE_TYPES.JSXIdentifier, - AST_NODE_TYPES.JSXNamespacedName, AST_NODE_TYPES.JSXMemberExpression, AST_NODE_TYPES.JSXEmptyExpression, AST_NODE_TYPES.JSXExpressionContainer, @@ -164,7 +163,7 @@ const KNOWN_NODES = new Set([ 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, - AST_NODE_TYPES.TSQuestionToken, + 'TSQuestionToken', AST_NODE_TYPES.TSRestType, AST_NODE_TYPES.TSThisType, AST_NODE_TYPES.TSTupleType, diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 2c135fea6a71..3f0e88926a27 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -69,7 +69,7 @@ const KNOWN_NODES = new Set([ 'TSPlusToken', AST_NODE_TYPES.TSPropertySignature, AST_NODE_TYPES.TSQualifiedName, - AST_NODE_TYPES.TSQuestionToken, + 'TSQuestionToken', AST_NODE_TYPES.TSRestType, AST_NODE_TYPES.TSThisType, AST_NODE_TYPES.TSTupleType, diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 1724dec828b8..dad91e6a8e09 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -226,6 +226,8 @@ interface RuleListener { AssignmentPattern?: RuleFunction; AssignmentExpression?: RuleFunction; AwaitExpression?: RuleFunction; + BigIntLiteral?: RuleFunction; + BinaryExpression?: RuleFunction; BlockStatement?: RuleFunction; BreakStatement?: RuleFunction; CallExpression?: RuleFunction; @@ -249,6 +251,8 @@ interface RuleListener { ForInStatement?: RuleFunction; ForOfStatement?: RuleFunction; ForStatement?: RuleFunction; + FunctionDeclaration?: RuleFunction; + FunctionExpression?: RuleFunction; Identifier?: RuleFunction; IfStatement?: RuleFunction; Import?: RuleFunction; @@ -295,6 +299,7 @@ interface RuleListener { ThrowStatement?: RuleFunction; Token?: RuleFunction; TryStatement?: RuleFunction; + TSAbstractClassProperty?: RuleFunction; TSAbstractKeyword?: RuleFunction; TSAbstractMethodDefinition?: RuleFunction< TSESTree.TSAbstractMethodDefinition @@ -308,17 +313,23 @@ interface RuleListener { TSCallSignatureDeclaration?: RuleFunction< TSESTree.TSCallSignatureDeclaration >; + TSClassImplements?: RuleFunction; TSConditionalType?: RuleFunction; + TSConstructorType?: RuleFunction; TSConstructSignatureDeclaration?: RuleFunction< TSESTree.TSConstructSignatureDeclaration >; TSDeclareKeyword?: RuleFunction; TSDeclareFunction?: RuleFunction; + TSEmptyBodyFunctionExpression?: RuleFunction< + TSESTree.TSEmptyBodyFunctionExpression + >; TSEnumDeclaration?: RuleFunction; TSEnumMember?: RuleFunction; TSExportAssignment?: RuleFunction; TSExportKeyword?: RuleFunction; TSExternalModuleReference?: RuleFunction; + TSFunctionType?: RuleFunction; TSImportEqualsDeclaration?: RuleFunction; TSImportType?: RuleFunction; TSIndexedAccessType?: RuleFunction; @@ -326,6 +337,7 @@ interface RuleListener { TSInferType?: RuleFunction; TSInterfaceBody?: RuleFunction; TSInterfaceDeclaration?: RuleFunction; + TSInterfaceHeritage?: RuleFunction; TSIntersectionType?: RuleFunction; TSLiteralType?: RuleFunction; TSMappedType?: RuleFunction; diff --git a/packages/parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts index 7cc4aa9d8935..756527ff83fa 100644 --- a/packages/parser/src/visitor-keys.ts +++ b/packages/parser/src/visitor-keys.ts @@ -99,7 +99,6 @@ export const visitorKeys = eslintVisitorKeys.unionWith({ TSProtectedKeyword: [], TSPublicKeyword: [], TSQualifiedName: ['left', 'right'], - TSQuestionToken: [], TSReadonlyKeyword: [], TSRestType: ['typeAnnotation'], TSStaticKeyword: [], diff --git a/packages/typescript-estree/src/ts-estree/ast-node-types.ts b/packages/typescript-estree/src/ts-estree/ast-node-types.ts index 4ae1b5dcf866..b7ff28646a68 100644 --- a/packages/typescript-estree/src/ts-estree/ast-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/ast-node-types.ts @@ -47,7 +47,6 @@ export enum AST_NODE_TYPES { JSXFragment = 'JSXFragment', JSXIdentifier = 'JSXIdentifier', JSXMemberExpression = 'JSXMemberExpression', - JSXNamespacedName = 'JSXNamespacedName', // https://github.com/Microsoft/TypeScript/issues/7411 JSXOpeningElement = 'JSXOpeningElement', JSXOpeningFragment = 'JSXOpeningFragment', JSXSpreadAttribute = 'JSXSpreadAttribute', @@ -135,7 +134,6 @@ export enum AST_NODE_TYPES { TSProtectedKeyword = 'TSProtectedKeyword', TSPublicKeyword = 'TSPublicKeyword', TSQualifiedName = 'TSQualifiedName', - TSQuestionToken = 'TSQuestionToken', TSReadonlyKeyword = 'TSReadonlyKeyword', TSRestType = 'TSRestType', TSStaticKeyword = 'TSStaticKeyword', diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index d4361bf3d5c0..799c3e917c0b 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -465,7 +465,7 @@ interface ClassDeclarationBase extends BaseNode { interface ClassPropertyBase extends BaseNode { key: PropertyName; - value: Expression; + value: Expression | null; computed: boolean; static: boolean; readonly?: boolean; From 514bed95fd68d75eecdf3719e52bfac0f3cd8fc2 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 10 Oct 2019 20:17:41 +0300 Subject: [PATCH 03/47] =?UTF-8?q?fix(eslint-plugin):=20[promise-function-a?= =?UTF-8?q?sync]=20Should=20not=20report=E2=80=A6=20(#1023)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Brad Zacher --- .../docs/rules/promise-function-async.md | 12 +++--- .../src/rules/promise-function-async.ts | 6 ++- packages/eslint-plugin/src/util/types.ts | 11 ++++-- .../rules/promise-function-async.test.ts | 39 +++++++++++++++++++ 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md index 5ccddf45ed47..79000974cead 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.md +++ b/packages/eslint-plugin/docs/rules/promise-function-async.md @@ -6,7 +6,7 @@ Ensures that each function is only capable of: - returning a rejected promise, or - throwing an Error object. -In contrast, non-`async` `Promise`-returning functions are technically capable of either. +In contrast, non-`async` `Promise` - returning functions are technically capable of either. Code that handles the results of those functions will often need to handle both cases, which can get complex. This rule's practice removes a requirement for creating code to handle both cases. @@ -17,18 +17,18 @@ Examples of **incorrect** code for this rule ```ts const arrowFunctionReturnsPromise = () => Promise.resolve('value'); -function functionDeturnsPromise() { - return Math.random() > 0.5 ? Promise.resolve('value') : false; +function functionReturnsPromise() { + return Promise.resolve('value'); } ``` Examples of **correct** code for this rule ```ts -const arrowFunctionReturnsPromise = async () => 'value'; +const arrowFunctionReturnsPromise = async () => Promise.resolve('value'); -async function functionDeturnsPromise() { - return Math.random() > 0.5 ? 'value' : false; +async function functionReturnsPromise() { + return Promise.resolve('value'); } ``` diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 1575cf02dfce..d907f3d45a55 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -98,7 +98,11 @@ export default util.createRule({ const returnType = checker.getReturnTypeOfSignature(signatures[0]); if ( - !util.containsTypeByName(returnType, allowAny!, allAllowedPromiseNames) + !util.containsAllTypesByName( + returnType, + allowAny!, + allAllowedPromiseNames, + ) ) { return; } diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index 6f769d7f950a..72213da6ebbf 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -8,9 +8,9 @@ import ts from 'typescript'; /** * @param type Type being checked by name. * @param allowedNames Symbol names checking on the type. - * @returns Whether the type is, extends, or contains any of the allowed names. + * @returns Whether the type is, extends, or contains all of the allowed names. */ -export function containsTypeByName( +export function containsAllTypesByName( type: ts.Type, allowAny: boolean, allowedNames: Set, @@ -31,13 +31,16 @@ export function containsTypeByName( } if (isUnionOrIntersectionType(type)) { - return type.types.some(t => containsTypeByName(t, allowAny, allowedNames)); + return type.types.every(t => + containsAllTypesByName(t, allowAny, allowedNames), + ); } const bases = type.getBaseTypes(); return ( typeof bases !== 'undefined' && - bases.some(t => containsTypeByName(t, allowAny, allowedNames)) + bases.length > 0 && + bases.every(t => containsAllTypesByName(t, allowAny, allowedNames)) ); } diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 46100db7982a..66a65a21ffd3 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -106,6 +106,26 @@ function returnsUnknown(): unknown { }, ], }, + { + code: ` +interface ReadableStream {} +interface Options { + stream: ReadableStream; +} + +type Return = ReadableStream | Promise; +const foo = (options: Options): Return => { + return options.stream ? asStream(options) : asPromise(options); +} + `, + }, + { + code: ` +function foo(): Promise | boolean { + return Math.random() > 0.5 ? Promise.resolve('value') : false; +} + `, + }, ], invalid: [ { @@ -379,5 +399,24 @@ const returnAllowedType = () => new PromiseType(); }, ], }, + { + code: ` +interface SPromise extends Promise {} +function foo(): Promise | SPromise { + return Math.random() > 0.5 ? Promise.resolve('value') : Promise.resolve(false); +} + `, + options: [ + { + allowedPromiseNames: ['SPromise'], + }, + ], + errors: [ + { + line: 3, + messageId, + }, + ], + }, ], }); From 526d336adec7ae173fb259b18b7263859f61539b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 10 Oct 2019 19:18:34 +0200 Subject: [PATCH 04/47] chore: add test for function types & no-restricted-globals rule (#1055) --- .../tests/eslint-rules/no-restricted-globals.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts index f20381c20719..40f3398fb7df 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts @@ -24,6 +24,12 @@ export default class Test { `, options: ['status'], }, + { + code: ` +type Handler = (event: string) => any + `, + options: ['event'], + }, ], invalid: [], }); From 5f92b9f0b21eb45c11029ca9fe18418f73d45a12 Mon Sep 17 00:00:00 2001 From: James George Date: Fri, 11 Oct 2019 21:31:33 +0530 Subject: [PATCH 05/47] docs: add TOC to root README (#838) --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index b57368515235..7dbe5f150a5b 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,24 @@
+## Table of Contents + +- [Getting Started](#getting-started) +- [What are ESLint and TypeScript, and how do they compare?](#what-are-eslint-and-typescript-and-how-do-they-compare) +- [Why does this project exist?](#why-does-this-project-exist) +- [What about TSLint?](#what-about-tslint) +- [How does typescript-eslint work and why do you have multiple packages?](#how-does-typescript-eslint-work-and-why-do-you-have-multiple-packages) +- [Can I use all of the existing ESLint plugins and rules without any changes?](#can-i-use-all-of-the-existing-eslint-plugins-and-rules-without-any-changes) +- [Can we write rules which leverage type information?](#can-we-write-rules-which-leverage-type-information) +- [What about Babel and babel-eslint?](#what-about-babel-and-babel-eslint) +- [How can I help?](#how-can-i-help) +- [How do I configure my project to use typescript-eslint?](#how-do-i-configure-my-project-to-use-typescript-eslint) +- [Package Versions](#package-versions) +- [Supported TypeScript Version](#supported-typescript-version) +- [License](#license) +- [Contributors](#contributors) +- [Contributing Guide](#contributing-guide) + ## Getting Started The following sections will give you an overview of what this project is, why it exists and how it works at a high level. From fec73b0882dc57001c6b75aa2e837a0557889e70 Mon Sep 17 00:00:00 2001 From: Nick Heiner Date: Fri, 11 Oct 2019 18:40:11 -0700 Subject: [PATCH 06/47] docs: clarify which versions of ESLint are supported (#1073) Co-authored-by: Brad Zacher --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 7dbe5f150a5b..801c15aa1a18 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ - [How do I configure my project to use typescript-eslint?](#how-do-i-configure-my-project-to-use-typescript-eslint) - [Package Versions](#package-versions) - [Supported TypeScript Version](#supported-typescript-version) +- [Supported ESLint version](#supported-eslint-version) - [License](#license) - [Contributors](#contributors) - [Contributing Guide](#contributing-guide) @@ -246,6 +247,10 @@ If you use a non-supported version of TypeScript, the parser will log a warning
+## Supported ESLint version + +See the value of `eslint` declared in `@typescript-eslint/eslint-plugin`'s [package.json](./packages/eslint-plugin/package.json). + ## License TypeScript ESLint inherits from the the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. From 854620e9232d4d54e6fc89876b4c9ed38f5570f9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 12 Oct 2019 12:43:38 -0700 Subject: [PATCH 07/47] fix: support long running "watch" lint sessions (#973) --- .eslintrc.js | 4 +- .gitignore | 9 +- .vscode/settings.json | 3 +- package.json | 3 +- packages/eslint-plugin-tslint/package.json | 8 +- .../eslint-plugin-tslint/tsconfig.build.json | 11 +- packages/eslint-plugin-tslint/tsconfig.json | 4 + packages/eslint-plugin/package.json | 8 +- packages/eslint-plugin/tests/RuleTester.ts | 7 + packages/eslint-plugin/tsconfig.build.json | 11 +- packages/eslint-plugin/tsconfig.json | 4 + packages/experimental-utils/package.json | 10 +- .../src/ts-eslint/ParserOptions.ts | 19 +-- .../src/ts-eslint/RuleTester.ts | 26 +++- .../experimental-utils/tsconfig.build.json | 4 +- packages/experimental-utils/tsconfig.json | 6 +- packages/parser/package.json | 8 +- packages/parser/src/parser.ts | 1 + packages/parser/tests/lib/jsx.ts | 2 +- packages/parser/tsconfig.build.json | 12 +- packages/parser/tsconfig.json | 4 + packages/typescript-estree/package.json | 13 +- .../typescript-estree/src/parser-options.ts | 44 +++--- packages/typescript-estree/src/parser.ts | 42 ++++-- .../typescript-estree/src/tsconfig-parser.ts | 141 ++++++++++++++++-- .../tests/ast-alignment/fixtures-to-test.ts | 2 +- packages/typescript-estree/tests/lib/jsx.ts | 2 +- packages/typescript-estree/tests/lib/parse.ts | 5 +- .../tests/lib/persistentParse.ts | 136 +++++++++++++++++ .../typescript-estree/tsconfig.build.json | 4 +- packages/typescript-estree/tsconfig.json | 5 +- tsconfig.eslint.json | 4 + yarn.lock | 63 +++++++- 33 files changed, 506 insertions(+), 119 deletions(-) create mode 100644 packages/typescript-estree/tests/lib/persistentParse.ts create mode 100644 tsconfig.eslint.json diff --git a/.eslintrc.js b/.eslintrc.js index 6ae76ac3b6cb..337e239983b8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,6 +35,7 @@ module.exports = { // 'comma-dangle': ['error', 'always-multiline'], + 'constructor-super': 'off', curly: ['error', 'all'], 'no-mixed-operators': 'error', 'no-console': 'error', @@ -113,7 +114,8 @@ module.exports = { ecmaFeatures: { jsx: false, }, - project: './tsconfig.base.json', + project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'], + tsconfigRootDir: __dirname, }, overrides: [ { diff --git a/.gitignore b/.gitignore index 3a06baccf6f5..582f78d2d60e 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,12 @@ jspm_packages/ # next.js build output .next -.DS_Store -.idea -dist # Editor-specific metadata folders .vs + +.DS_Store +.idea +dist +*.tsbuildinfo +.watchmanconfig diff --git a/.vscode/settings.json b/.vscode/settings.json index adcf2422e8f3..9f2782e2bb55 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,5 +22,6 @@ "javascript.preferences.importModuleSpecifier": "auto", "typescript.preferences.importModuleSpecifier": "auto", "javascript.preferences.quoteStyle": "single", - "typescript.preferences.quoteStyle": "single" +"typescript.preferences.quoteStyle": "single", +"editor.defaultFormatter": "esbenp.prettier-vscode" } diff --git a/package.json b/package.json index 2dce8eb93355..e4d690b0bb42 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "pre-push": "yarn format-check", "postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install && opencollective-postinstall", "check-clean-workspace-after-install": "git diff --quiet --exit-code", - "test": "lerna run test --parallel", + "test": "lerna run test --concurrency 1", "typecheck": "lerna run typecheck" }, "config": { @@ -70,7 +70,6 @@ "lint-staged": "^9.2.5", "opencollective-postinstall": "^2.0.2", "prettier": "^1.18.2", - "rimraf": "^3.0.0", "ts-jest": "^24.0.0", "ts-node": "^8.3.0", "tslint": "^5.19.0", diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 1944e16e02e9..78d58d38427b 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -23,12 +23,12 @@ }, "license": "MIT", "scripts": { - "build": "tsc -p tsconfig.build.json", - "clean": "rimraf dist/", + "build": "tsc -b tsconfig.build.json", + "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "prebuild": "npm run clean", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@typescript-eslint/experimental-utils": "2.3.3", diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json index b0fced27d72d..d6987c27afe7 100644 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ b/packages/eslint-plugin-tslint/tsconfig.build.json @@ -1,7 +1,14 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "./dist" + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true }, - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../experimental-utils/tsconfig.build.json" }, + { "path": "../parser/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } + ] } diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index 7db2d0520ffa..5362fa1c79c4 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -1,5 +1,9 @@ { "extends": "./tsconfig.build.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true + }, "include": ["src", "tests"], "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"] } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 2458e18eb1be..9eeb7f31616e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -29,15 +29,15 @@ "license": "MIT", "main": "dist/index.js", "scripts": { - "build": "tsc -p tsconfig.build.json", + "build": "tsc -b tsconfig.build.json", "check:docs": "../../node_modules/.bin/ts-node --files ./tools/validate-docs/index.ts", "check:configs": "../../node_modules/.bin/ts-node --files ./tools/validate-configs/index.ts", - "clean": "rimraf dist/", + "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:configs": "../../node_modules/.bin/ts-node --files tools/generate-configs.ts", - "prebuild": "npm run clean", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@typescript-eslint/experimental-utils": "2.3.3", diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 978adc109669..f96d1739f182 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -1,4 +1,5 @@ import { TSESLint, ESLintUtils } from '@typescript-eslint/experimental-utils'; +import { clearCaches } from '@typescript-eslint/parser'; import * as path from 'path'; const parser = '@typescript-eslint/parser'; @@ -74,4 +75,10 @@ function getFixturesRootDir(): string { const { batchedSingleLineTests } = ESLintUtils; +// make sure that the parser doesn't hold onto file handles between tests +// on linux (i.e. our CI env), there can be very a limited number of watch handles available +afterAll(() => { + clearCaches(); +}); + export { RuleTester, getFixturesRootDir, batchedSingleLineTests }; diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index 1ab98da19abf..86f3842dae31 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -5,12 +5,13 @@ "declaration": false, "declarationMap": false, "outDir": "./dist", + "rootDir": "./src", "resolveJsonModule": true }, - "include": [ - "src", - "typings", - // include the parser's ambient typings because the parser exports them in its type defs - "../parser/typings" + "include": ["src", "typings"], + "references": [ + { "path": "../experimental-utils/tsconfig.build.json" }, + { "path": "../parser/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } ] } diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index fb7e21da237d..4ef2253e8b4e 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -1,4 +1,8 @@ { "extends": "./tsconfig.build.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true + }, "include": ["src", "typings", "tests", "tools"] } diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index b17f79a2ca30..e312f6b11140 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -28,12 +28,12 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "test": "jest --coverage", - "prebuild": "npm run clean", - "build": "tsc -p tsconfig.build.json", - "clean": "rimraf dist/", + "build": "tsc -b tsconfig.build.json", + "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "typecheck": "tsc --noEmit" + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", + "test": "jest --coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@types/json-schema": "^7.0.3", diff --git a/packages/experimental-utils/src/ts-eslint/ParserOptions.ts b/packages/experimental-utils/src/ts-eslint/ParserOptions.ts index eea1a9577684..87f919129053 100644 --- a/packages/experimental-utils/src/ts-eslint/ParserOptions.ts +++ b/packages/experimental-utils/src/ts-eslint/ParserOptions.ts @@ -1,21 +1,22 @@ export interface ParserOptions { - loc?: boolean; comment?: boolean; - range?: boolean; - tokens?: boolean; - sourceType?: 'script' | 'module'; - ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019; ecmaFeatures?: { globalReturn?: boolean; jsx?: boolean; }; + ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 2015 | 2016 | 2017 | 2018 | 2019; + errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + errorOnUnknownASTType?: boolean; + extraFileExtensions?: string[]; // ts-estree specific filePath?: string; + loc?: boolean; + noWatch?: boolean; project?: string | string[]; - useJSXTextNode?: boolean; - errorOnUnknownASTType?: boolean; - errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + range?: boolean; + sourceType?: 'script' | 'module'; + tokens?: boolean; tsconfigRootDir?: string; - extraFileExtensions?: string[]; + useJSXTextNode?: boolean; warnOnUnsupportedTypeScriptVersion?: boolean; } diff --git a/packages/experimental-utils/src/ts-eslint/RuleTester.ts b/packages/experimental-utils/src/ts-eslint/RuleTester.ts index 863d0c076f23..84da228fb81e 100644 --- a/packages/experimental-utils/src/ts-eslint/RuleTester.ts +++ b/packages/experimental-utils/src/ts-eslint/RuleTester.ts @@ -50,16 +50,32 @@ interface RuleTesterConfig { parser: string; parserOptions?: ParserOptions; } -declare interface RuleTester { + +// the cast on the extends is so that we don't want to have the built type defs to attempt to import eslint +class RuleTester extends (ESLintRuleTester as { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + new (...args: unknown[]): any; +}) { + constructor(config?: RuleTesterConfig) { + super(config); + + // nobody will ever need watching in tests + // so we can give everyone a perf win by disabling watching + if (config && config.parserOptions && config.parserOptions.project) { + config.parserOptions.noWatch = + typeof config.parserOptions.noWatch === 'boolean' || true; + } + } + run>( name: string, rule: RuleModule, tests: RunTests, - ): void; + ): void { + // this method is only defined here because we lazily type the eslint import with `any` + super.run(name, rule, tests); + } } -const RuleTester = ESLintRuleTester as { - new (config?: RuleTesterConfig): RuleTester; -}; export { InvalidTestCase, diff --git a/packages/experimental-utils/tsconfig.build.json b/packages/experimental-utils/tsconfig.build.json index c052e5211304..e1b499764611 100644 --- a/packages/experimental-utils/tsconfig.build.json +++ b/packages/experimental-utils/tsconfig.build.json @@ -1,9 +1,11 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "composite": true, "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "typings"] + "include": ["src", "typings"], + "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] } diff --git a/packages/experimental-utils/tsconfig.json b/packages/experimental-utils/tsconfig.json index f469d044ef4b..4ef2253e8b4e 100644 --- a/packages/experimental-utils/tsconfig.json +++ b/packages/experimental-utils/tsconfig.json @@ -1,8 +1,8 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.build.json", "compilerOptions": { - "outDir": "./dist", - "resolveJsonModule": true + "rootDir": ".", + "noEmit": true }, "include": ["src", "typings", "tests", "tools"] } diff --git a/packages/parser/package.json b/packages/parser/package.json index a5a641ef5170..9979d210ed8a 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -31,12 +31,12 @@ "eslint" ], "scripts": { - "build": "tsc -p tsconfig.build.json", - "clean": "rimraf dist/", + "build": "tsc -b tsconfig.build.json", + "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "prebuild": "npm run clean", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "typecheck": "tsc -p tsconfig.json --noEmit" }, "peerDependencies": { "eslint": "^5.0.0 || ^6.0.0" diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 830a282da1e4..bcb6dde759a4 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -115,3 +115,4 @@ export function parseForESLint( } export { ParserServices, ParserOptions }; +export { clearCaches } from '@typescript-eslint/typescript-estree'; diff --git a/packages/parser/tests/lib/jsx.ts b/packages/parser/tests/lib/jsx.ts index 530b26c444b5..39548ea1b3b8 100644 --- a/packages/parser/tests/lib/jsx.ts +++ b/packages/parser/tests/lib/jsx.ts @@ -1,6 +1,6 @@ +import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; import fs from 'fs'; import glob from 'glob'; -import filesWithKnownIssues from '../../../shared-fixtures/jsx-known-issues'; import { createScopeSnapshotTestBlock, formatSnapshotName, diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index a94802fb081a..b1d34cc5c3d9 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -1,8 +1,14 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "declaration": true, - "outDir": "./dist" + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true }, - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../experimental-utils/tsconfig.build.json" }, + { "path": "../typescript-estree/tsconfig.build.json" } + ] } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index 6f763b588b53..adda86ea16c6 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -1,5 +1,9 @@ { "extends": "./tsconfig.build.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true + }, "include": ["src", "tests", "tools"], "exclude": ["tests/fixtures"] } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index b5918d8d939e..0e2dcc979145 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -31,16 +31,15 @@ "syntax" ], "scripts": { - "ast-alignment-tests": "jest spec.ts", - "build": "tsc -p tsconfig.build.json", - "clean": "rimraf dist/", + "build": "tsc -b tsconfig.build.json", + "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "prebuild": "npm run clean", + "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", - "typecheck": "tsc --noEmit", - "unit-tests": "jest \"./tests/lib/.*\"" + "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { + "chokidar": "^3.0.2", "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", @@ -56,10 +55,12 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", + "@types/tmp": "^0.1.0", "@typescript-eslint/shared-fixtures": "2.3.3", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", + "tmp": "^0.1.0", "typescript": "*" } } diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 77a649f6f309..1a47f30f16d6 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -2,41 +2,43 @@ import { Program } from 'typescript'; import { TSESTree, TSNode } from './ts-estree'; export interface Extra { - errorOnUnknownASTType: boolean; - errorOnTypeScriptSyntacticAndSemanticIssues: boolean; - useJSXTextNode: boolean; - tokens: null | TSESTree.Token[]; - comment: boolean; code: string; - range: boolean; - loc: boolean; + comment: boolean; comments: TSESTree.Comment[]; - strict: boolean; + createDefaultProgram: boolean; + errorOnTypeScriptSyntacticAndSemanticIssues: boolean; + errorOnUnknownASTType: boolean; + extraFileExtensions: string[]; jsx: boolean; + loc: boolean; log: Function; + noWatch?: boolean; + preserveNodeMaps?: boolean; projects: string[]; + range: boolean; + strict: boolean; + tokens: null | TSESTree.Token[]; tsconfigRootDir: string; - extraFileExtensions: string[]; - preserveNodeMaps?: boolean; - createDefaultProgram: boolean; + useJSXTextNode: boolean; } export interface TSESTreeOptions { - range?: boolean; - loc?: boolean; - tokens?: boolean; comment?: boolean; - jsx?: boolean; - errorOnUnknownASTType?: boolean; + createDefaultProgram?: boolean; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; - useJSXTextNode?: boolean; + errorOnUnknownASTType?: boolean; + extraFileExtensions?: string[]; + filePath?: string; + jsx?: boolean; + loc?: boolean; loggerFn?: Function | false; + noWatch?: boolean; + preserveNodeMaps?: boolean; project?: string | string[]; - filePath?: string; + range?: boolean; + tokens?: boolean; tsconfigRootDir?: string; - extraFileExtensions?: string[]; - preserveNodeMaps?: boolean; - createDefaultProgram?: boolean; + useJSXTextNode?: boolean; } // This lets us use generics to type the return value, and removes the need to diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 882a8bbff7e5..75d3983cf55c 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -46,23 +46,24 @@ function getFileName({ jsx }: { jsx?: boolean }): string { */ function resetExtra(): void { extra = { - tokens: null, - range: false, - loc: false, + code: '', comment: false, comments: [], - strict: false, + createDefaultProgram: false, + errorOnTypeScriptSyntacticAndSemanticIssues: false, + errorOnUnknownASTType: false, + extraFileExtensions: [], jsx: false, - useJSXTextNode: false, + loc: false, log: console.log, // eslint-disable-line no-console + noWatch: false, + preserveNodeMaps: undefined, projects: [], - errorOnUnknownASTType: false, - errorOnTypeScriptSyntacticAndSemanticIssues: false, - code: '', + range: false, + strict: false, + tokens: null, tsconfigRootDir: process.cwd(), - extraFileExtensions: [], - preserveNodeMaps: undefined, - createDefaultProgram: false, + useJSXTextNode: false, }; } @@ -225,6 +226,8 @@ function getProgramAndAST( } function applyParserOptionsToExtra(options: TSESTreeOptions): void { + extra.noWatch = typeof options.noWatch === 'boolean' && options.noWatch; + /** * Track range information in the AST */ @@ -287,19 +290,25 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.projects = options.project; } + if (typeof options.tsconfigRootDir === 'string') { + extra.tsconfigRootDir = options.tsconfigRootDir; + } + // Transform glob patterns into paths if (extra.projects) { extra.projects = extra.projects.reduce( (projects, project) => - projects.concat(isGlob(project) ? globSync(project) : project), + projects.concat( + isGlob(project) + ? globSync(project, { + cwd: extra.tsconfigRootDir || process.cwd(), + }) + : project, + ), [], ); } - if (typeof options.tsconfigRootDir === 'string') { - extra.tsconfigRootDir = options.tsconfigRootDir; - } - if ( Array.isArray(options.extraFileExtensions) && options.extraFileExtensions.every(ext => typeof ext === 'string') @@ -500,3 +509,4 @@ export function parseAndGenerateServices< export { TSESTreeOptions, ParserServices }; export * from './ts-estree'; +export { clearCaches } from './tsconfig-parser'; diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index e6ef356b6f30..4dab9030a55b 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -1,3 +1,4 @@ +import chokidar from 'chokidar'; import path from 'path'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from './parser-options'; @@ -30,18 +31,37 @@ const knownWatchProgramMap = new Map< * Maps file paths to their set of corresponding watch callbacks * There may be more than one per file if a file is shared between projects */ -const watchCallbackTrackingMap = new Map(); +const watchCallbackTrackingMap = new Map>(); + +/** + * Tracks the ts.sys.watchFile watchers that we've opened for config files. + * We store these so we can clean up our handles if required. + */ +const configSystemFileWatcherTrackingSet = new Set(); +/** + * Tracks the ts.sys.watchDirectory watchers that we've opened for project folders. + * We store these so we can clean up our handles if required. + */ +const directorySystemFileWatcherTrackingSet = new Set(); const parsedFilesSeen = new Set(); /** - * Clear tsconfig caches. - * Primarily used for testing. + * Clear all of the parser caches. + * This should only be used in testing to ensure the parser is clean between tests. */ export function clearCaches(): void { knownWatchProgramMap.clear(); watchCallbackTrackingMap.clear(); parsedFilesSeen.clear(); + + // stop tracking config files + configSystemFileWatcherTrackingSet.forEach(cb => cb.close()); + configSystemFileWatcherTrackingSet.clear(); + + // stop tracking folders + directorySystemFileWatcherTrackingSet.forEach(cb => cb.close()); + directorySystemFileWatcherTrackingSet.clear(); } /** @@ -62,14 +82,42 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { ); } -const noopFileWatcher = { close: (): void => {} }; - function getTsconfigPath(tsconfigPath: string, extra: Extra): string { return path.isAbsolute(tsconfigPath) ? tsconfigPath : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); } +interface Watcher { + close(): void; + on(evt: 'add', listener: (file: string) => void): void; + on(evt: 'change', listener: (file: string) => void): void; +} +/** + * Watches a file or directory for changes + */ +function watch( + path: string, + options: chokidar.WatchOptions, + extra: Extra, +): Watcher { + // an escape hatch to disable the file watchers as they can take a bit to initialise in some cases + // this also supports an env variable so it's easy to switch on/off from the CLI + if (process.env.PARSER_NO_WATCH === 'true' || extra.noWatch === true) { + return { + close: (): void => {}, + on: (): void => {}, + }; + } + + return chokidar.watch(path, { + ignoreInitial: true, + persistent: false, + useFsEvents: false, + ...options, + }); +} + /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted @@ -91,9 +139,13 @@ export function calculateProjectParserOptions( // Update file version if necessary // TODO: only update when necessary, currently marks as changed on every lint - const watchCallback = watchCallbackTrackingMap.get(filePath); - if (parsedFilesSeen.has(filePath) && typeof watchCallback !== 'undefined') { - watchCallback(filePath, ts.FileWatcherEventKind.Changed); + const watchCallbacks = watchCallbackTrackingMap.get(filePath); + if ( + parsedFilesSeen.has(filePath) && + watchCallbacks && + watchCallbacks.size > 0 + ) { + watchCallbacks.forEach(cb => cb(filePath, ts.FileWatcherEventKind.Changed)); } for (const rawTsconfigPath of extra.projects) { @@ -146,19 +198,80 @@ export function calculateProjectParserOptions( } }; - // register callbacks to trigger program updates without using fileWatchers - watchCompilerHost.watchFile = (fileName, callback): ts.FileWatcher => { + // in watch mode, eslint will give us the latest file contents + // store the watch callback so we can trigger an update with eslint's content + watchCompilerHost.watchFile = ( + fileName, + callback, + interval, + ): ts.FileWatcher => { + // specifically (and separately) watch the tsconfig file + // this allows us to react to changes in the tsconfig's include/exclude options + let watcher: Watcher | null = null; + if (fileName.includes(tsconfigPath)) { + watcher = watch( + fileName, + { + interval, + }, + extra, + ); + watcher.on('change', path => { + callback(path, ts.FileWatcherEventKind.Changed); + }); + configSystemFileWatcherTrackingSet.add(watcher); + } + const normalizedFileName = path.normalize(fileName); - watchCallbackTrackingMap.set(normalizedFileName, callback); + const watchers = ((): Set => { + let watchers = watchCallbackTrackingMap.get(normalizedFileName); + if (!watchers) { + watchers = new Set(); + watchCallbackTrackingMap.set(normalizedFileName, watchers); + } + return watchers; + })(); + watchers.add(callback); + return { close: (): void => { - watchCallbackTrackingMap.delete(normalizedFileName); + watchers.delete(callback); + + if (watcher) { + watcher.close(); + configSystemFileWatcherTrackingSet.delete(watcher); + } }, }; }; - // ensure fileWatchers aren't created for directories - watchCompilerHost.watchDirectory = (): ts.FileWatcher => noopFileWatcher; + // when new files are added in watch mode, we need to tell typescript about those files + // if we don't then typescript will act like they don't exist. + watchCompilerHost.watchDirectory = ( + dirPath, + callback, + recursive, + ): ts.FileWatcher => { + const watcher = watch( + dirPath, + { + depth: recursive ? 0 : undefined, + interval: 250, + }, + extra, + ); + watcher.on('add', path => { + callback(path); + }); + directorySystemFileWatcherTrackingSet.add(watcher); + + return { + close(): void { + watcher.close(); + directorySystemFileWatcherTrackingSet.delete(watcher); + }, + }; + }; // allow files with custom extensions to be included in program (uses internal ts api) const oldOnDirectoryStructureHostCreate = 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 dfa1b047f36b..59c7b8b2b554 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -1,8 +1,8 @@ +import jsxKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; import fs from 'fs'; import glob from 'glob'; import path from 'path'; -import jsxKnownIssues from '../../../shared-fixtures/jsx-known-issues'; import { isJSXFileType } from '../../tools/test-utils'; interface Fixture { diff --git a/packages/typescript-estree/tests/lib/jsx.ts b/packages/typescript-estree/tests/lib/jsx.ts index a3e0148907cc..f5d3f31b27cb 100644 --- a/packages/typescript-estree/tests/lib/jsx.ts +++ b/packages/typescript-estree/tests/lib/jsx.ts @@ -1,3 +1,4 @@ +import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; import { readFileSync } from 'fs'; import glob from 'glob'; import { TSESTreeOptions } from '../../src/parser-options'; @@ -5,7 +6,6 @@ import { createSnapshotTestBlock, formatSnapshotName, } from '../../tools/test-utils'; -import filesWithKnownIssues from '../../../shared-fixtures/jsx-known-issues'; const JSX_FIXTURES_DIR = '../../node_modules/@typescript-eslint/shared-fixtures/fixtures/jsx'; diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 6ed8db76cbc9..38b80aafbaaf 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -81,20 +81,21 @@ describe('parse()', () => { code: 'let foo = bar;', comment: true, comments: [], + createDefaultProgram: false, errorOnTypeScriptSyntacticAndSemanticIssues: false, errorOnUnknownASTType: false, extraFileExtensions: [], jsx: false, loc: true, log: loggerFn, + noWatch: false, + preserveNodeMaps: false, projects: [], range: true, strict: false, tokens: expect.any(Array), tsconfigRootDir: expect.any(String), useJSXTextNode: false, - preserveNodeMaps: false, - createDefaultProgram: false, }, false, ); diff --git a/packages/typescript-estree/tests/lib/persistentParse.ts b/packages/typescript-estree/tests/lib/persistentParse.ts new file mode 100644 index 000000000000..c588570bf732 --- /dev/null +++ b/packages/typescript-estree/tests/lib/persistentParse.ts @@ -0,0 +1,136 @@ +import fs from 'fs'; +import path from 'path'; +import tmp from 'tmp'; +import { parseAndGenerateServices } from '../../src/parser'; +import { clearCaches } from '../../src/tsconfig-parser'; + +const tsConfigExcludeBar = { + include: ['./*.ts'], + exclude: ['./bar.ts'], +}; +const tsConfigIncludeAll = { + include: ['./*.ts'], + exclude: [], +}; +const CONTENTS = { + foo: 'console.log("foo")', + bar: 'console.log("bar")', +}; + +const tmpDirs = new Set(); +afterEach(() => { + // stop watching the files and folders + clearCaches(); + + // clean up the temporary files and folders + tmpDirs.forEach(t => t.removeCallback()); + tmpDirs.clear(); +}); + +function writeTSConfig( + dirName: string, + config: Record, +): void { + fs.writeFileSync(path.join(dirName, 'tsconfig.json'), JSON.stringify(config)); +} +function writeFile(dirName: string, file: 'foo' | 'bar'): void { + fs.writeFileSync(path.join(dirName, `${file}.ts`), CONTENTS[file]); +} + +function setup(tsconfig: Record, writeBar = true): string { + const tmpDir = tmp.dirSync({ + keep: false, + unsafeCleanup: true, + }); + tmpDirs.add(tmpDir); + + writeTSConfig(tmpDir.name, tsconfig); + + writeFile(tmpDir.name, 'foo'); + writeBar && writeFile(tmpDir.name, 'bar'); + + return tmpDir.name; +} + +function parseFile(filename: 'foo' | 'bar', tmpDir: string): void { + parseAndGenerateServices(CONTENTS.foo, { + project: './tsconfig.json', + tsconfigRootDir: tmpDir, + filePath: path.join(tmpDir, `${filename}.ts`), + }); +} + +// https://github.com/microsoft/TypeScript/blob/a4bacf3bfaf77213c1ef4ddecaf3689837e20ac5/src/compiler/sys.ts#L46-L50 +enum PollingInterval { + High = 2000, + Medium = 500, + Low = 250, +} +async function runTimer(interval: PollingInterval): Promise { + // would love to use jest fake timers, but ts stores references to the standard timeout functions + // so we can't switch to fake timers on the fly :( + await new Promise((resolve): void => { + setTimeout(resolve, interval); + }); +} +async function waitForChokidar(): Promise { + // wait for chokidar to be ready + // this isn't won't be a problem when running the eslint CLI in watch mode because the init takes a few hundred ms + await runTimer(PollingInterval.Medium); +} + +describe('persistent lint session', () => { + it('parses both files successfully when included', () => { + const PROJECT_DIR = setup(tsConfigIncludeAll); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); + + it('parses included files, and throws on excluded files', () => { + const PROJECT_DIR = setup(tsConfigExcludeBar); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + }); + + it('reacts to changes in the tsconfig', async () => { + const PROJECT_DIR = setup(tsConfigExcludeBar); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + + await waitForChokidar(); + + // change the config file so it now includes all files + writeTSConfig(PROJECT_DIR, tsConfigIncludeAll); + + // wait for TS to pick up the change to the config file + await runTimer(PollingInterval.High); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); + + it('allows parsing of new files', async () => { + const PROJECT_DIR = setup(tsConfigIncludeAll, false); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + // bar should throw because it doesn't exist yet + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + + await waitForChokidar(); + + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'bar'); + + // wait for TS to pick up the new file + await runTimer(PollingInterval.Medium); + + // both files should parse fine now + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); +}); diff --git a/packages/typescript-estree/tsconfig.build.json b/packages/typescript-estree/tsconfig.build.json index 792172fb82f6..145fd09f633b 100644 --- a/packages/typescript-estree/tsconfig.build.json +++ b/packages/typescript-estree/tsconfig.build.json @@ -1,8 +1,10 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "composite": true, "outDir": "./dist", - "rootDir": "./src" + "rootDir": "./src", + "resolveJsonModule": true }, "include": ["src"] } diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index 2ea9199d2638..7dc0e63275b4 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -1,7 +1,8 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.build.json", "compilerOptions": { - "outDir": "./dist" + "rootDir": ".", + "noEmit": true }, "include": ["src", "tests", "tools"], "exclude": ["tests/fixtures/**/*"] diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 000000000000..2d9938163eac --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.base.json", + "include": ["tests/**/*.ts", "tools/**/*.ts"] +} diff --git a/yarn.lock b/yarn.lock index 9f41d090fe99..8054910b5668 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1473,6 +1473,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/tmp@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.1.0.tgz#19cf73a7bcf641965485119726397a096f0049bd" + integrity sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA== + "@types/yargs-parser@*": version "13.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" @@ -1843,6 +1848,14 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" +anymatch@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.0.tgz#e609350e50a9313b472789b2f14ef35808ee14d6" + integrity sha512-Ozz7l4ixzI7Oxj2+cw+p0tVUt27BpaJ+1+q1TCeANWxHpvyn2+Un+YamBdfKu0uh8xLodGhoa1v7595NhKDAuA== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -2172,6 +2185,11 @@ binary-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== +binary-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" + integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== + bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.5.5" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" @@ -2206,7 +2224,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1: +braces@^3.0.1, braces@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -2559,6 +2577,21 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.7" +chokidar@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.0.2.tgz#0d1cd6d04eb2df0327446188cd13736a3367d681" + integrity sha512-c4PR2egjNjI1um6bamCQ6bUNPDiyofNQruHvKgHQ4gDUP/ITSVSzNsiI5OWtHOsX323i5ha/kk4YmOZ1Ktg7KA== + dependencies: + anymatch "^3.0.1" + braces "^3.0.2" + glob-parent "^5.0.0" + is-binary-path "^2.1.0" + is-glob "^4.0.1" + normalize-path "^3.0.0" + readdirp "^3.1.1" + optionalDependencies: + fsevents "^2.0.6" + chownr@^1.1.1, chownr@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" @@ -4226,6 +4259,11 @@ fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" +fsevents@^2.0.6: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" + integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -4907,6 +4945,13 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" +is-binary-path@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -7253,7 +7298,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.5: +picomatch@^2.0.4, picomatch@^2.0.5: version "2.0.7" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6" integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA== @@ -7702,6 +7747,13 @@ readdirp@^2.2.1: micromatch "^3.1.10" readable-stream "^2.0.2" +readdirp@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.1.2.tgz#fa85d2d14d4289920e4671dead96431add2ee78a" + integrity sha512-8rhl0xs2cxfVsqzreYCvs8EwBfn/DhVdqtoLmw19uI3SC5avYX9teCurlErfpPXGmYtMHReGaP2RsLnFvz/lnw== + dependencies: + picomatch "^2.0.4" + realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" @@ -8719,6 +8771,13 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" +tmp@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877" + integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw== + dependencies: + rimraf "^2.6.3" + tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" From 623febfca0b5afbbdc7297d65617d80ac4872513 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 14 Oct 2019 09:53:59 -0700 Subject: [PATCH 08/47] feat(typescript-estree): support for parsing 3.7 features (#1045) --- .vscode/launch.json | 3 + .vscode/settings.json | 4 +- README.md | 4 +- package.json | 5 +- packages/eslint-plugin-tslint/tsconfig.json | 4 +- .../src/rules/adjacent-overload-signatures.ts | 2 - packages/eslint-plugin/src/rules/indent.ts | 6 +- .../src/rules/prefer-readonly.ts | 4 +- packages/eslint-plugin/tsconfig.json | 4 +- packages/experimental-utils/tsconfig.json | 4 +- packages/parser/src/visitor-keys.ts | 2 + .../tests/lib/__snapshots__/comments.ts.snap | 13 + .../lib/__snapshots__/typescript.ts.snap | 7316 +++++-- packages/parser/tests/lib/jsx.ts | 2 +- packages/parser/tsconfig.build.json | 3 +- packages/parser/tsconfig.json | 4 +- ...cket-type-assertion-arrow-function.src.ts} | 0 ...ts => angle-bracket-type-assertion.src.ts} | 0 .../basics/nullish-coalescing.src.ts | 3 + .../basics/optional-chain-call.src.ts | 12 + .../optional-chain-element-access.src.ts | 8 + .../typescript/basics/optional-chain.src.ts | 7 + .../type-assertion-in-arrow-function.src.ts | 3 + .../basics/type-assertion-in-function.src.ts | 3 + .../basics/type-assertion-in-interface.src.ts | 3 + .../basics/type-assertion-in-method.src.ts | 8 + ...ertion-with-guard-in-arrow-function.src.ts | 3 + ...pe-assertion-with-guard-in-function.src.ts | 3 + ...e-assertion-with-guard-in-interface.src.ts | 3 + ...type-assertion-with-guard-in-method.src.ts | 8 + packages/shared-fixtures/package.json | 7 +- packages/shared-fixtures/tsconfig.build.json | 12 + packages/shared-fixtures/tsconfig.json | 10 + packages/typescript-estree/src/convert.ts | 131 +- packages/typescript-estree/src/node-utils.ts | 25 +- packages/typescript-estree/src/parser.ts | 2 +- .../src/ts-estree/ast-node-types.ts | 2 + .../src/ts-estree/ts-estree.ts | 35 +- .../tests/ast-alignment/fixtures-to-test.ts | 276 +- .../tests/ast-alignment/parse.ts | 2 + .../tests/lib/__snapshots__/comments.ts.snap | 13 + .../lib/__snapshots__/javascript.ts.snap | 45 + .../semantic-diagnostics-enabled.ts.snap | 28 +- .../lib/__snapshots__/semanticInfo.ts.snap | 2 + .../tests/lib/__snapshots__/tsx.ts.snap | 1 + .../lib/__snapshots__/typescript.ts.snap | 16971 +++++++++++++--- packages/typescript-estree/tests/lib/jsx.ts | 2 +- .../tests/lib/semanticInfo.ts | 7 +- packages/typescript-estree/tsconfig.json | 7 +- yarn.lock | 2341 +-- 50 files changed, 20524 insertions(+), 6839 deletions(-) rename packages/shared-fixtures/fixtures/typescript/basics/{type-assertion-arrow-function.src.ts => angle-bracket-type-assertion-arrow-function.src.ts} (100%) rename packages/shared-fixtures/fixtures/typescript/basics/{type-assertion.src.ts => angle-bracket-type-assertion.src.ts} (100%) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/nullish-coalescing.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-arrow-function.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-function.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-interface.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-method.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-function.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-interface.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-method.src.ts create mode 100644 packages/shared-fixtures/tsconfig.build.json create mode 100644 packages/shared-fixtures/tsconfig.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 1c2b4b3dd803..474d245895c0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,6 +12,7 @@ "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", "args": [ "--runInBand", + "--no-coverage", // needs the '' around it so that the () are properly handled "'tests/(.+/)?${fileBasenameNoExtension}'" ], @@ -27,6 +28,8 @@ "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", "args": [ "--runInBand", + "--no-cache", + "--no-coverage", "${relativeFile}" ], "sourceMaps": true, diff --git a/.vscode/settings.json b/.vscode/settings.json index 9f2782e2bb55..0174acc7be36 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,6 +22,6 @@ "javascript.preferences.importModuleSpecifier": "auto", "typescript.preferences.importModuleSpecifier": "auto", "javascript.preferences.quoteStyle": "single", -"typescript.preferences.quoteStyle": "single", -"editor.defaultFormatter": "esbenp.prettier-vscode" + "typescript.preferences.quoteStyle": "single", + "editor.defaultFormatter": "esbenp.prettier-vscode" } diff --git a/README.md b/README.md index 801c15aa1a18..f296ee034eff 100644 --- a/README.md +++ b/README.md @@ -235,9 +235,9 @@ The latest version under the `canary` tag **(latest commit to master)** is: ## Supported TypeScript Version -We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. +We will always endeavor to support the latest stable version of TypeScript. Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version. -**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.7.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.8.0`.** This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. diff --git a/package.json b/package.json index e4d690b0bb42..c848499ff784 100644 --- a/package.json +++ b/package.json @@ -73,10 +73,13 @@ "ts-jest": "^24.0.0", "ts-node": "^8.3.0", "tslint": "^5.19.0", - "typescript": ">=3.2.1 <3.7.0" + "typescript": ">=3.2.1 <3.8.0 >3.7.0-dev.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "resolutions": { + "typescript": "^3.7.0-beta" } } diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index 5362fa1c79c4..65fc5ce65848 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "rootDir": ".", - "noEmit": true + "composite": false, + "rootDir": "." }, "include": ["src", "tests"], "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"] diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index b2f22b8a0aa6..6f3f31c9c6e0 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -90,8 +90,6 @@ export default util.createRule({ case AST_NODE_TYPES.TSTypeLiteral: return node.members; } - - return []; } /** diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 3f0e88926a27..9951db4ea8b0 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -292,7 +292,7 @@ export default util.createRule({ range: moduleReference.range, loc: moduleReference.loc, }, - }, + } as TSESTree.VariableDeclarator, ], // location data @@ -313,6 +313,8 @@ export default util.createRule({ parent: node.parent, range: node.range, loc: node.loc, + optional: false, + computed: true, }); }, @@ -420,6 +422,8 @@ export default util.createRule({ parent: node.parent, range: node.range, loc: node.loc, + optional: false, + computed: false, }); }, diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 280213dde0f3..3daa37e14dd7 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -162,7 +162,9 @@ export default util.createRule({ function getEsNodesFromViolatingNode( violatingNode: ParameterOrPropertyDeclaration, ): { esNode: TSESTree.Node; nameNode: TSESTree.Node } { - if (ts.isParameterPropertyDeclaration(violatingNode)) { + if ( + ts.isParameterPropertyDeclaration(violatingNode, violatingNode.parent) + ) { return { esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), nameNode: parserServices.tsNodeToESTreeNodeMap.get( diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 4ef2253e8b4e..9cea515ba6b2 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "rootDir": ".", - "noEmit": true + "composite": false, + "rootDir": "." }, "include": ["src", "typings", "tests", "tools"] } diff --git a/packages/experimental-utils/tsconfig.json b/packages/experimental-utils/tsconfig.json index 4ef2253e8b4e..9cea515ba6b2 100644 --- a/packages/experimental-utils/tsconfig.json +++ b/packages/experimental-utils/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "rootDir": ".", - "noEmit": true + "composite": false, + "rootDir": "." }, "include": ["src", "typings", "tests", "tools"] } diff --git a/packages/parser/src/visitor-keys.ts b/packages/parser/src/visitor-keys.ts index 756527ff83fa..e594fb240e05 100644 --- a/packages/parser/src/visitor-keys.ts +++ b/packages/parser/src/visitor-keys.ts @@ -43,6 +43,8 @@ export const visitorKeys = eslintVisitorKeys.unionWith({ BigIntLiteral: [], ClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], Decorator: ['expression'], + OptionalCallExpression: eslintVisitorKeys.KEYS.CallExpression, + OptionalMemberExpression: eslintVisitorKeys.KEYS.MemberExpression, TSAbstractClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], diff --git a/packages/parser/tests/lib/__snapshots__/comments.ts.snap b/packages/parser/tests/lib/__snapshots__/comments.ts.snap index 92affb66677c..86f198bdab95 100644 --- a/packages/parser/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/comments.ts.snap @@ -36,6 +36,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 6, 9, @@ -11708,6 +11709,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 24, 37, @@ -12589,6 +12591,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 24, 37, @@ -14189,6 +14192,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 36, 41, @@ -15965,6 +15969,7 @@ Object { "line": 6, }, }, + "optional": false, "range": Array [ 82, 88, @@ -16485,6 +16490,7 @@ Object { "line": 7, }, }, + "optional": false, "range": Array [ 126, 132, @@ -18181,6 +18187,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18277,6 +18284,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18301,6 +18309,7 @@ Object { ], "type": "MemberExpression", }, + "optional": false, "property": Object { "left": Object { "computed": false, @@ -18344,6 +18353,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18368,6 +18378,7 @@ Object { ], "type": "MemberExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18463,6 +18474,7 @@ Object { "line": 6, }, }, + "optional": false, "range": Array [ 161, 218, @@ -18552,6 +18564,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index cf9bd22368cf..ab627ecea750 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -1147,134 +1147,121 @@ Object { } `; -exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` +exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` Object { - "$id": 4, + "$id": 3, "block": Object { "range": Array [ 0, - 19, + 29, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 2, "block": Object { "range": Array [ 0, - 19, + 29, ], "type": "Program", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "$id": 2, - "block": Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "foo", "range": Array [ - 1, - 14, + 6, + 9, ], - "type": "ArrowFunctionExpression", + "type": "Identifier", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "k", + "name": Object { + "name": "foo", "range": Array [ + 6, 9, - 10, ], "type": "Identifier", }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "node": Object { + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", }, - "writeExpr": undefined, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", }, ], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "k": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "k", - "range": Array [ - 2, - 4, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 1, - 14, - ], - "type": "ArrowFunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "k", - "range": Array [ - 2, - 4, - ], - "type": "Identifier", - }, - ], - "name": "k", - "references": Array [ - Object { - "$ref": 1, - }, + "name": "foo", + "range": Array [ + 6, + 9, ], - "scope": Object { - "$ref": 2, - }, + "type": "Identifier", }, ], + "name": "foo", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, }, ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], }, ], "functionExpressionScope": false, @@ -1285,39 +1272,39 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 3, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` Object { - "$id": 4, + "$id": 6, "block": Object { "range": Array [ 0, - 33, + 45, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 5, "block": Object { "range": Array [ 0, - 33, + 45, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 4, "block": Object { "range": Array [ - 0, - 33, + 22, + 42, ], "type": "ArrowFunctionExpression", }, @@ -1326,21 +1313,21 @@ Object { "isStrict": true, "references": Array [ Object { - "$id": 1, + "$id": 3, "from": Object { - "$ref": 2, + "$ref": 4, }, "identifier": Object { - "name": "b", + "name": "n", "range": Array [ - 29, - 30, + 38, + 39, ], "type": "Identifier", }, "kind": "r", "resolved": Object { - "$ref": 0, + "$ref": 2, }, "writeExpr": undefined, }, @@ -1348,33 +1335,33 @@ Object { "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 3, + "$ref": 5, }, "variableMap": Object { - "b": Object { - "$ref": 0, + "n": Object { + "$ref": 2, }, }, "variableScope": Object { - "$ref": 2, + "$ref": 4, }, "variables": Array [ Object { - "$id": 0, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "b", + "name": "n", "range": Array [ - 4, - 8, + 23, + 24, ], "type": "Identifier", }, "node": Object { "range": Array [ - 0, - 33, + 22, + 42, ], "type": "ArrowFunctionExpression", }, @@ -1385,22 +1372,22 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "b", + "name": "n", "range": Array [ - 4, - 8, + 23, + 24, ], "type": "Identifier", }, ], - "name": "b", + "name": "n", "references": Array [ Object { - "$ref": 1, + "$ref": 3, }, ], "scope": Object { - "$ref": 2, + "$ref": 4, }, }, ], @@ -1408,120 +1395,180 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 4, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 4, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "asserted2", + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 16, + 43, + ], + "type": "TSTypeAssertion", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "asserted2": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "asserted2", + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 43, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "asserted2", + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + }, + ], + "name": "asserted2", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` Object { - "$id": 5, + "$id": 4, "block": Object { "range": Array [ 0, - 30, + 19, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 4, + "$id": 3, "block": Object { "range": Array [ 0, - 30, + 19, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 2, "block": Object { "range": Array [ 1, - 26, + 14, ], - "type": "FunctionExpression", + "type": "ArrowFunctionExpression", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "$id": 2, - "block": Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "k", "range": Array [ - 1, - 26, + 9, + 10, ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, + "type": "Identifier", }, - "variableScope": Object { - "$ref": 2, + "kind": "r", + "resolved": Object { + "$ref": 0, }, - "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], + "writeExpr": undefined, }, ], - "functionExpressionScope": true, - "isStrict": true, - "references": Array [], "throughReferences": Array [], - "type": "function-expression-name", + "type": "function", "upperScope": Object { - "$ref": 4, + "$ref": 3, }, "variableMap": Object { - "test": Object { + "k": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 4, + "$ref": 2, }, "variables": Array [ Object { @@ -1529,39 +1576,43 @@ Object { "defs": Array [ Object { "name": Object { - "name": "test", + "name": "k", "range": Array [ - 16, - 20, + 2, + 4, ], "type": "Identifier", }, "node": Object { "range": Array [ 1, - 26, + 14, ], - "type": "FunctionExpression", + "type": "ArrowFunctionExpression", }, "parent": null, - "type": "FunctionName", + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "test", + "name": "k", "range": Array [ - 16, - 20, + 2, + 4, ], "type": "Identifier", }, ], - "name": "test", - "references": Array [], + "name": "k", + "references": Array [ + Object { + "$ref": 1, + }, + ], "scope": Object { - "$ref": 3, + "$ref": 2, }, }, ], @@ -1573,11 +1624,11 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 5, + "$ref": 4, }, "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 3, }, "variables": Array [], }, @@ -1590,304 +1641,122 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 5, + "$ref": 4, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` Object { - "$id": 10, + "$id": 4, "block": Object { "range": Array [ 0, - 97, + 33, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 9, + "$id": 3, "block": Object { "range": Array [ 0, - 97, + 33, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 8, + "$id": 2, "block": Object { "range": Array [ 0, - 96, + 33, ], - "type": "FunctionDeclaration", + "type": "ArrowFunctionExpression", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, "references": Array [ Object { - "$id": 5, + "$id": 1, "from": Object { - "$ref": 8, + "$ref": 2, }, "identifier": Object { - "name": "foo", + "name": "b", "range": Array [ - 32, - 35, + 29, + 30, ], "type": "Identifier", }, - "kind": "w", + "kind": "r", "resolved": Object { - "$ref": 2, - }, - "writeExpr": Object { - "range": Array [ - 38, - 43, - ], - "type": "Literal", - }, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "range": Array [ - 59, - 64, - ], - "type": "Literal", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "fooBar", - "range": Array [ - 76, - 82, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": Object { - "range": Array [ - 85, - 93, - ], - "type": "Literal", + "$ref": 0, }, + "writeExpr": undefined, }, ], "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 9, + "$ref": 3, }, "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - "bar": Object { - "$ref": 3, - }, - "foo": Object { - "$ref": 2, - }, - "fooBar": Object { - "$ref": 4, + "b": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 8, + "$ref": 2, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 32, - 43, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 28, - 44, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [ - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 53, - 64, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 49, - 65, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", - }, - ], - "name": "bar", - "references": Array [ - Object { - "$ref": 6, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 4, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "fooBar", + "name": "b", "range": Array [ - 76, - 82, + 4, + 8, ], "type": "Identifier", }, "node": Object { "range": Array [ - 76, - 93, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 70, - 94, + 0, + 33, ], - "type": "VariableDeclaration", + "type": "ArrowFunctionExpression", }, - "type": "Variable", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "fooBar", + "name": "b", "range": Array [ - 76, - 82, + 4, + 8, ], "type": "Identifier", }, ], - "name": "fooBar", + "name": "b", "references": Array [ Object { - "$ref": 7, + "$ref": 1, }, ], "scope": Object { - "$ref": 8, + "$ref": 2, }, }, ], @@ -1899,58 +1768,174 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 10, - }, - "variableMap": Object { - "test": Object { - "$ref": 0, - }, + "$ref": 4, }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 9, + "$ref": 3, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "test", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 96, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "test", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 30, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 30, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], }, ], - "name": "test", + "functionExpressionScope": true, + "isStrict": true, "references": Array [], - "scope": Object { - "$ref": 9, + "throughReferences": Array [], + "type": "function-expression-name", + "upperScope": Object { + "$ref": 4, }, + "variableMap": Object { + "test": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + ], + "name": "test", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], }, ], "functionExpressionScope": false, @@ -1961,39 +1946,39 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 10, + "$ref": 5, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/await-without-async-function.src 1`] = ` +exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` Object { - "$id": 8, + "$id": 10, "block": Object { "range": Array [ 0, - 64, + 97, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 7, + "$id": 9, "block": Object { "range": Array [ 0, - 64, + 97, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 6, + "$id": 8, "block": Object { "range": Array [ 0, - 63, + 96, ], "type": "FunctionDeclaration", }, @@ -2002,15 +1987,15 @@ Object { "isStrict": true, "references": Array [ Object { - "$id": 3, + "$id": 5, "from": Object { - "$ref": 6, + "$ref": 8, }, "identifier": Object { - "name": "bar", + "name": "foo", "range": Array [ - 25, - 28, + 32, + 35, ], "type": "Identifier", }, @@ -2020,68 +2005,84 @@ Object { }, "writeExpr": Object { "range": Array [ - 31, - 42, + 38, + 43, ], - "type": "AwaitExpression", + "type": "Literal", }, }, Object { - "$id": 4, + "$id": 6, "from": Object { - "$ref": 6, + "$ref": 8, }, "identifier": Object { - "name": "baz", + "name": "bar", "range": Array [ - 37, - 40, + 53, + 56, ], "type": "Identifier", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 59, + 64, + ], + "type": "Literal", + }, }, Object { - "$id": 5, + "$id": 7, "from": Object { - "$ref": 6, + "$ref": 8, }, "identifier": Object { - "name": "bar", + "name": "fooBar", "range": Array [ - 53, - 56, + 76, + 82, ], "type": "Identifier", }, - "kind": "r", + "kind": "w", "resolved": Object { - "$ref": 2, + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 85, + 93, + ], + "type": "Literal", }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, }, ], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 7, + "$ref": 9, }, "variableMap": Object { "arguments": Object { "$ref": 1, }, "bar": Object { + "$ref": 3, + }, + "foo": Object { "$ref": 2, }, + "fooBar": Object { + "$ref": 4, + }, }, "variableScope": Object { - "$ref": 6, + "$ref": 8, }, "variables": Array [ Object { @@ -2092,7 +2093,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 6, + "$ref": 8, }, }, Object { @@ -2100,24 +2101,74 @@ Object { "defs": Array [ Object { "name": Object { - "name": "bar", + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 43, + ], + "type": "VariableDeclarator", + }, + "parent": Object { "range": Array [ - 25, 28, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 53, + 56, ], "type": "Identifier", }, "node": Object { "range": Array [ - 25, - 42, + 53, + 64, ], "type": "VariableDeclarator", }, "parent": Object { "range": Array [ - 19, - 43, + 49, + 65, ], "type": "VariableDeclaration", }, @@ -2129,8 +2180,8 @@ Object { Object { "name": "bar", "range": Array [ - 25, - 28, + 53, + 56, ], "type": "Identifier", }, @@ -2138,14 +2189,61 @@ Object { "name": "bar", "references": Array [ Object { - "$ref": 3, + "$ref": 6, }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 4, + "defs": Array [ Object { - "$ref": 5, + "name": Object { + "name": "fooBar", + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 76, + 93, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 70, + 94, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "fooBar", + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + }, + ], + "name": "fooBar", + "references": Array [ + Object { + "$ref": 7, }, ], "scope": Object { - "$ref": 6, + "$ref": 8, }, }, ], @@ -2154,22 +2252,18 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 8, + "$ref": 10, }, "variableMap": Object { - "foo": Object { + "test": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 7, + "$ref": 9, }, "variables": Array [ Object { @@ -2177,17 +2271,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "foo", + "name": "test", "range": Array [ - 9, - 12, + 15, + 19, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 63, + 96, ], "type": "FunctionDeclaration", }, @@ -2198,18 +2292,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "foo", + "name": "test", "range": Array [ - 9, - 12, + 15, + 19, ], "type": "Identifier", }, ], - "name": "foo", + "name": "test", "references": Array [], "scope": Object { - "$ref": 7, + "$ref": 9, }, }, ], @@ -2218,197 +2312,263 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/call-signatures.src 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 62, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 0, - 62, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 10, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/call-signatures-with-generics.src 1`] = ` +exports[`typescript fixtures/basics/await-without-async-function.src 1`] = ` Object { - "$id": 1, + "$id": 8, "block": Object { "range": Array [ 0, - 68, + 64, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 0, + "$id": 7, "block": Object { "range": Array [ 0, - 68, + 64, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/cast-as-expression.src 1`] = ` -Object { - "$id": 3, - "block": Object { - "range": Array [ - 0, - 18, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 18, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 0, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "x", + "$id": 6, + "block": Object { "range": Array [ 0, - 1, + 63, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 1, - "from": Object { - "$ref": 2, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 31, + 42, + ], + "type": "AwaitExpression", + }, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "baz", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 7, }, - "identifier": Object { - "name": "y", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 25, + 42, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 19, + 43, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [ Object { - "$ref": 0, - }, - Object { - "$ref": 1, + "$ref": 4, }, ], "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 8, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, }, - "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 7, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], }, ], "functionExpressionScope": false, @@ -2416,7 +2576,203 @@ Object { "references": Array [], "throughReferences": Array [ Object { - "$ref": 0, + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/call-signatures.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/call-signatures-with-generics.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/cast-as-expression.src 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, }, Object { "$ref": 1, @@ -19424,103 +19780,1849 @@ Object { }, }, Object { - "$id": 10, - "defs": Array [ - Object { - "name": Object { - "name": "async", - "range": Array [ - 82, - 87, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 82, - 91, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 76, - 92, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], + "$id": 10, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 82, + 91, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 76, + 92, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [ + Object { + "$ref": 16, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 11, + "defs": Array [ + Object { + "name": Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 101, + 107, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 95, + 108, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + ], + "name": "is", + "references": Array [ + Object { + "$ref": 17, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 20, + }, + "variableMap": Object { + "async": Object { + "$ref": 4, + }, + "get": Object { + "$ref": 0, + }, + "is": Object { + "$ref": 5, + }, + "module": Object { + "$ref": 2, + }, + "set": Object { + "$ref": 1, + }, + "type": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 123, + 126, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 130, + 133, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "set", + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 137, + 143, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 137, + 143, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 137, + 143, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 147, + 151, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 147, + 151, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "type", + "range": Array [ + 147, + 151, + ], + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 155, + 160, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 155, + 160, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 155, + 160, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "is", + "range": Array [ + 164, + 166, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 164, + 166, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 112, + 189, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "is", + "range": Array [ + 164, + 166, + ], + "type": "Identifier", + }, + ], + "name": "is", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 20, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 44, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 44, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "nestedArray": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "nestedArray", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "nestedArray", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "nestedArray", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 46, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 46, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "e": Object { + "$ref": 2, + }, + "s": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "processEntity": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + ], + "name": "processEntity", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 30, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 30, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/nullish-coalescing.src 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 70, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "len", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 59, + 66, + ], + "type": "LogicalExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "len": Object { + "$ref": 3, + }, + "s": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 32, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 70, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 32, + 42, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "len", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 52, + 67, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 48, + 68, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "len", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + ], + "name": "len", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "processNullishCoalesce": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processNullishCoalesce", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 70, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processNullishCoalesce", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + ], + "name": "processNullishCoalesce", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 26, + 31, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + Object { + "$id": 4, + "block": Object { + "range": Array [ + 58, + 81, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "X": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 81, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + ], + "name": "X", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "X": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 81, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + ], + "name": "X", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 176, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 176, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 29, + 61, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + Object { + "$id": 5, + "block": Object { + "range": Array [ + 68, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + Object { + "$id": 7, + "block": Object { + "range": Array [ + 109, + 138, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 147, + 172, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 8, + }, + "x": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 8, + "defs": Array [], "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "async", - "range": Array [ - 82, - 87, - ], - "type": "Identifier", - }, - ], - "name": "async", - "references": Array [ - Object { - "$ref": 16, - }, - ], + "identifiers": Array [], + "name": "arguments", + "references": Array [], "scope": Object { - "$ref": 18, + "$ref": 10, }, }, Object { - "$id": 11, + "$id": 9, "defs": Array [ Object { "name": Object { - "name": "is", + "name": "x", "range": Array [ - 101, - 103, + 148, + 157, ], "type": "Identifier", }, "node": Object { "range": Array [ - 101, - 107, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 95, - 108, + 147, + 172, ], - "type": "VariableDeclaration", + "type": "FunctionExpression", }, - "type": "Variable", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "is", + "name": "x", "range": Array [ - 101, - 103, + 148, + 157, ], "type": "Identifier", }, ], - "name": "is", - "references": Array [ - Object { - "$ref": 17, - }, - ], + "name": "x", + "references": Array [], "scope": Object { - "$ref": 18, + "$ref": 10, }, }, ], @@ -19528,34 +21630,45 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 174, + ], + "type": "ObjectExpression", + }, + }, + ], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 20, + "$ref": 12, }, "variableMap": Object { - "async": Object { - "$ref": 4, - }, - "get": Object { + "foo": Object { "$ref": 0, }, - "is": Object { - "$ref": 5, - }, - "module": Object { - "$ref": 2, - }, - "set": Object { - "$ref": 1, - }, - "type": Object { - "$ref": 3, - }, }, "variableScope": Object { - "$ref": 19, + "$ref": 11, }, "variables": Array [ Object { @@ -19563,330 +21676,486 @@ Object { "defs": Array [ Object { "name": Object { - "name": "get", + "name": "foo", "range": Array [ - 123, - 126, + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 174, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 175, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain.src 1`] = ` +Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 135, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 17, + "block": Object { + "range": Array [ + 0, + 135, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 16, + "block": Object { + "range": Array [ + 0, + 134, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 40, + 43, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 123, - 126, - ], - "type": "ImportSpecifier", + "kind": "r", + "resolved": Object { + "$ref": 2, }, - "parent": Object { + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "two", "range": Array [ - 112, - 189, + 45, + 48, ], - "type": "ImportDeclaration", + "type": "Identifier", }, - "type": "ImportBinding", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "get", - "range": Array [ - 123, - 126, - ], - "type": "Identifier", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "name": "get", - "references": Array [], - "scope": Object { - "$ref": 19, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { - "name": "set", + "$id": 5, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "one", "range": Array [ - 130, - 133, + 52, + 55, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 130, - 133, - ], - "type": "ImportSpecifier", + "kind": "r", + "resolved": Object { + "$ref": 2, }, - "parent": Object { + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "two", "range": Array [ - 112, - 189, + 57, + 60, ], - "type": "ImportDeclaration", + "type": "Identifier", }, - "type": "ImportBinding", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "set", - "range": Array [ - 130, - 133, - ], - "type": "Identifier", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "name": "set", - "references": Array [], - "scope": Object { - "$ref": 19, - }, - }, - Object { - "$id": 2, - "defs": Array [ Object { - "name": Object { - "name": "module", + "$id": 7, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "three", "range": Array [ - 137, - 143, + 61, + 66, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 137, - 143, - ], - "type": "ImportSpecifier", + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 16, }, - "parent": Object { + "identifier": Object { + "name": "one", "range": Array [ - 112, - 189, + 70, + 73, ], - "type": "ImportDeclaration", + "type": "Identifier", }, - "type": "ImportBinding", + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "module", - "range": Array [ - 137, - 143, - ], - "type": "Identifier", + "$id": 9, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "name": "module", - "references": Array [], - "scope": Object { - "$ref": 19, - }, - }, - Object { - "$id": 3, - "defs": Array [ Object { - "name": Object { - "name": "type", + "$id": 10, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "one", "range": Array [ - 147, - 151, + 88, + 91, ], "type": "Identifier", }, - "node": Object { + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "three", "range": Array [ - 147, - 151, + 97, + 102, ], - "type": "ImportSpecifier", + "type": "Identifier", }, - "parent": Object { + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "four", "range": Array [ - 112, - 189, + 103, + 107, ], - "type": "ImportDeclaration", + "type": "Identifier", }, - "type": "ImportBinding", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "type", - "range": Array [ - 147, - 151, - ], - "type": "Identifier", + "$id": 13, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, }, - ], - "name": "type", - "references": Array [], - "scope": Object { - "$ref": 19, - }, - }, - Object { - "$id": 4, - "defs": Array [ Object { - "name": Object { - "name": "async", + "$id": 14, + "from": Object { + "$ref": 16, + }, + "identifier": Object { + "name": "three", "range": Array [ - 155, - 160, + 120, + 125, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 155, - 160, - ], - "type": "ImportSpecifier", + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 15, + "from": Object { + "$ref": 16, }, - "parent": Object { + "identifier": Object { + "name": "four", "range": Array [ - 112, - 189, + 127, + 131, ], - "type": "ImportDeclaration", + "type": "Identifier", }, - "type": "ImportBinding", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, ], - "eslintUsed": undefined, - "identifiers": Array [ + "throughReferences": Array [ Object { - "name": "async", - "range": Array [ - 155, - 160, - ], - "type": "Identifier", + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, }, ], - "name": "async", - "references": Array [], - "scope": Object { - "$ref": 19, + "type": "function", + "upperScope": Object { + "$ref": 17, }, - }, - Object { - "$id": 5, - "defs": Array [ + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ Object { - "name": Object { - "name": "is", - "range": Array [ - 164, - 166, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 164, - 166, - ], - "type": "ImportSpecifier", - }, - "parent": Object { - "range": Array [ - 112, - 189, - ], - "type": "ImportDeclaration", + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, }, - "type": "ImportBinding", }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "is", - "range": Array [ - 164, - 166, + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 134, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 16, + }, }, ], - "name": "is", - "references": Array [], - "scope": Object { - "$ref": 19, - }, }, ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 20, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 44, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 44, - ], - "type": "Program", - }, - "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + ], "type": "module", "upperScope": Object { - "$ref": 2, + "$ref": 18, }, "variableMap": Object { - "nestedArray": Object { + "processOptional": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 1, + "$ref": 17, }, "variables": Array [ Object { @@ -19894,45 +22163,39 @@ Object { "defs": Array [ Object { "name": Object { - "name": "nestedArray", + "name": "processOptional", "range": Array [ - 4, - 44, + 9, + 24, ], "type": "Identifier", }, "node": Object { - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", - }, - "parent": Object { "range": Array [ 0, - 44, + 134, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, - "type": "Variable", + "parent": null, + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "nestedArray", - "range": Array [ - 4, - 44, + "name": "processOptional", + "range": Array [ + 9, + 24, ], "type": "Identifier", }, ], - "name": "nestedArray", + "name": "processOptional", "references": Array [], "scope": Object { - "$ref": 1, + "$ref": 17, }, }, ], @@ -19941,188 +22204,300 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 18, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` Object { - "$id": 3, + "$id": 22, "block": Object { "range": Array [ 0, - 46, + 181, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 21, "block": Object { "range": Array [ 0, - 46, + 181, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "Observable", + "$id": 20, + "block": Object { "range": Array [ - 19, - 29, + 0, + 180, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { - "name": "x", + "$id": 3, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "one", "range": Array [ - 6, - 17, + 44, + 47, ], "type": "Identifier", }, - "node": Object { + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "fn", "range": Array [ - 6, - 17, + 49, + 51, ], - "type": "VariableDeclarator", + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 66, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 83, + 85, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 91, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 106, + 108, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 20, }, - "parent": Object { + "identifier": Object { + "name": "three", "range": Array [ - 0, - 18, + 123, + 128, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 6, - 17, - ], - "type": "Identifier", + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` -Object { - "$id": 10, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 9, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ Object { - "$id": 4, + "$id": 15, "from": Object { - "$ref": 8, + "$ref": 20, }, "identifier": Object { - "name": "validateEntity", + "name": "fn", "range": Array [ - 41, - 55, + 130, + 132, ], "type": "Identifier", }, @@ -20131,15 +22506,15 @@ Object { "writeExpr": undefined, }, Object { - "$id": 5, + "$id": 16, "from": Object { - "$ref": 8, + "$ref": 20, }, "identifier": Object { - "name": "e", + "name": "one", "range": Array [ - 56, - 57, + 139, + 142, ], "type": "Identifier", }, @@ -20150,40 +22525,34 @@ Object { "writeExpr": undefined, }, Object { - "$id": 6, + "$id": 17, "from": Object { - "$ref": 8, + "$ref": 20, }, "identifier": Object { - "name": "s", + "name": "one", "range": Array [ - 68, - 69, + 150, + 153, ], "type": "Identifier", }, - "kind": "w", + "kind": "r", "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "range": Array [ - 72, - 79, - ], - "type": "MemberExpression", + "$ref": 2, }, + "writeExpr": undefined, }, Object { - "$id": 7, + "$id": 18, "from": Object { - "$ref": 8, + "$ref": 20, }, "identifier": Object { - "name": "e", + "name": "one", "range": Array [ - 72, - 73, + 166, + 169, ], "type": "Identifier", }, @@ -20193,29 +22562,67 @@ Object { }, "writeExpr": undefined, }, + Object { + "$id": 19, + "from": Object { + "$ref": 20, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 174, + 177, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, ], "throughReferences": Array [ Object { "$ref": 4, }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 19, + }, ], "type": "function", "upperScope": Object { - "$ref": 9, + "$ref": 21, }, "variableMap": Object { "arguments": Object { "$ref": 1, }, - "e": Object { + "one": Object { "$ref": 2, }, - "s": Object { - "$ref": 3, - }, }, "variableScope": Object { - "$ref": 8, + "$ref": 20, }, "variables": Array [ Object { @@ -20226,7 +22633,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 8, + "$ref": 20, }, }, Object { @@ -20234,17 +22641,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "e", + "name": "one", "range": Array [ - 23, - 33, + 29, + 38, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 82, + 180, ], "type": "FunctionDeclaration", }, @@ -20255,99 +22662,91 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "e", + "name": "one", "range": Array [ - 23, - 33, + 29, + 38, ], "type": "Identifier", }, ], - "name": "e", + "name": "one", "references": Array [ + Object { + "$ref": 3, + }, Object { "$ref": 5, }, Object { - "$ref": 7, + "$ref": 8, }, - ], - "scope": Object { - "$ref": 8, - }, - }, - Object { - "$id": 3, - "defs": Array [ Object { - "name": Object { - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 68, - 79, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", + "$ref": 10, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ Object { - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", + "$ref": 13, }, - ], - "name": "s", - "references": Array [ Object { - "$ref": 6, + "$ref": 16, + }, + Object { + "$ref": 17, + }, + Object { + "$ref": 18, }, ], "scope": Object { - "$ref": 8, + "$ref": 20, }, }, ], }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [ + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, Object { - "$ref": 4, + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 19, }, ], "type": "module", "upperScope": Object { - "$ref": 10, + "$ref": 22, }, "variableMap": Object { - "processEntity": Object { + "processOptionalCall": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 9, + "$ref": 21, }, "variables": Array [ Object { @@ -20355,17 +22754,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processEntity", + "name": "processOptionalCall", "range": Array [ 9, - 22, + 28, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 82, + 180, ], "type": "FunctionDeclaration", }, @@ -20376,18 +22775,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processEntity", + "name": "processOptionalCall", "range": Array [ 9, - 22, + 28, ], "type": "Identifier", }, ], - "name": "processEntity", + "name": "processOptionalCall", "references": Array [], "scope": Object { - "$ref": 9, + "$ref": 21, }, }, ], @@ -20400,213 +22799,205 @@ Object { Object { "$ref": 4, }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 19, + }, ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 10, + "$ref": 22, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` Object { - "$id": 3, + "$id": 11, "block": Object { "range": Array [ 0, - 30, + 142, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 10, "block": Object { "range": Array [ 0, - 30, + 142, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 3, - }, - "variableMap": Object { - "x": Object { - "$ref": 0, - }, - "y": Object { - "$ref": 1, - }, - }, - "variableScope": Object { - "$ref": 2, - }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ + "$id": 9, + "block": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { - "name": "x", + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", "range": Array [ - 4, - 11, + 47, + 50, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", + "kind": "r", + "resolved": Object { + "$ref": 2, }, - "parent": Object { + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", "range": Array [ - 0, - 12, + 59, + 62, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "x", - "range": Array [ - 4, - 11, - ], - "type": "Identifier", + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, }, - ], - "name": "x", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - Object { - "$id": 1, - "defs": Array [ Object { - "name": Object { - "name": "y", + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", "range": Array [ - 17, - 29, + 74, + 77, ], "type": "Identifier", }, - "node": Object { - "range": Array [ - 17, - 29, - ], - "type": "VariableDeclarator", + "kind": "r", + "resolved": Object { + "$ref": 2, }, - "parent": Object { + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", "range": Array [ - 13, - 30, + 89, + 92, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "y", - "range": Array [ - 17, - 29, - ], - "type": "Identifier", - }, - ], - "name": "y", - "references": Array [], - "scope": Object { - "$ref": 2, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` -Object { - "$id": 6, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 0, - 82, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 2, - "block": Object { - "range": Array [ - 26, - 31, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 5, + "$ref": 10, }, "variableMap": Object { "arguments": Object { "$ref": 1, }, + "one": Object { + "$ref": 2, + }, }, "variableScope": Object { - "$ref": 2, + "$ref": 9, }, "variables": Array [ Object { @@ -20617,76 +23008,66 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 9, }, }, - ], - }, - Object { - "$id": 4, - "block": Object { - "range": Array [ - 58, - 81, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 5, - }, - "variableMap": Object { - "X": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ Object { - "$id": 3, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "X", + "name": "one", "range": Array [ - 64, - 65, + 32, + 41, ], "type": "Identifier", }, "node": Object { "range": Array [ - 58, - 81, + 0, + 141, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, - "parent": undefined, - "type": "ClassName", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "one", "range": Array [ - 64, - 65, + 32, + 41, ], "type": "Identifier", }, ], - "name": "X", - "references": Array [], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + ], "scope": Object { - "$ref": 4, + "$ref": 9, }, }, ], @@ -20698,15 +23079,15 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 6, + "$ref": 11, }, "variableMap": Object { - "X": Object { + "processOptionalElement": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 5, + "$ref": 10, }, "variables": Array [ Object { @@ -20714,39 +23095,39 @@ Object { "defs": Array [ Object { "name": Object { - "name": "X", + "name": "processOptionalElement", "range": Array [ - 64, - 65, + 9, + 31, ], "type": "Identifier", }, "node": Object { "range": Array [ - 58, - 81, + 0, + 141, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, "parent": null, - "type": "ClassName", + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "X", + "name": "processOptionalElement", "range": Array [ - 64, - 65, + 9, + 31, ], "type": "Identifier", }, ], - "name": "X", + "name": "processOptionalElement", "references": Array [], "scope": Object { - "$ref": 5, + "$ref": 10, }, }, ], @@ -20760,19 +23141,69 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 6, + "$ref": 11, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/object-with-typed-methods.src 1`] = ` +exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 45, + 60, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 45, + 60, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/readonly-arrays.src 1`] = ` Object { "$id": 12, "block": Object { "range": Array [ 0, - 176, + 211, ], "type": "Program", }, @@ -20782,64 +23213,63 @@ Object { "block": Object { "range": Array [ 0, - 176, + 211, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 5, "block": Object { "range": Array [ - 29, - 61, + 0, + 106, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, }, - }, - "variableScope": Object { - "$ref": 3, - }, - "variables": Array [ Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 3, + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, }, + "writeExpr": undefined, }, ], - }, - Object { - "$id": 5, - "block": Object { - "range": Array [ - 68, - 100, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], "throughReferences": Array [], "type": "function", "upperScope": Object { @@ -20847,7 +23277,10 @@ Object { }, "variableMap": Object { "arguments": Object { - "$ref": 4, + "$ref": 1, + }, + "arr": Object { + "$ref": 2, }, }, "variableScope": Object { @@ -20855,7 +23288,7 @@ Object { }, "variables": Array [ Object { - "$id": 4, + "$id": 1, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], @@ -20865,44 +23298,51 @@ Object { "$ref": 5, }, }, - ], - }, - Object { - "$id": 7, - "block": Object { - "range": Array [ - 109, - 138, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 11, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 6, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ Object { - "$id": 6, - "defs": Array [], + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 106, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], + "identifiers": Array [ + Object { + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + }, + ], + "name": "arr", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], "scope": Object { - "$ref": 7, + "$ref": 5, }, }, ], @@ -20911,15 +23351,54 @@ Object { "$id": 10, "block": Object { "range": Array [ - 147, - 172, + 108, + 210, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 8, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "arr", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": undefined, + }, + ], "throughReferences": Array [], "type": "function", "upperScope": Object { @@ -20927,10 +23406,10 @@ Object { }, "variableMap": Object { "arguments": Object { - "$ref": 8, + "$ref": 6, }, - "x": Object { - "$ref": 9, + "arr": Object { + "$ref": 7, }, }, "variableScope": Object { @@ -20938,7 +23417,7 @@ Object { }, "variables": Array [ Object { - "$id": 8, + "$id": 6, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], @@ -20949,23 +23428,23 @@ Object { }, }, Object { - "$id": 9, + "$id": 7, "defs": Array [ Object { "name": Object { - "name": "x", + "name": "arr", "range": Array [ - 148, - 157, + 121, + 143, ], "type": "Identifier", }, "node": Object { "range": Array [ - 147, - 172, + 108, + 210, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "parent": null, "type": "Parameter", @@ -20974,16 +23453,23 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "x", + "name": "arr", "range": Array [ - 148, - 157, + 121, + 143, ], "type": "Identifier", }, ], - "name": "x", - "references": Array [], + "name": "arr", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 9, + }, + ], "scope": Object { "$ref": 10, }, @@ -20993,33 +23479,7 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 11, - }, - "identifier": Object { - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 174, - ], - "type": "ObjectExpression", - }, - }, - ], + "references": Array [], "throughReferences": Array [], "type": "module", "upperScope": Object { @@ -21041,26 +23501,39 @@ Object { "name": Object { "name": "foo", "range": Array [ - 6, 9, + 12, ], "type": "Identifier", }, "node": Object { "range": Array [ - 6, - 174, + 0, + 106, ], - "type": "VariableDeclarator", + "type": "FunctionDeclaration", }, - "parent": Object { + "parent": null, + "type": "FunctionName", + }, + Object { + "name": Object { + "name": "foo", "range": Array [ - 0, - 175, + 117, + 120, ], - "type": "VariableDeclaration", + "type": "Identifier", }, - "type": "Variable", + "node": Object { + "range": Array [ + 108, + 210, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", }, ], "eslintUsed": undefined, @@ -21068,18 +23541,22 @@ Object { Object { "name": "foo", "range": Array [ - 6, 9, + 12, ], "type": "Identifier", }, - ], - "name": "foo", - "references": Array [ Object { - "$ref": 1, + "name": "foo", + "range": Array [ + 117, + 120, + ], + "type": "Identifier", }, ], + "name": "foo", + "references": Array [], "scope": Object { "$ref": 11, }, @@ -21101,83 +23578,33 @@ Object { } `; -exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` -Object { - "$id": 1, - "block": Object { - "range": Array [ - 45, - 60, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 0, - "block": Object { - "range": Array [ - 45, - 60, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 1, - }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 0, - }, - "variables": Array [], - }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [], -} -`; - -exports[`typescript fixtures/basics/readonly-arrays.src 1`] = ` +exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` Object { - "$id": 12, + "$id": 8, "block": Object { "range": Array [ 0, - 211, + 119, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 11, + "$id": 7, "block": Object { "range": Array [ 0, - 211, + 119, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 6, "block": Object { "range": Array [ 0, - 106, + 118, ], "type": "FunctionDeclaration", }, @@ -21188,13 +23615,30 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 5, + "$ref": 6, }, "identifier": Object { - "name": "arr", + "name": "console", "range": Array [ - 45, - 48, + 50, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "pair", + "range": Array [ + 62, + 66, ], "type": "Identifier", }, @@ -21205,15 +23649,15 @@ Object { "writeExpr": undefined, }, Object { - "$id": 4, + "$id": 5, "from": Object { - "$ref": 5, + "$ref": 6, }, "identifier": Object { - "name": "arr", + "name": "pair", "range": Array [ - 75, - 78, + 84, + 88, ], "type": "Identifier", }, @@ -21224,21 +23668,25 @@ Object { "writeExpr": undefined, }, ], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], "type": "function", "upperScope": Object { - "$ref": 11, + "$ref": 7, }, "variableMap": Object { "arguments": Object { "$ref": 1, }, - "arr": Object { + "pair": Object { "$ref": 2, }, }, "variableScope": Object { - "$ref": 5, + "$ref": 6, }, "variables": Array [ Object { @@ -21249,7 +23697,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 5, + "$ref": 6, }, }, Object { @@ -21257,17 +23705,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "arr", + "name": "pair", "range": Array [ 13, - 39, + 44, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 106, + 118, ], "type": "FunctionDeclaration", }, @@ -21278,125 +23726,190 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "arr", + "name": "pair", "range": Array [ 13, - 39, + 44, ], "type": "Identifier", }, ], - "name": "arr", + "name": "pair", "references": Array [ Object { - "$ref": 3, + "$ref": 4, }, Object { - "$ref": 4, + "$ref": 5, }, ], "scope": Object { - "$ref": 5, + "$ref": 6, }, }, ], }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ Object { - "$id": 10, - "block": Object { - "range": Array [ - 108, - 210, - ], - "type": "FunctionDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ Object { - "$id": 8, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "arr", + "name": Object { + "name": "foo", "range": Array [ - 149, - 152, + 9, + 12, ], "type": "Identifier", }, - "kind": "r", - "resolved": Object { - "$ref": 7, - }, - "writeExpr": undefined, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 10, - }, - "identifier": Object { - "name": "arr", + "node": Object { "range": Array [ - 179, - 182, + 0, + 118, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 7, + "type": "FunctionDeclaration", }, - "writeExpr": undefined, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", }, ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/symbol-type-param.src 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 42, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 42, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 42, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 11, + "$ref": 4, }, "variableMap": Object { - "arguments": Object { - "$ref": 6, + "abc": Object { + "$ref": 2, }, - "arr": Object { - "$ref": 7, + "arguments": Object { + "$ref": 1, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 3, }, "variables": Array [ Object { - "$id": 6, + "$id": 1, "defs": Array [], "eslintUsed": undefined, "identifiers": Array [], "name": "arguments", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 3, }, }, Object { - "$id": 7, + "$id": 2, "defs": Array [ Object { "name": Object { - "name": "arr", + "name": "abc", "range": Array [ - 121, - 143, + 14, + 38, ], "type": "Identifier", }, "node": Object { "range": Array [ - 108, - 210, + 0, + 42, ], "type": "FunctionDeclaration", }, @@ -21407,25 +23920,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "arr", + "name": "abc", "range": Array [ - 121, - 143, + 14, + 38, ], "type": "Identifier", }, ], - "name": "arr", - "references": Array [ - Object { - "$ref": 8, - }, - Object { - "$ref": 9, - }, - ], + "name": "abc", + "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 3, }, }, ], @@ -21437,15 +23943,15 @@ Object { "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 12, + "$ref": 5, }, "variableMap": Object { - "foo": Object { + "test": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 11, + "$ref": 4, }, "variables": Array [ Object { @@ -21453,36 +23959,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "foo", + "name": "test", "range": Array [ 9, - 12, + 13, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 106, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - Object { - "name": Object { - "name": "foo", - "range": Array [ - 117, - 120, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 108, - 210, + 42, ], "type": "FunctionDeclaration", }, @@ -21493,26 +23980,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "foo", + "name": "test", "range": Array [ 9, - 12, - ], - "type": "Identifier", - }, - Object { - "name": "foo", - "range": Array [ - 117, - 120, + 13, ], "type": "Identifier", }, ], - "name": "foo", + "name": "test", "references": Array [], "scope": Object { - "$ref": 11, + "$ref": 4, }, }, ], @@ -21526,152 +24005,228 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 12, + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 31, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 31, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-in-arrow-function.src 1`] = ` Object { - "$id": 8, + "$id": 5, "block": Object { "range": Array [ 0, - 119, + 59, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 7, + "$id": 4, "block": Object { "range": Array [ 0, - 119, + 59, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 6, + "$id": 3, "block": Object { "range": Array [ - 0, - 118, + 21, + 58, ], - "type": "FunctionDeclaration", + "type": "ArrowFunctionExpression", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [ - Object { - "$id": 3, - "from": Object { - "$ref": 6, - }, - "identifier": Object { - "name": "console", - "range": Array [ - 50, - 57, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 4, - "from": Object { - "$ref": 6, - }, - "identifier": Object { - "name": "pair", - "range": Array [ - 62, - 66, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 6, - }, - "identifier": Object { - "name": "pair", - "range": Array [ - 84, - 88, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], + "references": Array [], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 7, + "$ref": 4, }, "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - "pair": Object { + "x": Object { "$ref": 2, }, }, "variableScope": Object { - "$ref": 6, + "$ref": 3, }, "variables": Array [ - Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 6, - }, - }, Object { "$id": 2, "defs": Array [ Object { "name": Object { - "name": "pair", + "name": "x", "range": Array [ - 13, - 44, + 22, + 28, ], "type": "Identifier", }, "node": Object { "range": Array [ - 0, - 118, + 21, + 58, ], - "type": "FunctionDeclaration", + "type": "ArrowFunctionExpression", }, "parent": null, "type": "Parameter", @@ -21680,25 +24235,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "pair", + "name": "x", "range": Array [ - 13, - 44, + 22, + 28, ], "type": "Identifier", }, ], - "name": "pair", - "references": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 5, - }, - ], + "name": "x", + "references": Array [], "scope": Object { - "$ref": 6, + "$ref": 3, }, }, ], @@ -21706,23 +24254,45 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [ + "references": Array [ Object { - "$ref": 3, + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "assertString", + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 21, + 58, + ], + "type": "ArrowFunctionExpression", + }, }, ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 8, + "$ref": 5, }, "variableMap": Object { - "foo": Object { + "assertString": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 7, + "$ref": 4, }, "variables": Array [ Object { @@ -21730,39 +24300,49 @@ Object { "defs": Array [ Object { "name": Object { - "name": "foo", + "name": "assertString", "range": Array [ - 9, - 12, + 6, + 18, ], "type": "Identifier", }, "node": Object { + "range": Array [ + 6, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { "range": Array [ 0, - 118, + 58, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, - "parent": null, - "type": "FunctionName", + "type": "Variable", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "foo", + "name": "assertString", "range": Array [ - 9, - 12, + 6, + 18, ], "type": "Identifier", }, ], - "name": "foo", - "references": Array [], + "name": "assertString", + "references": Array [ + Object { + "$ref": 1, + }, + ], "scope": Object { - "$ref": 7, + "$ref": 4, }, }, ], @@ -21771,28 +24351,24 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 3, - }, - ], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 8, + "$ref": 5, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/symbol-type-param.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-in-function.src 1`] = ` Object { "$id": 5, "block": Object { "range": Array [ 0, - 42, + 57, ], "type": "Program", }, @@ -21802,7 +24378,7 @@ Object { "block": Object { "range": Array [ 0, - 42, + 57, ], "type": "Program", }, @@ -21812,7 +24388,7 @@ Object { "block": Object { "range": Array [ 0, - 42, + 56, ], "type": "FunctionDeclaration", }, @@ -21826,12 +24402,12 @@ Object { "$ref": 4, }, "variableMap": Object { - "abc": Object { - "$ref": 2, - }, "arguments": Object { "$ref": 1, }, + "x": Object { + "$ref": 2, + }, }, "variableScope": Object { "$ref": 3, @@ -21853,17 +24429,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "abc", + "name": "x", "range": Array [ - 14, - 38, + 23, + 29, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 42, + 56, ], "type": "FunctionDeclaration", }, @@ -21874,15 +24450,15 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "abc", + "name": "x", "range": Array [ - 14, - 38, + 23, + 29, ], "type": "Identifier", }, ], - "name": "abc", + "name": "x", "references": Array [], "scope": Object { "$ref": 3, @@ -21900,7 +24476,7 @@ Object { "$ref": 5, }, "variableMap": Object { - "test": Object { + "assertsString": Object { "$ref": 0, }, }, @@ -21913,17 +24489,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "test", + "name": "assertsString", "range": Array [ 9, - 13, + 22, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 42, + 56, ], "type": "FunctionDeclaration", }, @@ -21934,15 +24510,15 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "test", + "name": "assertsString", "range": Array [ 9, - 13, + 22, ], "type": "Identifier", }, ], - "name": "test", + "name": "assertsString", "references": Array [], "scope": Object { "$ref": 4, @@ -21965,13 +24541,13 @@ Object { } `; -exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-in-interface.src 1`] = ` Object { "$id": 1, "block": Object { "range": Array [ 0, - 37, + 61, ], "type": "Program", }, @@ -21981,7 +24557,7 @@ Object { "block": Object { "range": Array [ 0, - 37, + 61, ], "type": "Program", }, @@ -22015,40 +24591,220 @@ Object { } `; -exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-in-method.src 1`] = ` Object { - "$id": 1, + "$id": 7, "block": Object { "range": Array [ 0, - 48, + 111, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 0, + "$id": 6, "block": Object { "range": Array [ 0, - 48, + 111, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 26, + 60, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + Object { + "$id": 4, + "block": Object { + "range": Array [ + 71, + 108, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "AssertsFoo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 110, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, + ], + "name": "AssertsFoo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, "references": Array [], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 1, + "$ref": 7, + }, + "variableMap": Object { + "AssertsFoo": Object { + "$ref": 0, + }, }, - "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 6, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 110, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, + ], + "name": "AssertsFoo", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], }, ], "functionExpressionScope": false, @@ -22059,46 +24815,197 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 7, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-arrow-function.src 1`] = ` Object { - "$id": 1, + "$id": 5, "block": Object { "range": Array [ 0, - 31, + 69, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 0, + "$id": 4, "block": Object { "range": Array [ 0, - 31, + 69, ], "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 21, + 68, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "x": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 68, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "assertString", + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 21, + 68, + ], + "type": "ArrowFunctionExpression", + }, + }, + ], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 1, + "$ref": 5, + }, + "variableMap": Object { + "assertString": Object { + "$ref": 0, + }, }, - "variableMap": Object {}, "variableScope": Object { - "$ref": 0, + "$ref": 4, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "assertString", + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 68, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 68, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "assertString", + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + }, + ], + "name": "assertString", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], }, ], "functionExpressionScope": false, @@ -22109,74 +25016,132 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 1, + "$ref": 5, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/type-assertion.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-function.src 1`] = ` Object { - "$id": 3, + "$id": 5, "block": Object { "range": Array [ 0, - 29, + 72, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 4, "block": Object { "range": Array [ 0, - 29, + 72, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "foo", + "$id": 3, + "block": Object { "range": Array [ - 6, - 9, + 0, + 71, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, - "kind": "w", - "resolved": Object { - "$ref": 0, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, }, - "writeExpr": Object { - "range": Array [ - 12, - 27, - ], - "type": "TSTypeAssertion", + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "x": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 3, }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 71, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 5, }, "variableMap": Object { - "foo": Object { + "assertsStringGuard": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 2, + "$ref": 4, }, "variables": Array [ Object { @@ -22184,49 +25149,39 @@ Object { "defs": Array [ Object { "name": Object { - "name": "foo", + "name": "assertsStringGuard", "range": Array [ - 6, 9, + 27, ], "type": "Identifier", }, "node": Object { - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", - }, - "parent": Object { "range": Array [ 0, - 28, + 71, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, - "type": "Variable", + "parent": null, + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "foo", + "name": "assertsStringGuard", "range": Array [ - 6, 9, + 27, ], "type": "Identifier", }, ], - "name": "foo", - "references": Array [ - Object { - "$ref": 1, - }, - ], + "name": "assertsStringGuard", + "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 4, }, }, ], @@ -22240,122 +25195,213 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 5, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-interface.src 1`] = ` Object { - "$id": 6, + "$id": 1, "block": Object { "range": Array [ 0, - 45, + 71, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 5, + "$id": 0, "block": Object { "range": Array [ 0, - 45, + 71, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/type-assertion-with-guard-in-method.src 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 131, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 131, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ - 22, - 42, + 0, + 130, ], - "type": "ArrowFunctionExpression", + "type": "ClassDeclaration", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { "$id": 3, - "from": Object { - "$ref": 4, + "block": Object { + "range": Array [ + 26, + 70, + ], + "type": "FunctionExpression", }, - "identifier": Object { - "name": "n", + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + Object { + "$id": 4, + "block": Object { "range": Array [ - 38, - 39, + 81, + 128, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, - "kind": "r", - "resolved": Object { - "$ref": 2, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, }, - "writeExpr": undefined, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "class", "upperScope": Object { - "$ref": 5, + "$ref": 6, }, "variableMap": Object { - "n": Object { - "$ref": 2, + "AssertsFoo": Object { + "$ref": 1, }, }, "variableScope": Object { - "$ref": 4, + "$ref": 6, }, "variables": Array [ Object { - "$id": 2, + "$id": 1, "defs": Array [ Object { "name": Object { - "name": "n", + "name": "AssertsFoo", "range": Array [ - 23, - 24, + 6, + 16, ], "type": "Identifier", }, "node": Object { "range": Array [ - 22, - 42, + 0, + 130, ], - "type": "ArrowFunctionExpression", + "type": "ClassDeclaration", }, - "parent": null, - "type": "Parameter", + "parent": undefined, + "type": "ClassName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "n", + "name": "AssertsFoo", "range": Array [ - 23, - 24, + 6, + 16, ], "type": "Identifier", }, ], - "name": "n", - "references": Array [ - Object { - "$ref": 3, - }, - ], + "name": "AssertsFoo", + "references": Array [], "scope": Object { - "$ref": 4, + "$ref": 5, }, }, ], @@ -22363,45 +25409,19 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "asserted2", - "range": Array [ - 4, - 13, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 16, - 43, - ], - "type": "TSTypeAssertion", - }, - }, - ], + "references": Array [], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 6, + "$ref": 7, }, "variableMap": Object { - "asserted2": Object { + "AssertsFoo": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 5, + "$ref": 6, }, "variables": Array [ Object { @@ -22409,49 +25429,39 @@ Object { "defs": Array [ Object { "name": Object { - "name": "asserted2", + "name": "AssertsFoo", "range": Array [ - 4, - 13, + 6, + 16, ], "type": "Identifier", }, "node": Object { - "range": Array [ - 4, - 43, - ], - "type": "VariableDeclarator", - }, - "parent": Object { "range": Array [ 0, - 44, + 130, ], - "type": "VariableDeclaration", + "type": "ClassDeclaration", }, - "type": "Variable", + "parent": null, + "type": "ClassName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "asserted2", + "name": "AssertsFoo", "range": Array [ - 4, - 13, + 6, + 16, ], "type": "Identifier", }, ], - "name": "asserted2", - "references": Array [ - Object { - "$ref": 1, - }, - ], + "name": "AssertsFoo", + "references": Array [], "scope": Object { - "$ref": 5, + "$ref": 6, }, }, ], @@ -22465,7 +25475,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 6, + "$ref": 7, }, "variables": Array [], } diff --git a/packages/parser/tests/lib/jsx.ts b/packages/parser/tests/lib/jsx.ts index 39548ea1b3b8..7055ca98d199 100644 --- a/packages/parser/tests/lib/jsx.ts +++ b/packages/parser/tests/lib/jsx.ts @@ -1,4 +1,4 @@ -import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; +import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/dist/jsx-known-issues'; import fs from 'fs'; import glob from 'glob'; import { diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index b1d34cc5c3d9..2f7c5d796091 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -9,6 +9,7 @@ "include": ["src"], "references": [ { "path": "../experimental-utils/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { "path": "../typescript-estree/tsconfig.build.json" }, + { "path": "../shared-fixtures/tsconfig.build.json" } ] } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index adda86ea16c6..a987c8b550de 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "rootDir": ".", - "noEmit": true + "composite": false, + "rootDir": "." }, "include": ["src", "tests", "tools"], "exclude": ["tests/fixtures"] diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts similarity index 100% rename from packages/shared-fixtures/fixtures/typescript/basics/type-assertion-arrow-function.src.ts rename to packages/shared-fixtures/fixtures/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/angle-bracket-type-assertion.src.ts similarity index 100% rename from packages/shared-fixtures/fixtures/typescript/basics/type-assertion.src.ts rename to packages/shared-fixtures/fixtures/typescript/basics/angle-bracket-type-assertion.src.ts diff --git a/packages/shared-fixtures/fixtures/typescript/basics/nullish-coalescing.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/nullish-coalescing.src.ts new file mode 100644 index 000000000000..6ecd2db00aaa --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/nullish-coalescing.src.ts @@ -0,0 +1,3 @@ +function processNullishCoalesce(s?: string) { + let len = (s ?? ''); +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts new file mode 100644 index 000000000000..7de9343489eb --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts @@ -0,0 +1,12 @@ +function processOptionalCall(one?: any) { + one?.fn(); + one?.two.fn(); + one.two?.fn(); + one.two?.three.fn(); + one.two?.three?.fn(); + + one?.(); + one?.()?.(); + + one?.().two; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access.src.ts new file mode 100644 index 000000000000..6a3ba4500d17 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access.src.ts @@ -0,0 +1,8 @@ +function processOptionalElement(one?: any) { + one?.[2]; + one?.[2][3]; + one[2]?.[3]; + one[2]?.[3]; + one[2]?.[3][4]; + one[2]?.[3]?.[4]; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain.src.ts new file mode 100644 index 000000000000..6fbf4219de01 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain.src.ts @@ -0,0 +1,7 @@ +function processOptional(one?: any) { + one?.two; + one?.two.three; + one.two?.three; + one.two?.three.four; + one.two?.three?.four; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-arrow-function.src.ts new file mode 100644 index 000000000000..584155016de8 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-arrow-function.src.ts @@ -0,0 +1,3 @@ +const assertString = (x: any): asserts x => { + return +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-function.src.ts new file mode 100644 index 000000000000..28727047a6d5 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-function.src.ts @@ -0,0 +1,3 @@ +function assertsString(x: any): asserts x { + return +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-interface.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-interface.src.ts new file mode 100644 index 000000000000..22b280ec535d --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-interface.src.ts @@ -0,0 +1,3 @@ +interface AssertFoo { + isString(node: any): asserts node; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-method.src.ts new file mode 100644 index 000000000000..5d2ab8745a1b --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-in-method.src.ts @@ -0,0 +1,8 @@ +class AssertsFoo { + isBar(): asserts this { + return; + } + isBaz = (): asserts this => { + return; + } +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts new file mode 100644 index 000000000000..586fda06dfda --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts @@ -0,0 +1,3 @@ +const assertString = (x: any): asserts x is string => { + return +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-function.src.ts new file mode 100644 index 000000000000..027a4c1197dd --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-function.src.ts @@ -0,0 +1,3 @@ +function assertsStringGuard(x: any): asserts x is string { + return +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-interface.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-interface.src.ts new file mode 100644 index 000000000000..fe226cfc388a --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-interface.src.ts @@ -0,0 +1,3 @@ +interface AssertFoo { + isString(node: any): asserts node is string; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-method.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-method.src.ts new file mode 100644 index 000000000000..146b4ce1484b --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/type-assertion-with-guard-in-method.src.ts @@ -0,0 +1,8 @@ +class AssertsFoo { + isBar(): asserts this is string { + return; + } + isBaz = (): asserts this is string => { + return; + } +} diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 6b55d5122d85..30eb5af18999 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,10 @@ { "name": "@typescript-eslint/shared-fixtures", "version": "2.3.3", - "private": true + "private": true, + "scripts": { + "build": "tsc -b tsconfig.build.json", + "clean": "tsc -b tsconfig.build.json --clean", + "typecheck": "tsc -p tsconfig.json --noEmit" + } } diff --git a/packages/shared-fixtures/tsconfig.build.json b/packages/shared-fixtures/tsconfig.build.json new file mode 100644 index 000000000000..a4799817b0e5 --- /dev/null +++ b/packages/shared-fixtures/tsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": ".", + "resolveJsonModule": true + }, + "files": [ + "jsx-known-issues.ts" + ] +} diff --git a/packages/shared-fixtures/tsconfig.json b/packages/shared-fixtures/tsconfig.json new file mode 100644 index 000000000000..75086e9799bd --- /dev/null +++ b/packages/shared-fixtures/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "files": [ + "jsx-known-issues.ts" + ] +} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 203fbe2b4947..598178158b01 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1676,7 +1676,7 @@ export class Converter { | TSESTree.LogicalExpression | TSESTree.BinaryExpression >(node, { - type: type, + type, operator: getTextForTokenKind(node.operatorToken.kind)!, left: this.converter( node.left, @@ -1689,36 +1689,90 @@ export class Converter { } } - case SyntaxKind.PropertyAccessExpression: - return this.createNode(node, { - type: AST_NODE_TYPES.MemberExpression, - object: this.convertChild(node.expression), - property: this.convertChild(node.name), - computed: false, - }); - - case SyntaxKind.ElementAccessExpression: - return this.createNode(node, { - type: AST_NODE_TYPES.MemberExpression, - object: this.convertChild(node.expression), - property: this.convertChild(node.argumentExpression), - computed: true, - }); + case SyntaxKind.PropertyAccessExpression: { + const isLocallyOptional = node.questionDotToken !== undefined; + const object = this.convertChild(node.expression); + const property = this.convertChild(node.name); + const computed = false; + if ( + isLocallyOptional || + // the optional expression should propogate up the member expression tree + object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression + ) { + return this.createNode(node, { + type: AST_NODE_TYPES.OptionalMemberExpression, + object, + property, + computed, + optional: isLocallyOptional, + }); + } else { + return this.createNode(node, { + type: AST_NODE_TYPES.MemberExpression, + object, + property, + computed, + optional: false, + }); + } + } - case SyntaxKind.ConditionalExpression: - return this.createNode(node, { - type: AST_NODE_TYPES.ConditionalExpression, - test: this.convertChild(node.condition), - consequent: this.convertChild(node.whenTrue), - alternate: this.convertChild(node.whenFalse), - }); + case SyntaxKind.ElementAccessExpression: { + const isLocallyOptional = node.questionDotToken !== undefined; + const object = this.convertChild(node.expression); + const property = this.convertChild(node.argumentExpression); + const computed = true; + if ( + isLocallyOptional || + // the optional expression should propogate up the member expression tree + object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression + ) { + return this.createNode(node, { + type: AST_NODE_TYPES.OptionalMemberExpression, + object, + property, + computed, + optional: isLocallyOptional, + }); + } else { + return this.createNode(node, { + type: AST_NODE_TYPES.MemberExpression, + object, + property, + computed, + optional: false, + }); + } + } case SyntaxKind.CallExpression: { - const result = this.createNode(node, { - type: AST_NODE_TYPES.CallExpression, - callee: this.convertChild(node.expression), - arguments: node.arguments.map(el => this.convertChild(el)), - }); + const isLocallyOptional = node.questionDotToken !== undefined; + const callee = this.convertChild(node.expression); + const args = node.arguments.map(el => this.convertChild(el)); + let result; + if ( + isLocallyOptional || + // the optional expression should propogate up the member expression tree + callee.type === AST_NODE_TYPES.OptionalMemberExpression || + callee.type === AST_NODE_TYPES.OptionalCallExpression + ) { + result = this.createNode(node, { + type: AST_NODE_TYPES.OptionalCallExpression, + callee, + arguments: args, + optional: isLocallyOptional, + }); + } else { + result = this.createNode(node, { + type: AST_NODE_TYPES.CallExpression, + callee, + arguments: args, + optional: false, + }); + } + if (node.typeArguments) { result.typeParameters = this.convertTypeArgumentsToTypeParameters( node.typeArguments, @@ -1728,6 +1782,7 @@ export class Converter { } case SyntaxKind.NewExpression: { + // NOTE - NewExpression cannot have an optional chain in it const result = this.createNode(node, { type: AST_NODE_TYPES.NewExpression, callee: this.convertChild(node.expression), @@ -1743,6 +1798,14 @@ export class Converter { return result; } + case SyntaxKind.ConditionalExpression: + return this.createNode(node, { + type: AST_NODE_TYPES.ConditionalExpression, + test: this.convertChild(node.condition), + consequent: this.convertChild(node.whenTrue), + alternate: this.convertChild(node.whenFalse), + }); + case SyntaxKind.MetaProperty: { return this.createNode(node, { type: AST_NODE_TYPES.MetaProperty, @@ -2367,15 +2430,19 @@ export class Converter { case SyntaxKind.TypePredicate: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypePredicate, + asserts: node.assertsModifier !== undefined, parameterName: this.convertChild(node.parameterName), - typeAnnotation: this.convertTypeAnnotation(node.type, node), + typeAnnotation: null, }); /** * Specific fix for type-guard location data */ - result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; - result.typeAnnotation.range = - result.typeAnnotation.typeAnnotation.range; + if (node.type) { + result.typeAnnotation = this.convertTypeAnnotation(node.type, node); + result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; + result.typeAnnotation.range = + result.typeAnnotation.typeAnnotation.range; + } return result; } diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index c23daf6e3173..392c08fabb82 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -20,9 +20,12 @@ const ASSIGNMENT_OPERATORS: ts.AssignmentOperator[] = [ SyntaxKind.CaretEqualsToken, ]; -const LOGICAL_OPERATORS: ts.LogicalOperator[] = [ +const LOGICAL_OPERATORS: ( + | ts.LogicalOperator + | ts.SyntaxKind.QuestionQuestionToken)[] = [ SyntaxKind.BarBarToken, SyntaxKind.AmpersandAmpersandToken, + SyntaxKind.QuestionQuestionToken, ]; const TOKEN_TO_TEXT: { readonly [P in ts.SyntaxKind]?: string } = { @@ -87,6 +90,8 @@ const TOKEN_TO_TEXT: { readonly [P in ts.SyntaxKind]?: string } = { [SyntaxKind.NewKeyword]: 'new', [SyntaxKind.ImportKeyword]: 'import', [SyntaxKind.ReadonlyKeyword]: 'readonly', + [SyntaxKind.QuestionQuestionToken]: '??', + [SyntaxKind.QuestionDotToken]: '?.', }; /** @@ -94,10 +99,10 @@ const TOKEN_TO_TEXT: { readonly [P in ts.SyntaxKind]?: string } = { * @param operator the operator token * @returns is assignment */ -export function isAssignmentOperator( - operator: ts.Token, +export function isAssignmentOperator( + operator: ts.Token, ): boolean { - return ASSIGNMENT_OPERATORS.includes(operator.kind); + return (ASSIGNMENT_OPERATORS as ts.SyntaxKind[]).includes(operator.kind); } /** @@ -105,10 +110,10 @@ export function isAssignmentOperator( * @param operator the operator token * @returns is a logical operator */ -export function isLogicalOperator( - operator: ts.Token, +export function isLogicalOperator( + operator: ts.Token, ): boolean { - return LOGICAL_OPERATORS.includes(operator.kind); + return (LOGICAL_OPERATORS as ts.SyntaxKind[]).includes(operator.kind); } /** @@ -195,10 +200,8 @@ export function isJSDocComment(node: ts.Node): boolean { * @param operator the operator token * @returns the binary expression type */ -export function getBinaryExpressionType( - // can be any operator - // eslint-disable-next-line @typescript-eslint/no-explicit-any - operator: ts.Token, +export function getBinaryExpressionType( + operator: ts.Token, ): | AST_NODE_TYPES.AssignmentExpression | AST_NODE_TYPES.LogicalExpression diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 75d3983cf55c..07435780a37d 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -19,7 +19,7 @@ import { * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.7.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/typescript-estree/src/ts-estree/ast-node-types.ts b/packages/typescript-estree/src/ts-estree/ast-node-types.ts index b7ff28646a68..13f2485819f0 100644 --- a/packages/typescript-estree/src/ts-estree/ast-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/ast-node-types.ts @@ -61,6 +61,8 @@ export enum AST_NODE_TYPES { NewExpression = 'NewExpression', ObjectExpression = 'ObjectExpression', ObjectPattern = 'ObjectPattern', + OptionalCallExpression = 'OptionalCallExpression', + OptionalMemberExpression = 'OptionalMemberExpression', Program = 'Program', Property = 'Property', RestElement = 'RestElement', diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 799c3e917c0b..178ed9efe59d 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -139,6 +139,8 @@ export type Node = | NewExpression | ObjectExpression | ObjectPattern + | OptionalCallExpression + | OptionalMemberExpression | Program | Property | RestElement @@ -323,6 +325,8 @@ export type LeftHandSideExpression = | FunctionExpression | LiteralExpression | MemberExpression + | OptionalCallExpression + | OptionalMemberExpression | PrimaryExpression | TaggedTemplateExpression | TSNonNullExpression @@ -426,8 +430,8 @@ export type TypeNode = | TSTupleType | TSTypeLiteral | TSTypeOperator - | TSTypeReference | TSTypePredicate + | TSTypeReference | TSTypeQuery | TSUndefinedKeyword | TSUnionType @@ -591,11 +595,19 @@ export interface BreakStatement extends BaseNode { label: Identifier | null; } -export interface CallExpression extends BaseNode { - type: AST_NODE_TYPES.CallExpression; +interface CallExpressionBase extends BaseNode { callee: LeftHandSideExpression; arguments: Expression[]; typeParameters?: TSTypeParameterInstantiation; + optional: boolean; +} +export interface CallExpression extends CallExpressionBase { + type: AST_NODE_TYPES.CallExpression; + optional: false; +} +export interface OptionalCallExpression extends CallExpressionBase { + type: AST_NODE_TYPES.OptionalCallExpression; + optional: boolean; } export interface CatchClause extends BaseNode { @@ -843,11 +855,19 @@ export interface LogicalExpression extends BinaryExpressionBase { type: AST_NODE_TYPES.LogicalExpression; } -export interface MemberExpression extends BaseNode { - type: AST_NODE_TYPES.MemberExpression; +interface MemberExpressionBase extends BaseNode { object: LeftHandSideExpression; property: Expression | Identifier; - computed?: boolean; + computed: boolean; + optional: boolean; +} +export interface MemberExpression extends MemberExpressionBase { + type: AST_NODE_TYPES.MemberExpression; + optional: false; +} +export interface OptionalMemberExpression extends MemberExpressionBase { + type: AST_NODE_TYPES.OptionalMemberExpression; + optional: boolean; } export interface MetaProperty extends BaseNode { @@ -1346,8 +1366,9 @@ export interface TSTypeParameterInstantiation extends BaseNode { export interface TSTypePredicate extends BaseNode { type: AST_NODE_TYPES.TSTypePredicate; + asserts: boolean; parameterName: Identifier | TSThisType; - typeAnnotation: TSTypeAnnotation; + typeAnnotation: TSTypeAnnotation | null; } export interface TSTypeQuery extends BaseNode { 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 59c7b8b2b554..68639cb01b55 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -1,4 +1,4 @@ -import jsxKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; +import jsxKnownIssues from '@typescript-eslint/shared-fixtures/dist/jsx-known-issues'; import fs from 'fs'; import glob from 'glob'; import path from 'path'; @@ -123,7 +123,18 @@ const jsxFilesWithKnownIssues = jsxKnownIssues.map(f => f.replace('jsx/', '')); */ jsxFilesWithKnownIssues.push('invalid-no-tag-name'); -tester.addFixturePatternConfig('javascript/basics'); +tester.addFixturePatternConfig('javascript/basics', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'delete-expression', + 'new-with-member-expression', + 'update-expression', + ], +}); tester.addFixturePatternConfig('comments', { ignore: [ @@ -133,6 +144,18 @@ tester.addFixturePatternConfig('comments', { */ 'no-comment-template', // Purely AST diffs 'template-string-block', // Purely AST diffs + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'block-trailing-comment', + 'jsx-with-greather-than', + 'jsx-with-operators', + 'surrounding-call-comments', + 'switch-fallthrough-comment-in-function', + 'switch-fallthrough-comment', + 'switch-no-default-comment-in-nested-functions', ], }); @@ -140,13 +163,31 @@ tester.addFixturePatternConfig('javascript/templateStrings', { ignore: ['**/*'], }); -tester.addFixturePatternConfig('javascript/arrayLiteral'); +tester.addFixturePatternConfig('javascript/arrayLiteral', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'array-literal-in-lhs', + ], +}); tester.addFixturePatternConfig('javascript/simple-literals'); tester.addFixturePatternConfig('javascript/directives'); -tester.addFixturePatternConfig('javascript/experimentalObjectRestSpread'); +tester.addFixturePatternConfig('javascript/experimentalObjectRestSpread', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'property-spread', + ], +}); tester.addFixturePatternConfig('javascript/arrowFunctions', { ignore: [ @@ -177,6 +218,13 @@ tester.addFixturePatternConfig('javascript/arrowFunctions', { 'error-strict-param-names', 'error-strict-param-no-paren-arguments', 'error-strict-param-no-paren-eval', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'as-param-with-params', + 'as-param', ], }); tester.addFixturePatternConfig('javascript/function', { @@ -193,7 +241,18 @@ tester.addFixturePatternConfig('javascript/bigIntLiterals'); tester.addFixturePatternConfig('javascript/binaryLiterals'); tester.addFixturePatternConfig('javascript/blockBindings'); -tester.addFixturePatternConfig('javascript/callExpression'); +tester.addFixturePatternConfig('javascript/callExpression', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'call-expression-with-array', + 'call-expression-with-object', + 'mixed-expression', + ], +}); tester.addFixturePatternConfig('javascript/classes', { ignore: [ @@ -212,7 +271,18 @@ tester.addFixturePatternConfig('javascript/commaOperator'); tester.addFixturePatternConfig('javascript/defaultParams'); -tester.addFixturePatternConfig('javascript/destructuring'); +tester.addFixturePatternConfig('javascript/destructuring', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'array-member', + 'call-expression-destruction-array', + 'call-expression-destruction-object', + ], +}); tester.addFixturePatternConfig('javascript/destructuring-and-arrowFunctions'); tester.addFixturePatternConfig('javascript/destructuring-and-blockBindings'); tester.addFixturePatternConfig('javascript/destructuring-and-defaultParams'); @@ -220,11 +290,29 @@ tester.addFixturePatternConfig('javascript/destructuring-and-forOf'); tester.addFixturePatternConfig('javascript/destructuring-and-spread'); tester.addFixturePatternConfig('javascript/experimentalAsyncIteration'); -tester.addFixturePatternConfig('javascript/experimentalDynamicImport'); +tester.addFixturePatternConfig('javascript/experimentalDynamicImport', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'dynamic-import', + ], +}); tester.addFixturePatternConfig('javascript/exponentiationOperators'); tester.addFixturePatternConfig('javascript/experimentalOptionalCatchBinding'); -tester.addFixturePatternConfig('javascript/for'); +tester.addFixturePatternConfig('javascript/for', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'for-with-function', + ], +}); tester.addFixturePatternConfig('javascript/forIn', { ignore: [ /** @@ -242,14 +330,54 @@ tester.addFixturePatternConfig('javascript/forIn', { * SyntaxError: Invalid left-hand side in for-loop */ 'for-in-with-bare-assigment', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'for-in-with-const', + 'for-in-with-var', ], }); -tester.addFixturePatternConfig('javascript/forOf'); -tester.addFixturePatternConfig('javascript/generators'); +tester.addFixturePatternConfig('javascript/forOf', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'for-of-array', + 'for-of-object', + 'for-of-with-var-and-braces', + 'for-of-with-var-and-no-braces', + 'invalid-for-of-with-const-and-no-braces', + 'invalid-for-of-with-let-and-no-braces', + ], +}); +tester.addFixturePatternConfig('javascript/generators', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'async-generator-method', + 'yield-without-value-in-call', + ], +}); tester.addFixturePatternConfig('javascript/globalReturn'); tester.addFixturePatternConfig('javascript/hexLiterals'); -tester.addFixturePatternConfig('javascript/importMeta'); +tester.addFixturePatternConfig('javascript/importMeta', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'simple-import-meta', + ], +}); tester.addFixturePatternConfig('javascript/labels'); tester.addFixturePatternConfig('javascript/modules', { @@ -266,10 +394,16 @@ tester.addFixturePatternConfig('javascript/modules', { 'export-named-specifier', 'export-named-specifiers-comma', 'export-named-specifiers', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'error-strict', ], ignoreSourceType: [ 'error-function', - 'error-strict', + // 'error-strict', 'error-delete', 'invalid-await', ], @@ -277,7 +411,16 @@ tester.addFixturePatternConfig('javascript/modules', { tester.addFixturePatternConfig('javascript/newTarget'); -tester.addFixturePatternConfig('javascript/objectLiteral'); +tester.addFixturePatternConfig('javascript/objectLiteral', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'object-literal-in-lhs', + ], +}); tester.addFixturePatternConfig('javascript/objectLiteralComputedProperties'); tester.addFixturePatternConfig('javascript/objectLiteralDuplicateProperties', { @@ -314,7 +457,18 @@ tester.addFixturePatternConfig('javascript/regex'); tester.addFixturePatternConfig('javascript/regexUFlag'); tester.addFixturePatternConfig('javascript/regexYFlag'); tester.addFixturePatternConfig('javascript/restParams'); -tester.addFixturePatternConfig('javascript/spread'); +tester.addFixturePatternConfig('javascript/spread', { + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'multi-function-call', + 'not-final-param', + 'simple-function-call', + ], +}); tester.addFixturePatternConfig('javascript/unicodeCodePointEscapes'); /* ================================================== */ @@ -332,6 +486,14 @@ tester.addFixturePatternConfig('jsx-useJSXTextNode'); tester.addFixturePatternConfig('tsx', { fileType: 'tsx', + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'react-typed-props', + ], }); /* ================================================== */ @@ -415,6 +577,34 @@ tester.addFixturePatternConfig('typescript/basics', { * SyntaxError: 'abstract' modifier can only appear on a class, method, or property declaration. */ 'abstract-class-with-abstract-constructor', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'optional-chain', + 'optional-chain-call', + 'optional-chain-element-access', + 'async-function-expression', + 'class-with-accessibility-modifiers', + 'class-with-mixin', + 'global-this', + 'never-type-param', + 'non-null-assertion-operator', + 'type-parameters-comments', + // type assertion function + 'type-assertion-in-function', + 'type-assertion-in-arrow-function', + 'type-assertion-in-interface', + 'type-assertion-in-method', + 'type-guard-in-arrow-function', + 'type-guard-in-function', + 'type-guard-in-interface', + 'type-guard-in-method', + 'type-assertion-with-guard-in-arrow-function', + 'type-assertion-with-guard-in-function', + 'type-assertion-with-guard-in-interface', + 'type-assertion-with-guard-in-method', ], ignoreSourceType: [ /** @@ -429,12 +619,40 @@ tester.addFixturePatternConfig('typescript/basics', { tester.addFixturePatternConfig('typescript/decorators/accessor-decorators', { fileType: 'ts', + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'accessor-decorator-factory-instance-member', + 'accessor-decorator-factory-static-member', + 'accessor-decorator-instance-member', + 'accessor-decorator-static-member', + ], }); tester.addFixturePatternConfig('typescript/decorators/class-decorators', { fileType: 'ts', + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'class-decorator-factory', + ], }); tester.addFixturePatternConfig('typescript/decorators/method-decorators', { fileType: 'ts', + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'method-decorator-factory-instance-member', + 'method-decorator-factory-static-member', + ], }); tester.addFixturePatternConfig('typescript/decorators/parameter-decorators', { fileType: 'ts', @@ -445,10 +663,28 @@ tester.addFixturePatternConfig('typescript/decorators/parameter-decorators', { */ 'parameter-array-pattern-decorator', 'parameter-rest-element-decorator', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'parameter-decorator-constructor', + 'parameter-decorator-decorator-instance-member', + 'parameter-decorator-decorator-static-member', + 'parameter-object-pattern-decorator', ], }); tester.addFixturePatternConfig('typescript/decorators/property-decorators', { fileType: 'ts', + ignore: [ + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'property-decorator-factory-instance-member', + 'property-decorator-factory-static-member', + ], }); tester.addFixturePatternConfig('typescript/expressions', { @@ -458,6 +694,12 @@ tester.addFixturePatternConfig('typescript/expressions', { * there is difference in range between babel and ts-estree */ 'tagged-template-expression-type-arguments', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'call-expression-type-arguments', ], }); @@ -497,6 +739,12 @@ tester.addFixturePatternConfig('typescript/types', { * Babel parse error: https://github.com/babel/babel/pull/9431 */ 'function-with-array-destruction', + /** + * TS 3.7 feature changes + * TODO: remove me when babel adds support + */ + // optional chaining + 'this-type-expanded', ], }); diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 7fba488c78d8..b236e5a9861b 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -31,6 +31,8 @@ function parseWithBabelParser(text: string, jsx = true): any { 'estree', 'bigInt', 'importMeta', + 'optionalChaining', + 'nullishCoalescingOperator', ]; if (jsx) { plugins.push('jsx'); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap index b90f5eb45487..5671b2447c12 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap @@ -36,6 +36,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 6, 9, @@ -11708,6 +11709,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 24, 37, @@ -12589,6 +12591,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 24, 37, @@ -14189,6 +14192,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 36, 41, @@ -15965,6 +15969,7 @@ Object { "line": 6, }, }, + "optional": false, "range": Array [ 82, 88, @@ -16485,6 +16490,7 @@ Object { "line": 7, }, }, + "optional": false, "range": Array [ 126, 132, @@ -18181,6 +18187,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18277,6 +18284,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18301,6 +18309,7 @@ Object { ], "type": "MemberExpression", }, + "optional": false, "property": Object { "left": Object { "computed": false, @@ -18344,6 +18353,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18368,6 +18378,7 @@ Object { ], "type": "MemberExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18463,6 +18474,7 @@ Object { "line": 6, }, }, + "optional": false, "range": Array [ 161, 218, @@ -18552,6 +18564,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index 5bf7a0b6adc3..a73f908a3623 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -66,12 +66,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "CallExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -628,6 +630,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 13, @@ -946,6 +949,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 17, @@ -11542,6 +11546,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -13162,6 +13167,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -15832,6 +15838,7 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 35, 38, @@ -17972,6 +17979,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 7, @@ -18177,6 +18185,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 7, @@ -18453,6 +18462,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -18487,6 +18497,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 36, 53, @@ -18556,6 +18567,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 17, 62, @@ -18625,6 +18637,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 70, @@ -22743,6 +22756,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 27, 34, @@ -38075,6 +38089,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -39051,6 +39066,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 10, @@ -39291,6 +39307,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 10, @@ -80454,12 +80471,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 13, ], "type": "CallExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -80494,6 +80513,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 24, @@ -83775,6 +83795,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -91233,6 +91254,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -91267,6 +91289,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 16, 33, @@ -95213,6 +95236,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 25, 35, @@ -95964,6 +95988,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 22, 32, @@ -97229,6 +97254,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 20, 30, @@ -97615,6 +97641,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 22, 35, @@ -98891,6 +98918,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 22, 35, @@ -99296,6 +99324,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 53, 63, @@ -100454,6 +100483,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 25, 38, @@ -100875,6 +100905,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 23, 36, @@ -101243,6 +101274,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 25, 38, @@ -101611,6 +101643,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 23, 36, @@ -103778,6 +103811,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 53, 56, @@ -106000,6 +106034,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 16, 25, @@ -107221,6 +107256,7 @@ Object { ], "type": "MetaProperty", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -108920,6 +108956,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -108954,6 +108991,7 @@ Object { "line": 4, }, }, + "optional": false, "range": Array [ 44, 61, @@ -122445,12 +122483,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "CallExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -139914,6 +139954,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 12, @@ -140190,6 +140231,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 13, @@ -140448,6 +140490,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 9, @@ -142772,6 +142815,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -142806,6 +142850,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 40, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 52d62f3fd906..645b6114f8ac 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -1661,6 +1661,10 @@ Object { } `; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/angle-bracket-type-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/angle-bracket-type-assertion-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-optional-parameter.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/arrow-function-with-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1904,10 +1908,18 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/null-and-undefined-type-annotations.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/nullish-coalescing.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/object-with-escaped-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/object-with-typed-methods.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/parenthesized-use-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-arrays.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -1922,9 +1934,21 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-alias-object-without-annotation.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-interface.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; -exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-assertion-with-guard-in-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/type-guard-in-arrow-function.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap index f5722861dd24..c1ba4580efde 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap @@ -447,6 +447,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -481,6 +482,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 37, 51, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap index 76cb6fb260d5..c0240d2580e9 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap @@ -1192,6 +1192,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 5cbee776bf20..44425c5e4a57 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -3106,6 +3106,816 @@ Object { } `; +exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "asserted2", + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 22, + 42, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 43, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + "value": "asserted2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "n", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "n", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` Object { "body": Array [ @@ -3219,6 +4029,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 17, @@ -4153,6 +4964,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 29, @@ -5173,6 +5985,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 37, 42, @@ -5260,6 +6073,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -9198,6 +10012,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -9349,6 +10164,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -17796,6 +18612,7 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 102, 111, @@ -50279,6 +51096,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -50461,6 +51279,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -57198,6 +58017,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -62963,6 +63783,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -62997,6 +63818,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 44, @@ -63440,6 +64262,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 41, 58, @@ -63530,6 +64353,7 @@ Object { ], "type": "TSNonNullExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -64535,6 +65359,595 @@ Object { } `; +exports[`typescript fixtures/basics/nullish-coalescing.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "len", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "operator": "??", + "range": Array [ + 59, + 66, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 67, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processNullishCoalesce", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "s", + "optional": true, + "range": Array [ + 32, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 70, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processNullishCoalesce", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "len", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "Punctuator", + "value": "??", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` Object { "body": Array [ @@ -67404,140 +68817,7 @@ Object { } `; -exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "range": Array [ - 46, - 58, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 45, - 60, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 45, - 60, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, - }, - }, - "range": Array [ - 46, - 58, - ], - "type": "String", - "value": "\\"use strict\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 58, - 59, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 59, - 60, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/readonly-arrays.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain.src 1`] = ` Object { "body": Array [ Object { @@ -67546,12 +68826,21 @@ Object { "body": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { - "computed": false, + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { "loc": Object { "end": Object { - "column": 11, + "column": 5, "line": 2, }, "start": Object { @@ -67559,67 +68848,41 @@ Object { "line": 2, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "name": "one", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, }, - "name": "arr", - "range": Array [ - 45, - 48, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, + "start": Object { + "column": 7, + "line": 2, }, - "name": "slice", - "range": Array [ - 49, - 54, - ], - "type": "Identifier", }, + "name": "two", "range": Array [ 45, - 54, + 48, ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, + "type": "Identifier", }, "range": Array [ - 45, - 56, + 40, + 48, ], - "type": "CallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 2, }, "start": Object { @@ -67628,35 +68891,25 @@ Object { }, }, "range": Array [ - 45, - 57, + 40, + 49, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 84, - 92, - ], - "raw": "\\"hello!\\"", - "type": "Literal", - "value": "hello!", + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, }, - ], - "callee": Object { + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { "computed": false, "loc": Object { "end": Object { @@ -67679,13 +68932,14 @@ Object { "line": 3, }, }, - "name": "arr", + "name": "one", "range": Array [ - 75, - 78, + 52, + 55, ], "type": "Identifier", }, + "optional": true, "property": Object { "loc": Object { "end": Object { @@ -67693,42 +68947,51 @@ Object { "line": 3, }, "start": Object { - "column": 6, + "column": 7, "line": 3, }, }, - "name": "push", + "name": "two", "range": Array [ - 79, - 83, + 57, + 60, ], "type": "Identifier", }, "range": Array [ - 75, - 83, + 52, + 60, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, }, + "name": "three", + "range": Array [ + 61, + 66, + ], + "type": "Identifier", }, "range": Array [ - 75, - 93, + 52, + 66, ], - "type": "CallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 3, }, "start": Object { @@ -67737,371 +69000,409 @@ Object { }, }, "range": Array [ - 75, - 94, + 52, + 67, ], "type": "ExpressionStatement", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 106, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "arr", - "range": Array [ - 13, - 39, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 39, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + Object { + "expression": Object { + "computed": false, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 4, }, }, - "range": Array [ - 18, - 39, - ], - "type": "TSTypeReference", - "typeName": Object { + "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 9, + "line": 4, }, "start": Object { - "column": 18, - "line": 1, + "column": 2, + "line": 4, }, }, - "name": "ReadonlyArray", + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 70, + 73, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, "range": Array [ - 18, - 31, + 70, + 77, ], - "type": "Identifier", + "type": "MemberExpression", }, - "typeParameters": Object { + "optional": true, + "property": Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 31, - "line": 1, + "column": 11, + "line": 4, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - ], + "name": "three", "range": Array [ - 31, - 39, + 79, + 84, ], - "type": "TSTypeParameterInstantiation", + "type": "Identifier", + }, + "range": Array [ + 70, + 84, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, }, }, + "range": Array [ + 70, + 85, + ], + "type": "ExpressionStatement", }, - }, - ], - "range": Array [ - 0, - 106, - ], - "type": "FunctionDeclaration", - }, - Object { - "async": false, - "body": Object { - "body": Array [ Object { "expression": Object { - "arguments": Array [], - "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { "computed": false, "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 16, + "line": 5, }, "start": Object { "column": 2, - "line": 7, + "line": 5, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 9, + "line": 5, }, "start": Object { "column": 2, - "line": 7, + "line": 5, }, }, - "name": "arr", + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 88, + 91, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 92, + 95, + ], + "type": "Identifier", + }, "range": Array [ - 149, - 152, + 88, + 95, ], - "type": "Identifier", + "type": "MemberExpression", }, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 16, + "line": 5, }, "start": Object { - "column": 6, - "line": 7, + "column": 11, + "line": 5, }, }, - "name": "slice", + "name": "three", "range": Array [ - 153, - 158, + 97, + 102, ], "type": "Identifier", }, "range": Array [ - 149, - 158, + 88, + 102, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 13, - "line": 7, - }, - "start": Object { - "column": 2, - "line": 7, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, }, + "name": "four", + "range": Array [ + 103, + 107, + ], + "type": "Identifier", }, "range": Array [ - 149, - 160, + 88, + 107, ], - "type": "CallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 22, + "line": 5, }, "start": Object { "column": 2, - "line": 7, + "line": 5, }, }, "range": Array [ - 149, - 161, + 88, + 108, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "range": Array [ - 188, - 196, - ], - "raw": "\\"hello!\\"", - "type": "Literal", - "value": "hello!", + "computed": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, }, - ], - "callee": Object { + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { "computed": false, "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 16, + "line": 6, }, "start": Object { "column": 2, - "line": 8, + "line": 6, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 9, + "line": 6, }, "start": Object { "column": 2, - "line": 8, + "line": 6, }, }, - "name": "arr", + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 115, + 118, + ], + "type": "Identifier", + }, "range": Array [ - 179, - 182, + 111, + 118, ], - "type": "Identifier", + "type": "MemberExpression", }, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 16, + "line": 6, }, "start": Object { - "column": 6, - "line": 8, + "column": 11, + "line": 6, }, }, - "name": "push", + "name": "three", "range": Array [ - 183, - 187, + 120, + 125, ], "type": "Identifier", }, "range": Array [ - 179, - 187, + 111, + 125, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "loc": Object { - "end": Object { - "column": 20, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 8, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, }, + "name": "four", + "range": Array [ + 127, + 131, + ], + "type": "Identifier", }, "range": Array [ - 179, - 197, + 111, + 131, ], - "type": "CallExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 21, - "line": 8, + "column": 23, + "line": 6, }, "start": Object { "column": 2, - "line": 8, + "line": 6, }, }, "range": Array [ - 179, - 198, + 111, + 132, ], "type": "ExpressionStatement", }, @@ -68109,16 +69410,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 9, + "line": 7, }, "start": Object { - "column": 37, - "line": 6, + "column": 36, + "line": 1, }, }, "range": Array [ - 145, - 210, + 36, + 134, ], "type": "BlockStatement", }, @@ -68127,123 +69428,89 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 24, + "line": 1, }, "start": Object { "column": 9, - "line": 6, + "line": 1, }, }, - "name": "foo", + "name": "processOptional", "range": Array [ - 117, - 120, + 9, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 9, + "line": 7, }, "start": Object { "column": 0, - "line": 6, + "line": 1, }, }, "params": Array [ Object { "loc": Object { "end": Object { - "column": 35, - "line": 6, + "column": 34, + "line": 1, }, "start": Object { - "column": 13, - "line": 6, + "column": 25, + "line": 1, }, }, - "name": "arr", + "name": "one", + "optional": true, "range": Array [ - 121, - 143, + 25, + 34, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, - "line": 6, + "column": 34, + "line": 1, }, "start": Object { - "column": 16, - "line": 6, + "column": 29, + "line": 1, }, }, "range": Array [ - 124, - 143, + 29, + 34, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 35, - "line": 6, + "column": 34, + "line": 1, }, "start": Object { - "column": 18, - "line": 6, + "column": 31, + "line": 1, }, }, - "operator": "readonly", "range": Array [ - 126, - 143, + 31, + 34, ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 6, - }, - "start": Object { - "column": 27, - "line": 6, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 6, - }, - "start": Object { - "column": 27, - "line": 6, - }, - }, - "range": Array [ - 135, - 143, - ], - "type": "TSArrayType", - }, + "type": "TSAnyKeyword", }, }, }, ], "range": Array [ - 108, - 210, + 0, + 134, ], "type": "FunctionDeclaration", }, @@ -68251,7 +69518,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 8, }, "start": Object { "column": 0, @@ -68260,7 +69527,7 @@ Object { }, "range": Array [ 0, - 211, + 135, ], "sourceType": "script", "tokens": Array [ @@ -68285,7 +69552,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 24, "line": 1, }, "start": Object { @@ -68295,25 +69562,25 @@ Object { }, "range": Array [ 9, - 12, + 24, ], "type": "Identifier", - "value": "foo", + "value": "processOptional", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 25, "line": 1, }, "start": Object { - "column": 12, + "column": 24, "line": 1, }, }, "range": Array [ - 12, - 13, + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -68321,61 +69588,61 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 28, "line": 1, }, "start": Object { - "column": 13, + "column": 25, "line": 1, }, }, "range": Array [ - 13, - 16, + 25, + 28, ], "type": "Identifier", - "value": "arr", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 29, "line": 1, }, "start": Object { - "column": 16, + "column": 28, "line": 1, }, }, "range": Array [ - 16, - 17, + 28, + 29, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { - "column": 18, + "column": 29, "line": 1, }, }, "range": Array [ - 18, - 31, + 29, + 30, ], - "type": "Identifier", - "value": "ReadonlyArray", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 34, "line": 1, }, "start": Object { @@ -68385,91 +69652,91 @@ Object { }, "range": Array [ 31, - 32, + 34, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 35, "line": 1, }, "start": Object { - "column": 32, + "column": 34, "line": 1, }, }, "range": Array [ - 32, - 38, + 34, + 35, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 37, "line": 1, }, "start": Object { - "column": 38, + "column": 36, "line": 1, }, }, "range": Array [ - 38, - 39, + 36, + 37, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 39, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 39, 40, + 43, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 41, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 41, - 42, + 43, + 45, ], "type": "Punctuator", - "value": "{", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 2, }, "start": Object { - "column": 2, + "column": 7, "line": 2, }, }, @@ -68478,16 +69745,16 @@ Object { 48, ], "type": "Identifier", - "value": "arr", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 2, }, "start": Object { - "column": 5, + "column": 10, "line": 2, }, }, @@ -68496,115 +69763,43 @@ Object { 49, ], "type": "Punctuator", - "value": ".", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 49, - 54, + 52, + 55, ], "type": "Identifier", - "value": "slice", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 11, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 54, 55, + 57, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 56, - 57, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 75, - 78, - ], - "type": "Identifier", - "value": "arr", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 78, - 79, - ], - "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { @@ -68613,16 +69808,16 @@ Object { "line": 3, }, "start": Object { - "column": 6, + "column": 7, "line": 3, }, }, "range": Array [ - 79, - 83, + 57, + 60, ], "type": "Identifier", - "value": "push", + "value": "two", }, Object { "loc": Object { @@ -68636,16 +69831,16 @@ Object { }, }, "range": Array [ - 83, - 84, + 60, + 61, ], "type": "Punctuator", - "value": "(", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 3, }, "start": Object { @@ -68654,44 +69849,26 @@ Object { }, }, "range": Array [ - 84, - 92, - ], - "type": "String", - "value": "\\"hello!\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 3, - }, - }, - "range": Array [ - 92, - 93, + 61, + 66, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 3, }, "start": Object { - "column": 20, + "column": 16, "line": 3, }, }, "range": Array [ - 93, - 94, + 66, + 67, ], "type": "Punctuator", "value": ";", @@ -68699,251 +69876,215 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 4, }, "start": Object { - "column": 0, + "column": 2, "line": 4, }, }, "range": Array [ - 105, - 106, + 70, + 73, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 6, + "line": 4, }, "start": Object { - "column": 0, - "line": 6, + "column": 5, + "line": 4, }, }, "range": Array [ - 108, - 116, + 73, + 74, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 9, + "line": 4, }, "start": Object { - "column": 9, - "line": 6, + "column": 6, + "line": 4, }, }, "range": Array [ - 117, - 120, + 74, + 77, ], "type": "Identifier", - "value": "foo", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 11, + "line": 4, }, "start": Object { - "column": 12, - "line": 6, + "column": 9, + "line": 4, }, }, "range": Array [ - 120, - 121, + 77, + 79, ], "type": "Punctuator", - "value": "(", + "value": "?.", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 6, + "line": 4, }, "start": Object { - "column": 13, - "line": 6, + "column": 11, + "line": 4, }, }, "range": Array [ - 121, - 124, + 79, + 84, ], "type": "Identifier", - "value": "arr", + "value": "three", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 6, + "line": 4, }, "start": Object { "column": 16, - "line": 6, + "line": 4, }, }, "range": Array [ - 124, - 125, + 84, + 85, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 18, - "line": 6, - }, - }, - "range": Array [ - 126, - 134, - ], - "type": "Identifier", - "value": "readonly", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 6, + "column": 5, + "line": 5, }, "start": Object { - "column": 27, - "line": 6, + "column": 2, + "line": 5, }, }, "range": Array [ - 135, - 141, + 88, + 91, ], "type": "Identifier", - "value": "string", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 6, - }, - "start": Object { - "column": 33, - "line": 6, - }, - }, - "range": Array [ - 141, - 142, - ], - "type": "Punctuator", - "value": "[", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 6, + "column": 6, + "line": 5, }, "start": Object { - "column": 34, - "line": 6, + "column": 5, + "line": 5, }, }, "range": Array [ - 142, - 143, + 91, + 92, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 6, + "column": 9, + "line": 5, }, "start": Object { - "column": 35, - "line": 6, + "column": 6, + "line": 5, }, }, "range": Array [ - 143, - 144, + 92, + 95, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 6, + "column": 11, + "line": 5, }, "start": Object { - "column": 37, - "line": 6, + "column": 9, + "line": 5, }, }, "range": Array [ - 145, - 146, + 95, + 97, ], "type": "Punctuator", - "value": "{", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 7, + "column": 16, + "line": 5, }, "start": Object { - "column": 2, - "line": 7, + "column": 11, + "line": 5, }, }, "range": Array [ - 149, - 152, + 97, + 102, ], "type": "Identifier", - "value": "arr", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 7, + "column": 17, + "line": 5, }, "start": Object { - "column": 5, - "line": 7, + "column": 16, + "line": 5, }, }, "range": Array [ - 152, - 153, + 102, + 103, ], "type": "Punctuator", "value": ".", @@ -68951,197 +70092,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 21, + "line": 5, }, "start": Object { - "column": 6, - "line": 7, + "column": 17, + "line": 5, }, }, "range": Array [ - 153, - 158, + 103, + 107, ], "type": "Identifier", - "value": "slice", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 22, + "line": 5, }, "start": Object { - "column": 11, - "line": 7, + "column": 21, + "line": 5, }, }, "range": Array [ - 158, - 159, + 107, + 108, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 5, + "line": 6, }, "start": Object { - "column": 12, - "line": 7, + "column": 2, + "line": 6, }, }, "range": Array [ - 159, - 160, + 111, + 114, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 6, + "line": 6, }, "start": Object { - "column": 13, - "line": 7, + "column": 5, + "line": 6, }, }, "range": Array [ - 160, - 161, + 114, + 115, ], "type": "Punctuator", - "value": ";", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 9, + "line": 6, }, "start": Object { - "column": 2, - "line": 8, + "column": 6, + "line": 6, }, }, "range": Array [ - 179, - 182, + 115, + 118, ], "type": "Identifier", - "value": "arr", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 11, + "line": 6, }, "start": Object { - "column": 5, - "line": 8, + "column": 9, + "line": 6, }, }, "range": Array [ - 182, - 183, + 118, + 120, ], "type": "Punctuator", - "value": ".", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 16, + "line": 6, }, "start": Object { - "column": 6, - "line": 8, + "column": 11, + "line": 6, }, }, "range": Array [ - 183, - 187, + 120, + 125, ], "type": "Identifier", - "value": "push", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 8, + "column": 18, + "line": 6, }, "start": Object { - "column": 10, - "line": 8, + "column": 16, + "line": 6, }, }, "range": Array [ - 187, - 188, + 125, + 127, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "range": Array [ - 188, - 196, - ], - "type": "String", - "value": "\\"hello!\\"", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 8, + "column": 22, + "line": 6, }, "start": Object { - "column": 19, - "line": 8, + "column": 18, + "line": 6, }, }, "range": Array [ - 196, - 197, + 127, + 131, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 8, + "column": 23, + "line": 6, }, "start": Object { - "column": 20, - "line": 8, + "column": 22, + "line": 6, }, }, "range": Array [ - 197, - 198, + 131, + 132, ], "type": "Punctuator", "value": ";", @@ -69150,16 +70273,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 9, + "line": 7, }, "start": Object { "column": 0, - "line": 9, + "line": 7, }, }, "range": Array [ - 209, - 210, + 133, + 134, ], "type": "Punctuator", "value": "}", @@ -69169,7 +70292,7 @@ Object { } `; -exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` Object { "body": Array [ Object { @@ -69178,68 +70301,12 @@ Object { "body": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "pair", - "range": Array [ - 62, - 66, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 67, - 68, - ], - "raw": "0", - "type": "Literal", - "value": 0, - }, - "range": Array [ - 62, - 69, - ], - "type": "MemberExpression", - }, - ], + "arguments": Array [], "callee": Object { "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 2, }, "start": Object { @@ -69250,7 +70317,7 @@ Object { "object": Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 2, }, "start": Object { @@ -69258,40 +70325,41 @@ Object { "line": 2, }, }, - "name": "console", + "name": "one", "range": Array [ - 50, - 57, + 44, + 47, ], "type": "Identifier", }, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 2, }, "start": Object { - "column": 10, + "column": 7, "line": 2, }, }, - "name": "log", + "name": "fn", "range": Array [ - 58, - 61, + 49, + 51, ], "type": "Identifier", }, "range": Array [ - 50, - 61, + 44, + 51, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 2, }, "start": Object { @@ -69299,15 +70367,16 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ - 50, - 70, + 44, + 53, ], - "type": "CallExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 2, }, "start": Object { @@ -69316,18 +70385,19 @@ Object { }, }, "range": Array [ - 50, - 71, + 44, + 54, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "left": Object { - "computed": true, + "arguments": Array [], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 3, }, "start": Object { @@ -69336,9 +70406,10 @@ Object { }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 3, }, "start": Object { @@ -69346,41 +70417,77 @@ Object { "line": 3, }, }, - "name": "pair", + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + }, "range": Array [ - 84, - 88, + 57, + 65, ], - "type": "Identifier", + "type": "OptionalMemberExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 3, }, "start": Object { - "column": 7, + "column": 11, "line": 3, }, }, + "name": "fn", "range": Array [ - 89, - 90, + 66, + 68, ], - "raw": "1", - "type": "Literal", - "value": 1, + "type": "Identifier", }, "range": Array [ - 84, - 91, + 57, + 68, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 3, }, "start": Object { @@ -69388,35 +70495,16 @@ Object { "line": 3, }, }, - "operator": "=", + "optional": false, "range": Array [ - 84, - 102, + 57, + 70, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 94, - 102, - ], - "raw": "\\"hello!\\"", - "type": "Literal", - "value": "hello!", - }, - "type": "AssignmentExpression", + "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 21, + "column": 16, "line": 3, }, "start": Object { @@ -69425,186 +70513,809 @@ Object { }, }, "range": Array [ - 84, - 103, + 57, + 71, ], "type": "ExpressionStatement", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 46, - "line": 1, - }, - }, - "range": Array [ - 46, - 118, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 78, + 81, + ], + "type": "Identifier", + }, + "range": Array [ + 74, + 81, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "fn", + "range": Array [ + 83, + 85, + ], + "type": "Identifier", + }, + "range": Array [ + 74, + 85, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 74, + 87, + ], + "type": "OptionalCallExpression", }, - }, - "name": "pair", - "range": Array [ - 13, - 44, - ], - "type": "Identifier", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 17, - 44, + 74, + 88, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, }, - }, - "operator": "readonly", - "range": Array [ - 19, - 44, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "elementTypes": Array [ - Object { + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 29, - "line": 1, + "column": 2, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 91, + 94, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, }, + "name": "two", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", }, "range": Array [ - 29, - 35, + 91, + 98, ], - "type": "TSStringKeyword", + "type": "MemberExpression", }, - Object { + "optional": true, + "property": Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 16, + "line": 5, }, "start": Object { - "column": 37, - "line": 1, + "column": 11, + "line": 5, }, }, + "name": "three", "range": Array [ - 37, - 43, + 100, + 105, ], - "type": "TSStringKeyword", - }, - ], - "loc": Object { - "end": Object { - "column": 44, - "line": 1, + "type": "Identifier", }, - "start": Object { - "column": 28, - "line": 1, + "range": Array [ + 91, + 105, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, }, + "name": "fn", + "range": Array [ + 106, + 108, + ], + "type": "Identifier", }, "range": Array [ - 28, - 44, + 91, + 108, ], - "type": "TSTupleType", + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 91, + 110, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, }, }, + "range": Array [ + 91, + 111, + ], + "type": "ExpressionStatement", }, - }, - ], - "range": Array [ - 0, - 118, - ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 5, - }, - "start": Object { + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 121, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "three", + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 128, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "name": "fn", + "range": Array [ + 130, + 132, + ], + "type": "Identifier", + }, + "range": Array [ + 114, + 132, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 114, + 134, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 135, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "one", + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 139, + 146, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 147, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "one", + "range": Array [ + 150, + 153, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 150, + 157, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 150, + 161, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 162, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "object": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "name": "one", + "range": Array [ + 166, + 169, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "optional": true, + "range": Array [ + 166, + 173, + ], + "type": "OptionalCallExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 10, + "line": 11, + }, + }, + "name": "two", + "range": Array [ + 174, + 177, + ], + "type": "Identifier", + }, + "range": Array [ + 166, + 177, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 166, + 178, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 180, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalCall", + "range": Array [ + 9, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 29, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 180, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 13, + }, + "start": Object { "column": 0, "line": 1, }, }, "range": Array [ 0, - 119, + 181, ], "sourceType": "script", "tokens": Array [ @@ -69629,7 +71340,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 28, "line": 1, }, "start": Object { @@ -69639,25 +71350,25 @@ Object { }, "range": Array [ 9, - 12, + 28, ], "type": "Identifier", - "value": "foo", + "value": "processOptionalCall", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 29, "line": 1, }, "start": Object { - "column": 12, + "column": 28, "line": 1, }, }, "range": Array [ - 12, - 13, + 28, + 29, ], "type": "Punctuator", "value": "(", @@ -69665,318 +71376,318 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 32, "line": 1, }, "start": Object { - "column": 13, + "column": 29, "line": 1, }, }, "range": Array [ - 13, - 17, + 29, + 32, ], "type": "Identifier", - "value": "pair", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 33, "line": 1, }, "start": Object { - "column": 17, + "column": 32, "line": 1, }, }, "range": Array [ - 17, - 18, + 32, + 33, ], "type": "Punctuator", - "value": ":", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 34, "line": 1, }, "start": Object { - "column": 19, + "column": 33, "line": 1, }, }, "range": Array [ - 19, - 27, + 33, + 34, ], - "type": "Identifier", - "value": "readonly", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 38, "line": 1, }, "start": Object { - "column": 28, + "column": 35, "line": 1, }, }, "range": Array [ - 28, - 29, + 35, + 38, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 39, "line": 1, }, "start": Object { - "column": 29, + "column": 38, "line": 1, }, }, "range": Array [ - 29, - 35, + 38, + 39, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 41, "line": 1, }, "start": Object { - "column": 35, + "column": 40, "line": 1, }, }, "range": Array [ - 35, - 36, + 40, + 41, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 37, - 43, + 44, + 47, ], "type": "Identifier", - "value": "string", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 43, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 43, - 44, + 47, + 49, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 44, - 45, + 49, + 51, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 46, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 46, - 47, + 51, + 52, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { - "column": 2, + "column": 10, "line": 2, }, }, "range": Array [ - 50, - 57, + 52, + 53, ], - "type": "Identifier", - "value": "console", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 57, - 58, + 53, + 54, ], "type": "Punctuator", - "value": ".", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 10, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 58, - 61, + 57, + 60, ], "type": "Identifier", - "value": "log", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 5, + "line": 3, }, }, "range": Array [ - 61, + 60, 62, ], "type": "Punctuator", - "value": "(", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 10, + "line": 3, }, "start": Object { - "column": 14, - "line": 2, + "column": 7, + "line": 3, }, }, "range": Array [ 62, - 66, + 65, ], "type": "Identifier", - "value": "pair", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 18, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ + 65, 66, - 67, ], "type": "Punctuator", - "value": "[", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 19, - "line": 2, + "column": 11, + "line": 3, }, }, "range": Array [ - 67, + 66, 68, ], - "type": "Numeric", - "value": "0", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 14, + "line": 3, }, "start": Object { - "column": 20, - "line": 2, + "column": 13, + "line": 3, }, }, "range": Array [ @@ -69984,17 +71695,17 @@ Object { 69, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 15, + "line": 3, }, "start": Object { - "column": 21, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ @@ -70007,12 +71718,12 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 22, - "line": 2, + "column": 15, + "line": 3, }, }, "range": Array [ @@ -70025,424 +71736,9435 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 5, + "line": 4, }, "start": Object { "column": 2, - "line": 3, + "line": 4, }, }, "range": Array [ - 84, - 88, + 74, + 77, ], "type": "Identifier", - "value": "pair", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 6, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 5, + "line": 4, }, }, "range": Array [ - 88, - 89, + 77, + 78, ], "type": "Punctuator", - "value": "[", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 9, + "line": 4, }, "start": Object { - "column": 7, - "line": 3, + "column": 6, + "line": 4, }, }, "range": Array [ - 89, - 90, + 78, + 81, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 11, + "line": 4, }, "start": Object { - "column": 8, - "line": 3, + "column": 9, + "line": 4, }, }, "range": Array [ - 90, - 91, + 81, + 83, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 10, - "line": 3, + "column": 11, + "line": 4, }, }, "range": Array [ - 92, - 93, + 83, + 85, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "fn", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 3, + "column": 14, + "line": 4, }, "start": Object { - "column": 12, - "line": 3, + "column": 13, + "line": 4, }, }, "range": Array [ - 94, - 102, + 85, + 86, ], - "type": "String", - "value": "\\"hello!\\"", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, + "column": 15, + "line": 4, }, "start": Object { - "column": 20, - "line": 3, + "column": 14, + "line": 4, }, }, "range": Array [ - 102, - 103, + 86, + 87, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 16, "line": 4, }, "start": Object { - "column": 0, + "column": 15, "line": 4, }, }, "range": Array [ - 117, - 118, + 87, + 88, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/symbol-type-param.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "range": Array [ - 40, - 42, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "test", - "range": Array [ - 9, - 13, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 5, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "abc", - "range": Array [ - 14, - 38, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 38, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 38, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "Map", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 29, - ], - "type": "TSSymbolKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 22, - 38, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - }, - }, - ], "range": Array [ - 0, - 42, + 91, + 94, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "one", }, - }, - "range": Array [ - 0, - 42, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 6, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 5, }, }, "range": Array [ - 0, - 8, + 94, + 95, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { "column": 9, - "line": 1, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 98, + 100, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 106, + 108, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 121, + 123, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 130, + 132, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 142, + 144, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 153, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 153, + 155, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 157, + 159, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 166, + 169, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 5, + "line": 11, + }, + }, + "range": Array [ + 169, + 171, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 10, + "line": 11, + }, + }, + "range": Array [ + 174, + 177, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 47, + 55, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 59, + 67, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 59, + 70, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 74, + 80, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 74, + 85, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 89, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 89, + 100, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 101, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 104, + 110, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 104, + 115, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 104, + 118, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 119, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 139, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 141, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 142, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processOptionalElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 62, + 64, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 110, + 112, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/parenthesized-use-strict.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 46, + 58, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 60, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 46, + 58, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/readonly-arrays.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "arr", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "slice", + "range": Array [ + 49, + 54, + ], + "type": "Identifier", + }, + "range": Array [ + 45, + 54, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 45, + 56, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 57, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "arr", + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "push", + "range": Array [ + 79, + 83, + ], + "type": "Identifier", + }, + "range": Array [ + 75, + 83, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 75, + 93, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 94, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 106, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "arr", + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 39, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "ReadonlyArray", + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 31, + 39, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 106, + ], + "type": "FunctionDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "arr", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "slice", + "range": Array [ + 153, + 158, + ], + "type": "Identifier", + }, + "range": Array [ + 149, + 158, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 149, + 160, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 161, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 188, + 196, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "arr", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "name": "push", + "range": Array [ + 183, + 187, + ], + "type": "Identifier", + }, + "range": Array [ + 179, + 187, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": false, + "range": Array [ + 179, + 197, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 179, + 198, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 210, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "name": "arr", + "range": Array [ + 121, + 143, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 143, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "operator": "readonly", + "range": Array [ + 126, + 143, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 143, + ], + "type": "TSArrayType", + }, + }, + }, + }, + ], + "range": Array [ + 108, + 210, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "value": "ReadonlyArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Identifier", + "value": "slice", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 79, + 83, + ], + "type": "Identifier", + "value": "push", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 108, + 116, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 153, + 158, + ], + "type": "Identifier", + "value": "slice", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 183, + 187, + ], + "type": "Identifier", + "value": "push", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 188, + 196, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 20, + "line": 8, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 209, + 210, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/readonly-tuples.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "pair", + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "range": Array [ + 62, + 69, + ], + "type": "MemberExpression", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "console", + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "log", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "range": Array [ + 50, + 61, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 50, + 70, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "pair", + "range": Array [ + 84, + 88, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "range": Array [ + 84, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 84, + 102, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 94, + 102, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 84, + 103, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 118, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "pair", + "range": Array [ + 13, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "operator": "readonly", + "range": Array [ + 19, + 44, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "TSTupleType", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 118, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 119, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + "value": "console", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "value": "log", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 84, + 88, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 94, + 102, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/symbol-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "abc", + "range": Array [ + 14, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "Map", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSSymbolKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 22, + 38, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 42, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "abc", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "Map", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 37, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + }, + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 48, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + }, + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 25, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSPropertySignature", + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion-in-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "assertString", + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 58, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 21, + 58, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "range": Array [ + 31, + 40, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 58, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + "value": "assertString", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 54, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "assertsString", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 56, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "range": Array [ + 32, + 41, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "value": "assertsString", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 54, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion-in-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isString", + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "node", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 24, + 58, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 57, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "node", + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + }, + "range": Array [ + 45, + 57, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "TSMethodSignature", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 60, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "AssertFoo", + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "AssertFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 45, + 52, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-assertion-in-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isBar", + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 60, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 56, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 60, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 26, + 60, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSThisType", + }, + "range": Array [ + 30, + 42, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "isBaz", + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 63, + 108, + ], + "static": false, + "type": "ClassProperty", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 97, + 104, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 91, + 108, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 71, + 108, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 73, + 87, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 83, + 87, + ], + "type": "TSThisType", + }, + "range": Array [ + 75, + 87, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "ArrowFunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 110, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, }, }, "range": Array [ - 9, - 13, + 0, + 110, ], - "type": "Identifier", - "value": "test", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, + "column": 5, "line": 1, }, "start": Object { - "column": 13, + "column": 0, "line": 1, }, }, "range": Array [ - 13, - 14, + 0, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 6, "line": 1, }, }, "range": Array [ - 14, - 17, + 6, + 16, ], "type": "Identifier", - "value": "abc", + "value": "AssertsFoo", }, Object { "loc": Object { @@ -70460,906 +81182,689 @@ Object { 18, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 19, - 22, + 21, + 26, ], "type": "Identifier", - "value": "Map", + "value": "isBar", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 22, - 23, + 26, + 27, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 23, - 29, + 27, + 28, ], - "type": "Identifier", - "value": "symbol", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ + 28, 29, - 30, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 31, + 30, 37, ], "type": "Identifier", - "value": "string", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 37, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 37, 38, + 42, ], - "type": "Punctuator", - "value": ">", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 38, - 39, + 43, + 44, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 40, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 40, - 41, + 49, + 55, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 41, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 41, - 42, + 55, + 56, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 0, - 37, + 59, + 60, ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, }, - "range": Array [ - 17, - 37, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 27, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "Success", - "range": Array [ - 17, - 24, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 37, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "Failure", - "range": Array [ - 30, - 37, - ], - "type": "Identifier", - }, - }, - ], - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "start": Object { + "column": 2, + "line": 5, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 11, - 14, - ], - "type": "TSTypeParameterDeclaration", }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "isBaz", }, - ], - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 37, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 0, - 4, + 69, + 70, ], - "type": "Identifier", - "value": "type", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 11, - "line": 1, + "line": 5, }, "start": Object { - "column": 5, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 5, - 11, + 71, + 72, ], - "type": "Identifier", - "value": "Result", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 5, }, "start": Object { "column": 11, - "line": 1, + "line": 5, }, }, "range": Array [ - 11, - 12, + 72, + 73, ], "type": "Punctuator", - "value": "<", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 1, + "line": 5, }, "start": Object { "column": 12, - "line": 1, + "line": 5, }, }, "range": Array [ - 12, - 13, + 73, + 74, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 21, + "line": 5, }, "start": Object { - "column": 13, - "line": 1, + "column": 14, + "line": 5, }, }, "range": Array [ - 13, - 14, + 75, + 82, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 5, }, "start": Object { - "column": 15, - "line": 1, + "column": 22, + "line": 5, }, }, "range": Array [ - 15, - 16, + 83, + 87, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 17, - "line": 1, + "column": 27, + "line": 5, }, }, "range": Array [ - 17, - 24, + 88, + 90, ], - "type": "Identifier", - "value": "Success", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 31, + "line": 5, }, "start": Object { - "column": 24, - "line": 1, + "column": 30, + "line": 5, }, }, "range": Array [ - 24, - 25, + 91, + 92, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 25, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 25, - 26, + 97, + 103, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 26, - "line": 1, + "column": 10, + "line": 6, }, }, "range": Array [ - 26, - 27, + 103, + 104, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 28, - "line": 1, + "column": 2, + "line": 7, }, }, "range": Array [ - 28, - 29, + 107, + 108, ], "type": "Punctuator", - "value": "|", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 8, }, "start": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 8, }, }, "range": Array [ - 30, - 37, + 109, + 110, ], - "type": "Identifier", - "value": "Failure", + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-arrow-function.src 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 48, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 48, - ], - "type": "TSUnionType", - "types": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 38, + "column": 18, "line": 1, }, "start": Object { - "column": 28, + "column": 6, "line": 1, }, }, + "name": "assertString", "range": Array [ - 28, - 38, + 6, + 18, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 28, + "column": 54, "line": 1, }, }, - "name": "Success", "range": Array [ - 28, - 35, + 54, + 68, ], - "type": "Identifier", + "type": "BlockStatement", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "params": Array [ - Object { + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 28, "line": 1, }, "start": Object { - "column": 36, + "column": 23, "line": 1, }, }, "range": Array [ - 36, - 37, + 23, + 28, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, + "column": 28, "line": 1, }, "start": Object { - "column": 36, + "column": 25, "line": 1, }, }, - "name": "T", "range": Array [ - 36, - 37, + 25, + 28, ], - "type": "Identifier", + "type": "TSAnyKeyword", }, }, - ], - "range": Array [ - 35, - 38, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, }, - }, + ], "range": Array [ - 41, - 48, + 21, + 68, ], - "type": "TSTypeReference", - "typeName": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 48, + "column": 50, "line": 1, }, "start": Object { - "column": 41, + "column": 29, "line": 1, }, }, - "name": "Failure", "range": Array [ - 41, - 48, + 29, + 50, ], - "type": "Identifier", - }, - }, - ], - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, }, - "start": Object { - "column": 22, - "line": 1, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "range": Array [ + 31, + 50, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, }, }, - "members": Array [], - "range": Array [ - 22, - 24, - ], - "type": "TSTypeLiteral", }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "name": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameter", }, - ], - "range": Array [ - 11, - 25, - ], - "type": "TSTypeParameterDeclaration", + "range": Array [ + 6, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 68, + ], + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -71368,14 +81873,14 @@ Object { }, "range": Array [ 0, - 48, + 69, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -71385,436 +81890,528 @@ Object { }, "range": Array [ 0, - 4, + 5, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, - 11, + 6, + 18, ], "type": "Identifier", - "value": "Result", + "value": "assertString", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 21, "line": 1, }, }, "range": Array [ - 12, - 13, + 21, + 22, ], - "type": "Identifier", - "value": "T", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 22, "line": 1, }, }, "range": Array [ - 14, - 21, + 22, + 23, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 1, }, "start": Object { - "column": 22, + "column": 23, "line": 1, }, }, "range": Array [ - 22, 23, + 24, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 28, "line": 1, }, "start": Object { - "column": 23, + "column": 25, "line": 1, }, }, "range": Array [ - 23, - 24, + 25, + 28, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 29, "line": 1, }, "start": Object { - "column": 24, + "column": 28, "line": 1, }, }, "range": Array [ - 24, - 25, + 28, + 29, ], "type": "Punctuator", - "value": ">", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 30, "line": 1, }, "start": Object { - "column": 26, + "column": 29, "line": 1, }, }, "range": Array [ - 26, - 27, + 29, + 30, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 38, "line": 1, }, "start": Object { - "column": 28, + "column": 31, "line": 1, }, }, "range": Array [ - 28, - 35, + 31, + 38, ], "type": "Identifier", - "value": "Success", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 40, "line": 1, }, "start": Object { - "column": 35, + "column": 39, "line": 1, }, }, "range": Array [ - 35, - 36, + 39, + 40, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 43, "line": 1, }, "start": Object { - "column": 36, + "column": 41, "line": 1, }, }, "range": Array [ - 36, - 37, + 41, + 43, ], "type": "Identifier", - "value": "T", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 50, "line": 1, }, "start": Object { - "column": 37, + "column": 44, "line": 1, }, }, "range": Array [ - 37, - 38, + 44, + 50, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 53, "line": 1, }, "start": Object { - "column": 39, + "column": 51, "line": 1, }, }, "range": Array [ - 39, - 40, + 51, + 53, ], "type": "Punctuator", - "value": "|", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 55, "line": 1, }, "start": Object { - "column": 41, + "column": 54, "line": 1, }, }, "range": Array [ - 41, - 48, + 54, + 55, ], - "type": "Identifier", - "value": "Failure", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-function.src 1`] = ` Object { "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 71, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 27, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, - "name": "foo", + "name": "assertsStringGuard", "range": Array [ - 5, - 8, + 9, + 27, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 30, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, }, + }, + "name": "x", + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 24, + "column": 34, "line": 1, }, "start": Object { - "column": 12, + "column": 29, "line": 1, }, }, "range": Array [ - 12, - 24, + 29, + 34, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, + "column": 34, "line": 1, }, "start": Object { - "column": 15, + "column": 31, "line": 1, }, }, "range": Array [ - 15, - 23, + 31, + 34, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 23, - ], - "type": "TSStringKeyword", - }, + "type": "TSAnyKeyword", }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, + }, + ], + "range": Array [ + 0, + 71, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 56, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", }, + "name": "x", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + "range": Array [ + 37, + 56, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 56, "line": 1, }, "start": Object { - "column": 25, + "column": 50, "line": 1, }, }, "range": Array [ - 25, - 28, + 50, + 56, ], - "type": "TSPropertySignature", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "TSStringKeyword", + }, }, - ], - "range": Array [ - 11, - 29, - ], - "type": "TSTypeLiteral", + }, }, + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -71823,14 +82420,14 @@ Object { }, "range": Array [ 0, - 31, + 72, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { @@ -71840,97 +82437,133 @@ Object { }, "range": Array [ 0, - 4, + 8, ], - "type": "Identifier", - "value": "type", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 27, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 8, + 9, + 27, ], "type": "Identifier", - "value": "foo", + "value": "assertsStringGuard", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 27, "line": 1, }, }, "range": Array [ - 9, - 10, + 27, + 28, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 29, "line": 1, }, "start": Object { - "column": 11, + "column": 28, "line": 1, }, }, "range": Array [ - 11, - 12, + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 34, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 15, + 31, + 34, ], "type": "Identifier", - "value": "bar", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 35, "line": 1, }, "start": Object { - "column": 15, + "column": 34, "line": 1, }, }, "range": Array [ - 15, - 16, + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, ], "type": "Punctuator", "value": ":", @@ -71938,453 +82571,757 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 44, "line": 1, }, "start": Object { - "column": 17, + "column": 37, "line": 1, }, }, "range": Array [ - 17, - 23, + 37, + 44, ], "type": "Identifier", - "value": "string", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 46, "line": 1, }, "start": Object { - "column": 23, + "column": 45, "line": 1, }, }, "range": Array [ - 23, - 24, + 45, + 46, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 49, "line": 1, }, "start": Object { - "column": 25, + "column": 47, "line": 1, }, }, "range": Array [ - 25, - 28, + 47, + 49, ], "type": "Identifier", - "value": "baz", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 56, "line": 1, }, "start": Object { - "column": 28, + "column": 50, "line": 1, }, }, "range": Array [ - 28, - 29, + 50, + 56, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 58, "line": 1, }, "start": Object { - "column": 29, + "column": 57, "line": 1, }, }, "range": Array [ - 29, - 30, + 57, + 58, ], "type": "Punctuator", - "value": ";", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-assertion.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-interface.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 2, + "line": 2, }, }, + "name": "isString", "range": Array [ - 26, - 27, + 24, + 32, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 46, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 2, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "node", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], "range": Array [ - 12, - 27, + 24, + 68, ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 45, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 13, - 16, + 43, + 67, ], - "type": "TSAnyKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "node", + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + }, + "range": Array [ + 45, + 67, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "TSStringKeyword", + }, + }, + }, }, + "type": "TSMethodSignature", }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 70, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "AssertFoo", + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, ], - "kind": "const", + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 28, + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "AssertFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, "line": 1, }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, "start": Object { - "column": 0, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 0, - 28, + 39, + 42, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "any", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 0, - 5, + 42, + 43, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 6, - 9, + 43, + 44, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 10, - 11, + 45, + 52, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 31, + "line": 2, }, }, "range": Array [ - 12, - 13, + 53, + 57, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "node", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 38, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 13, - 16, + 58, + 60, ], "type": "Identifier", - "value": "any", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 45, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 39, + "line": 2, }, }, "range": Array [ - 16, - 17, + 61, + 67, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 46, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 45, + "line": 2, }, }, "range": Array [ - 26, - 27, + 67, + 68, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 27, - 28, + 69, + 70, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/type-assertion-with-guard-in-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isBar", + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + }, + "kind": "method", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 4, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "asserted2", "range": Array [ - 4, - 13, + 21, + 70, ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { "async": false, "body": Object { "body": Array [ Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "n", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, + "argument": null, "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 31, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 31, - 40, + 59, + 66, ], "type": "ReturnStatement", }, ], "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 29, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 29, - 42, + 53, + 70, ], "type": "BlockStatement", }, @@ -72393,95 +83330,329 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 2, }, }, - "params": Array [ - Object { + "params": Array [], + "range": Array [ + 26, + 70, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 11, + "line": 2, }, }, - "name": "n", + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSThisType", + }, "range": Array [ - 23, - 24, + 30, + 52, ], - "type": "Identifier", + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, }, - ], + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "isBaz", "range": Array [ - 22, - 42, + 73, + 78, ], - "type": "ArrowFunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 16, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 16, - 43, + 73, + 128, ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { + "static": false, + "type": "ClassProperty", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 117, + 124, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 111, + 128, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 3, + "line": 7, }, "start": Object { - "column": 17, - "line": 1, + "column": 10, + "line": 5, }, }, + "params": Array [], "range": Array [ - 17, - 20, + 81, + 128, ], - "type": "TSAnyKeyword", + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 83, + 107, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 93, + 97, + ], + "type": "TSThisType", + }, + "range": Array [ + 85, + 107, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "ArrowFunctionExpression", }, }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 1, }, - "range": Array [ - 4, - 43, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 17, + 130, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AssertsFoo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 8, }, "start": Object { "column": 0, @@ -72490,15 +83661,16 @@ Object { }, "range": Array [ 0, - 44, + 130, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 9, }, "start": Object { "column": 0, @@ -72507,14 +83679,14 @@ Object { }, "range": Array [ 0, - 45, + 131, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -72524,317 +83696,533 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 13, + 6, + 16, ], "type": "Identifier", - "value": "asserted2", + "value": "AssertsFoo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, "range": Array [ - 14, - 15, + 17, + 18, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 26, + ], + "type": "Identifier", + "value": "isBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 17, - 20, + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, ], "type": "Identifier", - "value": "any", + "value": "asserts", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 20, - 21, + 38, + 42, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 10, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 21, - 22, + 59, + 65, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 3, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 22, - 23, + 69, + 70, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 23, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 23, - 24, + 73, + 78, ], "type": "Identifier", - "value": "n", + "value": "isBaz", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 24, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 24, - 25, + 79, + 80, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 11, + "line": 5, }, "start": Object { - "column": 26, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 26, - 28, + 81, + 82, ], "type": "Punctuator", - "value": "=>", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 12, + "line": 5, }, "start": Object { - "column": 29, - "line": 1, + "column": 11, + "line": 5, }, }, "range": Array [ - 29, - 30, + 82, + 83, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 13, + "line": 5, }, "start": Object { - "column": 31, - "line": 1, + "column": 12, + "line": 5, }, }, "range": Array [ - 31, - 37, + 83, + 84, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 93, + 97, ], "type": "Keyword", - "value": "return", + "value": "this", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 29, + "line": 5, }, "start": Object { - "column": 38, - "line": 1, + "column": 27, + "line": 5, }, }, "range": Array [ - 38, - 39, + 98, + 100, ], "type": "Identifier", - "value": "n", + "value": "is", }, Object { "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 36, + "line": 5, }, "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { "column": 39, - "line": 1, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, }, }, "range": Array [ - 39, - 40, + 108, + 110, ], "type": "Punctuator", - "value": ";", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 41, + "line": 5, }, "start": Object { - "column": 41, - "line": 1, + "column": 40, + "line": 5, }, }, "range": Array [ - 41, - 42, + 111, + 112, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 42, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 42, - 43, + 117, + 123, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 43, - "line": 1, + "column": 10, + "line": 6, }, }, "range": Array [ - 43, - 44, + 123, + 124, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } @@ -73064,6 +84452,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "asserts": false, "loc": Object { "end": Object { "column": 38, @@ -73771,6 +85160,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "asserts": false, "loc": Object { "end": Object { "column": 38, @@ -74299,6 +85689,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "asserts": false, "loc": Object { "end": Object { "column": 37, @@ -74882,6 +86273,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "asserts": false, "loc": Object { "end": Object { "column": 25, @@ -75115,6 +86507,7 @@ Object { ], "type": "TSTypeAnnotation", "typeAnnotation": Object { + "asserts": false, "loc": Object { "end": Object { "column": 28, @@ -75906,6 +87299,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 42, @@ -86557,6 +97951,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 38, @@ -86649,6 +98044,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -87279,6 +98675,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 37, @@ -87371,6 +98768,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -88087,6 +99485,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -88660,6 +100059,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -89582,6 +100982,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 36, @@ -89974,6 +101375,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 15, 30, @@ -90459,6 +101861,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 15, 25, @@ -91836,6 +103239,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 32, @@ -92431,6 +103835,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -92500,6 +103905,7 @@ Object { ], "type": "Identifier", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -92625,6 +104031,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 33, 51, @@ -93379,6 +104786,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 21, 34, @@ -93971,6 +105379,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 34, 47, @@ -96071,6 +107480,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 32, @@ -96775,6 +108185,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 32, @@ -97294,6 +108705,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 27, 34, @@ -97387,6 +108799,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 46, 54, @@ -97993,6 +109406,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 15, 33, @@ -98106,6 +109520,7 @@ Object { "line": 4, }, }, + "optional": false, "range": Array [ 54, 73, @@ -100944,6 +112359,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 7, @@ -101259,6 +112675,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 7, @@ -101758,6 +113175,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 7, @@ -113119,6 +124537,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 8, @@ -113226,6 +124645,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 10, 23, @@ -134685,6 +146105,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -134922,6 +146343,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -135199,6 +146621,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -135308,6 +146731,7 @@ Object { "line": 14, }, }, + "optional": false, "range": Array [ 228, 232, @@ -135549,6 +146973,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { @@ -135658,6 +147083,7 @@ Object { "line": 19, }, }, + "optional": false, "range": Array [ 313, 317, @@ -135894,6 +147320,7 @@ Object { ], "type": "ThisExpression", }, + "optional": false, "property": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/jsx.ts b/packages/typescript-estree/tests/lib/jsx.ts index f5d3f31b27cb..cfcc68284ccd 100644 --- a/packages/typescript-estree/tests/lib/jsx.ts +++ b/packages/typescript-estree/tests/lib/jsx.ts @@ -1,4 +1,4 @@ -import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/jsx-known-issues'; +import filesWithKnownIssues from '@typescript-eslint/shared-fixtures/dist/jsx-known-issues'; import { readFileSync } from 'fs'; import glob from 'glob'; import { TSESTreeOptions } from '../../src/parser-options'; diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 157edec74126..6afffd43029d 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -335,8 +335,7 @@ function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node): void { expect((nodeType as ts.ObjectType).objectFlags).toBe( ts.ObjectFlags.Reference, ); - expect((nodeType as ts.TypeReference).typeArguments).toHaveLength(1); - expect((nodeType as ts.TypeReference).typeArguments![0].flags).toBe( - ts.TypeFlags.Number, - ); + const typeArguments = checker.getTypeArguments(nodeType as ts.TypeReference); + expect(typeArguments).toHaveLength(1); + expect(typeArguments[0].flags).toBe(ts.TypeFlags.Number); } diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index 7dc0e63275b4..9c39ef4a085c 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "rootDir": ".", - "noEmit": true + "composite": false, + "rootDir": "." }, "include": ["src", "tests", "tools"], - "exclude": ["tests/fixtures/**/*"] + "exclude": ["tests/fixtures/**/*"], + "references": [{ "path": "../shared-fixtures/tsconfig.build.json" }] } diff --git a/yarn.lock b/yarn.lock index 8054910b5668..3a524d7a1cbe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,17 +10,17 @@ "@babel/highlight" "^7.0.0" "@babel/core@^7.1.0": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" - integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.2.tgz#069a776e8d5e9eefff76236bc8845566bd31dd91" + integrity sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helpers" "^7.5.5" - "@babel/parser" "^7.5.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" + "@babel/generator" "^7.6.2" + "@babel/helpers" "^7.6.2" + "@babel/parser" "^7.6.2" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.2" + "@babel/types" "^7.6.0" convert-source-map "^1.1.0" debug "^4.1.0" json5 "^2.1.0" @@ -29,16 +29,15 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.4.0", "@babel/generator@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" - integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== +"@babel/generator@^7.4.0", "@babel/generator@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03" + integrity sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ== dependencies: - "@babel/types" "^7.5.5" + "@babel/types" "^7.6.0" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" "@babel/helper-function-name@^7.1.0": version "7.1.0" @@ -68,14 +67,14 @@ dependencies: "@babel/types" "^7.4.4" -"@babel/helpers@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" - integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== +"@babel/helpers@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" + integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.2" + "@babel/types" "^7.6.0" "@babel/highlight@^7.0.0": version "7.5.0" @@ -86,11 +85,16 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.5.5", "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": +"@babel/parser@7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== +"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" + integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== + "@babel/plugin-syntax-object-rest-spread@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" @@ -98,41 +102,41 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/runtime@^7.2.0", "@babel/runtime@^7.4.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" - integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== +"@babel/runtime@^7.2.0", "@babel/runtime@^7.5.5": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.2.tgz#c3d6e41b304ef10dcf13777a33e7694ec4a9a6dd" + integrity sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg== dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== +"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" + integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/parser" "^7.6.0" + "@babel/types" "^7.6.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" - integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== +"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" + integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" + "@babel/generator" "^7.6.2" "@babel/helper-function-name" "^7.1.0" "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.5.5" - "@babel/types" "^7.5.5" + "@babel/parser" "^7.6.2" + "@babel/types" "^7.6.0" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.3.2", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" - integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.3.2", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.6.0": + version "7.6.1" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.1.tgz#53abf3308add3ac2a2884d539151c57c4b3ac648" + integrity sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g== dependencies: esutils "^2.0.2" lodash "^4.17.13" @@ -146,17 +150,17 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@commitlint/cli@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-8.1.0.tgz#a3d4236c0ac961d7026a53d728b179c696d6a045" - integrity sha512-83K5C2nIAgoZlzMegf0/MEBjX+ampUyc/u79RxgX9ZYjzos+RQtNyO7I43dztVxPXSwAnX9XRgoOfkGWA4nbig== +"@commitlint/cli@^8.1.0", "@commitlint/cli@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-8.2.0.tgz#fbf9969e04e2162d985eaa644fdad6ce807aadb6" + integrity sha512-8fJ5pmytc38yw2QWbTTJmXLfSiWPwMkHH4govo9zJ/+ERPBF2jvlxD/dQvk24ezcizjKc6LFka2edYC4OQ+Dgw== dependencies: - "@commitlint/format" "^8.1.0" - "@commitlint/lint" "^8.1.0" - "@commitlint/load" "^8.1.0" - "@commitlint/read" "^8.1.0" + "@commitlint/format" "^8.2.0" + "@commitlint/lint" "^8.2.0" + "@commitlint/load" "^8.2.0" + "@commitlint/read" "^8.2.0" babel-polyfill "6.26.0" - chalk "2.3.1" + chalk "2.4.2" get-stdin "7.0.0" lodash "4.17.14" meow "5.0.0" @@ -164,89 +168,89 @@ resolve-global "1.0.0" "@commitlint/config-conventional@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-8.1.0.tgz#ba61fbf0ad4df52da2b5ee3034470371a2cbf039" - integrity sha512-/JY+FNBnrT91qzDVIoV1Buiigvj7Le7ezFw+oRqu0nYREX03k7xnaG/7t7rUSvm7hM6dnLSOlaUsevjgMI9AEw== + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-8.2.0.tgz#886a5538e3708e017ec2871e0cbce00f635d3102" + integrity sha512-HuwlHQ3DyVhpK9GHgTMhJXD8Zp8PGIQVpQGYh/iTrEU6TVxdRC61BxIDZvfWatCaiG617Z/U8maRAFrqFM4TqA== -"@commitlint/ensure@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-8.1.0.tgz#6c669f85c3005ed15c8141d83cf5312c43001613" - integrity sha512-dBU4CcjN0vJSDNOeSpaHNgQ1ra444u4USvI6PTaHVAS4aeDpZ5Cds1rxkZNsocu48WNycUu0jP84+zjcw2pPLQ== +"@commitlint/ensure@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-8.2.0.tgz#fad0c81c3d3bd09aa5fbcbcc483ae1f39bc8af8f" + integrity sha512-XZZih/kcRrqK7lEORbSYCfqQw6byfsFbLygRGVdJMlCPGu9E2MjpwCtoj5z7y/lKfUB3MJaBhzn2muJqS1gC6A== dependencies: lodash "4.17.14" -"@commitlint/execute-rule@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-8.1.0.tgz#e8386bd0836b3dcdd41ebb9d5904bbeb447e4715" - integrity sha512-+vpH3RFuO6ypuCqhP2rSqTjFTQ7ClzXtUvXphpROv9v9+7zH4L+Ex+wZLVkL8Xj2cxefSLn/5Kcqa9XyJTn3kg== +"@commitlint/execute-rule@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-8.2.0.tgz#aefb3744e22613660adefb7ebcccaa60bd24e78d" + integrity sha512-9MBRthHaulbWTa8ReG2Oii2qc117NuvzhZdnkuKuYLhker7sUXGFcVhLanuWUKGyfyI2o9zVr/NHsNbCCsTzAA== -"@commitlint/format@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-8.1.0.tgz#c3f3ca78bb74cbc1cce1368c0974b0cb8f31b98e" - integrity sha512-D0cmabUTQIKdABgt08d9JAvO9+lMRAmkcsZx8TMScY502R67HCw77JhzRDcw1RmqX5rN8JO6ZjDHO92Pbwlt+Q== +"@commitlint/format@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-8.2.0.tgz#0a2447fadac7c0421ce8a8d7e27dfa2172c737d4" + integrity sha512-sA77agkDEMsEMrlGhrLtAg8vRexkOofEEv/CZX+4xlANyAz2kNwJvMg33lcL65CBhqKEnRRJRxfZ1ZqcujdKcQ== dependencies: chalk "^2.0.1" -"@commitlint/is-ignored@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-8.1.0.tgz#c0583fa3c641b2d4898be1443e70e9c467429de2" - integrity sha512-HUSxx6kuLbqrQ8jb5QRzo+yR+CIXgA9HNcIcZ1qWrb+O9GOixt3mlW8li1IcfIgfODlaWoxIz0jYCxR08IoQLg== +"@commitlint/is-ignored@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-8.2.0.tgz#b6409ab28bf5a80f25e14da17da3916adb230a89" + integrity sha512-ADaGnKfbfV6KD1pETp0Qf7XAyc75xTy3WJlbvPbwZ4oPdBMsXF0oXEEGMis6qABfU2IXan5/KAJgAFX3vdd0jA== dependencies: "@types/semver" "^6.0.1" - semver "6.1.1" + semver "6.2.0" -"@commitlint/lint@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-8.1.0.tgz#ad10f4885c06f14c71de11dcd6bf2ca54a395141" - integrity sha512-WYjbUgtqvnlVH3S3XPZMAa+N7KO0yQ+GuUG20Qra+EtER6SRYawykmEs4wAyrmY8VcFXUnKgSlIQUsqmGKwNZQ== +"@commitlint/lint@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-8.2.0.tgz#aadc606379f3550eb877f16d4f5b103639cbf92a" + integrity sha512-ch9JN8aR37ufdjoWv50jLfvFz9rWMgLW5HEkMGLsM/51gjekmQYS5NJg8S2+6F5+jmralAO7VkUMI6FukXKX0A== dependencies: - "@commitlint/is-ignored" "^8.1.0" - "@commitlint/parse" "^8.1.0" - "@commitlint/rules" "^8.1.0" + "@commitlint/is-ignored" "^8.2.0" + "@commitlint/parse" "^8.2.0" + "@commitlint/rules" "^8.2.0" babel-runtime "^6.23.0" lodash "4.17.14" -"@commitlint/load@>6.1.1", "@commitlint/load@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-8.1.0.tgz#63b72ae5bb9152b8fa5b17c5428053032a9a49c8" - integrity sha512-ra02Dvmd7Gp1+uFLzTY3yGOpHjPzl5T9wYg/xrtPJNiOWXvQ0Mw7THw+ucd1M5iLUWjvdavv2N87YDRc428wHg== +"@commitlint/load@>6.1.1", "@commitlint/load@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-8.2.0.tgz#9ca53a0c795e4f63d796b4d42279e856549add1a" + integrity sha512-EV6PfAY/p83QynNd1llHxJiNxKmp43g8+7dZbyfHFbsGOdokrCnoelAVZ+WGgktXwLN/uXyfkcIAxwac015UYw== dependencies: - "@commitlint/execute-rule" "^8.1.0" - "@commitlint/resolve-extends" "^8.1.0" + "@commitlint/execute-rule" "^8.2.0" + "@commitlint/resolve-extends" "^8.2.0" babel-runtime "^6.23.0" chalk "2.4.2" cosmiconfig "^5.2.0" lodash "4.17.14" resolve-from "^5.0.0" -"@commitlint/message@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-8.1.0.tgz#8fb8046ddaa7e5c846a79da7cdbd15cf1a7770ae" - integrity sha512-AjHq022G8jQQ/3YrBOjwVBD4xF75hvC3vcvFoBIb7cC8vad1QWq+1w+aks0KlEK5IW+/+7ORZXIH+oyW7h3+8A== +"@commitlint/message@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-8.2.0.tgz#bdc0388183f6bc6006c7e7e197a721683011907a" + integrity sha512-LNsSwDLIFgE3nb/Sb1PIluYNy4Q8igdf4tpJCdv5JJDf7CZCZt3ZTglj0YutZZorpRRuHJsVIB2+dI4bVH3bFw== -"@commitlint/parse@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-8.1.0.tgz#833243c6d848e7a7e775a283b38697166ed2fd22" - integrity sha512-n4fEbZ5kdK5HChvne7Mj8rGGkKMfA4H11IuWiWmmMzgmZTNb/B04LPrzdUm4lm3f10XzM2JMM7PLXqofQJOGvA== +"@commitlint/parse@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-8.2.0.tgz#de80137e89ee5a2d3029656c9b33e90c88c6f56c" + integrity sha512-vzouqroTXG6QXApkrps0gbeSYW6w5drpUk7QAeZIcaCSPsQXDM8eqqt98ZzlzLJHo5oPNXPX1AAVSTrssvHemA== dependencies: conventional-changelog-angular "^1.3.3" conventional-commits-parser "^2.1.0" lodash "^4.17.11" -"@commitlint/read@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-8.1.0.tgz#effe07c965ba1735a5f7f8b7b19ac4d98c887507" - integrity sha512-PKsGMQFEr2sX/+orI71b82iyi8xFqb7F4cTvsLxzB5x6/QutxPVM3rg+tEVdi6rBKIDuqRIp2puDZQuREZs3vg== +"@commitlint/read@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-8.2.0.tgz#54c6549723d532c74434ee0d74e0459032dc9159" + integrity sha512-1tBai1VuSQmsOTsvJr3Fi/GZqX3zdxRqYe/yN4i3cLA5S2Y4QGJ5I3l6nGZlKgm/sSelTCVKHltrfWU8s5H7SA== dependencies: - "@commitlint/top-level" "^8.1.0" + "@commitlint/top-level" "^8.2.0" "@marionebl/sander" "^0.6.0" babel-runtime "^6.23.0" git-raw-commits "^1.3.0" -"@commitlint/resolve-extends@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-8.1.0.tgz#ed67f2ee484160ac8e0078bae52f172625157472" - integrity sha512-r/y+CeKW72Oa9BUctS1+I/MFCDiI3lfhwfQ65Tpfn6eZ4CuBYKzrCRi++GTHeAFKE3y8q1epJq5Rl/1GBejtBw== +"@commitlint/resolve-extends@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-8.2.0.tgz#b7f2f0c71c10f24b98a199ed11d2c14cfd7a318f" + integrity sha512-cwi0HUsDcD502HBP8huXfTkVuWmeo1Fiz3GKxNwMBBsJV4+bKa7QrtxbNpXhVuarX7QjWfNTvmW6KmFS7YK9uw== dependencies: "@types/node" "^12.0.2" import-fresh "^3.0.0" @@ -254,36 +258,36 @@ resolve-from "^5.0.0" resolve-global "^1.0.0" -"@commitlint/rules@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-8.1.0.tgz#009c64a8a23feb4647e5a25057997be62a272c8a" - integrity sha512-hlM8VfNjsOkbvMteFyqn0c3akiUjqG09Iid28MBLrXl/d+8BR3eTzwJ4wMta4oz/iqGyrIywvg1FpHrV977MPA== +"@commitlint/rules@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-8.2.0.tgz#4cd6a323ca1a3f3d33ae6dc723f8c88f3dcde347" + integrity sha512-FlqSBBP2Gxt5Ibw+bxdYpzqYR6HI8NIBpaTBhAjSEAduQtdWFMOhF0zsgkwH7lHN7opaLcnY2fXxAhbzTmJQQA== dependencies: - "@commitlint/ensure" "^8.1.0" - "@commitlint/message" "^8.1.0" - "@commitlint/to-lines" "^8.1.0" + "@commitlint/ensure" "^8.2.0" + "@commitlint/message" "^8.2.0" + "@commitlint/to-lines" "^8.2.0" babel-runtime "^6.23.0" -"@commitlint/to-lines@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-8.1.0.tgz#5bf2597f46acacec4b1b3dba832ac8934798b22a" - integrity sha512-Lh4OH1bInI8GME/7FggS0/XkIMEJdTObMbXRyPRGaPcWH5S7zpB6y+b4qjzBHXAbEv2O46QAAMjZ+ywPQCpmYQ== +"@commitlint/to-lines@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-8.2.0.tgz#dddb5916a457e1a79e437115a9b8eac7bf9ad52a" + integrity sha512-LXTYG3sMenlN5qwyTZ6czOULVcx46uMy+MEVqpvCgptqr/MZcV/C2J+S2o1DGwj1gOEFMpqrZaE3/1R2Q+N8ng== -"@commitlint/top-level@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-8.1.0.tgz#f1950de73a1f76ef5c9e753a6b77402e0755d677" - integrity sha512-EvQuofuA/+0l1w9pkG/PRyIwACmZdIh9qxyax7w7mR8qqmSHscqf2jARIylh1TOx0uI9egO8MuPLiwC1RwyREA== +"@commitlint/top-level@^8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-8.2.0.tgz#206e7cbc54dbe9494190677f887dd60943fed5b0" + integrity sha512-Yaw4KmYNy31/HhRUuZ+fupFcDalnfpdu4JGBgGAqS9aBHdMSSWdWqtAaDaxdtWjTZeN3O0sA2gOhXwvKwiDwvw== dependencies: find-up "^4.0.0" "@commitlint/travis-cli@^8.1.0": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@commitlint/travis-cli/-/travis-cli-8.1.0.tgz#0c8dc099644cd2da8bd3e55ac9cc3055f1906504" - integrity sha512-HSeinF08sstSTXDIPvTx5evAd4U49NLF1n0eAXu9rzyHA+ELc6gVSiW3HnIdNx83WkTV+nuQIPQGXqXYx9vleA== + version "8.2.0" + resolved "https://registry.yarnpkg.com/@commitlint/travis-cli/-/travis-cli-8.2.0.tgz#ad916afee6c3cb4c120119e7acc6aca35a911cfe" + integrity sha512-SXZh9qpAWwvzW2KlG5HOxnci1KMkUZOqr2wKMzgXuV+BS5jhkZaPsKvrrs85FZtUWdJuqFNHTVXKoetgWgMXpQ== dependencies: - "@commitlint/cli" "^8.1.0" + "@commitlint/cli" "^8.2.0" babel-runtime "6.26.0" - execa "0.9.0" + execa "0.11.0" "@evocateur/libnpmaccess@^3.1.2": version "3.1.2" @@ -359,16 +363,7 @@ unique-filename "^1.1.1" which "^1.3.1" -"@jest/console@^24.7.1": - version "24.7.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" - integrity sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg== - dependencies: - "@jest/source-map" "^24.3.0" - chalk "^2.0.1" - slash "^2.0.0" - -"@jest/console@^24.9.0": +"@jest/console@^24.7.1", "@jest/console@^24.9.0": version "24.9.0" resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== @@ -457,16 +452,7 @@ source-map "^0.6.0" string-length "^2.0.0" -"@jest/source-map@^24.3.0": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" - integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.1.15" - source-map "^0.6.0" - -"@jest/source-map@^24.9.0": +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": version "24.9.0" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== @@ -1220,18 +1206,18 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@nodelib/fs.scandir@2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.2.tgz#1f981cd5b83e85cfdeb386fc693d4baab392fa54" - integrity sha512-wrIBsjA5pl13f0RN4Zx4FNWmU71lv03meGKnqRUoCyan17s4V3WL92f3w3AIuWbNnpcrQyFBU5qMavJoB8d27w== +"@nodelib/fs.scandir@2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" + integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== dependencies: - "@nodelib/fs.stat" "2.0.2" + "@nodelib/fs.stat" "2.0.3" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.2", "@nodelib/fs.stat@^2.0.1": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.2.tgz#2762aea8fe78ea256860182dcb52d61ee4b8fda6" - integrity sha512-z8+wGWV2dgUhLqrtRYa03yDx4HWMvXKi1z8g3m2JyxAx8F7xk74asqPk5LAETjqDSGLFML/6CDl0+yFunSYicw== +"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.1": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" + integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== "@nodelib/fs.stat@^1.1.2": version "1.1.3" @@ -1239,22 +1225,20 @@ integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== "@nodelib/fs.walk@^1.2.1": - version "1.2.3" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.3.tgz#a555dc256acaf00c62b0db29529028dd4d4cb141" - integrity sha512-l6t8xEhfK9Sa4YO5mIRdau7XSOADfmh3jCr0evNHdY+HNkW6xuQhgMH7D73VV6WpZOagrW0UludvMTiifiwTfA== + version "1.2.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" + integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== dependencies: - "@nodelib/fs.scandir" "2.1.2" + "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" "@octokit/endpoint@^5.1.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.3.0.tgz#7c4a8d74e88176206817bf513b63b1859a84c475" - integrity sha512-D7u80EdZHlHzYl81PgoKXFFIl121eLahKI6WFvuhwE4ih+U+YWrE1fGiH9eybr8l3mGgZ9iITYGBR+7UR5S9QA== + version "5.3.6" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.3.6.tgz#58a67b75b853127568e0db533cdd10f3bdca2e23" + integrity sha512-XuerByak8H+jW9J/rVMEdBXfI4UTsDWUwAKgIP/uhQjXIUVdPRwt2Zg+SmbWQ+WY7pRkw/hFVES8C4G/Kle7oA== dependencies: - deepmerge "4.0.0" is-plain-object "^3.0.0" - universal-user-agent "^3.0.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" "@octokit/plugin-enterprise-rest@^3.6.1": version "3.6.2" @@ -1270,9 +1254,9 @@ once "^1.4.0" "@octokit/request@^5.0.0": - version "5.0.1" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.0.1.tgz#6705c9a883db0ac0f58cee717e806b6575d4a199" - integrity sha512-SHOk/APYpfrzV1RNf7Ux8SZi+vZXhMIB2dBr4TQR6ExMX8R4jcy/0gHw26HLe1dWV7Wxe9WzYyDSEC0XwnoCSQ== + version "5.1.0" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.1.0.tgz#5609dcc7b5323e529f29d535214383d9eaf0c05c" + integrity sha512-I15T9PwjFs4tbWyhtFU2Kq7WDPidYMvRB7spmxoQRZfxSmiqullG+Nz+KbSmpkfnlvHwTr1e31R5WReFRKMXjg== dependencies: "@octokit/endpoint" "^5.1.0" "@octokit/request-error" "^1.0.1" @@ -1280,12 +1264,12 @@ is-plain-object "^3.0.0" node-fetch "^2.3.0" once "^1.4.0" - universal-user-agent "^3.0.0" + universal-user-agent "^4.0.0" "@octokit/rest@^16.28.4": - version "16.28.7" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.28.7.tgz#a2c2db5b318da84144beba82d19c1a9dbdb1a1fa" - integrity sha512-cznFSLEhh22XD3XeqJw51OLSfyL2fcFKUO+v2Ep9MTAFfFLS1cK1Zwd1yEgQJmJoDnj4/vv3+fGGZweG+xsbIA== + version "16.30.2" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.30.2.tgz#da379a6f4f7e7e152733d38a9cba21da5c76ef7c" + integrity sha512-6YN4N/uWjjBUx4TNfWAxkrzCy1i7M4agdHs2g/sOTdSY/Va3T1v/f/ME5EnNfd64AMpBWee6rcLHQe5fki89lg== dependencies: "@octokit/request" "^5.0.0" "@octokit/request-error" "^1.0.2" @@ -1298,8 +1282,7 @@ lodash.uniq "^4.5.0" octokit-pagination-methods "^1.1.0" once "^1.4.0" - universal-user-agent "^3.0.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" @@ -1314,9 +1297,9 @@ integrity sha512-HAdhFeYOZKIkrR2jbonCJxp3I/o2G/kxY+CIx7qX9Kmv5jY+9D7OgmgSLdRqeHacB5RlqE5efj2WIDFL9NXCyg== "@types/babel__core@^7.1.0": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f" - integrity sha512-cfCCrFmiGY/yq0NuKNxIQvZFy9kY/1immpSpTngOnyIbD4+eJOG5mxphhHDv3CHL9GltO4GcKr54kGBg3RNdbg== + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1325,9 +1308,9 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" - integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== dependencies: "@babel/types" "^7.0.0" @@ -1429,9 +1412,9 @@ "@types/lodash" "*" "@types/lodash@*": - version "4.14.136" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.136.tgz#413e85089046b865d960c9ff1d400e04c31ab60f" - integrity sha512-0GJhzBdvsW2RUccNHOBkabI8HZVdOXmXbXhuKlDEd5Vv12P7oAVGfomGp3Ne21o5D/qu1WmthlNKFaoZJJeErA== + version "4.14.141" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.141.tgz#d81f4d0c562abe28713406b571ffb27692a82ae6" + integrity sha512-v5NYIi9qEbFEUpCyikmnOYe4YlP8BMUdTcNCAquAKzu+FA7rZ1onj9x80mbnDdOW/K5bFf3Tv5kJplP33+gAbQ== "@types/marked@^0.6.5": version "0.6.5" @@ -1443,15 +1426,10 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^12.0.2": - version "12.6.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" - integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== - -"@types/node@^12.7.2": - version "12.7.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" - integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== +"@types/node@*", "@types/node@^12.0.2", "@types/node@^12.7.2": + version "12.7.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" + integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1459,14 +1437,14 @@ integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== "@types/prettier@^1.18.2": - version "1.18.2" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.2.tgz#069e7d132024d436fd1f5771f6932426a695f230" - integrity sha512-2JBasa5Qaj81Qsp/dxX2Njy+MdKC767WytHUDsRM7TYEfQvKPxsnGpnCBlBS1i2Aiv1YwCpmKSbQ6O6v8TpiKg== + version "1.18.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.3.tgz#64ff53329ce16139f17c3db9d3e0487199972cd8" + integrity sha512-48rnerQdcZ26odp+HOvDGX8IcUkYOCuMc2BodWYTe956MqkHlOGAG4oFQ83cjZ0a4GAgj7mb4GUClxYd2Hlodg== "@types/semver@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.1.tgz#a984b405c702fa5a7ec6abc56b37f2ba35ef5af6" - integrity sha512-ffCdcrEE5h8DqVxinQjo+2d1q+FV5z7iNtPofw3JsrltSoSVlOGaW0rY8XxtO9XukdTn8TaCGWmk2VFGhI70mg== + version "6.0.2" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.2.tgz#5e8b09f0e4af53034b1d0fb9977a277847836205" + integrity sha512-G1Ggy7/9Nsa1Jt2yiBR2riEuyK2DFNnqow6R7cromXPMNynackRY1vqFTLz/gwnef1LHokbXThcPhqMRjUbkpQ== "@types/stack-utils@^1.0.1": version "1.0.1" @@ -1479,14 +1457,14 @@ integrity sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA== "@types/yargs-parser@*": - version "13.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" - integrity sha512-wBlsw+8n21e6eTd4yVv8YD/E3xq0O6nNnJIquutAsFGE7EyMKz7W6RNT6BRu1SmdgmlCZ9tb0X+j+D6HGr8pZw== + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== "@types/yargs@^13.0.0": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.2.tgz#a64674fc0149574ecd90ba746e932b5a5f7b3653" - integrity sha512-lwwgizwk/bIIU+3ELORkyuOgDjCh7zuWDFqRtPPhhVgq9N1F7CvLNKg1TX4f2duwtKQ0p044Au9r1PLIXHrIzQ== + version "13.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" + integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== dependencies: "@types/yargs-parser" "*" @@ -1507,162 +1485,6 @@ lodash.unescape "4.0.1" semver "5.5.0" -"@webassemblyjs/ast@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" - integrity sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ== - dependencies: - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - -"@webassemblyjs/floating-point-hex-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz#1ba926a2923613edce496fd5b02e8ce8a5f49721" - integrity sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ== - -"@webassemblyjs/helper-api-error@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz#c49dad22f645227c5edb610bdb9697f1aab721f7" - integrity sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA== - -"@webassemblyjs/helper-buffer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz#fea93e429863dd5e4338555f42292385a653f204" - integrity sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q== - -"@webassemblyjs/helper-code-frame@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz#9a740ff48e3faa3022b1dff54423df9aa293c25e" - integrity sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ== - dependencies: - "@webassemblyjs/wast-printer" "1.8.5" - -"@webassemblyjs/helper-fsm@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz#ba0b7d3b3f7e4733da6059c9332275d860702452" - integrity sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow== - -"@webassemblyjs/helper-module-context@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz#def4b9927b0101dc8cbbd8d1edb5b7b9c82eb245" - integrity sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g== - dependencies: - "@webassemblyjs/ast" "1.8.5" - mamacro "^0.0.3" - -"@webassemblyjs/helper-wasm-bytecode@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz#537a750eddf5c1e932f3744206551c91c1b93e61" - integrity sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ== - -"@webassemblyjs/helper-wasm-section@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz#74ca6a6bcbe19e50a3b6b462847e69503e6bfcbf" - integrity sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - -"@webassemblyjs/ieee754@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz#712329dbef240f36bf57bd2f7b8fb9bf4154421e" - integrity sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.8.5.tgz#044edeb34ea679f3e04cd4fd9824d5e35767ae10" - integrity sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.8.5.tgz#a8bf3b5d8ffe986c7c1e373ccbdc2a0915f0cedc" - integrity sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw== - -"@webassemblyjs/wasm-edit@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz#962da12aa5acc1c131c81c4232991c82ce56e01a" - integrity sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/helper-wasm-section" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-opt" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - "@webassemblyjs/wast-printer" "1.8.5" - -"@webassemblyjs/wasm-gen@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz#54840766c2c1002eb64ed1abe720aded714f98bc" - integrity sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - -"@webassemblyjs/wasm-opt@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz#b24d9f6ba50394af1349f510afa8ffcb8a63d264" - integrity sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-buffer" "1.8.5" - "@webassemblyjs/wasm-gen" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - -"@webassemblyjs/wasm-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz#21576f0ec88b91427357b8536383668ef7c66b8d" - integrity sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-wasm-bytecode" "1.8.5" - "@webassemblyjs/ieee754" "1.8.5" - "@webassemblyjs/leb128" "1.8.5" - "@webassemblyjs/utf8" "1.8.5" - -"@webassemblyjs/wast-parser@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz#e10eecd542d0e7bd394f6827c49f3df6d4eefb8c" - integrity sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/floating-point-hex-parser" "1.8.5" - "@webassemblyjs/helper-api-error" "1.8.5" - "@webassemblyjs/helper-code-frame" "1.8.5" - "@webassemblyjs/helper-fsm" "1.8.5" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/wast-printer@1.8.5": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz#114bbc481fd10ca0e23b3560fa812748b0bae5bc" - integrity sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/wast-parser" "1.8.5" - "@xtuc/long" "4.2.2" - -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - "@zkochan/cmd-shim@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" @@ -1681,9 +1503,9 @@ JSONStream@^1.0.4, JSONStream@^1.3.4: through ">=2.2.7 <3" abab@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" - integrity sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w== + version "2.0.2" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d" + integrity sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg== abbrev@1: version "1.1.1" @@ -1691,9 +1513,9 @@ abbrev@1: integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== acorn-globals@^4.1.0: - version "4.3.2" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.2.tgz#4e2c2313a597fd589720395f6354b41cd5ec8006" - integrity sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ== + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== dependencies: acorn "^6.0.1" acorn-walk "^6.0.1" @@ -1713,15 +1535,15 @@ acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" - integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== +acorn@^6.0.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" + integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== acorn@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.0.0.tgz#26b8d1cd9a9b700350b71c0905546f64d1284e7a" - integrity sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ== + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== agent-base@4, agent-base@^4.3.0: version "4.3.0" @@ -1745,24 +1567,14 @@ agentkeepalive@^3.4.1: humanize-ms "^1.2.1" aggregate-error@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.0.tgz#5b5a3c95e9095f311c9ab16c19fb4f3527cd3f79" - integrity sha512-yKD9kEoJIR+2IFqhMwayIBgheLYbB3PS2OBhWae1L/ODTd/JF/30cW0bc9TqzRL3k4U41Dieu3BF4I29p8xesA== + version "3.0.1" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" + integrity sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== dependencies: clean-stack "^2.0.0" - indent-string "^3.2.0" - -ajv-errors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" - integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== + indent-string "^4.0.0" -ajv-keywords@^3.1.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" - integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== - -ajv@^6.1.0, ajv@^6.10.2: +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -1772,20 +1584,10 @@ ajv@^6.1.0, ajv@^6.10.2: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^6.10.0, ajv@^6.5.5: - version "6.10.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" - integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - all-contributors-cli@^6.8.1: - version "6.8.1" - resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.8.1.tgz#70c8c560ad05d054c09798d4a155887c82c5d553" - integrity sha512-06nnLE9Gl0gGqUIzmELNT/k8IWF31Xgq97GkuMJjEOS+3DFXuJ/0U+AJwa9UxP3Ivlqn484xXx4o3XDqPhytjA== + version "6.9.1" + resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.9.1.tgz#29f0867c6215a1691b25e83c23bc16f30f83f31a" + integrity sha512-z0I/u78s1Robx2p57X28gg+ZHgtRe7iABmEw1O/UFRDpqAHvlF3P7rmug0d99nsNIehrOSayO6XQey4bOHe4Iw== dependencies: "@babel/runtime" "^7.2.0" async "^3.0.1" @@ -1796,7 +1598,7 @@ all-contributors-cli@^6.8.1: lodash "^4.11.2" pify "^4.0.1" request "^2.72.0" - yargs "^13.1.0" + yargs "^14.0.0" ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: version "3.2.0" @@ -1886,14 +1688,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -aria-query@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" - integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= - dependencies: - ast-types-flow "0.0.7" - commander "^2.11.0" - arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -1924,11 +1718,6 @@ array-find-index@^1.0.1: resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= -array-find@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-find/-/array-find-1.0.0.tgz#6c8e286d11ed768327f8e62ecee87353ca3e78b8" - integrity sha1-bI4obRHtdoMn+OYuzuhzU8o+eLg= - array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" @@ -1974,15 +1763,6 @@ asap@^2.0.0: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= -asn1.js@^4.0.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" - integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -1995,38 +1775,20 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assert@^1.1.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" - integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== - dependencies: - object-assign "^4.1.1" - util "0.10.3" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -ast-types-flow@0.0.7, ast-types-flow@^0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" - integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= - astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== -async-each@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" - integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== - async-limiter@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" - integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== async@^3.0.1: version "3.1.0" @@ -2058,13 +1820,6 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== -axobject-query@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9" - integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww== - dependencies: - ast-types-flow "0.0.7" - babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -2074,18 +1829,6 @@ babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-eslint@^10.0.1: - version "10.0.2" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" - integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - eslint-scope "3.7.1" - eslint-visitor-keys "^1.0.0" - babel-jest@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" @@ -2100,10 +1843,11 @@ babel-jest@^24.9.0: slash "^2.0.0" babel-plugin-istanbul@^5.1.0: - version "5.1.4" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.4.tgz#841d16b9a58eeb407a0ddce622ba02fe87a752ba" - integrity sha512-dySz4VJMH+dpndj0wjJ8JPs/7i1TdSPb1nRrn56/92pKOF9VKC1FMFJmMXjzlGGusnCAqujP6PBCiKq0sVA+YQ== + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== dependencies: + "@babel/helper-plugin-utils" "^7.0.0" find-up "^3.0.0" istanbul-lib-instrument "^3.3.0" test-exclude "^5.2.3" @@ -2145,11 +1889,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base64-js@^1.0.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" - integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== - base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" @@ -2175,30 +1914,15 @@ before-after-hook@^2.0.0: resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== -big.js@^5.2.2: - version "5.2.2" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" - integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== - -binary-extensions@^1.0.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" - integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== - binary-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: - version "3.5.5" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" - integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + version "3.7.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.0.tgz#56a6a886e03f6ae577cffedeb524f8f2450293cf" + integrity sha512-aBQ1FxIa7kSWCcmKHlcHFlT2jt6J/l4FzC7KcPELkOJOsPOb/bccdhmIrKDfXhwFrmc7vDoDrrepFvGqjyXGJg== brace-expansion@^1.1.7: version "1.1.11" @@ -2208,7 +1932,7 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^2.3.1, braces@^2.3.2: +braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== @@ -2231,11 +1955,6 @@ braces@^3.0.1, braces@^3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= - browser-process-hrtime@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" @@ -2248,65 +1967,6 @@ browser-resolve@^1.11.3: dependencies: resolve "1.1.7" -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" - integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= - dependencies: - bn.js "^4.1.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" - integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= - dependencies: - bn.js "^4.1.1" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.2" - elliptic "^6.0.0" - inherits "^2.0.1" - parse-asn1 "^5.0.0" - -browserify-zlib@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== - dependencies: - pako "~1.0.5" - bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -2331,30 +1991,11 @@ buffer-from@1.x, buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= - -buffer@^4.3.0: - version "4.9.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - integrity sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg= - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" - builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= - builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" @@ -2370,47 +2011,7 @@ byte-size@^5.0.1: resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-5.0.1.tgz#4b651039a5ecd96767e71a3d7ed380e48bed4191" integrity sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw== -cacache@^11.3.2: - version "11.3.3" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.3.tgz#8bd29df8c6a718a6ebd2d010da4d7972ae3bbadc" - integrity sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA== - dependencies: - bluebird "^3.5.5" - chownr "^1.1.1" - figgy-pudding "^3.5.1" - glob "^7.1.4" - graceful-fs "^4.1.15" - lru-cache "^5.1.1" - mississippi "^3.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.3" - ssri "^6.0.1" - unique-filename "^1.1.1" - y18n "^4.0.0" - -cacache@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.0.tgz#1ed91cc306312a53ad688b1563ce4c416faec564" - integrity sha512-0baf1FhCp16LhN+xDJsOrSiaPDCTD3JegZptVmLDoEbFcT5aT+BeFGt3wcDU3olCP5tpTCXU5sv0+TsKWT9WGQ== - dependencies: - bluebird "^3.5.5" - chownr "^1.1.1" - figgy-pudding "^3.5.1" - glob "^7.1.4" - graceful-fs "^4.1.15" - lru-cache "^5.1.1" - mississippi "^3.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.3" - ssri "^6.0.1" - unique-filename "^1.1.1" - y18n "^4.0.0" - -cacache@^12.0.3: +cacache@^12.0.0, cacache@^12.0.3: version "12.0.3" resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== @@ -2524,15 +2125,6 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" - integrity sha512-QUU4ofkDoMIVO7hcx1iPTISs88wsO8jA92RQIm4JAwZvFGGAV2hSAA1NX7oVj2Ej2Q6NDTcRDjPTFrMCRZoJ6g== - dependencies: - ansi-styles "^3.2.0" - escape-string-regexp "^1.0.5" - supports-color "^5.2.0" - chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -2558,25 +2150,6 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@^2.0.2: - version "2.1.6" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" - integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== - dependencies: - anymatch "^2.0.0" - async-each "^1.0.1" - braces "^2.3.2" - glob-parent "^3.1.0" - inherits "^2.0.3" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - normalize-path "^3.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.2.1" - upath "^1.1.1" - optionalDependencies: - fsevents "^1.2.7" - chokidar@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.0.2.tgz#0d1cd6d04eb2df0327446188cd13736a3367d681" @@ -2593,30 +2166,15 @@ chokidar@^3.0.2: fsevents "^2.0.6" chownr@^1.1.1, chownr@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" - integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A== - -chrome-trace-event@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" - integrity sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ== - dependencies: - tslib "^1.9.0" + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -2720,10 +2278,10 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.11.0, commander@^2.12.1, commander@^2.20.0, commander@~2.20.0: - version "2.20.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" - integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commander@^2.12.1, commander@^2.20.0, commander@~2.20.0: + version "2.20.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.1.tgz#3863ce3ca92d0831dcf2a102f5fb4b5926afd0f9" + integrity sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg== commitizen@^4.0.3: version "4.0.3" @@ -2746,11 +2304,6 @@ commitizen@^4.0.3: strip-bom "4.0.0" strip-json-comments "3.0.1" -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= - compare-func@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648" @@ -2797,23 +2350,11 @@ config-chain@^1.1.11: ini "^1.3.4" proto-list "~1.2.1" -console-browserify@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - integrity sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA= - dependencies: - date-now "^0.1.4" - console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= -constants-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= - contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" @@ -2836,17 +2377,17 @@ conventional-changelog-angular@^5.0.3: q "^1.5.1" conventional-changelog-core@^3.1.6: - version "3.2.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.2.tgz#de41e6b4a71011a18bcee58e744f6f8f0e7c29c0" - integrity sha512-cssjAKajxaOX5LNAJLB+UOcoWjAIBvXtDMedv/58G+YEmAXMNfC16mmPl0JDOuVJVfIqM0nqQiZ8UCm8IXbE0g== + version "3.2.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz#b31410856f431c847086a7dcb4d2ca184a7d88fb" + integrity sha512-LMMX1JlxPIq/Ez5aYAYS5CpuwbOk6QFp8O4HLAcZxe3vxoCtABkhfjetk8IYdRB9CDQGwJFLR3Dr55Za6XKgUQ== dependencies: - conventional-changelog-writer "^4.0.5" - conventional-commits-parser "^3.0.2" + conventional-changelog-writer "^4.0.6" + conventional-commits-parser "^3.0.3" dateformat "^3.0.0" get-pkg-repo "^1.0.0" git-raw-commits "2.0.0" git-remote-origin-url "^2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" lodash "^4.2.1" normalize-package-data "^2.3.5" q "^1.5.1" @@ -2855,19 +2396,19 @@ conventional-changelog-core@^3.1.6: through2 "^3.0.0" conventional-changelog-preset-loader@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.1.1.tgz#65bb600547c56d5627d23135154bcd9a907668c4" - integrity sha512-K4avzGMLm5Xw0Ek/6eE3vdOXkqnpf9ydb68XYmCc16cJ99XMMbc2oaNMuPwAsxVK6CC1yA4/I90EhmWNj0Q6HA== + version "2.2.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.2.0.tgz#571e2b3d7b53d65587bea9eedf6e37faa5db4fcc" + integrity sha512-zXB+5vF7D5Y3Cb/rJfSyCCvFphCVmF8mFqOdncX3BmjZwAtGAPfYrBcT225udilCKvBbHgyzgxqz2GWDB5xShQ== -conventional-changelog-writer@^4.0.5: - version "4.0.6" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.6.tgz#24db578ac8e7c89a409ef9bba12cf3c095990148" - integrity sha512-ou/sbrplJMM6KQpR5rKFYNVQYesFjN7WpNGdudQSWNi6X+RgyFUcSv871YBYkrUYV9EX8ijMohYVzn9RUb+4ag== +conventional-changelog-writer@^4.0.6: + version "4.0.7" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.7.tgz#e4b7d9cbea902394ad671f67108a71fa90c7095f" + integrity sha512-p/wzs9eYaxhFbrmX/mCJNwJuvvHR+j4Fd0SQa2xyAhYed6KBiZ780LvoqUUvsayP4R1DtC27czalGUhKV2oabw== dependencies: compare-func "^1.3.1" conventional-commits-filter "^2.0.2" dateformat "^3.0.0" - handlebars "^4.1.0" + handlebars "^4.1.2" json-stringify-safe "^5.0.1" lodash "^4.2.1" meow "^4.0.0" @@ -2901,10 +2442,10 @@ conventional-commits-parser@^2.1.0: through2 "^2.0.0" trim-off-newlines "^1.0.0" -conventional-commits-parser@^3.0.2, conventional-commits-parser@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.3.tgz#c3f972fd4e056aa8b9b4f5f3d0e540da18bf396d" - integrity sha512-KaA/2EeUkO4bKjinNfGUyqPTX/6w9JGshuQRik4r/wJz7rUw3+D3fDG6sZSEqJvKILzKXFQuFkpPLclcsAuZcg== +conventional-commits-parser@^3.0.3: + version "3.0.5" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.5.tgz#df471d6cb3f6fecfd1356ac72e0b577dbdae0a9c" + integrity sha512-qVz9+5JwdJzsbt7JbJ6P7NOXBGt8CyLFJYSjKAuPSgO+5UGfcsbk9EMR+lI8Unlvx6qwIc2YDJlrGIfay2ehNA== dependencies: JSONStream "^1.0.4" is-text-path "^2.0.0" @@ -2972,46 +2513,6 @@ cosmiconfig@^5.1.0, cosmiconfig@^5.2.0, cosmiconfig@^5.2.1: js-yaml "^3.13.1" parse-json "^4.0.0" -create-ecdh@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" - integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== - dependencies: - bn.js "^4.1.0" - elliptic "^6.0.0" - -create-hash@^1.1.0, create-hash@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -cross-spawn@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3023,23 +2524,6 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -crypto-browserify@^3.11.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.8" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" @@ -3059,10 +2543,10 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" -cyclist@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" - integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= +cyclist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" + integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= cz-conventional-changelog@3.0.1: version "3.0.1" @@ -3093,11 +2577,6 @@ cz-conventional-changelog@^3.0.2: optionalDependencies: "@commitlint/load" ">6.1.1" -damerau-levenshtein@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414" - integrity sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA== - dargs@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-4.1.0.tgz#03a9dbb4b5c2f139bf14ae53f0b8a2a6a86f4e17" @@ -3126,11 +2605,6 @@ date-fns@^1.27.2: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" - integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= - dateformat@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" @@ -3202,11 +2676,6 @@ deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -deepmerge@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.0.0.tgz#3e3110ca29205f120d7cb064960a39c3d2087c09" - integrity sha512-YZ1rOP5+kHor4hMAH+HRQnBQHg+wvS1un1hAOuIcxcBy0hzcUf6Jg2a1w65kpoOUnurOfZbERwjI1TfZxNjcww== - defaults@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" @@ -3272,14 +2741,6 @@ deprecation@^2.0.0: resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== -des.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" - integrity sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - detect-file@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" @@ -3323,25 +2784,11 @@ diff-sequences@^24.9.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== -diff@^3.2.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" - integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== - diff@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - dir-glob@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" @@ -3364,13 +2811,6 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" - integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== - dependencies: - esutils "^2.0.2" - doctrine@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" @@ -3378,11 +2818,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -domain-browser@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" - integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== - domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" @@ -3432,29 +2867,11 @@ elegant-spinner@^1.0.1: resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= -elliptic@^6.0.0: - version "6.5.0" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.0.tgz#2b8ed4c891b7de3200e14412a5b8248c7af505ca" - integrity sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg== - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - -emoji-regex@^7.0.1, emoji-regex@^7.0.2: +emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== -emojis-list@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" - integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= - encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" @@ -3463,30 +2880,12 @@ encoding@^0.1.11: iconv-lite "~0.4.13" end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" - integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== dependencies: once "^1.4.0" -enhanced-resolve@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" - integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng== - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.4.0" - tapable "^1.0.0" - -enhanced-resolve@~0.9.0: - version "0.9.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e" - integrity sha1-TW5omzcl+GCQknzMhs2fFjW4ni4= - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.2.0" - tapable "^0.1.8" - env-paths@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" @@ -3497,13 +2896,6 @@ err-code@^1.0.0: resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= -errno@^0.1.3, errno@~0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" - integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== - dependencies: - prr "~1.0.1" - error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -3511,17 +2903,21 @@ error-ex@^1.2.0, error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.11.0, es-abstract@^1.12.0, es-abstract@^1.5.1, es-abstract@^1.7.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" - integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== +es-abstract@^1.12.0, es-abstract@^1.5.1, es-abstract@^1.7.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.15.0.tgz#8884928ec7e40a79e3c9bc812d37d10c8b24cc57" + integrity sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ== dependencies: es-to-primitive "^1.2.0" function-bind "^1.1.1" has "^1.0.3" + has-symbols "^1.0.0" is-callable "^1.1.4" is-regex "^1.0.4" - object-keys "^1.0.12" + object-inspect "^1.6.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" es-to-primitive@^1.2.0: version "1.2.0" @@ -3550,9 +2946,9 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@^1.9.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" - integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw== + version "1.12.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" + integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== dependencies: esprima "^3.1.3" estraverse "^4.2.0" @@ -3561,31 +2957,6 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-config-kentcdodds@^14.3.2: - version "14.3.4" - resolved "https://registry.yarnpkg.com/eslint-config-kentcdodds/-/eslint-config-kentcdodds-14.3.4.tgz#49cde58dba48d76aec486b3eae65f2142bfa4ca2" - integrity sha512-GTqZZg647k3Duiefkwqj7onCTTyTeKiKP5D9/T3SYofd+eeNTKPntDSqDNL3qMHFwINHluMcFkwd+gOd1QCMHA== - dependencies: - babel-eslint "^10.0.1" - eslint-config-prettier "^6.0.0" - eslint-import-resolver-webpack "^0.11.1" - eslint-plugin-babel "^5.3.0" - eslint-plugin-import "^2.17.1" - eslint-plugin-jest "^22.4.1" - eslint-plugin-jsx-a11y "^6.2.1" - eslint-plugin-react "^7.13.0" - eslint-plugin-react-hooks "^1.6.0" - read-pkg-up "^6.0.0" - semver "^6.1.1" - webpack "^4.33.0" - -eslint-config-prettier@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25" - integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA== - dependencies: - get-stdin "^6.0.0" - eslint-import-resolver-node@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" @@ -3594,37 +2965,14 @@ eslint-import-resolver-node@^0.3.2: debug "^2.6.9" resolve "^1.5.0" -eslint-import-resolver-webpack@^0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.11.1.tgz#fcf1fd57a775f51e18f442915f85dd6ba45d2f26" - integrity sha512-eK3zR7xVQR/MaoBWwGuD+CULYVuqe5QFlDukman71aI6IboCGzggDUohHNfu1ZeBnbHcUHJc0ywWoXUBNB6qdg== - dependencies: - array-find "^1.0.0" - debug "^2.6.8" - enhanced-resolve "~0.9.0" - find-root "^1.1.0" - has "^1.0.1" - interpret "^1.0.0" - lodash "^4.17.4" - node-libs-browser "^1.0.0 || ^2.0.0" - resolve "^1.10.0" - semver "^5.3.0" - eslint-module-utils@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a" - integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw== + version "2.4.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz#7b4675875bf96b0dbf1b21977456e5bb1f5e018c" + integrity sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw== dependencies: debug "^2.6.8" pkg-dir "^2.0.0" -eslint-plugin-babel@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-5.3.0.tgz#2e7f251ccc249326da760c1a4c948a91c32d0023" - integrity sha512-HPuNzSPE75O+SnxHIafbW5QB45r2w78fxqwK3HmjqIUoPfPzVrq6rD+CINU3yzoDSzEhUkX07VUphbF73Lth/w== - dependencies: - eslint-rule-composer "^0.3.0" - eslint-plugin-eslint-comments@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.2.tgz#4ef6c488dbe06aa1627fea107b3e5d059fc8a395" @@ -3638,23 +2986,6 @@ eslint-plugin-eslint-plugin@^2.1.0: resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.1.0.tgz#a7a00f15a886957d855feacaafee264f039e62d5" integrity sha512-kT3A/ZJftt28gbl/Cv04qezb/NQ1dwYIbi8lyf806XMxkus7DvOVCLIfTXMrorp322Pnoez7+zabXH29tADIDg== -eslint-plugin-import@^2.17.1: - version "2.18.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.0.tgz#7a5ba8d32622fb35eb9c8db195c2090bd18a3678" - integrity sha512-PZpAEC4gj/6DEMMoU2Df01C5c50r7zdGIN52Yfi7CvvWaYssG7Jt5R9nFG5gmqodxNOz9vQS87xk6Izdtpdrig== - dependencies: - array-includes "^3.0.3" - contains-path "^0.1.0" - debug "^2.6.9" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.2" - eslint-module-utils "^2.4.0" - has "^1.0.3" - lodash "^4.17.11" - minimatch "^3.0.4" - read-pkg-up "^2.0.0" - resolve "^1.11.0" - eslint-plugin-import@^2.18.2: version "2.18.2" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" @@ -3673,65 +3004,12 @@ eslint-plugin-import@^2.18.2: resolve "^1.11.0" eslint-plugin-jest@^22.15.2: - version "22.15.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.2.tgz#e3c10d9391f787744e31566f69ebb70c3a98e398" - integrity sha512-p4NME9TgXIt+KgpxcXyNBvO30ZKxwFAO1dJZBc2OGfDnXVEtPwEyNs95GSr6RIE3xLHdjd8ngDdE2icRRXrbxg== + version "22.17.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.17.0.tgz#dc170ec8369cd1bff9c5dd8589344e3f73c88cf6" + integrity sha512-WT4DP4RoGBhIQjv+5D0FM20fAdAUstfYAf/mkufLNTojsfgzc5/IYW22cIg/Q4QBavAZsROQlqppiWDpFZDS8Q== dependencies: "@typescript-eslint/experimental-utils" "^1.13.0" -eslint-plugin-jest@^22.4.1: - version "22.10.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.10.0.tgz#a22be77f4dc692808b88ead0059620bda299a97d" - integrity sha512-iBEWJn60Z5bctcjacymUnOQ3xN3gdvGOy3tDHpalAa99r4+jwH0CvICsIIHBNXNlJxuklkbx+wxr49tXk6M0tg== - -eslint-plugin-jsx-a11y@^6.2.1: - version "6.2.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa" - integrity sha512-CawzfGt9w83tyuVekn0GDPU9ytYtxyxyFZ3aSWROmnRRFQFT2BiPJd7jvRdzNDi6oLWaS2asMeYSNMjWTV4eNg== - dependencies: - "@babel/runtime" "^7.4.5" - aria-query "^3.0.0" - array-includes "^3.0.3" - ast-types-flow "^0.0.7" - axobject-query "^2.0.2" - damerau-levenshtein "^1.0.4" - emoji-regex "^7.0.2" - has "^1.0.3" - jsx-ast-utils "^2.2.1" - -eslint-plugin-react-hooks@^1.6.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.1.tgz#3c66a5515ea3e0a221ffc5d4e75c971c217b1a4c" - integrity sha512-wHhmGJyVuijnYIJXZJHDUF2WM+rJYTjulUTqF9k61d3BTk8etydz+M4dXUVH7M76ZRS85rqBTCx0Es/lLsrjnA== - -eslint-plugin-react@^7.13.0: - version "7.14.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.2.tgz#94c193cc77a899ac0ecbb2766fbef88685b7ecc1" - integrity sha512-jZdnKe3ip7FQOdjxks9XPN0pjUKZYq48OggNMd16Sk+8VXx6JOvXmlElxROCgp7tiUsTsze3jd78s/9AFJP2mA== - dependencies: - array-includes "^3.0.3" - doctrine "^2.1.0" - has "^1.0.3" - jsx-ast-utils "^2.1.0" - object.entries "^1.1.0" - object.fromentries "^2.0.0" - object.values "^1.1.0" - prop-types "^15.7.2" - resolve "^1.10.1" - -eslint-rule-composer@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" - integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== - -eslint-scope@3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - eslint-scope@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" @@ -3755,20 +3033,15 @@ eslint-utils@^1.4.2: dependencies: eslint-visitor-keys "^1.0.0" -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== - -eslint-visitor-keys@^1.1.0: +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== eslint@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.2.2.tgz#03298280e7750d81fcd31431f3d333e43d93f24f" - integrity sha512-mf0elOkxHbdyGX1IJEUsNBzCDdyoUgljF3rRlgfyYh0pwGnreLc0jjD6ZuleOibjmnUWZLY2eXwSooeOgGJ2jw== + version "6.5.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.5.1.tgz#828e4c469697d43bb586144be152198b91e96ed6" + integrity sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3842,45 +3115,32 @@ esrecurse@^4.1.0: estraverse "^4.1.0" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== eventemitter3@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== -events@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" - integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - exec-sh@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== -execa@0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" - integrity sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA== +execa@0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.11.0.tgz#0b3c71daf9b9159c252a863cd981af1b4410d97a" + integrity sha512-k5AR22vCt1DcfeiRixW46U5tMLtBg44ssdJM9PiXw3D8Bn5qyxFCSnKY/eR22y+ctFDGPqafpaXg2G4Emyua4A== dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" + cross-spawn "^6.0.0" + get-stream "^4.0.0" is-stream "^1.1.0" npm-run-path "^2.0.0" p-finally "^1.0.0" @@ -3901,9 +3161,9 @@ execa@^1.0.0: strip-eof "^1.0.0" execa@^2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.4.tgz#2f5cc589c81db316628627004ea4e37b93391d8e" - integrity sha512-VcQfhuGD51vQUQtKIq2fjGDLDbL6N1DTQVpYzxZ7LPIXw3HqTuIz6uxRmpV1qf8i31LHf2kjiaGI+GdHwRgbnQ== + version "2.0.5" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.5.tgz#5be3e2ea7e61bd038da5a0e11dc6ab2097357f2f" + integrity sha512-SwmwZZyJjflcqLSgllk4EQlMLst2p9muyzwNugKGFlpAz6rZ7M+s2nBR97GAq4Vzjwx2y9rcMcmqzojwN+xwNA== dependencies: cross-spawn "^6.0.5" get-stream "^5.0.0" @@ -4102,15 +3362,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-cache-dir@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" - integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== - dependencies: - commondir "^1.0.1" - make-dir "^2.0.0" - pkg-dir "^3.0.0" - find-node-modules@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/find-node-modules/-/find-node-modules-2.0.0.tgz#5db1fb9e668a3d451db3d618cd167cdd59e41b69" @@ -4119,7 +3370,7 @@ find-node-modules@2.0.0: findup-sync "^3.0.0" merge "^1.2.1" -find-root@1.1.0, find-root@^1.1.0: +find-root@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== @@ -4230,11 +3481,11 @@ fs-extra@8.1.0, fs-extra@^8.1.0: universalify "^0.1.0" fs-minipass@^1.2.5: - version "1.2.6" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.6.tgz#2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07" - integrity sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ== + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== dependencies: - minipass "^2.2.1" + minipass "^2.6.0" fs-write-stream-atomic@^1.0.8: version "1.0.10" @@ -4304,9 +3555,9 @@ get-caller-file@^2.0.1: integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-own-enumerable-property-symbols@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz#b877b49a5c16aefac3655f2ed2ea5b684df8d203" - integrity sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg== + version "3.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.1.tgz#6f7764f88ea11e0b514bd9bd860a132259992ca4" + integrity sha512-09/VS4iek66Dh2bctjRkowueRJbY1JDGR1L/zRxO1Qk8Uxs6PnqaNSqalpizPT+CDjre3hnEsuzvhgomz9qYrA== get-pkg-repo@^1.0.0: version "1.4.0" @@ -4334,16 +3585,6 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= - get-stream@^4.0.0, get-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -4400,14 +3641,6 @@ git-remote-origin-url@^2.0.0: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.2.tgz#f506ec07caade191ac0c8d5a21bdb8131b4934e3" - integrity sha512-34lMF7Yo1xEmsK2EkbArdoU79umpvm0MfzaDkSNYSJqtM5QLAVTPWgpiXSVI5o/O9EvZPSrP4Zvnec/CqhSd5w== - dependencies: - meow "^4.0.0" - semver "^5.5.0" - git-semver-tags@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.3.tgz#48988a718acf593800f99622a952a77c405bfa34" @@ -4447,9 +3680,9 @@ glob-parent@^3.1.0: path-dirname "^1.0.0" glob-parent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" - integrity sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg== + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== dependencies: is-glob "^4.0.1" @@ -4530,12 +3763,7 @@ globby@^9.2.0: pify "^4.0.1" slash "^2.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6: - version "4.2.0" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" - integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== - -graceful-fs@^4.2.0, graceful-fs@^4.2.2: +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== @@ -4545,10 +3773,10 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -handlebars@^4.1.0, handlebars@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" - integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== +handlebars@^4.1.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.2.tgz#8810a9821a9d6d52cb2f57d326d6ce7c3dfe741d" + integrity sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg== dependencies: neo-async "^2.6.0" optimist "^0.6.1" @@ -4629,31 +3857,6 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -hash-base@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" - integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hmac-drbg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - homedir-polyfill@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" @@ -4661,10 +3864,10 @@ homedir-polyfill@^1.0.1: dependencies: parse-passwd "^1.0.0" -hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== +hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: + version "2.8.4" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" + integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ== html-encoding-sniffer@^1.0.2: version "1.0.2" @@ -4695,11 +3898,6 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= - https-proxy-agent@^2.2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793" @@ -4716,9 +3914,9 @@ humanize-ms@^1.2.1: ms "^2.0.0" husky@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.4.tgz#10a48ac11ab50859b0939750fa0b4e07ad0bf669" - integrity sha512-7Rnt8aJfy+MlV28snmYK7O7vWwtOfeVxV6KhLpUFXlmx5ukQ1nQmNUB7QsAwSgdySB5X+bm7q7JIRgazqBUzKA== + version "3.0.8" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.8.tgz#8de3fed26ce9b43034ef51013c4ad368b6b74ea8" + integrity sha512-HFOsgcyrX3qe/rBuqyTt+P4Gxn5P0seJmr215LAZ/vnwK3jWB3r0ck7swbzGRUbufCf9w/lgHPVbF/YXQALgfQ== dependencies: chalk "^2.4.2" cosmiconfig "^5.2.1" @@ -4739,20 +3937,15 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.1.4: - version "1.1.13" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" - integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== - iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" - integrity sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ== + version "3.0.2" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.2.tgz#99d83a246c196ea5c93ef9315ad7b0819c35069b" + integrity sha512-EXyErtpHbn75ZTsOADsfx6J/FPo6/5cjev46PXrcTpd8z3BoRkXgYu9/JVqrI7tusjmwCZutGeRJeU0Wo1e4Cw== dependencies: minimatch "^3.0.4" @@ -4761,12 +3954,7 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.0.5: - version "5.1.2" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" - integrity sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ== - -ignore@^5.1.1: +ignore@^5.0.5, ignore@^5.1.1: version "5.1.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== @@ -4807,11 +3995,16 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" -indent-string@^3.0.0, indent-string@^3.2.0: +indent-string@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + infer-owner@^1.0.3, infer-owner@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" @@ -4825,21 +4018,11 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" @@ -4859,7 +4042,7 @@ init-package-json@^1.10.3: validate-npm-package-license "^3.0.1" validate-npm-package-name "^3.0.0" -inquirer@6.5.0, inquirer@^6.2.0, inquirer@^6.2.1: +inquirer@6.5.0: version "6.5.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== @@ -4878,7 +4061,7 @@ inquirer@6.5.0, inquirer@^6.2.0, inquirer@^6.2.1: strip-ansi "^5.1.0" through "^2.3.6" -inquirer@^6.4.1: +inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.4.1: version "6.5.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== @@ -4938,13 +4121,6 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= -is-binary-path@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= - dependencies: - binary-extensions "^1.0.0" - is-binary-path@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -5096,9 +4272,9 @@ is-path-cwd@^2.2.0: integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== is-path-inside@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.1.tgz#7417049ed551d053ab82bba3fdd6baa6b3a81e89" - integrity sha512-CKstxrctq1kUesU6WhtZDbYKzzYBuRH0UYInAVrkc/EYdB9ltbfE0gOoayG9nhohG6447sOOVGhHqsdmBvkbNg== + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" + integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" @@ -5341,9 +4517,9 @@ jest-diff@^24.9.0: pretty-format "^24.9.0" jest-docblock@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" - integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== dependencies: detect-newline "^2.1.0" @@ -5471,12 +4647,7 @@ jest-pnp-resolver@^1.2.1: resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== -jest-regex-util@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" - integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== - -jest-regex-util@^24.9.0: +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== @@ -5622,15 +4793,7 @@ jest-watcher@^24.9.0: jest-util "^24.9.0" string-length "^2.0.0" -jest-worker@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" - integrity sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ== - dependencies: - merge-stream "^1.0.1" - supports-color "^6.1.0" - -jest-worker@^24.9.0: +jest-worker@^24.6.0, jest-worker@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== @@ -5707,16 +4870,15 @@ jsesc@^2.5.1: integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== json-fixer@^1.3.1-0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.3.1.tgz#22189c66699801475114aacf54de0ec61e53e95b" - integrity sha512-cXDbm60QRRn/3h+uPmVdgt2rBP4VPTQo4OZO+ptw4iZIpT9REfgj/I7/0YVplpEFWph/WGNjto7TPgou2uyfOw== + version "1.3.3" + resolved "https://registry.yarnpkg.com/json-fixer/-/json-fixer-1.3.3.tgz#8a11c0536330e44f2aaba8b836d16657ad590dba" + integrity sha512-+UpmAba1KuudCrsbw/oZyibEyAbhFkaDoG9RJcSQVMLdSd6LI1dlaKbYbFzx4O6u4WA7TiBYAXHdQs2bMFCbEw== dependencies: - "@babel/runtime" "^7.4.5" + "@babel/runtime" "^7.5.5" chalk "^2.4.2" - eslint-config-kentcdodds "^14.3.2" pegjs "^0.10.0" -json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: +json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== @@ -5738,20 +4900,13 @@ json-stable-stringify-without-jsonify@^1.0.1: json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -json5@2.x, json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" - integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== - dependencies: - minimist "^1.2.0" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== +json5@2.x, json5@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== dependencies: minimist "^1.2.0" @@ -5777,14 +4932,6 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.1.0, jsx-ast-utils@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" - integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== - dependencies: - array-includes "^3.0.3" - object.assign "^4.1.0" - kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -5809,7 +4956,7 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== -kleur@^3.0.2: +kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== @@ -5868,9 +5015,9 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= lint-staged@^9.2.5: - version "9.2.5" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.2.5.tgz#5a3e1e0a539a403bd7f88542bc3d34ce52efdbb3" - integrity sha512-d99gTBFMJ29159+9iRvaMEQstmNcPAbQbhHSYw6D/1FncvFdIj8lWHztaq3Uq+tbZPABHXQ/fyN7Rp1QwF8HIw== + version "9.4.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.1.tgz#60c0f85745bd398e6460aa7f5adb3cad3a2b862c" + integrity sha512-zFRbo1bAJEVf1m33paTTjDVfy2v3lICCqHfmQSgNoI+lWpi7HPG5y/R2Y7Whdce+FKxlZYs/U1sDSx8+nmQdDA== dependencies: chalk "^2.4.2" commander "^2.20.0" @@ -5973,20 +5120,6 @@ load-json-file@^5.3.0: strip-bom "^3.0.0" type-fest "^0.3.0" -loader-runner@^2.3.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" - integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== - -loader-utils@^1.1.0, loader-utils@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" - integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== - dependencies: - big.js "^5.2.2" - emojis-list "^2.0.0" - json5 "^1.0.1" - locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -6040,7 +5173,7 @@ lodash.map@^4.5.1: resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3" integrity sha1-dx7Hg540c9nEzeKLGTlMNWL09tM= -lodash.memoize@^4.1.2: +lodash.memoize@4.x, lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= @@ -6080,12 +5213,12 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.14, lodash@^4.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.2.1: +lodash@4.17.14: version "4.17.14" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== -lodash@4.17.15: +lodash@4.17.15, lodash@^4.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.2.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -6118,7 +5251,7 @@ longest@^2.0.1: resolved "https://registry.yarnpkg.com/longest/-/longest-2.0.1.tgz#781e183296aa94f6d4d916dc335d0d17aefa23f8" integrity sha1-eB4YMpaqlPbU2RbcM10NF676I/g= -loose-envify@^1.0.0, loose-envify@^1.4.0: +loose-envify@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== @@ -6133,14 +5266,6 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lru-cache@^4.0.1: - version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -6160,7 +5285,7 @@ make-dir@^1.0.0: dependencies: pify "^3.0.0" -make-dir@^2.0.0, make-dir@^2.1.0: +make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== @@ -6197,11 +5322,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -mamacro@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" - integrity sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA== - map-age-cleaner@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" @@ -6236,15 +5356,6 @@ marked@^0.7.0: resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e" integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg== -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - mem@^4.0.0: version "4.3.0" resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" @@ -6254,19 +5365,6 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" -memory-fs@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" - integrity sha1-8rslNovBIeORwlIN6Slpyu4KApA= - -memory-fs@^0.4.0, memory-fs@~0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" - integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= - dependencies: - errno "^0.1.3" - readable-stream "^2.0.1" - meow@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" @@ -6313,29 +5411,22 @@ meow@^4.0.0: redent "^2.0.0" trim-newlines "^2.0.0" -merge-stream@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" - integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= - dependencies: - readable-stream "^2.0.1" - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== merge2@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" - integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== + version "1.3.0" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" + integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== merge@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: +micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6362,14 +5453,6 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - mime-db@1.40.0: version "1.40.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" @@ -6392,16 +5475,6 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= - minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -6432,20 +5505,20 @@ minimist@~0.0.1: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -minipass@^2.2.1, minipass@^2.3.5: - version "2.3.5" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" - integrity sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA== +minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== dependencies: safe-buffer "^5.1.2" yallist "^3.0.0" minizlib@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" - integrity sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA== + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== dependencies: - minipass "^2.2.1" + minipass "^2.9.0" mississippi@^3.0.0: version "3.0.0" @@ -6478,7 +5551,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -6577,7 +5650,7 @@ needle@^2.2.1: iconv-lite "^0.4.4" sax "^1.2.4" -neo-async@^2.5.0, neo-async@^2.6.0: +neo-async@^2.6.0: version "2.6.1" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== @@ -6610,9 +5683,9 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== node-gyp@^5.0.2: - version "5.0.3" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.3.tgz#80d64c23790244991b6d44532f0a351bedd3dd45" - integrity sha512-z/JdtkFGUm0QaQUusvloyYuGDub3nUbOo5de1Fz57cM++osBTvQatBUSTlF1k/w8vFHPxxXW6zxGvkxXSpaBkQ== + version "5.0.5" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.5.tgz#f6cf1da246eb8c42b097d7cd4d6c3ce23a4163af" + integrity sha512-WABl9s4/mqQdZneZHVWVG4TVr6QQJZUC6PAx47ITSk9lreZ1n+7Z9mMAIbA3vnO4J9W20P7LhCxtzfWsAD/KDw== dependencies: env-paths "^1.0.0" glob "^7.0.3" @@ -6623,7 +5696,7 @@ node-gyp@^5.0.2: request "^2.87.0" rimraf "2" semver "~5.3.0" - tar "^4.4.8" + tar "^4.4.12" which "1" node-int64@^0.4.0: @@ -6631,35 +5704,6 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= -"node-libs-browser@^1.0.0 || ^2.0.0", node-libs-browser@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" - integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^3.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.1" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.11.0" - vm-browserify "^1.0.1" - node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" @@ -6740,9 +5784,9 @@ npm-bundled@^1.0.1: integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== npm-lifecycle@^3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-3.1.3.tgz#09e9b0b6686e85fd53bab82364386222d97a3730" - integrity sha512-M0QmmqbEHBXxDrmc6X3+eKjW9+F7Edg1ENau92WkYw1sox6wojHzEZJIRm1ItljEiaigZlKL8mXni/4ylAy1Dg== + version "3.1.4" + resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-3.1.4.tgz#de6975c7d8df65f5150db110b57cce498b0b604c" + integrity sha512-tgs1PaucZwkxECGKhC/stbEgFyc3TGh2TJcg2CDr6jbvQRdteHNhmMeljRzpe4wgFAXQADoy1cSqqi7mtiAa5A== dependencies: byline "^5.0.0" graceful-fs "^4.1.15" @@ -6754,13 +5798,13 @@ npm-lifecycle@^3.1.2: which "^1.3.1" "npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" - integrity sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA== + version "6.1.1" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.1.tgz#02168cb0a49a2b75bf988a28698de7b529df5cb7" + integrity sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg== dependencies: - hosted-git-info "^2.6.0" + hosted-git-info "^2.7.1" osenv "^0.1.5" - semver "^5.5.0" + semver "^5.6.0" validate-npm-package-name "^3.0.0" npm-packlist@^1.1.6, npm-packlist@^1.4.4: @@ -6772,9 +5816,9 @@ npm-packlist@^1.1.6, npm-packlist@^1.4.4: npm-bundled "^1.0.1" npm-pick-manifest@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-3.0.1.tgz#19c350ffbe42e0c3c054dcd50dd5760556a98bd8" - integrity sha512-QsJY1LuN6vuGg2BDnteeWGYODOYWZZwbW/YyCKHK4tt9uE+k2d70eg+Kr1CSLbX157Nu8UtY/Afdv884RnJSrQ== + version "3.0.2" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-3.0.2.tgz#f4d9e5fd4be2153e5f4e5f9b7be8dc419a99abb7" + integrity sha512-wNprTNg+X5nf+tDi+hbjdHhM4bX+mKqv6XmPh7B5eG+QY9VARfQPfCEH013H5GqfNj6ee8Ij2fg8yk0mzps1Vw== dependencies: figgy-pudding "^3.5.1" npm-package-arg "^6.0.0" @@ -6819,7 +5863,7 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -6833,7 +5877,12 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-keys@^1.0.11, object-keys@^1.0.12: +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + +object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -6845,36 +5894,6 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.entries@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" - integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.12.0" - function-bind "^1.1.1" - has "^1.0.3" - -object.fromentries@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab" - integrity sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA== - dependencies: - define-properties "^1.1.2" - es-abstract "^1.11.0" - function-bind "^1.1.1" - has "^1.0.1" - object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" @@ -6951,11 +5970,6 @@ optionator@^0.8.1, optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" -os-browserify@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= - os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -6970,7 +5984,7 @@ os-locale@^3.0.0: lcid "^2.0.0" mem "^4.0.0" -os-name@^3.0.0: +os-name@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.1.0.tgz#dec19d966296e1cd62d701a5a66ee1ddeae70801" integrity sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg== @@ -7026,9 +6040,9 @@ p-limit@^1.1.0: p-try "^1.0.0" p-limit@^2.0.0, p-limit@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" - integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== dependencies: p-try "^2.0.0" @@ -7106,17 +6120,12 @@ p-waterfall@^1.0.0: dependencies: p-reduce "^1.0.0" -pako@~1.0.5: - version "1.0.10" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" - integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== - parallel-transform@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" - integrity sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY= + version "1.2.0" + resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" + integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== dependencies: - cyclist "~0.2.2" + cyclist "^1.0.1" inherits "^2.0.3" readable-stream "^2.1.5" @@ -7127,18 +6136,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-asn1@^5.0.0: - version "5.1.4" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.4.tgz#37f6628f823fbdeb2273b4d540434a22f3ef1fcc" - integrity sha512-Qs5duJcuvNExRfFZ99HDD3z4mAi3r9Wl/FOjEOijlxwCZs7E7mW2vjTpgQ4J8LpTF8x5v+1Vn5UQFejmWT11aw== - dependencies: - asn1.js "^4.0.0" - browserify-aes "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - safe-buffer "^5.1.1" - parse-github-repo-url@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" @@ -7202,11 +6199,6 @@ pascalcase@^0.1.1: resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-browserify@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" - integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== - path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" @@ -7277,17 +6269,6 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pbkdf2@^3.0.3: - version "3.0.17" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" - integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - pegjs@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/pegjs/-/pegjs-0.10.0.tgz#cf8bafae6eddff4b5a7efb185269eaaf4610ddbd" @@ -7358,14 +6339,7 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -please-upgrade-node@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" - integrity sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ== - dependencies: - semver-compare "^1.0.0" - -please-upgrade-node@^3.2.0: +please-upgrade-node@^3.1.1, please-upgrade-node@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== @@ -7407,11 +6381,6 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= - progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -7431,12 +6400,12 @@ promise-retry@^1.1.1: retry "^0.10.0" prompts@^2.0.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db" - integrity sha512-+x5TozgqYdOwWsQFZizE/Tra3fKvAoy037kOyU6cgz84n8f6zxngLOV4O32kTwt9FcLCxAqw0P/c8rOr9y+Gfg== + version "2.2.1" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" + integrity sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw== dependencies: - kleur "^3.0.2" - sisteransi "^1.0.0" + kleur "^3.0.3" + sisteransi "^1.0.3" promzard@^0.3.0: version "0.3.0" @@ -7445,15 +6414,6 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.7.2: - version "15.7.2" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" - integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== - dependencies: - loose-envify "^1.4.0" - object-assign "^4.1.1" - react-is "^16.8.1" - proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" @@ -7471,32 +6431,10 @@ protoduck@^5.0.1: dependencies: genfun "^5.0.0" -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= - psl@^1.1.24, psl@^1.1.28: - version "1.2.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.2.0.tgz#df12b5b1b3a30f51c329eacbdef98f3a6e136dc6" - integrity sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA== - -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" + version "1.4.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" + integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== pump@^2.0.0: version "2.0.1" @@ -7523,12 +6461,7 @@ pumpify@^1.3.3: inherits "^2.0.3" pump "^2.0.0" -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= - -punycode@^1.2.4, punycode@^1.4.1: +punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= @@ -7548,36 +6481,11 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -querystring-es3@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= - -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -randomfill@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" - integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== - dependencies: - randombytes "^2.0.5" - safe-buffer "^5.1.0" - rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -7588,22 +6496,22 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-is@^16.8.1, react-is@^16.8.4: - version "16.8.6" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" - integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== +react-is@^16.8.4: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" + integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== read-cmd-shim@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" - integrity sha1-LV0Vd4ajfAVdIgd8MsU/gynpHHs= + version "1.0.4" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.4.tgz#b4a53d43376211b45243f0072b6e603a8e37640d" + integrity sha512-Pqpl3qJ/QdOIjRYA0q5DND/gLvGOfpIz/fYVDGYpOXfW/lFrIttmLsBnd6IkyK10+JHU9zhsaudfvrQTBB9YFQ== dependencies: graceful-fs "^4.1.2" "read-package-json@1 || 2", read-package-json@^2.0.0, read-package-json@^2.0.13: - version "2.0.13" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.0.13.tgz#2e82ebd9f613baa6d2ebe3aa72cefe3f68e41f4a" - integrity sha512-/1dZ7TRZvGrYqE0UAfN6qQb5GYBsNcqS1C0tNK601CFOJmtHI7NIGXwetEPU/OtoFHZL3hDxm4rolFFVE9Bnmg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.0.tgz#e3d42e6c35ea5ae820d9a03ab0c7291217fc51d5" + integrity sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A== dependencies: glob "^7.1.1" json-parse-better-errors "^1.0.1" @@ -7653,15 +6561,6 @@ read-pkg-up@^4.0.0: find-up "^3.0.0" read-pkg "^3.0.0" -read-pkg-up@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-6.0.0.tgz#da75ce72762f2fa1f20c5a40d4dd80c77db969e3" - integrity sha512-odtTvLl+EXo1eTsMnoUHRmg/XmXdTkwXVxy4VFE9Kp6cCq7b3l7QMdBndND3eAFzrbSAXC/WCUOQQ9rLjifKZw== - dependencies: - find-up "^4.0.0" - read-pkg "^5.1.1" - type-fest "^0.5.0" - read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" @@ -7706,7 +6605,7 @@ read@1, read@~1.0.1: dependencies: mute-stream "~0.0.4" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== @@ -7738,15 +6637,6 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -readdirp@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" - integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== - dependencies: - graceful-fs "^4.1.11" - micromatch "^3.1.10" - readable-stream "^2.0.2" - readdirp@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.1.2.tgz#fa85d2d14d4289920e4671dead96431add2ee78a" @@ -7795,9 +6685,9 @@ regenerator-runtime@^0.11.0: integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== regenerator-runtime@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" - integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" @@ -7938,14 +6828,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@1.x, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.5.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" - integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== - dependencies: - path-parse "^1.0.6" - -resolve@^1.1.6: +resolve@1.x, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.5.0: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== @@ -7980,7 +6863,14 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@2.6.3, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, 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" + +rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -7994,14 +6884,6 @@ rimraf@^3.0.0: dependencies: glob "^7.1.3" -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -8032,13 +6914,13 @@ run-queue@^1.0.0, run-queue@^1.0.3: aproba "^1.1.1" rxjs@^6.3.3, rxjs@^6.4.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" - integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.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.0" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== @@ -8080,41 +6962,27 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -schema-utils@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" - integrity sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g== - dependencies: - ajv "^6.1.0" - ajv-errors "^1.0.0" - ajv-keywords "^3.1.0" - semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= "semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" - integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== semver@5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== -semver@6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.1.tgz#53f53da9b30b2103cd4f15eab3a18ecbcb210c9b" - integrity sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ== - -semver@^6.0.0, semver@^6.1.1: +semver@6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== -semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -8124,11 +6992,6 @@ semver@~5.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= -serialize-javascript@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.7.0.tgz#d6e0dfb2a3832a8c94468e6eb1db97e55a192a65" - integrity sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA== - set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -8144,19 +7007,6 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= - -sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -8188,10 +7038,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= -sisteransi@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.2.tgz#ec57d64b6f25c4f26c0e2c7dd23f2d7f12f7e418" - integrity sha512-ZcYcZcT69nSLAR2oLN2JwNmLkJEKGooFMCdvOkFrToUt/WfcRWqhIg4P4KwY4dmLbuyXIx4o4YmPsvMRJYJd/w== +sisteransi@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.3.tgz#98168d62b79e3a5e758e27ae63c4a053d748f4eb" + integrity sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg== slash@^1.0.0: version "1.0.0" @@ -8285,11 +7135,6 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" -source-list-map@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" - integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== - source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" @@ -8301,10 +7146,10 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@~0.5.12: - version "0.5.12" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" - integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== +source-map-support@^0.5.6: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -8416,14 +7261,6 @@ stealthy-require@^1.1.1: resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= -stream-browserify@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" - integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" @@ -8432,26 +7269,15 @@ stream-each@^1.1.0: end-of-stream "^1.1.0" stream-shift "^1.0.0" -stream-http@^2.7.2: - version "2.8.3" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" - integrity sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.1" - readable-stream "^2.3.6" - to-arraybuffer "^1.0.0" - xtend "^4.0.0" - stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= string-argv@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.0.tgz#0ea99e7257fea5e97a1bfcdfc19cf12d68e6ec6a" - integrity sha512-NGZHq3nkSXVtGZXTBjFru3MNfoZyIzN25T7BmvdgnSC0LCJczAGLLMQLyjywSIaAoqSemgLzBRHOsnrHbt60+Q== + version "0.3.1" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" + integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== string-length@^2.0.0: version "2.0.0" @@ -8487,12 +7313,28 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string_decoder@^1.0.0, string_decoder@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" - integrity sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== +string.prototype.trimleft@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== dependencies: - safe-buffer "~5.1.0" + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" string_decoder@~1.1.1: version "1.1.1" @@ -8594,7 +7436,7 @@ supports-color@^2.0.0: resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^5.2.0, supports-color@^5.3.0: +supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== @@ -8619,33 +7461,23 @@ symbol-tree@^3.2.2: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== table@^5.2.3: - version "5.4.4" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.4.tgz#6e0f88fdae3692793d1077fd172a4667afe986a6" - integrity sha512-IIfEAUx5QlODLblLrGTTLJA7Tk0iLSGBvgY8essPRVNGHAzThujww1YqHLs6h3HfTg55h++RzLHH5Xw/rfv+mg== + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== dependencies: ajv "^6.10.2" lodash "^4.17.14" slice-ansi "^2.1.0" string-width "^3.0.0" -tapable@^0.1.8: - version "0.1.10" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" - integrity sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q= - -tapable@^1.0.0, tapable@^1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" - integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== - -tar@^4, tar@^4.4.10, tar@^4.4.8: - version "4.4.10" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.10.tgz#946b2810b9a5e0b26140cf78bea6b0b0d689eba1" - integrity sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA== +tar@^4, tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== dependencies: chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.5" + minipass "^2.8.6" minizlib "^1.2.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" @@ -8668,31 +7500,6 @@ temp-write@^3.4.0: temp-dir "^1.0.0" uuid "^3.0.1" -terser-webpack-plugin@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz#69aa22426299f4b5b3775cbed8cb2c5d419aa1d4" - integrity sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg== - dependencies: - cacache "^11.3.2" - find-cache-dir "^2.0.0" - is-wsl "^1.1.0" - loader-utils "^1.2.3" - schema-utils "^1.0.0" - serialize-javascript "^1.7.0" - source-map "^0.6.1" - terser "^4.0.0" - webpack-sources "^1.3.0" - worker-farm "^1.7.0" - -terser@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.2.tgz#b2656c8a506f7ce805a3f300a2ff48db022fa391" - integrity sha512-jvNoEQSPXJdssFwqPSgWjsOrb+ELoE+ILpHPKXC83tIxOlh2U75F1KuB2luLD/3a6/7K3Vw5pDn+hvu0C4AzSw== - dependencies: - commander "^2.20.0" - source-map "~0.6.1" - source-map-support "~0.5.12" - test-exclude@^5.2.3: version "5.2.3" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" @@ -8757,13 +7564,6 @@ through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= -timers-browserify@^2.0.4: - version "2.0.10" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" - integrity sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg== - dependencies: - setimmediate "^1.0.4" - tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -8783,11 +7583,6 @@ tmpl@1.0.x: resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -8863,20 +7658,16 @@ trim-off-newlines@^1.0.0: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= - ts-jest@^24.0.0: - version "24.0.2" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.0.2.tgz#8dde6cece97c31c03e80e474c749753ffd27194d" - integrity sha512-h6ZCZiA1EQgjczxq+uGLXQlNgeg02WWJBbeT8j6nyIBRQdglqbvzDoHahTEIiS6Eor6x8mK6PfZ7brQ9Q6tzHw== + version "24.1.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.1.0.tgz#2eaa813271a2987b7e6c3fefbda196301c131734" + integrity sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ== dependencies: bs-logger "0.x" buffer-from "1.x" fast-json-stable-stringify "2.x" json5 "2.x" + lodash.memoize "4.x" make-error "1.x" mkdirp "0.x" resolve "1.x" @@ -8884,9 +7675,9 @@ ts-jest@^24.0.0: yargs-parser "10.x" ts-node@^8.3.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.3.0.tgz#e4059618411371924a1fb5f3b125915f324efb57" - integrity sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ== + version "8.4.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.4.1.tgz#270b0dba16e8723c9fa4f9b4775d3810fd994b4f" + integrity sha512-5LpRN+mTiCs7lI5EtbXmF/HfMeCjzt7DH9CZwtkr6SywStrNQC723wG+aOWFiLNn7zT3kD/RnFqi3ZUfr4l5Qw== dependencies: arg "^4.1.0" diff "^4.0.1" @@ -8900,15 +7691,15 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== tslint@^5.19.0: - version "5.19.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.19.0.tgz#a2cbd4a7699386da823f6b499b8394d6c47bb968" - integrity sha512-1LwwtBxfRJZnUvoS9c0uj8XQtAnyhWr9KlNvDIdB+oXyT+VpsOAaEhEgKi1HrZ8rq0ki/AAnbGSv4KM6/AfVZw== + version "5.20.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.20.0.tgz#fac93bfa79568a5a24e7be9cdde5e02b02d00ec1" + integrity sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g== dependencies: "@babel/code-frame" "^7.0.0" builtin-modules "^1.1.1" chalk "^2.3.0" commander "^2.12.1" - diff "^3.2.0" + diff "^4.0.1" glob "^7.1.1" js-yaml "^3.13.1" minimatch "^3.0.4" @@ -8932,11 +7723,6 @@ tsutils@^3.17.1: dependencies: tslib "^1.8.1" -tty-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" - integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -8961,11 +7747,6 @@ type-fest@^0.3.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== -type-fest@^0.5.0: - version "0.5.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" - integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== - type-fest@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" @@ -8976,10 +7757,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.2.1 <3.7.0": - version "3.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54" - integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw== +typescript@*, "typescript@>=3.2.1 <3.8.0 >3.7.0-dev.0", typescript@^3.7.0-beta: + version "3.7.0-dev.20191006" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191006.tgz#b455c0bdbc29625b6f95886e17c85ded1271f588" + integrity sha512-0uxLQ41QwguSZdMlQ5GUXljS42Ti1+AFJ1EnTsQOSX4Z0eG2bwxHDJItIRDGV6yZGBMXJ6HGapxv2qxSeW5svA== uglify-js@^3.1.4: version "3.6.0" @@ -9023,12 +7804,12 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" -universal-user-agent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-3.0.0.tgz#4cc88d68097bffd7ac42e3b7c903e7481424b4b9" - integrity sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA== +universal-user-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-4.0.0.tgz#27da2ec87e32769619f68a14996465ea1cb9df16" + integrity sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA== dependencies: - os-name "^3.0.0" + os-name "^3.1.0" universalify@^0.1.0: version "0.1.2" @@ -9043,11 +7824,6 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" -upath@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" - integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== - uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -9060,19 +7836,6 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-template@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" - integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= - -url@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= - dependencies: - punycode "1.3.2" - querystring "0.2.0" - use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" @@ -9098,24 +7861,10 @@ util.promisify@^1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= - dependencies: - inherits "2.0.1" - -util@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/util/-/util-0.11.1.tgz#3236733720ec64bb27f6e26f421aaa2e1b588d61" - integrity sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ== - dependencies: - inherits "2.0.3" - uuid@^3.0.1, uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== v8-compile-cache@^2.0.3: version "2.1.0" @@ -9146,11 +7895,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vm-browserify@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" - integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== - w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" @@ -9165,15 +7909,6 @@ walker@^1.0.7, walker@~1.0.5: dependencies: makeerror "1.0.x" -watchpack@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" - integrity sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA== - dependencies: - chokidar "^2.0.2" - graceful-fs "^4.1.2" - neo-async "^2.5.0" - wcwidth@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -9186,43 +7921,6 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== -webpack-sources@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85" - integrity sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA== - dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" - -webpack@^4.33.0: - version "4.36.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.36.1.tgz#f546fda7a403a76faeaaa7196c50d12370ed18a9" - integrity sha512-Ej01/N9W8DVyhEpeQnbUdGvOECw0L46FxS12cCOs8gSK7bhUlrbHRnWkjiXckGlHjUrmL89kDpTRIkUk6Y+fKg== - dependencies: - "@webassemblyjs/ast" "1.8.5" - "@webassemblyjs/helper-module-context" "1.8.5" - "@webassemblyjs/wasm-edit" "1.8.5" - "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^6.2.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chrome-trace-event "^1.0.0" - enhanced-resolve "^4.1.0" - eslint-scope "^4.0.0" - json-parse-better-errors "^1.0.2" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - micromatch "^3.1.8" - mkdirp "~0.5.0" - neo-async "^2.5.0" - node-libs-browser "^2.0.0" - schema-utils "^1.0.0" - tapable "^1.1.0" - terser-webpack-plugin "^1.1.0" - watchpack "^1.5.0" - webpack-sources "^1.3.0" - whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" @@ -9299,13 +7997,6 @@ wordwrap@~1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= -worker-farm@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" - integrity sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw== - dependencies: - errno "~0.1.7" - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -9405,7 +8096,7 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== -xtend@^4.0.0, xtend@~4.0.1: +xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -9415,15 +8106,10 @@ xtend@^4.0.0, xtend@~4.0.1: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= - yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" - integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== yargs-parser@10.x, yargs-parser@^10.0.0: version "10.1.0" @@ -9466,7 +8152,7 @@ yargs@^12.0.1: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^13.1.0, yargs@^13.3.0: +yargs@^13.3.0: version "13.3.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== @@ -9482,7 +8168,24 @@ yargs@^13.1.0, yargs@^13.3.0: y18n "^4.0.0" yargs-parser "^13.1.1" +yargs@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.0.0.tgz#ba4cacc802b3c0b3e36a9e791723763d57a85066" + integrity sha512-ssa5JuRjMeZEUjg7bEL99AwpitxU/zWGAGpdj0di41pOEmJti8NR6kyUIJBkR78DTYNPZOU08luUo0GTHuB+ow== + dependencies: + cliui "^5.0.0" + decamelize "^1.2.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" + yn@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.0.tgz#fcbe2db63610361afcc5eb9e0ac91e976d046114" - integrity sha512-kKfnnYkbTfrAdd0xICNFw7Atm8nKpLcLv9AZGEt+kczL/WQVai4e2V6ZN8U/O+iI6WrNuJjNNOyu4zfhl9D3Hg== + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== From 111ecc668eb8a332d7311dacf196fceec83316cb Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 14 Oct 2019 17:01:40 +0000 Subject: [PATCH 09/47] chore: publish v2.4.0 --- CHANGELOG.md | 17 +++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 16 ++++++++++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 17 +++++++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 16 ++++++++++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 16 ++++++++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 11 +++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 16 ++++++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 124 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd6a1421944f..66ff74784f0c 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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* **eslint-plugin:** [promise-function-async] Should not report… ([#1023](https://github.com/typescript-eslint/typescript-eslint/issues/1023)) ([514bed9](https://github.com/typescript-eslint/typescript-eslint/commit/514bed9)) +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) diff --git a/lerna.json b/lerna.json index 093a7b7253e4..f4653f7fb8d0 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.3.3", + "version": "2.4.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 50d3ff8d511a..f76756a7a3e0 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **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 78d58d38427b..88c3cfe1d722 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": "2.3.3", + "version": "2.4.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.3", + "@typescript-eslint/experimental-utils": "2.4.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.3.3" + "@typescript-eslint/parser": "2.4.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index ecbd6059dfb2..e39f75e56170 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* **eslint-plugin:** [promise-function-async] Should not report… ([#1023](https://github.com/typescript-eslint/typescript-eslint/issues/1023)) ([514bed9](https://github.com/typescript-eslint/typescript-eslint/commit/514bed9)) +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 9eeb7f31616e..c9e1b0fe0da5 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.3.3", + "version": "2.4.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.3", + "@typescript-eslint/experimental-utils": "2.4.0", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 43271d72e814..f3721e9a3a8d 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index e312f6b11140..d39a9110f7ed 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.3.3", + "version": "2.4.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.3.3", + "@typescript-eslint/typescript-estree": "2.4.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 9ccea9c2f802..0017c21cb6a0 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 9979d210ed8a..e551b4d86ef6 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.3.3", + "version": "2.4.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.3.3", - "@typescript-eslint/typescript-estree": "2.3.3", + "@typescript-eslint/experimental-utils": "2.4.0", + "@typescript-eslint/typescript-estree": "2.4.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.3.3", + "@typescript-eslint/shared-fixtures": "2.4.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 959a366b0e61..945b637ecb1d 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **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 30eb5af18999..a833a2bd0ee9 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.3.3", + "version": "2.4.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 0bf4baa176b7..0278cba2f3fb 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/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. +# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) + + +### Bug Fixes + +* support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) + + +### Features + +* **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) + + + + + ## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) **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 0e2dcc979145..4716b2ba19d6 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.3.3", + "version": "2.4.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -56,7 +56,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.3.3", + "@typescript-eslint/shared-fixtures": "2.4.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 1918024e86acdf315dbbe659af6fea5d7244b336 Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Mon, 14 Oct 2019 11:19:36 -0700 Subject: [PATCH 10/47] chore: declare TypeScript as an optional peerDependency (#990) --- packages/eslint-plugin/package.json | 5 +++++ packages/typescript-estree/package.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c9e1b0fe0da5..6633b8f2ca59 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -58,5 +58,10 @@ "peerDependencies": { "@typescript-eslint/parser": "^2.0.0", "eslint": "^5.0.0 || ^6.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 4716b2ba19d6..7b0a0ed58fd8 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -62,5 +62,10 @@ "lodash.isplainobject": "4.0.6", "tmp": "^0.1.0", "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } } From 5f093ac50ad5efb48d20b2e4a77c585ef8b4787f Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 15 Oct 2019 18:07:55 -0700 Subject: [PATCH 11/47] feat(eslint-plugin): Support abstract members in member-ordering rule (#395) (#1004) --- .../docs/rules/member-ordering.md | 28 +++- .../src/rules/member-ordering.ts | 31 +++- packages/eslint-plugin/src/util/misc.ts | 5 +- .../tests/rules/member-ordering.test.ts | 144 +++++++++++++++++- 4 files changed, 195 insertions(+), 13 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md index 50c4a7eacd33..517673f09d68 100644 --- a/packages/eslint-plugin/docs/rules/member-ordering.md +++ b/packages/eslint-plugin/docs/rules/member-ordering.md @@ -37,6 +37,9 @@ There are multiple ways to specify the member types. The most explicit and granu 'public-instance-field', 'protected-instance-field', 'private-instance-field', + 'public-abstract-field', + 'protected-abstract-field', + 'private-abstract-field', // Constructors 'public-constructor', @@ -50,6 +53,9 @@ There are multiple ways to specify the member types. The most explicit and granu 'public-instance-method', 'protected-instance-method', 'private-instance-method', + 'public-abstract-method', + 'protected-abstract-method', + 'private-abstract-method', ] ``` @@ -57,7 +63,7 @@ Note: If you only specify some of the possible types, the non-specified ones can ### Member group types (with accessibility, ignoring scope) -It is also possible to group member types by their accessibility (`static`, `instance`), ignoring their scope. +It is also possible to group member types by their accessibility (`static`, `instance`, `abstract`), ignoring their scope. ```json5 [ @@ -85,13 +91,15 @@ Another option is to group the member types by their scope (`public`, `protected // Fields 'static-field', // = ['public-static-field', 'protected-static-field', 'private-static-field']) 'instance-field', // = ['public-instance-field', 'protected-instance-field', 'private-instance-field']) + 'abstract-field', // = ['public-abstract-field', 'protected-abstract-field', 'private-abstract-field']) // Constructors 'constructor', // = ['public-constructor', 'protected-constructor', 'private-constructor']) // Methods 'static-method', // = ['public-static-method', 'protected-static-method', 'private-static-method']) - 'instance-method', // = ['public-instance-method', 'protected-instance-method', 'private-instance-method'] + 'instance-method', // = ['public-instance-method', 'protected-instance-method', 'private-instance-method']) + 'abstract-method', // = ['public-abstract-method', 'protected-abstract-method', 'private-abstract-method']) ] ``` @@ -102,13 +110,15 @@ The third grouping option is to ignore both scope and accessibility. ```json5 [ // Fields - 'field', // = ['public-static-field', 'protected-static-field', 'private-static-field', 'public-instance-field', 'protected-instance-field', 'private-instance-field']) + 'field', // = ['public-static-field', 'protected-static-field', 'private-static-field', 'public-instance-field', 'protected-instance-field', 'private-instance-field', + // 'public-abstract-field', 'protected-abstract-field', private-abstract-field']) // Constructors // Only the accessibility of constructors is configurable. See above. // Methods - 'method', // = ['public-static-method', 'protected-static-method', 'private-static-method', 'public-instance-method', 'protected-instance-method', 'private-instance-method']) + 'method', // = ['public-static-method', 'protected-static-method', 'private-static-method', 'public-instance-method', 'protected-instance-method', 'private-instance-method', + // 'public-abstract-method', 'protected-abstract-method', 'private-abstract-method']) ] ``` @@ -127,12 +137,17 @@ The default configuration looks as follows: "protected-instance-field", "private-instance-field", + "public-abstract-field", + "protected-abstract-field", + "private-abstract-field", + "public-field", "protected-field", "private-field", "static-field", "instance-field", + "abstract-field", "field", @@ -146,12 +161,17 @@ The default configuration looks as follows: "protected-instance-method", "private-instance-method", + "public-abstract-method", + "protected-abstract-method", + "private-abstract-method", + "public-method", "protected-method", "private-method", "static-method", "instance-method", + "abstract-method", "method" ] diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index 72020afc6008..b17076856949 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -24,8 +24,8 @@ const allMemberTypes = ['field', 'method', 'constructor'].reduce( all.push(`${accessibility}-${type}`); // e.g. `public-field` if (type !== 'constructor') { - // There is no `static-constructor` or `instance-constructor - ['static', 'instance'].forEach(scope => { + // There is no `static-constructor` or `instance-constructor or `abstract-constructor` + ['static', 'instance', 'abstract'].forEach(scope => { if (!all.includes(`${scope}-${type}`)) { all.push(`${scope}-${type}`); } @@ -138,12 +138,17 @@ export default util.createRule({ 'protected-instance-field', 'private-instance-field', + 'public-abstract-field', + 'protected-abstract-field', + 'private-abstract-field', + 'public-field', 'protected-field', 'private-field', 'static-field', 'instance-field', + 'abstract-field', 'field', @@ -157,12 +162,17 @@ export default util.createRule({ 'protected-instance-method', 'private-instance-method', + 'public-abstract-method', + 'protected-abstract-method', + 'private-abstract-method', + 'public-method', 'protected-method', 'private-method', 'static-method', 'instance-method', + 'abstract-method', 'method', ], @@ -185,15 +195,15 @@ export default util.createRule({ ): string | null { // TODO: add missing TSCallSignatureDeclaration // TODO: add missing TSIndexSignature - // TODO: add missing TSAbstractClassProperty - // TODO: add missing TSAbstractMethodDefinition switch (node.type) { + case AST_NODE_TYPES.TSAbstractMethodDefinition: case AST_NODE_TYPES.MethodDefinition: return node.kind; case AST_NODE_TYPES.TSMethodSignature: return 'method'; case AST_NODE_TYPES.TSConstructSignatureDeclaration: return 'constructor'; + case AST_NODE_TYPES.TSAbstractClassProperty: case AST_NODE_TYPES.ClassProperty: return node.value && functionExpressions.includes(node.value.type) ? 'method' @@ -215,8 +225,10 @@ export default util.createRule({ switch (node.type) { case AST_NODE_TYPES.TSPropertySignature: case AST_NODE_TYPES.TSMethodSignature: + case AST_NODE_TYPES.TSAbstractClassProperty: case AST_NODE_TYPES.ClassProperty: return util.getNameFromPropertyName(node.key); + case AST_NODE_TYPES.TSAbstractMethodDefinition: case AST_NODE_TYPES.MethodDefinition: return node.kind === 'constructor' ? 'constructor' @@ -268,7 +280,16 @@ export default util.createRule({ return order.length - 1; } - const scope = 'static' in node && node.static ? 'static' : 'instance'; + const abstract = + node.type === 'TSAbstractClassProperty' || + node.type === 'TSAbstractMethodDefinition'; + + const scope = + 'static' in node && node.static + ? 'static' + : abstract + ? 'abstract' + : 'instance'; const accessibility = 'accessibility' in node && node.accessibility ? node.accessibility diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index cae887c229f1..58c41249d473 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -96,7 +96,10 @@ export function findFirstResult( * or ClassProperty node, with handling for computed property names. */ export function getNameFromClassMember( - methodDefinition: TSESTree.MethodDefinition | TSESTree.ClassProperty, + methodDefinition: + | TSESTree.MethodDefinition + | TSESTree.ClassProperty + | TSESTree.TSAbstractMethodDefinition, sourceCode: TSESLint.SourceCode, ): string { if (keyCanBeReadAsPropertyName(methodDefinition.key)) { diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 81e67999b8dd..936fe3a89004 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -1211,12 +1211,45 @@ type Foo = { `, options: [{ default: ['method', 'constructor', 'field'] }], }, - ` + { + code: ` abstract class Foo { B: string; abstract A: () => {} } `, + }, + { + code: ` +interface Foo { + public B: string; + [A:string]: number; +} + `, + }, + { + code: ` +abstract class Foo { + private static C: string; + B: string; + private D: string; + protected static F(): {}; + public E(): {}; + public abstract A = () => {}; + protected abstract G(): void; +} + `, + }, + { + code: ` +abstract class Foo { + protected typeChecker: (data: any) => boolean; + public abstract required: boolean; + abstract verify(): void; +} + `, + options: [{ classes: ['field', 'constructor', 'method'] }], + }, ], invalid: [ { @@ -3319,7 +3352,7 @@ type Foo = { { code: ` abstract class Foo { - abstract A: () => {} + abstract A = () => {}; B: string; } `, @@ -3328,12 +3361,117 @@ abstract class Foo { messageId: 'incorrectOrder', data: { name: 'B', - rank: 'method', + rank: 'public abstract method', }, line: 4, column: 5, }, ], }, + { + code: ` +abstract class Foo { + abstract A: () => {}; + B: string; + public C() {}; + private D() {}; + abstract E() {}; +} + `, + errors: [ + { + messageId: 'incorrectOrder', + data: { + name: 'B', + rank: 'public abstract field', + }, + line: 4, + column: 5, + }, + ], + }, + { + code: ` +abstract class Foo { + B: string; + abstract C = () => {}; + abstract A: () => {}; +} + `, + options: [{ default: ['method', 'constructor', 'field'] }], + errors: [ + { + messageId: 'incorrectOrder', + data: { + name: 'C', + rank: 'field', + }, + line: 4, + column: 5, + }, + ], + }, + { + code: ` +class Foo { + C: number; + [A:string]: number; + public static D(): {}; + private static [B:string]: number; +} + `, + options: [ + { + default: [ + 'field', + 'method', + 'public-static-method', + 'private-static-method', + ], + }, + ], + errors: [ + { + messageId: 'incorrectOrder', + data: { + name: 'D', + rank: 'private static method', + }, + line: 5, + column: 5, + }, + ], + }, + { + code: ` +abstract class Foo { + abstract B: string; + abstract A(): void; + public C(): {}; + +} + `, + options: [{ default: ['method', 'constructor', 'field'] }], + errors: [ + { + messageId: 'incorrectOrder', + data: { + name: 'A', + rank: 'field', + }, + line: 4, + column: 5, + }, + { + messageId: 'incorrectOrder', + data: { + name: 'C', + rank: 'field', + }, + line: 5, + column: 5, + }, + ], + }, ], }); From ec627477fb314e6e268d9d5ddd384902af4cebed Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 15 Oct 2019 18:12:17 -0700 Subject: [PATCH 12/47] fix(typescript-estree): handle running out of fs watchers (#1088) --- packages/typescript-estree/README.md | 5 + packages/typescript-estree/package.json | 2 + packages/typescript-estree/src/parser.ts | 50 ++++++-- .../typescript-estree/src/tsconfig-parser.ts | 119 ++++++++++++------ yarn.lock | 11 +- 5 files changed, 137 insertions(+), 50 deletions(-) diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 55cf645d88ec..fe1515c869ee 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -144,6 +144,11 @@ I work closely with the TypeScript Team and we are gradually aliging the AST of - `npm run unit-tests` - run only unit tests - `npm run ast-alignment-tests` - run only Babylon AST alignment tests +## Debugging + +If you encounter a bug with the parser that you want to investigate, you can turn on the debug logging via setting the environment variable: `DEBUG=typescript-eslint:*`. +I.e. in this repo you can run: `DEBUG=typescript-eslint:* yarn lint`. + ## License TypeScript ESTree inherits from the the original TypeScript ESLint Parser license, as the majority of the work began there. It is licensed under a permissive BSD 2-clause license. diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 7b0a0ed58fd8..225380a2bd27 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -40,6 +40,7 @@ }, "dependencies": { "chokidar": "^3.0.2", + "debug": "^4.1.1", "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", @@ -50,6 +51,7 @@ "@babel/parser": "7.5.5", "@babel/types": "^7.3.2", "@types/babel-code-frame": "^6.20.1", + "@types/debug": "^4.1.5", "@types/glob": "^7.1.1", "@types/is-glob": "^4.0.1", "@types/lodash.isplainobject": "^4.0.4", diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 07435780a37d..6aec2452e5a0 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,3 +1,4 @@ +import debug from 'debug'; import path from 'path'; import semver from 'semver'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports @@ -15,6 +16,8 @@ import { defaultCompilerOptions, } from './tsconfig-parser'; +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 @@ -41,6 +44,17 @@ function getFileName({ jsx }: { jsx?: boolean }): string { return jsx ? 'estree.tsx' : 'estree.ts'; } +function enforceString(code: unknown): string { + /** + * Ensure the source code is a string + */ + if (typeof code !== 'string') { + return String(code); + } + + return code; +} + /** * Resets the extra config object */ @@ -82,6 +96,8 @@ function getASTFromProject( options: TSESTreeOptions, createDefaultProgram: boolean, ): ASTAndProgram | undefined { + log('Attempting to get AST from project(s) for: %s', options.filePath); + const filePath = options.filePath || getFileName(options); const astAndProgram = firstDefined( calculateProjectParserOptions(code, filePath, extra), @@ -139,6 +155,11 @@ function getASTAndDefaultProject( code: string, options: TSESTreeOptions, ): ASTAndProgram | undefined { + log( + 'Attempting to get AST from the default project(s): %s', + options.filePath, + ); + const fileName = options.filePath || getFileName(options); const program = createProgram(code, fileName, extra); const ast = program && program.getSourceFile(fileName); @@ -150,6 +171,8 @@ function getASTAndDefaultProject( * @returns Returns a new source file and program corresponding to the linted code */ function createNewProgram(code: string): ASTAndProgram { + log('Getting AST without type information'); + const FILENAME = getFileName(extra); const compilerHost: ts.CompilerHost = { @@ -226,6 +249,9 @@ function getProgramAndAST( } function applyParserOptionsToExtra(options: TSESTreeOptions): void { + /** + * Turn on/off filesystem watchers + */ extra.noWatch = typeof options.noWatch === 'boolean' && options.noWatch; /** @@ -378,6 +404,7 @@ export function parse( * Reset the parse configuration */ resetExtra(); + /** * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() */ @@ -386,24 +413,25 @@ export function parse( `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`, ); } + /** * Ensure the source code is a string, and store a reference to it */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if (typeof code !== 'string' && !((code as any) instanceof String)) { - code = String(code); - } + code = enforceString(code); extra.code = code; + /** * Apply the given parser options */ if (typeof options !== 'undefined') { applyParserOptionsToExtra(options); } + /** * Warn if the user is using an unsupported version of TypeScript */ warnAboutTSVersion(); + /** * Create a ts.SourceFile directly, no ts.Program is needed for a simple * parse @@ -414,6 +442,7 @@ export function parse( ts.ScriptTarget.Latest, /* setParentNodes */ true, ); + /** * Convert the TypeScript AST to an ESTree-compatible one */ @@ -428,14 +457,13 @@ export function parseAndGenerateServices< * Reset the parse configuration */ resetExtra(); + /** * Ensure the source code is a string, and store a reference to it */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if (typeof code !== 'string' && !((code as any) instanceof String)) { - code = String(code); - } + code = enforceString(code); extra.code = code; + /** * Apply the given parser options */ @@ -449,10 +477,12 @@ export function parseAndGenerateServices< extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; } } + /** * Warn if the user is using an unsupported version of TypeScript */ warnAboutTSVersion(); + /** * Generate a full ts.Program in order to be able to provide parser * services, such as type-checking @@ -465,6 +495,7 @@ export function parseAndGenerateServices< shouldProvideParserServices, extra.createDefaultProgram, )!; + /** * Determine whether or not two-way maps of converted AST nodes should be preserved * during the conversion process @@ -473,11 +504,13 @@ export function parseAndGenerateServices< extra.preserveNodeMaps !== undefined ? extra.preserveNodeMaps : shouldProvideParserServices; + /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve * mappings between converted and original AST nodes */ const { estree, astMaps } = astConverter(ast, extra, shouldPreserveNodeMaps); + /** * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, * there may be other syntactic or semantic issues in the code that we can optionally report on. @@ -488,6 +521,7 @@ export function parseAndGenerateServices< throw convertError(error); } } + /** * Return the converted AST and additional parser services */ diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 4dab9030a55b..5f3b97c036ea 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -1,12 +1,11 @@ import chokidar from 'chokidar'; +import debug from 'debug'; import path from 'path'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from './parser-options'; import { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; -//------------------------------------------------------------------------------ -// Environment calculation -//------------------------------------------------------------------------------ +const log = debug('typescript-eslint:typescript-estree:tsconfig-parser'); /** * Default compiler options for program generation from single root file @@ -33,16 +32,18 @@ const knownWatchProgramMap = new Map< */ const watchCallbackTrackingMap = new Map>(); -/** - * Tracks the ts.sys.watchFile watchers that we've opened for config files. - * We store these so we can clean up our handles if required. - */ -const configSystemFileWatcherTrackingSet = new Set(); +interface Watcher { + close(): void; + forceClose(): void; + on(evt: 'add', listener: (file: string) => void): void; + on(evt: 'change', listener: (file: string) => void): void; + trackWatcher(): void; +} /** * Tracks the ts.sys.watchDirectory watchers that we've opened for project folders. * We store these so we can clean up our handles if required. */ -const directorySystemFileWatcherTrackingSet = new Set(); +const fileWatcherTrackingSet = new Map(); const parsedFilesSeen = new Set(); @@ -56,12 +57,8 @@ export function clearCaches(): void { parsedFilesSeen.clear(); // stop tracking config files - configSystemFileWatcherTrackingSet.forEach(cb => cb.close()); - configSystemFileWatcherTrackingSet.clear(); - - // stop tracking folders - directorySystemFileWatcherTrackingSet.forEach(cb => cb.close()); - directorySystemFileWatcherTrackingSet.clear(); + fileWatcherTrackingSet.forEach(cb => cb.forceClose()); + fileWatcherTrackingSet.clear(); } /** @@ -88,34 +85,84 @@ function getTsconfigPath(tsconfigPath: string, extra: Extra): string { : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); } -interface Watcher { - close(): void; - on(evt: 'add', listener: (file: string) => void): void; - on(evt: 'change', listener: (file: string) => void): void; -} +const EMPTY_WATCHER: Watcher = { + close: (): void => {}, + forceClose: (): void => {}, + on: (): void => {}, + trackWatcher: (): void => {}, +}; + /** * Watches a file or directory for changes */ function watch( - path: string, + watchPath: string, options: chokidar.WatchOptions, extra: Extra, ): Watcher { // an escape hatch to disable the file watchers as they can take a bit to initialise in some cases // this also supports an env variable so it's easy to switch on/off from the CLI - if (process.env.PARSER_NO_WATCH === 'true' || extra.noWatch === true) { - return { - close: (): void => {}, - on: (): void => {}, - }; + const blockWatchers = + process.env.PARSER_NO_WATCH === 'false' + ? false + : process.env.PARSER_NO_WATCH === 'true' || extra.noWatch === true; + if (blockWatchers) { + return EMPTY_WATCHER; + } + + // reuse watchers in case typescript asks us to watch the same file/directory multiple times + if (fileWatcherTrackingSet.has(watchPath)) { + const watcher = fileWatcherTrackingSet.get(watchPath)!; + watcher.trackWatcher(); + return watcher; } - return chokidar.watch(path, { - ignoreInitial: true, - persistent: false, - useFsEvents: false, - ...options, - }); + let fsWatcher: chokidar.FSWatcher; + try { + log('setting up watcher on path: %s', watchPath); + fsWatcher = chokidar.watch(watchPath, { + ignoreInitial: true, + persistent: false, + useFsEvents: false, + ...options, + }); + } catch (e) { + log( + 'error occurred using file watcher, setting up polling watcher instead: %s', + watchPath, + ); + // https://github.com/microsoft/TypeScript/blob/c9d407b52ad92370cd116105c33d618195de8070/src/compiler/sys.ts#L1232-L1237 + // Catch the exception and use polling instead + // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point + // so instead of throwing error, use fs.watchFile + fsWatcher = chokidar.watch(watchPath, { + ignoreInitial: true, + persistent: false, + useFsEvents: false, + ...options, + usePolling: true, + }); + } + + let counter = 1; + const watcher = { + close: (): void => { + counter -= 1; + if (counter <= 0) { + fsWatcher.close(); + fileWatcherTrackingSet.delete(watchPath); + } + }, + forceClose: fsWatcher.close.bind(fsWatcher), + on: fsWatcher.on.bind(fsWatcher), + trackWatcher: (): void => { + counter += 1; + }, + }; + + fileWatcherTrackingSet.set(watchPath, watcher); + + return watcher; } /** @@ -219,7 +266,6 @@ export function calculateProjectParserOptions( watcher.on('change', path => { callback(path, ts.FileWatcherEventKind.Changed); }); - configSystemFileWatcherTrackingSet.add(watcher); } const normalizedFileName = path.normalize(fileName); @@ -239,7 +285,6 @@ export function calculateProjectParserOptions( if (watcher) { watcher.close(); - configSystemFileWatcherTrackingSet.delete(watcher); } }, }; @@ -263,13 +308,9 @@ export function calculateProjectParserOptions( watcher.on('add', path => { callback(path); }); - directorySystemFileWatcherTrackingSet.add(watcher); return { - close(): void { - watcher.close(); - directorySystemFileWatcherTrackingSet.delete(watcher); - }, + close: watcher.close, }; }; diff --git a/yarn.lock b/yarn.lock index 3a524d7a1cbe..1817d623b819 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1329,6 +1329,11 @@ dependencies: "@babel/types" "^7.3.0" +"@types/debug@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" + integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== + "@types/eslint-visitor-keys@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" @@ -7758,9 +7763,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@*, "typescript@>=3.2.1 <3.8.0 >3.7.0-dev.0", typescript@^3.7.0-beta: - version "3.7.0-dev.20191006" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191006.tgz#b455c0bdbc29625b6f95886e17c85ded1271f588" - integrity sha512-0uxLQ41QwguSZdMlQ5GUXljS42Ti1+AFJ1EnTsQOSX4Z0eG2bwxHDJItIRDGV6yZGBMXJ6HGapxv2qxSeW5svA== + version "3.7.0-dev.20191015" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191015.tgz#283a99aeb09c91963aa16adcf5cb2fccbea9bdc4" + integrity sha512-Cpfj1n4pEUVKL+jtS0mkZodJffyMmf3Wk/UjyZMGX4fsjK5KBPJf3NUlyXij8I8p1E2CAomdS5NPFrAR+z8pKw== uglify-js@^3.1.4: version "3.6.0" From 16adda4199509477f9e08c487d4bc29f00dd7f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 16 Oct 2019 16:50:16 +0100 Subject: [PATCH 13/47] chore(typescript-estree): fix package name in warning message (#1093) --- packages/typescript-estree/src/parser.ts | 2 +- packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 6aec2452e5a0..7efde256c81d 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -364,7 +364,7 @@ function warnAboutTSVersion(): void { const border = '============='; const versionWarning = [ border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.', + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', 'You may find that it works just fine, or you may not.', `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, diff --git a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts index 97493a5915ae..9e6a26a39a66 100644 --- a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts +++ b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts @@ -15,7 +15,7 @@ describe('Warn on unsupported TypeScript version', () => { parser.parse(''); expect(console.log).toHaveBeenCalledWith( expect.stringContaining( - 'WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree', + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree', ), ); }); From 0c85ac3dadf59e475317bbbe422447c08689b36b Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 16 Oct 2019 22:28:56 +0300 Subject: [PATCH 14/47] fix(eslint-plugin): [no-magic-numbers] Support negative numbers (#1072) Co-authored-by: Brad Zacher --- .../src/rules/no-magic-numbers.ts | 55 +++++++++++++++---- .../tests/rules/no-magic-numbers.test.ts | 14 +++++ 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 01a2505498f6..e3597cf83485 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -160,11 +160,23 @@ export default util.createRule({ * @private */ function isParentTSReadonlyClassProperty(node: TSESTree.Node): boolean { - return ( - !!node.parent && + if ( + node.parent && + node.parent.type === AST_NODE_TYPES.UnaryExpression && + ['-', '+'].includes(node.parent.operator) + ) { + node = node.parent; + } + + if ( + node.parent && node.parent.type === AST_NODE_TYPES.ClassProperty && - !!node.parent.readonly - ); + node.parent.readonly + ) { + return true; + } + + return false; } return { @@ -174,13 +186,6 @@ export default util.createRule({ return; } - if ( - options.ignoreReadonlyClassProperties && - isParentTSReadonlyClassProperty(node) - ) { - return; - } - // Check TypeScript specific nodes for Numeric Literal if ( options.ignoreNumericLiteralTypes && @@ -190,6 +195,34 @@ export default util.createRule({ return; } + // Check if the node is a readonly class property + if (isNumber(node) && isParentTSReadonlyClassProperty(node)) { + if (options.ignoreReadonlyClassProperties) { + return; + } + + let fullNumberNode: + | TSESTree.Literal + | TSESTree.UnaryExpression = node; + let raw = node.raw; + + if ( + node.parent && + node.parent.type === AST_NODE_TYPES.UnaryExpression + ) { + fullNumberNode = node.parent; + raw = `${node.parent.operator}${node.raw}`; + } + + context.report({ + messageId: 'noMagic', + node: fullNumberNode, + data: { raw }, + }); + + return; + } + // Let the base rule deal with the rest rules.Literal(node); }, diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index 1ab26cfa704d..f65610ea3f4b 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -48,6 +48,8 @@ class Foo { readonly B = 2; public static readonly C = 1; static readonly D = 1; + readonly E = -1; + readonly F = +1; } `, options: [{ ignoreReadonlyClassProperties: true }], @@ -184,6 +186,8 @@ class Foo { readonly B = 2; public static readonly C = 1; static readonly D = 1; + readonly E = -1; + readonly F = +1; } `, options: [{ ignoreReadonlyClassProperties: false }], @@ -208,6 +212,16 @@ class Foo { line: 6, column: 23, }, + { + messageId: 'noMagic', + line: 7, + column: 16, + }, + { + messageId: 'noMagic', + line: 8, + column: 16, + }, ], }, ], From ed5564d22ca198c98048e93f1beacec715c427b5 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 19 Oct 2019 11:54:34 -0700 Subject: [PATCH 15/47] feat(typescript-estree): support long running lint without watch (#1106) --- .vscode/launch.json | 16 + packages/eslint-plugin/tests/RuleTester.ts | 43 +- .../create-program/createDefaultProgram.ts | 59 +++ .../create-program/createIsolatedProgram.ts | 71 +++ .../create-program/createProjectProgram.ts | 72 +++ .../src/create-program/createSourceFile.ts | 18 + .../src/create-program/createWatchProgram.ts | 440 ++++++++++++++++++ .../src/create-program/shared.ts | 27 ++ .../typescript-estree/src/parser-options.ts | 3 +- packages/typescript-estree/src/parser.ts | 291 ++++-------- .../typescript-estree/src/tsconfig-parser.ts | 391 ---------------- .../fixtures/invalidFileErrors/tsconfig.json | 3 + packages/typescript-estree/tests/lib/parse.ts | 38 +- .../tests/lib/persistentParse.ts | 106 +++-- .../tests/lib/semanticInfo.ts | 4 +- 15 files changed, 882 insertions(+), 700 deletions(-) create mode 100644 packages/typescript-estree/src/create-program/createDefaultProgram.ts create mode 100644 packages/typescript-estree/src/create-program/createIsolatedProgram.ts create mode 100644 packages/typescript-estree/src/create-program/createProjectProgram.ts create mode 100644 packages/typescript-estree/src/create-program/createSourceFile.ts create mode 100644 packages/typescript-estree/src/create-program/createWatchProgram.ts create mode 100644 packages/typescript-estree/src/create-program/shared.ts delete mode 100644 packages/typescript-estree/src/tsconfig-parser.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index 474d245895c0..6552aae66136 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -35,6 +35,22 @@ "sourceMaps": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened parser test", + "cwd": "${workspaceFolder}/packages/parser/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${relativeFile}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" } ] } diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index f96d1739f182..7d8bdb2c6955 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -8,20 +8,30 @@ type RuleTesterConfig = Omit & { parser: typeof parser; }; class RuleTester extends TSESLint.RuleTester { - private filename: string | undefined = undefined; - // as of eslint 6 you have to provide an absolute path to the parser // but that's not as clean to type, this saves us trying to manually enforce // that contributors require.resolve everything - constructor(options: RuleTesterConfig) { + constructor(private readonly options: RuleTesterConfig) { super({ ...options, parser: require.resolve(options.parser), }); + } + private getFilename(options?: TSESLint.ParserOptions): string { + if (options) { + const filename = `file.ts${ + options.ecmaFeatures && options.ecmaFeatures.jsx ? 'x' : '' + }`; + if (options.project) { + return path.join(getFixturesRootDir(), filename); + } - if (options.parserOptions && options.parserOptions.project) { - this.filename = path.join(getFixturesRootDir(), 'file.ts'); + return filename; + } else if (this.options.parserOptions) { + return this.getFilename(this.options.parserOptions); } + + return 'file.ts'; } // as of eslint 6 you have to provide an absolute path to the parser @@ -34,17 +44,14 @@ class RuleTester extends TSESLint.RuleTester { ): void { const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${parser}`; - if (this.filename) { - tests.valid = tests.valid.map(test => { - if (typeof test === 'string') { - return { - code: test, - filename: this.filename, - }; - } - return test; - }); - } + tests.valid = tests.valid.map(test => { + if (typeof test === 'string') { + return { + code: test, + }; + } + return test; + }); tests.valid.forEach(test => { if (typeof test !== 'string') { @@ -52,7 +59,7 @@ class RuleTester extends TSESLint.RuleTester { throw new Error(errorMessage); } if (!test.filename) { - test.filename = this.filename; + test.filename = this.getFilename(test.parserOptions); } } }); @@ -61,7 +68,7 @@ class RuleTester extends TSESLint.RuleTester { throw new Error(errorMessage); } if (!test.filename) { - test.filename = this.filename; + test.filename = this.getFilename(test.parserOptions); } }); diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts new file mode 100644 index 000000000000..e124bd8ed573 --- /dev/null +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -0,0 +1,59 @@ +import debug from 'debug'; +import path from 'path'; +import ts from 'typescript'; +import { Extra } from '../parser-options'; +import { + getTsconfigPath, + DEFAULT_COMPILER_OPTIONS, + ASTAndProgram, +} from './shared'; + +const log = debug('typescript-eslint:typescript-estree:createDefaultProgram'); + +/** + * @param code The code of the file being linted + * @param options The config object + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.projects Provided tsconfig paths + * @returns If found, returns the source file corresponding to the code and the containing program + */ +function createDefaultProgram( + code: string, + extra: Extra, +): ASTAndProgram | undefined { + log('Getting default program for: %s', extra.filePath || 'unnamed file'); + + if (!extra.projects || extra.projects.length !== 1) { + return undefined; + } + + const tsconfigPath = getTsconfigPath(extra.projects[0], extra); + + const commandLine = ts.getParsedCommandLineOfConfigFile( + tsconfigPath, + DEFAULT_COMPILER_OPTIONS, + { ...ts.sys, onUnRecoverableConfigFileDiagnostic: () => {} }, + ); + + if (!commandLine) { + return undefined; + } + + const compilerHost = ts.createCompilerHost(commandLine.options, true); + const oldReadFile = compilerHost.readFile; + compilerHost.readFile = (fileName: string): string | undefined => + path.normalize(fileName) === path.normalize(extra.filePath) + ? code + : oldReadFile(fileName); + + const program = ts.createProgram( + [extra.filePath], + commandLine.options, + compilerHost, + ); + const ast = program.getSourceFile(extra.filePath); + + return ast && { ast, program }; +} + +export { createDefaultProgram }; diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts new file mode 100644 index 000000000000..8588b3c1bc43 --- /dev/null +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -0,0 +1,71 @@ +import debug from 'debug'; +import ts from 'typescript'; +import { Extra } from '../parser-options'; +import { ASTAndProgram, DEFAULT_COMPILER_OPTIONS } from './shared'; + +const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); + +/** + * @param code The code of the file being linted + * @returns Returns a new source file and program corresponding to the linted code + */ +function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { + log('Getting isolated program for: %s', extra.filePath); + + const compilerHost: ts.CompilerHost = { + fileExists() { + return true; + }, + getCanonicalFileName() { + return extra.filePath; + }, + getCurrentDirectory() { + return ''; + }, + getDirectories() { + return []; + }, + getDefaultLibFileName() { + return 'lib.d.ts'; + }, + + // TODO: Support Windows CRLF + getNewLine() { + return '\n'; + }, + getSourceFile(filename: string) { + return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); + }, + readFile() { + return undefined; + }, + useCaseSensitiveFileNames() { + return true; + }, + writeFile() { + return null; + }, + }; + + const program = ts.createProgram( + [extra.filePath], + { + noResolve: true, + target: ts.ScriptTarget.Latest, + jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined, + ...DEFAULT_COMPILER_OPTIONS, + }, + compilerHost, + ); + + const ast = program.getSourceFile(extra.filePath); + if (!ast) { + throw new Error( + 'Expected an ast to be returned for the single-file isolated program.', + ); + } + + return { ast, program }; +} + +export { createIsolatedProgram }; diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts new file mode 100644 index 000000000000..9864c20cea01 --- /dev/null +++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -0,0 +1,72 @@ +import debug from 'debug'; +import path from 'path'; +import { getProgramsForProjects } from './createWatchProgram'; +import { firstDefined } from '../node-utils'; +import { Extra } from '../parser-options'; +import { ASTAndProgram } from './shared'; + +const log = debug('typescript-eslint:typescript-estree:createProjectProgram'); + +/** + * @param code The code of the file being linted + * @param options The config object + * @returns If found, returns the source file corresponding to the code and the containing program + */ +function createProjectProgram( + code: string, + createDefaultProgram: boolean, + extra: Extra, +): ASTAndProgram | undefined { + log('Creating project program for: %s', extra.filePath); + + const astAndProgram = firstDefined( + getProgramsForProjects(code, extra.filePath, extra), + currentProgram => { + const ast = currentProgram.getSourceFile(extra.filePath); + return ast && { ast, program: currentProgram }; + }, + ); + + if (!astAndProgram && !createDefaultProgram) { + // the file was either not matched within the tsconfig, or the extension wasn't expected + const errorLines = [ + '"parserOptions.project" has been set for @typescript-eslint/parser.', + `The file does not match your project config: ${path.relative( + process.cwd(), + extra.filePath, + )}.`, + ]; + let hasMatchedAnError = false; + + const fileExtension = path.extname(extra.filePath); + if (!['.ts', '.tsx', '.js', '.jsx'].includes(fileExtension)) { + const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; + if (extra.extraFileExtensions && extra.extraFileExtensions.length > 0) { + if (!extra.extraFileExtensions.includes(fileExtension)) { + errorLines.push( + `${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`, + ); + hasMatchedAnError = true; + } + } else { + errorLines.push( + `${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`, + ); + hasMatchedAnError = true; + } + } + + if (!hasMatchedAnError) { + errorLines.push( + 'The file must be included in at least one of the projects provided.', + ); + hasMatchedAnError = true; + } + + throw new Error(errorLines.join('\n')); + } + + return astAndProgram; +} + +export { createProjectProgram }; diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts new file mode 100644 index 000000000000..9f14ec274ff1 --- /dev/null +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -0,0 +1,18 @@ +import debug from 'debug'; +import ts from 'typescript'; +import { Extra } from '../parser-options'; + +const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); + +function createSourceFile(code: string, extra: Extra): ts.SourceFile { + log('Getting AST without type information for: %s', extra.filePath); + + return ts.createSourceFile( + extra.filePath, + code, + ts.ScriptTarget.Latest, + /* setParentNodes */ true, + ); +} + +export { createSourceFile }; diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts new file mode 100644 index 000000000000..4bfde8d2ba87 --- /dev/null +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -0,0 +1,440 @@ +import debug from 'debug'; +import fs from 'fs'; +import path from 'path'; +import ts from 'typescript'; +import { Extra } from '../parser-options'; +import { WatchCompilerHostOfConfigFile } from '../WatchCompilerHostOfConfigFile'; +import { getTsconfigPath, DEFAULT_COMPILER_OPTIONS } from './shared'; + +const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); + +/** + * Maps tsconfig paths to their corresponding file contents and resulting watches + */ +const knownWatchProgramMap = new Map< + string, + ts.WatchOfConfigFile +>(); + +/** + * Maps file/folder paths to their set of corresponding watch callbacks + * There may be more than one per file/folder if a file/folder is shared between projects + */ +const fileWatchCallbackTrackingMap = new Map< + string, + Set +>(); +const folderWatchCallbackTrackingMap = new Map< + string, + Set +>(); + +/** + * Stores the list of known files for each program + */ +const programFileListCache = new Map>(); + +/** + * Caches the last modified time of the tsconfig files + */ +const tsconfigLsatModifiedTimestampCache = new Map(); + +const parsedFilesSeen = new Set(); + +/** + * Clear all of the parser caches. + * This should only be used in testing to ensure the parser is clean between tests. + */ +function clearCaches(): void { + knownWatchProgramMap.clear(); + fileWatchCallbackTrackingMap.clear(); + folderWatchCallbackTrackingMap.clear(); + parsedFilesSeen.clear(); + programFileListCache.clear(); + tsconfigLsatModifiedTimestampCache.clear(); +} + +function saveWatchCallback( + trackingMap: Map>, +) { + return ( + fileName: string, + callback: ts.FileWatcherCallback, + ): ts.FileWatcher => { + const normalizedFileName = path.normalize(fileName); + const watchers = ((): Set => { + let watchers = trackingMap.get(normalizedFileName); + if (!watchers) { + watchers = new Set(); + trackingMap.set(normalizedFileName, watchers); + } + return watchers; + })(); + watchers.add(callback); + + return { + close: (): void => { + watchers.delete(callback); + }, + }; + }; +} + +/** + * Holds information about the file currently being linted + */ +const currentLintOperationState = { + code: '', + filePath: '', +}; + +/** + * Appropriately report issues found when reading a config file + * @param diagnostic The diagnostic raised when creating a program + */ +function diagnosticReporter(diagnostic: ts.Diagnostic): void { + throw new Error( + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine), + ); +} + +/** + * Calculate project environments using options provided by consumer and paths from config + * @param code The code being linted + * @param filePath The path of the file being parsed + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.projects Provided tsconfig paths + * @returns The programs corresponding to the supplied tsconfig paths + */ +function getProgramsForProjects( + code: string, + filePath: string, + extra: Extra, +): ts.Program[] { + const results = []; + + // preserve reference to code and file being linted + currentLintOperationState.code = code; + currentLintOperationState.filePath = filePath; + + // Update file version if necessary + // TODO: only update when necessary, currently marks as changed on every lint + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); + if ( + parsedFilesSeen.has(filePath) && + fileWatchCallbacks && + fileWatchCallbacks.size > 0 + ) { + fileWatchCallbacks.forEach(cb => + cb(filePath, ts.FileWatcherEventKind.Changed), + ); + } + + /* + * before we go into the process of attempting to find and update every program + * see if we know of a program that contains this file + */ + for (const rawTsconfigPath of extra.projects) { + const tsconfigPath = getTsconfigPath(rawTsconfigPath, extra); + const existingWatch = knownWatchProgramMap.get(tsconfigPath); + if (!existingWatch) { + continue; + } + + let fileList = programFileListCache.get(tsconfigPath); + let updatedProgram: ts.Program | null = null; + if (!fileList) { + updatedProgram = existingWatch.getProgram().getProgram(); + fileList = new Set(updatedProgram.getRootFileNames()); + programFileListCache.set(tsconfigPath, fileList); + } + + if (fileList.has(filePath)) { + log('Found existing program for file. %s', filePath); + return [updatedProgram || existingWatch.getProgram().getProgram()]; + } + } + log( + 'File did not belong to any existing programs, moving to create/update. %s', + filePath, + ); + + /* + * We don't know of a program that contains the file, this means that either: + * - the required program hasn't been created yet, or + * - the file is new/renamed, and the program hasn't been updated. + */ + for (const rawTsconfigPath of extra.projects) { + const tsconfigPath = getTsconfigPath(rawTsconfigPath, extra); + + const existingWatch = knownWatchProgramMap.get(tsconfigPath); + + if (existingWatch) { + const updatedProgram = maybeInvalidateProgram( + existingWatch, + filePath, + tsconfigPath, + ); + if (!updatedProgram) { + continue; + } + + // sets parent pointers in source files + updatedProgram.getTypeChecker(); + results.push(updatedProgram); + + continue; + } + + const programWatch = createWatchProgram(tsconfigPath, extra); + const program = programWatch.getProgram().getProgram(); + + // cache watch program and return current program + knownWatchProgramMap.set(tsconfigPath, programWatch); + results.push(program); + } + + parsedFilesSeen.add(filePath); + return results; +} + +function createWatchProgram( + tsconfigPath: string, + extra: Extra, +): ts.WatchOfConfigFile { + log('Creating watch program for %s.', tsconfigPath); + + // create compiler host + const watchCompilerHost = ts.createWatchCompilerHost( + tsconfigPath, + DEFAULT_COMPILER_OPTIONS, + ts.sys, + ts.createSemanticDiagnosticsBuilderProgram, + diagnosticReporter, + /*reportWatchStatus*/ () => {}, + ) as WatchCompilerHostOfConfigFile; + + // ensure readFile reads the code being linted instead of the copy on disk + const oldReadFile = watchCompilerHost.readFile; + watchCompilerHost.readFile = (filePath, encoding): string | undefined => + path.normalize(filePath) === + path.normalize(currentLintOperationState.filePath) + ? currentLintOperationState.code + : oldReadFile(filePath, encoding); + + // ensure process reports error on failure instead of exiting process immediately + watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; + + // ensure process doesn't emit programs + watchCompilerHost.afterProgramCreate = (program): void => { + // report error if there are any errors in the config file + const configFileDiagnostics = program + .getConfigFileParsingDiagnostics() + .filter( + diag => + diag.category === ts.DiagnosticCategory.Error && diag.code !== 18003, + ); + if (configFileDiagnostics.length > 0) { + diagnosticReporter(configFileDiagnostics[0]); + } + }; + + /* + * From the CLI, the file watchers won't matter, as the files will be parsed once and then forgotten. + * When running from an IDE, these watchers will let us tell typescript about changes. + * + * ESLint IDE plugins will send us unfinished file content as the user types (before it's saved to disk). + * We use the file watchers to tell typescript about this latest file content. + * + * When files are created (or renamed), we won't know about them because we have no filesystem watchers attached. + * We use the folder watchers to tell typescript it needs to go and find new files in the project folders. + */ + watchCompilerHost.watchFile = saveWatchCallback(fileWatchCallbackTrackingMap); + watchCompilerHost.watchDirectory = saveWatchCallback( + folderWatchCallbackTrackingMap, + ); + + // allow files with custom extensions to be included in program (uses internal ts api) + const oldOnDirectoryStructureHostCreate = + watchCompilerHost.onCachedDirectoryStructureHostCreate; + watchCompilerHost.onCachedDirectoryStructureHostCreate = (host): void => { + const oldReadDirectory = host.readDirectory; + host.readDirectory = ( + path, + extensions, + exclude, + include, + depth, + ): string[] => + oldReadDirectory( + path, + !extensions ? undefined : extensions.concat(extra.extraFileExtensions), + exclude, + include, + depth, + ); + oldOnDirectoryStructureHostCreate(host); + }; + + /* + * The watch change callbacks TS provides us all have a 250ms delay before firing + * https://github.com/microsoft/TypeScript/blob/b845800bdfcc81c8c72e2ac6fdc2c1df0cdab6f9/src/compiler/watch.ts#L1013 + * + * We live in a synchronous world, so we can't wait for that. + * This is a bit of a hack, but it lets us immediately force updates when we detect a tsconfig or directory change + */ + const oldSetTimeout = watchCompilerHost.setTimeout; + watchCompilerHost.setTimeout = (cb, ms, ...args): unknown => { + if (ms === 250) { + cb(); + return null; + } + + return oldSetTimeout && oldSetTimeout(cb, ms, ...args); + }; + + return ts.createWatchProgram(watchCompilerHost); +} + +function hasTSConfigChanged(tsconfigPath: string): boolean { + const stat = fs.statSync(tsconfigPath); + const lastModifiedAt = stat.mtimeMs; + const cachedLastModifiedAt = tsconfigLsatModifiedTimestampCache.get( + tsconfigPath, + ); + + tsconfigLsatModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); + + if (cachedLastModifiedAt === undefined) { + return false; + } + + return Math.abs(cachedLastModifiedAt - lastModifiedAt) > Number.EPSILON; +} + +function maybeInvalidateProgram( + existingWatch: ts.WatchOfConfigFile, + filePath: string, + tsconfigPath: string, +): ts.Program | null { + /* + * By calling watchProgram.getProgram(), it will trigger a resync of the program based on + * whatever new file content we've given it from our input. + */ + let updatedProgram = existingWatch.getProgram().getProgram(); + + // In case this change causes problems in larger real world codebases + // Provide an escape hatch so people don't _have_ to revert to an older version + if (process.env.TSESTREE_NO_INVALIDATION === 'true') { + return updatedProgram; + } + + if (hasTSConfigChanged(tsconfigPath)) { + /* + * If the stat of the tsconfig has changed, that could mean the include/exclude/files lists has changed + * We need to make sure typescript knows this so it can update appropriately + */ + log('tsconfig has changed - triggering program update. %s', tsconfigPath); + fileWatchCallbackTrackingMap + .get(tsconfigPath)! + .forEach(cb => cb(tsconfigPath, ts.FileWatcherEventKind.Changed)); + + // tsconfig change means that the file list more than likely changed, so clear the cache + programFileListCache.delete(tsconfigPath); + } + + let sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + /* + * Missing source file means our program's folder structure might be out of date. + * So we need to tell typescript it needs to update the correct folder. + */ + log('File was not found in program - triggering folder update. %s', filePath); + + // Find the correct directory callback by climbing the folder tree + let current: string | null = null; + let next: string | null = path.dirname(filePath); + let hasCallback = false; + while (current !== next) { + current = next; + const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); + if (folderWatchCallbacks) { + folderWatchCallbacks.forEach(cb => + cb(current!, ts.FileWatcherEventKind.Changed), + ); + hasCallback = true; + break; + } + + next = path.dirname(current); + } + if (!hasCallback) { + /* + * No callback means the paths don't matchup - so no point returning any program + * this will signal to the caller to skip this program + */ + log('No callback found for file, not part of this program. %s', filePath); + return null; + } + + // directory update means that the file list more than likely changed, so clear the cache + programFileListCache.delete(tsconfigPath); + + // force the immediate resync + updatedProgram = existingWatch.getProgram().getProgram(); + sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + + /* + * At this point we're in one of two states: + * - The file isn't supposed to be in this program due to exclusions + * - The file is new, and was renamed from an old, included filename + * + * For the latter case, we need to tell typescript that the old filename is now deleted + */ + log( + 'File was still not found in program after directory update - checking file deletions. %s', + filePath, + ); + + const rootFilenames = updatedProgram.getRootFileNames(); + // use find because we only need to "delete" one file to cause typescript to do a full resync + const deletedFile = rootFilenames.find(file => !fs.existsSync(file)); + if (!deletedFile) { + // There are no deleted files, so it must be the former case of the file not belonging to this program + return null; + } + + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(deletedFile); + if (!fileWatchCallbacks) { + // shouldn't happen, but just in case + log('Could not find watch callbacks for root file. %s', deletedFile); + return updatedProgram; + } + + log('Marking file as deleted. %s', deletedFile); + fileWatchCallbacks.forEach(cb => + cb(deletedFile, ts.FileWatcherEventKind.Deleted), + ); + + // deleted files means that the file list _has_ changed, so clear the cache + programFileListCache.delete(tsconfigPath); + + updatedProgram = existingWatch.getProgram().getProgram(); + sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + + log( + 'File was still not found in program after deletion check, assuming it is not part of this program. %s', + filePath, + ); + return null; +} + +export { clearCaches, createWatchProgram, getProgramsForProjects }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts new file mode 100644 index 000000000000..3607a7fb897c --- /dev/null +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -0,0 +1,27 @@ +import path from 'path'; +import ts from 'typescript'; +import { Extra } from '../parser-options'; + +interface ASTAndProgram { + ast: ts.SourceFile; + program: ts.Program | undefined; +} + +/** + * Default compiler options for program generation from single root file + */ +const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { + allowNonTsExtensions: true, + allowJs: true, + checkJs: true, + noEmit: true, + // extendedDiagnostics: true, +}; + +function getTsconfigPath(tsconfigPath: string, extra: Extra): string { + return path.isAbsolute(tsconfigPath) + ? tsconfigPath + : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); +} + +export { ASTAndProgram, DEFAULT_COMPILER_OPTIONS, getTsconfigPath }; diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 1a47f30f16d6..63e14a2fffb1 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -9,10 +9,10 @@ export interface Extra { errorOnTypeScriptSyntacticAndSemanticIssues: boolean; errorOnUnknownASTType: boolean; extraFileExtensions: string[]; + filePath: string; jsx: boolean; loc: boolean; log: Function; - noWatch?: boolean; preserveNodeMaps?: boolean; projects: string[]; range: boolean; @@ -32,7 +32,6 @@ export interface TSESTreeOptions { jsx?: boolean; loc?: boolean; loggerFn?: Function | false; - noWatch?: boolean; preserveNodeMaps?: boolean; project?: string | string[]; range?: boolean; diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 7efde256c81d..cb56c179a004 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,28 +1,22 @@ -import debug from 'debug'; -import path from 'path'; import semver from 'semver'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { sync as globSync } from 'glob'; import isGlob from 'is-glob'; import { astConverter } from './ast-converter'; import { convertError } from './convert'; -import { firstDefined } from './node-utils'; +import { createDefaultProgram } from './create-program/createDefaultProgram'; +import { createIsolatedProgram } from './create-program/createIsolatedProgram'; +import { createProjectProgram } from './create-program/createProjectProgram'; +import { createSourceFile } from './create-program/createSourceFile'; import { Extra, TSESTreeOptions, ParserServices } from './parser-options'; import { getFirstSemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import { TSESTree } from './ts-estree'; -import { - calculateProjectParserOptions, - createProgram, - defaultCompilerOptions, -} from './tsconfig-parser'; - -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.2.1 <3.8.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0 >3.7.0-dev.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, @@ -32,18 +26,6 @@ const isRunningSupportedTypeScriptVersion = semver.satisfies( let extra: Extra; let warnedAboutTSVersion = false; -/** - * Compute the filename based on the parser options. - * - * Even if jsx option is set in typescript compiler, filename still has to - * contain .tsx file extension. - * - * @param options Parser options - */ -function getFileName({ jsx }: { jsx?: boolean }): string { - return jsx ? 'estree.tsx' : 'estree.ts'; -} - function enforceString(code: unknown): string { /** * Ensure the source code is a string @@ -55,6 +37,44 @@ function enforceString(code: unknown): string { return code; } +interface ASTAndProgram { + ast: ts.SourceFile; + program: ts.Program | undefined; +} + +/** + * @param code The code of the file being linted + * @param options The config object + * @param shouldProvideParserServices True iff the program should be attempted to be calculated from provided tsconfig files + * @returns Returns a source file and program corresponding to the linted code + */ +function getProgramAndAST( + code: string, + shouldProvideParserServices: boolean, + shouldCreateDefaultProgram: boolean, +): ASTAndProgram | undefined { + return ( + (shouldProvideParserServices && + createProjectProgram(code, shouldCreateDefaultProgram, extra)) || + (shouldProvideParserServices && + shouldCreateDefaultProgram && + createDefaultProgram(code, extra)) || + createIsolatedProgram(code, extra) + ); +} + +/** + * Compute the filename based on the parser options. + * + * Even if jsx option is set in typescript compiler, filename still has to + * contain .tsx file extension. + * + * @param options Parser options + */ +function getFileName({ jsx }: { jsx?: boolean } = {}): string { + return jsx ? 'estree.tsx' : 'estree.ts'; +} + /** * Resets the extra config object */ @@ -67,10 +87,10 @@ function resetExtra(): void { errorOnTypeScriptSyntacticAndSemanticIssues: false, errorOnUnknownASTType: false, extraFileExtensions: [], + filePath: getFileName(), jsx: false, loc: false, log: console.log, // eslint-disable-line no-console - noWatch: false, preserveNodeMaps: undefined, projects: [], range: false, @@ -81,190 +101,20 @@ function resetExtra(): void { }; } -interface ASTAndProgram { - ast: ts.SourceFile; - program: ts.Program | undefined; -} - -/** - * @param code The code of the file being linted - * @param options The config object - * @returns If found, returns the source file corresponding to the code and the containing program - */ -function getASTFromProject( - code: string, - options: TSESTreeOptions, - createDefaultProgram: boolean, -): ASTAndProgram | undefined { - log('Attempting to get AST from project(s) for: %s', options.filePath); - - const filePath = options.filePath || getFileName(options); - const astAndProgram = firstDefined( - calculateProjectParserOptions(code, filePath, extra), - currentProgram => { - const ast = currentProgram.getSourceFile(filePath); - return ast && { ast, program: currentProgram }; - }, - ); - - if (!astAndProgram && !createDefaultProgram) { - // the file was either not matched within the tsconfig, or the extension wasn't expected - const errorLines = [ - '"parserOptions.project" has been set for @typescript-eslint/parser.', - `The file does not match your project config: ${filePath}.`, - ]; - let hasMatchedAnError = false; - - const fileExtension = path.extname(filePath); - if (!['.ts', '.tsx', '.js', '.jsx'].includes(fileExtension)) { - const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; - if (extra.extraFileExtensions && extra.extraFileExtensions.length > 0) { - if (!extra.extraFileExtensions.includes(fileExtension)) { - errorLines.push( - `${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`, - ); - hasMatchedAnError = true; - } - } else { - errorLines.push( - `${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`, - ); - hasMatchedAnError = true; - } - } - - if (!hasMatchedAnError) { - errorLines.push( - 'The file must be included in at least one of the projects provided.', - ); - hasMatchedAnError = true; - } - - throw new Error(errorLines.join('\n')); - } - - return astAndProgram; -} - -/** - * @param code The code of the file being linted - * @param options The config object - * @returns If found, returns the source file corresponding to the code and the containing program - */ -function getASTAndDefaultProject( - code: string, - options: TSESTreeOptions, -): ASTAndProgram | undefined { - log( - 'Attempting to get AST from the default project(s): %s', - options.filePath, - ); - - const fileName = options.filePath || getFileName(options); - const program = createProgram(code, fileName, extra); - const ast = program && program.getSourceFile(fileName); - return ast && { ast, program }; -} - -/** - * @param code The code of the file being linted - * @returns Returns a new source file and program corresponding to the linted code - */ -function createNewProgram(code: string): ASTAndProgram { - log('Getting AST without type information'); - - const FILENAME = getFileName(extra); - - const compilerHost: ts.CompilerHost = { - fileExists() { - return true; - }, - getCanonicalFileName() { - return FILENAME; - }, - getCurrentDirectory() { - return ''; - }, - getDirectories() { - return []; - }, - getDefaultLibFileName() { - return 'lib.d.ts'; - }, - - // TODO: Support Windows CRLF - getNewLine() { - return '\n'; - }, - getSourceFile(filename: string) { - return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); - }, - readFile() { - return undefined; - }, - useCaseSensitiveFileNames() { - return true; - }, - writeFile() { - return null; - }, - }; - - const program = ts.createProgram( - [FILENAME], - { - noResolve: true, - target: ts.ScriptTarget.Latest, - jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined, - ...defaultCompilerOptions, - }, - compilerHost, - ); - - const ast = program.getSourceFile(FILENAME)!; - - return { ast, program }; -} - -/** - * @param code The code of the file being linted - * @param options The config object - * @param shouldProvideParserServices True iff the program should be attempted to be calculated from provided tsconfig files - * @returns Returns a source file and program corresponding to the linted code - */ -function getProgramAndAST( - code: string, - options: TSESTreeOptions, - shouldProvideParserServices: boolean, - createDefaultProgram: boolean, -): ASTAndProgram | undefined { - return ( - (shouldProvideParserServices && - getASTFromProject(code, options, createDefaultProgram)) || - (shouldProvideParserServices && - createDefaultProgram && - getASTAndDefaultProject(code, options)) || - createNewProgram(code) - ); -} - function applyParserOptionsToExtra(options: TSESTreeOptions): void { - /** - * Turn on/off filesystem watchers - */ - extra.noWatch = typeof options.noWatch === 'boolean' && options.noWatch; - /** * Track range information in the AST */ extra.range = typeof options.range === 'boolean' && options.range; extra.loc = typeof options.loc === 'boolean' && options.loc; + /** * Track tokens in the AST */ if (typeof options.tokens === 'boolean' && options.tokens) { extra.tokens = []; } + /** * Track comments in the AST */ @@ -272,12 +122,23 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.comment = true; extra.comments = []; } + /** * Enable JSX - note the applicable file extension is still required */ if (typeof options.jsx === 'boolean' && options.jsx) { extra.jsx = true; } + + /** + * Get the file extension + */ + if (typeof options.filePath === 'string' && options.filePath !== '') { + extra.filePath = options.filePath; + } else { + extra.filePath = getFileName(extra); + } + /** * The JSX AST changed the node type for string literals * inside a JSX Element from `Literal` to `JSXText`. @@ -288,6 +149,7 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { extra.useJSXTextNode = true; } + /** * Allow the user to cause the parser to error if it encounters an unknown AST Node Type * (used in testing) @@ -298,6 +160,7 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { ) { extra.errorOnUnknownASTType = true; } + /** * Allow the user to override the function used for logging */ @@ -341,6 +204,7 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { ) { extra.extraFileExtensions = options.extraFileExtensions; } + /** * Allow the user to enable or disable the preservation of the AST node maps * during the conversion process. @@ -380,12 +244,12 @@ function warnAboutTSVersion(): void { // Parser //------------------------------------------------------------------------------ -export type AST = TSESTree.Program & +type AST = TSESTree.Program & (T['range'] extends true ? { range: [number, number] } : {}) & (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : {}) & (T['comment'] extends true ? { comments: TSESTree.Comment[] } : {}); -export interface ParseAndGenerateServicesResult { +interface ParseAndGenerateServicesResult { ast: AST; services: ParserServices; } @@ -394,9 +258,9 @@ export interface ParseAndGenerateServicesResult { // Public //------------------------------------------------------------------------------ -export const version: string = require('../package.json').version; +const version: string = require('../package.json').version; -export function parse( +function parse( code: string, options?: T, ): AST { @@ -436,12 +300,7 @@ export function parse( * Create a ts.SourceFile directly, no ts.Program is needed for a simple * parse */ - const ast = ts.createSourceFile( - getFileName(extra), - code, - ts.ScriptTarget.Latest, - /* setParentNodes */ true, - ); + const ast = createSourceFile(code, extra); /** * Convert the TypeScript AST to an ESTree-compatible one @@ -450,9 +309,10 @@ export function parse( return estree as AST; } -export function parseAndGenerateServices< - T extends TSESTreeOptions = TSESTreeOptions ->(code: string, options: T): ParseAndGenerateServicesResult { +function parseAndGenerateServices( + code: string, + options: T, +): ParseAndGenerateServicesResult { /** * Reset the parse configuration */ @@ -491,7 +351,6 @@ export function parseAndGenerateServices< extra.projects && extra.projects.length > 0; const { ast, program } = getProgramAndAST( code, - options, shouldProvideParserServices, extra.createDefaultProgram, )!; @@ -541,6 +400,14 @@ export function parseAndGenerateServices< }; } -export { TSESTreeOptions, ParserServices }; +export { + AST, + parse, + parseAndGenerateServices, + ParseAndGenerateServicesResult, + ParserServices, + TSESTreeOptions, + version, +}; export * from './ts-estree'; -export { clearCaches } from './tsconfig-parser'; +export { clearCaches } from './create-program/createWatchProgram'; diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts deleted file mode 100644 index 5f3b97c036ea..000000000000 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ /dev/null @@ -1,391 +0,0 @@ -import chokidar from 'chokidar'; -import debug from 'debug'; -import path from 'path'; -import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports -import { Extra } from './parser-options'; -import { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; - -const log = debug('typescript-eslint:typescript-estree:tsconfig-parser'); - -/** - * Default compiler options for program generation from single root file - */ -export const defaultCompilerOptions: ts.CompilerOptions = { - allowNonTsExtensions: true, - allowJs: true, - checkJs: true, - noEmit: true, - // extendedDiagnostics: true, -}; - -/** - * Maps tsconfig paths to their corresponding file contents and resulting watches - */ -const knownWatchProgramMap = new Map< - string, - ts.WatchOfConfigFile ->(); - -/** - * Maps file paths to their set of corresponding watch callbacks - * There may be more than one per file if a file is shared between projects - */ -const watchCallbackTrackingMap = new Map>(); - -interface Watcher { - close(): void; - forceClose(): void; - on(evt: 'add', listener: (file: string) => void): void; - on(evt: 'change', listener: (file: string) => void): void; - trackWatcher(): void; -} -/** - * Tracks the ts.sys.watchDirectory watchers that we've opened for project folders. - * We store these so we can clean up our handles if required. - */ -const fileWatcherTrackingSet = new Map(); - -const parsedFilesSeen = new Set(); - -/** - * Clear all of the parser caches. - * This should only be used in testing to ensure the parser is clean between tests. - */ -export function clearCaches(): void { - knownWatchProgramMap.clear(); - watchCallbackTrackingMap.clear(); - parsedFilesSeen.clear(); - - // stop tracking config files - fileWatcherTrackingSet.forEach(cb => cb.forceClose()); - fileWatcherTrackingSet.clear(); -} - -/** - * Holds information about the file currently being linted - */ -const currentLintOperationState = { - code: '', - filePath: '', -}; - -/** - * Appropriately report issues found when reading a config file - * @param diagnostic The diagnostic raised when creating a program - */ -function diagnosticReporter(diagnostic: ts.Diagnostic): void { - throw new Error( - ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine), - ); -} - -function getTsconfigPath(tsconfigPath: string, extra: Extra): string { - return path.isAbsolute(tsconfigPath) - ? tsconfigPath - : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); -} - -const EMPTY_WATCHER: Watcher = { - close: (): void => {}, - forceClose: (): void => {}, - on: (): void => {}, - trackWatcher: (): void => {}, -}; - -/** - * Watches a file or directory for changes - */ -function watch( - watchPath: string, - options: chokidar.WatchOptions, - extra: Extra, -): Watcher { - // an escape hatch to disable the file watchers as they can take a bit to initialise in some cases - // this also supports an env variable so it's easy to switch on/off from the CLI - const blockWatchers = - process.env.PARSER_NO_WATCH === 'false' - ? false - : process.env.PARSER_NO_WATCH === 'true' || extra.noWatch === true; - if (blockWatchers) { - return EMPTY_WATCHER; - } - - // reuse watchers in case typescript asks us to watch the same file/directory multiple times - if (fileWatcherTrackingSet.has(watchPath)) { - const watcher = fileWatcherTrackingSet.get(watchPath)!; - watcher.trackWatcher(); - return watcher; - } - - let fsWatcher: chokidar.FSWatcher; - try { - log('setting up watcher on path: %s', watchPath); - fsWatcher = chokidar.watch(watchPath, { - ignoreInitial: true, - persistent: false, - useFsEvents: false, - ...options, - }); - } catch (e) { - log( - 'error occurred using file watcher, setting up polling watcher instead: %s', - watchPath, - ); - // https://github.com/microsoft/TypeScript/blob/c9d407b52ad92370cd116105c33d618195de8070/src/compiler/sys.ts#L1232-L1237 - // Catch the exception and use polling instead - // Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point - // so instead of throwing error, use fs.watchFile - fsWatcher = chokidar.watch(watchPath, { - ignoreInitial: true, - persistent: false, - useFsEvents: false, - ...options, - usePolling: true, - }); - } - - let counter = 1; - const watcher = { - close: (): void => { - counter -= 1; - if (counter <= 0) { - fsWatcher.close(); - fileWatcherTrackingSet.delete(watchPath); - } - }, - forceClose: fsWatcher.close.bind(fsWatcher), - on: fsWatcher.on.bind(fsWatcher), - trackWatcher: (): void => { - counter += 1; - }, - }; - - fileWatcherTrackingSet.set(watchPath, watcher); - - return watcher; -} - -/** - * Calculate project environments using options provided by consumer and paths from config - * @param code The code being linted - * @param filePath The path of the file being parsed - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths - * @returns The programs corresponding to the supplied tsconfig paths - */ -export function calculateProjectParserOptions( - code: string, - filePath: string, - extra: Extra, -): ts.Program[] { - const results = []; - - // preserve reference to code and file being linted - currentLintOperationState.code = code; - currentLintOperationState.filePath = filePath; - - // Update file version if necessary - // TODO: only update when necessary, currently marks as changed on every lint - const watchCallbacks = watchCallbackTrackingMap.get(filePath); - if ( - parsedFilesSeen.has(filePath) && - watchCallbacks && - watchCallbacks.size > 0 - ) { - watchCallbacks.forEach(cb => cb(filePath, ts.FileWatcherEventKind.Changed)); - } - - for (const rawTsconfigPath of extra.projects) { - const tsconfigPath = getTsconfigPath(rawTsconfigPath, extra); - - const existingWatch = knownWatchProgramMap.get(tsconfigPath); - - if (typeof existingWatch !== 'undefined') { - // get new program (updated if necessary) - const updatedProgram = existingWatch.getProgram().getProgram(); - updatedProgram.getTypeChecker(); // sets parent pointers in source files - results.push(updatedProgram); - - continue; - } - - // create compiler host - const watchCompilerHost = ts.createWatchCompilerHost( - tsconfigPath, - defaultCompilerOptions, - ts.sys, - ts.createSemanticDiagnosticsBuilderProgram, - diagnosticReporter, - /*reportWatchStatus*/ () => {}, - ) as WatchCompilerHostOfConfigFile; - - // ensure readFile reads the code being linted instead of the copy on disk - const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding): string | undefined => - path.normalize(filePath) === - path.normalize(currentLintOperationState.filePath) - ? currentLintOperationState.code - : oldReadFile(filePath, encoding); - - // ensure process reports error on failure instead of exiting process immediately - watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; - - // ensure process doesn't emit programs - watchCompilerHost.afterProgramCreate = (program): void => { - // report error if there are any errors in the config file - const configFileDiagnostics = program - .getConfigFileParsingDiagnostics() - .filter( - diag => - diag.category === ts.DiagnosticCategory.Error && - diag.code !== 18003, - ); - if (configFileDiagnostics.length > 0) { - diagnosticReporter(configFileDiagnostics[0]); - } - }; - - // in watch mode, eslint will give us the latest file contents - // store the watch callback so we can trigger an update with eslint's content - watchCompilerHost.watchFile = ( - fileName, - callback, - interval, - ): ts.FileWatcher => { - // specifically (and separately) watch the tsconfig file - // this allows us to react to changes in the tsconfig's include/exclude options - let watcher: Watcher | null = null; - if (fileName.includes(tsconfigPath)) { - watcher = watch( - fileName, - { - interval, - }, - extra, - ); - watcher.on('change', path => { - callback(path, ts.FileWatcherEventKind.Changed); - }); - } - - const normalizedFileName = path.normalize(fileName); - const watchers = ((): Set => { - let watchers = watchCallbackTrackingMap.get(normalizedFileName); - if (!watchers) { - watchers = new Set(); - watchCallbackTrackingMap.set(normalizedFileName, watchers); - } - return watchers; - })(); - watchers.add(callback); - - return { - close: (): void => { - watchers.delete(callback); - - if (watcher) { - watcher.close(); - } - }, - }; - }; - - // when new files are added in watch mode, we need to tell typescript about those files - // if we don't then typescript will act like they don't exist. - watchCompilerHost.watchDirectory = ( - dirPath, - callback, - recursive, - ): ts.FileWatcher => { - const watcher = watch( - dirPath, - { - depth: recursive ? 0 : undefined, - interval: 250, - }, - extra, - ); - watcher.on('add', path => { - callback(path); - }); - - return { - close: watcher.close, - }; - }; - - // allow files with custom extensions to be included in program (uses internal ts api) - const oldOnDirectoryStructureHostCreate = - watchCompilerHost.onCachedDirectoryStructureHostCreate; - watchCompilerHost.onCachedDirectoryStructureHostCreate = (host): void => { - const oldReadDirectory = host.readDirectory; - host.readDirectory = ( - path, - extensions, - exclude, - include, - depth, - ): string[] => - oldReadDirectory( - path, - !extensions - ? undefined - : extensions.concat(extra.extraFileExtensions), - exclude, - include, - depth, - ); - oldOnDirectoryStructureHostCreate(host); - }; - - // create program - const programWatch = ts.createWatchProgram(watchCompilerHost); - const program = programWatch.getProgram().getProgram(); - - // cache watch program and return current program - knownWatchProgramMap.set(tsconfigPath, programWatch); - results.push(program); - } - - parsedFilesSeen.add(filePath); - return results; -} - -/** - * Create program from single root file. Requires a single tsconfig to be specified. - * @param code The code being linted - * @param filePath The file being linted - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths - * @returns The program containing just the file being linted and associated library files - */ -export function createProgram( - code: string, - filePath: string, - extra: Extra, -): ts.Program | undefined { - if (!extra.projects || extra.projects.length !== 1) { - return undefined; - } - - const tsconfigPath = getTsconfigPath(extra.projects[0], extra); - - const commandLine = ts.getParsedCommandLineOfConfigFile( - tsconfigPath, - defaultCompilerOptions, - { ...ts.sys, onUnRecoverableConfigFileDiagnostic: () => {} }, - ); - - if (!commandLine) { - return undefined; - } - - const compilerHost = ts.createCompilerHost(commandLine.options, true); - const oldReadFile = compilerHost.readFile; - compilerHost.readFile = (fileName: string): string | undefined => - path.normalize(fileName) === path.normalize(filePath) - ? code - : oldReadFile(fileName); - - return ts.createProgram([filePath], commandLine.options, compilerHost); -} diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json index de5d69d736c8..9f3d8cab0be7 100644 --- a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json @@ -1,4 +1,7 @@ { + "compilerOptions": { + "allowJs": true + }, "include": [ "ts/included.ts", "ts/included.tsx", diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 38b80aafbaaf..21664b7bd418 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -1,4 +1,4 @@ -import { join, resolve, relative } from 'path'; +import { join, resolve } from 'path'; import * as parser from '../../src/parser'; import * as astConverter from '../../src/ast-converter'; import { TSESTreeOptions } from '../../src/parser-options'; @@ -75,30 +75,16 @@ describe('parse()', () => { loc: true, }); - expect(spy).toHaveBeenCalledWith( - expect.any(Object), - { - code: 'let foo = bar;', - comment: true, - comments: [], - createDefaultProgram: false, - errorOnTypeScriptSyntacticAndSemanticIssues: false, - errorOnUnknownASTType: false, - extraFileExtensions: [], - jsx: false, - loc: true, - log: loggerFn, - noWatch: false, - preserveNodeMaps: false, - projects: [], - range: true, - strict: false, - tokens: expect.any(Array), - tsconfigRootDir: expect.any(String), - useJSXTextNode: false, - }, - false, - ); + expect(spy).toHaveBeenCalled(); + expect(spy.mock.calls[0][1]).toMatchObject({ + code: 'let foo = bar;', + comment: true, + comments: [], + loc: true, + log: loggerFn, + range: true, + tokens: expect.any(Array), + }); }); }); @@ -258,7 +244,7 @@ describe('parse()', () => { const testParse = (filePath: string) => (): void => { parser.parseAndGenerateServices(code, { ...config, - filePath: relative(process.cwd(), join(PROJECT_DIR, filePath)), + filePath: join(PROJECT_DIR, filePath), }); }; diff --git a/packages/typescript-estree/tests/lib/persistentParse.ts b/packages/typescript-estree/tests/lib/persistentParse.ts index c588570bf732..bb77cefd7f7f 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.ts @@ -1,20 +1,20 @@ import fs from 'fs'; import path from 'path'; import tmp from 'tmp'; -import { parseAndGenerateServices } from '../../src/parser'; -import { clearCaches } from '../../src/tsconfig-parser'; +import { clearCaches, parseAndGenerateServices } from '../../src/parser'; const tsConfigExcludeBar = { - include: ['./*.ts'], - exclude: ['./bar.ts'], + include: ['src'], + exclude: ['./src/bar.ts'], }; const tsConfigIncludeAll = { - include: ['./*.ts'], + include: ['src'], exclude: [], }; const CONTENTS = { foo: 'console.log("foo")', bar: 'console.log("bar")', + 'baz/bar': 'console.log("baz bar")', }; const tmpDirs = new Set(); @@ -27,17 +27,20 @@ afterEach(() => { tmpDirs.clear(); }); -function writeTSConfig( - dirName: string, - config: Record, -): void { +function writeTSConfig(dirName: string, config: Record): void { fs.writeFileSync(path.join(dirName, 'tsconfig.json'), JSON.stringify(config)); } -function writeFile(dirName: string, file: 'foo' | 'bar'): void { - fs.writeFileSync(path.join(dirName, `${file}.ts`), CONTENTS[file]); +function writeFile(dirName: string, file: 'foo' | 'bar' | 'baz/bar'): void { + fs.writeFileSync(path.join(dirName, 'src', `${file}.ts`), CONTENTS[file]); +} +function renameFile(dirName: string, src: 'bar', dest: 'baz/bar'): void { + fs.renameSync( + path.join(dirName, 'src', `${src}.ts`), + path.join(dirName, 'src', `${dest}.ts`), + ); } -function setup(tsconfig: Record, writeBar = true): string { +function setup(tsconfig: Record, writeBar = true): string { const tmpDir = tmp.dirSync({ keep: false, unsafeCleanup: true, @@ -46,38 +49,21 @@ function setup(tsconfig: Record, writeBar = true): string { writeTSConfig(tmpDir.name, tsconfig); + fs.mkdirSync(path.join(tmpDir.name, 'src')); + fs.mkdirSync(path.join(tmpDir.name, 'src', 'baz')); writeFile(tmpDir.name, 'foo'); writeBar && writeFile(tmpDir.name, 'bar'); return tmpDir.name; } -function parseFile(filename: 'foo' | 'bar', tmpDir: string): void { +function parseFile(filename: 'foo' | 'bar' | 'baz/bar', tmpDir: string): void { parseAndGenerateServices(CONTENTS.foo, { project: './tsconfig.json', tsconfigRootDir: tmpDir, - filePath: path.join(tmpDir, `${filename}.ts`), - }); -} - -// https://github.com/microsoft/TypeScript/blob/a4bacf3bfaf77213c1ef4ddecaf3689837e20ac5/src/compiler/sys.ts#L46-L50 -enum PollingInterval { - High = 2000, - Medium = 500, - Low = 250, -} -async function runTimer(interval: PollingInterval): Promise { - // would love to use jest fake timers, but ts stores references to the standard timeout functions - // so we can't switch to fake timers on the fly :( - await new Promise((resolve): void => { - setTimeout(resolve, interval); + filePath: path.join(tmpDir, 'src', `${filename}.ts`), }); } -async function waitForChokidar(): Promise { - // wait for chokidar to be ready - // this isn't won't be a problem when running the eslint CLI in watch mode because the init takes a few hundred ms - await runTimer(PollingInterval.Medium); -} describe('persistent lint session', () => { it('parses both files successfully when included', () => { @@ -94,42 +80,64 @@ describe('persistent lint session', () => { expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); }); - it('reacts to changes in the tsconfig', async () => { - const PROJECT_DIR = setup(tsConfigExcludeBar); + it('allows parsing of new files', () => { + const PROJECT_DIR = setup(tsConfigIncludeAll, false); // parse once to: assert the config as correct, and to make sure the program is setup expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + // bar should throw because it doesn't exist yet expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); - await waitForChokidar(); - - // change the config file so it now includes all files - writeTSConfig(PROJECT_DIR, tsConfigIncludeAll); - - // wait for TS to pick up the change to the config file - await runTimer(PollingInterval.High); + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'bar'); + // both files should parse fine now expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); }); - it('allows parsing of new files', async () => { + it('allows parsing of deeply nested new files', () => { const PROJECT_DIR = setup(tsConfigIncludeAll, false); // parse once to: assert the config as correct, and to make sure the program is setup expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); // bar should throw because it doesn't exist yet - expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); - - await waitForChokidar(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).toThrow(); // write a new file and attempt to parse it - writeFile(PROJECT_DIR, 'bar'); + writeFile(PROJECT_DIR, 'baz/bar'); - // wait for TS to pick up the new file - await runTimer(PollingInterval.Medium); + // both files should parse fine now + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).not.toThrow(); + }); + + it('allows renaming of files', () => { + const PROJECT_DIR = setup(tsConfigIncludeAll, true); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + // bar should throw because it doesn't exist yet + expect(() => parseFile('baz/bar', PROJECT_DIR)).toThrow(); + + // write a new file and attempt to parse it + renameFile(PROJECT_DIR, 'bar', 'baz/bar'); // both files should parse fine now + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).not.toThrow(); + }); + + it('reacts to changes in the tsconfig', () => { + const PROJECT_DIR = setup(tsConfigExcludeBar); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + + // change the config file so it now includes all files + writeTSConfig(PROJECT_DIR, tsConfigIncludeAll); + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 6afffd43029d..ccbc9d905819 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -9,11 +9,11 @@ import { parseCodeAndGenerateServices, } from '../../tools/test-utils'; import { + clearCaches, parseAndGenerateServices, ParseAndGenerateServicesResult, } from '../../src/parser'; import { TSESTree } from '../../src/ts-estree'; -import { clearCaches } from '../../src/tsconfig-parser'; const FIXTURES_DIR = './tests/fixtures/semanticInfo'; const testFiles = glob.sync(`${FIXTURES_DIR}/**/*.src.ts`); @@ -236,7 +236,7 @@ describe('semanticInfo', () => { `function M() { return Base }`, createOptions(''), ), - ).toThrow(/The file does not match your project config: /); + ).toThrow(/The file does not match your project config: estree.ts/); }); it('non-existent project file', () => { From 088a6911d503df3b3ffa96f97f30fb43313f9dee Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 19 Oct 2019 12:10:15 -0700 Subject: [PATCH 16/47] fix(typescript-estree): remove now unneeded dep on chokidar --- packages/typescript-estree/package.json | 1 - yarn.lock | 51 +------------------------ 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 225380a2bd27..d8ca623677f3 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -39,7 +39,6 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "chokidar": "^3.0.2", "debug": "^4.1.1", "glob": "^7.1.4", "is-glob": "^4.0.1", diff --git a/yarn.lock b/yarn.lock index 1817d623b819..888b1ba35fca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1655,14 +1655,6 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -anymatch@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.0.tgz#e609350e50a9313b472789b2f14ef35808ee14d6" - integrity sha512-Ozz7l4ixzI7Oxj2+cw+p0tVUt27BpaJ+1+q1TCeANWxHpvyn2+Un+YamBdfKu0uh8xLodGhoa1v7595NhKDAuA== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -1919,11 +1911,6 @@ before-after-hook@^2.0.0: resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== -binary-extensions@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" - integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== - bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.7.0" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.0.tgz#56a6a886e03f6ae577cffedeb524f8f2450293cf" @@ -1953,7 +1940,7 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1, braces@^3.0.2: +braces@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -2155,21 +2142,6 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.0.2.tgz#0d1cd6d04eb2df0327446188cd13736a3367d681" - integrity sha512-c4PR2egjNjI1um6bamCQ6bUNPDiyofNQruHvKgHQ4gDUP/ITSVSzNsiI5OWtHOsX323i5ha/kk4YmOZ1Ktg7KA== - dependencies: - anymatch "^3.0.1" - braces "^3.0.2" - glob-parent "^5.0.0" - is-binary-path "^2.1.0" - is-glob "^4.0.1" - normalize-path "^3.0.0" - readdirp "^3.1.1" - optionalDependencies: - fsevents "^2.0.6" - chownr@^1.1.1, chownr@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" @@ -3515,11 +3487,6 @@ fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" -fsevents@^2.0.6: - version "2.0.7" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" - integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== - function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -4126,13 +4093,6 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= -is-binary-path@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -6284,7 +6244,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.0.5: version "2.0.7" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6" integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA== @@ -6642,13 +6602,6 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -readdirp@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.1.2.tgz#fa85d2d14d4289920e4671dead96431add2ee78a" - integrity sha512-8rhl0xs2cxfVsqzreYCvs8EwBfn/DhVdqtoLmw19uI3SC5avYX9teCurlErfpPXGmYtMHReGaP2RsLnFvz/lnw== - dependencies: - picomatch "^2.0.4" - realpath-native@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" From 2fc9bd26495da59019a3e9dfe8314dba40c6b0a0 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 19 Oct 2019 15:58:34 -0700 Subject: [PATCH 17/47] fix(typescript-estree): correct semver check range (#1109) --- package.json | 4 ++-- packages/typescript-estree/src/parser.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index c848499ff784..6390641fcae0 100644 --- a/package.json +++ b/package.json @@ -73,13 +73,13 @@ "ts-jest": "^24.0.0", "ts-node": "^8.3.0", "tslint": "^5.19.0", - "typescript": ">=3.2.1 <3.8.0 >3.7.0-dev.0" + "typescript": ">=3.2.1 <3.8.0 || >3.7.0-dev.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "resolutions": { - "typescript": "^3.7.0-beta" + "typescript": "^3.7.0-dev.20191018" } } diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index cb56c179a004..c887193365f7 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -16,7 +16,7 @@ import { TSESTree } from './ts-estree'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0 >3.7.0-dev.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0 || >3.7.0-dev.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/yarn.lock b/yarn.lock index 888b1ba35fca..88507646d6d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7715,10 +7715,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.2.1 <3.8.0 >3.7.0-dev.0", typescript@^3.7.0-beta: - version "3.7.0-dev.20191015" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191015.tgz#283a99aeb09c91963aa16adcf5cb2fccbea9bdc4" - integrity sha512-Cpfj1n4pEUVKL+jtS0mkZodJffyMmf3Wk/UjyZMGX4fsjK5KBPJf3NUlyXij8I8p1E2CAomdS5NPFrAR+z8pKw== +typescript@*, "typescript@>=3.2.1 <3.8.0 || >3.7.0-dev.0", typescript@^3.7.0-dev.20191018: + version "3.7.0-dev.20191018" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191018.tgz#6b98a655b124ca697364e2d7977c469a2bfede3d" + integrity sha512-Z8KpsytbY5lBMp5cc08VFoO8CgHC6IcbgyiA5vjh7fitkoG0qcem9C354YuiWV4O2+i2gdC7vF8tNUYqO/vUkQ== uglify-js@^3.1.4: version "3.6.0" From 7a8cce6d4c7b3756a0267f57596b7204ca8c2566 Mon Sep 17 00:00:00 2001 From: IU Date: Sun, 20 Oct 2019 09:37:33 +0800 Subject: [PATCH 18/47] fix(typescript-estree): parsing error for vue sfc (#1083) --- .../src/create-program/createWatchProgram.ts | 9 +++--- .../fixtures/vue-sfc/.eslintrc.yml | 3 ++ tests/integration/fixtures/vue-sfc/World.vue | 30 +++++++++++++++++++ .../integration/fixtures/vue-sfc/test.js.snap | 8 +++++ tests/integration/fixtures/vue-sfc/test.sh | 3 ++ .../fixtures/vue-sfc/tsconfig.json | 7 +++-- 6 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 tests/integration/fixtures/vue-sfc/World.vue diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 4bfde8d2ba87..a0a8eeefb485 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -194,7 +194,6 @@ function getProgramsForProjects( results.push(program); } - parsedFilesSeen.add(filePath); return results; } @@ -216,11 +215,13 @@ function createWatchProgram( // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding): string | undefined => - path.normalize(filePath) === - path.normalize(currentLintOperationState.filePath) + watchCompilerHost.readFile = (filePath, encoding): string | undefined => { + parsedFilesSeen.add(filePath); + return path.normalize(filePath) === + path.normalize(currentLintOperationState.filePath) ? currentLintOperationState.code : oldReadFile(filePath, encoding); + }; // ensure process reports error on failure instead of exiting process immediately watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; diff --git a/tests/integration/fixtures/vue-sfc/.eslintrc.yml b/tests/integration/fixtures/vue-sfc/.eslintrc.yml index f20f5baf1746..7b9b183b59bc 100644 --- a/tests/integration/fixtures/vue-sfc/.eslintrc.yml +++ b/tests/integration/fixtures/vue-sfc/.eslintrc.yml @@ -6,6 +6,9 @@ env: es6: true node: true +extends: + plugin:vue/essential + parserOptions: # Local version of @typescript-eslint/parser parser: '@typescript-eslint/parser' diff --git a/tests/integration/fixtures/vue-sfc/World.vue b/tests/integration/fixtures/vue-sfc/World.vue new file mode 100644 index 000000000000..ade2b409a3b6 --- /dev/null +++ b/tests/integration/fixtures/vue-sfc/World.vue @@ -0,0 +1,30 @@ + + + + diff --git a/tests/integration/fixtures/vue-sfc/test.js.snap b/tests/integration/fixtures/vue-sfc/test.js.snap index 49bd30cc3897..df23862a1253 100644 --- a/tests/integration/fixtures/vue-sfc/test.js.snap +++ b/tests/integration/fixtures/vue-sfc/test.js.snap @@ -59,5 +59,13 @@ export default Vue.extend({ ", "warningCount": 0, }, + Object { + "errorCount": 0, + "filePath": "/usr/linked/World.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [], + "warningCount": 0, + }, ] `; diff --git a/tests/integration/fixtures/vue-sfc/test.sh b/tests/integration/fixtures/vue-sfc/test.sh index ba89362dcd13..b61a140ff5be 100755 --- a/tests/integration/fixtures/vue-sfc/test.sh +++ b/tests/integration/fixtures/vue-sfc/test.sh @@ -14,6 +14,9 @@ npm install $(npm pack /usr/eslint-plugin | tail -1) # Install the latest vue-eslint-parser (this may break us occassionally, but it's probably good to get that feedback early) npm install vue-eslint-parser@latest +# Install the latest eslint-plugin-vue (this may break us occassionally, but it's probably good to get that feedback early) +npm install eslint-plugin-vue@latest + # Run the linting # (the "|| true" helps make sure that we run our tests on failed linting runs as well) npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.vue || true diff --git a/tests/integration/fixtures/vue-sfc/tsconfig.json b/tests/integration/fixtures/vue-sfc/tsconfig.json index 86423f3e4aa2..861b7d99bedf 100644 --- a/tests/integration/fixtures/vue-sfc/tsconfig.json +++ b/tests/integration/fixtures/vue-sfc/tsconfig.json @@ -1,5 +1,8 @@ { "compilerOptions": { "strict": true - } -} \ No newline at end of file + }, + "include": [ + "*.vue" + ] +} From 611dff3f58d3c91fd7d7ab9e07a536ae09f50522 Mon Sep 17 00:00:00 2001 From: zEh- Date: Sun, 20 Oct 2019 20:48:31 +0200 Subject: [PATCH 19/47] docs(eslint-plugin): typo in no-unnecessary-condition.md (#1113) --- packages/eslint-plugin/docs/rules/no-unnecessary-condition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index ac54dba64ca3..996d1d9aae13 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -59,6 +59,6 @@ The main downside to using this rule is the need for type information. ## Related To -- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - this rule is essentially a stronger versison +- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - this rule is essentially a stronger version. - [strict-boolean-expression](./strict-boolean-expressions.md) - a stricter alternative to this rule. From fd39bbd8e973ef7b658740e00928d86af0140113 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 21 Oct 2019 17:01:53 +0000 Subject: [PATCH 20/47] chore: publish v2.5.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 17 +++++++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 8 ++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 19 +++++++++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 104 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66ff74784f0c..490f45a7b3e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + + +### Bug Fixes + +* **eslint-plugin:** [no-magic-numbers] Support negative numbers ([#1072](https://github.com/typescript-eslint/typescript-eslint/issues/1072)) ([0c85ac3](https://github.com/typescript-eslint/typescript-eslint/commit/0c85ac3)) +* **typescript-estree:** correct semver check range ([#1109](https://github.com/typescript-eslint/typescript-eslint/issues/1109)) ([2fc9bd2](https://github.com/typescript-eslint/typescript-eslint/commit/2fc9bd2)) +* **typescript-estree:** handle running out of fs watchers ([#1088](https://github.com/typescript-eslint/typescript-eslint/issues/1088)) ([ec62747](https://github.com/typescript-eslint/typescript-eslint/commit/ec62747)) +* **typescript-estree:** parsing error for vue sfc ([#1083](https://github.com/typescript-eslint/typescript-eslint/issues/1083)) ([7a8cce6](https://github.com/typescript-eslint/typescript-eslint/commit/7a8cce6)) +* **typescript-estree:** remove now unneeded dep on chokidar ([088a691](https://github.com/typescript-eslint/typescript-eslint/commit/088a691)) + + +### Features + +* **eslint-plugin:** Support abstract members in member-ordering rule ([#395](https://github.com/typescript-eslint/typescript-eslint/issues/395)) ([#1004](https://github.com/typescript-eslint/typescript-eslint/issues/1004)) ([5f093ac](https://github.com/typescript-eslint/typescript-eslint/commit/5f093ac)) +* **typescript-estree:** support long running lint without watch ([#1106](https://github.com/typescript-eslint/typescript-eslint/issues/1106)) ([ed5564d](https://github.com/typescript-eslint/typescript-eslint/commit/ed5564d)) + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/lerna.json b/lerna.json index f4653f7fb8d0..2a40ae9e906b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.4.0", + "version": "2.5.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index f76756a7a3e0..5128c179c540 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. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 88c3cfe1d722..7e2168b5ff1c 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": "2.4.0", + "version": "2.5.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.4.0", + "@typescript-eslint/experimental-utils": "2.5.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.4.0" + "@typescript-eslint/parser": "2.5.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index e39f75e56170..f40f2624eec6 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + + +### Bug Fixes + +* **eslint-plugin:** [no-magic-numbers] Support negative numbers ([#1072](https://github.com/typescript-eslint/typescript-eslint/issues/1072)) ([0c85ac3](https://github.com/typescript-eslint/typescript-eslint/commit/0c85ac3)) + + +### Features + +* **eslint-plugin:** Support abstract members in member-ordering rule ([#395](https://github.com/typescript-eslint/typescript-eslint/issues/395)) ([#1004](https://github.com/typescript-eslint/typescript-eslint/issues/1004)) ([5f093ac](https://github.com/typescript-eslint/typescript-eslint/commit/5f093ac)) +* **typescript-estree:** support long running lint without watch ([#1106](https://github.com/typescript-eslint/typescript-eslint/issues/1106)) ([ed5564d](https://github.com/typescript-eslint/typescript-eslint/commit/ed5564d)) + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6633b8f2ca59..cacc21e47137 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.4.0", + "version": "2.5.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.4.0", + "@typescript-eslint/experimental-utils": "2.5.0", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index f3721e9a3a8d..dd63f064e21c 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. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index d39a9110f7ed..0f26e278fec3 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.4.0", + "version": "2.5.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.4.0", + "@typescript-eslint/typescript-estree": "2.5.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 0017c21cb6a0..1e2d3c4d0f6d 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. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/parser/package.json b/packages/parser/package.json index e551b4d86ef6..7e3f5e3ce340 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.4.0", + "version": "2.5.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.4.0", - "@typescript-eslint/typescript-estree": "2.4.0", + "@typescript-eslint/experimental-utils": "2.5.0", + "@typescript-eslint/typescript-estree": "2.5.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.4.0", + "@typescript-eslint/shared-fixtures": "2.5.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 945b637ecb1d..3fef3f0ee9a4 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. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index a833a2bd0ee9..b482cfdcf92b 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.4.0", + "version": "2.5.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 0278cba2f3fb..2389fef6c569 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) + + +### Bug Fixes + +* **typescript-estree:** correct semver check range ([#1109](https://github.com/typescript-eslint/typescript-eslint/issues/1109)) ([2fc9bd2](https://github.com/typescript-eslint/typescript-eslint/commit/2fc9bd2)) +* **typescript-estree:** handle running out of fs watchers ([#1088](https://github.com/typescript-eslint/typescript-eslint/issues/1088)) ([ec62747](https://github.com/typescript-eslint/typescript-eslint/commit/ec62747)) +* **typescript-estree:** parsing error for vue sfc ([#1083](https://github.com/typescript-eslint/typescript-eslint/issues/1083)) ([7a8cce6](https://github.com/typescript-eslint/typescript-eslint/commit/7a8cce6)) +* **typescript-estree:** remove now unneeded dep on chokidar ([088a691](https://github.com/typescript-eslint/typescript-eslint/commit/088a691)) + + +### Features + +* **typescript-estree:** support long running lint without watch ([#1106](https://github.com/typescript-eslint/typescript-eslint/issues/1106)) ([ed5564d](https://github.com/typescript-eslint/typescript-eslint/commit/ed5564d)) + + + + + # [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d8ca623677f3..508d8400531d 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.4.0", + "version": "2.5.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -57,7 +57,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.4.0", + "@typescript-eslint/shared-fixtures": "2.5.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 8dcbf4c5502966297ecd04105e7580c5079acdac Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 21 Oct 2019 15:28:58 -0700 Subject: [PATCH 21/47] fix(typescript-estree): better handle canonical paths (#1111) --- .../src/create-program/createWatchProgram.ts | 63 +++++++++++-------- .../src/create-program/shared.ts | 29 +++++++-- .../tests/lib/persistentParse.ts | 36 ++++++++++- .../tests/lib/semanticInfo.ts | 5 +- 4 files changed, 101 insertions(+), 32 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index a0a8eeefb485..3acf67d385a2 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -4,7 +4,13 @@ import path from 'path'; import ts from 'typescript'; import { Extra } from '../parser-options'; import { WatchCompilerHostOfConfigFile } from '../WatchCompilerHostOfConfigFile'; -import { getTsconfigPath, DEFAULT_COMPILER_OPTIONS } from './shared'; +import { + canonicalDirname, + CanonicalPath, + getTsconfigPath, + DEFAULT_COMPILER_OPTIONS, + getCanonicalFileName, +} from './shared'; const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); @@ -12,7 +18,7 @@ const log = debug('typescript-eslint:typescript-estree:createWatchProgram'); * Maps tsconfig paths to their corresponding file contents and resulting watches */ const knownWatchProgramMap = new Map< - string, + CanonicalPath, ts.WatchOfConfigFile >(); @@ -21,25 +27,25 @@ const knownWatchProgramMap = new Map< * There may be more than one per file/folder if a file/folder is shared between projects */ const fileWatchCallbackTrackingMap = new Map< - string, + CanonicalPath, Set >(); const folderWatchCallbackTrackingMap = new Map< - string, + CanonicalPath, Set >(); /** * Stores the list of known files for each program */ -const programFileListCache = new Map>(); +const programFileListCache = new Map>(); /** * Caches the last modified time of the tsconfig files */ -const tsconfigLsatModifiedTimestampCache = new Map(); +const tsconfigLastModifiedTimestampCache = new Map(); -const parsedFilesSeen = new Set(); +const parsedFilesSeen = new Set(); /** * Clear all of the parser caches. @@ -51,7 +57,7 @@ function clearCaches(): void { folderWatchCallbackTrackingMap.clear(); parsedFilesSeen.clear(); programFileListCache.clear(); - tsconfigLsatModifiedTimestampCache.clear(); + tsconfigLastModifiedTimestampCache.clear(); } function saveWatchCallback( @@ -61,7 +67,7 @@ function saveWatchCallback( fileName: string, callback: ts.FileWatcherCallback, ): ts.FileWatcher => { - const normalizedFileName = path.normalize(fileName); + const normalizedFileName = getCanonicalFileName(path.normalize(fileName)); const watchers = ((): Set => { let watchers = trackingMap.get(normalizedFileName); if (!watchers) { @@ -83,9 +89,9 @@ function saveWatchCallback( /** * Holds information about the file currently being linted */ -const currentLintOperationState = { +const currentLintOperationState: { code: string; filePath: CanonicalPath } = { code: '', - filePath: '', + filePath: '' as CanonicalPath, }; /** @@ -101,16 +107,17 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted - * @param filePath The path of the file being parsed + * @param filePathIn The path of the file being parsed * @param extra.tsconfigRootDir The root directory for relative tsconfig paths * @param extra.projects Provided tsconfig paths * @returns The programs corresponding to the supplied tsconfig paths */ function getProgramsForProjects( code: string, - filePath: string, + filePathIn: string, extra: Extra, ): ts.Program[] { + const filePath = getCanonicalFileName(filePathIn); const results = []; // preserve reference to code and file being linted @@ -145,7 +152,9 @@ function getProgramsForProjects( let updatedProgram: ts.Program | null = null; if (!fileList) { updatedProgram = existingWatch.getProgram().getProgram(); - fileList = new Set(updatedProgram.getRootFileNames()); + fileList = new Set( + updatedProgram.getRootFileNames().map(f => getCanonicalFileName(f)), + ); programFileListCache.set(tsconfigPath, fileList); } @@ -215,7 +224,8 @@ function createWatchProgram( // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding): string | undefined => { + watchCompilerHost.readFile = (filePathIn, encoding): string | undefined => { + const filePath = getCanonicalFileName(filePathIn); parsedFilesSeen.add(filePath); return path.normalize(filePath) === path.normalize(currentLintOperationState.filePath) @@ -297,14 +307,14 @@ function createWatchProgram( return ts.createWatchProgram(watchCompilerHost); } -function hasTSConfigChanged(tsconfigPath: string): boolean { +function hasTSConfigChanged(tsconfigPath: CanonicalPath): boolean { const stat = fs.statSync(tsconfigPath); const lastModifiedAt = stat.mtimeMs; - const cachedLastModifiedAt = tsconfigLsatModifiedTimestampCache.get( + const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get( tsconfigPath, ); - tsconfigLsatModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); + tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); if (cachedLastModifiedAt === undefined) { return false; @@ -315,8 +325,8 @@ function hasTSConfigChanged(tsconfigPath: string): boolean { function maybeInvalidateProgram( existingWatch: ts.WatchOfConfigFile, - filePath: string, - tsconfigPath: string, + filePath: CanonicalPath, + tsconfigPath: CanonicalPath, ): ts.Program | null { /* * By calling watchProgram.getProgram(), it will trigger a resync of the program based on @@ -355,21 +365,22 @@ function maybeInvalidateProgram( log('File was not found in program - triggering folder update. %s', filePath); // Find the correct directory callback by climbing the folder tree - let current: string | null = null; - let next: string | null = path.dirname(filePath); + const currentDir = canonicalDirname(filePath); + let current: CanonicalPath | null = null; + let next = currentDir; let hasCallback = false; while (current !== next) { current = next; const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); if (folderWatchCallbacks) { folderWatchCallbacks.forEach(cb => - cb(current!, ts.FileWatcherEventKind.Changed), + cb(currentDir, ts.FileWatcherEventKind.Changed), ); hasCallback = true; break; } - next = path.dirname(current); + next = canonicalDirname(current); } if (!hasCallback) { /* @@ -410,7 +421,9 @@ function maybeInvalidateProgram( return null; } - const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(deletedFile); + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get( + getCanonicalFileName(deletedFile), + ); if (!fileWatchCallbacks) { // shouldn't happen, but just in case log('Could not find watch callbacks for root file. %s', deletedFile); diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 3607a7fb897c..a436ec7082d8 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -18,10 +18,29 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { // extendedDiagnostics: true, }; -function getTsconfigPath(tsconfigPath: string, extra: Extra): string { - return path.isAbsolute(tsconfigPath) - ? tsconfigPath - : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath); +// This narrows the type so we can be sure we're passing canonical names in the correct places +type CanonicalPath = string & { __brand: unknown }; +const getCanonicalFileName = ts.sys.useCaseSensitiveFileNames + ? (path: string): CanonicalPath => path as CanonicalPath + : (path: string): CanonicalPath => path.toLowerCase() as CanonicalPath; + +function getTsconfigPath(tsconfigPath: string, extra: Extra): CanonicalPath { + return getCanonicalFileName( + path.isAbsolute(tsconfigPath) + ? tsconfigPath + : path.join(extra.tsconfigRootDir || process.cwd(), tsconfigPath), + ); +} + +function canonicalDirname(p: CanonicalPath): CanonicalPath { + return path.dirname(p) as CanonicalPath; } -export { ASTAndProgram, DEFAULT_COMPILER_OPTIONS, getTsconfigPath }; +export { + ASTAndProgram, + canonicalDirname, + CanonicalPath, + DEFAULT_COMPILER_OPTIONS, + getCanonicalFileName, + getTsconfigPath, +}; diff --git a/packages/typescript-estree/tests/lib/persistentParse.ts b/packages/typescript-estree/tests/lib/persistentParse.ts index bb77cefd7f7f..e1cb8b9f9b76 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.ts @@ -40,12 +40,16 @@ function renameFile(dirName: string, src: 'bar', dest: 'baz/bar'): void { ); } -function setup(tsconfig: Record, writeBar = true): string { +function createTmpDir(): tmp.DirResult { const tmpDir = tmp.dirSync({ keep: false, unsafeCleanup: true, }); tmpDirs.add(tmpDir); + return tmpDir; +} +function setup(tsconfig: Record, writeBar = true): string { + const tmpDir = createTmpDir(); writeTSConfig(tmpDir.name, tsconfig); @@ -141,4 +145,34 @@ describe('persistent lint session', () => { expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); }); + + it('handles tsconfigs with no includes/excludes (single level)', () => { + const PROJECT_DIR = setup({}, false); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'bar'); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); + + it('handles tsconfigs with no includes/excludes (nested)', () => { + const PROJECT_DIR = setup({}, false); + + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).toThrow(); + + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'baz/bar'); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('baz/bar', PROJECT_DIR)).not.toThrow(); + }); + + // TODO - support the complex monorepo case with a tsconfig with no include/exclude }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index ccbc9d905819..05e65137db43 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -254,7 +254,10 @@ describe('semanticInfo', () => { badConfig.project = '.'; expect(() => parseCodeAndGenerateServices(readFileSync(fileName, 'utf8'), badConfig), - ).toThrow(/File .+semanticInfo' not found/); + ).toThrow( + // case insensitive because unix based systems are case insensitive + /File .+semanticInfo' not found/i, + ); }); it('malformed project file', () => { From 768ef6339e466a072e026ffd7724e8694d5eb80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Antunes?= Date: Tue, 22 Oct 2019 16:53:29 +0100 Subject: [PATCH 22/47] fix(parser): adds TTY check before logging the version mismatch warning (#1121) --- packages/typescript-estree/src/parser.ts | 6 +++++- .../tests/lib/warn-on-unsupported-ts.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index c887193365f7..7ee2cdacbc3e 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -224,7 +224,11 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { } function warnAboutTSVersion(): void { - if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { + if ( + !isRunningSupportedTypeScriptVersion && + !warnedAboutTSVersion && + process.stdout.isTTY + ) { const border = '============='; const versionWarning = [ border, diff --git a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts index 9e6a26a39a66..581d28a7e961 100644 --- a/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts +++ b/packages/typescript-estree/tests/lib/warn-on-unsupported-ts.ts @@ -3,15 +3,20 @@ import * as parser from '../../src/parser'; jest.mock('semver'); +const resetIsTTY = process.stdout.isTTY; + describe('Warn on unsupported TypeScript version', () => { afterEach(() => { jest.resetModules(); jest.resetAllMocks(); + process.stdout.isTTY = resetIsTTY; }); it('should warn the user if they are using an unsupported TypeScript version', () => { (semver.satisfies as jest.Mock).mockReturnValue(false); jest.spyOn(console, 'log').mockImplementation(); + process.stdout.isTTY = true; + parser.parse(''); expect(console.log).toHaveBeenCalledWith( expect.stringContaining( @@ -19,4 +24,13 @@ describe('Warn on unsupported TypeScript version', () => { ), ); }); + + it('should not warn the user when the user is running on a non TTY process', () => { + (semver.satisfies as jest.Mock).mockReturnValue(false); + jest.spyOn(console, 'log').mockImplementation(); + process.stdout.isTTY = false; + + parser.parse(''); + expect(console.log).not.toHaveBeenCalled(); + }); }); From 6d0f2ceb8ff4a8044abf9f86da98d071d6b63028 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 22 Oct 2019 21:13:48 -0700 Subject: [PATCH 23/47] fix(typescript-estree): normalize paths to fix cache miss on windows (#1128) --- packages/typescript-estree/src/create-program/shared.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index a436ec7082d8..ac2dc3d5e62e 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -21,8 +21,10 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { // This narrows the type so we can be sure we're passing canonical names in the correct places type CanonicalPath = string & { __brand: unknown }; const getCanonicalFileName = ts.sys.useCaseSensitiveFileNames - ? (path: string): CanonicalPath => path as CanonicalPath - : (path: string): CanonicalPath => path.toLowerCase() as CanonicalPath; + ? (filePath: string): CanonicalPath => + path.normalize(filePath) as CanonicalPath + : (filePath: string): CanonicalPath => + path.normalize(filePath).toLowerCase() as CanonicalPath; function getTsconfigPath(tsconfigPath: string, extra: Extra): CanonicalPath { return getCanonicalFileName( From 1508670d511052244bf99ac68945064194e4294e Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 24 Oct 2019 10:28:41 -0700 Subject: [PATCH 24/47] feat(typescript-estree): add support for declare class properties (#1136) --- packages/eslint-plugin/src/rules/indent.ts | 1 + .../lib/__snapshots__/typescript.ts.snap | 330 + ...tract-class-with-declare-properties.src.ts | 7 + .../class-with-declare-properties.src.ts | 9 + packages/typescript-estree/src/convert.ts | 1 + .../src/ts-estree/ts-estree.ts | 1 + .../tests/ast-alignment/fixtures-to-test.ts | 17 + .../semantic-diagnostics-enabled.ts.snap | 4 + .../lib/__snapshots__/semanticInfo.ts.snap | 1 + .../lib/__snapshots__/typescript.ts.snap | 8335 +++++++++++------ 10 files changed, 5865 insertions(+), 2841 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 9951db4ea8b0..704bc09dc65b 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -163,6 +163,7 @@ export default util.createRule({ type, static: false, readonly: false, + declare: false, ...base, } as TSESTree.ClassProperty; } diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index ab627ecea750..847709697616 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -932,6 +932,171 @@ Object { } `; +exports[`typescript fixtures/basics/abstract-class-with-declare-properties.src 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 230, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 230, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "AbstractDeclProps": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + ], + "name": "AbstractDeclProps", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "AbstractDeclProps": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 229, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + }, + ], + "name": "AbstractDeclProps", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` Object { "$id": 4, @@ -4605,6 +4770,171 @@ Object { } `; +exports[`typescript fixtures/basics/class-with-declare-properties.src 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 271, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 271, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 270, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "DeclProps": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "DeclProps", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 270, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "DeclProps", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "DeclProps", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "DeclProps": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "DeclProps", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 270, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "DeclProps", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "DeclProps", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` Object { "$id": 4, diff --git a/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts new file mode 100644 index 000000000000..307d36a66163 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/abstract-class-with-declare-properties.src.ts @@ -0,0 +1,7 @@ +abstract class AbstractDeclProps { + declare prop1: string; + declare abstract prop2: string; + declare public abstract prop3: string; + declare readonly abstract prop4: string; + declare public readonly abstract prop5: string; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts new file mode 100644 index 000000000000..3b37e42e4b19 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-declare-properties.src.ts @@ -0,0 +1,9 @@ +class DeclProps { + declare prop1: string; + declare public prop2: string; + declare static prop3: string; + declare readonly prop3: string; + declare public readonly prop4: string; + declare public static prop5: string; + declare public static readonly prop6: string; +} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 598178158b01..8ffbc03b3ce8 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -926,6 +926,7 @@ export class Converter { computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + declare: hasModifier(SyntaxKind.DeclareKeyword, node), }); if (node.type) { diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 178ed9efe59d..10cd0b7e0fb2 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -472,6 +472,7 @@ interface ClassPropertyBase extends BaseNode { value: Expression | null; computed: boolean; static: boolean; + declare: boolean; readonly?: boolean; decorators?: Decorator[]; accessibility?: Accessibility; 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 68639cb01b55..4c7276573ff8 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -605,6 +605,20 @@ tester.addFixturePatternConfig('typescript/basics', { 'type-assertion-with-guard-in-function', 'type-assertion-with-guard-in-interface', 'type-assertion-with-guard-in-method', + // declare class properties + 'abstract-class-with-abstract-properties', + 'abstract-class-with-abstract-readonly-property', + 'abstract-class-with-declare-properties', + 'class-with-declare-properties', + 'class-with-definite-assignment', + 'class-with-optional-computed-property', + 'class-with-optional-properties', + 'class-with-optional-property-undefined', + 'class-with-property-function', + 'class-with-property-values', + 'class-with-readonly-property', + 'object-with-escaped-properties', + 'type-reference-comments', ], ignoreSourceType: [ /** @@ -684,6 +698,9 @@ tester.addFixturePatternConfig('typescript/decorators/property-decorators', { // optional chaining 'property-decorator-factory-instance-member', 'property-decorator-factory-static-member', + // declare class properties + 'property-decorator-instance-member', + 'property-decorator-static-member', ], }); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 645b6114f8ac..423d0c5bc652 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -1650,6 +1650,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-class-with-optional-method.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/abstract-interface.src 1`] = ` @@ -1708,6 +1710,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-constructor-and-type-parameters.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-declare-properties.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-definite-assignment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-export-parameter-properties.src 1`] = ` diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap index c1ba4580efde..f6b67ce5556a 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.ts.snap @@ -1254,6 +1254,7 @@ Object { "body": Array [ Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 44425c5e4a57..6437b88068c8 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -1607,6 +1607,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -1645,6 +1646,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -2017,6 +2019,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -2362,220 +2365,421 @@ Object { } `; -exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` +exports[`typescript fixtures/basics/abstract-class-with-declare-properties.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "abstract": true, - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 45, + 50, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 37, + 59, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 50, + 58, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 2, }, "start": Object { - "column": 4, + "column": 17, "line": 2, }, }, - "name": "createSocket", - "optional": true, "range": Array [ - 43, - 55, + 52, + 58, ], - "type": "Identifier", + "type": "TSStringKeyword", }, - "kind": "method", + }, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 24, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 19, + "line": 3, }, }, + "name": "prop2", "range": Array [ - 43, - 76, + 79, + 84, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 62, + 93, + ], + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 17, - "line": 2, + "column": 26, + "line": 3, }, }, - "params": Array [], "range": Array [ - 56, - 76, + 86, + 92, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "name": "prop3", + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 96, + 134, + ], + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 125, + 133, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, }, - "range": Array [ - 58, - 75, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 60, - 75, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "name": "Promise", - "range": Array [ - 60, - 67, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, - ], - "range": Array [ - 67, - 75, - ], - "type": "TSTypeParameterInstantiation", - }, + "start": Object { + "column": 33, + "line": 4, }, }, - "type": "FunctionExpression", + "range": Array [ + 127, + 133, + ], + "type": "TSStringKeyword", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "name": "prop4", + "range": Array [ + 163, + 168, + ], + "type": "Identifier", }, - "start": Object { - "column": 37, - "line": 1, + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 137, + 177, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 176, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 170, + 176, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, - "range": Array [ - 37, - 78, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "name": "prop5", + "range": Array [ + 213, + 218, + ], + "type": "Identifier", }, - "start": Object { - "column": 22, - "line": 1, + "loc": Object { + "end": Object { + "column": 49, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 180, + 227, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 226, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 220, + 226, + ], + "type": "TSStringKeyword", + }, }, + "value": null, }, - "name": "AbstractSocket", - "range": Array [ - 22, - 36, - ], - "type": "Identifier", - }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 7, }, "start": Object { - "column": 7, + "column": 33, "line": 1, }, }, "range": Array [ - 7, - 78, + 33, + 229, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "AbstractDeclProps", + "range": Array [ + 15, + 32, + ], + "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 7, }, "start": Object { "column": 0, @@ -2584,17 +2788,16 @@ Object { }, "range": Array [ 0, - 78, + 229, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -2603,14 +2806,14 @@ Object { }, "range": Array [ 0, - 78, + 230, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -2620,25 +2823,7 @@ Object { }, "range": Array [ 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 15, + 8, ], "type": "Identifier", "value": "abstract", @@ -2646,17 +2831,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, "range": Array [ - 16, - 21, + 9, + 14, ], "type": "Keyword", "value": "class", @@ -2664,35 +2849,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 32, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 36, + 15, + 32, ], "type": "Identifier", - "value": "AbstractSocket", + "value": "AbstractDeclProps", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 34, "line": 1, }, "start": Object { - "column": 37, + "column": 33, "line": 1, }, }, "range": Array [ - 37, - 38, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -2700,83 +2885,83 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, "range": Array [ - 43, - 55, + 37, + 44, ], "type": "Identifier", - "value": "createSocket", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 2, }, "start": Object { - "column": 16, + "column": 10, "line": 2, }, }, "range": Array [ - 55, - 56, + 45, + 50, ], - "type": "Punctuator", - "value": "?", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 2, }, "start": Object { - "column": 17, + "column": 15, "line": 2, }, }, "range": Array [ - 56, - 57, + 50, + 51, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 2, }, "start": Object { - "column": 18, + "column": 17, "line": 2, }, }, "range": Array [ - 57, + 52, 58, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 2, }, "start": Object { - "column": 19, + "column": 23, "line": 2, }, }, @@ -2785,246 +2970,166 @@ Object { 59, ], "type": "Punctuator", - "value": ":", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 9, + "line": 3, }, "start": Object { - "column": 21, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 60, - 67, + 62, + 69, ], "type": "Identifier", - "value": "Promise", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 18, + "line": 3, }, "start": Object { - "column": 28, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 67, - 68, + 70, + 78, ], - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 2, + "column": 24, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 19, + "line": 3, }, }, "range": Array [ - 68, - 74, + 79, + 84, ], "type": "Identifier", - "value": "string", + "value": "prop2", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 2, + "column": 25, + "line": 3, }, "start": Object { - "column": 35, - "line": 2, + "column": 24, + "line": 3, }, }, "range": Array [ - 74, - 75, + 84, + 85, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 2, + "column": 32, + "line": 3, }, "start": Object { - "column": 36, - "line": 2, + "column": 26, + "line": 3, }, }, "range": Array [ - 75, - 76, + 86, + 92, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 33, "line": 3, }, "start": Object { - "column": 0, + "column": 32, "line": 3, }, }, "range": Array [ - 77, - 78, + 92, + 93, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": Object { - "abstract": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 31, - ], - "type": "TSInterfaceBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "I", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 31, - ], - "type": "TSInterfaceDeclaration", - }, "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 9, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 0, - 31, + 96, + 103, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "declare", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 16, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 4, }, }, "range": Array [ - 0, - 6, + 104, + 110, ], "type": "Keyword", - "value": "export", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 25, + "line": 4, }, "start": Object { - "column": 7, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 7, - 15, + 111, + 119, ], "type": "Identifier", "value": "abstract", @@ -3032,532 +3137,582 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 31, + "line": 4, }, "start": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 4, }, }, "range": Array [ - 16, - 25, + 120, + 125, ], - "type": "Keyword", - "value": "interface", + "type": "Identifier", + "value": "prop3", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 32, + "line": 4, }, "start": Object { - "column": 26, - "line": 1, + "column": 31, + "line": 4, }, }, "range": Array [ - 26, - 27, + 125, + 126, ], - "type": "Identifier", - "value": "I", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 39, + "line": 4, }, "start": Object { - "column": 28, - "line": 1, + "column": 33, + "line": 4, }, }, "range": Array [ - 28, - 29, + 127, + 133, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 40, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 39, + "line": 4, }, }, "range": Array [ - 30, - 31, + 133, + 134, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 27, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "TSAnyKeyword", - }, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 27, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 0, - 28, + 137, + 144, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "declare", }, - }, - "range": Array [ - 0, - 29, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 18, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 10, + "line": 5, }, }, "range": Array [ - 0, - 5, + 145, + 153, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 27, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, - }, + "column": 19, + "line": 5, + }, }, "range": Array [ - 6, - 9, + 154, + 162, ], "type": "Identifier", - "value": "foo", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 33, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 28, + "line": 5, }, }, "range": Array [ - 10, - 11, + 163, + 168, + ], + "type": "Identifier", + "value": "prop4", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 41, + "line": 5, }, "start": Object { - "column": 12, - "line": 1, + "column": 35, + "line": 5, }, }, "range": Array [ - 12, - 13, + 170, + 176, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 176, + 177, ], "type": "Punctuator", - "value": "<", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 9, + "line": 6, }, "start": Object { - "column": 13, - "line": 1, + "column": 2, + "line": 6, }, }, "range": Array [ - 13, - 16, + 180, + 187, ], "type": "Identifier", - "value": "any", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 188, + 194, + ], + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { "column": 17, - "line": 1, + "line": 6, + }, + }, + "range": Array [ + 195, + 203, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, }, "start": Object { - "column": 16, - "line": 1, + "column": 26, + "line": 6, }, }, "range": Array [ - 16, - 17, + 204, + 212, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 213, + 218, + ], + "type": "Identifier", + "value": "prop5", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 219, ], "type": "Punctuator", - "value": ">", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 48, + "line": 6, }, "start": Object { - "column": 26, - "line": 1, + "column": 42, + "line": 6, }, }, "range": Array [ - 26, - 27, + 220, + 226, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 49, + "line": 6, }, "start": Object { - "column": 27, - "line": 1, + "column": 48, + "line": 6, }, }, "range": Array [ - 27, - 28, + 226, + 227, ], "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "}", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` +exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "asserted2", - "range": Array [ - 4, - 13, - ], - "type": "Identifier", - }, - "init": Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "n", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 40, - ], - "type": "ReturnStatement", - }, - ], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 2, }, }, + "name": "createSocket", + "optional": true, "range": Array [ - 29, - 42, + 43, + 55, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "kind": "method", "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 2, }, }, - "params": Array [ - Object { + "range": Array [ + 43, + 76, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 56, + 76, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 19, + "line": 2, }, }, - "name": "n", "range": Array [ - 23, - 24, + 58, + 75, ], - "type": "Identifier", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 75, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "Promise", + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 67, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, }, - ], - "range": Array [ - 22, - 42, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, + "type": "FunctionExpression", }, }, - "range": Array [ - 16, - 43, - ], - "type": "TSTypeAssertion", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 20, - ], - "type": "TSAnyKeyword", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, }, }, + "range": Array [ + 37, + 78, + ], + "type": "ClassBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 43, + "column": 36, "line": 1, }, "start": Object { - "column": 4, + "column": 22, "line": 1, }, }, + "name": "AbstractSocket", "range": Array [ - 4, - 43, + 22, + 36, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 78, + ], + "superClass": null, + "type": "ClassDeclaration", + }, "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -3566,15 +3721,17 @@ Object { }, "range": Array [ 0, - 44, + 78, ], - "type": "VariableDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -3583,14 +3740,14 @@ Object { }, "range": Array [ 0, - 45, + 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { @@ -3600,28 +3757,10 @@ Object { }, "range": Array [ 0, - 3, + 6, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "Identifier", - "value": "asserted2", + "value": "export", }, Object { "loc": Object { @@ -3630,21 +3769,21 @@ Object { "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, + 7, 15, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { @@ -3654,115 +3793,115 @@ Object { }, "range": Array [ 16, - 17, + 21, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 36, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 20, + 22, + 36, ], "type": "Identifier", - "value": "any", + "value": "AbstractSocket", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 20, + "column": 37, "line": 1, }, }, "range": Array [ - 20, - 21, + 37, + 38, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 21, - 22, + 43, + 55, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "createSocket", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 22, - 23, + 55, + 56, ], "type": "Punctuator", - "value": "(", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 23, - 24, + 56, + 57, ], - "type": "Identifier", - "value": "n", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 24, - 25, + 57, + 58, ], "type": "Punctuator", "value": ")", @@ -3770,276 +3909,196 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 26, - 28, + 58, + 59, ], "type": "Punctuator", - "value": "=>", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 29, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 29, - 30, + 60, + 67, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "Promise", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 31, - 37, + 67, + 68, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 38, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 38, - 39, + 68, + 74, ], "type": "Identifier", - "value": "n", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": ";", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 36, + "line": 2, }, "start": Object { - "column": 41, - "line": 1, + "column": 35, + "line": 2, }, }, "range": Array [ - 41, - 42, + 74, + 75, ], "type": "Punctuator", - "value": "}", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 42, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 42, - 43, + 75, + 76, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 43, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 43, - 44, + 77, + 78, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` +exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "async": false, - "body": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "k", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, }, - "operator": "+", - "range": Array [ - 9, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "start": Object { + "column": 28, + "line": 1, }, - "type": "BinaryExpression", }, - "expression": true, - "generator": false, - "id": null, + "range": Array [ + 28, + 31, + ], + "type": "TSInterfaceBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 27, "line": 1, }, "start": Object { - "column": 1, + "column": 26, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "k", - "optional": true, - "range": Array [ - 2, - 4, - ], - "type": "Identifier", - }, - ], + "name": "I", "range": Array [ - 1, - 14, + 26, + 27, ], - "type": "ArrowFunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { - "column": 0, + "column": 7, "line": 1, }, }, - "optional": false, "range": Array [ - 0, - 17, + 7, + 31, ], - "type": "CallExpression", + "type": "TSInterfaceDeclaration", }, "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { "column": 0, @@ -4048,14 +4107,16 @@ Object { }, "range": Array [ 0, - 18, + 31, ], - "type": "ExpressionStatement", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, + "column": 1, "line": 2, }, "start": Object { @@ -4065,14 +4126,14 @@ Object { }, "range": Array [ 0, - 19, + 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -4082,172 +4143,305 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 7, "line": 1, }, }, "range": Array [ - 2, - 3, + 7, + 15, ], "type": "Identifier", - "value": "k", + "value": "abstract", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 25, "line": 1, }, "start": Object { - "column": 3, + "column": 16, "line": 1, }, }, "range": Array [ - 3, - 4, + 16, + 25, ], - "type": "Punctuator", - "value": "?", + "type": "Keyword", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 27, "line": 1, }, "start": Object { - "column": 4, + "column": 26, "line": 1, }, }, "range": Array [ - 4, - 5, + 26, + 27, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "I", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 29, "line": 1, }, "start": Object { - "column": 6, + "column": 28, "line": 1, }, }, "range": Array [ - 6, - 8, + 28, + 29, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "k", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 11, - 12, + 30, + 31, ], "type": "Punctuator", - "value": "+", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/angle-bracket-type-assertion.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, }, "range": Array [ - 13, - 14, + 0, + 28, ], - "type": "Numeric", - "value": "1", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, + "column": 5, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { @@ -4256,16 +4450,16 @@ Object { "line": 1, }, "start": Object { - "column": 15, + "column": 13, "line": 1, }, }, "range": Array [ - 15, + 13, 16, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "any", }, Object { "loc": Object { @@ -4283,22 +4477,40 @@ Object { 17, ], "type": "Punctuator", - "value": ")", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 27, "line": 1, }, "start": Object { - "column": 17, + "column": 26, "line": 1, }, }, "range": Array [ - 17, - 18, + 26, + 27, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -4308,84 +4520,16 @@ Object { } `; -exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` +exports[`typescript fixtures/basics/angle-bracket-type-assertion-arrow-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 22, - 31, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 33, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { @@ -4393,182 +4537,164 @@ Object { "line": 1, }, }, - "name": "b", + "name": "asserted2", "range": Array [ 4, - 8, + 13, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 8, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + }, + "init": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { - "column": 8, + "column": 42, "line": 1, }, "start": Object { - "column": 7, + "column": 29, "line": 1, }, }, "range": Array [ - 7, - 8, + 29, + 42, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 8, + "column": 24, "line": 1, }, "start": Object { - "column": 7, + "column": 23, "line": 1, }, }, - "name": "X", + "name": "n", "range": Array [ - 7, - 8, + 23, + 24, ], "type": "Identifier", }, - }, - }, - }, - ], - "range": Array [ - 0, - 33, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + ], + "range": Array [ + 22, + 42, + ], + "type": "ArrowFunctionExpression", }, - }, - "range": Array [ - 9, - 12, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 43, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 43, ], - "type": "TSTypeReference", - "typeName": Object { + "type": "TSTypeAssertion", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 17, "line": 1, }, }, - "name": "X", "range": Array [ - 11, - 12, + 17, + 20, ], - "type": "Identifier", + "type": "TSAnyKeyword", }, }, - }, - "type": "ArrowFunctionExpression", - "typeParameters": Object { "loc": Object { "end": Object { - "column": 3, + "column": 43, "line": 1, }, "start": Object { - "column": 0, + "column": 4, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - "range": Array [ - 1, - 2, - ], - "type": "TSTypeParameter", - }, - ], "range": Array [ - 0, - 3, + 4, + 43, ], - "type": "TSTypeParameterDeclaration", + "type": "VariableDeclarator", }, - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 44, + "line": 1, }, "start": Object { "column": 0, @@ -4577,15 +4703,15 @@ Object { }, "range": Array [ 0, - 33, + 44, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -4594,14 +4720,14 @@ Object { }, "range": Array [ 0, - 33, + 45, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -4611,187 +4737,187 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, - 2, + 4, + 13, ], "type": "Identifier", - "value": "X", + "value": "asserted2", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 3, + 14, + 15, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 17, "line": 1, }, "start": Object { - "column": 3, + "column": 16, "line": 1, }, }, "range": Array [ - 3, - 4, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 17, "line": 1, }, }, "range": Array [ - 4, - 5, + 17, + 20, ], "type": "Identifier", - "value": "b", + "value": "any", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 21, "line": 1, }, "start": Object { - "column": 5, + "column": 20, "line": 1, }, }, "range": Array [ - 5, - 6, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 22, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 8, + 21, + 22, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 1, }, "start": Object { - "column": 8, + "column": 22, "line": 1, }, }, "range": Array [ - 8, - 9, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, "range": Array [ - 9, - 10, + 23, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 25, ], - "type": "Identifier", - "value": "X", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 1, }, "start": Object { - "column": 13, + "column": 26, "line": 1, }, }, "range": Array [ - 13, - 15, + 26, + 28, ], "type": "Punctuator", "value": "=>", @@ -4799,17 +4925,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { - "column": 16, + "column": 29, "line": 1, }, }, "range": Array [ - 16, - 17, + 29, + 30, ], "type": "Punctuator", "value": "{", @@ -4817,17 +4943,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 22, - 28, + 31, + 37, ], "type": "Keyword", "value": "return", @@ -4835,35 +4961,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 39, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 38, + "line": 1, }, }, "range": Array [ - 29, - 30, + 38, + 39, ], "type": "Identifier", - "value": "b", + "value": "n", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 39, + "line": 1, }, }, "range": Array [ - 30, - 31, + 39, + 40, ], "type": "Punctuator", "value": ";", @@ -4871,93 +4997,169 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 42, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 41, + "line": 1, }, }, "range": Array [ - 32, - 33, + 41, + 42, ], "type": "Punctuator", "value": "}", }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-optional-parameter.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "arguments": Array [], "callee": Object { - "async": true, + "async": false, "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 1, + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "k", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "range": Array [ - 23, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 20, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, - "name": "test", + "operator": "+", "range": Array [ - 16, - 20, + 9, + 14, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { "column": 1, "line": 1, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "k", + "optional": true, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + }, + ], "range": Array [ 1, - 26, + 14, ], - "type": "FunctionExpression", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { "column": 0, @@ -4967,14 +5169,14 @@ Object { "optional": false, "range": Array [ 0, - 29, + 17, ], "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { "column": 0, @@ -4983,14 +5185,14 @@ Object { }, "range": Array [ 0, - 30, + 18, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 5, + "column": 0, "line": 2, }, "start": Object { @@ -5000,7 +5202,7 @@ Object { }, "range": Array [ 0, - 30, + 19, ], "sourceType": "script", "tokens": Array [ @@ -5025,7 +5227,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 2, "line": 1, }, "start": Object { @@ -5035,133 +5237,151 @@ Object { }, "range": Array [ 1, - 6, + 2, ], - "type": "Identifier", - "value": "async", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 3, "line": 1, }, "start": Object { - "column": 7, + "column": 2, "line": 1, }, }, "range": Array [ - 7, - 15, + 2, + 3, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "k", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 4, "line": 1, }, "start": Object { - "column": 16, + "column": 3, "line": 1, }, }, "range": Array [ - 16, - 20, + 3, + 4, ], - "type": "Identifier", - "value": "test", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 5, "line": 1, }, "start": Object { - "column": 20, + "column": 4, "line": 1, }, }, "range": Array [ - 20, - 21, + 4, + 5, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 8, "line": 1, }, "start": Object { - "column": 21, + "column": 6, "line": 1, }, }, "range": Array [ - 21, - 22, + 6, + 8, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 10, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 10, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "k", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 25, - 26, + 11, + 12, ], "type": "Punctuator", - "value": "}", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 1, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 26, - 27, + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", "value": ")", @@ -5169,17 +5389,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 27, - 28, + 15, + 16, ], "type": "Punctuator", "value": "(", @@ -5187,17 +5407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 28, - 29, + 16, + 17, ], "type": "Punctuator", "value": ")", @@ -5205,17 +5425,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 29, - 30, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -5225,34 +5445,951 @@ Object { } `; -exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, }, - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "range": Array [ + 1, + 2, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 0, + 3, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 29, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, "init": Object { "loc": Object { "end": Object { @@ -9797,6 +10934,7 @@ Object { Object { "accessibility": "private", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -9870,6 +11008,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -9941,132 +11080,1269 @@ Object { "value": null, }, Object { - "accessibility": "public", + "accessibility": "public", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "getBar", + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 68, + 111, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 98, + 106, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 91, + 107, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 111, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 82, + 111, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "setBar", + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 114, + 171, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "bar", + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + }, + "range": Array [ + 152, + 160, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "operator": "=", + "range": Array [ + 152, + 166, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "name": "bar", + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 167, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 171, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 132, + 144, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 136, + 144, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 131, + 171, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 173, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 173, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 174, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 91, + 97, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "setBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 132, + 135, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 32, + "line": 7, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 7, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-constructor-and-modifier.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "protected", "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 23, + "line": 2, }, "start": Object { - "column": 9, - "line": 4, + "column": 12, + "line": 2, }, }, - "name": "getBar", + "name": "constructor", "range": Array [ - 75, - 81, + 22, + 33, ], "type": "Identifier", }, - "kind": "method", + "kind": "constructor", "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 29, + "line": 2, }, "start": Object { "column": 2, - "line": 4, + "line": 2, }, }, "range": Array [ - 68, - 111, + 12, + 39, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "range": Array [ - 98, - 102, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, - }, - "name": "bar", - "range": Array [ - 103, - 106, - ], - "type": "Identifier", - }, - "range": Array [ - 98, - 106, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 91, - 107, - ], - "type": "ReturnStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 29, + "line": 2, }, "start": Object { - "column": 19, - "line": 4, + "column": 26, + "line": 2, }, }, "range": Array [ - 85, - 111, + 36, + 39, ], "type": "BlockStatement", }, @@ -10075,185 +12351,78 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 29, + "line": 2, }, "start": Object { - "column": 16, - "line": 4, + "column": 23, + "line": 2, }, }, "params": Array [], "range": Array [ - 82, - 111, + 33, + 39, ], "type": "FunctionExpression", }, }, Object { - "accessibility": "protected", - "computed": false, + "accessibility": "public", + "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 7, + "column": 23, + "line": 4, }, "start": Object { - "column": 12, - "line": 7, + "column": 10, + "line": 4, }, }, - "name": "setBar", "range": Array [ - 124, - 130, + 51, + 64, ], - "type": "Identifier", + "raw": "'constructor'", + "type": "Literal", + "value": "constructor", }, "kind": "method", "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 30, + "line": 4, }, "start": Object { "column": 2, - "line": 7, + "line": 4, }, }, "range": Array [ - 114, - 171, + 43, + 71, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 12, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 152, - 156, - ], - "type": "ThisExpression", - }, - "optional": false, - "property": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 8, - }, - "start": Object { - "column": 9, - "line": 8, - }, - }, - "name": "bar", - "range": Array [ - 157, - 160, - ], - "type": "Identifier", - }, - "range": Array [ - 152, - 160, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "operator": "=", - "range": Array [ - 152, - 166, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 8, - }, - "start": Object { - "column": 15, - "line": 8, - }, - }, - "name": "bar", - "range": Array [ - 163, - 166, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 152, - 167, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 30, + "line": 4, }, "start": Object { - "column": 34, - "line": 7, + "column": 27, + "line": 4, }, }, "range": Array [ - 146, - 171, + 68, + 71, ], "type": "BlockStatement", }, @@ -10262,71 +12431,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 30, + "line": 4, }, "start": Object { - "column": 19, - "line": 7, + "column": 24, + "line": 4, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 7, - }, - "start": Object { - "column": 20, - "line": 7, - }, - }, - "name": "bar", - "range": Array [ - 132, - 144, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 7, - }, - "start": Object { - "column": 24, - "line": 7, - }, - }, - "range": Array [ - 136, - 144, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 7, - }, - "start": Object { - "column": 26, - "line": 7, - }, - }, - "range": Array [ - 138, - 144, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], + "params": Array [], "range": Array [ - 131, - 171, + 65, + 71, ], "type": "FunctionExpression", }, @@ -10335,23 +12451,23 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 10, + "line": 5, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 173, + 8, + 73, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -10359,17 +12475,17 @@ Object { "line": 1, }, }, - "name": "Foo", + "name": "C", "range": Array [ 6, - 9, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 10, + "line": 5, }, "start": Object { "column": 0, @@ -10378,7 +12494,7 @@ Object { }, "range": Array [ 0, - 173, + 73, ], "superClass": null, "type": "ClassDeclaration", @@ -10387,7 +12503,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 11, + "line": 6, }, "start": Object { "column": 0, @@ -10396,7 +12512,7 @@ Object { }, "range": Array [ 0, - 174, + 74, ], "sourceType": "script", "tokens": Array [ @@ -10421,7 +12537,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { @@ -10431,25 +12547,25 @@ Object { }, "range": Array [ 6, - 9, + 7, ], "type": "Identifier", - "value": "Foo", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -10457,7 +12573,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { @@ -10466,183 +12582,165 @@ Object { }, }, "range": Array [ - 14, + 12, 21, ], "type": "Keyword", - "value": "private", + "value": "protected", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 2, }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ 22, - 25, + 33, ], "type": "Identifier", - "value": "bar", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 2, }, "start": Object { - "column": 14, + "column": 23, "line": 2, }, }, "range": Array [ - 26, - 27, + 33, + 34, ], "type": "Punctuator", - "value": ":", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 25, "line": 2, }, "start": Object { - "column": 16, + "column": 24, "line": 2, }, }, "range": Array [ - 28, 34, + 35, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 27, "line": 2, }, "start": Object { - "column": 22, + "column": 26, "line": 2, }, }, "range": Array [ - 34, - 35, + 36, + 37, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 29, + "line": 2, }, "start": Object { - "column": 2, - "line": 3, + "column": 28, + "line": 2, }, }, "range": Array [ 38, - 44, + 39, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 8, + "line": 4, }, "start": Object { - "column": 9, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 45, - 51, + 43, + 49, ], "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 52, - 55, - ], - "type": "Identifier", - "value": "baz", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 3, + "column": 10, + "line": 4, }, "start": Object { - "column": 20, - "line": 3, + "column": 9, + "line": 4, }, }, "range": Array [ - 56, - 57, + 50, + 51, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 23, + "line": 4, }, "start": Object { - "column": 22, - "line": 3, + "column": 10, + "line": 4, }, }, "range": Array [ - 58, + 51, 64, ], - "type": "Identifier", - "value": "number", + "type": "String", + "value": "'constructor'", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 24, + "line": 4, }, "start": Object { - "column": 28, - "line": 3, + "column": 23, + "line": 4, }, }, "range": Array [ @@ -10650,472 +12748,741 @@ Object { 65, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 25, "line": 4, }, "start": Object { - "column": 2, + "column": 24, "line": 4, }, }, "range": Array [ - 68, - 74, + 65, + 66, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 4, }, "start": Object { - "column": 9, + "column": 25, "line": 4, }, }, "range": Array [ - 75, - 81, + 66, + 67, ], - "type": "Identifier", - "value": "getBar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 28, "line": 4, }, "start": Object { - "column": 16, + "column": 27, "line": 4, }, }, "range": Array [ - 82, - 83, + 68, + 69, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 4, }, "start": Object { - "column": 17, + "column": 29, "line": 4, }, }, "range": Array [ - 83, - 84, + 70, + 71, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 1, + "line": 5, }, "start": Object { - "column": 19, - "line": 4, + "column": 0, + "line": 5, }, }, "range": Array [ - 85, - 86, + 72, + 73, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-constructor-and-return-type.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 5, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 37, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 42, + 55, + ], + "raw": "'constructor'", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 41, + 70, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 56, + 70, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 58, + 66, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 4, - "line": 5, + "range": Array [ + 8, + 72, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 91, - 97, - ], - "type": "Keyword", - "value": "return", - }, - Object { "loc": Object { "end": Object { - "column": 15, + "column": 1, "line": 5, }, "start": Object { - "column": 11, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 98, - 102, + 0, + 72, ], - "type": "Keyword", - "value": "this", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 5, + "line": 1, }, "start": Object { - "column": 15, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 102, - 103, + 0, + 5, ], - "type": "Punctuator", - "value": ".", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 5, + "column": 7, + "line": 1, }, "start": Object { - "column": 16, - "line": 5, + "column": 6, + "line": 1, }, }, "range": Array [ - 103, - 106, + 6, + 7, ], "type": "Identifier", - "value": "bar", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 19, - "line": 5, + "column": 8, + "line": 1, }, }, "range": Array [ - 106, - 107, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 13, + "line": 2, }, "start": Object { "column": 2, - "line": 6, + "line": 2, }, }, "range": Array [ - 110, - 111, + 12, + 23, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 7, + "column": 14, + "line": 2, }, "start": Object { - "column": 2, - "line": 7, + "column": 13, + "line": 2, }, }, "range": Array [ - 114, - 123, + 23, + 24, ], - "type": "Keyword", - "value": "protected", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { - "end": Object { - "column": 18, - "line": 7, + "end": Object { + "column": 15, + "line": 2, }, "start": Object { - "column": 12, - "line": 7, + "column": 14, + "line": 2, }, }, "range": Array [ - 124, - 130, + 24, + 25, ], - "type": "Identifier", - "value": "setBar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 7, + "column": 16, + "line": 2, }, "start": Object { - "column": 19, - "line": 7, + "column": 15, + "line": 2, }, }, "range": Array [ - 131, - 132, + 25, + 26, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 7, + "line": 2, }, "start": Object { - "column": 20, - "line": 7, + "column": 17, + "line": 2, }, }, "range": Array [ - 132, - 135, + 27, + 33, ], "type": "Identifier", - "value": "bar", + "value": "number", }, Object { "loc": Object { "end": Object { "column": 25, - "line": 7, + "line": 2, }, "start": Object { "column": 24, - "line": 7, + "line": 2, }, }, "range": Array [ - 136, - 137, + 34, + 35, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 7, + "column": 27, + "line": 2, }, "start": Object { "column": 26, - "line": 7, + "line": 2, }, }, "range": Array [ - 138, - 144, + 36, + 37, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 7, + "column": 3, + "line": 4, }, "start": Object { - "column": 32, - "line": 7, + "column": 2, + "line": 4, }, }, "range": Array [ - 144, - 145, + 41, + 42, ], "type": "Punctuator", - "value": ")", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 7, + "column": 16, + "line": 4, }, "start": Object { - "column": 34, - "line": 7, + "column": 3, + "line": 4, }, }, "range": Array [ - 146, - 147, + 42, + 55, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "'constructor'", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 8, + "column": 17, + "line": 4, }, "start": Object { - "column": 4, - "line": 8, + "column": 16, + "line": 4, }, }, "range": Array [ - 152, - 156, + 55, + 56, ], - "type": "Keyword", - "value": "this", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 8, + "column": 18, + "line": 4, }, "start": Object { - "column": 8, - "line": 8, + "column": 17, + "line": 4, }, }, "range": Array [ - 156, - 157, + 56, + 57, ], "type": "Punctuator", - "value": ".", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 8, + "column": 19, + "line": 4, }, "start": Object { - "column": 9, - "line": 8, + "column": 18, + "line": 4, }, }, "range": Array [ - 157, - 160, + 57, + 58, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, + "column": 20, + "line": 4, }, "start": Object { - "column": 13, - "line": 8, + "column": 19, + "line": 4, }, }, "range": Array [ - 161, - 162, + 58, + 59, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 8, + "column": 27, + "line": 4, }, "start": Object { - "column": 15, - "line": 8, + "column": 21, + "line": 4, }, }, "range": Array [ - 163, - 166, + 60, + 66, ], "type": "Identifier", - "value": "bar", + "value": "number", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 8, + "column": 29, + "line": 4, }, "start": Object { - "column": 18, - "line": 8, + "column": 28, + "line": 4, }, }, "range": Array [ - 166, - 167, + 67, + 68, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 9, + "column": 31, + "line": 4, }, "start": Object { - "column": 2, - "line": 9, + "column": 30, + "line": 4, }, }, "range": Array [ - 170, - 171, + 69, + 70, ], "type": "Punctuator", "value": "}", @@ -11124,16 +13491,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 10, + "line": 5, }, "start": Object { "column": 0, - "line": 10, + "line": 5, }, }, "range": Array [ - 172, - 173, + 71, + 72, ], "type": "Punctuator", "value": "}", @@ -11143,37 +13510,36 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-constructor-and-modifier.src 1`] = ` +exports[`typescript fixtures/basics/class-with-constructor-and-type-parameters.src 1`] = ` Object { "body": Array [ Object { "body": Object { "body": Array [ Object { - "accessibility": "protected", "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 2, }, "start": Object { - "column": 12, + "column": 2, "line": 2, }, }, "name": "constructor", "range": Array [ - 22, - 33, + 12, + 23, ], "type": "Identifier", }, "kind": "constructor", "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 2, }, "start": Object { @@ -11183,7 +13549,7 @@ Object { }, "range": Array [ 12, - 39, + 32, ], "static": false, "type": "MethodDefinition", @@ -11193,17 +13559,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 2, }, "start": Object { - "column": 26, + "column": 19, "line": 2, }, }, "range": Array [ - 36, - 39, + 29, + 32, ], "type": "BlockStatement", }, @@ -11212,39 +13578,92 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 2, }, "start": Object { - "column": 23, + "column": 13, "line": 2, }, }, "params": Array [], "range": Array [ - 33, - 39, + 23, + 32, ], "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 23, + 26, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, Object { - "accessibility": "public", "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 4, }, "start": Object { - "column": 10, + "column": 3, "line": 4, }, }, "range": Array [ - 51, - 64, + 37, + 50, ], "raw": "'constructor'", "type": "Literal", @@ -11253,7 +13672,7 @@ Object { "kind": "method", "loc": Object { "end": Object { - "column": 30, + "column": 26, "line": 4, }, "start": Object { @@ -11262,8 +13681,8 @@ Object { }, }, "range": Array [ - 43, - 71, + 36, + 60, ], "static": false, "type": "MethodDefinition", @@ -11273,17 +13692,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 30, + "column": 26, "line": 4, }, "start": Object { - "column": 27, + "column": 23, "line": 4, }, }, "range": Array [ - 68, - 71, + 57, + 60, ], "type": "BlockStatement", }, @@ -11292,20 +13711,74 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 30, + "column": 26, "line": 4, }, "start": Object { - "column": 24, + "column": 17, "line": 4, }, }, "params": Array [], "range": Array [ - 65, - 71, + 51, + 60, ], "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterDeclaration", + }, }, }, ], @@ -11321,7 +13794,7 @@ Object { }, "range": Array [ 8, - 73, + 62, ], "type": "ClassBody", }, @@ -11355,7 +13828,7 @@ Object { }, "range": Array [ 0, - 73, + 62, ], "superClass": null, "type": "ClassDeclaration", @@ -11373,7 +13846,7 @@ Object { }, "range": Array [ 0, - 74, + 63, ], "sourceType": "script", "tokens": Array [ @@ -11434,7 +13907,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { @@ -11444,43 +13917,79 @@ Object { }, "range": Array [ 12, - 21, + 23, ], - "type": "Keyword", - "value": "protected", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 2, }, "start": Object { - "column": 12, + "column": 13, "line": 2, }, }, "range": Array [ - 22, - 33, + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Identifier", - "value": "constructor", + "value": "T", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 2, }, "start": Object { - "column": 23, + "column": 15, "line": 2, }, }, "range": Array [ - 33, - 34, + 25, + 26, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -11488,17 +13997,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 2, }, "start": Object { - "column": 24, + "column": 17, "line": 2, }, }, "range": Array [ - 34, - 35, + 27, + 28, ], "type": "Punctuator", "value": ")", @@ -11506,17 +14015,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 20, "line": 2, }, "start": Object { - "column": 26, + "column": 19, "line": 2, }, }, "range": Array [ - 36, - 37, + 29, + 30, ], "type": "Punctuator", "value": "{", @@ -11524,17 +14033,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 2, }, "start": Object { - "column": 28, + "column": 21, "line": 2, }, }, "range": Array [ - 38, - 39, + 31, + 32, ], "type": "Punctuator", "value": "}", @@ -11542,7 +14051,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 4, }, "start": Object { @@ -11551,20 +14060,38 @@ Object { }, }, "range": Array [ - 43, - 49, + 36, + 37, ], - "type": "Keyword", - "value": "public", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 4, }, "start": Object { - "column": 9, + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 37, + 50, + ], + "type": "String", + "value": "'constructor'", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, "line": 4, }, }, @@ -11573,58 +14100,76 @@ Object { 51, ], "type": "Punctuator", - "value": "[", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 18, "line": 4, }, "start": Object { - "column": 10, + "column": 17, "line": 4, }, }, "range": Array [ 51, - 64, + 52, ], - "type": "String", - "value": "'constructor'", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 19, "line": 4, }, "start": Object { - "column": 23, + "column": 18, "line": 4, }, }, "range": Array [ - 64, - 65, + 52, + 53, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "]", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 4, }, "start": Object { - "column": 24, + "column": 20, "line": 4, }, }, "range": Array [ - 65, - 66, + 54, + 55, ], "type": "Punctuator", "value": "(", @@ -11632,17 +14177,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 4, }, "start": Object { - "column": 25, + "column": 21, "line": 4, }, }, "range": Array [ - 66, - 67, + 55, + 56, ], "type": "Punctuator", "value": ")", @@ -11650,17 +14195,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 24, "line": 4, }, "start": Object { - "column": 27, + "column": 23, "line": 4, }, }, "range": Array [ - 68, - 69, + 57, + 58, ], "type": "Punctuator", "value": "{", @@ -11668,17 +14213,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 26, "line": 4, }, "start": Object { - "column": 29, + "column": 25, "line": 4, }, }, "range": Array [ - 70, - 71, + 59, + 60, ], "type": "Punctuator", "value": "}", @@ -11695,8 +14240,8 @@ Object { }, }, "range": Array [ - 72, - 73, + 61, + 62, ], "type": "Punctuator", "value": "}", @@ -11706,7 +14251,7 @@ Object { } `; -exports[`typescript fixtures/basics/class-with-constructor-and-return-type.src 1`] = ` +exports[`typescript fixtures/basics/class-with-declare-properties.src 1`] = ` Object { "body": Array [ Object { @@ -11714,28 +14259,28 @@ Object { "body": Array [ Object { "computed": false, + "declare": true, "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 2, }, "start": Object { - "column": 2, + "column": 10, "line": 2, }, }, - "name": "constructor", + "name": "prop1", "range": Array [ - 12, - 23, + 28, + 33, ], "type": "Identifier", }, - "kind": "constructor", "loc": Object { "end": Object { - "column": 27, + "column": 24, "line": 2, }, "start": Object { @@ -11744,108 +14289,142 @@ Object { }, }, "range": Array [ - 12, - 37, + 20, + 42, ], "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 27, + "column": 23, "line": 2, }, "start": Object { - "column": 24, + "column": 17, "line": 2, }, }, "range": Array [ - 34, - 37, + 35, + 41, ], - "type": "BlockStatement", + "type": "TSStringKeyword", }, - "expression": false, - "generator": false, - "id": null, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 22, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 17, + "line": 3, }, }, - "params": Array [], + "name": "prop2", "range": Array [ - 23, - 37, + 60, + 65, ], - "returnType": Object { + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 45, + 74, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 30, + "line": 3, }, "start": Object { - "column": 15, - "line": 2, + "column": 24, + "line": 3, }, }, "range": Array [ - 25, - 33, + 67, + 73, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 27, - 33, - ], - "type": "TSNumberKeyword", - }, + "type": "TSStringKeyword", }, - "type": "FunctionExpression", }, + "value": null, }, Object { - "computed": true, + "computed": false, + "declare": true, "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 22, "line": 4, }, "start": Object { - "column": 3, + "column": 17, "line": 4, }, }, + "name": "prop3", "range": Array [ - 42, - 55, + 92, + 97, ], - "raw": "'constructor'", - "type": "Literal", - "value": "constructor", + "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { "column": 31, @@ -11857,107 +14436,366 @@ Object { }, }, "range": Array [ - 41, - 70, + 77, + 106, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 97, + 105, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 4, }, "start": Object { - "column": 28, + "column": 24, "line": 4, }, }, "range": Array [ - 67, - 70, + 99, + 105, ], - "type": "BlockStatement", + "type": "TSStringKeyword", }, - "expression": false, - "generator": false, - "id": null, + }, + "value": null, + }, + Object { + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "prop3", + "range": Array [ + 126, + 131, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 109, + 140, + ], + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 131, + 139, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 133, + 139, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { "loc": Object { "end": Object { "column": 31, - "line": 4, + "line": 6, }, "start": Object { - "column": 17, - "line": 4, + "column": 26, + "line": 6, + }, + }, + "name": "prop4", + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 143, + 181, + ], + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 172, + 180, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 174, + 180, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "name": "prop5", + "range": Array [ + 206, + 211, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 184, + 220, + ], + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 211, + 219, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 31, + "line": 7, + }, + }, + "range": Array [ + 213, + 219, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 8, + }, + "start": Object { + "column": 33, + "line": 8, + }, + }, + "name": "prop6", + "range": Array [ + 254, + 259, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 223, + 268, + ], + "readonly": true, + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 38, + "line": 8, }, }, - "params": Array [], "range": Array [ - 56, - 70, + 259, + 267, ], - "returnType": Object { + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 27, - "line": 4, + "column": 46, + "line": 8, }, "start": Object { - "column": 19, - "line": 4, + "column": 40, + "line": 8, }, }, "range": Array [ - 58, - 66, + 261, + 267, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "range": Array [ - 60, - 66, - ], - "type": "TSNumberKeyword", - }, + "type": "TSStringKeyword", }, - "type": "FunctionExpression", }, + "value": null, }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 9, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 72, + 16, + 270, ], "type": "ClassBody", }, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { @@ -11965,17 +14803,17 @@ Object { "line": 1, }, }, - "name": "C", + "name": "DeclProps", "range": Array [ 6, - 7, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 9, }, "start": Object { "column": 0, @@ -11984,7 +14822,7 @@ Object { }, "range": Array [ 0, - 72, + 270, ], "superClass": null, "type": "ClassDeclaration", @@ -11993,7 +14831,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 10, }, "start": Object { "column": 0, @@ -12002,7 +14840,7 @@ Object { }, "range": Array [ 0, - 73, + 271, ], "sourceType": "script", "tokens": Array [ @@ -12027,7 +14865,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { @@ -12037,25 +14875,25 @@ Object { }, "range": Array [ 6, - 7, + 15, ], "type": "Identifier", - "value": "C", + "value": "DeclProps", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 9, + 16, + 17, ], "type": "Punctuator", "value": "{", @@ -12063,7 +14901,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 2, }, "start": Object { @@ -12072,263 +14910,281 @@ Object { }, }, "range": Array [ - 12, - 23, + 20, + 27, ], "type": "Identifier", - "value": "constructor", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { - "column": 13, + "column": 10, "line": 2, }, }, "range": Array [ - 23, - 24, + 28, + 33, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "prop1", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 2, }, "start": Object { - "column": 14, + "column": 15, "line": 2, }, }, "range": Array [ - 24, - 25, + 33, + 34, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 2, }, "start": Object { - "column": 15, + "column": 17, "line": 2, }, }, "range": Array [ - 25, - 26, + 35, + 41, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 2, }, "start": Object { - "column": 17, + "column": 23, "line": 2, }, }, "range": Array [ - 27, - 33, + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 45, + 52, ], "type": "Identifier", - "value": "number", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 24, - "line": 2, + "column": 10, + "line": 3, }, }, "range": Array [ - 34, - 35, + 53, + 59, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 22, + "line": 3, }, "start": Object { - "column": 26, - "line": 2, + "column": 17, + "line": 3, }, }, "range": Array [ - 36, - 37, + 60, + 65, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "prop2", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 23, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 22, + "line": 3, }, }, "range": Array [ - 41, - 42, + 65, + 66, ], "type": "Punctuator", - "value": "[", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 30, + "line": 3, }, "start": Object { - "column": 3, - "line": 4, + "column": 24, + "line": 3, }, }, "range": Array [ - 42, - 55, + 67, + 73, ], - "type": "String", - "value": "'constructor'", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 31, + "line": 3, }, "start": Object { - "column": 16, - "line": 4, + "column": 30, + "line": 3, }, }, "range": Array [ - 55, - 56, + 73, + 74, ], "type": "Punctuator", - "value": "]", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 4, }, "start": Object { - "column": 17, + "column": 2, "line": 4, }, }, "range": Array [ - 56, - 57, + 77, + 84, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 4, }, "start": Object { - "column": 18, + "column": 10, "line": 4, }, }, "range": Array [ - 57, - 58, + 85, + 91, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 4, }, "start": Object { - "column": 19, + "column": 17, "line": 4, }, }, "range": Array [ - 58, - 59, + 92, + 97, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "prop3", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 23, "line": 4, }, "start": Object { - "column": 21, + "column": 22, "line": 4, }, }, "range": Array [ - 60, - 66, + 97, + 98, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 4, }, "start": Object { - "column": 28, + "column": 24, "line": 4, }, }, "range": Array [ - 67, - 68, + 99, + 105, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { @@ -12342,767 +15198,530 @@ Object { }, }, "range": Array [ - 69, - 70, + 105, + 106, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 9, "line": 5, }, "start": Object { - "column": 0, + "column": 2, "line": 5, }, }, "range": Array [ - 71, - 72, + 109, + 116, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "declare", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-constructor-and-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 12, - 23, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 12, - 32, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 29, - 32, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 23, - 32, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - "range": Array [ - 24, - 25, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 23, - 26, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 4, - }, - "start": Object { - "column": 3, - "line": 4, - }, - }, - "range": Array [ - 37, - 50, - ], - "raw": "'constructor'", - "type": "Literal", - "value": "constructor", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 36, - 60, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 23, - "line": 4, - }, - }, - "range": Array [ - 57, - 60, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 26, - "line": 4, - }, - "start": Object { - "column": 17, - "line": 4, - }, - }, - "params": Array [], - "range": Array [ - 51, - 60, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 17, - "line": 4, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "T", - "range": Array [ - 52, - 53, - ], - "type": "Identifier", - }, - "range": Array [ - 52, - 53, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 51, - 54, - ], - "type": "TSTypeParameterDeclaration", - }, - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, }, - "range": Array [ - 8, - 62, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 10, + "line": 5, }, - "name": "C", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, + "range": Array [ + 117, + 125, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 24, "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 19, + "line": 5, }, }, "range": Array [ - 0, - 62, + 126, + 131, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "prop3", }, - }, - "range": Array [ - 0, - 63, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 25, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 24, + "line": 5, }, }, "range": Array [ - 0, - 5, + 131, + 132, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 32, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 26, + "line": 5, }, }, "range": Array [ - 6, - 7, + 133, + 139, ], "type": "Identifier", - "value": "C", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 33, + "line": 5, }, "start": Object { - "column": 8, - "line": 1, + "column": 32, + "line": 5, }, }, "range": Array [ - 8, - 9, + 139, + 140, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 9, + "line": 6, }, "start": Object { "column": 2, - "line": 2, + "line": 6, }, }, "range": Array [ - 12, - 23, + 143, + 150, ], "type": "Identifier", - "value": "constructor", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 16, + "line": 6, }, "start": Object { - "column": 13, - "line": 2, + "column": 10, + "line": 6, }, }, "range": Array [ - 23, - 24, + 151, + 157, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 25, + "line": 6, }, "start": Object { - "column": 14, - "line": 2, + "column": 17, + "line": 6, }, }, "range": Array [ - 24, - 25, + 158, + 166, ], "type": "Identifier", - "value": "T", + "value": "readonly", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 31, + "line": 6, }, "start": Object { - "column": 15, - "line": 2, + "column": 26, + "line": 6, }, }, "range": Array [ - 25, - 26, + 167, + 172, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "prop4", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 32, + "line": 6, }, "start": Object { - "column": 16, - "line": 2, + "column": 31, + "line": 6, }, }, "range": Array [ - 26, - 27, + 172, + 173, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 39, + "line": 6, }, "start": Object { - "column": 17, - "line": 2, + "column": 33, + "line": 6, }, }, "range": Array [ - 27, - 28, + 174, + 180, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 40, + "line": 6, }, "start": Object { - "column": 19, - "line": 2, + "column": 39, + "line": 6, }, }, "range": Array [ - 29, - 30, + 180, + 181, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 9, + "line": 7, }, "start": Object { - "column": 21, - "line": 2, + "column": 2, + "line": 7, }, }, "range": Array [ - 31, - 32, + 184, + 191, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 16, + "line": 7, }, "start": Object { - "column": 2, - "line": 4, + "column": 10, + "line": 7, }, }, "range": Array [ - 36, - 37, + 192, + 198, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 23, + "line": 7, }, "start": Object { - "column": 3, - "line": 4, + "column": 17, + "line": 7, }, }, "range": Array [ - 37, - 50, + 199, + 205, ], - "type": "String", - "value": "'constructor'", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 4, + "column": 29, + "line": 7, }, "start": Object { - "column": 16, - "line": 4, + "column": 24, + "line": 7, }, }, "range": Array [ - 50, - 51, + 206, + 211, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "prop5", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 30, + "line": 7, }, "start": Object { - "column": 17, - "line": 4, + "column": 29, + "line": 7, }, }, "range": Array [ - 51, - 52, + 211, + 212, ], "type": "Punctuator", - "value": "<", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 37, + "line": 7, }, "start": Object { - "column": 18, - "line": 4, + "column": 31, + "line": 7, }, }, "range": Array [ - 52, - 53, + 213, + 219, ], "type": "Identifier", - "value": "T", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 4, + "column": 38, + "line": 7, }, "start": Object { - "column": 19, - "line": 4, + "column": 37, + "line": 7, }, }, "range": Array [ - 53, - 54, + 219, + 220, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 9, + "line": 8, }, "start": Object { - "column": 20, - "line": 4, + "column": 2, + "line": 8, }, }, "range": Array [ - 54, - 55, + 223, + 230, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 16, + "line": 8, }, "start": Object { - "column": 21, - "line": 4, + "column": 10, + "line": 8, }, }, "range": Array [ - 55, - 56, + 231, + 237, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "range": Array [ + 238, + 244, + ], + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { + "column": 32, + "line": 8, + }, + "start": Object { "column": 24, - "line": 4, + "line": 8, + }, + }, + "range": Array [ + 245, + 253, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 8, }, "start": Object { - "column": 23, - "line": 4, + "column": 33, + "line": 8, }, }, "range": Array [ - 57, - 58, + 254, + 259, + ], + "type": "Identifier", + "value": "prop6", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 8, + }, + "start": Object { + "column": 38, + "line": 8, + }, + }, + "range": Array [ + 259, + 260, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 46, + "line": 8, }, "start": Object { - "column": 25, - "line": 4, + "column": 40, + "line": 8, }, }, "range": Array [ - 59, - 60, + 261, + 267, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 8, + }, + "start": Object { + "column": 46, + "line": 8, + }, + }, + "range": Array [ + 267, + 268, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 9, }, "start": Object { "column": 0, - "line": 5, + "line": 9, }, }, "range": Array [ - 61, - 62, + 269, + 270, ], "type": "Punctuator", "value": "}", @@ -13120,6 +15739,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "definite": true, "key": Object { "loc": Object { @@ -20795,6 +23415,7 @@ Object { Object { "accessibility": "private", "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22063,6 +24684,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22102,6 +24724,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22176,6 +24799,7 @@ Object { Object { "accessibility": "private", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22249,6 +24873,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22288,6 +24913,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22328,6 +24954,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22368,6 +24995,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22441,6 +25069,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -22515,6 +25144,7 @@ Object { }, Object { "computed": true, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -23822,6 +26452,7 @@ Object { Object { "accessibility": "private", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -25263,6 +27894,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -25444,6 +28076,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -26121,6 +28754,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -26177,6 +28811,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -26232,6 +28867,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -26287,6 +28923,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -26343,6 +28980,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -30201,6 +32839,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -66262,6 +68901,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -80914,6 +83554,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -83434,6 +86075,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -86347,6 +88989,7 @@ Object { }, Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -89936,6 +92579,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { @@ -108673,6 +111317,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -108767,6 +111412,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -109354,6 +112000,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -109468,6 +112115,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110022,6 +112670,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110097,6 +112746,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110468,6 +113118,7 @@ Object { "body": Array [ Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -110543,6 +113194,7 @@ Object { }, Object { "computed": false, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -145963,6 +148615,7 @@ Object { Object { "accessibility": "public", "computed": false, + "declare": false, "key": Object { "loc": Object { "end": Object { From 5ae286ec03b8c3d4911076756a7c33e7560a751a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 25 Oct 2019 14:36:10 -0700 Subject: [PATCH 25/47] fix(typescript-estree): correct parenthesized optional chain AST (#1141) - Also fixes the package not working in the browser: - ts.sys undefined in the browser - process is undefined in the browser - Whitelist 3.7.1-rc --- .../lib/__snapshots__/typescript.ts.snap | 1687 +++- .../optional-chain-call-with-parens.src.ts | 13 + .../basics/optional-chain-call.src.ts | 1 + ...al-chain-element-access-with-parens.src.ts | 8 + .../basics/optional-chain-with-parens.src.ts | 8 + packages/typescript-estree/src/convert.ts | 51 +- .../src/create-program/shared.ts | 5 +- packages/typescript-estree/src/parser.ts | 42 +- .../tests/ast-alignment/fixtures-to-test.ts | 3 + .../semantic-diagnostics-enabled.ts.snap | 6 + .../lib/__snapshots__/typescript.ts.snap | 8965 +++++++++++++++-- 11 files changed, 9915 insertions(+), 874 deletions(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 847709697616..3d94d81e424b 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -22572,31 +22572,31 @@ Object { exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` Object { - "$id": 22, + "$id": 23, "block": Object { "range": Array [ 0, - 181, + 194, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 21, + "$id": 22, "block": Object { "range": Array [ 0, - 181, + 194, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 20, + "$id": 21, "block": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -22607,7 +22607,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22626,7 +22626,7 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22643,7 +22643,7 @@ Object { Object { "$id": 5, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22662,7 +22662,7 @@ Object { Object { "$id": 6, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "two", @@ -22679,7 +22679,7 @@ Object { Object { "$id": 7, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22696,7 +22696,7 @@ Object { Object { "$id": 8, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22715,7 +22715,7 @@ Object { Object { "$id": 9, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22732,7 +22732,7 @@ Object { Object { "$id": 10, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22751,7 +22751,7 @@ Object { Object { "$id": 11, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "three", @@ -22768,7 +22768,7 @@ Object { Object { "$id": 12, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22785,7 +22785,7 @@ Object { Object { "$id": 13, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22804,7 +22804,7 @@ Object { Object { "$id": 14, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "three", @@ -22821,7 +22821,7 @@ Object { Object { "$id": 15, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "fn", @@ -22838,7 +22838,7 @@ Object { Object { "$id": 16, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22857,7 +22857,7 @@ Object { Object { "$id": 17, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", @@ -22876,13 +22876,13 @@ Object { Object { "$id": 18, "from": Object { - "$ref": 20, + "$ref": 21, }, "identifier": Object { "name": "one", "range": Array [ + 163, 166, - 169, ], "type": "Identifier", }, @@ -22895,13 +22895,32 @@ Object { Object { "$id": 19, "from": Object { - "$ref": 20, + "$ref": 21, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 20, + "from": Object { + "$ref": 21, }, "identifier": Object { "name": "two", "range": Array [ - 174, - 177, + 187, + 190, ], "type": "Identifier", }, @@ -22936,12 +22955,12 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "function", "upperScope": Object { - "$ref": 21, + "$ref": 22, }, "variableMap": Object { "arguments": Object { @@ -22952,7 +22971,7 @@ Object { }, }, "variableScope": Object { - "$ref": 20, + "$ref": 21, }, "variables": Array [ Object { @@ -22963,7 +22982,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 20, + "$ref": 21, }, }, Object { @@ -22981,7 +23000,7 @@ Object { "node": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -23026,9 +23045,12 @@ Object { Object { "$ref": 18, }, + Object { + "$ref": 19, + }, ], "scope": Object { - "$ref": 20, + "$ref": 21, }, }, ], @@ -23063,12 +23085,12 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "module", "upperScope": Object { - "$ref": 22, + "$ref": 23, }, "variableMap": Object { "processOptionalCall": Object { @@ -23076,7 +23098,7 @@ Object { }, }, "variableScope": Object { - "$ref": 21, + "$ref": 22, }, "variables": Array [ Object { @@ -23094,7 +23116,7 @@ Object { "node": Object { "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -23116,7 +23138,7 @@ Object { "name": "processOptionalCall", "references": Array [], "scope": Object { - "$ref": 21, + "$ref": 22, }, }, ], @@ -23151,46 +23173,46 @@ Object { "$ref": 15, }, Object { - "$ref": 19, + "$ref": 20, }, ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 22, + "$ref": 23, }, "variables": Array [], } `; -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` Object { - "$id": 11, + "$id": 20, "block": Object { "range": Array [ 0, - 142, + 218, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 10, + "$id": 19, "block": Object { "range": Array [ 0, - 142, + 218, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 9, + "$id": 18, "block": Object { "range": Array [ 0, - 141, + 217, ], "type": "FunctionDeclaration", }, @@ -23201,13 +23223,13 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 9, + "$ref": 18, }, "identifier": Object { "name": "one", "range": Array [ - 47, - 50, + 51, + 54, ], "type": "Identifier", }, @@ -23220,32 +23242,30 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 9, + "$ref": 18, }, "identifier": Object { - "name": "one", + "name": "fn", "range": Array [ - 59, - 62, + 56, + 58, ], "type": "Identifier", }, "kind": "r", - "resolved": Object { - "$ref": 2, - }, + "resolved": null, "writeExpr": undefined, }, Object { "$id": 5, "from": Object { - "$ref": 9, + "$ref": 18, }, "identifier": Object { "name": "one", "range": Array [ - 74, - 77, + 66, + 69, ], "type": "Identifier", }, @@ -23258,13 +23278,30 @@ Object { Object { "$id": 6, "from": Object { - "$ref": 9, + "$ref": 18, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 18, }, "identifier": Object { "name": "one", "range": Array [ - 89, - 92, + 85, + 88, ], "type": "Identifier", }, @@ -23275,9 +23312,26 @@ Object { "writeExpr": undefined, }, Object { - "$id": 7, + "$id": 8, "from": Object { - "$ref": 9, + "$ref": 18, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 18, }, "identifier": Object { "name": "one", @@ -23294,15 +23348,32 @@ Object { "writeExpr": undefined, }, Object { - "$id": 8, + "$id": 10, "from": Object { - "$ref": 9, + "$ref": 18, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 18, }, "identifier": Object { "name": "one", "range": Array [ - 122, - 125, + 129, + 132, ], "type": "Identifier", }, @@ -23312,92 +23383,1368 @@ Object { }, "writeExpr": undefined, }, - ], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 10, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 1, + Object { + "$id": 12, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - "one": Object { - "$ref": 2, + Object { + "$id": 13, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "fn", + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, }, - }, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 9, + "$id": 14, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, }, + "writeExpr": undefined, }, Object { - "$id": 2, - "defs": Array [ - Object { - "name": Object { - "name": "one", - "range": Array [ - 32, - 41, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 141, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "one", - "range": Array [ - 32, - 41, - ], - "type": "Identifier", - }, - ], - "name": "one", + "$id": 15, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 17, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + Object { + "$ref": 11, + }, + Object { + "$ref": 14, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + Object { + "$ref": 17, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 20, + }, + "variableMap": Object { + "processOptionalCallParens": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalCallParens", + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalCallParens", + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalCallParens", + "references": Array [], + "scope": Object { + "$ref": 19, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 20, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 142, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 142, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "processOptionalElement": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalElement", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 168, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 168, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + }, + ], + "name": "one", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "processOptionalElementParens": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalElementParens", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`typescript fixtures/basics/optional-chain-with-parens.src 1`] = ` +Object { + "$id": 19, + "block": Object { + "range": Array [ + 0, + 182, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 182, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 17, + "block": Object { + "range": Array [ + 0, + 181, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "two", + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 90, + 95, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 110, + 115, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 135, + 140, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "four", + "range": Array [ + 142, + 146, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "one", + "range": Array [ + 152, + 155, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 15, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "three", + "range": Array [ + 161, + 166, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "four", + "range": Array [ + 168, + 172, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "one": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 17, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "one", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 181, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "one", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + ], + "name": "one", "references": Array [ Object { "$ref": 3, }, Object { - "$ref": 4, + "$ref": 5, }, Object { - "$ref": 5, + "$ref": 7, }, Object { - "$ref": 6, + "$ref": 9, }, Object { - "$ref": 7, + "$ref": 11, }, Object { - "$ref": 8, + "$ref": 14, }, ], "scope": Object { - "$ref": 9, + "$ref": 17, }, }, ], @@ -23406,18 +24753,43 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + ], "type": "module", "upperScope": Object { - "$ref": 11, + "$ref": 19, }, "variableMap": Object { - "processOptionalElement": Object { + "processOptionalParens": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 10, + "$ref": 18, }, "variables": Array [ Object { @@ -23425,17 +24797,17 @@ Object { "defs": Array [ Object { "name": Object { - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, "node": Object { "range": Array [ 0, - 141, + 181, ], "type": "FunctionDeclaration", }, @@ -23446,18 +24818,18 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, ], - "name": "processOptionalElement", + "name": "processOptionalParens", "references": Array [], "scope": Object { - "$ref": 10, + "$ref": 18, }, }, ], @@ -23466,12 +24838,37 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + Object { + "$ref": 12, + }, + Object { + "$ref": 13, + }, + Object { + "$ref": 15, + }, + Object { + "$ref": 16, + }, + ], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 11, + "$ref": 19, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts new file mode 100644 index 000000000000..4024fffa9d58 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call-with-parens.src.ts @@ -0,0 +1,13 @@ +function processOptionalCallParens(one?: any) { + (one?.fn()); + (one?.two).fn(); + (one.two?.fn()); + (one.two?.three).fn(); + (one.two?.three?.fn()); + + (one?.()); + (one?.())(); + (one?.())?.(); + + (one?.()).two; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts index 7de9343489eb..c411490d129b 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-call.src.ts @@ -6,6 +6,7 @@ function processOptionalCall(one?: any) { one.two?.three?.fn(); one?.(); + one?.()(); one?.()?.(); one?.().two; diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts new file mode 100644 index 000000000000..a4a30b2d5df6 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-element-access-with-parens.src.ts @@ -0,0 +1,8 @@ +function processOptionalElementParens(one?: any) { + (one?.[2]); + (one?.[2])[3]; + (one[2]?.[3]); + (one[2]?.[3])[4]; + (one[2]?.[3]?.[4]); + (one[2]?.[3]?.[4])[5]; +} diff --git a/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts new file mode 100644 index 000000000000..69c9e8efee51 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/optional-chain-with-parens.src.ts @@ -0,0 +1,8 @@ +function processOptionalParens(one?: any) { + (one?.two); + (one?.two).three; + (one.two?.three); + (one.two?.three).four; + (one.two?.three?.four); + (one.two?.three?.four).five; +} diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 8ffbc03b3ce8..67ca0be79b89 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1691,16 +1691,19 @@ export class Converter { } case SyntaxKind.PropertyAccessExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const object = this.convertChild(node.expression); const property = this.convertChild(node.name); const computed = false; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - object.type === AST_NODE_TYPES.OptionalMemberExpression || - object.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { return this.createNode(node, { type: AST_NODE_TYPES.OptionalMemberExpression, object, @@ -1720,16 +1723,19 @@ export class Converter { } case SyntaxKind.ElementAccessExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const object = this.convertChild(node.expression); const property = this.convertChild(node.argumentExpression); const computed = true; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - object.type === AST_NODE_TYPES.OptionalMemberExpression || - object.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (object.type === AST_NODE_TYPES.OptionalMemberExpression || + object.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { return this.createNode(node, { type: AST_NODE_TYPES.OptionalMemberExpression, object, @@ -1749,16 +1755,19 @@ export class Converter { } case SyntaxKind.CallExpression: { - const isLocallyOptional = node.questionDotToken !== undefined; const callee = this.convertChild(node.expression); const args = node.arguments.map(el => this.convertChild(el)); let result; - if ( - isLocallyOptional || - // the optional expression should propogate up the member expression tree - callee.type === AST_NODE_TYPES.OptionalMemberExpression || - callee.type === AST_NODE_TYPES.OptionalCallExpression - ) { + + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propogate up the member expression tree + const isChildOptional = + (callee.type === AST_NODE_TYPES.OptionalMemberExpression || + callee.type === AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z() is semantically different, and as such .z() is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + + if (isLocallyOptional || isChildOptional) { result = this.createNode(node, { type: AST_NODE_TYPES.OptionalCallExpression, callee, diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index ac2dc3d5e62e..c210ddee43ee 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -20,7 +20,10 @@ const DEFAULT_COMPILER_OPTIONS: ts.CompilerOptions = { // This narrows the type so we can be sure we're passing canonical names in the correct places type CanonicalPath = string & { __brand: unknown }; -const getCanonicalFileName = ts.sys.useCaseSensitiveFileNames +// typescript doesn't provide a ts.sys implementation for browser environments +const useCaseSensitiveFileNames = + ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true; +const getCanonicalFileName = useCaseSensitiveFileNames ? (filePath: string): CanonicalPath => path.normalize(filePath) as CanonicalPath : (filePath: string): CanonicalPath => diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 7ee2cdacbc3e..141ba25cce6a 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -16,11 +16,18 @@ import { TSESTree } from './ts-estree'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0 || >3.7.0-dev.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.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 + */ +const SUPPORTED_PRERELEASE_RANGES = ['>3.7.0-dev.0', '3.7.1-rc']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, - SUPPORTED_TYPESCRIPT_VERSIONS, + [SUPPORTED_TYPESCRIPT_VERSIONS] + .concat(SUPPORTED_PRERELEASE_RANGES) + .join(' || '), ); let extra: Extra; @@ -224,22 +231,21 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { } function warnAboutTSVersion(): void { - if ( - !isRunningSupportedTypeScriptVersion && - !warnedAboutTSVersion && - process.stdout.isTTY - ) { - const border = '============='; - const versionWarning = [ - border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', - 'You may find that it works just fine, or you may not.', - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - 'Please only submit bug reports when using the officially supported version.', - border, - ]; - extra.log(versionWarning.join('\n\n')); + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { + const isTTY = typeof process === undefined ? false : process.stdout.isTTY; + if (isTTY) { + const border = '============='; + const versionWarning = [ + border, + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', + 'You may find that it works just fine, or you may not.', + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + 'Please only submit bug reports when using the officially supported version.', + border, + ]; + extra.log(versionWarning.join('\n\n')); + } warnedAboutTSVersion = true; } } 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 4c7276573ff8..557ac0c11ce5 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -583,8 +583,11 @@ tester.addFixturePatternConfig('typescript/basics', { */ // optional chaining 'optional-chain', + 'optional-chain-with-parens', 'optional-chain-call', + 'optional-chain-call-with-parens', 'optional-chain-element-access', + 'optional-chain-element-access-with-parens', 'async-function-expression', 'class-with-accessibility-modifiers', 'class-with-mixin', diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index 423d0c5bc652..7454835c3ae1 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -1922,8 +1922,14 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-call-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-element-access-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/optional-chain-with-parens.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/parenthesized-use-strict.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/readonly-arrays.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 6437b88068c8..14b0a341b7a9 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -73712,7 +73712,7 @@ Object { }, "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 9, }, "start": Object { @@ -73720,16 +73720,16 @@ Object { "line": 9, }, }, - "optional": true, + "optional": false, "range": Array [ 150, - 161, + 159, ], "type": "OptionalCallExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 9, }, "start": Object { @@ -73739,7 +73739,80 @@ Object { }, "range": Array [ 150, - 162, + 160, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "name": "one", + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 170, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 174, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 163, + 175, ], "type": "ExpressionStatement", }, @@ -73749,11 +73822,11 @@ Object { "loc": Object { "end": Object { "column": 13, - "line": 11, + "line": 12, }, "start": Object { "column": 2, - "line": 11, + "line": 12, }, }, "object": Object { @@ -73762,34 +73835,34 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 11, + "line": 12, }, "start": Object { "column": 2, - "line": 11, + "line": 12, }, }, "name": "one", "range": Array [ - 166, - 169, + 179, + 182, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 9, - "line": 11, + "line": 12, }, "start": Object { "column": 2, - "line": 11, + "line": 12, }, }, "optional": true, "range": Array [ - 166, - 173, + 179, + 186, ], "type": "OptionalCallExpression", }, @@ -73798,39 +73871,39 @@ Object { "loc": Object { "end": Object { "column": 13, - "line": 11, + "line": 12, }, "start": Object { "column": 10, - "line": 11, + "line": 12, }, }, "name": "two", "range": Array [ - 174, - 177, + 187, + 190, ], "type": "Identifier", }, "range": Array [ - 166, - 177, + 179, + 190, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { "column": 14, - "line": 11, + "line": 12, }, "start": Object { "column": 2, - "line": 11, + "line": 12, }, }, "range": Array [ - 166, - 178, + 179, + 191, ], "type": "ExpressionStatement", }, @@ -73838,7 +73911,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 13, }, "start": Object { "column": 40, @@ -73847,7 +73920,7 @@ Object { }, "range": Array [ 40, - 180, + 193, ], "type": "BlockStatement", }, @@ -73874,7 +73947,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 13, }, "start": Object { "column": 0, @@ -73938,7 +74011,7 @@ Object { ], "range": Array [ 0, - 180, + 193, ], "type": "FunctionDeclaration", }, @@ -73946,7 +74019,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 13, + "line": 14, }, "start": Object { "column": 0, @@ -73955,7 +74028,7 @@ Object { }, "range": Array [ 0, - 181, + 194, ], "sourceType": "script", "tokens": Array [ @@ -75042,7 +75115,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 9, }, "start": Object { @@ -75052,25 +75125,7 @@ Object { }, "range": Array [ 157, - 159, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 9, - }, - "start": Object { - "column": 11, - "line": 9, - }, - }, - "range": Array [ - 159, - 160, + 158, ], "type": "Punctuator", "value": "(", @@ -75078,17 +75133,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 9, }, "start": Object { - "column": 12, + "column": 10, "line": 9, }, }, "range": Array [ - 160, - 161, + 158, + 159, ], "type": "Punctuator", "value": ")", @@ -75096,17 +75151,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 9, }, "start": Object { - "column": 13, + "column": 11, "line": 9, }, }, "range": Array [ - 161, - 162, + 159, + 160, ], "type": "Punctuator", "value": ";", @@ -75115,16 +75170,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 11, + "line": 10, }, "start": Object { "column": 2, - "line": 11, + "line": 10, }, }, "range": Array [ + 163, 166, - 169, ], "type": "Identifier", "value": "one", @@ -75133,16 +75188,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 11, + "line": 10, }, "start": Object { "column": 5, - "line": 11, + "line": 10, }, }, "range": Array [ - 169, - 171, + 166, + 168, ], "type": "Punctuator", "value": "?.", @@ -75151,16 +75206,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 10, }, "start": Object { "column": 7, - "line": 11, + "line": 10, }, }, "range": Array [ - 171, - 172, + 168, + 169, ], "type": "Punctuator", "value": "(", @@ -75169,16 +75224,16 @@ Object { "loc": Object { "end": Object { "column": 9, - "line": 11, + "line": 10, }, "start": Object { "column": 8, - "line": 11, + "line": 10, }, }, "range": Array [ - 172, - 173, + 169, + 170, ], "type": "Punctuator", "value": ")", @@ -75186,53 +75241,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 11, + "column": 11, + "line": 10, }, "start": Object { "column": 9, - "line": 11, + "line": 10, + }, + }, + "range": Array [ + 170, + 172, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, }, }, "range": Array [ + 172, 173, - 174, ], "type": "Punctuator", - "value": ".", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 11, + "line": 10, }, "start": Object { - "column": 10, - "line": 11, + "column": 12, + "line": 10, }, }, "range": Array [ + 173, 174, - 177, ], - "type": "Identifier", - "value": "two", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 11, + "line": 10, }, "start": Object { "column": 13, - "line": 11, + "line": 10, }, }, "range": Array [ - 177, - 178, + 174, + 175, ], "type": "Punctuator", "value": ";", @@ -75240,54 +75313,7579 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 12, }, "start": Object { - "column": 0, + "column": 2, "line": 12, }, }, "range": Array [ 179, - 180, + 182, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "one", }, - ], - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` -Object { - "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 5, + "line": 12, + }, + }, + "range": Array [ + 182, + 184, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 12, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 187, + 190, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "fn", + "range": Array [ + 56, + 58, + ], + "type": "Identifier", + }, + "range": Array [ + 51, + 58, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 51, + 60, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 62, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + }, + "range": Array [ + 66, + 74, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "fn", + "range": Array [ + 76, + 78, + ], + "type": "Identifier", + }, + "range": Array [ + 65, + 78, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 65, + 80, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 65, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "two", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "range": Array [ + 85, + 92, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "fn", + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + }, + "range": Array [ + 85, + 96, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 85, + 98, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 100, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + }, + "range": Array [ + 104, + 111, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "name": "three", + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + }, + "range": Array [ + 104, + 118, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "fn", + "range": Array [ + 120, + 122, + ], + "type": "Identifier", + }, + "range": Array [ + 103, + 122, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 103, + 124, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 103, + 125, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": "two", + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + }, + "range": Array [ + 129, + 136, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "three", + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + }, + "range": Array [ + 129, + 143, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "name": "fn", + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + }, + "range": Array [ + 129, + 147, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 129, + 149, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 128, + 151, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "name": "one", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 156, + 163, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 165, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "name": "one", + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 169, + 176, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 168, + 179, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 180, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "one", + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 184, + 191, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 183, + 196, + ], + "type": "OptionalCallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 197, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "object": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "name": "one", + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 202, + 209, + ], + "type": "OptionalCallExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "name": "two", + "range": Array [ + 211, + 214, + ], + "type": "Identifier", + }, + "range": Array [ + 201, + 214, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 201, + 215, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 217, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalCallParens", + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 217, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 218, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + "value": "processOptionalCallParens", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 54, + 56, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 69, + 71, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 76, + 78, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 92, + 94, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 111, + 113, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 119, + 120, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 120, + 122, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 136, + 138, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 143, + 145, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 159, + 161, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 172, + 174, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 184, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 187, + 189, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 189, + 190, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 10, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 192, + 194, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 194, + 195, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 205, + 207, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 209, + 210, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 211, + 214, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 47, + 55, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 59, + 67, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 59, + 70, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 74, + 80, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 74, + 85, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 89, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 89, + 100, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 101, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 104, + 110, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 104, + 115, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 104, + 118, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 119, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 139, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 141, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElement", + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 142, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processOptionalElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 62, + 64, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 110, + 112, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-element-access-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 54, + 62, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 68, + 76, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 67, + 80, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 85, + 91, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 85, + 96, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 98, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 102, + 108, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 102, + 113, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 101, + 117, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 101, + 118, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "OptionalMemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 121, + 140, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 148, + 149, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 144, + 150, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 144, + 155, + ], + "type": "OptionalMemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 144, + 160, + ], + "type": "OptionalMemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 162, + 163, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "range": Array [ + 143, + 164, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 143, + 165, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 167, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElementParens", + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 167, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 168, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + "value": "processOptionalElementParens", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 57, + 59, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 71, + 73, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 91, + 93, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 139, + 140, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 150, + 152, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 155, + 157, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/optional-chain-with-parens.src 1`] = ` +Object { + "body": Array [ Object { "async": false, "body": Object { "body": Array [ Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 2, }, "start": Object { - "column": 2, + "column": 3, "line": 2, }, }, @@ -75302,7 +82900,7 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { @@ -75310,13 +82908,12 @@ Object { "line": 2, }, }, + "name": "two", "range": Array [ - 53, - 54, + 52, + 55, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ 47, @@ -75326,7 +82923,7 @@ Object { }, "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { @@ -75335,17 +82932,17 @@ Object { }, }, "range": Array [ - 47, - 56, + 46, + 57, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 3, }, "start": Object { @@ -75354,32 +82951,32 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 3, }, "start": Object { - "column": 2, + "column": 3, "line": 3, }, }, "name": "one", "range": Array [ - 59, - 62, + 61, + 64, ], "type": "Identifier", }, @@ -75387,7 +82984,7 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 3, }, "start": Object { @@ -75395,17 +82992,16 @@ Object { "line": 3, }, }, + "name": "two", "range": Array [ - 65, 66, + 69, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 59, - 67, + 61, + 69, ], "type": "OptionalMemberExpression", }, @@ -75413,31 +83009,30 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 18, "line": 3, }, "start": Object { - "column": 11, + "column": 13, "line": 3, }, }, + "name": "three", "range": Array [ - 68, - 69, + 71, + 76, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 59, - 70, + 60, + 76, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 3, }, "start": Object { @@ -75446,51 +83041,51 @@ Object { }, }, "range": Array [ - 59, - 71, + 60, + 77, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 4, }, "start": Object { - "column": 2, + "column": 3, "line": 4, }, }, "name": "one", "range": Array [ - 74, - 77, + 81, + 84, ], "type": "Identifier", }, @@ -75498,25 +83093,24 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 4, }, "start": Object { - "column": 6, + "column": 7, "line": 4, }, }, + "name": "two", "range": Array [ - 78, - 79, - ], - "raw": "2", - "type": "Literal", - "value": 2, + 85, + 88, + ], + "type": "Identifier", }, "range": Array [ - 74, - 80, + 81, + 88, ], "type": "MemberExpression", }, @@ -75524,31 +83118,30 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 4, }, "start": Object { - "column": 11, + "column": 12, "line": 4, }, }, + "name": "three", "range": Array [ - 83, - 84, + 90, + 95, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 74, - 85, + 81, + 95, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 4, }, "start": Object { @@ -75557,17 +83150,17 @@ Object { }, }, "range": Array [ - 74, - 86, + 80, + 97, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 5, }, "start": Object { @@ -75576,90 +83169,125 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 5, }, "start": Object { - "column": 2, + "column": 3, "line": 5, }, }, - "name": "one", + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "range": Array [ + 105, + 108, + ], + "type": "Identifier", + }, "range": Array [ - 89, - 92, + 101, + 108, ], - "type": "Identifier", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 5, }, "start": Object { - "column": 6, + "column": 12, "line": 5, }, }, + "name": "three", "range": Array [ - 93, - 94, + 110, + 115, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 89, - 95, + 101, + 115, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 5, }, "start": Object { - "column": 11, + "column": 19, "line": 5, }, }, + "name": "four", "range": Array [ - 98, - 99, + 117, + 121, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 89, 100, + 121, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 5, }, "start": Object { @@ -75668,63 +83296,63 @@ Object { }, }, "range": Array [ - 89, - 101, + 100, + 122, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "object": Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 6, }, "start": Object { - "column": 2, + "column": 3, "line": 6, }, }, "name": "one", "range": Array [ - 104, - 107, + 126, + 129, ], "type": "Identifier", }, @@ -75732,25 +83360,24 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 6, }, "start": Object { - "column": 6, + "column": 7, "line": 6, }, }, + "name": "two", "range": Array [ - 108, - 109, + 130, + 133, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 104, - 110, + 126, + 133, ], "type": "MemberExpression", }, @@ -75758,57 +83385,55 @@ Object { "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 6, }, "start": Object { - "column": 11, + "column": 12, "line": 6, }, }, + "name": "three", "range": Array [ - 113, - 114, + 135, + 140, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 104, - 115, + 126, + 140, ], "type": "OptionalMemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 6, }, "start": Object { - "column": 14, + "column": 19, "line": 6, }, }, + "name": "four", "range": Array [ - 116, - 117, + 142, + 146, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", }, "range": Array [ - 104, - 118, + 126, + 146, ], "type": "OptionalMemberExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 6, }, "start": Object { @@ -75817,17 +83442,17 @@ Object { }, }, "range": Array [ - 104, - 119, + 125, + 148, ], "type": "ExpressionStatement", }, Object { "expression": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 7, }, "start": Object { @@ -75836,128 +83461,162 @@ Object { }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, "object": Object { - "computed": true, + "computed": false, "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, "object": Object { + "computed": false, "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 7, }, "start": Object { - "column": 2, + "column": 3, "line": 7, }, }, - "name": "one", + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "range": Array [ + 152, + 155, + ], + "type": "Identifier", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "two", + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + }, "range": Array [ - 122, - 125, + 152, + 159, ], - "type": "Identifier", + "type": "MemberExpression", }, - "optional": false, + "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 7, }, "start": Object { - "column": 6, + "column": 12, "line": 7, }, }, + "name": "three", "range": Array [ - 126, - 127, + 161, + 166, ], - "raw": "2", - "type": "Literal", - "value": 2, + "type": "Identifier", }, "range": Array [ - 122, - 128, + 152, + 166, ], - "type": "MemberExpression", + "type": "OptionalMemberExpression", }, "optional": true, "property": Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 7, }, "start": Object { - "column": 11, + "column": 19, "line": 7, }, }, + "name": "four", "range": Array [ - 131, - 132, + 168, + 172, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, "range": Array [ - 122, - 133, + 152, + 172, ], "type": "OptionalMemberExpression", }, - "optional": true, + "optional": false, "property": Object { "loc": Object { "end": Object { - "column": 17, + "column": 29, "line": 7, }, "start": Object { - "column": 16, + "column": 25, "line": 7, }, }, + "name": "five", "range": Array [ - 136, - 137, + 174, + 178, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", }, "range": Array [ - 122, - 138, + 151, + 178, ], - "type": "OptionalMemberExpression", + "type": "MemberExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 7, }, "start": Object { @@ -75966,8 +83625,8 @@ Object { }, }, "range": Array [ - 122, - 139, + 151, + 179, ], "type": "ExpressionStatement", }, @@ -75978,13 +83637,13 @@ Object { "line": 8, }, "start": Object { - "column": 43, + "column": 42, "line": 1, }, }, "range": Array [ - 43, - 141, + 42, + 181, ], "type": "BlockStatement", }, @@ -75993,7 +83652,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { @@ -76001,10 +83660,10 @@ Object { "line": 1, }, }, - "name": "processOptionalElement", + "name": "processOptionalParens", "range": Array [ 9, - 31, + 30, ], "type": "Identifier", }, @@ -76022,51 +83681,51 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 32, + "column": 31, "line": 1, }, }, "name": "one", "optional": true, "range": Array [ - 32, - 41, + 31, + 40, ], "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 36, + "column": 35, "line": 1, }, }, "range": Array [ - 36, - 41, + 35, + 40, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 38, + "column": 37, "line": 1, }, }, "range": Array [ - 38, - 41, + 37, + 40, ], "type": "TSAnyKeyword", }, @@ -76075,7 +83734,7 @@ Object { ], "range": Array [ 0, - 141, + 181, ], "type": "FunctionDeclaration", }, @@ -76092,7 +83751,7 @@ Object { }, "range": Array [ 0, - 142, + 182, ], "sourceType": "script", "tokens": Array [ @@ -76117,7 +83776,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 30, "line": 1, }, "start": Object { @@ -76127,25 +83786,25 @@ Object { }, "range": Array [ 9, - 31, + 30, ], "type": "Identifier", - "value": "processOptionalElement", + "value": "processOptionalParens", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 31, "line": 1, }, "start": Object { - "column": 31, + "column": 30, "line": 1, }, }, "range": Array [ + 30, 31, - 32, ], "type": "Punctuator", "value": "(", @@ -76153,17 +83812,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 34, "line": 1, }, "start": Object { - "column": 32, + "column": 31, "line": 1, }, }, "range": Array [ - 32, - 35, + 31, + 34, ], "type": "Identifier", "value": "one", @@ -76171,17 +83830,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 35, "line": 1, }, "start": Object { - "column": 35, + "column": 34, "line": 1, }, }, "range": Array [ + 34, 35, - 36, ], "type": "Punctuator", "value": "?", @@ -76189,17 +83848,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 36, "line": 1, }, "start": Object { - "column": 36, + "column": 35, "line": 1, }, }, "range": Array [ + 35, 36, - 37, ], "type": "Punctuator", "value": ":", @@ -76207,17 +83866,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 40, "line": 1, }, "start": Object { - "column": 38, + "column": 37, "line": 1, }, }, "range": Array [ - 38, - 41, + 37, + 40, ], "type": "Identifier", "value": "any", @@ -76225,17 +83884,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 41, "line": 1, }, "start": Object { - "column": 41, + "column": 40, "line": 1, }, }, "range": Array [ + 40, 41, - 42, ], "type": "Punctuator", "value": ")", @@ -76243,17 +83902,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 43, "line": 1, }, "start": Object { - "column": 43, + "column": 42, "line": 1, }, }, "range": Array [ + 42, 43, - 44, ], "type": "Punctuator", "value": "{", @@ -76261,7 +83920,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { @@ -76270,29 +83929,29 @@ Object { }, }, "range": Array [ + 46, 47, - 50, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 2, }, "start": Object { - "column": 5, + "column": 3, "line": 2, }, }, "range": Array [ + 47, 50, - 52, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -76301,21 +83960,21 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 6, "line": 2, }, }, "range": Array [ + 50, 52, - 53, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 2, }, "start": Object { @@ -76324,44 +83983,44 @@ Object { }, }, "range": Array [ - 53, - 54, + 52, + 55, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 2, }, "start": Object { - "column": 9, + "column": 11, "line": 2, }, }, "range": Array [ - 54, 55, + 56, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 2, }, "start": Object { - "column": 10, + "column": 12, "line": 2, }, }, "range": Array [ - 55, 56, + 57, ], "type": "Punctuator", "value": ";", @@ -76369,7 +84028,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 3, }, "start": Object { @@ -76378,83 +84037,47 @@ Object { }, }, "range": Array [ - 59, - 62, - ], - "type": "Identifier", - "value": "one", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 62, - 64, - ], - "type": "Punctuator", - "value": "?.", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 64, - 65, + 60, + 61, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 3, }, "start": Object { - "column": 8, + "column": 3, "line": 3, }, }, "range": Array [ - 65, - 66, + 61, + 64, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 3, }, "start": Object { - "column": 9, + "column": 6, "line": 3, }, }, "range": Array [ + 64, 66, - 67, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { @@ -76463,16 +84086,16 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 67, - 68, + 66, + 69, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { @@ -76486,11 +84109,11 @@ Object { }, }, "range": Array [ - 68, 69, + 70, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -76504,16 +84127,16 @@ Object { }, }, "range": Array [ - 69, 70, + 71, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 3, }, "start": Object { @@ -76522,83 +84145,83 @@ Object { }, }, "range": Array [ - 70, 71, + 76, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 19, + "line": 3, }, "start": Object { - "column": 2, - "line": 4, + "column": 18, + "line": 3, }, }, "range": Array [ - 74, + 76, 77, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 4, }, "start": Object { - "column": 5, + "column": 2, "line": 4, }, }, "range": Array [ - 77, - 78, + 80, + 81, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 4, }, "start": Object { - "column": 6, + "column": 3, "line": 4, }, }, "range": Array [ - 78, - 79, + 81, + 84, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 4, }, "start": Object { - "column": 7, + "column": 6, "line": 4, }, }, "range": Array [ - 79, - 80, + 84, + 85, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -76607,21 +84230,21 @@ Object { "line": 4, }, "start": Object { - "column": 8, + "column": 7, "line": 4, }, }, "range": Array [ - 80, - 82, + 85, + 88, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 4, }, "start": Object { @@ -76630,62 +84253,62 @@ Object { }, }, "range": Array [ - 82, - 83, + 88, + 90, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 4, }, "start": Object { - "column": 11, + "column": 12, "line": 4, }, }, "range": Array [ - 83, - 84, + 90, + 95, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 4, }, "start": Object { - "column": 12, + "column": 17, "line": 4, }, }, "range": Array [ - 84, - 85, + 95, + 96, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 4, }, "start": Object { - "column": 13, + "column": 18, "line": 4, }, }, "range": Array [ - 85, - 86, + 96, + 97, ], "type": "Punctuator", "value": ";", @@ -76693,7 +84316,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 5, }, "start": Object { @@ -76702,11 +84325,11 @@ Object { }, }, "range": Array [ - 89, - 92, + 100, + 101, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -76715,16 +84338,16 @@ Object { "line": 5, }, "start": Object { - "column": 5, + "column": 3, "line": 5, }, }, "range": Array [ - 92, - 93, + 101, + 104, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -76738,29 +84361,11 @@ Object { }, }, "range": Array [ - 93, - 94, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 7, - "line": 5, - }, - }, - "range": Array [ - 94, - 95, + 104, + 105, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -76769,21 +84374,21 @@ Object { "line": 5, }, "start": Object { - "column": 8, + "column": 7, "line": 5, }, }, "range": Array [ - 95, - 97, + 105, + 108, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 5, }, "start": Object { @@ -76792,173 +84397,173 @@ Object { }, }, "range": Array [ - 97, - 98, + 108, + 110, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 5, }, "start": Object { - "column": 11, + "column": 12, "line": 5, }, }, "range": Array [ - 98, - 99, + 110, + 115, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 5, }, "start": Object { - "column": 12, + "column": 17, "line": 5, }, }, "range": Array [ - 99, - 100, + 115, + 116, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 5, }, "start": Object { - "column": 13, + "column": 18, "line": 5, }, }, "range": Array [ - 100, - 101, + 116, + 117, ], "type": "Punctuator", - "value": ";", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 23, + "line": 5, }, "start": Object { - "column": 2, - "line": 6, + "column": 19, + "line": 5, }, }, "range": Array [ - 104, - 107, + 117, + 121, ], "type": "Identifier", - "value": "one", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 6, + "column": 24, + "line": 5, }, - "start": Object { - "column": 5, - "line": 6, + "start": Object { + "column": 23, + "line": 5, }, }, "range": Array [ - 107, - 108, + 121, + 122, ], "type": "Punctuator", - "value": "[", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, "line": 6, }, "start": Object { - "column": 6, + "column": 2, "line": 6, }, }, "range": Array [ - 108, - 109, + 125, + 126, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 6, }, "start": Object { - "column": 7, + "column": 3, "line": 6, }, }, "range": Array [ - 109, - 110, + 126, + 129, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 6, }, "start": Object { - "column": 8, + "column": 6, "line": 6, }, }, "range": Array [ - 110, - 112, + 129, + 130, ], "type": "Punctuator", - "value": "?.", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 6, }, "start": Object { - "column": 10, + "column": 7, "line": 6, }, }, "range": Array [ - 112, - 113, + 130, + 133, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { @@ -76967,21 +84572,21 @@ Object { "line": 6, }, "start": Object { - "column": 11, + "column": 10, "line": 6, }, }, "range": Array [ - 113, - 114, + 133, + 135, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 6, }, "start": Object { @@ -76990,80 +84595,80 @@ Object { }, }, "range": Array [ - 114, - 115, + 135, + 140, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 6, }, "start": Object { - "column": 13, + "column": 17, "line": 6, }, }, "range": Array [ - 115, - 116, + 140, + 142, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 6, }, "start": Object { - "column": 14, + "column": 19, "line": 6, }, }, "range": Array [ - 116, - 117, + 142, + 146, ], - "type": "Numeric", - "value": "4", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 6, }, "start": Object { - "column": 15, + "column": 23, "line": 6, }, }, "range": Array [ - 117, - 118, + 146, + 147, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 6, }, "start": Object { - "column": 16, + "column": 24, "line": 6, }, }, "range": Array [ - 118, - 119, + 147, + 148, ], "type": "Punctuator", "value": ";", @@ -77071,7 +84676,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 7, }, "start": Object { @@ -77080,11 +84685,11 @@ Object { }, }, "range": Array [ - 122, - 125, + 151, + 152, ], - "type": "Identifier", - "value": "one", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -77093,16 +84698,16 @@ Object { "line": 7, }, "start": Object { - "column": 5, + "column": 3, "line": 7, }, }, "range": Array [ - 125, - 126, + 152, + 155, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "one", }, Object { "loc": Object { @@ -77116,29 +84721,11 @@ Object { }, }, "range": Array [ - 126, - 127, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 7, - }, - "start": Object { - "column": 7, - "line": 7, - }, - }, - "range": Array [ - 127, - 128, + 155, + 156, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { @@ -77147,21 +84734,21 @@ Object { "line": 7, }, "start": Object { - "column": 8, + "column": 7, "line": 7, }, }, "range": Array [ - 128, - 130, + 156, + 159, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "two", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 7, }, "start": Object { @@ -77170,134 +84757,134 @@ Object { }, }, "range": Array [ - 130, - 131, + 159, + 161, ], "type": "Punctuator", - "value": "[", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 7, }, "start": Object { - "column": 11, + "column": 12, "line": 7, }, }, "range": Array [ - 131, - 132, + 161, + 166, ], - "type": "Numeric", - "value": "3", + "type": "Identifier", + "value": "three", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 7, }, "start": Object { - "column": 12, + "column": 17, "line": 7, }, }, "range": Array [ - 132, - 133, + 166, + 168, ], "type": "Punctuator", - "value": "]", + "value": "?.", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 7, }, "start": Object { - "column": 13, + "column": 19, "line": 7, }, }, "range": Array [ - 133, - 135, + 168, + 172, ], - "type": "Punctuator", - "value": "?.", + "type": "Identifier", + "value": "four", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 7, }, "start": Object { - "column": 15, + "column": 23, "line": 7, }, }, "range": Array [ - 135, - 136, + 172, + 173, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 7, }, "start": Object { - "column": 16, + "column": 24, "line": 7, }, }, "range": Array [ - 136, - 137, + 173, + 174, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 7, }, "start": Object { - "column": 17, + "column": 25, "line": 7, }, }, "range": Array [ - 137, - 138, + 174, + 178, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "five", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 7, }, "start": Object { - "column": 18, + "column": 29, "line": 7, }, }, "range": Array [ - 138, - 139, + 178, + 179, ], "type": "Punctuator", "value": ";", @@ -77314,8 +84901,8 @@ Object { }, }, "range": Array [ - 140, - 141, + 180, + 181, ], "type": "Punctuator", "value": "}", From d4703e1a97760604cadb4167d5de4a897883119f Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 25 Oct 2019 14:36:59 -0700 Subject: [PATCH 26/47] fix(typescript-estree): ensure parent pointers are set (#1129) --- .../WatchCompilerHostOfConfigFile.ts | 0 .../src/create-program/createWatchProgram.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) rename packages/typescript-estree/src/{ => create-program}/WatchCompilerHostOfConfigFile.ts (100%) diff --git a/packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts similarity index 100% rename from packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts rename to packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 3acf67d385a2..ddd2d90ccb19 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -3,7 +3,7 @@ import fs from 'fs'; import path from 'path'; import ts from 'typescript'; import { Extra } from '../parser-options'; -import { WatchCompilerHostOfConfigFile } from '../WatchCompilerHostOfConfigFile'; +import { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; import { canonicalDirname, CanonicalPath, @@ -160,7 +160,13 @@ function getProgramsForProjects( if (fileList.has(filePath)) { log('Found existing program for file. %s', filePath); - return [updatedProgram || existingWatch.getProgram().getProgram()]; + + updatedProgram = + updatedProgram || existingWatch.getProgram().getProgram(); + // sets parent pointers in source files + updatedProgram.getTypeChecker(); + + return [updatedProgram]; } } log( From ab102c08408f84c2d1b87864dc8088870c821092 Mon Sep 17 00:00:00 2001 From: Retsam Date: Sun, 27 Oct 2019 19:28:31 -0400 Subject: [PATCH 27/47] docs(eslint-plugin): [no-unnecessary-condition] tweak wording (#1147) Removes "looser/stricter" wording in favor of "more opinionated, less opinionated" and clarifies in what way `no-unnecessary-condition` is less opinionated. --- packages/eslint-plugin/docs/rules/no-unnecessary-condition.md | 4 ++-- .../eslint-plugin/docs/rules/strict-boolean-expressions.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index 996d1d9aae13..48b98849c41e 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -59,6 +59,6 @@ The main downside to using this rule is the need for type information. ## Related To -- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - this rule is essentially a stronger version. +- ESLint: [no-constant-condition](https://eslint.org/docs/rules/no-constant-condition) - `no-unnecessary-condition` is essentially a stronger version of `no-constant-condition`, but requires type information. -- [strict-boolean-expression](./strict-boolean-expressions.md) - a stricter alternative to this rule. +- [strict-boolean-expressions](./strict-boolean-expressions.md) - a more opinionated version of `no-unnecessary-condition`. `strict-boolean-expressions` enforces a specific code style, while `no-unnecessary-condition` is about correctness. diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 72d38f1ed66c..fd23d75cb5ef 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -63,4 +63,4 @@ Options may be provided as an object with: - TSLint: [strict-boolean-expressions](https://palantir.github.io/tslint/rules/strict-boolean-expressions) -- [no-unnecessary-condition](./no-unnecessary-condition.md) - a looser alternative to this rule. +- [no-unnecessary-condition](./no-unnecessary-condition.md) - essentially a less opinionated alternative to this rule. `strict-boolean-expressions` enforces a specific code style, while `no-unnecessary-condition` is about correctness. From 5338955f1cf6513ff3bf0c391ae2bd9c092ecb55 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 28 Oct 2019 17:02:01 +0000 Subject: [PATCH 28/47] chore: publish v2.6.0 --- CHANGELOG.md | 20 ++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 11 +++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 16 ++++++++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 16 ++++++++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 20 ++++++++++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 114 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 490f45a7b3e1..7df61feebd24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **parser:** adds TTY check before logging the version mismatch warning ([#1121](https://github.com/typescript-eslint/typescript-eslint/issues/1121)) ([768ef63](https://github.com/typescript-eslint/typescript-eslint/commit/768ef63)) +* **typescript-estree:** better handle canonical paths ([#1111](https://github.com/typescript-eslint/typescript-eslint/issues/1111)) ([8dcbf4c](https://github.com/typescript-eslint/typescript-eslint/commit/8dcbf4c)) +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) +* **typescript-estree:** ensure parent pointers are set ([#1129](https://github.com/typescript-eslint/typescript-eslint/issues/1129)) ([d4703e1](https://github.com/typescript-eslint/typescript-eslint/commit/d4703e1)) +* **typescript-estree:** normalize paths to fix cache miss on windows ([#1128](https://github.com/typescript-eslint/typescript-eslint/issues/1128)) ([6d0f2ce](https://github.com/typescript-eslint/typescript-eslint/commit/6d0f2ce)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/lerna.json b/lerna.json index 2a40ae9e906b..f3a88ed9b376 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.5.0", + "version": "2.6.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 5128c179c540..b3a92499169a 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. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **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 7e2168b5ff1c..00f7281ffef5 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": "2.5.0", + "version": "2.6.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.5.0" + "@typescript-eslint/parser": "2.6.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index f40f2624eec6..09dfcf804632 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index cacc21e47137..e5ba66ba0408 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.5.0", + "version": "2.6.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index dd63f064e21c..5d1e618d4424 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. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **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 0f26e278fec3..7cc729040e54 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.5.0", + "version": "2.6.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.5.0", + "@typescript-eslint/typescript-estree": "2.6.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 1e2d3c4d0f6d..6075ce3ac7d5 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/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. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 7e3f5e3ce340..d6ea0d95f60a 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.5.0", + "version": "2.6.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.5.0", - "@typescript-eslint/typescript-estree": "2.5.0", + "@typescript-eslint/experimental-utils": "2.6.0", + "@typescript-eslint/typescript-estree": "2.6.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.5.0", + "@typescript-eslint/shared-fixtures": "2.6.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 3fef3f0ee9a4..87ceff1bc553 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/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. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) **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 b482cfdcf92b..a19e0cd1e5a7 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.5.0", + "version": "2.6.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2389fef6c569..e1232b70926b 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) + + +### Bug Fixes + +* **parser:** adds TTY check before logging the version mismatch warning ([#1121](https://github.com/typescript-eslint/typescript-eslint/issues/1121)) ([768ef63](https://github.com/typescript-eslint/typescript-eslint/commit/768ef63)) +* **typescript-estree:** better handle canonical paths ([#1111](https://github.com/typescript-eslint/typescript-eslint/issues/1111)) ([8dcbf4c](https://github.com/typescript-eslint/typescript-eslint/commit/8dcbf4c)) +* **typescript-estree:** correct parenthesized optional chain AST ([#1141](https://github.com/typescript-eslint/typescript-eslint/issues/1141)) ([5ae286e](https://github.com/typescript-eslint/typescript-eslint/commit/5ae286e)) +* **typescript-estree:** ensure parent pointers are set ([#1129](https://github.com/typescript-eslint/typescript-eslint/issues/1129)) ([d4703e1](https://github.com/typescript-eslint/typescript-eslint/commit/d4703e1)) +* **typescript-estree:** normalize paths to fix cache miss on windows ([#1128](https://github.com/typescript-eslint/typescript-eslint/issues/1128)) ([6d0f2ce](https://github.com/typescript-eslint/typescript-eslint/commit/6d0f2ce)) + + +### Features + +* **typescript-estree:** add support for declare class properties ([#1136](https://github.com/typescript-eslint/typescript-eslint/issues/1136)) ([1508670](https://github.com/typescript-eslint/typescript-eslint/commit/1508670)) + + + + + # [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 508d8400531d..e28166f1eb88 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.5.0", + "version": "2.6.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -57,7 +57,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.5.0", + "@typescript-eslint/shared-fixtures": "2.6.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 17c956e1592030a3d4736ecdcf63f1c953940b64 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 29 Oct 2019 09:56:25 -0700 Subject: [PATCH 29/47] fix(typescript-estree): don't use typescript's synthetic default (#1156) Fixes #1153 --- .../src/create-program/createDefaultProgram.ts | 2 +- .../src/create-program/createIsolatedProgram.ts | 2 +- .../typescript-estree/src/create-program/createSourceFile.ts | 2 +- .../typescript-estree/src/create-program/createWatchProgram.ts | 2 +- packages/typescript-estree/src/create-program/shared.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts index e124bd8ed573..383d10bd43d3 100644 --- a/packages/typescript-estree/src/create-program/createDefaultProgram.ts +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -1,6 +1,6 @@ import debug from 'debug'; import path from 'path'; -import ts from 'typescript'; +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; import { getTsconfigPath, diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts index 8588b3c1bc43..d2e8c22901e3 100644 --- a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -1,5 +1,5 @@ import debug from 'debug'; -import ts from 'typescript'; +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; import { ASTAndProgram, DEFAULT_COMPILER_OPTIONS } from './shared'; diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts index 9f14ec274ff1..04815b246485 100644 --- a/packages/typescript-estree/src/create-program/createSourceFile.ts +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -1,5 +1,5 @@ import debug from 'debug'; -import ts from 'typescript'; +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index ddd2d90ccb19..beabcdd68886 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -1,7 +1,7 @@ import debug from 'debug'; import fs from 'fs'; import path from 'path'; -import ts from 'typescript'; +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; import { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; import { diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index c210ddee43ee..3e948841773b 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -1,5 +1,5 @@ import path from 'path'; -import ts from 'typescript'; +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; interface ASTAndProgram { From 366518f75944dd387d2f55a33a31d2ac9c743f1d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 3 Nov 2019 14:30:17 -0800 Subject: [PATCH 30/47] fix(typescript-estree): fix filename handling for vue JSX + markdown (#1127) * fix(typescript-estree): fix filename handling for vue JSX + markdown * fix: correct integration tests * fix: remove erroneous vue file * docs: add a readme for the integration tests * chore: respect known filenames, ignore unknown ones * fix: add explicit tests for filename/jsx handling * docs: explicitly state the expected behaviour for JSX * docs: correct wording * docs: correct wording * chore: new commit to force codecov --- package.json | 2 +- packages/parser/README.md | 13 +- packages/typescript-estree/README.md | 12 +- .../create-program/createIsolatedProgram.ts | 20 +- .../src/create-program/createSourceFile.ts | 10 +- .../src/create-program/shared.ts | 30 + .../tests/lib/__snapshots__/parse.ts.snap | 3813 +++++++++++++++++ packages/typescript-estree/tests/lib/parse.ts | 150 + tests/integration/README.md | 18 + tests/integration/docker-compose.yml | 40 +- .../fixtures/markdown/.eslintrc.yml | 23 + tests/integration/fixtures/markdown/Doc.md | 71 + .../integration/fixtures/markdown/Dockerfile | 17 + .../fixtures/markdown/test.js.snap | 197 + tests/integration/fixtures/markdown/test.sh | 22 + .../fixtures/markdown/tsconfig.json | 6 + .../fixtures/vue-jsx/.eslintrc.yml | 25 + tests/integration/fixtures/vue-jsx/Dockerfile | 17 + tests/integration/fixtures/vue-jsx/Jsx.vue | 36 + .../integration/fixtures/vue-jsx/test.js.snap | 63 + tests/integration/fixtures/vue-jsx/test.sh | 29 + .../fixtures/vue-jsx/tsconfig.json | 8 + tests/integration/fixtures/vue-sfc/test.sh | 4 + tests/integration/run-all-tests.sh | 6 + yarn.lock | 8 +- 25 files changed, 4623 insertions(+), 17 deletions(-) create mode 100644 tests/integration/README.md create mode 100644 tests/integration/fixtures/markdown/.eslintrc.yml create mode 100644 tests/integration/fixtures/markdown/Doc.md create mode 100644 tests/integration/fixtures/markdown/Dockerfile create mode 100644 tests/integration/fixtures/markdown/test.js.snap create mode 100755 tests/integration/fixtures/markdown/test.sh create mode 100644 tests/integration/fixtures/markdown/tsconfig.json create mode 100644 tests/integration/fixtures/vue-jsx/.eslintrc.yml create mode 100644 tests/integration/fixtures/vue-jsx/Dockerfile create mode 100644 tests/integration/fixtures/vue-jsx/Jsx.vue create mode 100644 tests/integration/fixtures/vue-jsx/test.js.snap create mode 100755 tests/integration/fixtures/vue-jsx/test.sh create mode 100644 tests/integration/fixtures/vue-jsx/tsconfig.json diff --git a/package.json b/package.json index 6390641fcae0..559b4e792715 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,6 @@ "url": "https://opencollective.com/typescript-eslint" }, "resolutions": { - "typescript": "^3.7.0-dev.20191018" + "typescript": "^3.7.0-dev.20191021" } } diff --git a/packages/parser/README.md b/packages/parser/README.md index 9fcb9d043633..011fb69b13d7 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -42,9 +42,16 @@ The following additional configuration options are available by specifying them - **`ecmaFeatures.jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html). - - It's `false` on `*.ts` files regardless of this option. - - It's `true` on `*.tsx` files regardless of this option. - - Otherwise, it respects this option. + NOTE: this setting does not effect known file types (.js, .jsx, .ts, .tsx, .json) because the typescript compiler has its own internal handling for known file extensions. The exact behaviour is as follows: + + - if `parserOptions.project` is _not_ provided: + - `.js`, `.jsx`, `.tsx` files are parsed as if this is true. + - `.ts` files are parsed as if this is false. + - unknown extensions (`.md`, `.vue`) will respect this setting. + - if `parserOptions.project` is provided (i.e. you are using rules with type information): + - `.js`, `.jsx`, `.tsx` files are parsed as if this is true. + - `.ts` files are parsed as if this is false. + - "unknown" extensions (`.md`, `.vue`) **are parsed as if this is false**. - **`useJSXTextNode`** - default `true`. Please set `false` if you use this parser on ESLint v4. If this is `false`, the parser creates the AST of JSX texts as the legacy style. diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index fe1515c869ee..aca6f215dcb1 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -47,7 +47,17 @@ Parses the given string of code with the options provided and returns an ESTree- // create a top-level comments array containing all comments comment: false, - // enable parsing JSX. For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html + /* + * enable parsing JSX. For more details, see https://www.typescriptlang.org/docs/handbook/jsx.html + * + * NOTE: this setting does not effect known file types (.js, .jsx, .ts, .tsx, .json) because the + * typescript compiler has its own internal handling for known file extensions. + * + * Exact behaviour: + * - .js, .jsx, .tsx files are parsed as if this is true + * - .ts files are parsed as if this is false + * - unknown extensions (.md, .vue) will respect this setting + */ jsx: false, /* diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts index d2e8c22901e3..296aee2e5ba0 100644 --- a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -1,7 +1,11 @@ import debug from 'debug'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; -import { ASTAndProgram, DEFAULT_COMPILER_OPTIONS } from './shared'; +import { + ASTAndProgram, + DEFAULT_COMPILER_OPTIONS, + getScriptKind, +} from './shared'; const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); @@ -10,7 +14,11 @@ const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); * @returns Returns a new source file and program corresponding to the linted code */ function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { - log('Getting isolated program for: %s', extra.filePath); + log( + 'Getting isolated program in %s mode for: %s', + extra.jsx ? 'TSX' : 'TS', + extra.filePath, + ); const compilerHost: ts.CompilerHost = { fileExists() { @@ -34,7 +42,13 @@ function createIsolatedProgram(code: string, extra: Extra): ASTAndProgram { return '\n'; }, getSourceFile(filename: string) { - return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); + return ts.createSourceFile( + filename, + code, + ts.ScriptTarget.Latest, + true, + getScriptKind(extra, filename), + ); }, readFile() { return undefined; diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts index 04815b246485..d1ab5f98d21a 100644 --- a/packages/typescript-estree/src/create-program/createSourceFile.ts +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -1,17 +1,23 @@ import debug from 'debug'; import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports import { Extra } from '../parser-options'; +import { getScriptKind } from './shared'; -const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); +const log = debug('typescript-eslint:typescript-estree:createSourceFile'); function createSourceFile(code: string, extra: Extra): ts.SourceFile { - log('Getting AST without type information for: %s', extra.filePath); + log( + 'Getting AST without type information in %s mode for: %s', + extra.jsx ? 'TSX' : 'TS', + extra.filePath, + ); return ts.createSourceFile( extra.filePath, code, ts.ScriptTarget.Latest, /* setParentNodes */ true, + getScriptKind(extra), ); } diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 3e948841773b..6509997094f9 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -41,11 +41,41 @@ function canonicalDirname(p: CanonicalPath): CanonicalPath { return path.dirname(p) as CanonicalPath; } +function getScriptKind( + extra: Extra, + filePath: string = extra.filePath, +): ts.ScriptKind { + const extension = path.extname(filePath).toLowerCase(); + // note - we respect the user's extension when it is known we could override it and force it to match their + // jsx setting, but that could create weird situations where we throw parse errors when TSC doesn't + switch (extension) { + case '.ts': + return ts.ScriptKind.TS; + + case '.tsx': + return ts.ScriptKind.TSX; + + case '.js': + return ts.ScriptKind.JS; + + case '.jsx': + return ts.ScriptKind.JSX; + + case '.json': + return ts.ScriptKind.JSON; + + default: + // unknown extension, force typescript to ignore the file extension, and respect the user's setting + return extra.jsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS; + } +} + export { ASTAndProgram, canonicalDirname, CanonicalPath, DEFAULT_COMPILER_OPTIONS, getCanonicalFileName, + getScriptKind, getTsconfigPath, }; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index bca89ec8d8c6..e953f852a8e9 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -225,6 +225,3819 @@ The file does not match your project config: tests/fixtures/invalidFileErrors/js The file must be included in at least one of the projects provided." `; +exports[`parse() isolated parsing should parse .js file - with JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .js file - with JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .js file - without JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .js file - without JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .jsx file - with JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .jsx file - with JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .jsx file - without JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .jsx file - without JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .ts file - without JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .ts file - without JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .tsx file - with JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .tsx file - with JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .tsx file - without JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .tsx file - without JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .vue file - with JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .vue file - without JSX content - parserOptions.jsx = false 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + +exports[`parse() isolated parsing should parse .vue file - without JSX content - parserOptions.jsx = true 1`] = ` +Object { + "ast": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", + }, + "services": Object { + "esTreeNodeToTSNodeMap": undefined, + "program": undefined, + "tsNodeToESTreeNodeMap": undefined, + }, +} +`; + exports[`parse() non string code should correctly convert code to a string for parse() 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 21664b7bd418..53197b7a73d8 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -229,6 +229,156 @@ describe('parse()', () => { }); }); + describe('isolated parsing', () => { + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + }; + const testParse = ({ + ext, + jsxContent, + jsxSetting, + shouldThrow = false, + }: { + ext: '.js' | '.jsx' | '.ts' | '.tsx' | '.vue'; + jsxContent: boolean; + jsxSetting: boolean; + shouldThrow?: boolean; + }): void => { + const code = jsxContent ? 'const x =
;' : 'const x = 1'; + it(`should parse ${ext} file - ${ + jsxContent ? 'with' : 'without' + } JSX content - parserOptions.jsx = ${jsxSetting}`, () => { + let result; + let exp = expect(() => { + result = parser.parseAndGenerateServices(code, { + ...config, + jsx: jsxSetting, + filePath: join(FIXTURES_DIR, `file${ext}`), + }); + }); + if (!shouldThrow) { + exp = exp.not; + } + exp.toThrow(); + + if (!shouldThrow) { + expect(result).toMatchSnapshot(); + } + }); + }; + + testParse({ + ext: '.js', + jsxContent: false, + jsxSetting: false, + }); + testParse({ + ext: '.js', + jsxContent: false, + jsxSetting: true, + }); + testParse({ + ext: '.js', + jsxContent: true, + jsxSetting: false, + }); + testParse({ + ext: '.js', + jsxContent: true, + jsxSetting: true, + }); + + testParse({ + ext: '.jsx', + jsxContent: false, + jsxSetting: false, + }); + testParse({ + ext: '.jsx', + jsxContent: false, + jsxSetting: true, + }); + testParse({ + ext: '.jsx', + jsxContent: true, + jsxSetting: false, + }); + testParse({ + ext: '.jsx', + jsxContent: true, + jsxSetting: true, + }); + + testParse({ + ext: '.ts', + jsxContent: false, + jsxSetting: false, + }); + testParse({ + ext: '.ts', + jsxContent: false, + jsxSetting: true, + }); + testParse({ + ext: '.ts', + jsxContent: true, + jsxSetting: false, + shouldThrow: true, // Typescript does not allow JSX in a .ts file + }); + testParse({ + ext: '.ts', + jsxContent: true, + jsxSetting: true, + shouldThrow: true, + }); + + testParse({ + ext: '.tsx', + jsxContent: false, + jsxSetting: false, + }); + testParse({ + ext: '.tsx', + jsxContent: false, + jsxSetting: true, + }); + testParse({ + ext: '.tsx', + jsxContent: true, + jsxSetting: false, + }); + testParse({ + ext: '.tsx', + jsxContent: true, + jsxSetting: true, + }); + + testParse({ + ext: '.vue', + jsxContent: false, + jsxSetting: false, + }); + testParse({ + ext: '.vue', + jsxContent: false, + jsxSetting: true, + }); + testParse({ + ext: '.vue', + jsxContent: true, + jsxSetting: false, + shouldThrow: true, // "Unknown" filetype means we respect the JSX setting + }); + testParse({ + ext: '.vue', + jsxContent: true, + jsxSetting: true, + }); + }); + describe('invalid file error messages', () => { const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); const code = 'var a = true'; diff --git a/tests/integration/README.md b/tests/integration/README.md new file mode 100644 index 000000000000..eb33e8bd62df --- /dev/null +++ b/tests/integration/README.md @@ -0,0 +1,18 @@ +# Integration Tests + +We have a set of integration tests defined in this project to help ensure we don't inadvertently break downstream packages that depend on us. + +These tests are setup to run within docker containers to ensure that each test is completely isolated; we don't want them to affect our local environment, and similarly we don't want them to be effected by our local environment. + +## Adding a new integration test + +1. [Install docker for your platform](https://docs.docker.com/v17.09/engine/installation/#supported-platforms). +1. Add a new folder in `/tests/integration/fixtures` +1. Add a `.eslintrc.yml`, and a `tsconfig.json` to your folder, with the config required. +1. Create the necessary files to test the integration. +1. Copy+paste the `Dockerfile` from an existing fixture (they are all the same). +1. Copy+paste the `test.sh` from an existing fixture, and adjust the `eslint` command as required. +1. Add a new entry to `docker-compose.yml` by copy+pasting an existing section, and changing the name to match your new folder. +1. Add a new entry to `run-all-tests.sh` by copy+pasting an existing command, and changing the name to match your new folder. +1. Run your integration test by running the single command you copied in . + - If your test finishes successfully, a `test.js.snap` will be created. diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index 74bfb63dab22..c3a0b450d65f 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: typescript-and-tslint-plugins-together: build: ./fixtures/typescript-and-tslint-plugins-together - container_name: "typescript-and-tslint-plugins-together" + container_name: 'typescript-and-tslint-plugins-together' volumes: # Runtime link to the relevant built @typescript-eslint packages and integration test utils, # but apply an empty volume for the package tests, we don't need those. @@ -22,7 +22,7 @@ services: vue-sfc: build: ./fixtures/vue-sfc - container_name: "vue-sfc" + container_name: 'vue-sfc' volumes: # Runtime link to the relevant built @typescript-eslint packages and integration test utils, # but apply an empty volume for the package tests, we don't need those. @@ -37,9 +37,26 @@ services: # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - ./fixtures/vue-sfc:/usr/linked + vue-jsx: + build: ./fixtures/vue-jsx + container_name: 'vue-jsx' + volumes: + # Runtime link to the relevant built @typescript-eslint packages and integration test utils, + # but apply an empty volume for the package tests, we don't need those. + - ../../package.json/:/usr/root-package.json + - ./utils/:/usr/utils + - ../../packages/parser/:/usr/parser + - /usr/parser/tests + - ../../packages/typescript-estree/:/usr/typescript-estree + - /usr/typescript-estree/tests + - ../../packages/eslint-plugin/:/usr/eslint-plugin + - /usr/eslint-plugin/tests + # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. + - ./fixtures/vue-jsx:/usr/linked + recommended-does-not-require-program: build: ./fixtures/recommended-does-not-require-program - container_name: "recommended-does-not-require-program" + container_name: 'recommended-does-not-require-program' volumes: # Runtime link to the relevant built @typescript-eslint packages and integration test utils, # but apply an empty volume for the package tests, we don't need those. @@ -53,3 +70,20 @@ services: - /usr/eslint-plugin/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 + + markdown: + build: ./fixtures/markdown + container_name: 'markdown' + volumes: + # Runtime link to the relevant built @typescript-eslint packages and integration test utils, + # but apply an empty volume for the package tests, we don't need those. + - ../../package.json/:/usr/root-package.json + - ./utils/:/usr/utils + - ../../packages/parser/:/usr/parser + - /usr/parser/tests + - ../../packages/typescript-estree/:/usr/typescript-estree + - /usr/typescript-estree/tests + - ../../packages/eslint-plugin/:/usr/eslint-plugin + - /usr/eslint-plugin/tests + # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. + - ./fixtures/markdown:/usr/linked diff --git a/tests/integration/fixtures/markdown/.eslintrc.yml b/tests/integration/fixtures/markdown/.eslintrc.yml new file mode 100644 index 000000000000..92575183cd91 --- /dev/null +++ b/tests/integration/fixtures/markdown/.eslintrc.yml @@ -0,0 +1,23 @@ +root: true + +# Local version of @typescript-eslint/parser +parser: '@typescript-eslint/parser' + +env: + es6: true + node: true + +parserOptions: + sourceType: module + extraFileExtensions: ['.vue'] + ecmaFeatures: + jsx: true + +plugins: +- 'markdown' +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' + +rules: + '@typescript-eslint/no-explicit-any': 'error' + 'no-console': 'error' diff --git a/tests/integration/fixtures/markdown/Doc.md b/tests/integration/fixtures/markdown/Doc.md new file mode 100644 index 000000000000..0d6eabe455ee --- /dev/null +++ b/tests/integration/fixtures/markdown/Doc.md @@ -0,0 +1,71 @@ +Some extra text to verify that the markdown plugin is ignoring anything that is not a code block. + +expected no-console error: +```jsx +import { Button } from 'antd'; + +function MyComp() { + console.log('test'); + return ( +
+ + + + + +
+ ); +} +``` + +expected no-explicit-any error: +expected no-console error: +```jsx +import { Button } from 'antd'; + +function MyComp(): any { + console.log('test'); + return ( +
+ + + + + +
+ ); +} +``` + +expected no-console error: +```js +function foo() { + console.log('test'); +} +``` + +expected no-explicit-any error: +expected no-console error: +```js +function foo(): any { + console.log('test'); +} +``` + + +expected no-explicit-any error: +expected no-console error: +```javascript +function foo(): any { + console.log('test'); +} +``` + + +expected no-explicit-any error: +expected no-console error: +```node +function foo(): any { + console.log('test'); +} +``` diff --git a/tests/integration/fixtures/markdown/Dockerfile b/tests/integration/fixtures/markdown/Dockerfile new file mode 100644 index 000000000000..3b281e624c87 --- /dev/null +++ b/tests/integration/fixtures/markdown/Dockerfile @@ -0,0 +1,17 @@ +FROM node:carbon + +# Copy the test.sh into the container. Every other file will be linked, rather +# than copied to allow for changes without rebuilds wherever possible +WORKDIR /usr +COPY ./test.sh /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toMatchSnapshot();\n" \ + "});\n" > test.js + +# Run the integration test +CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/markdown/test.js.snap b/tests/integration/fixtures/markdown/test.js.snap new file mode 100644 index 000000000000..4fc96f79abc7 --- /dev/null +++ b/tests/integration/fixtures/markdown/test.js.snap @@ -0,0 +1,197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`it should produce the expected lint ouput 1`] = ` +Array [ + Object { + "errorCount": 10, + "filePath": "/usr/linked/Doc.md", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "column": 3, + "endColumn": 14, + "endLine": 8, + "line": 8, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + Object { + "column": 20, + "endColumn": 23, + "endLine": 26, + "line": 26, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + Object { + "column": 3, + "endColumn": 14, + "endLine": 27, + "line": 27, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + Object { + "column": 3, + "endColumn": 14, + "endLine": 43, + "line": 43, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + Object { + "column": 17, + "endColumn": 20, + "endLine": 50, + "line": 50, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + Object { + "column": 3, + "endColumn": 14, + "endLine": 51, + "line": 51, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + Object { + "column": 17, + "endColumn": 20, + "endLine": 59, + "line": 59, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + Object { + "column": 3, + "endColumn": 14, + "endLine": 60, + "line": 60, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + Object { + "column": 17, + "endColumn": 20, + "endLine": 68, + "line": 68, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + Object { + "column": 3, + "endColumn": 14, + "endLine": 69, + "line": 69, + "message": "Unexpected console statement.", + "messageId": "unexpected", + "nodeType": "MemberExpression", + "ruleId": "no-console", + "severity": 2, + }, + ], + "source": "Some extra text to verify that the markdown plugin is ignoring anything that is not a code block. + +expected no-console error: +\`\`\`jsx +import { Button } from 'antd'; + +function MyComp() { + console.log('test'); + return ( +
+ + + + + +
+ ); +} +\`\`\` + +expected no-explicit-any error: +expected no-console error: +\`\`\`jsx +import { Button } from 'antd'; + +function MyComp(): any { + console.log('test'); + return ( +
+ + + + + +
+ ); +} +\`\`\` + +expected no-console error: +\`\`\`js +function foo() { + console.log('test'); +} +\`\`\` + +expected no-explicit-any error: +expected no-console error: +\`\`\`js +function foo(): any { + console.log('test'); +} +\`\`\` + + +expected no-explicit-any error: +expected no-console error: +\`\`\`javascript +function foo(): any { + console.log('test'); +} +\`\`\` + + +expected no-explicit-any error: +expected no-console error: +\`\`\`node +function foo(): any { + console.log('test'); +} +\`\`\` +", + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/fixtures/markdown/test.sh b/tests/integration/fixtures/markdown/test.sh new file mode 100755 index 000000000000..4641a6b33f45 --- /dev/null +++ b/tests/integration/fixtures/markdown/test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Generate the package.json to use +node /usr/utils/generate-package-json.js + +# Install dependencies +npm install + +# Use the local volumes for our own packages +npm install $(npm pack /usr/typescript-estree | tail -1) +npm install $(npm pack /usr/parser | tail -1) +npm install $(npm pack /usr/eslint-plugin | tail -1) + +# Install the latest vue-eslint-parser (this may break us occassionally, but it's probably good to get that feedback early) +npm install eslint-plugin-markdown@latest + +# Run the linting +# (the "|| true" helps make sure that we run our tests on failed linting runs as well) +npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.md || true + +# Run our assertions against the linting output +npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/markdown/tsconfig.json b/tests/integration/fixtures/markdown/tsconfig.json new file mode 100644 index 000000000000..45234bf35aa2 --- /dev/null +++ b/tests/integration/fixtures/markdown/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "strict": true + }, + "include": [] +} diff --git a/tests/integration/fixtures/vue-jsx/.eslintrc.yml b/tests/integration/fixtures/vue-jsx/.eslintrc.yml new file mode 100644 index 000000000000..ea4319ac718e --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/.eslintrc.yml @@ -0,0 +1,25 @@ +root: true + +parser: 'vue-eslint-parser' + +env: + es6: true + node: true + +extends: + plugin:vue/essential + +parserOptions: + # Local version of @typescript-eslint/parser + parser: '@typescript-eslint/parser' + sourceType: module + extraFileExtensions: ['.vue'] + ecmaFeatures: + jsx: true + +plugins: +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' + +rules: + '@typescript-eslint/no-explicit-any': 'error' diff --git a/tests/integration/fixtures/vue-jsx/Dockerfile b/tests/integration/fixtures/vue-jsx/Dockerfile new file mode 100644 index 000000000000..3b281e624c87 --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/Dockerfile @@ -0,0 +1,17 @@ +FROM node:carbon + +# Copy the test.sh into the container. Every other file will be linked, rather +# than copied to allow for changes without rebuilds wherever possible +WORKDIR /usr +COPY ./test.sh /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toMatchSnapshot();\n" \ + "});\n" > test.js + +# Run the integration test +CMD [ "./test.sh" ] diff --git a/tests/integration/fixtures/vue-jsx/Jsx.vue b/tests/integration/fixtures/vue-jsx/Jsx.vue new file mode 100644 index 000000000000..c08599249c39 --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/Jsx.vue @@ -0,0 +1,36 @@ + diff --git a/tests/integration/fixtures/vue-jsx/test.js.snap b/tests/integration/fixtures/vue-jsx/test.js.snap new file mode 100644 index 000000000000..d4432e47428a --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/test.js.snap @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`it should produce the expected lint ouput 1`] = ` +Array [ + Object { + "errorCount": 1, + "filePath": "/usr/linked/Jsx.vue", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "column": 17, + "endColumn": 20, + "endLine": 17, + "line": 17, + "message": "Unexpected any. Specify a different type.", + "messageId": "unexpectedAny", + "nodeType": "TSAnyKeyword", + "ruleId": "@typescript-eslint/no-explicit-any", + "severity": 2, + }, + ], + "source": " +", + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/fixtures/vue-jsx/test.sh b/tests/integration/fixtures/vue-jsx/test.sh new file mode 100755 index 000000000000..f59b6348fd6b --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/test.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Generate the package.json to use +node /usr/utils/generate-package-json.js + +# Install dependencies +npm install + +# Use the local volumes for our own packages +npm install $(npm pack /usr/typescript-estree | tail -1) +npm install $(npm pack /usr/parser | tail -1) +npm install $(npm pack /usr/eslint-plugin | tail -1) + +# Install the latest vue-eslint-parser (this may break us occassionally, but it's probably good to get that feedback early) +npm install vue-eslint-parser@latest + +# Install the latest eslint-plugin-vue (this may break us occassionally, but it's probably good to get that feedback early) +npm install eslint-plugin-vue@latest + +# Install the latest some other vue utilities +npm install vuex@latest +npm install vue-property-decorator@latest + +# Run the linting +# (the "|| true" helps make sure that we run our tests on failed linting runs as well) +npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.vue || true + +# Run our assertions against the linting output +npx jest /usr/test.js --snapshotResolver=/usr/utils/jest-snapshot-resolver.js diff --git a/tests/integration/fixtures/vue-jsx/tsconfig.json b/tests/integration/fixtures/vue-jsx/tsconfig.json new file mode 100644 index 000000000000..861b7d99bedf --- /dev/null +++ b/tests/integration/fixtures/vue-jsx/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "strict": true + }, + "include": [ + "*.vue" + ] +} diff --git a/tests/integration/fixtures/vue-sfc/test.sh b/tests/integration/fixtures/vue-sfc/test.sh index b61a140ff5be..f59b6348fd6b 100755 --- a/tests/integration/fixtures/vue-sfc/test.sh +++ b/tests/integration/fixtures/vue-sfc/test.sh @@ -17,6 +17,10 @@ npm install vue-eslint-parser@latest # Install the latest eslint-plugin-vue (this may break us occassionally, but it's probably good to get that feedback early) npm install eslint-plugin-vue@latest +# Install the latest some other vue utilities +npm install vuex@latest +npm install vue-property-decorator@latest + # Run the linting # (the "|| true" helps make sure that we run our tests on failed linting runs as well) npx eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.vue || true diff --git a/tests/integration/run-all-tests.sh b/tests/integration/run-all-tests.sh index 4506da773492..8964e3198690 100755 --- a/tests/integration/run-all-tests.sh +++ b/tests/integration/run-all-tests.sh @@ -10,5 +10,11 @@ docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-con # vue-sfc docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-sfc +# vue-jsx +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit vue-jsx + # recommended-does-not-require-program docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit recommended-does-not-require-program + +# markdown +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit markdown diff --git a/yarn.lock b/yarn.lock index 88507646d6d8..58e28ad5ec0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7715,10 +7715,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.2.1 <3.8.0 || >3.7.0-dev.0", typescript@^3.7.0-dev.20191018: - version "3.7.0-dev.20191018" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191018.tgz#6b98a655b124ca697364e2d7977c469a2bfede3d" - integrity sha512-Z8KpsytbY5lBMp5cc08VFoO8CgHC6IcbgyiA5vjh7fitkoG0qcem9C354YuiWV4O2+i2gdC7vF8tNUYqO/vUkQ== +typescript@*, "typescript@>=3.2.1 <3.8.0 || >3.7.0-dev.0", typescript@^3.7.0-dev.20191021: + version "3.7.0-dev.20191021" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191021.tgz#e0238e0b3eed9fc265767a1b7f5346fea8ab5edb" + integrity sha512-SSx/+QkyW7PMcaGQXzVmVkrRmmaLFsdOYXhP9sY9eYMiHrfmtZE9EL2hjtbihfnpyWfCmPup69VgbB4dTTEQgg== uglify-js@^3.1.4: version "3.6.0" From e54998d5a4583911857722f997c45bab9db0678d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 3 Nov 2019 15:30:40 -0800 Subject: [PATCH 31/47] fix(typescript-estree): improve comment parsing code (#1120) --- packages/typescript-estree/package.json | 3 +- .../typescript-estree/src/convert-comments.ts | 190 +++--------------- packages/typescript-estree/src/node-utils.ts | 35 ---- 3 files changed, 30 insertions(+), 198 deletions(-) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index e28166f1eb88..f4798d0d307e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -43,7 +43,8 @@ "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", - "semver": "^6.3.0" + "semver": "^6.3.0", + "tsutils": "^3.17.1" }, "devDependencies": { "@babel/code-frame": "7.5.5", diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index d3738774cd90..9a7de3e112a7 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -1,82 +1,8 @@ import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports -import { getLocFor, getNodeContainer } from './node-utils'; +import { forEachComment } from 'tsutils'; +import { getLocFor } from './node-utils'; import { TSESTree } from './ts-estree'; -/** - * Converts a TypeScript comment to an Esprima comment. - * @param block True if it's a block comment, false if not. - * @param text The text of the comment. - * @param start The index at which the comment starts. - * @param end The index at which the comment ends. - * @param startLoc The location at which the comment starts. - * @param endLoc The location at which the comment ends. - * @returns The comment object. - * @internal - */ -function convertTypeScriptCommentToEsprimaComment( - block: boolean, - text: string, - start: number, - end: number, - startLoc: TSESTree.LineAndColumnData, - endLoc: TSESTree.LineAndColumnData, -): TSESTree.Comment { - const comment: TSESTree.OptionalRangeAndLoc = { - type: block ? 'Block' : 'Line', - value: text, - }; - - if (typeof start === 'number') { - comment.range = [start, end]; - } - - if (typeof startLoc === 'object') { - comment.loc = { - start: startLoc, - end: endLoc, - }; - } - - return comment as TSESTree.Comment; -} - -/** - * Convert comment from TypeScript Triva Scanner. - * @param triviaScanner TS Scanner - * @param ast the AST object - * @param code TypeScript code - * @returns the converted Comment - * @private - */ -function getCommentFromTriviaScanner( - triviaScanner: ts.Scanner, - ast: ts.SourceFile, - code: string, -): TSESTree.Comment { - const kind = triviaScanner.getToken(); - const isBlock = kind === ts.SyntaxKind.MultiLineCommentTrivia; - const range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos(), - kind: triviaScanner.getToken(), - }; - - const comment = code.substring(range.pos, range.end); - const text = isBlock - ? comment.replace(/^\/\*/, '').replace(/\*\/$/, '') - : comment.replace(/^\/\//, ''); - const loc = getLocFor(range.pos, range.end, ast); - - return convertTypeScriptCommentToEsprimaComment( - isBlock, - text, - range.pos, - range.end, - loc.start, - loc.end, - ); -} - /** * Convert all comments for the given AST. * @param ast the AST object @@ -90,93 +16,33 @@ export function convertComments( ): TSESTree.Comment[] { const comments: TSESTree.Comment[] = []; - /** - * Create a TypeScript Scanner, with skipTrivia set to false so that - * we can parse the comments - */ - const triviaScanner = ts.createScanner( - ast.languageVersion, - false, - ast.languageVariant, - code, + forEachComment( + ast, + (_, comment) => { + const type = + comment.kind == ts.SyntaxKind.SingleLineCommentTrivia + ? 'Line' + : 'Block'; + const range: TSESTree.Range = [comment.pos, comment.end]; + const loc = getLocFor(range[0], range[1], ast); + + // both comments start with 2 characters - /* or // + const textStart = range[0] + 2; + const textEnd = + comment.kind === ts.SyntaxKind.SingleLineCommentTrivia + ? // single line comments end at the end + range[1] - textStart + : // multiline comments end 2 characters early + range[1] - textStart - 2; + comments.push({ + type, + value: code.substr(textStart, textEnd), + range, + loc, + }); + }, + ast, ); - let kind = triviaScanner.scan(); - while (kind !== ts.SyntaxKind.EndOfFileToken) { - const start = triviaScanner.getTokenPos(); - const end = triviaScanner.getTextPos(); - - let container: ts.Node | null = null; - switch (kind) { - case ts.SyntaxKind.SingleLineCommentTrivia: - case ts.SyntaxKind.MultiLineCommentTrivia: { - const comment = getCommentFromTriviaScanner(triviaScanner, ast, code); - - comments.push(comment); - break; - } - case ts.SyntaxKind.GreaterThanToken: - container = getNodeContainer(ast, start, end); - if ( - (container.parent && - container.parent.parent && - // Rescan after an opening element or fragment - (container.parent.kind === ts.SyntaxKind.JsxOpeningElement && - // Make sure this is the end of a tag like `>` - container.parent.end === end)) || - container.parent.kind === ts.SyntaxKind.JsxOpeningFragment || - // Rescan after a self-closing element if it's inside another JSX element - (container.parent.kind === ts.SyntaxKind.JsxSelfClosingElement && - (container.parent.parent.kind === ts.SyntaxKind.JsxElement || - container.parent.parent.kind === ts.SyntaxKind.JsxFragment)) || - // Rescan after a closing element if it's inside another JSX element - ((container.parent.kind === ts.SyntaxKind.JsxClosingElement || - container.parent.kind === ts.SyntaxKind.JsxClosingFragment) && - container.parent.parent.parent && - (container.parent.parent.parent.kind === ts.SyntaxKind.JsxElement || - container.parent.parent.parent.kind === - ts.SyntaxKind.JsxFragment)) - ) { - kind = triviaScanner.reScanJsxToken(); - continue; - } - break; - case ts.SyntaxKind.CloseBraceToken: - container = getNodeContainer(ast, start, end); - - // Rescan after a JSX expression - if ( - container.parent && - container.parent.kind === ts.SyntaxKind.JsxExpression && - container.parent.parent && - container.parent.parent.kind === ts.SyntaxKind.JsxElement - ) { - kind = triviaScanner.reScanJsxToken(); - continue; - } - - if ( - container.kind === ts.SyntaxKind.TemplateMiddle || - container.kind === ts.SyntaxKind.TemplateTail - ) { - kind = triviaScanner.reScanTemplateToken(); - continue; - } - break; - case ts.SyntaxKind.SlashToken: - case ts.SyntaxKind.SlashEqualsToken: - container = getNodeContainer(ast, start, end); - - if (container.kind === ts.SyntaxKind.RegularExpressionLiteral) { - kind = triviaScanner.reScanSlashToken(); - continue; - } - break; - default: - break; - } - kind = triviaScanner.scan(); - } - return comments; } diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 392c08fabb82..da0034ee6ae0 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -612,41 +612,6 @@ export function convertTokens(ast: ts.SourceFile): TSESTree.Token[] { return result; } -/** - * Get container token node between range - * @param ast the AST object - * @param start The index at which the comment starts. - * @param end The index at which the comment ends. - * @returns typescript container token - * @private - */ -export function getNodeContainer( - ast: ts.SourceFile, - start: number, - end: number, -): ts.Node { - let container: ts.Node | null = null; - - /** - * @param node the ts.Node - */ - function walk(node: ts.Node): void { - const nodeStart = node.pos; - const nodeEnd = node.end; - - if (start >= nodeStart && end <= nodeEnd) { - if (isToken(node)) { - container = node; - } else { - node.getChildren().forEach(walk); - } - } - } - walk(ast); - - return container!; -} - export interface TSError { index: number; lineNumber: number; From 643d6d62630a16d189f0673a4bcf34202c7a3fde Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 4 Nov 2019 18:01:48 +0000 Subject: [PATCH 32/47] chore: publish v2.6.1 --- CHANGELOG.md | 13 +++++++++++++ lerna.json | 2 +- 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 | 4 ++-- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 11 +++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 13 +++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 84 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df61feebd24..5e89159a5e78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + + +### Bug Fixes + +* **typescript-estree:** don't use typescript's synthetic default ([#1156](https://github.com/typescript-eslint/typescript-eslint/issues/1156)) ([17c956e](https://github.com/typescript-eslint/typescript-eslint/commit/17c956e)), closes [#1153](https://github.com/typescript-eslint/typescript-eslint/issues/1153) +* **typescript-estree:** fix filename handling for vue JSX + markdown ([#1127](https://github.com/typescript-eslint/typescript-eslint/issues/1127)) ([366518f](https://github.com/typescript-eslint/typescript-eslint/commit/366518f)) +* **typescript-estree:** improve comment parsing code ([#1120](https://github.com/typescript-eslint/typescript-eslint/issues/1120)) ([e54998d](https://github.com/typescript-eslint/typescript-eslint/commit/e54998d)) + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) diff --git a/lerna.json b/lerna.json index f3a88ed9b376..f467fc228a1e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.6.0", + "version": "2.6.1", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index b3a92499169a..bfbc5e387413 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. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) **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 00f7281ffef5..c0432f50ed1b 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": "2.6.0", + "version": "2.6.1", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.6.0", + "@typescript-eslint/experimental-utils": "2.6.1", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.6.0" + "@typescript-eslint/parser": "2.6.1" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 09dfcf804632..bf30ed088fc7 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. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e5ba66ba0408..75b4a0d903f6 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.6.0", + "version": "2.6.1", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.6.0", + "@typescript-eslint/experimental-utils": "2.6.1", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 5d1e618d4424..cabf42dd1a9b 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. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) **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 7cc729040e54..d05bf07280fb 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.6.0", + "version": "2.6.1", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.6.0", + "@typescript-eslint/typescript-estree": "2.6.1", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 6075ce3ac7d5..b6b7fc716a62 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. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + + +### Bug Fixes + +* **typescript-estree:** fix filename handling for vue JSX + markdown ([#1127](https://github.com/typescript-eslint/typescript-eslint/issues/1127)) ([366518f](https://github.com/typescript-eslint/typescript-eslint/commit/366518f)) + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) diff --git a/packages/parser/package.json b/packages/parser/package.json index d6ea0d95f60a..8283ffd33030 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.6.0", + "version": "2.6.1", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.6.0", - "@typescript-eslint/typescript-estree": "2.6.0", + "@typescript-eslint/experimental-utils": "2.6.1", + "@typescript-eslint/typescript-estree": "2.6.1", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.6.0", + "@typescript-eslint/shared-fixtures": "2.6.1", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 87ceff1bc553..320f1ba9ed0c 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. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index a19e0cd1e5a7..9d94966b4e18 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.6.0", + "version": "2.6.1", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index e1232b70926b..c90a056ec276 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) + + +### Bug Fixes + +* **typescript-estree:** don't use typescript's synthetic default ([#1156](https://github.com/typescript-eslint/typescript-eslint/issues/1156)) ([17c956e](https://github.com/typescript-eslint/typescript-eslint/commit/17c956e)), closes [#1153](https://github.com/typescript-eslint/typescript-eslint/issues/1153) +* **typescript-estree:** fix filename handling for vue JSX + markdown ([#1127](https://github.com/typescript-eslint/typescript-eslint/issues/1127)) ([366518f](https://github.com/typescript-eslint/typescript-eslint/commit/366518f)) +* **typescript-estree:** improve comment parsing code ([#1120](https://github.com/typescript-eslint/typescript-eslint/issues/1120)) ([e54998d](https://github.com/typescript-eslint/typescript-eslint/commit/e54998d)) + + + + + # [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index f4798d0d307e..1104de8adbd7 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.6.0", + "version": "2.6.1", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -58,7 +58,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.6.0", + "@typescript-eslint/shared-fixtures": "2.6.1", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 2b2f2d7f4702a7e518d51bef686a716895d4c44d Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 5 Nov 2019 18:19:58 +0200 Subject: [PATCH 33/47] fix(eslint-plugin): crash fixing readonly arrays to generic (#1172) --- .../eslint-plugin/src/rules/array-type.ts | 45 +++++++++++++------ .../tests/rules/array-type.test.ts | 30 +++++++++++++ 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index b9977618c40c..0ed4266a240d 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -146,7 +146,8 @@ export default util.createRule({ return false; } - if (node.range[0] - prevToken.range[1] > 0) { + const nextToken = sourceCode.getTokenAfter(prevToken); + if (nextToken && sourceCode.isSpaceBetweenTokens(prevToken, nextToken)) { return false; } @@ -168,6 +169,21 @@ export default util.createRule({ return 'T'; } + /** + * @param node the node to be evaluated + */ + function getTypeOpNodeRange( + node: TSESTree.Node | null, + ): [number, number] | undefined { + if (!node) { + return undefined; + } + + const firstToken = sourceCode.getFirstToken(node)!; + const nextToken = sourceCode.getTokenAfter(firstToken)!; + return [firstToken.range[0], nextToken.range[0]]; + } + return { TSArrayType(node): void { if ( @@ -208,24 +224,27 @@ export default util.createRule({ type: getMessageType(node.elementType), }, fix(fixer) { - const startText = requireWhitespaceBefore(node); const toFix = [ fixer.replaceTextRange([node.range[1] - 2, node.range[1]], '>'), - fixer.insertTextBefore( - node, - `${startText ? ' ' : ''}${isReadonly ? 'Readonly' : ''}Array<`, - ), ]; - if (typeOpNode) { - // remove the readonly operator if it exists - toFix.unshift( - fixer.removeRange([ - typeOpNode.range[0], - typeOpNode.range[0] + 'readonly '.length, - ]), + const startText = requireWhitespaceBefore(node); + const typeOpNodeRange = getTypeOpNodeRange(typeOpNode); + + if (typeOpNodeRange) { + toFix.unshift(fixer.removeRange(typeOpNodeRange)); + } else { + toFix.push( + fixer.insertTextBefore(node, `${startText ? ' ' : ''}`), ); } + toFix.push( + fixer.insertTextBefore( + node, + `${isReadonly ? 'Readonly' : ''}Array<`, + ), + ); + if (node.elementType.type === AST_NODE_TYPES.TSParenthesizedType) { const first = sourceCode.getFirstToken(node.elementType); const last = sourceCode.getLastToken(node.elementType); diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index 32de7e32c892..86cb1940826b 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -1071,5 +1071,35 @@ class Foo extends Bar implements Baz { `let a: readonly Array[] = []`, 'array', ); + testOutput( + 'generic', + `type T = readonly(string)[]`, + `type T = ReadonlyArray`, + 'generic', + ); + testOutput( + 'generic', + `let a: readonly(readonly string[])[] = []`, + `let a: ReadonlyArray> = []`, + 'generic', + ); + testOutput( + 'generic', + `type T = readonly(readonly string[])[]`, + `type T = ReadonlyArray>`, + 'generic', + ); + testOutput( + 'generic', + `type T = readonly (readonly string[])[]`, + `type T = ReadonlyArray>`, + 'generic', + ); + testOutput( + 'generic', + `type T = readonly (readonly string[])[]`, + `type T = ReadonlyArray>`, + 'generic', + ); }); }); From f63c9c2c31c524e32df27c5895df7a48f40deb6e Mon Sep 17 00:00:00 2001 From: Daniel Ruf <827205+DanielRuf@users.noreply.github.com> Date: Tue, 5 Nov 2019 17:21:38 +0100 Subject: [PATCH 34/47] docs(eslint-plugin): nit make package name more visible (#1173) --- packages/eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index baec8f2426e6..6d874a9c2b1c 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -10,7 +10,7 @@ ## Installation -Make sure you have TypeScript and @typescript-eslint/parser installed, then install the plugin: +Make sure you have TypeScript and `@typescript-eslint/parser` installed, then install the plugin: ```sh npm i @typescript-eslint/eslint-plugin --save-dev From c8fe51575d743ad317a09c18658c79d45059412b Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Wed, 6 Nov 2019 02:46:09 +0200 Subject: [PATCH 35/47] fix(typescript-estree): reduce bundle footprint of tsutils (#1177) --- packages/typescript-estree/src/convert-comments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 9a7de3e112a7..a82d9941dbd3 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -1,5 +1,5 @@ import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports -import { forEachComment } from 'tsutils'; +import { forEachComment } from 'tsutils/util/util'; import { getLocFor } from './node-utils'; import { TSESTree } from './ts-estree'; From 96d1cc3039e2c6402d60ed5443cd392232c23e0b Mon Sep 17 00:00:00 2001 From: IU Date: Sun, 10 Nov 2019 00:47:02 +0800 Subject: [PATCH 36/47] fix(typescript-estree): hash code to reduce update frequency (#1179) --- .../src/create-program/createWatchProgram.ts | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index beabcdd68886..9223107986af 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -45,7 +45,7 @@ const programFileListCache = new Map>(); */ const tsconfigLastModifiedTimestampCache = new Map(); -const parsedFilesSeen = new Set(); +const parsedFilesSeenHash = new Map(); /** * Clear all of the parser caches. @@ -55,7 +55,7 @@ function clearCaches(): void { knownWatchProgramMap.clear(); fileWatchCallbackTrackingMap.clear(); folderWatchCallbackTrackingMap.clear(); - parsedFilesSeen.clear(); + parsedFilesSeenHash.clear(); programFileListCache.clear(); tsconfigLastModifiedTimestampCache.clear(); } @@ -104,6 +104,19 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { ); } +/** + * Hash content for compare content. + * @param content hashed contend + * @returns hashed result + */ +function createHash(content: string): string { + // No ts.sys in browser environments. + if (ts.sys && ts.sys.createHash) { + return ts.sys.createHash(content); + } + return content; +} + /** * Calculate project environments using options provided by consumer and paths from config * @param code The code being linted @@ -125,10 +138,10 @@ function getProgramsForProjects( currentLintOperationState.filePath = filePath; // Update file version if necessary - // TODO: only update when necessary, currently marks as changed on every lint const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); + const codeHash = createHash(code); if ( - parsedFilesSeen.has(filePath) && + parsedFilesSeenHash.get(filePath) !== codeHash && fileWatchCallbacks && fileWatchCallbacks.size > 0 ) { @@ -232,11 +245,15 @@ function createWatchProgram( const oldReadFile = watchCompilerHost.readFile; watchCompilerHost.readFile = (filePathIn, encoding): string | undefined => { const filePath = getCanonicalFileName(filePathIn); - parsedFilesSeen.add(filePath); - return path.normalize(filePath) === + const fileContent = + path.normalize(filePath) === path.normalize(currentLintOperationState.filePath) - ? currentLintOperationState.code - : oldReadFile(filePath, encoding); + ? currentLintOperationState.code + : oldReadFile(filePath, encoding); + if (fileContent) { + parsedFilesSeenHash.set(filePath, createHash(fileContent)); + } + return fileContent; }; // ensure process reports error on failure instead of exiting process immediately From 026ceb991d12a7bf0f37cefee009bf2f408153ec Mon Sep 17 00:00:00 2001 From: Peter Potapov Date: Mon, 11 Nov 2019 20:07:53 +0300 Subject: [PATCH 37/47] feat(parser): handle optional chaining in scope analysis (#1169) Co-authored-by: nizarius Co-authored-by: Brad Zacher --- .../no-restricted-globals.test.ts | 67 +- .../tests/eslint-rules/no-undef.test.ts | 53 +- .../eslint-rules/no-use-before-define.test.ts | 85 ++ packages/parser/src/analyze-scope.ts | 23 + .../lib/__snapshots__/typescript.ts.snap | 1134 +++-------------- 5 files changed, 384 insertions(+), 978 deletions(-) create mode 100644 packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts diff --git a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts index 40f3398fb7df..0cb6ec5d2919 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts @@ -30,6 +30,71 @@ type Handler = (event: string) => any `, options: ['event'], }, + { + code: ` + const a = foo?.bar?.name + `, + }, + { + code: ` + const a = foo?.bar?.name ?? "foobar" + `, + }, + { + code: ` + const a = foo()?.bar; + `, + }, + { + code: ` + const a = foo()?.bar ?? true; + `, + }, + ], + invalid: [ + { + code: ` +function onClick() { + console.log(event); +} + +fdescribe("foo", function() { +}); + `, + options: ['event'], + errors: [ + { + message: "Unexpected use of 'event'.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + { + code: ` +confirm("TEST"); + `, + options: ['confirm'], + errors: [ + { + message: "Unexpected use of 'confirm'.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + { + code: ` +var a = confirm("TEST")?.a; + `, + options: ['confirm'], + errors: [ + { + message: "Unexpected use of 'confirm'.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, ], - invalid: [], }); 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 84626c38201f..38d58b482fd3 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts @@ -68,6 +68,57 @@ function eachr(subject: Object | Array): typeof subject { ` function eachr(subject: Map): typeof subject; `, + ` + var a = { b: 3 }; + var c = a?.b; + `, + ` + var a = { b: { c: 3 } }; + var d = a?.["b"]?.c; + `, + ` + var a = { b: 3 }; + var c = { }; + var d = (a || c)?.b; + `, + ` + var a = { b: () => {} }; + a?.b(); + `, + ], + invalid: [ + { + code: 'a = 5;', + errors: [ + { + messageId: 'undef', + data: { + name: 'a', + }, + }, + ], + }, + { + code: 'a?.b = 5;', + errors: [ + { + messageId: 'undef', + data: { + name: 'a', + }, + }, + ], + }, + { + code: 'a()?.b = 5;', + errors: [ + { + messageId: 'undef', + data: { + name: 'a', + }, + }, + ], + }, ], - invalid: [], }); diff --git a/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts new file mode 100644 index 000000000000..4571cd04afbb --- /dev/null +++ b/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts @@ -0,0 +1,85 @@ +import rule from 'eslint/lib/rules/no-use-before-define'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-use-before-define', rule, { + valid: [ + ` +const updatedAt = data?.updatedAt; + `, + ` +function f() { + return function t() {}; +} +f()?.(); + `, + ` +var a = { b: 5 }; +alert(a?.b); + `, + ], + invalid: [ + { + code: ` +f(); +function f() {} + `, + errors: [ + { + message: "'f' was used before it was defined.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + { + code: ` +alert(a); +var a = 10; + `, + errors: [ + { + message: "'a' was used before it was defined.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + { + code: ` +f()?.(); +function f() { + return function t() {}; +} + `, + errors: [ + { + message: "'f' was used before it was defined.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + { + code: ` +alert(a?.b); +var a = { b: 5 }; + `, + errors: [ + { + message: "'a' was used before it was defined.", + // the base rule doesn't use messageId + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any, + ], + }, + ], +}); diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index 1b98c064db09..27e90a46565d 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -344,6 +344,29 @@ class Referencer extends TSESLintScope.Referencer { node.arguments.forEach(this.visit, this); } + /** + * Visit optional member expression. + * @param node The OptionalMemberExpression node to visit. + */ + OptionalMemberExpression(node: TSESTree.OptionalMemberExpression): void { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + + /** + * Visit optional call expression. + * @param node The OptionalMemberExpression node to visit. + */ + OptionalCallExpression(node: TSESTree.OptionalCallExpression): void { + this.visitTypeParameters(node); + + this.visit(node.callee); + + node.arguments.forEach(this.visit, this); + } + /** * Define the variable of this function declaration only once. * Because to avoid confusion of `no-redeclare` rule by overloading. diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 3d94d81e424b..39f3da70df9c 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -22070,7 +22070,7 @@ Object { exports[`typescript fixtures/basics/optional-chain.src 1`] = ` Object { - "$id": 18, + "$id": 10, "block": Object { "range": Array [ 0, @@ -22080,7 +22080,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 17, + "$id": 9, "block": Object { "range": Array [ 0, @@ -22090,7 +22090,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 16, + "$id": 8, "block": Object { "range": Array [ 0, @@ -22105,7 +22105,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 16, + "$ref": 8, }, "identifier": Object { "name": "one", @@ -22124,24 +22124,7 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 45, - 48, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 16, + "$ref": 8, }, "identifier": Object { "name": "one", @@ -22158,43 +22141,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 6, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 57, - 60, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 61, - 66, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 8, + "$id": 5, "from": Object { - "$ref": 16, + "$ref": 8, }, "identifier": Object { "name": "one", @@ -22211,26 +22160,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 9, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 79, - 84, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 10, + "$id": 6, "from": Object { - "$ref": 16, + "$ref": 8, }, "identifier": Object { "name": "one", @@ -22247,43 +22179,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 11, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 97, - 102, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "four", - "range": Array [ - 103, - 107, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 13, + "$id": 7, "from": Object { - "$ref": 16, + "$ref": 8, }, "identifier": Object { "name": "one", @@ -22299,70 +22197,11 @@ Object { }, "writeExpr": undefined, }, - Object { - "$id": 14, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 120, - 125, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 15, - "from": Object { - "$ref": 16, - }, - "identifier": Object { - "name": "four", - "range": Array [ - 127, - 131, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, ], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 17, + "$ref": 9, }, "variableMap": Object { "arguments": Object { @@ -22373,7 +22212,7 @@ Object { }, }, "variableScope": Object { - "$ref": 16, + "$ref": 8, }, "variables": Array [ Object { @@ -22384,7 +22223,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 16, + "$ref": 8, }, }, Object { @@ -22427,20 +22266,20 @@ Object { "$ref": 3, }, Object { - "$ref": 5, + "$ref": 4, }, Object { - "$ref": 8, + "$ref": 5, }, Object { - "$ref": 10, + "$ref": 6, }, Object { - "$ref": 13, + "$ref": 7, }, ], "scope": Object { - "$ref": 16, + "$ref": 8, }, }, ], @@ -22449,35 +22288,10 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, - ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 18, + "$ref": 10, }, "variableMap": Object { "processOptional": Object { @@ -22485,7 +22299,7 @@ Object { }, }, "variableScope": Object { - "$ref": 17, + "$ref": 9, }, "variables": Array [ Object { @@ -22525,7 +22339,7 @@ Object { "name": "processOptional", "references": Array [], "scope": Object { - "$ref": 17, + "$ref": 9, }, }, ], @@ -22534,37 +22348,12 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, - ], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 18, + "$ref": 10, }, "variables": Array [], } @@ -22572,7 +22361,7 @@ Object { exports[`typescript fixtures/basics/optional-chain-call.src 1`] = ` Object { - "$id": 23, + "$id": 14, "block": Object { "range": Array [ 0, @@ -22582,7 +22371,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 22, + "$id": 13, "block": Object { "range": Array [ 0, @@ -22592,7 +22381,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 21, + "$id": 12, "block": Object { "range": Array [ 0, @@ -22607,7 +22396,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -22626,30 +22415,32 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { - "name": "fn", + "name": "one", "range": Array [ - 49, - 51, + 57, + 60, ], "type": "Identifier", }, "kind": "r", - "resolved": null, + "resolved": Object { + "$ref": 2, + }, "writeExpr": undefined, }, Object { "$id": 5, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", "range": Array [ - 57, - 60, + 74, + 77, ], "type": "Identifier", }, @@ -22662,133 +22453,29 @@ Object { Object { "$id": 6, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { - "name": "two", + "name": "one", "range": Array [ - 62, - 65, + 91, + 94, ], "type": "Identifier", }, "kind": "r", - "resolved": null, + "resolved": Object { + "$ref": 2, + }, "writeExpr": undefined, }, Object { "$id": 7, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { - "name": "fn", - "range": Array [ - 66, - 68, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "one", - "range": Array [ - 74, - 77, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 83, - 85, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "one", - "range": Array [ - 91, - 94, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": undefined, - }, - Object { - "$id": 11, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 100, - 105, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 12, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 106, - 108, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 13, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "one", + "name": "one", "range": Array [ 114, 117, @@ -22802,43 +22489,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 14, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 123, - 128, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 15, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 130, - 132, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 16, + "$id": 8, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -22855,9 +22508,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 17, + "$id": 9, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -22874,9 +22527,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 18, + "$id": 10, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -22893,9 +22546,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 19, + "$id": 11, "from": Object { - "$ref": 21, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -22911,56 +22564,11 @@ Object { }, "writeExpr": undefined, }, - Object { - "$id": 20, - "from": Object { - "$ref": 21, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 187, - 190, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 20, - }, ], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 22, + "$ref": 13, }, "variableMap": Object { "arguments": Object { @@ -22971,7 +22579,7 @@ Object { }, }, "variableScope": Object { - "$ref": 21, + "$ref": 12, }, "variables": Array [ Object { @@ -22982,7 +22590,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 21, + "$ref": 12, }, }, Object { @@ -23025,32 +22633,32 @@ Object { "$ref": 3, }, Object { - "$ref": 5, + "$ref": 4, }, Object { - "$ref": 8, + "$ref": 5, }, Object { - "$ref": 10, + "$ref": 6, }, Object { - "$ref": 13, + "$ref": 7, }, Object { - "$ref": 16, + "$ref": 8, }, Object { - "$ref": 17, + "$ref": 9, }, Object { - "$ref": 18, + "$ref": 10, }, Object { - "$ref": 19, + "$ref": 11, }, ], "scope": Object { - "$ref": 21, + "$ref": 12, }, }, ], @@ -23059,38 +22667,10 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 20, - }, - ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 23, + "$ref": 14, }, "variableMap": Object { "processOptionalCall": Object { @@ -23098,7 +22678,7 @@ Object { }, }, "variableScope": Object { - "$ref": 22, + "$ref": 13, }, "variables": Array [ Object { @@ -23138,7 +22718,7 @@ Object { "name": "processOptionalCall", "references": Array [], "scope": Object { - "$ref": 22, + "$ref": 13, }, }, ], @@ -23147,40 +22727,12 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - Object { - "$ref": 9, - }, - Object { - "$ref": 11, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 14, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 20, - }, - ], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 23, + "$ref": 14, }, "variables": Array [], } @@ -23188,7 +22740,7 @@ Object { exports[`typescript fixtures/basics/optional-chain-call-with-parens.src 1`] = ` Object { - "$id": 20, + "$id": 14, "block": Object { "range": Array [ 0, @@ -23198,7 +22750,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 19, + "$id": 13, "block": Object { "range": Array [ 0, @@ -23208,7 +22760,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 18, + "$id": 12, "block": Object { "range": Array [ 0, @@ -23223,7 +22775,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23242,24 +22794,7 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 56, - 58, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23276,26 +22811,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 6, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 71, - 74, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, + "$id": 5, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23312,26 +22830,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 8, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 94, - 96, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 9, + "$id": 6, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23348,26 +22849,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 10, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 113, - 118, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 11, + "$id": 7, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23384,43 +22868,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 12, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 138, - 143, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 13, - "from": Object { - "$ref": 18, - }, - "identifier": Object { - "name": "fn", - "range": Array [ - 145, - 147, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 14, + "$id": 8, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23437,9 +22887,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 15, + "$id": 9, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23456,9 +22906,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 16, + "$id": 10, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23475,9 +22925,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 17, + "$id": 11, "from": Object { - "$ref": 18, + "$ref": 12, }, "identifier": Object { "name": "one", @@ -23494,29 +22944,10 @@ Object { "writeExpr": undefined, }, ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, - }, - ], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 19, + "$ref": 13, }, "variableMap": Object { "arguments": Object { @@ -23527,7 +22958,7 @@ Object { }, }, "variableScope": Object { - "$ref": 18, + "$ref": 12, }, "variables": Array [ Object { @@ -23538,7 +22969,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 18, + "$ref": 12, }, }, Object { @@ -23581,32 +23012,32 @@ Object { "$ref": 3, }, Object { - "$ref": 5, + "$ref": 4, }, Object { - "$ref": 7, + "$ref": 5, }, Object { - "$ref": 9, + "$ref": 6, }, Object { - "$ref": 11, + "$ref": 7, }, Object { - "$ref": 14, + "$ref": 8, }, Object { - "$ref": 15, + "$ref": 9, }, Object { - "$ref": 16, + "$ref": 10, }, Object { - "$ref": 17, + "$ref": 11, }, ], "scope": Object { - "$ref": 18, + "$ref": 12, }, }, ], @@ -23615,29 +23046,10 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, - }, - ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 20, + "$ref": 14, }, "variableMap": Object { "processOptionalCallParens": Object { @@ -23645,7 +23057,7 @@ Object { }, }, "variableScope": Object { - "$ref": 19, + "$ref": 13, }, "variables": Array [ Object { @@ -23676,49 +23088,30 @@ Object { Object { "name": "processOptionalCallParens", "range": Array [ - 9, - 34, - ], - "type": "Identifier", - }, - ], - "name": "processOptionalCallParens", - "references": Array [], - "scope": Object { - "$ref": 19, - }, - }, - ], - }, - ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, + 9, + 34, + ], + "type": "Identifier", + }, + ], + "name": "processOptionalCallParens", + "references": Array [], + "scope": Object { + "$ref": 13, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 20, + "$ref": 14, }, "variables": Array [], } @@ -24352,7 +23745,7 @@ Object { exports[`typescript fixtures/basics/optional-chain-with-parens.src 1`] = ` Object { - "$id": 19, + "$id": 11, "block": Object { "range": Array [ 0, @@ -24362,7 +23755,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 18, + "$id": 10, "block": Object { "range": Array [ 0, @@ -24372,7 +23765,7 @@ Object { }, "childScopes": Array [ Object { - "$id": 17, + "$id": 9, "block": Object { "range": Array [ 0, @@ -24387,7 +23780,7 @@ Object { Object { "$id": 3, "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24406,24 +23799,7 @@ Object { Object { "$id": 4, "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 52, - 55, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 5, - "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24440,26 +23816,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 6, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "two", - "range": Array [ - 66, - 69, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 7, + "$id": 5, "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24476,26 +23835,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 8, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 90, - 95, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 9, + "$id": 6, "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24512,26 +23854,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 10, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 110, - 115, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 11, + "$id": 7, "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24548,43 +23873,9 @@ Object { "writeExpr": undefined, }, Object { - "$id": 12, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 135, - 140, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 13, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "four", - "range": Array [ - 142, - 146, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 14, + "$id": 8, "from": Object { - "$ref": 17, + "$ref": 9, }, "identifier": Object { "name": "one", @@ -24600,70 +23891,11 @@ Object { }, "writeExpr": undefined, }, - Object { - "$id": 15, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "three", - "range": Array [ - 161, - 166, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - Object { - "$id": 16, - "from": Object { - "$ref": 17, - }, - "identifier": Object { - "name": "four", - "range": Array [ - 168, - 172, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 16, - }, ], + "throughReferences": Array [], "type": "function", "upperScope": Object { - "$ref": 18, + "$ref": 10, }, "variableMap": Object { "arguments": Object { @@ -24674,7 +23906,7 @@ Object { }, }, "variableScope": Object { - "$ref": 17, + "$ref": 9, }, "variables": Array [ Object { @@ -24685,7 +23917,7 @@ Object { "name": "arguments", "references": Array [], "scope": Object { - "$ref": 17, + "$ref": 9, }, }, Object { @@ -24728,23 +23960,23 @@ Object { "$ref": 3, }, Object { - "$ref": 5, + "$ref": 4, }, Object { - "$ref": 7, + "$ref": 5, }, Object { - "$ref": 9, + "$ref": 6, }, Object { - "$ref": 11, + "$ref": 7, }, Object { - "$ref": 14, + "$ref": 8, }, ], "scope": Object { - "$ref": 17, + "$ref": 9, }, }, ], @@ -24753,35 +23985,10 @@ Object { "functionExpressionScope": false, "isStrict": true, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 16, - }, - ], + "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 19, + "$ref": 11, }, "variableMap": Object { "processOptionalParens": Object { @@ -24789,7 +23996,7 @@ Object { }, }, "variableScope": Object { - "$ref": 18, + "$ref": 10, }, "variables": Array [ Object { @@ -24829,7 +24036,7 @@ Object { "name": "processOptionalParens", "references": Array [], "scope": Object { - "$ref": 18, + "$ref": 10, }, }, ], @@ -24838,37 +24045,12 @@ Object { "functionExpressionScope": false, "isStrict": false, "references": Array [], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - Object { - "$ref": 6, - }, - Object { - "$ref": 8, - }, - Object { - "$ref": 10, - }, - Object { - "$ref": 12, - }, - Object { - "$ref": 13, - }, - Object { - "$ref": 15, - }, - Object { - "$ref": 16, - }, - ], + "throughReferences": Array [], "type": "global", "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 19, + "$ref": 11, }, "variables": Array [], } From 57d63b7488f6b21f0f2d38aa27e14146ea6d2ed0 Mon Sep 17 00:00:00 2001 From: Peter Potapov Date: Mon, 11 Nov 2019 20:36:52 +0300 Subject: [PATCH 38/47] feat(eslint-plugin): [no-unused-expressions] extend for optional chaining (#1175) --- packages/eslint-plugin/README.md | 5 +- .../docs/rules/no-unused-expressions.md | 25 +++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/no-unused-expressions.ts | 33 ++++ .../tests/rules/no-unused-expressions.test.ts | 180 ++++++++++++++++++ .../eslint-plugin/typings/eslint-rules.d.ts | 20 ++ 7 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 packages/eslint-plugin/docs/rules/no-unused-expressions.md create mode 100644 packages/eslint-plugin/src/rules/no-unused-expressions.ts create mode 100644 packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 6d874a9c2b1c..b616245454e6 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -145,7 +145,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | :heavy_check_mark: | | | | [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | +| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | | [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | | [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions. | :heavy_check_mark: | | | @@ -181,6 +181,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Warns if an explicitly specified type argument is the default for that type parameter | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | | [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | | [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | | [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | @@ -193,7 +194,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | | :thought_balloon: | -| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | +| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | | [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Enforce giving `compare` argument to `Array#sort` | | | :thought_balloon: | | [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/no-unused-expressions.md b/packages/eslint-plugin/docs/rules/no-unused-expressions.md new file mode 100644 index 000000000000..7da998ab2c6c --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unused-expressions.md @@ -0,0 +1,25 @@ +# require or disallow semicolons instead of ASI (semi) + +This rule aims to eliminate unused expressions which have no effect on the state of the program. + +## Rule Details + +This rule extends the base [eslint/no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions) rule. +It supports all options and features of the base rule. +This version adds support for numerous typescript features. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "no-unused-expressions": "off", + "@typescript-eslint/no-unused-expressions": ["error"] +} +``` + +## Options + +See [eslint/no-unused-expressions options](https://eslint.org/docs/rules/no-unused-expressions#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-unused-expressions.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 377f4b58f0e4..395c1af592ed 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -50,6 +50,7 @@ "@typescript-eslint/no-unnecessary-qualifier": "error", "@typescript-eslint/no-unnecessary-type-arguments": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/no-unused-expressions": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error", "no-use-before-define": "off", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 5302abd05de0..4aa8beea1f63 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -39,6 +39,7 @@ import noUnnecessaryCondition from './no-unnecessary-condition'; import noUnnecessaryQualifier from './no-unnecessary-qualifier'; import noUnnecessaryTypeAssertion from './no-unnecessary-type-assertion'; import noUnusedVars from './no-unused-vars'; +import noUnusedExpressions from './no-unused-expressions'; import noUseBeforeDefine from './no-use-before-define'; import noUselessConstructor from './no-useless-constructor'; import noVarRequires from './no-var-requires'; @@ -106,6 +107,7 @@ export default { 'no-unnecessary-type-arguments': useDefaultTypeParameter, 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion, 'no-unused-vars': noUnusedVars, + 'no-unused-expressions': noUnusedExpressions, 'no-use-before-define': noUseBeforeDefine, 'no-useless-constructor': noUselessConstructor, 'no-var-requires': noVarRequires, diff --git a/packages/eslint-plugin/src/rules/no-unused-expressions.ts b/packages/eslint-plugin/src/rules/no-unused-expressions.ts new file mode 100644 index 000000000000..f7d86f50c1c7 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unused-expressions.ts @@ -0,0 +1,33 @@ +import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/no-unused-expressions'; +import * as util from '../util'; + +export default util.createRule({ + name: 'no-unused-expressions', + meta: { + type: 'suggestion', + docs: { + description: 'Disallow unused expressions', + category: 'Best Practices', + recommended: false, + }, + schema: baseRule.meta.schema, + messages: { + expected: + 'Expected an assignment or function call and instead saw an expression.', + }, + }, + defaultOptions: [], + create(context) { + const rules = baseRule.create(context); + + return { + ExpressionStatement(node): void { + if (node.expression.type === AST_NODE_TYPES.OptionalCallExpression) { + return; + } + rules.ExpressionStatement(node); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts new file mode 100644 index 000000000000..46653b30c663 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts @@ -0,0 +1,180 @@ +import rule from '../../src/rules/no-unused-expressions'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, + parser: '@typescript-eslint/parser', +}); + +// the base rule doesn't have messageIds +function error( + messages: { line: number; column: number }[], + // eslint-disable-next-line @typescript-eslint/no-explicit-any +): any[] { + return messages.map(message => ({ + ...message, + message: + 'Expected an assignment or function call and instead saw an expression.', + })); +} + +ruleTester.run('no-unused-expressions', rule, { + valid: [ + ` + test.age?.toLocaleString(); + `, + ` + let a = (a?.b).c; + `, + ` + let b = a?.['b']; + `, + ` + let c = one[2]?.[3][4]; + `, + ` + one[2]?.[3][4]?.(); + `, + ` + a?.['b']?.c(); + `, + ], + invalid: [ + { + code: ` +if(0) 0 + `, + errors: error([ + { + line: 2, + column: 7, + }, + ]), + }, + { + code: ` +f(0), {} + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +a, b() + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +a() && function namedFunctionInExpressionContext () {f();} + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +a?.b + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +(a?.b).c + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +a?.['b'] + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +(a?.['b']).c + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +a?.b()?.c + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +(a?.b()).c + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +one[2]?.[3][4]; + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + { + code: ` +one.two?.three.four; + `, + errors: error([ + { + line: 2, + column: 1, + }, + ]), + }, + ], +}); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 120b11433cb9..c21b235be448 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -304,6 +304,26 @@ declare module 'eslint/lib/rules/no-unused-vars' { export = rule; } +declare module 'eslint/lib/rules/no-unused-expressions' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + 'expected', + ( + | 'all' + | 'local' + | { + allowShortCircuit?: boolean; + allowTernary?: boolean; + allowTaggedTemplates?: boolean; + })[], + { + ExpressionStatement(node: TSESTree.ExpressionStatement): void; + } + >; + export = rule; +} + declare module 'eslint/lib/rules/no-use-before-define' { import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; From 62b5a942f40472135d1b246f960ff1aed77f7307 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 11 Nov 2019 18:01:31 +0000 Subject: [PATCH 39/47] chore: publish v2.7.0 --- CHANGELOG.md | 19 +++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 17 +++++++++++++++++ packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 11 +++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 12 ++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 98 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e89159a5e78..f800e619f2dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + + +### Bug Fixes + +* **eslint-plugin:** crash fixing readonly arrays to generic ([#1172](https://github.com/typescript-eslint/typescript-eslint/issues/1172)) ([2b2f2d7](https://github.com/typescript-eslint/typescript-eslint/commit/2b2f2d7)) +* **typescript-estree:** hash code to reduce update frequency ([#1179](https://github.com/typescript-eslint/typescript-eslint/issues/1179)) ([96d1cc3](https://github.com/typescript-eslint/typescript-eslint/commit/96d1cc3)) +* **typescript-estree:** reduce bundle footprint of tsutils ([#1177](https://github.com/typescript-eslint/typescript-eslint/issues/1177)) ([c8fe515](https://github.com/typescript-eslint/typescript-eslint/commit/c8fe515)) + + +### Features + +* **eslint-plugin:** [no-unused-expressions] extend for optional chaining ([#1175](https://github.com/typescript-eslint/typescript-eslint/issues/1175)) ([57d63b7](https://github.com/typescript-eslint/typescript-eslint/commit/57d63b7)) +* **parser:** handle optional chaining in scope analysis ([#1169](https://github.com/typescript-eslint/typescript-eslint/issues/1169)) ([026ceb9](https://github.com/typescript-eslint/typescript-eslint/commit/026ceb9)) + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) diff --git a/lerna.json b/lerna.json index f467fc228a1e..991899f51336 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.6.1", + "version": "2.7.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index bfbc5e387413..9613287c0606 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. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-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 c0432f50ed1b..b23071880ad8 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": "2.6.1", + "version": "2.7.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.6.1", + "@typescript-eslint/experimental-utils": "2.7.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.6.1" + "@typescript-eslint/parser": "2.7.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index bf30ed088fc7..1759b88a3c13 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + + +### Bug Fixes + +* **eslint-plugin:** crash fixing readonly arrays to generic ([#1172](https://github.com/typescript-eslint/typescript-eslint/issues/1172)) ([2b2f2d7](https://github.com/typescript-eslint/typescript-eslint/commit/2b2f2d7)) + + +### Features + +* **eslint-plugin:** [no-unused-expressions] extend for optional chaining ([#1175](https://github.com/typescript-eslint/typescript-eslint/issues/1175)) ([57d63b7](https://github.com/typescript-eslint/typescript-eslint/commit/57d63b7)) +* **parser:** handle optional chaining in scope analysis ([#1169](https://github.com/typescript-eslint/typescript-eslint/issues/1169)) ([026ceb9](https://github.com/typescript-eslint/typescript-eslint/commit/026ceb9)) + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-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 75b4a0d903f6..b315da580591 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.6.1", + "version": "2.7.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.6.1", + "@typescript-eslint/experimental-utils": "2.7.0", "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index cabf42dd1a9b..fa483c6bd8f4 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. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-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 d05bf07280fb..2bbb6ddc9ec3 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.6.1", + "version": "2.7.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.6.1", + "@typescript-eslint/typescript-estree": "2.7.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index b6b7fc716a62..45ba8b728f68 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. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + + +### Features + +* **parser:** handle optional chaining in scope analysis ([#1169](https://github.com/typescript-eslint/typescript-eslint/issues/1169)) ([026ceb9](https://github.com/typescript-eslint/typescript-eslint/commit/026ceb9)) + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) diff --git a/packages/parser/package.json b/packages/parser/package.json index 8283ffd33030..549dda9e82fc 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.6.1", + "version": "2.7.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.6.1", - "@typescript-eslint/typescript-estree": "2.6.1", + "@typescript-eslint/experimental-utils": "2.7.0", + "@typescript-eslint/typescript-estree": "2.7.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.6.1", + "@typescript-eslint/shared-fixtures": "2.7.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 320f1ba9ed0c..aa253e3d46ee 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. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-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 9d94966b4e18..c457e83d4dd3 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.6.1", + "version": "2.7.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index c90a056ec276..28d91bddc6b1 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) + + +### Bug Fixes + +* **typescript-estree:** hash code to reduce update frequency ([#1179](https://github.com/typescript-eslint/typescript-eslint/issues/1179)) ([96d1cc3](https://github.com/typescript-eslint/typescript-eslint/commit/96d1cc3)) +* **typescript-estree:** reduce bundle footprint of tsutils ([#1177](https://github.com/typescript-eslint/typescript-eslint/issues/1177)) ([c8fe515](https://github.com/typescript-eslint/typescript-eslint/commit/c8fe515)) + + + + + ## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 1104de8adbd7..85a3a2b92b10 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.6.1", + "version": "2.7.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -58,7 +58,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.6.1", + "@typescript-eslint/shared-fixtures": "2.7.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 864c81100f754301e59272d549649bf62faa47a5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 11 Nov 2019 20:49:18 -0500 Subject: [PATCH 40/47] feat(eslint-plugin): added new rule no-dynamic-delete (#565) Co-authored-by: Josh Goldberg Co-authored-by: Brad Zacher --- packages/eslint-plugin/README.md | 1 + packages/eslint-plugin/ROADMAP.md | 3 +- .../docs/rules/no-dynamic-delete.md | 49 ++++++++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/no-dynamic-delete.ts | 109 ++++++++++++++++++ .../tests/rules/no-dynamic-delete.test.ts | 105 +++++++++++++++++ 7 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 packages/eslint-plugin/docs/rules/no-dynamic-delete.md create mode 100644 packages/eslint-plugin/src/rules/no-dynamic-delete.ts create mode 100644 packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index b616245454e6..75feac4ee49e 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -160,6 +160,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/member-naming`](./docs/rules/member-naming.md) | Enforces naming conventions for class members by visibility | | | | | [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | | [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-dynamic-delete`](./docs/rules/no-dynamic-delete.md) | Bans usage of the delete operator with computed key expressions | | :wrench: | | | [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :heavy_check_mark: | | | | [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | | | | [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | :wrench: | | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 06326a5439ec..82e7737feb55 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -60,7 +60,7 @@ | [`no-duplicate-super`] | 🌟 | [`constructor-super`][constructor-super] | | [`no-duplicate-switch-case`] | 🌟 | [`no-duplicate-case`][no-duplicate-case] | | [`no-duplicate-variable`] | 🌟 | [`no-redeclare`][no-redeclare] | -| [`no-dynamic-delete`] | 🛑 | N/A | +| [`no-dynamic-delete`] | ✅ | [`@typescript-eslint/no-dynamic-delete`] | | [`no-empty`] | 🌟 | [`no-empty`][no-empty] | | [`no-eval`] | 🌟 | [`no-eval`][no-eval] | | [`no-floating-promises`] | ✅ | [`@typescript-eslint/no-floating-promises`] | @@ -613,6 +613,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/member-delimiter-style`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md [`@typescript-eslint/prefer-for-of`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md [`@typescript-eslint/no-array-constructor`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md +[`@typescript-eslint/no-dynamic-delete`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dynamic-delete.md [`@typescript-eslint/prefer-function-type`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md [`@typescript-eslint/prefer-readonly`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md [`@typescript-eslint/require-await`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md diff --git a/packages/eslint-plugin/docs/rules/no-dynamic-delete.md b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md new file mode 100644 index 000000000000..630046823387 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-dynamic-delete.md @@ -0,0 +1,49 @@ +# Disallow the delete operator with computed key expressions (no-dynamic-delete) + +Deleting dynamically computed keys can be dangerous and in some cases not well optimized. + +## Rule Details + +Using the `delete` operator on keys that aren't runtime constants could be a sign that you're using the wrong data structures. +Using `Object`s with added and removed keys can cause occasional edge case bugs, such as if a key is named `"hasOwnProperty"`. +Consider using a `Map` or `Set` if you’re storing collections of objects. + +Examples of **correct** code wth this rule: + +```ts +const container: { [i: string]: number } = { + /* ... */ +}; + +// Constant runtime lookups by string index +delete container.aaa; + +// Constants that must be accessed by [] +delete container[7]; +delete container['-Infinity']; +``` + +Examples of **incorrect** code with this rule: + +```ts +// Can be replaced with the constant equivalents, such as container.aaa +delete container['aaa']; +delete container['Infinity']; + +// Dynamic, difficult-to-reason-about lookups +const name = 'name'; +delete container[name]; +delete container[name.toUpperCase()]; +``` + +## When Not To Use It + +When you know your keys are safe to delete, this rule can be unnecessary. +Some environments such as older browsers might not support `Map` and `Set`. + +Do not consider this rule as performance advice before profiling your code's bottlenecks. +Even repeated minor performance slowdowns likely do not significantly affect your application's general perceived speed. + +## Related to + +- TSLint: [no-dynamic-delete](https://palantir.github.io/tslint/rules/no-dynamic-delete) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 395c1af592ed..c7e9a99bc765 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -26,6 +26,7 @@ "@typescript-eslint/member-ordering": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "@typescript-eslint/no-dynamic-delete": "error", "no-empty-function": "off", "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 4aa8beea1f63..11c774610a00 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -18,6 +18,7 @@ import memberDelimiterStyle from './member-delimiter-style'; import memberNaming from './member-naming'; import memberOrdering from './member-ordering'; import noArrayConstructor from './no-array-constructor'; +import noDynamicDelete from './no-dynamic-delete'; import noEmptyFunction from './no-empty-function'; import noEmptyInterface from './no-empty-interface'; import noExplicitAny from './no-explicit-any'; @@ -85,6 +86,7 @@ export default { 'member-naming': memberNaming, 'member-ordering': memberOrdering, 'no-array-constructor': noArrayConstructor, + 'no-dynamic-delete': noDynamicDelete, 'no-empty-function': noEmptyFunction, 'no-empty-interface': noEmptyInterface, 'no-explicit-any': noExplicitAny, diff --git a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts new file mode 100644 index 000000000000..0ee1636ea643 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts @@ -0,0 +1,109 @@ +import { + TSESTree, + AST_NODE_TYPES, + TSESLint, +} from '@typescript-eslint/experimental-utils'; +import * as tsutils from 'tsutils'; +import * as util from '../util'; + +export default util.createRule({ + name: 'no-dynamic-delete', + meta: { + docs: { + category: 'Best Practices', + description: + 'Bans usage of the delete operator with computed key expressions', + recommended: false, + }, + fixable: 'code', + messages: { + dynamicDelete: 'Do not delete dynamically computed property keys.', + }, + schema: [], + type: 'suggestion', + }, + defaultOptions: [], + create(context) { + function createFixer( + member: TSESTree.MemberExpression, + ): TSESLint.ReportFixFunction | undefined { + if ( + member.property.type === AST_NODE_TYPES.Literal && + typeof member.property.value === 'string' + ) { + return createPropertyReplacement( + member.property, + member.property.value, + ); + } + + if (member.property.type === AST_NODE_TYPES.Identifier) { + return createPropertyReplacement(member.property, member.property.name); + } + + return undefined; + } + + return { + 'UnaryExpression[operator=delete]'(node: TSESTree.UnaryExpression): void { + if ( + node.argument.type !== AST_NODE_TYPES.MemberExpression || + !node.argument.computed || + isNecessaryDynamicAccess( + diveIntoWrapperExpressions(node.argument.property), + ) + ) { + return; + } + + context.report({ + fix: createFixer(node.argument), + messageId: 'dynamicDelete', + node: node.argument.property, + }); + }, + }; + + function createPropertyReplacement( + property: TSESTree.Expression, + replacement: string, + ) { + return (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => + fixer.replaceTextRange(getTokenRange(property), `.${replacement}`); + } + + function getTokenRange(property: TSESTree.Expression): [number, number] { + const sourceCode = context.getSourceCode(); + + return [ + sourceCode.getTokenBefore(property)!.range[0], + sourceCode.getTokenAfter(property)!.range[1], + ]; + } + }, +}); + +function diveIntoWrapperExpressions( + node: TSESTree.Expression, +): TSESTree.Expression { + if (node.type === AST_NODE_TYPES.UnaryExpression) { + return diveIntoWrapperExpressions(node.argument); + } + + return node; +} + +function isNecessaryDynamicAccess(property: TSESTree.Expression): boolean { + if (property.type !== AST_NODE_TYPES.Literal) { + return false; + } + + if (typeof property.value === 'number') { + return true; + } + + return ( + typeof property.value === 'string' && + !tsutils.isValidPropertyAccess(property.value) + ); +} diff --git a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts new file mode 100644 index 000000000000..e3b4e5366e8b --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts @@ -0,0 +1,105 @@ +import path from 'path'; +import rule from '../../src/rules/no-dynamic-delete'; +import { RuleTester } from '../RuleTester'; + +const rootDir = path.join(process.cwd(), 'tests/fixtures'); +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 2015, + tsconfigRootDir: rootDir, + project: './tsconfig.json', + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-dynamic-delete', rule, { + valid: [ + `const container: { [i: string]: 0 } = {}; + delete container.aaa;`, + `const container: { [i: string]: 0 } = {}; + delete container.delete;`, + `const container: { [i: string]: 0 } = {}; + delete container[7];`, + `const container: { [i: string]: 0 } = {}; + delete container[-7];`, + `const container: { [i: string]: 0 } = {}; + delete container[+7];`, + `const container: { [i: string]: 0 } = {}; + delete container['-Infinity'];`, + `const container: { [i: string]: 0 } = {}; + delete container['+Infinity'];`, + `const value = 1; + delete value;`, + `const value = 1; + delete -value;`, + ], + invalid: [ + { + code: `const container: { [i: string]: 0 } = {}; + delete container['aaa'];`, + errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container.aaa;`, + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container [ 'aaa' ] ;`, + errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container .aaa ;`, + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container['aa' + 'b'];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container['delete'];`, + errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container.delete;`, + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container[-Infinity];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container[+Infinity];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container[NaN];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container['NaN'];`, + errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container.NaN;`, + }, + { + code: `const container: { [i: string]: 0 } = {}; + delete container [ 'NaN' ] ;`, + errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container .NaN ;`, + }, + { + code: `const container: { [i: string]: 0 } = {}; + const name = 'name'; + delete container[name];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + const getName = () => 'aaa'; + delete container[getName()];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + ], +}); From db1aa185c91a391d4593819a22d034ae40b79198 Mon Sep 17 00:00:00 2001 From: Nimalan Date: Tue, 12 Nov 2019 07:20:53 +0530 Subject: [PATCH 41/47] fix(typescript-estree): options range loc being always true (#704) Co-authored-by: Brad Zacher --- packages/parser/src/analyze-scope.ts | 2 +- packages/parser/src/parser.ts | 4 +- packages/typescript-estree/package.json | 1 + .../typescript-estree/src/ast-converter.ts | 17 +++ packages/typescript-estree/src/parser.ts | 2 + .../src/simple-traverse.ts | 2 +- .../src/visitor-keys.ts | 0 .../tests/lib/__snapshots__/parse.ts.snap | 122 ++++++++++++++++++ packages/typescript-estree/tests/lib/parse.ts | 16 +++ .../tests/lib/visitor-keys.ts | 2 +- 10 files changed, 163 insertions(+), 5 deletions(-) rename packages/{parser => typescript-estree}/src/simple-traverse.ts (95%) rename packages/{parser => typescript-estree}/src/visitor-keys.ts (100%) rename packages/{parser => typescript-estree}/tests/lib/visitor-keys.ts (92%) diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index 27e90a46565d..67d553fac465 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -7,7 +7,7 @@ import { getKeys as fallback } from 'eslint-visitor-keys'; import { ParserOptions } from './parser-options'; import { ScopeManager } from './scope/scope-manager'; -import { visitorKeys as childVisitorKeys } from './visitor-keys'; +import { visitorKeys as childVisitorKeys } from '@typescript-eslint/typescript-estree'; /** * Define the override function of `Scope#__define` for global augmentation. diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index bcb6dde759a4..46878a9cdea7 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -5,10 +5,10 @@ import { ParserServices, TSESTreeOptions, TSESTree, + simpleTraverse, + visitorKeys, } from '@typescript-eslint/typescript-estree'; import { analyzeScope } from './analyze-scope'; -import { simpleTraverse } from './simple-traverse'; -import { visitorKeys } from './visitor-keys'; type ParserOptions = TSESLint.ParserOptions; diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 85a3a2b92b10..45386970cfa2 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -40,6 +40,7 @@ }, "dependencies": { "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index fffb9ea15cfd..270d50dde3f7 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -4,6 +4,7 @@ import { convertComments } from './convert-comments'; import { convertTokens } from './node-utils'; import { Extra } from './parser-options'; import { TSESTree } from './ts-estree'; +import { simpleTraverse } from './simple-traverse'; export function astConverter( ast: SourceFile, @@ -32,6 +33,22 @@ export function astConverter( const estree = instance.convertProgram(); + /** + * Optionally remove range and loc if specified + */ + if (extra.range || extra.loc) { + simpleTraverse(estree, { + enter: node => { + if (!extra.range) { + delete node.range; + } + if (!extra.loc) { + delete node.loc; + } + }, + }); + } + /** * Optionally convert and include all tokens in the AST */ diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 141ba25cce6a..0ef765ed8b64 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -419,5 +419,7 @@ export { TSESTreeOptions, version, }; +export { simpleTraverse } from './simple-traverse'; +export { visitorKeys } from './visitor-keys'; export * from './ts-estree'; export { clearCaches } from './create-program/createWatchProgram'; diff --git a/packages/parser/src/simple-traverse.ts b/packages/typescript-estree/src/simple-traverse.ts similarity index 95% rename from packages/parser/src/simple-traverse.ts rename to packages/typescript-estree/src/simple-traverse.ts index a616f239a7b4..e21d24d0de8b 100644 --- a/packages/parser/src/simple-traverse.ts +++ b/packages/typescript-estree/src/simple-traverse.ts @@ -1,4 +1,4 @@ -import { TSESTree } from '@typescript-eslint/typescript-estree'; +import { TSESTree } from './ts-estree'; import { visitorKeys } from './visitor-keys'; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/parser/src/visitor-keys.ts b/packages/typescript-estree/src/visitor-keys.ts similarity index 100% rename from packages/parser/src/visitor-keys.ts rename to packages/typescript-estree/src/visitor-keys.ts diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index e953f852a8e9..c09d5159cd4b 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -1,5 +1,127 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`parse() general output should not contain loc 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "name": "bar", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`parse() general output should not contain range 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "sourceType": "script", + "type": "Program", +} +`; + exports[`parse() general output tokens, comments, locs, and ranges when called with those options 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index 53197b7a73d8..ebfb922b8392 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -37,6 +37,22 @@ describe('parse()', () => { 'output tokens, comments, locs, and ranges when called with those options', createSnapshotTestBlock(code, config), ); + + it( + 'output should not contain loc', + createSnapshotTestBlock(code, { + range: true, + loc: false, + }), + ); + + it( + 'output should not contain range', + createSnapshotTestBlock(code, { + range: false, + loc: true, + }), + ); }); describe('non string code', () => { diff --git a/packages/parser/tests/lib/visitor-keys.ts b/packages/typescript-estree/tests/lib/visitor-keys.ts similarity index 92% rename from packages/parser/tests/lib/visitor-keys.ts rename to packages/typescript-estree/tests/lib/visitor-keys.ts index fd8ab4970f9b..6d16e90d00bf 100644 --- a/packages/parser/tests/lib/visitor-keys.ts +++ b/packages/typescript-estree/tests/lib/visitor-keys.ts @@ -1,4 +1,4 @@ -import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; +import { AST_NODE_TYPES } from '../../src/ts-estree'; import { visitorKeys } from '../../src/visitor-keys'; //------------------------------------------------------------------------------ From c5835f332c4c63af778b4064a6c524840deb690b Mon Sep 17 00:00:00 2001 From: Eran Shabi Date: Tue, 12 Nov 2019 04:20:28 +0200 Subject: [PATCH 42/47] feat(eslint-plugin): added new rule no-untyped-public-signature (#801) Co-authored-by: Brad Zacher --- packages/eslint-plugin/README.md | 1 + .../docs/rules/no-untyped-public-signature.md | 57 +++++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/no-untyped-public-signature.ts | 120 ++++++++++ .../rules/no-untyped-public-signature.test.ts | 210 ++++++++++++++++++ 6 files changed, 391 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/no-untyped-public-signature.md create mode 100644 packages/eslint-plugin/src/rules/no-untyped-public-signature.ts create mode 100644 packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 75feac4ee49e..20d3d817a218 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -182,6 +182,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Warns if an explicitly specified type argument is the default for that type parameter | | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-untyped-public-signature`](./docs/rules/no-untyped-public-signature.md) | Requires that all public method arguments and return type will be explicitly typed | | | | | [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | | [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | | [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | diff --git a/packages/eslint-plugin/docs/rules/no-untyped-public-signature.md b/packages/eslint-plugin/docs/rules/no-untyped-public-signature.md new file mode 100644 index 000000000000..7ffafd5a5ae7 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-untyped-public-signature.md @@ -0,0 +1,57 @@ +# Disallow untyped public methods (no-untyped-public-signature) + +public methods are meant to be used by code outside of your class. By typing both the parameters and the return type of public methods they will be more readable and easy to use. + +## Rule Details + +This rule aims to ensure that only typed public methods are declared in the code. + +The following patterns are considered warnings: + +```ts +// untyped parameter +public foo(param1): void { +} + +// untyped parameter +public foo(param1: any): void { +} + +// untyped return type +public foo(param1: string) { +} + +// untyped return type +public foo(param1: string): any { +} +``` + +The following patterns are not warnings: + +```ts +// typed public method +public foo(param1: string): void { +} + +// untyped private method +private foo(param1) { +} +``` + +## Options + +This rule, in its default state, does not require any argument. + +### ignoredMethods + +You may pass method names you would like this rule to ignore, like so: + +```cjson +{ + "@typescript-eslint/no-untyped-public-signature": ["error", { "ignoredMethods": ["ignoredMethodName"] }] +} +``` + +## When Not To Use It + +If you don't wish to type public methods. diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index c7e9a99bc765..84c450b0723a 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -51,6 +51,7 @@ "@typescript-eslint/no-unnecessary-qualifier": "error", "@typescript-eslint/no-unnecessary-type-arguments": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/no-untyped-public-signature": "error", "@typescript-eslint/no-unused-expressions": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 11c774610a00..87d02d56a3bf 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -40,6 +40,7 @@ import noUnnecessaryCondition from './no-unnecessary-condition'; import noUnnecessaryQualifier from './no-unnecessary-qualifier'; import noUnnecessaryTypeAssertion from './no-unnecessary-type-assertion'; import noUnusedVars from './no-unused-vars'; +import noUntypedPublicSignature from './no-untyped-public-signature'; import noUnusedExpressions from './no-unused-expressions'; import noUseBeforeDefine from './no-use-before-define'; import noUselessConstructor from './no-useless-constructor'; @@ -108,6 +109,7 @@ export default { 'no-unnecessary-qualifier': noUnnecessaryQualifier, 'no-unnecessary-type-arguments': useDefaultTypeParameter, 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion, + 'no-untyped-public-signature': noUntypedPublicSignature, 'no-unused-vars': noUnusedVars, 'no-unused-expressions': noUnusedExpressions, 'no-use-before-define': noUseBeforeDefine, diff --git a/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts b/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts new file mode 100644 index 000000000000..2ecb1cbd62c6 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts @@ -0,0 +1,120 @@ +import * as util from '../util'; +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; + +type MessageIds = 'noReturnType' | 'untypedParameter'; + +type Options = [{ ignoredMethods: string[] }]; + +export default util.createRule({ + name: 'no-unused-public-signature', + meta: { + docs: { + description: + 'Requires that all public method arguments and return type will be explicitly typed', + category: 'Best Practices', + recommended: false, + }, + messages: { + noReturnType: 'Public method has no return type', + untypedParameter: 'Public method parameters should be typed', + }, + schema: [ + { + allowAdditionalProperties: false, + properties: { + ignoredMethods: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + type: 'object', + }, + ], + type: 'suggestion', + }, + defaultOptions: [{ ignoredMethods: [] }], + create(context, [options]) { + const ignoredMethods = new Set(options.ignoredMethods); + + function isPublicMethod( + node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition, + ): boolean { + return node.accessibility === 'public' || !node.accessibility; + } + + function isIgnoredMethod( + node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition, + ignoredMethods: Set, + ): boolean { + if ( + node.key.type === AST_NODE_TYPES.Literal && + typeof node.key.value === 'string' + ) { + return ignoredMethods.has(node.key.value); + } + if ( + node.key.type === AST_NODE_TYPES.TemplateLiteral && + node.key.expressions.length === 0 + ) { + return ignoredMethods.has(node.key.quasis[0].value.raw); + } + if (node.key.type === AST_NODE_TYPES.Identifier && !node.computed) { + return ignoredMethods.has(node.key.name); + } + + return false; + } + + function isParamTyped(node: TSESTree.Identifier): boolean { + return ( + !!node.typeAnnotation && + node.typeAnnotation.typeAnnotation.type !== AST_NODE_TYPES.TSAnyKeyword + ); + } + + function isReturnTyped( + node: TSESTree.TSTypeAnnotation | undefined, + ): boolean { + if (!node) { + return false; + } + return ( + node.typeAnnotation && + node.typeAnnotation.type !== AST_NODE_TYPES.TSAnyKeyword + ); + } + + return { + 'TSAbstractMethodDefinition, MethodDefinition'( + node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition, + ): void { + if (isPublicMethod(node) && !isIgnoredMethod(node, ignoredMethods)) { + const paramIdentifiers = node.value.params.filter( + param => param.type === AST_NODE_TYPES.Identifier, + ) as TSESTree.Identifier[]; + const identifiersHaveTypes = paramIdentifiers.every(isParamTyped); + if (!identifiersHaveTypes) { + context.report({ + node, + messageId: 'untypedParameter', + data: {}, + }); + } + + if (!isReturnTyped(node.value.returnType)) { + context.report({ + node, + messageId: 'noReturnType', + data: {}, + }); + } + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts b/packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts new file mode 100644 index 000000000000..1a167d64e30d --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts @@ -0,0 +1,210 @@ +import rule from '../../src/rules/no-untyped-public-signature'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-untyped-public-signature', rule, { + valid: [ + { + code: `class A { + private a(c) { + } + }`, + }, + { + code: `class A { + private async a(c) { + } + }`, + }, + { + code: ` + class A { + public b(c: string):void { + + } + }`, + }, + { + code: ` + class A { + public b(...c):void { + + } + }`, + }, + { + code: ` + class A { + b(c):void { + + } + }`, + options: [{ ignoredMethods: ['b'] }], + }, + { + code: ` + class A { + ['b'](c):void { + + } + }`, + options: [{ ignoredMethods: ['b'] }], + }, + { + code: ` + class A { + [\`b\`](c):void { + + } + }`, + options: [{ ignoredMethods: ['b'] }], + }, + { + code: ` + class A { + b(...c):void { + + } + + d(c):void { + + } + }`, + options: [{ ignoredMethods: ['b', 'd'] }], + }, + ], + invalid: [ + //untyped parameter + { + code: `class A { + public b(c):void { + + } + }`, + errors: [{ messageId: 'untypedParameter' }], + }, + //untyped parameter (any) + { + code: `class A { + public b(c: any):void { + + } + }`, + errors: [{ messageId: 'untypedParameter' }], + }, + //implicit public method + { + code: `class A { + b(c):void { + + } + }`, + errors: [{ messageId: 'untypedParameter' }], + }, + //implicit async public method + { + code: `class A { + async a(c): void { + } + }`, + errors: [{ messageId: 'untypedParameter' }], + }, + //no return type + { + code: `class A { + public a(c: number) { + } + }`, + errors: [{ messageId: 'noReturnType' }], + }, + //no return type + untyped parameter + { + code: `class A { + public b(c) { + + } + }`, + errors: [ + { messageId: 'untypedParameter' }, + { messageId: 'noReturnType' }, + ], + }, + //any return type + { + code: `class A { + public b(c: number): any { + + } + }`, + errors: [{ messageId: 'noReturnType' }], + }, + //with ignored methods + { + code: `class A { + public b(c: number): any { + + } + + c() { + } + }`, + options: [{ ignoredMethods: ['c'] }], + errors: [{ messageId: 'noReturnType' }], + }, + { + code: ` + let c = 'd'; + class A { + [methodName]() { + } + }`, + options: [{ ignoredMethods: ['methodName'] }], + errors: [{ messageId: 'noReturnType' }], + }, + { + code: ` + class A { + [1]() { + } + }`, + options: [{ ignoredMethods: ['1'] }], + errors: [{ messageId: 'noReturnType' }], + }, + { + code: ` + let c = 'C'; + class A { + [\`methodName\${c}\`]() { + } + }`, + options: [{ ignoredMethods: ['methodNameC', 'methodNamec'] }], + errors: [{ messageId: 'noReturnType' }], + }, + { + code: ` + let c = '1'; + class A { + [(c as number)]() { + } + }`, + options: [{ ignoredMethods: ['1'] }], + errors: [{ messageId: 'noReturnType' }], + }, + { + code: ` + class A { + abstract c() { + } + }`, + errors: [{ messageId: 'noReturnType' }], + }, + ], +}); From 1bb4d6301b1c0c4e87a2e27e445150160315e896 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 12 Nov 2019 18:20:12 +0200 Subject: [PATCH 43/47] fix(eslint-plugin): [no-type-alias] handle constructor aliases (#1198) --- .../eslint-plugin/docs/rules/no-type-alias.md | 15 +++++++++++++++ .../eslint-plugin/src/rules/no-type-alias.ts | 15 +++++++++++++++ .../tests/rules/no-type-alias.test.ts | 18 ++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 46230f3d3293..496188d4c0a4 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -84,6 +84,7 @@ or more of the following you may pass an object with the options set as follows: - `allowAliases` set to `"always"` will allow you to do aliasing (Defaults to `"never"`). - `allowCallbacks` set to `"always"` will allow you to use type aliases with callbacks (Defaults to `"never"`) +- `allowConstructors` set to `"always"` will allow you to use type aliases with constructors (Defaults to `"never"`) - `allowLiterals` set to `"always"` will allow you to use type aliases with literal objects (Defaults to `"never"`) - `allowMappedTypes` set to `"always"` will allow you to use type aliases as mapping tools (Defaults to `"never"`) - `allowTupleTypes` set to `"always"` will allow you to use type aliases with tuples (Defaults to `"never"`) @@ -248,6 +249,20 @@ type Foo = (name: string, age: number) => string | Person; type Foo = (name: string, age: number) => string & Person; ``` +### allowConstructors + +This applies to constructor types. + +The setting accepts the following values: + +- `"always"` or `"never"` to active or deactivate the feature. + +Examples of **correct** code for the `{ "allowConstructors": "always" }` option: + +```ts +type Foo = new () => void; +``` + ### allowLiterals This applies to literal types (`type Foo = { ... }`). diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 38816b60a2fa..f10fbeaf3c9a 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -22,6 +22,7 @@ type Options = [ { allowAliases?: Values; allowCallbacks?: 'always' | 'never'; + allowConstructors?: 'always' | 'never'; allowLiterals?: Values; allowMappedTypes?: Values; allowTupleTypes?: Values; @@ -62,6 +63,9 @@ export default util.createRule({ allowCallbacks: { enum: ['always', 'never'], }, + allowConstructors: { + enum: ['always', 'never'], + }, allowLiterals: { enum: enumValues, }, @@ -80,6 +84,7 @@ export default util.createRule({ { allowAliases: 'never', allowCallbacks: 'never', + allowConstructors: 'never', allowLiterals: 'never', allowMappedTypes: 'never', allowTupleTypes: 'never', @@ -91,6 +96,7 @@ export default util.createRule({ { allowAliases, allowCallbacks, + allowConstructors, allowLiterals, allowMappedTypes, allowTupleTypes, @@ -220,6 +226,15 @@ export default util.createRule({ if (allowCallbacks === 'never') { reportError(type.node, type.compositionType, isTopLevel, 'Callbacks'); } + } else if (type.node.type === AST_NODE_TYPES.TSConstructorType) { + if (allowConstructors === 'never') { + reportError( + type.node, + type.compositionType, + isTopLevel, + 'Constructors', + ); + } } else if (type.node.type === AST_NODE_TYPES.TSTypeLiteral) { // literal object type checkAndReport(allowLiterals!, isTopLevel, type, 'Literals'); diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index d17348af7460..d66691dd9556 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -439,6 +439,10 @@ type Foo = { 'type Foo = [string] & [number, number] | keyof [number, number, number];', options: [{ allowTupleTypes: 'in-unions-and-intersections' }], }, + { + code: 'type Foo = new (bar: number) => string | null;', + options: [{ allowConstructors: 'always' }], + }, ], invalid: [ { @@ -3176,5 +3180,19 @@ type Foo = { }, ], }, + { + code: 'type Foo = new (bar: number) => string | null;', + options: [{ allowConstructors: 'never' }], + errors: [ + { + messageId: 'noTypeAlias', + data: { + alias: 'constructors', + line: 1, + column: 12, + }, + }, + ], + }, ], }); From ecb3f4ec9b9f8b56896b0ad985547de0e6608381 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 12 Nov 2019 08:26:53 -0800 Subject: [PATCH 44/47] fix(eslint-plugin): disable base no-unused-expressions in all config --- packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/tools/generate-configs.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 84c450b0723a..7df63e938566 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -52,6 +52,7 @@ "@typescript-eslint/no-unnecessary-type-arguments": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error", "@typescript-eslint/no-untyped-public-signature": "error", + "no-unused-expressions": "off", "@typescript-eslint/no-unused-expressions": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "error", diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 664504783f0a..5e3db377d0d8 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -31,6 +31,7 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'no-extra-parens', 'no-magic-numbers', 'quotes', + 'no-unused-expressions', 'no-unused-vars', 'no-use-before-define', 'no-useless-constructor', From ca41dcf6c0fbfc19975b18ffb5b44c0cbe8adb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Veyret?= Date: Wed, 13 Nov 2019 18:13:13 +0100 Subject: [PATCH 45/47] docs(eslint-plugin): brace-style as a replacement for one-line (#1202) --- packages/eslint-plugin/ROADMAP.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 82e7737feb55..2d4e37bded7e 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -169,7 +169,7 @@ | [`number-literal-format`] | 🛑 | N/A | | [`object-literal-key-quotes`] | 🌟 | [`quote-props`][quote-props] | | [`object-literal-shorthand`] | 🌟 | [`object-shorthand`][object-shorthand] | -| [`one-line`] | 🛑 | N/A | +| [`one-line`] | 🌟 | [`brace-style`][brace-style] or [Prettier] | | [`one-variable-per-declaration`] | 🌟 | [`one-var`][one-var] | | [`ordered-imports`] | 🌓 | [`import/order`] | | [`prefer-function-over-method`] | 🌟 | [`class-methods-use-this`][class-methods-use-this] | @@ -545,6 +545,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [no-undef-init]: https://eslint.org/docs/rules/no-undef-init [quote-props]: https://eslint.org/docs/rules/quote-props [object-shorthand]: https://eslint.org/docs/rules/object-shorthand +[brace-style]: https://eslint.org/docs/rules/brace-style [one-var]: https://eslint.org/docs/rules/one-var [class-methods-use-this]: https://eslint.org/docs/rules/class-methods-use-this [prefer-template]: https://eslint.org/docs/rules/prefer-template From d8b07a7a492c9adece40c4209eab24ae77535618 Mon Sep 17 00:00:00 2001 From: Austaras Date: Thu, 14 Nov 2019 08:21:49 +0800 Subject: [PATCH 46/47] feat(eslint-plugin): add space-before-function-paren [extension] (#924) --- packages/eslint-plugin/README.md | 1 + .../docs/rules/space-before-function-paren.md | 42 ++ packages/eslint-plugin/src/configs/all.json | 2 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/space-before-function-paren.ts | 180 ++++++ .../rules/space-before-function-paren.test.ts | 577 ++++++++++++++++++ .../eslint-plugin/tools/generate-configs.ts | 1 + 7 files changed, 805 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/space-before-function-paren.md create mode 100644 packages/eslint-plugin/src/rules/space-before-function-paren.ts create mode 100644 packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 20d3d817a218..9f82b851d29b 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -201,6 +201,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | | [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | +| [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | enforce consistent spacing before `function` definition opening parenthesis | | :wrench: | | | [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | | :thought_balloon: | | [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :heavy_check_mark: | | | | [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | :heavy_check_mark: | :wrench: | | diff --git a/packages/eslint-plugin/docs/rules/space-before-function-paren.md b/packages/eslint-plugin/docs/rules/space-before-function-paren.md new file mode 100644 index 000000000000..df8d848c7b42 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/space-before-function-paren.md @@ -0,0 +1,42 @@ +# Require or disallow a space before function parenthesis (space-before-function-paren) + +When formatting a function, whitespace is allowed between the function name or `function` keyword and the opening paren. Named functions also require a space between the `function` keyword and the function name, but anonymous functions require no whitespace. For example: + + +```ts +function withoutSpace (x) { + // ... +} + +function withSpace (x) { + // ... +} + +var anonymousWithoutSpace = function () {}; + +var anonymousWithSpace = function () {}; +``` + +Style guides may require a space after the `function` keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required. + +## Rule Details + +This rule extends the base [eslint/func-call-spacing](https://eslint.org/docs/rules/space-before-function-paren) rule. +It supports all options and features of the base rule. +This version adds support for generic type parameters on function calls. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "space-before-function-paren": "off", + "@typescript-eslint/space-before-function-paren": ["error"] +} +``` + +## Options + +See [eslint/space-before-function-paren options](https://eslint.org/docs/rules/space-before-function-paren#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/space-before-function-paren.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 7df63e938566..23b38b458a3b 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -77,6 +77,8 @@ "@typescript-eslint/restrict-plus-operands": "error", "semi": "off", "@typescript-eslint/semi": "error", + "space-before-function-paren": "off", + "@typescript-eslint/space-before-function-paren": "error", "@typescript-eslint/strict-boolean-expressions": "error", "@typescript-eslint/triple-slash-reference": "error", "@typescript-eslint/type-annotation-spacing": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 87d02d56a3bf..35f2d7582912 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -58,6 +58,7 @@ import requireArraySortCompare from './require-array-sort-compare'; import requireAwait from './require-await'; import restrictPlusOperands from './restrict-plus-operands'; import semi from './semi'; +import spaceBeforeFunctionParen from './space-before-function-paren'; import strictBooleanExpressions from './strict-boolean-expressions'; import tripleSlashReference from './triple-slash-reference'; import typeAnnotationSpacing from './type-annotation-spacing'; @@ -128,6 +129,7 @@ export default { 'require-await': requireAwait, 'restrict-plus-operands': restrictPlusOperands, semi: semi, + 'space-before-function-paren': spaceBeforeFunctionParen, 'strict-boolean-expressions': strictBooleanExpressions, 'triple-slash-reference': tripleSlashReference, 'type-annotation-spacing': typeAnnotationSpacing, diff --git a/packages/eslint-plugin/src/rules/space-before-function-paren.ts b/packages/eslint-plugin/src/rules/space-before-function-paren.ts new file mode 100644 index 000000000000..1def91e08f25 --- /dev/null +++ b/packages/eslint-plugin/src/rules/space-before-function-paren.ts @@ -0,0 +1,180 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import { isOpeningParenToken } from 'eslint-utils'; +import * as util from '../util'; + +type Option = 'never' | 'always'; +type FuncOption = Option | 'ignore'; + +export type Options = [ + + | Option + | Partial<{ + anonymous: FuncOption; + named: FuncOption; + asyncArrow: FuncOption; + }>, +]; +export type MessageIds = 'unexpected' | 'missing'; + +export default util.createRule({ + name: 'space-before-function-paren', + meta: { + type: 'layout', + docs: { + description: + 'enforce consistent spacing before `function` definition opening parenthesis', + category: 'Stylistic Issues', + recommended: false, + }, + fixable: 'whitespace', + schema: [ + { + oneOf: [ + { + enum: ['always', 'never'], + }, + { + type: 'object', + properties: { + anonymous: { + enum: ['always', 'never', 'ignore'], + }, + named: { + enum: ['always', 'never', 'ignore'], + }, + asyncArrow: { + enum: ['always', 'never', 'ignore'], + }, + }, + additionalProperties: false, + }, + ], + }, + ], + messages: { + unexpected: 'Unexpected space before function parentheses.', + missing: 'Missing space before function parentheses.', + }, + }, + defaultOptions: ['always'], + + create(context) { + const sourceCode = context.getSourceCode(); + const baseConfig = + typeof context.options[0] === 'string' ? context.options[0] : 'always'; + const overrideConfig = + typeof context.options[0] === 'object' ? context.options[0] : {}; + + /** + * Determines whether a function has a name. + * @param {ASTNode} node The function node. + * @returns {boolean} Whether the function has a name. + */ + function isNamedFunction( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): boolean { + if (node.id) { + return true; + } + + const parent = node.parent!; + + return ( + parent.type === 'MethodDefinition' || + (parent.type === 'Property' && + (parent.kind === 'get' || parent.kind === 'set' || parent.method)) + ); + } + + /** + * Gets the config for a given function + * @param {ASTNode} node The function node + * @returns {string} "always", "never", or "ignore" + */ + function getConfigForFunction( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): FuncOption { + if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { + // Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar + if ( + node.async && + isOpeningParenToken(sourceCode.getFirstToken(node, { skip: 1 })!) + ) { + return overrideConfig.asyncArrow || baseConfig; + } + } else if (isNamedFunction(node)) { + return overrideConfig.named || baseConfig; + + // `generator-star-spacing` should warn anonymous generators. E.g. `function* () {}` + } else if (!node.generator) { + return overrideConfig.anonymous || baseConfig; + } + + return 'ignore'; + } + + /** + * Checks the parens of a function node + * @param {ASTNode} node A function node + * @returns {void} + */ + function checkFunction( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): void { + const functionConfig = getConfigForFunction(node); + + if (functionConfig === 'ignore') { + return; + } + + let leftToken: TSESTree.Token, rightToken: TSESTree.Token; + if (node.typeParameters) { + leftToken = sourceCode.getLastToken(node.typeParameters)!; + rightToken = sourceCode.getTokenAfter(leftToken)!; + } else { + rightToken = sourceCode.getFirstToken(node, isOpeningParenToken)!; + leftToken = sourceCode.getTokenBefore(rightToken)!; + } + const hasSpacing = sourceCode.isSpaceBetweenTokens(leftToken, rightToken); + + if (hasSpacing && functionConfig === 'never') { + context.report({ + node, + loc: leftToken.loc.end, + messageId: 'unexpected', + fix: fixer => + fixer.removeRange([leftToken.range[1], rightToken.range[0]]), + }); + } else if ( + !hasSpacing && + functionConfig === 'always' && + (!node.typeParameters || node.id) + ) { + context.report({ + node, + loc: leftToken.loc.end, + messageId: 'missing', + fix: fixer => fixer.insertTextAfter(leftToken, ' '), + }); + } + } + + return { + ArrowFunctionExpression: checkFunction, + FunctionDeclaration: checkFunction, + FunctionExpression: checkFunction, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts b/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts new file mode 100644 index 000000000000..7acb61fa85fa --- /dev/null +++ b/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts @@ -0,0 +1,577 @@ +import { + TSESLint, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import rule, { + MessageIds, + Options, +} from '../../src/rules/space-before-function-paren'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('space-before-function-paren', rule, { + valid: [ + 'function foo () {}', + 'var foo = function () {}', + 'var bar = function foo () {}', + 'var obj = { get foo () {}, set foo (val) {} };', + 'type TransformFunction = (el: ASTElement, code: string) => string;', + 'var f = function () {};', + 'function foo {}> () {}', + 'async {}> () => {}', + 'async () => {}', + { + code: 'function foo {}>>() {}', + options: ['never'], + }, + { + code: 'var obj = { foo () {} };', + parserOptions: { ecmaVersion: 6 }, + }, + { code: 'function* foo () {}', parserOptions: { ecmaVersion: 6 } }, + { code: 'var foo = function *() {};', parserOptions: { ecmaVersion: 6 } }, + { code: 'function foo() {}', options: ['never'] }, + { code: 'var foo = function() {}', options: ['never'] }, + { code: 'var bar = function foo() {}', options: ['never'] }, + { + code: 'var obj = { get foo() {}, set foo(val) {} };', + options: ['never'], + }, + { + code: 'var obj = { foo() {} };', + options: ['never'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'function* foo() {}', + options: ['never'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = function*() {};', + options: ['never'], + parserOptions: { ecmaVersion: 6 }, + }, + + { + code: [ + 'function foo() {}', + 'var bar = function () {}', + 'function* baz() {}', + 'var bat = function*() {};', + 'var obj = { get foo() {}, set foo(val) {}, bar() {} };', + ].join('\n'), + options: [{ named: 'never', anonymous: 'always' }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: [ + 'function foo () {}', + 'var bar = function() {}', + 'function* baz () {}', + 'var bat = function* () {};', + 'var obj = { get foo () {}, set foo (val) {}, bar () {} };', + ].join('\n'), + options: [{ named: 'always', anonymous: 'never' }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'class Foo { constructor() {} *method() {} }', + options: [{ named: 'never', anonymous: 'always' }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'class Foo { constructor () {} *method () {} }', + options: [{ named: 'always', anonymous: 'never' }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = function() {}', + options: [{ named: 'always', anonymous: 'ignore' }], + }, + { + code: 'var foo = function () {}', + options: [{ named: 'always', anonymous: 'ignore' }], + }, + { + code: 'var bar = function foo() {}', + options: [{ named: 'ignore', anonymous: 'always' }], + }, + { + code: 'var bar = function foo () {}', + options: [{ named: 'ignore', anonymous: 'always' }], + }, + + // Async arrow functions + { code: '() => 1', parserOptions: { ecmaVersion: 6 } }, + { code: 'async a => a', parserOptions: { ecmaVersion: 8 } }, + { + code: 'async a => a', + options: [{ asyncArrow: 'always' }], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async a => a', + options: [{ asyncArrow: 'never' }], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async () => 1', + options: [{ asyncArrow: 'always' }], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async() => 1', + options: [{ asyncArrow: 'never' }], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async () => 1', + options: [{ asyncArrow: 'ignore' }], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async() => 1', + options: [{ asyncArrow: 'ignore' }], + parserOptions: { ecmaVersion: 8 }, + }, + { code: 'async () => 1', parserOptions: { ecmaVersion: 8 } }, + { + code: 'async () => 1', + options: ['always'], + parserOptions: { ecmaVersion: 8 }, + }, + { + code: 'async() => 1', + options: ['never'], + parserOptions: { ecmaVersion: 8 }, + }, + ], + + invalid: [ + { + code: 'function foo {}>() {}', + output: 'function foo {}> () {}', + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'missing', + line: 1, + column: 33, + }, + ], + }, + { + code: 'function foo() {}', + output: 'function foo () {}', + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'missing', + line: 1, + column: 13, + }, + ], + }, + { + code: 'function foo/* */() {}', + output: 'function foo /* */() {}', + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'missing', + line: 1, + column: 13, + }, + ], + }, + { + code: 'var foo = function() {}', + output: 'var foo = function () {}', + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 19, + }, + ], + }, + { + code: 'var bar = function foo() {}', + output: 'var bar = function foo () {}', + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 23, + }, + ], + }, + { + code: 'var obj = { get foo() {}, set foo(val) {} };', + output: 'var obj = { get foo () {}, set foo (val) {} };', + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 20, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 34, + }, + ], + }, + { + code: 'var obj = { foo() {} };', + output: 'var obj = { foo () {} };', + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 16, + }, + ], + }, + { + code: 'function* foo() {}', + output: 'function* foo () {}', + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'missing', + line: 1, + column: 14, + }, + ], + }, + + { + code: 'function foo () {}', + output: 'function foo() {}', + options: ['never'], + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'unexpected', + line: 1, + column: 13, + }, + ], + }, + { + code: 'var foo = function () {}', + output: 'var foo = function() {}', + options: ['never'], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 19, + }, + ], + }, + { + code: 'var bar = function foo () {}', + output: 'var bar = function foo() {}', + options: ['never'], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 23, + }, + ], + }, + { + code: 'var obj = { get foo () {}, set foo (val) {} };', + output: 'var obj = { get foo() {}, set foo(val) {} };', + options: ['never'], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 20, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 35, + }, + ], + }, + { + code: 'var obj = { foo () {} };', + output: 'var obj = { foo() {} };', + options: ['never'], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 16, + }, + ], + }, + { + code: 'function* foo () {}', + output: 'function* foo() {}', + options: ['never'], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'unexpected', + line: 1, + column: 14, + }, + ], + }, + + { + code: [ + 'function foo () {}', + 'var bar = function() {}', + 'var obj = { get foo () {}, set foo (val) {}, bar () {} };', + ].join('\n'), + output: [ + 'function foo() {}', + 'var bar = function () {}', + 'var obj = { get foo() {}, set foo(val) {}, bar() {} };', + ].join('\n'), + options: [{ named: 'never', anonymous: 'always' }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'unexpected', + line: 1, + column: 13, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 2, + column: 19, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 3, + column: 20, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 3, + column: 35, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 3, + column: 49, + }, + ], + }, + { + code: 'class Foo { constructor () {} *method () {} }', + output: 'class Foo { constructor() {} *method() {} }', + options: [{ named: 'never', anonymous: 'always' }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 24, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 38, + }, + ], + }, + { + code: 'var foo = { bar () {} }', + output: 'var foo = { bar() {} }', + options: [{ named: 'never', anonymous: 'always' }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 16, + }, + ], + }, + { + code: [ + 'function foo() {}', + 'var bar = function () {}', + 'var obj = { get foo() {}, set foo(val) {}, bar() {} };', + ].join('\n'), + output: [ + 'function foo () {}', + 'var bar = function() {}', + 'var obj = { get foo () {}, set foo (val) {}, bar () {} };', + ].join('\n'), + options: [{ named: 'always', anonymous: 'never' }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + type: AST_NODE_TYPES.FunctionDeclaration, + messageId: 'missing', + line: 1, + column: 13, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 2, + column: 19, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 3, + column: 20, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 3, + column: 34, + }, + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 3, + column: 47, + }, + ], + }, + { + code: 'var foo = function() {}', + output: 'var foo = function () {}', + options: [{ named: 'ignore', anonymous: 'always' }], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 19, + }, + ], + }, + { + code: 'var foo = function () {}', + output: 'var foo = function() {}', + options: [{ named: 'ignore', anonymous: 'never' }], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 19, + }, + ], + }, + { + code: 'var bar = function foo() {}', + output: 'var bar = function foo () {}', + options: [{ named: 'always', anonymous: 'ignore' }], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'missing', + line: 1, + column: 23, + }, + ], + }, + { + code: 'var bar = function foo () {}', + output: 'var bar = function foo() {}', + options: [{ named: 'never', anonymous: 'ignore' }], + errors: [ + { + type: AST_NODE_TYPES.FunctionExpression, + messageId: 'unexpected', + line: 1, + column: 23, + }, + ], + }, + + // Async arrow functions + { + code: 'async() => 1', + output: 'async () => 1', + options: [{ asyncArrow: 'always' }], + parserOptions: { ecmaVersion: 8 }, + errors: ['Missing space before function parentheses.'], + }, + { + code: 'async () => 1', + output: 'async() => 1', + options: [{ asyncArrow: 'never' }], + parserOptions: { ecmaVersion: 8 }, + errors: ['Unexpected space before function parentheses.'], + }, + { + code: 'async() => 1', + output: 'async () => 1', + parserOptions: { ecmaVersion: 8 }, + errors: [ + { + messageId: 'missing', + type: AST_NODE_TYPES.ArrowFunctionExpression, + }, + ], + }, + { + code: 'async() => 1', + output: 'async () => 1', + options: ['always'], + parserOptions: { ecmaVersion: 8 }, + errors: [ + { + messageId: 'missing', + type: AST_NODE_TYPES.ArrowFunctionExpression, + }, + ], + }, + { + code: 'async () => 1', + output: 'async() => 1', + options: ['never'], + parserOptions: { ecmaVersion: 8 }, + errors: [ + { + messageId: 'unexpected', + type: AST_NODE_TYPES.ArrowFunctionExpression, + }, + ], + }, + ] as TSESLint.InvalidTestCase[], +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 5e3db377d0d8..ff6c5c63a0c2 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -37,6 +37,7 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'no-useless-constructor', 'require-await', 'semi', + 'space-before-function-paren', ]); // list of rules from the base plugin that we think should be turned on for typescript code const BASE_RULES_THAT_ARE_RECOMMENDED = new Set([ From 9c8203f15854293f67dac7ea201c6a2ee527edc1 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 14 Nov 2019 19:15:39 +0200 Subject: [PATCH 47/47] fix(eslint-plugin): [camelcase] handle optional member expr (#1204) --- packages/eslint-plugin/src/rules/camelcase.ts | 42 ++++++++++++------ .../tests/rules/camelcase.test.ts | 44 +++++++++++++++++++ 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index 4bb614cba9d7..0928484b629d 100644 --- a/packages/eslint-plugin/src/rules/camelcase.ts +++ b/packages/eslint-plugin/src/rules/camelcase.ts @@ -72,23 +72,28 @@ export default util.createRule({ * @private */ function isTSPropertyType(node: TSESTree.Node): boolean { - if (!node.parent) { - return false; - } - if (TS_PROPERTY_TYPES.includes(node.parent.type)) { + if (TS_PROPERTY_TYPES.includes(node.type)) { return true; } - if (node.parent.type === AST_NODE_TYPES.AssignmentPattern) { + if (node.type === AST_NODE_TYPES.AssignmentPattern) { return ( - node.parent.parent !== undefined && - TS_PROPERTY_TYPES.includes(node.parent.parent.type) + node.parent !== undefined && + TS_PROPERTY_TYPES.includes(node.parent.type) ); } return false; } + function report(node: TSESTree.Identifier): void { + context.report({ + node, + messageId: 'notCamelCase', + data: { name: node.name }, + }); + } + return { Identifier(node): void { /* @@ -103,13 +108,24 @@ export default util.createRule({ } // Check TypeScript specific nodes - if (isTSPropertyType(node)) { + const parent = node.parent; + if (parent && isTSPropertyType(parent)) { if (properties === 'always' && isUnderscored(name)) { - context.report({ - node, - messageId: 'notCamelCase', - data: { name: node.name }, - }); + report(node); + } + + return; + } + + if (parent && parent.type === AST_NODE_TYPES.OptionalMemberExpression) { + // Report underscored object names + if ( + properties === 'always' && + parent.object.type === AST_NODE_TYPES.Identifier && + parent.object.name === node.name && + isUnderscored(name) + ) { + report(node); } return; diff --git a/packages/eslint-plugin/tests/rules/camelcase.test.ts b/packages/eslint-plugin/tests/rules/camelcase.test.ts index e0e142c70a4b..d2d3287ce662 100644 --- a/packages/eslint-plugin/tests/rules/camelcase.test.ts +++ b/packages/eslint-plugin/tests/rules/camelcase.test.ts @@ -79,6 +79,22 @@ ruleTester.run('camelcase', rule, { code: 'abstract class Foo { abstract bar: number = 0; }', options: [{ properties: 'always' }], }, + { + code: 'const foo = foo?.baz;', + }, + { + code: 'const foo = foo?.foo_bar?.foo_bar_baz;', + }, + { + code: 'const foo = foo.bar?.foo_bar_baz;', + }, + { + code: 'const foo = (foo?.bar?.baz)?.foo_bar_baz;', + }, + { + code: 'const foo = foo_bar?.foo;', + options: [{ properties: 'never' }], + }, ], invalid: [ @@ -194,5 +210,33 @@ ruleTester.run('camelcase', rule, { }, ], }, + { + code: 'const foo = foo_bar?.foo;', + options: [{ properties: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 'foo_bar', + }, + line: 1, + column: 13, + }, + ], + }, + { + code: 'const foo = (foo_test?.bar)?.baz;', + options: [{ properties: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 'foo_test', + }, + line: 1, + column: 14, + }, + ], + }, ], });