From 42b3013ab846669fd730628f5cb0b043cfedabba Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 9 Aug 2019 17:19:19 +0100 Subject: [PATCH 001/317] chore: misc package.json updates related to v2 (#832) --- package.json | 2 +- packages/eslint-plugin-tslint/package.json | 2 +- packages/eslint-plugin/package.json | 4 ++-- packages/experimental-utils/package.json | 2 +- packages/parser/package.json | 2 +- packages/typescript-estree/package.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 98a6c27fc2d..d0c730ff1b4 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ ] }, "engines": { - "node": ">=6.14.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "devDependencies": { "@commitlint/cli": "^8.1.0", diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index bed7e2fd46f..bf40809b2db 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -11,7 +11,7 @@ "tslint" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 99183122281..516ee6b4f98 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -9,7 +9,7 @@ "typescript" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "files": [ "dist", @@ -54,7 +54,7 @@ "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^1.9.0", + "@typescript-eslint/parser": "^2.0.0-alpha.0", "eslint": "^5.0.0 || ^6.0.0" } } diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 5cbedf3e6cb..4574f3129d1 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -8,7 +8,7 @@ "estree" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "files": [ "dist", diff --git a/packages/parser/package.json b/packages/parser/package.json index c11e9cb790a..bc3f3cf29b0 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -9,7 +9,7 @@ "LICENSE" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index fabdc79810c..e0a0e661882 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -10,7 +10,7 @@ "LICENSE" ], "engines": { - "node": ">=6.14.0" + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "repository": { "type": "git", From ebbcc010c546b5777c14f0b33ead851b620184e0 Mon Sep 17 00:00:00 2001 From: Torleif Berger Date: Sat, 10 Aug 2019 02:32:16 +0200 Subject: [PATCH 002/317] fix(eslint-plugin): [efrt] flag default export w/allowExpressions (#831) BREAKING: the rule didn't previously flag default exports with this option --- .../rules/explicit-function-return-type.md | 20 +++++------ .../rules/explicit-function-return-type.ts | 3 +- .../explicit-function-return-type.test.ts | 33 +++++++++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index b1ac9af14ff..f31d6f42b8b 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -84,6 +84,10 @@ Examples of **incorrect** code for this rule with `{ allowExpressions: true }`: ```ts function test() {} + +const fn = () => {}; + +export default () => {}; ``` Examples of **correct** code for this rule with `{ allowExpressions: true }`: @@ -155,24 +159,20 @@ functionWithObjectArg({ Examples of **incorrect** code for this rule with `{ allowHigherOrderFunctions: true }`: ```ts -var arrowFn = (x: number) => (y: number) => x + y; +var arrowFn = () => () => {}; -function fn(x: number) { - return function(y: number) { - return x + y; - }; +function fn() { + return function() {}; } ``` Examples of **correct** code for this rule with `{ allowHigherOrderFunctions: true }`: ```ts -var arrowFn = (x: number) => (y: number): number => x + y; +var arrowFn = () => (): void => {}; -function fn(x: number) { - return function(y: number): number { - return x + y; - }; +function fn() { + return function(): void {}; } ``` diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b431fe7675c..44ea2d03c8e 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -256,7 +256,8 @@ export default util.createRule({ if ( options.allowExpressions && node.parent.type !== AST_NODE_TYPES.VariableDeclarator && - node.parent.type !== AST_NODE_TYPES.MethodDefinition + node.parent.type !== AST_NODE_TYPES.MethodDefinition && + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 72d64d2abe0..32f23792591 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -90,6 +90,15 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: `export default (): void => {}`, + options: [ + { + allowExpressions: true, + }, + ], + }, { filename: 'test.ts', code: ` @@ -417,6 +426,30 @@ function test() { }, ], }, + { + filename: 'test.ts', + code: 'export default () => {};', + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 16, + }, + ], + }, + { + filename: 'test.ts', + code: 'export default function() {};', + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 1, + column: 16, + }, + ], + }, { filename: 'test.ts', code: "var arrowFn = () => 'test';", From de6cc1d51a7b908ab2a731c5ce3c1d537062645f Mon Sep 17 00:00:00 2001 From: Ken <2770219+ken0x0a@users.noreply.github.com> Date: Tue, 13 Aug 2019 00:59:14 +0900 Subject: [PATCH 003/317] docs(eslint-plugin): [no-useless-constructor] add example setup (#837) --- .../eslint-plugin/docs/rules/no-useless-constructor.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-useless-constructor.md b/packages/eslint-plugin/docs/rules/no-useless-constructor.md index 821f6a5d105..0aa1f4a5c98 100644 --- a/packages/eslint-plugin/docs/rules/no-useless-constructor.md +++ b/packages/eslint-plugin/docs/rules/no-useless-constructor.md @@ -71,6 +71,16 @@ class A extends B { } ``` +## Rule Changes + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "no-useless-constructor": "off", + "@typescript-eslint/no-useless-constructor": "error", +} +``` + ## When Not To Use It If you don't want to be notified about unnecessary constructors, you can safely disable this rule. From 428567d7cc0985b1da754f092289212df3fe1bda Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 13 Aug 2019 02:50:38 -0700 Subject: [PATCH 004/317] feat(eslint-plugin)!: change recommended config (#729) BREAKING CHANGE: recommended config changes are considered breaking --- .eslintrc.js | 25 +++-------- .prettierrc => .prettierrc.json | 0 .../eslint-plugin-tslint/src/custom-linter.ts | 4 +- packages/eslint-plugin/README.md | 38 ++++++++-------- .../docs/rules/no-inferrable-types.md | 4 +- packages/eslint-plugin/package.json | 2 + packages/eslint-plugin/src/configs/all.json | 2 + packages/eslint-plugin/src/configs/base.json | 8 +--- .../src/configs/recommended.json | 32 +++++++++----- .../eslint-plugin/src/rules/array-type.ts | 7 +-- .../eslint-plugin/src/rules/await-thenable.ts | 4 +- .../eslint-plugin/src/rules/ban-ts-ignore.ts | 2 +- packages/eslint-plugin/src/rules/ban-types.ts | 5 ++- packages/eslint-plugin/src/rules/camelcase.ts | 2 +- .../src/rules/class-name-casing.ts | 4 +- .../src/rules/consistent-type-assertions.ts | 10 ++--- .../src/rules/consistent-type-definitions.ts | 5 ++- .../rules/explicit-function-return-type.ts | 4 +- .../rules/explicit-member-accessibility.ts | 9 ++-- .../src/rules/generic-type-naming.ts | 3 +- .../indent-new-do-not-use/OffsetStorage.ts | 12 +++-- .../src/rules/indent-new-do-not-use/index.ts | 15 +++---- packages/eslint-plugin/src/rules/indent.ts | 3 +- .../src/rules/interface-name-prefix.ts | 5 ++- .../src/rules/member-ordering.ts | 8 ++-- .../src/rules/no-empty-function.ts | 8 ++-- .../src/rules/no-empty-interface.ts | 2 +- .../src/rules/no-explicit-any.ts | 5 ++- .../src/rules/no-extra-parens.ts | 8 ++-- .../src/rules/no-extraneous-class.ts | 2 +- .../src/rules/no-floating-promises.ts | 2 +- .../src/rules/no-for-in-array.ts | 4 +- .../src/rules/no-inferrable-types.ts | 16 ++++--- .../src/rules/no-magic-numbers.ts | 2 +- .../eslint-plugin/src/rules/no-misused-new.ts | 8 ++-- .../src/rules/no-misused-promises.ts | 19 +++++--- .../eslint-plugin/src/rules/no-namespace.ts | 2 +- .../src/rules/no-non-null-assertion.ts | 4 +- .../src/rules/no-parameter-properties.ts | 5 ++- .../src/rules/no-require-imports.ts | 6 ++- .../eslint-plugin/src/rules/no-this-alias.ts | 6 +-- .../eslint-plugin/src/rules/no-type-alias.ts | 5 ++- .../src/rules/no-unnecessary-qualifier.ts | 2 +- .../rules/no-unnecessary-type-arguments.ts | 4 +- .../rules/no-unnecessary-type-assertion.ts | 4 +- .../src/rules/no-use-before-define.ts | 2 +- .../src/rules/no-useless-constructor.ts | 2 +- .../src/rules/no-var-requires.ts | 2 +- .../eslint-plugin/src/rules/prefer-for-of.ts | 2 +- .../src/rules/prefer-function-type.ts | 11 +++-- .../src/rules/prefer-includes.ts | 2 +- .../src/rules/prefer-namespace-keyword.ts | 2 +- .../src/rules/prefer-readonly.ts | 38 ++++++++-------- .../src/rules/prefer-regexp-exec.ts | 4 +- .../rules/prefer-string-starts-ends-with.ts | 2 +- .../src/rules/promise-function-async.ts | 12 +++-- .../src/rules/require-array-sort-compare.ts | 2 +- .../eslint-plugin/src/rules/require-await.ts | 8 ++-- .../src/rules/restrict-plus-operands.ts | 2 +- packages/eslint-plugin/src/rules/semi.ts | 3 +- .../src/rules/triple-slash-reference.ts | 10 ++--- .../src/rules/type-annotation-spacing.ts | 4 +- packages/eslint-plugin/src/rules/typedef.ts | 22 +++++----- .../eslint-plugin/src/rules/unbound-method.ts | 6 +-- .../src/rules/unified-signatures.ts | 21 ++++----- packages/eslint-plugin/src/util/misc.ts | 4 +- packages/eslint-plugin/src/util/types.ts | 7 ++- packages/eslint-plugin/tests/RuleTester.ts | 2 +- .../eslint-plugin/tests/rules/indent/utils.ts | 3 +- .../tests/rules/no-this-alias.test.ts | 10 +++++ .../tests/rules/no-unused-vars.test.ts | 8 ++-- .../eslint-plugin/tools/generate-configs.ts | 44 ++++++++++++++----- .../tools/validate-configs/checkConfigAll.ts | 4 +- .../checkConfigRecommended.ts | 4 +- .../validate-docs/validate-table-structure.ts | 3 +- .../src/eslint-utils/RuleCreator.ts | 2 +- .../src/eslint-utils/deepMerge.ts | 5 ++- packages/parser/src/analyze-scope.ts | 18 ++++---- packages/parser/src/parser.ts | 7 ++- packages/parser/src/scope/scope-manager.ts | 6 ++- packages/parser/src/simple-traverse.ts | 4 +- packages/parser/tests/lib/basics.ts | 2 +- packages/parser/tests/lib/jsx.ts | 2 +- packages/parser/tests/tools/scope-analysis.ts | 21 +++++---- packages/parser/tests/tools/test-utils.ts | 17 +++---- .../typescript-estree/src/ast-converter.ts | 5 ++- packages/typescript-estree/src/convert.ts | 17 ++++--- packages/typescript-estree/src/node-utils.ts | 11 ++++- packages/typescript-estree/src/parser.ts | 22 +++++++--- .../typescript-estree/src/tsconfig-parser.ts | 25 +++++++---- .../tests/ast-alignment/fixtures-to-test.ts | 4 +- .../tests/ast-alignment/parse.ts | 19 +++++--- .../tests/ast-alignment/utils.ts | 10 ++--- .../typescript-estree/tests/lib/convert.ts | 8 ++-- packages/typescript-estree/tests/lib/jsx.ts | 7 +-- .../tests/lib/semanticInfo.ts | 4 +- .../typescript-estree/tools/test-utils.ts | 10 ++--- .../utils/jest-snapshot-resolver.js | 1 + tools/generate-contributors.ts | 4 +- yarn.lock | 7 ++- 100 files changed, 470 insertions(+), 341 deletions(-) rename .prettierrc => .prettierrc.json (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 45426c37acf..32a476969d3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,23 +21,12 @@ module.exports = { // our plugin :D // - '@typescript-eslint/ban-ts-ignore': 'error', - '@typescript-eslint/consistent-type-definitions': 'error', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-member-accessibility': 'off', - '@typescript-eslint/indent': 'off', - '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-inferrable-types': 'error', - '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], + '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-parameter-properties': 'off', - '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-includes': 'error', - '@typescript-eslint/prefer-regexp-exec': 'error', - '@typescript-eslint/prefer-string-starts-ends-with': 'error', + '@typescript-eslint/unbound-method': 'off', // // eslint base @@ -110,12 +99,12 @@ module.exports = { 'import/no-mutable-exports': 'error', // Prevent importing the default as if it were named 'import/no-named-default': 'error', - // Prohibit named exports // we want everything to be a named export - 'import/no-named-export': 'off', + // Prohibit named exports + 'import/no-named-export': 'off', // we want everything to be a named export // Forbid a module from importing itself 'import/no-self-import': 'error', - // Require modules with a single export to use a default export // we want everything to be named - 'import/prefer-default-export': 'off', + // Require modules with a single export to use a default export + 'import/prefer-default-export': 'off', // we want everything to be named }, parserOptions: { sourceType: 'module', diff --git a/.prettierrc b/.prettierrc.json similarity index 100% rename from .prettierrc rename to .prettierrc.json diff --git a/packages/eslint-plugin-tslint/src/custom-linter.ts b/packages/eslint-plugin-tslint/src/custom-linter.ts index 5de914e5f8f..eb8527b99d7 100644 --- a/packages/eslint-plugin-tslint/src/custom-linter.ts +++ b/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -1,5 +1,5 @@ import { ILinterOptions, Linter, LintResult } from 'tslint'; -import { Program } from 'typescript'; +import { Program, SourceFile } from 'typescript'; // We need to access the program, but Linter has private program already // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -14,7 +14,7 @@ export class CustomLinter extends TSLintLinter { return super.getResult(); } - getSourceFile(fileName: string) { + getSourceFile(fileName: string): SourceFile | undefined { return this.program.getSourceFile(fileName); } } diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index a6db1f9ec46..516f9c48dae 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -124,65 +124,65 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | | [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | | | :thought_balloon: | -| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | | | | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | +| [`@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/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: | | | | [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | | [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | :heavy_check_mark: | | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | | | | [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | | [`@typescript-eslint/generic-type-naming`](./docs/rules/generic-type-naming.md) | Enforces naming of generic type variables | | | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names be prefixed with `I` | :heavy_check_mark: | | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | +| [`@typescript-eslint/interface-name-prefix`](./docs/rules/interface-name-prefix.md) | Require that interface names should or should not prefixed with `I` | :heavy_check_mark: | | | | [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | | | [`@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-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | | | | +| [`@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: | | | [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | | [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | | [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately. | | | :thought_balloon: | -| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | | | :thought_balloon: | +| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallows magic numbers | | | | | [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | | | :thought_balloon: | +| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :heavy_check_mark: | | | | [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :heavy_check_mark: | | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | :heavy_check_mark: | | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | | [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | | | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | | [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | | [`@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 | | :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-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 | | | | | [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | | [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | | [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | -| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | | | :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 | | :wrench: | :thought_balloon: | +| [`@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/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 | | | :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: | | [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :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 | | | | +| [`@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: | | | [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | -| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | | | :thought_balloon: | +| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :heavy_check_mark: | | :thought_balloon: | | [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | diff --git a/packages/eslint-plugin/docs/rules/no-inferrable-types.md b/packages/eslint-plugin/docs/rules/no-inferrable-types.md index 9dbabe276c3..7dd159b02e5 100644 --- a/packages/eslint-plugin/docs/rules/no-inferrable-types.md +++ b/packages/eslint-plugin/docs/rules/no-inferrable-types.md @@ -24,8 +24,8 @@ The default options are: ```JSON { - "ignoreParameters": true, - "ignoreProperties": true, + "ignoreParameters": false, + "ignoreProperties": false, } ``` diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 516ee6b4f98..14b417ac5c7 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -49,8 +49,10 @@ "devDependencies": { "@types/json-schema": "^7.0.3", "@types/marked": "^0.6.5", + "@types/prettier": "^1.18.0", "chalk": "^2.4.2", "marked": "^0.7.0", + "prettier": "*", "typescript": "*" }, "peerDependencies": { diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 0c17ccb0426..30a7cafafb5 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -24,6 +24,7 @@ "@typescript-eslint/member-ordering": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "no-empty-function": "off", "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "error", @@ -62,6 +63,7 @@ "@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/promise-function-async": "error", "@typescript-eslint/require-array-sort-compare": "error", + "require-await": "off", "@typescript-eslint/require-await": "error", "@typescript-eslint/restrict-plus-operands": "error", "semi": "off", diff --git a/packages/eslint-plugin/src/configs/base.json b/packages/eslint-plugin/src/configs/base.json index 6f56100a6ae..9580ed622cf 100644 --- a/packages/eslint-plugin/src/configs/base.json +++ b/packages/eslint-plugin/src/configs/base.json @@ -1,9 +1,5 @@ { "parser": "@typescript-eslint/parser", - "parserOptions": { - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ] + "parserOptions": { "sourceType": "module" }, + "plugins": ["@typescript-eslint"] } diff --git a/packages/eslint-plugin/src/configs/recommended.json b/packages/eslint-plugin/src/configs/recommended.json index 121b85bf17a..95d18847686 100644 --- a/packages/eslint-plugin/src/configs/recommended.json +++ b/packages/eslint-plugin/src/configs/recommended.json @@ -1,38 +1,48 @@ { "extends": "./configs/base.json", "rules": { - "no-var": "error", - "prefer-const": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", "camelcase": "off", "@typescript-eslint/camelcase": "error", "@typescript-eslint/class-name-casing": "error", "@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/explicit-function-return-type": "warn", - "@typescript-eslint/explicit-member-accessibility": "error", - "indent": "off", - "@typescript-eslint/indent": "error", "@typescript-eslint/interface-name-prefix": "error", "@typescript-eslint/member-delimiter-style": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "no-empty-function": "off", + "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-for-in-array": "error", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", + "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-non-null-assertion": "error", - "@typescript-eslint/no-parameter-properties": "error", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-this-alias": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "warn", "no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "error", "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/type-annotation-spacing": "error" + "@typescript-eslint/prefer-regexp-exec": "error", + "@typescript-eslint/prefer-string-starts-ends-with": "error", + "require-await": "off", + "@typescript-eslint/require-await": "error", + "@typescript-eslint/triple-slash-reference": "error", + "@typescript-eslint/type-annotation-spacing": "error", + "@typescript-eslint/unbound-method": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error" } } diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index 8fe28bc3217..b9977618c40 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -94,7 +94,8 @@ export default util.createRule({ docs: { description: 'Requires using either `T[]` or `Array` for arrays', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, fixable: 'code', messages: { @@ -168,7 +169,7 @@ export default util.createRule({ } return { - TSArrayType(node: TSESTree.TSArrayType) { + TSArrayType(node): void { if ( isArrayOption || (isArraySimpleOption && isSimpleType(node.elementType)) @@ -241,7 +242,7 @@ export default util.createRule({ }); }, - TSTypeReference(node: TSESTree.TSTypeReference) { + TSTypeReference(node): void { if ( isGenericOption || node.typeName.type !== AST_NODE_TYPES.Identifier diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 7a5db98db9c..304321001f7 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -9,7 +9,7 @@ export default util.createRule({ docs: { description: 'Disallows awaiting a value that is not a Thenable', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.', @@ -24,7 +24,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - AwaitExpression(node) { + AwaitExpression(node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get< ts.AwaitExpression >(node); diff --git a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts index 87af895627d..7d7a32e6cfc 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts @@ -7,7 +7,7 @@ export default util.createRule({ docs: { description: 'Bans “// @ts-ignore” comments from being used', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: [], messages: { diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index bd3d8bf1b93..a8c2cec6c06 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -25,7 +25,7 @@ function stringifyTypeName( function getCustomMessage( bannedType: null | string | { message?: string; fixWith?: string }, -) { +): string { if (bannedType === null) { return ''; } @@ -108,7 +108,7 @@ export default util.createRule({ ], create(context, [{ types: bannedTypes }]) { return { - TSTypeReference({ typeName }) { + TSTypeReference({ typeName }): void { const name = stringifyTypeName(typeName, context.getSourceCode()); if (name in bannedTypes) { @@ -124,6 +124,7 @@ export default util.createRule({ name: name, customMessage, }, + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type fix: fixWith ? fixer => fixer.replaceText(typeName, fixWith) : null, }); } diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index ffa5a62ed89..4bb614cba9d 100644 --- a/packages/eslint-plugin/src/rules/camelcase.ts +++ b/packages/eslint-plugin/src/rules/camelcase.ts @@ -90,7 +90,7 @@ export default util.createRule({ } return { - Identifier(node) { + Identifier(node): void { /* * Leading and trailing underscores are commonly used to flag * private/protected identifiers, strip them diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index 1c76edd118b..cb238f87ac7 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -64,7 +64,7 @@ export default util.createRule({ | TSESTree.ClassDeclaration | TSESTree.TSInterfaceDeclaration | TSESTree.ClassExpression, - ) { + ): void { // class expressions (i.e. export default class {}) are OK if (node.id && !isPascalCase(node.id.name)) { report(node, node.id); @@ -72,7 +72,7 @@ export default util.createRule({ }, "VariableDeclarator[init.type='ClassExpression']"( node: TSESTree.VariableDeclarator, - ) { + ): void { if ( node.id.type === AST_NODE_TYPES.ArrayPattern || node.id.type === AST_NODE_TYPES.ObjectPattern diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 6380f9f0003..a5f87250da0 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -77,7 +77,7 @@ export default util.createRule({ function reportIncorrectAssertionType( node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, - ) { + ): void { const messageId = options.assertionStyle; context.report({ node, @@ -89,7 +89,7 @@ export default util.createRule({ }); } - function checkType(node: TSESTree.TypeNode) { + function checkType(node: TSESTree.TypeNode): boolean { switch (node.type) { case AST_NODE_TYPES.TSAnyKeyword: case AST_NODE_TYPES.TSUnknownKeyword: @@ -107,7 +107,7 @@ export default util.createRule({ function checkExpression( node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, - ) { + ): void { if ( options.assertionStyle === 'never' || options.objectLiteralTypeAssertions === 'allow' || @@ -137,7 +137,7 @@ export default util.createRule({ } return { - TSTypeAssertion(node) { + TSTypeAssertion(node): void { if (options.assertionStyle !== 'angle-bracket') { reportIncorrectAssertionType(node); return; @@ -145,7 +145,7 @@ export default util.createRule({ checkExpression(node); }, - TSAsExpression(node) { + TSAsExpression(node): void { if (options.assertionStyle !== 'as') { reportIncorrectAssertionType(node); return; diff --git a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts index 01fa92dd3d0..cf9e851c81c 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts @@ -9,6 +9,7 @@ export default util.createRule({ description: 'Consistent with type definition either `interface` or `type`', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -29,7 +30,7 @@ export default util.createRule({ return { "TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"( node: TSESTree.TSTypeAliasDeclaration, - ) { + ): void { if (option === 'interface') { context.report({ node: node.id, @@ -63,7 +64,7 @@ export default util.createRule({ }); } }, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (option === 'type') { context.report({ node: node.id, diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 44ea2d03c8e..67692c20fc0 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -47,8 +47,8 @@ export default util.createRule({ defaultOptions: [ { allowExpressions: false, - allowTypedFunctionExpressions: false, - allowHigherOrderFunctions: false, + allowTypedFunctionExpressions: true, + allowHigherOrderFunctions: true, }, ], create(context, [options]) { diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 8d2b590ffad..21a5a8cda18 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -33,8 +33,9 @@ export default util.createRule({ docs: { description: 'Require explicit accessibility modifiers on class properties and methods', - category: 'Best Practices', - recommended: 'error', + category: 'Stylistic Issues', + // too opinionated to be recommended + recommended: false, }, messages: { missingAccessibility: @@ -82,7 +83,7 @@ export default util.createRule({ nodeType: string, node: TSESTree.Node, nodeName: string, - ) { + ): void { context.report({ node: node, messageId: messageId, @@ -179,7 +180,7 @@ export default util.createRule({ */ function checkParameterPropertyAccessibilityModifier( node: TSESTree.TSParameterProperty, - ) { + ): void { const nodeType = 'parameter property'; // HAS to be an identifier or assignment or TSC will throw if ( diff --git a/packages/eslint-plugin/src/rules/generic-type-naming.ts b/packages/eslint-plugin/src/rules/generic-type-naming.ts index 784a2fc3b0c..95516174448 100644 --- a/packages/eslint-plugin/src/rules/generic-type-naming.ts +++ b/packages/eslint-plugin/src/rules/generic-type-naming.ts @@ -10,6 +10,7 @@ export default util.createRule({ docs: { description: 'Enforces naming of generic type variables', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -30,7 +31,7 @@ export default util.createRule({ const regex = new RegExp(rule!); return { - TSTypeParameter(node) { + TSTypeParameter(node): void { const name = node.name.name; if (name && !regex.test(name)) { diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts index 475e3c35d7b..082ca05129d 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/OffsetStorage.ts @@ -2,7 +2,11 @@ // License: https://github.com/eslint/eslint/blob/48700fc8408f394887cdedd071b22b757700fdcb/LICENSE import { TSESTree } from '@typescript-eslint/experimental-utils'; -import { BinarySearchTree, TokenOrComment } from './BinarySearchTree'; +import { + BinarySearchTree, + TokenOrComment, + TreeValue, +} from './BinarySearchTree'; import { TokenInfo } from './TokenInfo'; /** @@ -34,7 +38,7 @@ export class OffsetStorage { this.ignoredTokens = new WeakSet(); } - private getOffsetDescriptor(token: TokenOrComment) { + private getOffsetDescriptor(token: TokenOrComment): TreeValue { return this.tree.findLe(token.range[0]).value; } @@ -151,8 +155,8 @@ export class OffsetStorage { public setDesiredOffsets( range: [number, number], fromToken: TokenOrComment | null, - offset: number = 0, - force: boolean = false, + offset = 0, + force = false, ): void { /* * Offset ranges are stored as a collection of nodes, where each node maps a numeric key to an offset 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 3549da45d74..56909f15fa7 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 @@ -25,15 +25,13 @@ import { OffsetStorage } from './OffsetStorage'; import { TokenInfo } from './TokenInfo'; import { createRule, ExcludeKeys, RequireKeys } from '../../util'; -function createGlobalLinebreakMatcher() { - return /\r\n|[\r\n\u2028\u2029]/gu; -} +const GLOBAL_LINEBREAK_REGEX = /\r\n|[\r\n\u2028\u2029]/gu; +const WHITESPACE_REGEX = /\s*$/u; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ -const WHITESPACE_REGEX = /\s*$/u; const KNOWN_NODES = new Set([ AST_NODE_TYPES.AssignmentExpression, AST_NODE_TYPES.AssignmentPattern, @@ -440,7 +438,7 @@ export default createRule({ expectedAmount: number, actualSpaces: number, actualTabs: number, - ) { + ): { expected: string; actual: string | number } { const expectedStatement = `${expectedAmount} ${indentType}${ expectedAmount === 1 ? '' : 's' }`; // e.g. "2 tabs" @@ -568,9 +566,7 @@ export default createRule({ */ function countTrailingLinebreaks(str: string): number { const trailingWhitespace = WHITESPACE_REGEX.exec(str)![0]; - const linebreakMatches = createGlobalLinebreakMatcher().exec( - trailingWhitespace, - ); + const linebreakMatches = GLOBAL_LINEBREAK_REGEX.exec(trailingWhitespace); return linebreakMatches === null ? 0 : linebreakMatches.length; } @@ -587,7 +583,7 @@ export default createRule({ startToken: TSESTree.Token, endToken: TSESTree.Token, offset: number | string, - ) { + ): void { /** * Gets the first token of a given element, including surrounding parentheses. * @param element A node in the `elements` list @@ -1589,6 +1585,7 @@ export default createRule({ const listener = baseOffsetListeners[key] as TSESLint.RuleFunction< TSESTree.Node >; + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type acc[key] = node => listenerCallQueue.push({ listener, node }); return acc; diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 76d1edf1cdb..aca492d4b4d 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -90,7 +90,8 @@ export default util.createRule({ docs: { description: 'Enforce consistent indentation', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, fixable: 'whitespace', schema: baseRule.meta.schema, diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 1af78f79a53..11976552221 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -8,8 +8,11 @@ export default util.createRule({ meta: { type: 'suggestion', docs: { - description: 'Require that interface names be prefixed with `I`', + description: + 'Require that interface names should or should not prefixed with `I`', category: 'Stylistic Issues', + // this will always be recommended as there's no reason to use this convention + // https://github.com/typescript-eslint/typescript-eslint/issues/374 recommended: 'error', }, messages: { diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index d2becd1655f..72020afc600 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -364,28 +364,28 @@ export default util.createRule({ } return { - ClassDeclaration(node) { + ClassDeclaration(node): void { validateMembersOrder( node.body.body, options.classes || options.default!, true, ); }, - ClassExpression(node) { + ClassExpression(node): void { validateMembersOrder( node.body.body, options.classExpressions || options.default!, true, ); }, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { validateMembersOrder( node.body.body, options.interfaces || options.default!, false, ); }, - TSTypeLiteral(node) { + TSTypeLiteral(node): void { validateMembersOrder( node.members, options.typeLiterals || options.default!, diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts index d64568a874f..31aa5d8bb63 100644 --- a/packages/eslint-plugin/src/rules/no-empty-function.ts +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -15,7 +15,7 @@ export default util.createRule({ docs: { description: 'Disallow empty functions', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, @@ -81,7 +81,7 @@ export default util.createRule({ */ function isConciseConstructor( node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, - ) { + ): boolean { // Check TypeScript specific nodes return ( isConstructor(node) && isBodyEmpty(node) && hasParameterProperties(node) @@ -89,12 +89,12 @@ export default util.createRule({ } return { - FunctionDeclaration(node: TSESTree.FunctionDeclaration) { + FunctionDeclaration(node): void { if (!isConciseConstructor(node)) { rules.FunctionDeclaration(node); } }, - FunctionExpression(node: TSESTree.FunctionExpression) { + FunctionExpression(node): void { if (!isConciseConstructor(node)) { rules.FunctionExpression(node); } diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 4d2a0a5a488..55fbdb5337e 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -40,7 +40,7 @@ export default util.createRule({ ], create(context, [{ allowSingleExtends }]) { return { - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (node.body.body.length !== 0) { // interface contains members --> Nothing to report return; diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 43f81b8607e..249265a7683 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -167,7 +167,7 @@ export default util.createRule({ } return { - TSAnyKeyword(node) { + TSAnyKeyword(node): void { if (ignoreRestArgs && isNodeDescendantOfRestElementInFunction(node)) { return; } @@ -175,7 +175,8 @@ export default util.createRule({ let fix: TSESLint.ReportFixFunction | null = null; if (fixToUnknown) { - fix = fixer => fixer.replaceText(node, 'unknown'); + fix = (fixer => + fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction; } context.report({ diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 28e69478d7e..7b8d091807c 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -31,7 +31,7 @@ export default util.createRule({ function binaryExp( node: TSESTree.BinaryExpression | TSESTree.LogicalExpression, - ) { + ): void { const rule = rules.BinaryExpression as (n: typeof node) => void; // makes the rule think it should skip the left or right @@ -56,7 +56,9 @@ export default util.createRule({ return rule(node); } - function callExp(node: TSESTree.CallExpression | TSESTree.NewExpression) { + function callExp( + node: TSESTree.CallExpression | TSESTree.NewExpression, + ): void { const rule = rules.CallExpression as (n: typeof node) => void; if (node.callee.type === AST_NODE_TYPES.TSAsExpression) { @@ -74,7 +76,7 @@ export default util.createRule({ } function unaryUpdateExpression( node: TSESTree.UnaryExpression | TSESTree.UpdateExpression, - ) { + ): void { const rule = rules.UnaryExpression as (n: typeof node) => void; if (node.argument.type === AST_NODE_TYPES.TSAsExpression) { diff --git a/packages/eslint-plugin/src/rules/no-extraneous-class.ts b/packages/eslint-plugin/src/rules/no-extraneous-class.ts index 846416866f2..4756b5928f3 100644 --- a/packages/eslint-plugin/src/rules/no-extraneous-class.ts +++ b/packages/eslint-plugin/src/rules/no-extraneous-class.ts @@ -54,7 +54,7 @@ export default util.createRule({ ], create(context, [{ allowConstructorOnly, allowEmpty, allowStaticOnly }]) { return { - ClassBody(node) { + ClassBody(node): void { const parent = node.parent as | TSESTree.ClassDeclaration | TSESTree.ClassExpression diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 04d6664525c..5bc2f75adaa 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -24,7 +24,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - ExpressionStatement(node) { + ExpressionStatement(node): void { const { expression } = parserServices.esTreeNodeToTSNodeMap.get< ts.ExpressionStatement >(node); diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 970c621887e..03171e7fdf7 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -7,7 +7,7 @@ export default util.createRule({ docs: { description: 'Disallow iterating over an array with a for-in loop', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { forInViolation: @@ -19,7 +19,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - ForInStatement(node) { + ForInStatement(node): void { const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); const originalNode = parserServices.esTreeNodeToTSNodeMap.get< diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index f3b44e512fa..40fc6a60c7e 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -44,24 +44,30 @@ export default util.createRule({ }, defaultOptions: [ { - ignoreParameters: true, - ignoreProperties: true, + ignoreParameters: false, + ignoreProperties: false, }, ], create(context, [{ ignoreParameters, ignoreProperties }]) { - function isFunctionCall(init: TSESTree.Expression, callName: string) { + function isFunctionCall( + init: TSESTree.Expression, + callName: string, + ): boolean { return ( init.type === AST_NODE_TYPES.CallExpression && init.callee.type === AST_NODE_TYPES.Identifier && init.callee.name === callName ); } - function isLiteral(init: TSESTree.Expression, typeName: string) { + function isLiteral(init: TSESTree.Expression, typeName: string): boolean { return ( init.type === AST_NODE_TYPES.Literal && typeof init.value === typeName ); } - function isIdentifier(init: TSESTree.Expression, ...names: string[]) { + function isIdentifier( + init: TSESTree.Expression, + ...names: string[] + ): boolean { return ( init.type === AST_NODE_TYPES.Identifier && names.includes(init.name) ); diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 8a50fa87c39..005bae9eb0a 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -150,7 +150,7 @@ export default util.createRule({ } return { - Literal(node) { + Literal(node): void { // Check if the node is a TypeScript enum declaration if (options.ignoreEnums && isParentTSEnumDeclaration(node)) { return; diff --git a/packages/eslint-plugin/src/rules/no-misused-new.ts b/packages/eslint-plugin/src/rules/no-misused-new.ts index aa9d0cb366c..67d00b131f0 100644 --- a/packages/eslint-plugin/src/rules/no-misused-new.ts +++ b/packages/eslint-plugin/src/rules/no-misused-new.ts @@ -16,7 +16,7 @@ export default util.createRule({ schema: [], messages: { errorMessageInterface: 'Interfaces cannot be constructed, only classes.', - errorMessageClass: 'Class cannon have method named `new`.', + errorMessageClass: 'Class cannot have method named `new`.', }, }, defaultOptions: [], @@ -69,7 +69,7 @@ export default util.createRule({ return { 'TSInterfaceBody > TSConstructSignatureDeclaration'( node: TSESTree.TSConstructSignatureDeclaration, - ) { + ): void { if ( isMatchingParentType( node.parent!.parent as TSESTree.TSInterfaceDeclaration, @@ -85,7 +85,7 @@ export default util.createRule({ }, "TSMethodSignature[key.name='constructor']"( node: TSESTree.TSMethodSignature, - ) { + ): void { context.report({ node, messageId: 'errorMessageInterface', @@ -93,7 +93,7 @@ export default util.createRule({ }, "ClassBody > MethodDefinition[key.name='new']"( node: TSESTree.MethodDefinition, - ) { + ): void { if (node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression) { if ( node.parent && diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index b36046352d7..6d06ef8807a 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -17,7 +17,7 @@ export default util.createRule({ docs: { description: 'Avoid using promises in places not designed to handle them', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { voidReturn: @@ -73,13 +73,15 @@ export default util.createRule({ NewExpression: checkArguments, }; - function checkTestConditional(node: { test: TSESTree.Expression | null }) { + function checkTestConditional(node: { + test: TSESTree.Expression | null; + }): void { if (node.test) { checkConditional(node.test); } } - function checkConditional(node: TSESTree.Expression) { + function checkConditional(node: TSESTree.Expression): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); if (isAlwaysThenable(checker, tsNode)) { context.report({ @@ -91,7 +93,7 @@ export default util.createRule({ function checkArguments( node: TSESTree.CallExpression | TSESTree.NewExpression, - ) { + ): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get< ts.CallExpression | ts.NewExpression >(node); @@ -126,7 +128,7 @@ export default util.createRule({ // alternates in a union) to be thenable. Otherwise, you might be trying to // check if something is defined or undefined and get caught because one of the // branches is thenable. -function isAlwaysThenable(checker: ts.TypeChecker, node: ts.Node) { +function isAlwaysThenable(checker: ts.TypeChecker, node: ts.Node): boolean { const type = checker.getTypeAtLocation(node); for (const subType of tsutils.unionTypeParts(checker.getApparentType(type))) { @@ -195,7 +197,7 @@ function isFunctionParam( function voidFunctionParams( checker: ts.TypeChecker, node: ts.CallExpression | ts.NewExpression, -) { +): Set { const voidReturnIndices = new Set(); const thenableReturnIndices = new Set(); const type = checker.getTypeAtLocation(node.expression); @@ -237,7 +239,10 @@ function voidFunctionParams( } // Returns true if the expression is a function that returns a thenable -function returnsThenable(checker: ts.TypeChecker, node: ts.Expression) { +function returnsThenable( + checker: ts.TypeChecker, + node: ts.Expression, +): boolean { const type = checker.getApparentType(checker.getTypeAtLocation(node)); for (const subType of tsutils.unionTypeParts(type)) { diff --git a/packages/eslint-plugin/src/rules/no-namespace.ts b/packages/eslint-plugin/src/rules/no-namespace.ts index ca68fcf647b..3698b4f941b 100644 --- a/packages/eslint-plugin/src/rules/no-namespace.ts +++ b/packages/eslint-plugin/src/rules/no-namespace.ts @@ -53,7 +53,7 @@ export default util.createRule({ return { "TSModuleDeclaration[global!=true][id.type='Identifier']"( node: TSESTree.TSModuleDeclaration, - ) { + ): void { if ( (node.parent && node.parent.type === AST_NODE_TYPES.TSModuleDeclaration) || diff --git a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts index 6ed336e4d2d..4e888c58bb6 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts @@ -8,7 +8,7 @@ export default util.createRule({ description: 'Disallows non-null assertions using the `!` postfix operator', category: 'Stylistic Issues', - recommended: 'error', + recommended: 'warn', }, messages: { noNonNull: 'Forbidden non-null assertion.', @@ -18,7 +18,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - TSNonNullExpression(node) { + TSNonNullExpression(node): void { context.report({ node, messageId: 'noNonNull', diff --git a/packages/eslint-plugin/src/rules/no-parameter-properties.ts b/packages/eslint-plugin/src/rules/no-parameter-properties.ts index a7727a33602..9b6bb31e654 100644 --- a/packages/eslint-plugin/src/rules/no-parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/no-parameter-properties.ts @@ -27,7 +27,8 @@ export default util.createRule({ description: 'Disallow the use of parameter properties in class constructors', category: 'Stylistic Issues', - recommended: 'error', + // too opinionated to be recommended + recommended: false, }, messages: { noParamProp: @@ -81,7 +82,7 @@ export default util.createRule({ } return { - TSParameterProperty(node) { + TSParameterProperty(node): void { const modifiers = getModifiers(node); if (!allows.includes(modifiers)) { diff --git a/packages/eslint-plugin/src/rules/no-require-imports.ts b/packages/eslint-plugin/src/rules/no-require-imports.ts index afb0b4a3848..91d81e0d8c5 100644 --- a/packages/eslint-plugin/src/rules/no-require-imports.ts +++ b/packages/eslint-plugin/src/rules/no-require-imports.ts @@ -18,13 +18,15 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - 'CallExpression > Identifier[name="require"]'(node: TSESTree.Identifier) { + 'CallExpression > Identifier[name="require"]'( + node: TSESTree.Identifier, + ): void { context.report({ node: node.parent!, messageId: 'noRequireImports', }); }, - TSExternalModuleReference(node) { + TSExternalModuleReference(node): void { context.report({ node, messageId: 'noRequireImports', diff --git a/packages/eslint-plugin/src/rules/no-this-alias.ts b/packages/eslint-plugin/src/rules/no-this-alias.ts index e156cbd24e2..8865fad2c3f 100644 --- a/packages/eslint-plugin/src/rules/no-this-alias.ts +++ b/packages/eslint-plugin/src/rules/no-this-alias.ts @@ -19,7 +19,7 @@ export default util.createRule({ docs: { description: 'Disallow aliasing `this`', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: [ { @@ -46,7 +46,7 @@ export default util.createRule({ }, defaultOptions: [ { - allowDestructuring: false, + allowDestructuring: true, allowedNames: [], }, ], @@ -54,7 +54,7 @@ export default util.createRule({ return { "VariableDeclarator[init.type='ThisExpression']"( node: TSESTree.VariableDeclarator, - ) { + ): void { const { id } = node; if (allowDestructuring && id.type !== AST_NODE_TYPES.Identifier) { diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index f260d124133..1648b89f0df 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -44,6 +44,7 @@ export default util.createRule({ docs: { description: 'Disallow the use of type aliases', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, messages: { @@ -188,7 +189,7 @@ export default util.createRule({ */ function validateTypeAliases( type: TypeWithLabel, - isTopLevel: boolean = false, + isTopLevel = false, ): void { if (type.node.type === AST_NODE_TYPES.TSFunctionType) { // callback @@ -268,7 +269,7 @@ export default util.createRule({ } return { - TSTypeAliasDeclaration(node) { + TSTypeAliasDeclaration(node): void { const types = getTypes(node.typeAnnotation); if (types.length === 1) { // is a top level type annotation diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 23a98cb9bef..64f58848d79 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -132,7 +132,7 @@ export default util.createRule({ namespacesInScope.push(esTreeNodeToTSNodeMap.get(node)); } - function exitDeclaration() { + function exitDeclaration(): void { namespacesInScope.pop(); } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index d93e205c7bb..100a9d261c0 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -73,7 +73,7 @@ export default util.createRule<[], MessageIds>({ } return { - TSTypeParameterInstantiation(node) { + TSTypeParameterInstantiation(node): void { const parentDeclaration = parserServices.esTreeNodeToTSNodeMap.get< ExtendingClassLikeDeclaration | ParameterCapableTSNode >(node.parent!); @@ -104,7 +104,7 @@ function getArgsAndParameters( function getTypeParametersFromNode( node: ParameterCapableTSNode, checker: ts.TypeChecker, -) { +): readonly ts.TypeParameterDeclaration[] | undefined { if (ts.isExpressionWithTypeArguments(node)) { return getTypeParametersFromType(node.expression, checker); } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index c91c3d678c7..11da74d88c9 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -27,7 +27,7 @@ export default util.createRule({ description: 'Warns if a type assertion does not change the type of an expression', category: 'Best Practices', - recommended: false, + recommended: 'error', }, fixable: 'code', messages: { @@ -166,7 +166,7 @@ export default util.createRule({ } return { - TSNonNullExpression(node) { + TSNonNullExpression(node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get< ts.NonNullExpression >(node); diff --git a/packages/eslint-plugin/src/rules/no-use-before-define.ts b/packages/eslint-plugin/src/rules/no-use-before-define.ts index 20ed4edc77a..e40da703893 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -255,7 +255,7 @@ export default util.createRule({ } return { - Program() { + Program(): void { findVariablesInScope(context.getScope()); }, }; diff --git a/packages/eslint-plugin/src/rules/no-useless-constructor.ts b/packages/eslint-plugin/src/rules/no-useless-constructor.ts index 6410fa5fa43..3587c795311 100644 --- a/packages/eslint-plugin/src/rules/no-useless-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-useless-constructor.ts @@ -59,7 +59,7 @@ export default util.createRule({ create(context) { const rules = baseRule.create(context); return { - MethodDefinition(node) { + MethodDefinition(node): void { if ( node.value && node.value.type === AST_NODE_TYPES.FunctionExpression && diff --git a/packages/eslint-plugin/src/rules/no-var-requires.ts b/packages/eslint-plugin/src/rules/no-var-requires.ts index 29b1c77dd34..274cf2c1ceb 100644 --- a/packages/eslint-plugin/src/rules/no-var-requires.ts +++ b/packages/eslint-plugin/src/rules/no-var-requires.ts @@ -22,7 +22,7 @@ export default util.createRule({ defaultOptions: [], create(context) { return { - CallExpression(node) { + CallExpression(node): void { if ( node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === 'require' && diff --git a/packages/eslint-plugin/src/rules/prefer-for-of.ts b/packages/eslint-plugin/src/rules/prefer-for-of.ts index 89f6c540303..5aef0845a53 100644 --- a/packages/eslint-plugin/src/rules/prefer-for-of.ts +++ b/packages/eslint-plugin/src/rules/prefer-for-of.ts @@ -181,7 +181,7 @@ export default util.createRule({ } return { - 'ForStatement:exit'(node: TSESTree.ForStatement) { + 'ForStatement:exit'(node: TSESTree.ForStatement): void { if (!isSingleVariableDeclaration(node.init)) { return; } diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index f375b1bb8f2..dae4fae3295 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -72,7 +72,7 @@ export default util.createRule({ | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration, parent: TSESTree.Node, - ) { + ): string { const start = call.range[0]; const colonPos = call.returnType!.range[0] - start; const text = sourceCode.getText().slice(start, call.range[1]); @@ -102,7 +102,10 @@ export default util.createRule({ * @param member The TypeElement being checked * @param node The parent of member being checked */ - function checkMember(member: TSESTree.TypeElement, node: TSESTree.Node) { + function checkMember( + member: TSESTree.TypeElement, + node: TSESTree.Node, + ): void { if ( (member.type === AST_NODE_TYPES.TSCallSignatureDeclaration || member.type === AST_NODE_TYPES.TSConstructSignatureDeclaration) && @@ -141,12 +144,12 @@ export default util.createRule({ } return { - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { if (!hasOneSupertype(node) && node.body.body.length === 1) { checkMember(node.body.body[0], node); } }, - 'TSTypeLiteral[members.length = 1]'(node: TSESTree.TSTypeLiteral) { + 'TSTypeLiteral[members.length = 1]'(node: TSESTree.TSTypeLiteral): void { checkMember(node.members[0], node); }, }; diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 2db17e11d1d..384edf01859 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -13,7 +13,7 @@ export default createRule({ docs: { description: 'Enforce `includes` method over `indexOf` method', category: 'Best Practices', - recommended: false, + recommended: 'error', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts index 6059a731a94..9137fe912aa 100644 --- a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts +++ b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts @@ -26,7 +26,7 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); return { - TSModuleDeclaration(node) { + TSModuleDeclaration(node): void { // Do nothing if the name is a string. if (!node.id || node.id.type === AST_NODE_TYPES.Literal) { return; diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 01f4ea320ba..22c85fd0343 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -61,7 +61,7 @@ export default util.createRule({ node: ts.PropertyAccessExpression, parent: ts.Node, classScope: ClassScope, - ) { + ): void { if (ts.isBinaryExpression(parent)) { handleParentBinaryExpression(node, parent, classScope); return; @@ -84,7 +84,7 @@ export default util.createRule({ node: ts.PropertyAccessExpression, parent: ts.BinaryExpression, classScope: ClassScope, - ) { + ): void { if ( parent.left === node && tsutils.isAssignmentKind(parent.operatorToken.kind) @@ -96,7 +96,7 @@ export default util.createRule({ function handleParentPostfixOrPrefixUnaryExpression( node: ts.PostfixUnaryExpression | ts.PrefixUnaryExpression, classScope: ClassScope, - ) { + ): void { if ( node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken @@ -107,14 +107,16 @@ export default util.createRule({ } } - function isConstructor(node: TSESTree.Node) { + function isConstructor(node: TSESTree.Node): boolean { return ( node.type === AST_NODE_TYPES.MethodDefinition && node.kind === 'constructor' ); } - function isFunctionScopeBoundaryInStack(node: TSESTree.Node) { + function isFunctionScopeBoundaryInStack( + node: TSESTree.Node, + ): boolean | tsutils.ScopeBoundary { if (classScopeStack.length === 0) { return false; } @@ -129,7 +131,7 @@ export default util.createRule({ function getEsNodesFromViolatingNode( violatingNode: ParameterOrPropertyDeclaration, - ) { + ): { esNode: TSESTree.Node; nameNode: TSESTree.Node } { if (ts.isParameterPropertyDeclaration(violatingNode)) { return { esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), @@ -148,7 +150,7 @@ export default util.createRule({ return { 'ClassDeclaration, ClassExpression'( node: TSESTree.ClassDeclaration | TSESTree.ClassExpression, - ) { + ): void { classScopeStack.push( new ClassScope( checker, @@ -157,7 +159,7 @@ export default util.createRule({ ), ); }, - 'ClassDeclaration, ClassExpression:exit'() { + 'ClassDeclaration, ClassExpression:exit'(): void { const finalizedClassScope = classScopeStack.pop()!; const sourceCode = context.getSourceCode(); @@ -175,7 +177,7 @@ export default util.createRule({ }); } }, - MemberExpression(node) { + MemberExpression(node): void { const tsNode = parserServices.esTreeNodeToTSNodeMap.get< ts.PropertyAccessExpression >(node); @@ -187,7 +189,7 @@ export default util.createRule({ ); } }, - [functionScopeBoundaries](node: TSESTree.Node) { + [functionScopeBoundaries](node: TSESTree.Node): void { if (isConstructor(node)) { classScopeStack[classScopeStack.length - 1].enterConstructor( parserServices.esTreeNodeToTSNodeMap.get( @@ -198,7 +200,7 @@ export default util.createRule({ classScopeStack[classScopeStack.length - 1].enterNonConstructor(); } }, - [`${functionScopeBoundaries}:exit`](node: TSESTree.Node) { + [`${functionScopeBoundaries}:exit`](node: TSESTree.Node): void { if (isConstructor(node)) { classScopeStack[classScopeStack.length - 1].exitConstructor(); } else if (isFunctionScopeBoundaryInStack(node)) { @@ -247,7 +249,7 @@ class ClassScope { } } - public addDeclaredVariable(node: ParameterOrPropertyDeclaration) { + public addDeclaredVariable(node: ParameterOrPropertyDeclaration): void { if ( !tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) || tsutils.isModifierFlagSet(node, ts.ModifierFlags.Readonly) || @@ -270,7 +272,7 @@ class ClassScope { ).set(node.name.getText(), node); } - public addVariableModification(node: ts.PropertyAccessExpression) { + public addVariableModification(node: ts.PropertyAccessExpression): void { const modifierType = this.checker.getTypeAtLocation(node.expression); if ( modifierType.symbol === undefined || @@ -295,7 +297,7 @@ class ClassScope { ).add(node.name.text); } - public enterConstructor(node: ts.ConstructorDeclaration) { + public enterConstructor(node: ts.ConstructorDeclaration): void { this.constructorScopeDepth = DIRECTLY_INSIDE_CONSTRUCTOR; for (const parameter of node.parameters) { @@ -305,23 +307,23 @@ class ClassScope { } } - public exitConstructor() { + public exitConstructor(): void { this.constructorScopeDepth = OUTSIDE_CONSTRUCTOR; } - public enterNonConstructor() { + public enterNonConstructor(): void { if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) { this.constructorScopeDepth += 1; } } - public exitNonConstructor() { + public exitNonConstructor(): void { if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) { this.constructorScopeDepth -= 1; } } - public finalizeUnmodifiedPrivateNonReadonlys() { + public finalizeUnmodifiedPrivateNonReadonlys(): ParameterOrPropertyDeclaration[] { this.memberVariableModifications.forEach(variableName => { this.privateModifiableMembers.delete(variableName); }); diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index c48e2351985..bd1a48fcb61 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -12,7 +12,7 @@ export default createRule({ description: 'Prefer RegExp#exec() over String#match() if no global flag is provided', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { regExpExecOverStringMatch: 'Use the `RegExp#exec()` method instead.', @@ -39,7 +39,7 @@ export default createRule({ return { "CallExpression[arguments.length=1] > MemberExpression.callee[property.name='match'][computed=false]"( node: TSESTree.MemberExpression, - ) { + ): void { const callNode = node.parent as TSESTree.CallExpression; const arg = callNode.arguments[0]; const evaluated = getStaticValue(arg, globalScope); diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 4e902dfd584..2ffac6728ac 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -20,7 +20,7 @@ export default createRule({ description: 'Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { preferStartsWith: "Use 'String#startsWith' method instead.", diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 48d63cf0f54..faf55f95fa7 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -86,7 +86,7 @@ export default util.createRule({ const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); - function validateNode(node: TSESTree.Node) { + function validateNode(node: TSESTree.Node): void { const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); const signatures = checker .getTypeAtLocation(originalNode) @@ -111,17 +111,21 @@ export default util.createRule({ return { 'ArrowFunctionExpression[async = false]'( node: TSESTree.ArrowFunctionExpression, - ) { + ): void { if (checkArrowFunctions) { validateNode(node); } }, - 'FunctionDeclaration[async = false]'(node: TSESTree.FunctionDeclaration) { + 'FunctionDeclaration[async = false]'( + node: TSESTree.FunctionDeclaration, + ): void { if (checkFunctionDeclarations) { validateNode(node); } }, - 'FunctionExpression[async = false]'(node: TSESTree.FunctionExpression) { + 'FunctionExpression[async = false]'( + node: TSESTree.FunctionExpression, + ): void { if ( node.parent && 'kind' in node.parent && diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index a9745be16e0..5b3f430420f 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -26,7 +26,7 @@ export default util.createRule({ return { "CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]"( node: TSESTree.MemberExpression, - ) { + ): void { // Get the symbol of the `sort` method. const tsNode = service.esTreeNodeToTSNodeMap.get(node); const sortSymbol = checker.getSymbolAtLocation(tsNode); diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index cbdd08791d9..ef1092b46db 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -23,7 +23,7 @@ export default util.createRule({ docs: { description: 'Disallow async functions which have no `await` expression', category: 'Best Practices', - recommended: false, + recommended: 'error', }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, @@ -46,7 +46,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, - ) { + ): void { scopeInfo = { upper: scopeInfo, returnsPromise: false, @@ -79,7 +79,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.ArrowFunctionExpression, - ) { + ): void { if (scopeInfo) { if (!scopeInfo.returnsPromise) { switch (node.type) { @@ -109,7 +109,7 @@ export default util.createRule({ 'FunctionExpression[async = true]:exit': exitFunction, 'ArrowFunctionExpression[async = true]:exit': exitFunction, - ReturnStatement(node: TSESTree.ReturnStatement) { + ReturnStatement(node): void { if (!scopeInfo) { return; } diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index 6d68d5f7dfc..df523033bf7 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -83,7 +83,7 @@ export default util.createRule({ } return { - "BinaryExpression[operator='+']"(node: TSESTree.BinaryExpression) { + "BinaryExpression[operator='+']"(node: TSESTree.BinaryExpression): void { const leftType = getNodeType(node.left); const rightType = getNodeType(node.right); diff --git a/packages/eslint-plugin/src/rules/semi.ts b/packages/eslint-plugin/src/rules/semi.ts index 8130088eb30..8d1ada467e3 100644 --- a/packages/eslint-plugin/src/rules/semi.ts +++ b/packages/eslint-plugin/src/rules/semi.ts @@ -16,6 +16,7 @@ export default util.createRule({ docs: { description: 'Require or disallow semicolons instead of ASI', category: 'Stylistic Issues', + // too opinionated to be recommended recommended: false, }, fixable: 'code', @@ -59,7 +60,7 @@ export default util.createRule({ return { ...rules, ...nodesToCheck, - ExportDefaultDeclaration(node) { + ExportDefaultDeclaration(node): void { if (node.declaration.type !== AST_NODE_TYPES.TSInterfaceDeclaration) { rules.ExportDefaultDeclaration(node); } diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 7d74ab0c603..c5ab5772523 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -18,7 +18,7 @@ export default util.createRule({ description: 'Sets preference level for triple slash directives versus ES6-style import declarations', category: 'Best Practices', - recommended: false, + recommended: 'error', }, messages: { tripleSlashReference: @@ -57,7 +57,7 @@ export default util.createRule({ importName: string; })[] = []; - function hasMatchingReference(source: TSESTree.Literal) { + function hasMatchingReference(source: TSESTree.Literal): void { references.forEach(reference => { if (reference.importName === source.value) { context.report({ @@ -71,20 +71,20 @@ export default util.createRule({ }); } return { - ImportDeclaration(node) { + ImportDeclaration(node): void { if (programNode) { const source = node.source as TSESTree.Literal; hasMatchingReference(source); } }, - TSImportEqualsDeclaration(node) { + TSImportEqualsDeclaration(node): void { if (programNode) { const source = (node.moduleReference as TSESTree.TSExternalModuleReference) .expression as TSESTree.Literal; hasMatchingReference(source); } }, - Program(node) { + Program(node): void { if (lib === 'always' && path === 'always' && types == 'always') { return; } diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index f5e11f51fb0..d0f1c5b45a4 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -185,12 +185,12 @@ export default util.createRule({ } return { - TSMappedType(node) { + TSMappedType(node): void { if (node.typeAnnotation) { checkTypeAnnotationSpacing(node.typeAnnotation); } }, - TSTypeAnnotation(node) { + TSTypeAnnotation(node): void { checkTypeAnnotationSpacing(node.typeAnnotation); }, }; diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 3c535467f2c..182568e5748 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -55,7 +55,7 @@ export default util.createRule<[Options], MessageIds>({ }, ], create(context, [options]) { - function report(location: TSESTree.Node, name?: string) { + function report(location: TSESTree.Node, name?: string): void { context.report({ node: location, messageId: name ? 'expectedTypedefNamed' : 'expectedTypedef', @@ -63,11 +63,13 @@ export default util.createRule<[Options], MessageIds>({ }); } - function getNodeName(node: TSESTree.Parameter | TSESTree.PropertyName) { + function getNodeName( + node: TSESTree.Parameter | TSESTree.PropertyName, + ): string | undefined { return node.type === AST_NODE_TYPES.Identifier ? node.name : undefined; } - function checkParameters(params: TSESTree.Parameter[]) { + function checkParameters(params: TSESTree.Parameter[]): void { for (const param of params) { let annotationNode: TSESTree.Node | undefined; @@ -90,17 +92,17 @@ export default util.createRule<[Options], MessageIds>({ } return { - ArrayPattern(node) { + ArrayPattern(node): void { if (options[OptionKeys.ArrayDestructuring] && !node.typeAnnotation) { report(node); } }, - ArrowFunctionExpression(node) { + ArrowFunctionExpression(node): void { if (options[OptionKeys.ArrowParameter]) { checkParameters(node.params); } }, - ClassProperty(node) { + ClassProperty(node): void { if ( options[OptionKeys.MemberVariableDeclaration] && !node.typeAnnotation @@ -115,19 +117,19 @@ export default util.createRule<[Options], MessageIds>({ }, 'FunctionDeclaration, FunctionExpression'( node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, - ) { + ): void { if (options[OptionKeys.Parameter]) { checkParameters(node.params); } }, - ObjectPattern(node) { + ObjectPattern(node): void { if (options[OptionKeys.ObjectDestructuring] && !node.typeAnnotation) { report(node); } }, 'TSIndexSignature, TSPropertySignature'( node: TSESTree.TSIndexSignature | TSESTree.TSPropertySignature, - ) { + ): void { if (options[OptionKeys.PropertyDeclaration] && !node.typeAnnotation) { report( node, @@ -137,7 +139,7 @@ export default util.createRule<[Options], MessageIds>({ ); } }, - VariableDeclarator(node) { + VariableDeclarator(node): void { if ( options[OptionKeys.VariableDeclaration] && !node.id.typeAnnotation diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 88892b63417..0db82b2c770 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -25,7 +25,7 @@ export default util.createRule({ category: 'Best Practices', description: 'Enforces unbound methods are called with their expected scope', - recommended: false, + recommended: 'error', }, messages: { unbound: @@ -54,7 +54,7 @@ export default util.createRule({ const checker = parserServices.program.getTypeChecker(); return { - [AST_NODE_TYPES.MemberExpression](node: TSESTree.MemberExpression) { + MemberExpression(node): void { if (isSafeUse(node)) { return; } @@ -73,7 +73,7 @@ export default util.createRule({ }, }); -function isDangerousMethod(symbol: ts.Symbol, ignoreStatic: boolean) { +function isDangerousMethod(symbol: ts.Symbol, ignoreStatic: boolean): boolean { const { valueDeclaration } = symbol; if (!valueDeclaration) { // working around https://github.com/microsoft/TypeScript/issues/31294 diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 04695fcc302..1c3f747bc51 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -55,6 +55,7 @@ export default util.createRule({ description: 'Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter', category: 'Variables', + // too opinionated to be recommended recommended: false, }, type: 'suggestion', @@ -307,14 +308,14 @@ export default util.createRule({ typeParameters?: TSESTree.TSTypeParameterDeclaration, ): IsTypeParameter { if (typeParameters === undefined) { - return () => false; + return (() => false) as IsTypeParameter; } const set = new Set(); for (const t of typeParameters.params) { set.add(t.name.name); } - return typeName => set.has(typeName); + return (typeName => set.has(typeName)) as IsTypeParameter; } /** True if any of the outer type parameters are used in a signature. */ @@ -476,7 +477,7 @@ export default util.createRule({ function createScope( parent: ScopeNode, typeParameters?: TSESTree.TSTypeParameterDeclaration, - ) { + ): void { currentScope && scopes.push(currentScope); currentScope = { overloads: new Map(), @@ -485,7 +486,7 @@ export default util.createRule({ }; } - function checkScope() { + function checkScope(): void { const failures = checkOverloads( Array.from(currentScope.overloads.values()), currentScope.typeParameters, @@ -494,7 +495,7 @@ export default util.createRule({ currentScope = scopes.pop()!; } - function addOverload(signature: OverloadNode, key?: string) { + function addOverload(signature: OverloadNode, key?: string): void { key = key || getOverloadKey(signature); if (currentScope && signature.parent === currentScope.parent && key) { const overloads = currentScope.overloads.get(key); @@ -513,15 +514,15 @@ export default util.createRule({ return { Program: createScope, TSModuleBlock: createScope, - TSInterfaceDeclaration(node) { + TSInterfaceDeclaration(node): void { createScope(node.body, node.typeParameters); }, - ClassDeclaration(node) { + ClassDeclaration(node): void { createScope(node.body, node.typeParameters); }, TSTypeLiteral: createScope, // collect overloads - TSDeclareFunction(node) { + TSDeclareFunction(node): void { if (node.id && !node.body) { addOverload(node, node.id.name); } @@ -529,12 +530,12 @@ export default util.createRule({ TSCallSignatureDeclaration: addOverload, TSConstructSignatureDeclaration: addOverload, TSMethodSignature: addOverload, - TSAbstractMethodDefinition(node) { + TSAbstractMethodDefinition(node): void { if (!node.value.body) { addOverload(node); } }, - MethodDefinition(node) { + MethodDefinition(node): void { if (!node.value.body) { addOverload(node); } diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 30587b336ed..cae887c229f 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -11,14 +11,14 @@ import { /** * Check if the context file name is *.d.ts or *.d.tsx */ -export function isDefinitionFile(fileName: string) { +export function isDefinitionFile(fileName: string): boolean { return /\.d\.tsx?$/i.test(fileName || ''); } /** * Upper cases the first character or the string */ -export function upperCaseFirst(str: string) { +export function upperCaseFirst(str: string): string { return str[0].toUpperCase() + str.slice(1); } diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index 83a8bbabf57..6f769d7f950 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -186,7 +186,10 @@ export function isTypeFlagSet( /** * @returns Whether a type is an instance of the parent type, including for the parent's base types. */ -export const typeIsOrHasBaseType = (type: ts.Type, parentType: ts.Type) => { +export function typeIsOrHasBaseType( + type: ts.Type, + parentType: ts.Type, +): boolean { if (type.symbol === undefined || parentType.symbol === undefined) { return false; } @@ -208,4 +211,4 @@ export const typeIsOrHasBaseType = (type: ts.Type, parentType: ts.Type) => { } return false; -}; +} diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index fe3d06d4fc8..978adc10966 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -68,7 +68,7 @@ class RuleTester extends TSESLint.RuleTester { } } -function getFixturesRootDir() { +function getFixturesRootDir(): string { return path.join(process.cwd(), 'tests/fixtures/'); } diff --git a/packages/eslint-plugin/tests/rules/indent/utils.ts b/packages/eslint-plugin/tests/rules/indent/utils.ts index 72cedd3ea64..badfbc1c3c6 100644 --- a/packages/eslint-plugin/tests/rules/indent/utils.ts +++ b/packages/eslint-plugin/tests/rules/indent/utils.ts @@ -17,6 +17,7 @@ type MessageIds = InferMessageIdsTypeFromRule; * @returns The template literal, with spaces removed from all lines */ export function unIndent(strings: TemplateStringsArray): string { + const WHITESPACE_REGEX = / */u; const templateValue = strings[0]; const lines = templateValue .replace(/^\n/u, '') @@ -24,7 +25,7 @@ export function unIndent(strings: TemplateStringsArray): string { .split('\n'); const lineIndents = lines .filter(line => line.trim()) - .map(line => / */u.exec(line)![0].length); + .map(line => WHITESPACE_REGEX.exec(line)![0].length); const minLineIndent = Math.min(...lineIndents); return lines.map(line => line.slice(minLineIndent)).join('\n'); diff --git a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts index c1ddce12186..03723eb9515 100644 --- a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts @@ -68,6 +68,11 @@ declare module 'foo' { }, { code: 'const { props, state } = this;', + options: [ + { + allowDestructuring: false, + }, + ], errors: [destructureError], }, { @@ -104,6 +109,11 @@ class TestClass { } } `, + options: [ + { + allowDestructuring: false, + }, + ], errors: [ idError, idError, diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts index d09724e8eee..45bb8c80db1 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars.test.ts @@ -10,10 +10,12 @@ const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -function error(messages: { message: string; line: number; column: number }[]) { - // the base rule doesn't have messageIds +// the base rule doesn't have messageIds +function error( + messages: { message: string; line: number; column: number }[], // eslint-disable-next-line @typescript-eslint/no-explicit-any - return messages as any[]; +): any[] { + return messages; } ruleTester.run('no-unused-vars', rule, { diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 5e293018eb4..d7f5fb29afd 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -2,8 +2,11 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; +import { format, resolveConfig } from 'prettier'; import rules from '../src/rules'; +const prettierConfig = resolveConfig(__dirname); + interface LinterConfigRules { [name: string]: | TSESLint.Linter.RuleLevel @@ -23,29 +26,40 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'func-call-spacing', 'indent', 'no-array-constructor', + 'no-empty-function', 'no-extra-parens', 'no-magic-numbers', 'no-unused-vars', 'no-use-before-define', 'no-useless-constructor', + 'require-await', 'semi', ]); +// 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([ + 'no-var', + 'prefer-const', + 'prefer-rest-params', + 'prefer-spread', +]); -const ruleEntries = Object.entries(rules); +const ruleEntries = Object.entries(rules).sort((a, b) => + a[0].localeCompare(b[0]), +); /** * Helper function reduces records to key - value pairs. * @param config * @param entry */ -const reducer = ( +function reducer( config: LinterConfigRules, entry: [string, TSESLint.RuleModule], settings: { errorLevel?: 'error' | 'warn'; filterDeprecated: boolean; }, -) => { +): LinterConfigRules { const key = entry[0]; const value = entry[1]; @@ -81,13 +95,17 @@ const reducer = ( config[ruleName] = usedSetting; return config; -}; +} /** * Helper function writes configuration. */ function writeConfig(config: LinterConfig, filePath: string): void { - fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`); + const configStr = format(JSON.stringify(config), { + parser: 'json', + ...prettierConfig, + }); + fs.writeFileSync(filePath, configStr); } const baseConfig: LinterConfig = { @@ -117,14 +135,18 @@ console.log(); console.log( '------------------------------ recommended.json ------------------------------', ); +const recommendedRules = ruleEntries + .filter(entry => !!entry[1].meta.docs.recommended) + .reduce( + (config, entry) => reducer(config, entry, { filterDeprecated: false }), + {}, + ); +BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { + recommendedRules[ruleName] = 'error'; +}); const recommendedConfig: LinterConfig = { extends: './configs/base.json', - rules: ruleEntries - .filter(entry => !!entry[1].meta.docs.recommended) - .reduce( - (config, entry) => reducer(config, entry, { filterDeprecated: false }), - {}, - ), + rules: recommendedRules, }; writeConfig( recommendedConfig, diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts index 84981b8816e..fab57fe20cf 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigAll.ts @@ -3,13 +3,13 @@ import { logRule } from '../log'; const prefix = '@typescript-eslint/'; -function checkConfigAll() { +function checkConfigAll(): boolean { const { rules } = plugin; const all = plugin.configs.all.rules; const allNames = new Set(Object.keys(all)); - return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { if (!rule.meta.deprecated) { const prefixed = `${prefix}${ruleName}` as keyof typeof all; if (allNames.has(prefixed)) { diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts index 21f2faa876d..ae256143112 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts @@ -3,13 +3,13 @@ import { logRule } from '../log'; const prefix = '@typescript-eslint/'; -function checkConfigRecommended() { +function checkConfigRecommended(): boolean { const { rules } = plugin; const recommended = plugin.configs.recommended.rules; const recommendedNames = new Set(Object.keys(recommended)); - return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { if (!rule.meta.deprecated && rule.meta.docs.recommended !== false) { const prefixed = `${prefix}${ruleName}` as keyof typeof recommended; if (recommendedNames.has(prefixed)) { diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts index e9d339c10c2..ed6a8131edb 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts @@ -3,6 +3,7 @@ import chalk from 'chalk'; import marked from 'marked'; import { logError } from '../log'; +const RULE_LINK_REGEX = /\[`@typescript-eslint\/(.+)`\]/; function validateTableStructure( rules: Record>>, rulesTable: marked.Tokens.Table, @@ -13,7 +14,7 @@ function validateTableStructure( let hasErrors = false; rulesTable.cells.forEach((row, rowIndex) => { - const match = /\[`@typescript-eslint\/(.+)`\]/.exec(row[0]); + const match = RULE_LINK_REGEX.exec(row[0]); if (!match) { logError(chalk.bold(`Unable to parse link in row ${rowIndex}:`), row[0]); hasErrors = true; diff --git a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts index e14242fca72..3edb71e5a55 100644 --- a/packages/experimental-utils/src/eslint-utils/RuleCreator.ts +++ b/packages/experimental-utils/src/eslint-utils/RuleCreator.ts @@ -42,7 +42,7 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { url: urlCreator(name), }, }, - create(context) { + create(context): TRuleListener { const optionsWithDefault = applyDefault( defaultOptions, context.options, diff --git a/packages/experimental-utils/src/eslint-utils/deepMerge.ts b/packages/experimental-utils/src/eslint-utils/deepMerge.ts index 966a0db0821..3db67a59407 100644 --- a/packages/experimental-utils/src/eslint-utils/deepMerge.ts +++ b/packages/experimental-utils/src/eslint-utils/deepMerge.ts @@ -18,7 +18,10 @@ export function isObjectNotArray( * @param second The second object * @returns a new object */ -export function deepMerge(first: ObjectLike = {}, second: ObjectLike = {}) { +export function deepMerge( + first: ObjectLike = {}, + second: ObjectLike = {}, +): Record { // get the unique set of keys across both objects const keys = new Set(Object.keys(first).concat(Object.keys(second))); diff --git a/packages/parser/src/analyze-scope.ts b/packages/parser/src/analyze-scope.ts index 6c7e5a38428..1b98c064db0 100644 --- a/packages/parser/src/analyze-scope.ts +++ b/packages/parser/src/analyze-scope.ts @@ -21,7 +21,7 @@ function overrideDefine( this: TSESLintScope.Scope, node: TSESTree.Node, definition: TSESLintScope.Definition, - ) { + ): void { define.call(this, node, definition); // Set `variable.eslintUsed` to tell ESLint that the variable is exported. @@ -147,7 +147,7 @@ class Referencer extends TSESLintScope.Referencer { const upperScope = this.currentScope(); // Process the name. - if (type === 'FunctionDeclaration' && id) { + if (type === AST_NODE_TYPES.FunctionDeclaration && id) { upperScope.__define( id, new TSESLintScope.Definition( @@ -166,14 +166,14 @@ class Referencer extends TSESLintScope.Referencer { const def = defs[i]; if ( def.type === 'FunctionName' && - def.node.type === 'TSDeclareFunction' + def.node.type === AST_NODE_TYPES.TSDeclareFunction ) { defs.splice(i, 1); identifiers.splice(i, 1); break; } } - } else if (type === 'FunctionExpression' && id) { + } else if (type === AST_NODE_TYPES.FunctionExpression && id) { scopeManager.__nestFunctionExpressionNameScope(node); } @@ -213,7 +213,7 @@ class Referencer extends TSESLintScope.Referencer { this.visit(returnType); // Process the body. - if (body && body.type === 'BlockStatement') { + if (body && body.type === AST_NODE_TYPES.BlockStatement) { this.visitChildren(body); } else { this.visit(body); @@ -732,7 +732,7 @@ class Referencer extends TSESLintScope.Referencer { return; } - if (id && id.type === 'Identifier') { + if (id && id.type === AST_NODE_TYPES.Identifier) { scope.__define( id, new TSESLintScope.Definition( @@ -777,7 +777,7 @@ class Referencer extends TSESLintScope.Referencer { */ TSImportEqualsDeclaration(node: TSESTree.TSImportEqualsDeclaration): void { const { id, moduleReference } = node; - if (id && id.type === 'Identifier') { + if (id && id.type === AST_NODE_TYPES.Identifier) { this.currentScope().__define( id, new TSESLintScope.Definition( @@ -809,7 +809,7 @@ class Referencer extends TSESLintScope.Referencer { scopeManager.__currentScope = globalScope; // Skip TSModuleBlock to avoid to create that block scope. - if (node.body && node.body.type === 'TSModuleBlock') { + if (node.body && node.body.type === AST_NODE_TYPES.TSModuleBlock) { node.body.body.forEach(this.visit, this); } @@ -845,7 +845,7 @@ class Referencer extends TSESLintScope.Referencer { export function analyzeScope( ast: TSESTree.Program, parserOptions: ParserOptions, -) { +): ScopeManager { const options = { ignoreEval: true, optimistic: false, diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index fb5142f9b37..830a282da1e 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -28,7 +28,7 @@ interface ParseForESLintResult { function validateBoolean( value: boolean | undefined, - fallback: boolean = false, + fallback = false, ): boolean { if (typeof value !== 'boolean') { return fallback; @@ -44,7 +44,10 @@ export const version = packageJSON.version; export const Syntax = Object.freeze(AST_NODE_TYPES); -export function parse(code: string, options?: ParserOptions) { +export function parse( + code: string, + options?: ParserOptions, +): ParseForESLintResult['ast'] { return parseForESLint(code, options).ast; } diff --git a/packages/parser/src/scope/scope-manager.ts b/packages/parser/src/scope/scope-manager.ts index 648e24b77f8..c179bd512d3 100644 --- a/packages/parser/src/scope/scope-manager.ts +++ b/packages/parser/src/scope/scope-manager.ts @@ -13,12 +13,14 @@ export class ScopeManager extends TSESLintScope.ScopeManager { } /** @internal */ - __nestEnumScope(node: TSESTree.TSEnumDeclaration) { + __nestEnumScope(node: TSESTree.TSEnumDeclaration): TSESLintScope.Scope { return this.__nestScope(new EnumScope(this, this.__currentScope, node)); } /** @internal */ - __nestEmptyFunctionScope(node: TSESTree.TSDeclareFunction) { + __nestEmptyFunctionScope( + node: TSESTree.TSDeclareFunction, + ): TSESLintScope.Scope { return this.__nestScope( new EmptyFunctionScope(this, this.__currentScope, node), ); diff --git a/packages/parser/src/simple-traverse.ts b/packages/parser/src/simple-traverse.ts index 10f58918799..a616f239a7b 100644 --- a/packages/parser/src/simple-traverse.ts +++ b/packages/parser/src/simple-traverse.ts @@ -26,7 +26,7 @@ class SimpleTraverser { this.enter = enter; } - traverse(node: unknown, parent: TSESTree.Node | undefined) { + traverse(node: unknown, parent: TSESTree.Node | undefined): void { if (!isValidNode(node)) { return; } @@ -54,6 +54,6 @@ class SimpleTraverser { export function simpleTraverse( startingNode: TSESTree.Node, options: SimpleTraverseOptions, -) { +): void { new SimpleTraverser(options).traverse(startingNode, undefined); } diff --git a/packages/parser/tests/lib/basics.ts b/packages/parser/tests/lib/basics.ts index d526745e341..c06e8e57be1 100644 --- a/packages/parser/tests/lib/basics.ts +++ b/packages/parser/tests/lib/basics.ts @@ -39,7 +39,7 @@ export const Price: React.SFC = function Price(props) {} linter.defineRule('test', { create(context) { return { - TSTypeReference(node) { + TSTypeReference(node): void { const name = context.getSourceCode().getText(node.typeName); context.report({ node, diff --git a/packages/parser/tests/lib/jsx.ts b/packages/parser/tests/lib/jsx.ts index 4d7f6a3f9bf..530b26c444b 100644 --- a/packages/parser/tests/lib/jsx.ts +++ b/packages/parser/tests/lib/jsx.ts @@ -27,7 +27,7 @@ describe('JSX', () => { * Test each fixture file */ function testFixture(fixturesDir: string, useJSXTextNode: boolean) { - return (filename: string) => { + return (filename: string): void => { const code = fs.readFileSync(filename, 'utf8'); const config = { useJSXTextNode, diff --git a/packages/parser/tests/tools/scope-analysis.ts b/packages/parser/tests/tools/scope-analysis.ts index e7aab1d9951..373b863be81 100644 --- a/packages/parser/tests/tools/scope-analysis.ts +++ b/packages/parser/tests/tools/scope-analysis.ts @@ -8,20 +8,20 @@ export class ReferenceResolver { this.map = new Map(); } - resolve(obj: any, properties: any) { + resolve(obj: any, properties: any): any { const resolved = Object.assign({ $id: this.map.size }, properties); this.map.set(obj, resolved); return resolved; } - ref(obj: any) { + ref(obj: any): any { if (typeof obj !== 'object' || obj === null) { return obj; } - const { map } = this; + const map = this.map; return { - get $ref() { + get $ref(): any { return map.get(obj).$id; }, }; @@ -34,7 +34,7 @@ export class ReferenceResolver { * @param {ASTNode} node The AST node object. * @returns {Object} The object that can be used for JSON.stringify. */ -export function nodeToJSON(node: any) { +export function nodeToJSON(node: any): any { if (!node) { return node; } @@ -52,7 +52,7 @@ export function nodeToJSON(node: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function variableToJSON(variable: any, resolver: any) { +export function variableToJSON(variable: any, resolver: any): any { const { name, eslintUsed } = variable; const defs = variable.defs.map((d: any) => ({ type: d.type, @@ -80,7 +80,7 @@ export function variableToJSON(variable: any, resolver: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function referenceToJSON(reference: any, resolver: any) { +export function referenceToJSON(reference: any, resolver: any): any { const kind = `${reference.isRead() ? 'r' : ''}${ reference.isWrite() ? 'w' : '' }`; @@ -104,7 +104,10 @@ export function referenceToJSON(reference: any, resolver: any) { * @param {ReferenceResolver} resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ -export function scopeToJSON(scope: any, resolver = new ReferenceResolver()) { +export function scopeToJSON( + scope: any, + resolver = new ReferenceResolver(), +): any { const { type, functionExpressionScope, isStrict } = scope; const block = nodeToJSON(scope.block); const variables = scope.variables.map((v: any) => @@ -142,7 +145,7 @@ export function scopeToJSON(scope: any, resolver = new ReferenceResolver()) { }); } -export function getScopeTree(scopeManager: any) { +export function getScopeTree(scopeManager: any): any { const { globalScope } = scopeManager; // Do the postprocess to test. diff --git a/packages/parser/tests/tools/test-utils.ts b/packages/parser/tests/tools/test-utils.ts index 1ce769a521b..28dd40d2e07 100644 --- a/packages/parser/tests/tools/test-utils.ts +++ b/packages/parser/tests/tools/test-utils.ts @@ -18,7 +18,7 @@ const defaultConfig = { * @param ast the AST object * @returns copy of the AST object */ -function getRaw(ast: TSESTree.Program) { +function getRaw(ast: TSESTree.Program): TSESTree.Program { return JSON.parse( JSON.stringify(ast, (key, value) => { if ((key === 'start' || key === 'end') && typeof value === 'number') { @@ -39,18 +39,18 @@ function getRaw(ast: TSESTree.Program) { export function createSnapshotTestBlock( code: string, config: ParserOptions = {}, -) { +): () => void { config = Object.assign({}, defaultConfig, config); /** * @returns {Object} the AST object */ - function parse() { + function parse(): TSESTree.Program { const ast = parser.parseForESLint(code, config).ast; return getRaw(ast); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); @@ -77,18 +77,19 @@ export function createSnapshotTestBlock( export function createScopeSnapshotTestBlock( code: string, config: ParserOptions = {}, -) { +): () => void { config = Object.assign({}, defaultConfig, config); /** * @returns {Object} the AST object */ - function parse() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function parse(): any { const result = parser.parseForESLint(code, config); return getScopeTree(result.scopeManager); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); @@ -123,7 +124,7 @@ export function formatSnapshotName( filename: string, fixturesDir: string, fileExtension = '.js', -) { +): string { return `fixtures/${filename .replace(fixturesDir + '/', '') .replace(fileExtension, '')}`; diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index 9cb2bdc974a..fffb9ea15cf 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -1,14 +1,15 @@ import { SourceFile } from 'typescript'; -import { convertError, Converter } from './convert'; +import { convertError, Converter, ASTMaps } from './convert'; import { convertComments } from './convert-comments'; import { convertTokens } from './node-utils'; import { Extra } from './parser-options'; +import { TSESTree } from './ts-estree'; export function astConverter( ast: SourceFile, extra: Extra, shouldPreserveNodeMaps: boolean, -) { +): { estree: TSESTree.Program; astMaps: ASTMaps | undefined } { /** * The TypeScript compiler produced fundamental parse errors when parsing the * source. diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index dedae68dd17..3a7d2de99dc 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -19,8 +19,10 @@ import { isESTreeClassMember, isOptional, unescapeStringLiteralText, + TSError, } from './node-utils'; import { AST_NODE_TYPES, TSESTree, TSNode } from './ts-estree'; +import { ParserWeakMap } from './parser-options'; const SyntaxKind = ts.SyntaxKind; @@ -35,7 +37,7 @@ interface ConverterOptions { * @param error the error object * @returns converted error object */ -export function convertError(error: any) { +export function convertError(error: any): TSError { return createError( error.file, error.start, @@ -43,14 +45,19 @@ export function convertError(error: any) { ); } +export interface ASTMaps { + esTreeNodeToTSNodeMap: ParserWeakMap; + tsNodeToESTreeNodeMap: ParserWeakMap; +} + export class Converter { private readonly ast: ts.SourceFile; private readonly options: ConverterOptions; private readonly esTreeNodeToTSNodeMap = new WeakMap(); private readonly tsNodeToESTreeNodeMap = new WeakMap(); - private allowPattern: boolean = false; - private inTypeMode: boolean = false; + private allowPattern = false; + private inTypeMode = false; /** * Converts a TypeScript node into an ESTree node @@ -63,7 +70,7 @@ export class Converter { this.options = options; } - getASTMaps() { + getASTMaps(): ASTMaps { return { esTreeNodeToTSNodeMap: this.esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap: this.tsNodeToESTreeNodeMap, @@ -168,7 +175,7 @@ export class Converter { private registerTSNodeInNodeMap( node: ts.Node, result: TSESTree.BaseNode | null, - ) { + ): void { if (result && this.options.shouldPreserveNodeMaps) { if (!this.tsNodeToESTreeNodeMap.has(node)) { this.tsNodeToESTreeNodeMap.set(node, result); diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index f1666635b11..c23daf6e317 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -644,6 +644,13 @@ export function getNodeContainer( return container!; } +export interface TSError { + index: number; + lineNumber: number; + column: number; + message: string; +} + /** * @param ast the AST object * @param start the index at which the error starts @@ -654,7 +661,7 @@ export function createError( ast: ts.SourceFile, start: number, message: string, -) { +): TSError { const loc = ast.getLineAndCharacterOfPosition(start); return { index: start, @@ -668,7 +675,7 @@ export function createError( * @param n the TSNode * @param ast the TS AST */ -export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile) { +export function nodeHasTokens(n: ts.Node, ast: ts.SourceFile): boolean { // If we have a token or node that has a non-zero width, it must have tokens. // Note: getWidth() does not take trivia into account. return n.kind === SyntaxKind.EndOfFileToken diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 564114d7ccb..f215fa44492 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -33,7 +33,7 @@ let warnedAboutTSVersion = false; * * @param options Parser options */ -function getFileName({ jsx }: { jsx?: boolean }) { +function getFileName({ jsx }: { jsx?: boolean }): string { return jsx ? 'estree.tsx' : 'estree.ts'; } @@ -62,6 +62,11 @@ 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 @@ -71,7 +76,7 @@ function getASTFromProject( code: string, options: TSESTreeOptions, createDefaultProgram: boolean, -) { +): ASTAndProgram | undefined { const filePath = options.filePath || getFileName(options); const astAndProgram = firstDefined( calculateProjectParserOptions(code, filePath, extra), @@ -95,7 +100,10 @@ function getASTFromProject( * @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) { +function getASTAndDefaultProject( + code: string, + options: TSESTreeOptions, +): ASTAndProgram | undefined { const fileName = options.filePath || getFileName(options); const program = createProgram(code, fileName, extra); const ast = program && program.getSourceFile(fileName); @@ -106,7 +114,7 @@ function getASTAndDefaultProject(code: string, options: TSESTreeOptions) { * @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) { +function createNewProgram(code: string): ASTAndProgram { const FILENAME = getFileName(extra); const compilerHost: ts.CompilerHost = { @@ -170,7 +178,7 @@ function getProgramAndAST( options: TSESTreeOptions, shouldProvideParserServices: boolean, createDefaultProgram: boolean, -) { +): ASTAndProgram | undefined { return ( (shouldProvideParserServices && getASTFromProject(code, options, createDefaultProgram)) || @@ -293,7 +301,7 @@ function warnAboutTSVersion(): void { // Parser //------------------------------------------------------------------------------ -type AST = TSESTree.Program & +export 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[] } : {}); @@ -403,7 +411,7 @@ export function parseAndGenerateServices< options, shouldProvideParserServices, extra.createDefaultProgram, - ); + )!; /** * Determine whether or not two-way maps of converted AST nodes should be preserved * during the conversion process diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 09199053349..88c63171545 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -34,7 +34,7 @@ const parsedFilesSeen = new Set(); * Clear tsconfig caches. * Primarily used for testing. */ -export function clearCaches() { +export function clearCaches(): void { knownWatchProgramMap.clear(); watchCallbackTrackingMap.clear(); parsedFilesSeen.clear(); @@ -58,7 +58,7 @@ function diagnosticReporter(diagnostic: ts.Diagnostic): void { ); } -const noopFileWatcher = { close: () => {} }; +const noopFileWatcher = { close: (): void => {} }; function getTsconfigPath(tsconfigPath: string, extra: Extra): string { return path.isAbsolute(tsconfigPath) @@ -118,7 +118,7 @@ export function calculateProjectParserOptions( // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePath, encoding) => + watchCompilerHost.readFile = (filePath, encoding): string | undefined => path.normalize(filePath) === path.normalize(currentLintOperationState.filePath) ? currentLintOperationState.code @@ -128,7 +128,7 @@ export function calculateProjectParserOptions( watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; // ensure process doesn't emit programs - watchCompilerHost.afterProgramCreate = program => { + watchCompilerHost.afterProgramCreate = (program): void => { // report error if there are any errors in the config file const configFileDiagnostics = program .getConfigFileParsingDiagnostics() @@ -143,18 +143,20 @@ export function calculateProjectParserOptions( }; // register callbacks to trigger program updates without using fileWatchers + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type watchCompilerHost.watchFile = (fileName, callback) => { const normalizedFileName = path.normalize(fileName); watchCallbackTrackingMap.set(normalizedFileName, callback); return { - close: () => { + close: (): void => { watchCallbackTrackingMap.delete(normalizedFileName); }, }; }; // ensure fileWatchers aren't created for directories - watchCompilerHost.watchDirectory = () => noopFileWatcher; + watchCompilerHost.watchDirectory = (): typeof noopFileWatcher => + noopFileWatcher; // we're using internal typescript APIs which aren't on the types /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -163,8 +165,9 @@ export function calculateProjectParserOptions( .onCachedDirectoryStructureHostCreate; (watchCompilerHost as any).onCachedDirectoryStructureHostCreate = ( host: any, - ) => { + ): void => { const oldReadDirectory = host.readDirectory; + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type host.readDirectory = ( path: string, extensions?: readonly string[], @@ -206,7 +209,11 @@ export function calculateProjectParserOptions( * @param extra.project 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) { +export function createProgram( + code: string, + filePath: string, + extra: Extra, +): ts.Program | undefined { if (!extra.projects || extra.projects.length !== 1) { return undefined; } @@ -225,7 +232,7 @@ export function createProgram(code: string, filePath: string, extra: Extra) { const compilerHost = ts.createCompilerHost(commandLine.options, true); const oldReadFile = compilerHost.readFile; - compilerHost.readFile = (fileName: string) => + compilerHost.readFile = (fileName: string): string | undefined => path.normalize(fileName) === path.normalize(filePath) ? code : oldReadFile(fileName); 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 4b8e05d166b..64f2453fc60 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -33,8 +33,6 @@ const sharedFixturesDirPath = path.join( class FixturesTester { protected fixtures: FixturePatternConfig[] = []; - constructor() {} - /** * Utility to generate a FixturePatternConfig object containing the glob pattern for specific subsections of the fixtures/ directory, * including the capability to ignore specific nested patterns. @@ -45,7 +43,7 @@ class FixturesTester { public addFixturePatternConfig( fixturesSubPath: string, config: CreateFixturePatternConfig = {}, - ) { + ): void { let _fixturesDirPath = fixturesDirPath; if (!fs.existsSync(path.join(fixturesDirPath, fixturesSubPath))) { _fixturesDirPath = sharedFixturesDirPath; diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 43c23ce44d7..7fba488c78d 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -1,12 +1,17 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + import { ParserPlugin } from '@babel/parser'; import codeFrame from 'babel-code-frame'; import * as parser from '../../src/parser'; import * as parseUtils from './utils'; -function createError(message: string, line: number, column: number) { +function createError( + message: string, + line: number, + column: number, +): SyntaxError { // Construct an error similar to the ones thrown by Babylon. const error = new SyntaxError(`${message} (${line}:${column})`); - // eslint-disable-next-line @typescript-eslint/no-explicit-any (error as any).loc = { line, column, @@ -14,7 +19,7 @@ function createError(message: string, line: number, column: number) { return error; } -function parseWithBabelParser(text: string, jsx: boolean = true) { +function parseWithBabelParser(text: string, jsx = true): any { const babel = require('@babel/parser'); const plugins: ParserPlugin[] = [ 'typescript', @@ -40,7 +45,7 @@ function parseWithBabelParser(text: string, jsx: boolean = true) { }); } -function parseWithTypeScriptESTree(text: string, jsx: boolean = true) { +function parseWithTypeScriptESTree(text: string, jsx = true): parser.AST { try { const result = parser.parseAndGenerateServices(text, { loc: true, @@ -69,12 +74,14 @@ interface ASTComparisonParseOptions { jsx?: boolean; } -export function parse(text: string, opts: ASTComparisonParseOptions) { +export function parse( + text: string, + opts: ASTComparisonParseOptions, +): { parseError: any | null; ast: any | null } { /** * Always return a consistent interface, there will be times when we expect both * parsers to fail to parse the invalid source. */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any const result: { parseError: any | null; ast: any | null } = { parseError: null, ast: null, diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 43be2143e78..563fd19cc30 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -26,7 +26,7 @@ export function omitDeep( root: any, keysToOmit: { key: string; predicate: Function }[], nodes: Record void> = {}, -) { +): any { function shouldOmit(keyName: string, val: any): boolean { if (keysToOmit && keysToOmit.length) { return keysToOmit.some( @@ -36,7 +36,7 @@ export function omitDeep( return false; } - function visit(node: any, parent: any) { + function visit(node: any, parent: any): void { if (!node) { return; } @@ -72,8 +72,8 @@ export function omitDeep( /** * Common predicates for Babylon AST preprocessing */ -const always = () => true; -const ifNumber = (val: any) => typeof val === 'number'; +const always = (): boolean => true; +const ifNumber = (val: any): boolean => typeof val === 'number'; /** * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... @@ -290,7 +290,7 @@ export function preprocessBabylonAST(ast: any): any { export function removeLocationDataAndSourceTypeFromProgramNode( ast: any, ignoreSourceType: boolean, -) { +): any { delete ast.loc; delete ast.range; if (ignoreSourceType) { diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts index 4a5ac51be55..2a275c53fb4 100644 --- a/packages/typescript-estree/tests/lib/convert.ts +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -100,7 +100,7 @@ describe('convert', () => { instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -134,7 +134,7 @@ describe('convert', () => { instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -167,7 +167,7 @@ describe('convert', () => { const program = instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: any) { + function checkMaps(child: any): void { child.forEachChild((node: any) => { if (node.kind !== ts.SyntaxKind.EndOfFileToken) { expect(ast).toBe( @@ -184,7 +184,7 @@ describe('convert', () => { expect(maps.esTreeNodeToTSNodeMap.get(program.body[0])).toBeDefined(); expect(program.body[0]).not.toBe( - maps.tsNodeToESTreeNodeMap.get(ast.statements[0]), + maps.tsNodeToESTreeNodeMap.get(ast.statements[0] as any), ); checkMaps(ast); }); diff --git a/packages/typescript-estree/tests/lib/jsx.ts b/packages/typescript-estree/tests/lib/jsx.ts index 52b6debdf6b..a3e0148907c 100644 --- a/packages/typescript-estree/tests/lib/jsx.ts +++ b/packages/typescript-estree/tests/lib/jsx.ts @@ -23,11 +23,8 @@ describe('JSX', () => { /** * Test each fixture file */ - function testFixture( - fixturesDir: string, - useJSXTextNode: boolean, - ): (filename: string) => void { - return filename => { + function testFixture(fixturesDir: string, useJSXTextNode: boolean) { + return (filename: string): void => { const code = readFileSync(filename, 'utf8'); const config: TSESTreeOptions = { loc: true, diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 7e5c634db9d..1afab0c5e44 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -280,7 +280,7 @@ describe('semanticInfo', () => { function testIsolatedFile( parseResult: ParseAndGenerateServicesResult, -) { +): void { // get type checker expect(parseResult).toHaveProperty('services.program.getTypeChecker'); const checker = parseResult.services.program!.getTypeChecker(); @@ -331,7 +331,7 @@ function testIsolatedFile( * @param {ts.TypeChecker} checker * @param {ts.Node} tsNode */ -function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node) { +function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node): void { const nodeType = checker.getTypeAtLocation(tsNode); expect(nodeType.flags).toBe(ts.TypeFlags.Object); expect((nodeType as ts.ObjectType).objectFlags).toBe( diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index 16210df104f..b9fcb51cab6 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -6,7 +6,7 @@ import { TSESTreeOptions } from '../src/parser-options'; * @param {Object} ast the AST object * @returns {Object} copy of the AST object */ -export function getRaw(ast: parser.TSESTree.Program) { +export function getRaw(ast: parser.TSESTree.Program): parser.TSESTree.Program { return JSON.parse( JSON.stringify(ast, (key, value) => { if ((key === 'start' || key === 'end') && typeof value === 'number') { @@ -20,7 +20,7 @@ export function getRaw(ast: parser.TSESTree.Program) { export function parseCodeAndGenerateServices( code: string, config: TSESTreeOptions, -) { +): parser.ParseAndGenerateServicesResult { return parser.parseAndGenerateServices(code, config); } @@ -36,18 +36,18 @@ export function createSnapshotTestBlock( code: string, config: TSESTreeOptions, generateServices?: true, -) { +): () => void { /** * @returns {Object} the AST object */ - function parse() { + function parse(): parser.TSESTree.Program { const ast = generateServices ? parser.parseAndGenerateServices(code, config).ast : parser.parse(code, config); return getRaw(ast); } - return () => { + return (): void => { try { const result = parse(); expect(result).toMatchSnapshot(); diff --git a/tests/integration/utils/jest-snapshot-resolver.js b/tests/integration/utils/jest-snapshot-resolver.js index 3032ef5d575..366a9611839 100644 --- a/tests/integration/utils/jest-snapshot-resolver.js +++ b/tests/integration/utils/jest-snapshot-resolver.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ /** * Use a jest snapshotResolver to map the test snapshot output back to the * linked volume. This means that even though we are running our tests inside diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 34bf65ac52f..11b23765615 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -35,7 +35,7 @@ interface AllContributorsUser { contributions: string[]; } -async function* fetchUsers(page = 1) { +async function* fetchUsers(page = 1): AsyncIterableIterator { let lastLength = 0; do { const response = await fetch(`${contributorsApiUrl}&page=${page}`, { @@ -61,7 +61,7 @@ async function* fetchUsers(page = 1) { ); } -async function main() { +async function main(): Promise { const githubContributors: Contributor[] = []; // fetch all of the contributor info diff --git a/yarn.lock b/yarn.lock index 5924927ec6d..c86527946ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1428,6 +1428,11 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== +"@types/prettier@^1.18.0": + version "1.18.0" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.0.tgz#d2dbe4d5f76b455138f13a2d881278e2c06a733d" + integrity sha512-5N6WK/XXs9PLPpge2KOmOSaIym2vIo32GsrxM5YOFs7uZ8R9L/acg+hQzWsfwoHEpasqQkH0+3LzLTbiF1GFLQ== + "@types/semver@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.1.tgz#a984b405c702fa5a7ec6abc56b37f2ba35ef5af6" @@ -6988,7 +6993,7 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@^1.18.2: +prettier@*, prettier@^1.18.2: version "1.18.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== From 90b36ddac2f6de006fd59f2a9234df1eb2d1606e Mon Sep 17 00:00:00 2001 From: Taeheon Kim Date: Wed, 14 Aug 2019 01:39:11 +0900 Subject: [PATCH 005/317] docs(eslint-plugin): update ROADMAP.md (#844) --- 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 58580935012..65b5dcd46ba 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -22,7 +22,7 @@ | [`no-import-side-effect`] | 🔌 | [`import/no-unassigned-import`] | | [`no-inferrable-types`] | ✅ | [`@typescript-eslint/no-inferrable-types`] | | [`no-internal-module`] | ✅ | [`@typescript-eslint/prefer-namespace-keyword`] | -| [`no-magic-numbers`] | 🌟 | [`no-magic-numbers`][no-magic-numbers] | +| [`no-magic-numbers`] | ✅ | [`@typescript-eslint/no-magic-numbers`] | | [`no-namespace`] | ✅ | [`@typescript-eslint/no-namespace`] | | [`no-non-null-assertion`] | ✅ | [`@typescript-eslint/no-non-null-assertion`] | | [`no-parameter-reassignment`] | ✅ | [`no-param-reassign`][no-param-reassign] | @@ -620,6 +620,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/no-unnecessary-type-arguments`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md [`@typescript-eslint/semi`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md [`@typescript-eslint/no-floating-promises`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md +[`@typescript-eslint/no-magic-numbers`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md From d3470c963eb436d9e5128301d4579fb2b251de7c Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 20:37:21 +0100 Subject: [PATCH 006/317] feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) BREAKING CHANGE: removed some rules from recommended config --- .eslintrc.js | 1 + packages/eslint-plugin/README.md | 21 ++++++- packages/eslint-plugin/package.json | 6 +- .../recommended-requiring-type-checking.json | 19 +++++++ .../src/configs/recommended.json | 10 ---- packages/eslint-plugin/src/index.ts | 2 + .../eslint-plugin/src/rules/await-thenable.ts | 1 + .../src/rules/no-floating-promises.ts | 1 + .../src/rules/no-for-in-array.ts | 1 + .../src/rules/no-misused-promises.ts | 1 + .../src/rules/no-unnecessary-qualifier.ts | 1 + .../rules/no-unnecessary-type-arguments.ts | 1 + .../rules/no-unnecessary-type-assertion.ts | 1 + .../src/rules/prefer-includes.ts | 1 + .../src/rules/prefer-readonly.ts | 1 + .../src/rules/prefer-regexp-exec.ts | 1 + .../rules/prefer-string-starts-ends-with.ts | 1 + .../src/rules/promise-function-async.ts | 1 + .../src/rules/require-array-sort-compare.ts | 1 + .../eslint-plugin/src/rules/require-await.ts | 1 + .../src/rules/restrict-plus-operands.ts | 1 + .../src/rules/strict-boolean-expressions.ts | 1 + .../eslint-plugin/src/rules/unbound-method.ts | 1 + .../eslint-plugin/tools/generate-configs.ts | 56 ++++++++++++++++++- .../checkConfigRecommended.ts | 6 +- ...kConfigRecommendedRequiringTypeChecking.ts | 45 +++++++++++++++ .../tools/validate-configs/index.ts | 6 ++ .../validate-docs/validate-table-rules.ts | 24 ++++++++ .../experimental-utils/src/ts-eslint/Rule.ts | 5 ++ tests/integration/docker-compose.yml | 17 ++++++ .../.eslintrc.yml | 17 ++++++ .../Dockerfile | 17 ++++++ .../index.ts | 1 + .../test.js.snap | 44 +++++++++++++++ .../test.sh | 19 +++++++ tests/integration/run-all-tests.sh | 3 + 36 files changed, 317 insertions(+), 19 deletions(-) create mode 100644 packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json create mode 100644 packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/Dockerfile create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/index.ts create mode 100644 tests/integration/fixtures/recommended-does-not-require-program/test.js.snap create mode 100755 tests/integration/fixtures/recommended-does-not-require-program/test.sh diff --git a/.eslintrc.js b/.eslintrc.js index 32a476969d3..ef3d195354e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', ], rules: { // diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 516f9c48dae..1ecc3e86cf9 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -51,7 +51,7 @@ You can also enable all the recommended rules for our plugin. Add `plugin:@types } ``` -You can also use [eslint:recommended](https://eslint.org/docs/rules/) with this plugin. Add both `eslint:recommended` and `plugin:@typescript-eslint/eslint-recommended`: +You can also use [eslint:recommended](https://eslint.org/docs/rules/) (the set of rules which are recommended for all projects by the ESLint Team) with this plugin. As noted in the root README, not all eslint core rules are compatible with TypeScript, so you need to add both `eslint:recommended` and `plugin:@typescript-eslint/eslint-recommended` (which will adjust the one from eslint appropriately for TypeScript) to your config: ```json { @@ -63,7 +63,24 @@ You can also use [eslint:recommended](https://eslint.org/docs/rules/) with this } ``` -If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions". +As of version 2 of this plugin, _by design_, none of the rules in the main `recommended` config require type-checking in order to run. This means that they are more lightweight and faster to run. + +Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You wou apply this _in addition_ to the recommended configs previously mentioned, e.g.: + +```json +{ + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ] +} +``` + +Pro Tip: For larger codebases you may want to consider splitting our linting into two separate stages: 1. fast feedback rules which operate purely based on syntax (no type-checking), 2. rules which are based on semantics (type-checking). + +NOTE: If you want to use rules which require type information, you will need to specify a path to your tsconfig.json file in the "project" property of "parserOptions". If you do not do this, you will get a runtime error which explains this. ```json { diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 14b417ac5c7..e0d1c05a9fe 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -30,11 +30,11 @@ "main": "dist/index.js", "scripts": { "build": "tsc -p tsconfig.build.json", - "check:docs": "ts-node --files ./tools/validate-docs/index.ts", - "check:configs": "ts-node --files ./tools/validate-configs/index.ts", + "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/", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", - "generate:configs": "ts-node --files tools/generate-configs.ts", + "generate:configs": "../../node_modules/.bin/ts-node --files tools/generate-configs.ts", "prebuild": "npm run clean", "test": "jest --coverage", "typecheck": "tsc --noEmit" diff --git a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json new file mode 100644 index 00000000000..68867b53248 --- /dev/null +++ b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.json @@ -0,0 +1,19 @@ +{ + "extends": "./configs/base.json", + "rules": { + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/no-for-in-array": "error", + "@typescript-eslint/no-misused-promises": "error", + "@typescript-eslint/no-unnecessary-type-assertion": "error", + "@typescript-eslint/prefer-includes": "error", + "@typescript-eslint/prefer-regexp-exec": "error", + "@typescript-eslint/prefer-string-starts-ends-with": "error", + "require-await": "off", + "@typescript-eslint/require-await": "error", + "@typescript-eslint/unbound-method": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error" + } +} diff --git a/packages/eslint-plugin/src/configs/recommended.json b/packages/eslint-plugin/src/configs/recommended.json index 95d18847686..7d7a5628c9d 100644 --- a/packages/eslint-plugin/src/configs/recommended.json +++ b/packages/eslint-plugin/src/configs/recommended.json @@ -2,7 +2,6 @@ "extends": "./configs/base.json", "rules": { "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/await-thenable": "error", "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", "camelcase": "off", @@ -18,28 +17,19 @@ "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "warn", - "@typescript-eslint/no-for-in-array": "error", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-namespace": "error", "@typescript-eslint/no-non-null-assertion": "warn", "@typescript-eslint/no-this-alias": "error", - "@typescript-eslint/no-unnecessary-type-assertion": "error", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "warn", "no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "error", "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/prefer-includes": "error", "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/prefer-regexp-exec": "error", - "@typescript-eslint/prefer-string-starts-ends-with": "error", - "require-await": "off", - "@typescript-eslint/require-await": "error", "@typescript-eslint/triple-slash-reference": "error", "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unbound-method": "error", "no-var": "error", "prefer-const": "error", "prefer-rest-params": "error", diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 0fb5516ba72..d8e55844e1d 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -3,6 +3,7 @@ import rules from './rules'; import all from './configs/all.json'; import base from './configs/base.json'; import recommended from './configs/recommended.json'; +import recommendedRequiringTypeChecking from './configs/recommended-requiring-type-checking.json'; import eslintRecommended from './configs/eslint-recommended'; export = { @@ -12,5 +13,6 @@ export = { base, recommended, 'eslint-recommended': eslintRecommended, + 'recommended-requiring-type-checking': recommendedRequiringTypeChecking, }, }; diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index 304321001f7..94dc75cf78d 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -10,6 +10,7 @@ export default util.createRule({ description: 'Disallows awaiting a value that is not a Thenable', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.', diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 5bc2f75adaa..816cc084670 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -10,6 +10,7 @@ export default util.createRule({ description: 'Requires Promise-like values to be handled appropriately.', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { floating: 'Promises must be handled appropriately', diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 03171e7fdf7..db15d310457 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -8,6 +8,7 @@ export default util.createRule({ description: 'Disallow iterating over an array with a for-in loop', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { forInViolation: diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 6d06ef8807a..63d0f0bf483 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -18,6 +18,7 @@ export default util.createRule({ description: 'Avoid using promises in places not designed to handle them', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { voidReturn: diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 64f58848d79..1017be32222 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -10,6 +10,7 @@ export default util.createRule({ category: 'Best Practices', description: 'Warns when a namespace qualifier is unnecessary', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 100a9d261c0..040650ea05d 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -29,6 +29,7 @@ export default util.createRule<[], MessageIds>({ 'Warns if an explicitly specified type argument is the default for that type parameter', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 11da74d88c9..61583878bae 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -28,6 +28,7 @@ export default util.createRule({ 'Warns if a type assertion does not change the type of an expression', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index 384edf01859..fcb5dfca4f5 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -14,6 +14,7 @@ export default createRule({ description: 'Enforce `includes` method over `indexOf` method', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 22c85fd0343..2c8ab3671be 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -32,6 +32,7 @@ export default util.createRule({ "Requires that private members are marked as `readonly` if they're never modified outside of the constructor", category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index bd1a48fcb61..fea08554c3a 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -13,6 +13,7 @@ export default createRule({ 'Prefer RegExp#exec() over String#match() if no global flag is provided', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { regExpExecOverStringMatch: 'Use the `RegExp#exec()` method instead.', diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 2ffac6728ac..56344783b34 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -21,6 +21,7 @@ export default createRule({ 'Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, messages: { preferStartsWith: "Use 'String#startsWith' method instead.", diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index faf55f95fa7..225b2bd8367 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -22,6 +22,7 @@ export default util.createRule({ 'Requires any function or method that returns a Promise to be marked async', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { missingAsync: 'Functions that return promises must be async.', diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index 5b3f430420f..e88f2791f8f 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -12,6 +12,7 @@ export default util.createRule({ description: 'Enforce giving `compare` argument to `Array#sort`', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { requireCompare: "Require 'compare' argument.", diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index ef1092b46db..7441b464896 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -24,6 +24,7 @@ export default util.createRule({ description: 'Disallow async functions which have no `await` expression', category: 'Best Practices', recommended: 'error', + requiresTypeChecking: true, }, schema: baseRule.meta.schema, messages: baseRule.meta.messages, diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index df523033bf7..1f715f1f902 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -11,6 +11,7 @@ export default util.createRule({ 'When adding two variables, operands must both be of type number or of type string', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, messages: { notNumbers: diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index d9077bf3154..9c3c5b6ea98 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -27,6 +27,7 @@ export default util.createRule({ description: 'Restricts the types allowed in boolean expressions', category: 'Best Practices', recommended: false, + requiresTypeChecking: true, }, schema: [ { diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 0db82b2c770..c76ac76f9d0 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -26,6 +26,7 @@ export default util.createRule({ description: 'Enforces unbound methods are called with their expected scope', recommended: 'error', + requiresTypeChecking: true, }, messages: { unbound: diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index d7f5fb29afd..cda1b0771ea 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -58,6 +58,7 @@ function reducer( settings: { errorLevel?: 'error' | 'warn'; filterDeprecated: boolean; + filterRequiresTypeChecking?: 'include' | 'exclude'; }, ): LinterConfigRules { const key = entry[0]; @@ -67,6 +68,22 @@ function reducer( return config; } + // Explicitly exclude rules requiring type-checking + if ( + settings.filterRequiresTypeChecking === 'exclude' && + value.meta.docs.requiresTypeChecking === true + ) { + return config; + } + + // Explicitly include rules requiring type-checking + if ( + settings.filterRequiresTypeChecking === 'include' && + value.meta.docs.requiresTypeChecking !== true + ) { + return config; + } + const ruleName = `${RULE_NAME_PREFIX}${key}`; const recommendation = value.meta.docs.recommended; const usedSetting = settings.errorLevel @@ -119,7 +136,7 @@ writeConfig(baseConfig, path.resolve(__dirname, '../src/configs/base.json')); console.log(); console.log( - '---------------------------------- all.json ----------------------------------', + '------------------------------------------------ all.json ------------------------------------------------', ); const allConfig: LinterConfig = { extends: './configs/base.json', @@ -133,12 +150,16 @@ writeConfig(allConfig, path.resolve(__dirname, '../src/configs/all.json')); console.log(); console.log( - '------------------------------ recommended.json ------------------------------', + '------------------------------ recommended.json (should not require program) ------------------------------', ); const recommendedRules = ruleEntries .filter(entry => !!entry[1].meta.docs.recommended) .reduce( - (config, entry) => reducer(config, entry, { filterDeprecated: false }), + (config, entry) => + reducer(config, entry, { + filterDeprecated: false, + filterRequiresTypeChecking: 'exclude', + }), {}, ); BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { @@ -152,3 +173,32 @@ writeConfig( recommendedConfig, path.resolve(__dirname, '../src/configs/recommended.json'), ); + +console.log(); +console.log( + '--------------------------------- recommended-requiring-type-checking.json ---------------------------------', +); +const recommendedRulesRequiringProgram = ruleEntries + .filter(entry => !!entry[1].meta.docs.recommended) + .reduce( + (config, entry) => + reducer(config, entry, { + filterDeprecated: false, + filterRequiresTypeChecking: 'include', + }), + {}, + ); +BASE_RULES_THAT_ARE_RECOMMENDED.forEach(ruleName => { + recommendedRulesRequiringProgram[ruleName] = 'error'; +}); +const recommendedRequiringTypeCheckingConfig: LinterConfig = { + extends: './configs/base.json', + rules: recommendedRulesRequiringProgram, +}; +writeConfig( + recommendedRequiringTypeCheckingConfig, + path.resolve( + __dirname, + '../src/configs/recommended-requiring-type-checking.json', + ), +); diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts index ae256143112..28f0c7b21a5 100644 --- a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommended.ts @@ -10,7 +10,11 @@ function checkConfigRecommended(): boolean { const recommendedNames = new Set(Object.keys(recommended)); return Object.entries(rules).reduce((acc, [ruleName, rule]) => { - if (!rule.meta.deprecated && rule.meta.docs.recommended !== false) { + if ( + !rule.meta.deprecated && + rule.meta.docs.recommended !== false && + rule.meta.docs.requiresTypeChecking !== true + ) { const prefixed = `${prefix}${ruleName}` as keyof typeof recommended; if (recommendedNames.has(prefixed)) { if (recommended[prefixed] !== rule.meta.docs.recommended) { diff --git a/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts new file mode 100644 index 00000000000..a63f5e42c23 --- /dev/null +++ b/packages/eslint-plugin/tools/validate-configs/checkConfigRecommendedRequiringTypeChecking.ts @@ -0,0 +1,45 @@ +import plugin from '../../src/index'; +import { logRule } from '../log'; + +const prefix = '@typescript-eslint/'; + +function checkConfigRecommendedRequiringTypeChecking(): boolean { + const { rules } = plugin; + + const recommendedRequiringTypeChecking = + plugin.configs['recommended-requiring-type-checking'].rules; + const recommendedNames = new Set( + Object.keys(recommendedRequiringTypeChecking), + ); + + return Object.entries(rules).reduce((acc, [ruleName, rule]) => { + if ( + !rule.meta.deprecated && + rule.meta.docs.recommended !== false && + rule.meta.docs.requiresTypeChecking === true + ) { + const prefixed = `${prefix}${ruleName}` as keyof typeof recommendedRequiringTypeChecking; + if (recommendedNames.has(prefixed)) { + if ( + recommendedRequiringTypeChecking[prefixed] !== + rule.meta.docs.recommended + ) { + logRule( + false, + ruleName, + 'incorrect setting compared to the rule meta.', + ); + return true; + } + } else { + logRule(false, ruleName, 'missing in the config.'); + return true; + } + } + + logRule(true, ruleName); + return acc; + }, false); +} + +export { checkConfigRecommendedRequiringTypeChecking }; diff --git a/packages/eslint-plugin/tools/validate-configs/index.ts b/packages/eslint-plugin/tools/validate-configs/index.ts index cb64df53648..1c05196a677 100644 --- a/packages/eslint-plugin/tools/validate-configs/index.ts +++ b/packages/eslint-plugin/tools/validate-configs/index.ts @@ -1,11 +1,17 @@ import chalk from 'chalk'; import { checkConfigRecommended } from './checkConfigRecommended'; +import { checkConfigRecommendedRequiringTypeChecking } from './checkConfigRecommendedRequiringTypeChecking'; import { checkConfigAll } from './checkConfigAll'; let hasErrors = false; console.log(chalk.underline('Checking config "recommended"')); hasErrors = checkConfigRecommended() || hasErrors; +console.log( + chalk.underline('Checking config "recommended-requiring-type-checking"'), +); +hasErrors = checkConfigRecommendedRequiringTypeChecking() || hasErrors; + console.log(); console.log(chalk.underline('Checking config "all"')); hasErrors = checkConfigAll() || hasErrors; diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts index c3e712ca525..b85172d0fdc 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts @@ -105,7 +105,31 @@ function validateTableRules( const ruleFileContents = fs.readFileSync( path.resolve(__dirname, `../../src/rules/${ruleName}.ts`), ); + const usesTypeInformation = ruleFileContents.includes('getParserServices'); + const tableRowHasThoughtBalloon = !!rowNeedsTypeInfo; + if (rule.meta.docs.requiresTypeChecking === true) { + if (!usesTypeInformation) { + errors.push( + 'Rule has `requiresTypeChecking` set in its meta, but it does not actually use type information - fix by removing `meta.docs.requiresTypeChecking`', + ); + } else if (!tableRowHasThoughtBalloon) { + errors.push( + 'Rule was documented as not using type information, when it actually does - fix by updating the plugin README.md', + ); + } + } else { + if (usesTypeInformation) { + errors.push( + 'Rule does not have `requiresTypeChecking` set in its meta, despite using type information - fix by setting `meta.docs.requiresTypeChecking: true` in the rule', + ); + } else if (tableRowHasThoughtBalloon) { + errors.push( + `Rule was documented as using type information, when it actually doesn't - fix by updating the plugin README.md`, + ); + } + } + validateTableBoolean( usesTypeInformation, rowNeedsTypeInfo, diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 89ac7b53288..75acea5988c 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -32,6 +32,11 @@ interface RuleMetaDataDocs { * The URL of the rule's docs */ url: string; + /** + * Does the rule require us to create a full TypeScript Program in order for it + * to type-check code. This is only used for documentation purposes. + */ + requiresTypeChecking?: boolean; } interface RuleMetaData { /** diff --git a/tests/integration/docker-compose.yml b/tests/integration/docker-compose.yml index 5d10d766177..74bfb63dab2 100644 --- a/tests/integration/docker-compose.yml +++ b/tests/integration/docker-compose.yml @@ -36,3 +36,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/vue-sfc:/usr/linked + + recommended-does-not-require-program: + build: ./fixtures/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. + - ../../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/recommended-does-not-require-program:/usr/linked diff --git a/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml new file mode 100644 index 00000000000..75de006c68d --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.yml @@ -0,0 +1,17 @@ +# This integration test exists to make sure that the recommended config does +# not require a program to be specified to ensure a fast and simple initial +# setup. Users can add on one of our other configs if they want to opt in to +# more expensive checks. +root: true + +# Local version of @typescript-eslint/parser +parser: '@typescript-eslint/parser' + +extends: +- 'eslint:recommended' +- 'plugin:@typescript-eslint/eslint-recommended' +- 'plugin:@typescript-eslint/recommended' + +plugins: +# Local version of @typescript-eslint/eslint-plugin +- '@typescript-eslint' diff --git a/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile b/tests/integration/fixtures/recommended-does-not-require-program/Dockerfile new file mode 100644 index 00000000000..3b281e624c8 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/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/recommended-does-not-require-program/index.ts b/tests/integration/fixtures/recommended-does-not-require-program/index.ts new file mode 100644 index 00000000000..838b04b9475 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/index.ts @@ -0,0 +1 @@ +var foo = true diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap b/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap new file mode 100644 index 00000000000..36d059733d5 --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/test.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`it should produce the expected lint ouput 1`] = ` +Array [ + Object { + "errorCount": 1, + "filePath": "/usr/linked/index.ts", + "fixableErrorCount": 1, + "fixableWarningCount": 0, + "messages": Array [ + Object { + "column": 1, + "endColumn": 15, + "endLine": 1, + "fix": Object { + "range": Array [ + 0, + 3, + ], + "text": "let", + }, + "line": 1, + "message": "Unexpected var, use let or const instead.", + "nodeType": "VariableDeclaration", + "ruleId": "no-var", + "severity": 2, + }, + Object { + "column": 5, + "endColumn": 8, + "endLine": 1, + "line": 1, + "message": "'foo' is assigned a value but never used.", + "nodeType": "Identifier", + "ruleId": "@typescript-eslint/no-unused-vars", + "severity": 1, + }, + ], + "source": "var foo = true +", + "warningCount": 1, + }, +] +`; diff --git a/tests/integration/fixtures/recommended-does-not-require-program/test.sh b/tests/integration/fixtures/recommended-does-not-require-program/test.sh new file mode 100755 index 00000000000..1fa77f5cbdf --- /dev/null +++ b/tests/integration/fixtures/recommended-does-not-require-program/test.sh @@ -0,0 +1,19 @@ +#!/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) + +# 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/**/*.ts || 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/run-all-tests.sh b/tests/integration/run-all-tests.sh index 5b43af06246..4506da77349 100755 --- a/tests/integration/run-all-tests.sh +++ b/tests/integration/run-all-tests.sh @@ -9,3 +9,6 @@ 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 + +# recommended-does-not-require-program +docker-compose -f tests/integration/docker-compose.yml up --build --abort-on-container-exit recommended-does-not-require-program From 0c4f474ccba2fd329cb43ae2309e786b51889a81 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Tue, 13 Aug 2019 12:52:28 -0700 Subject: [PATCH 007/317] feat(eslint-plugin): [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations (#790) --- .../docs/rules/class-name-casing.md | 16 +++ .../docs/rules/interface-name-prefix.md | 85 +++++++++++-- .../src/rules/class-name-casing.ts | 32 ++++- .../src/rules/interface-name-prefix.ts | 113 ++++++++++++++++-- .../tests/rules/class-name-casing.test.ts | 18 +++ .../tests/rules/interface-name-prefix.test.ts | 63 +++++++++- 6 files changed, 302 insertions(+), 25 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/class-name-casing.md b/packages/eslint-plugin/docs/rules/class-name-casing.md index a1fba58e323..f594a9854f1 100644 --- a/packages/eslint-plugin/docs/rules/class-name-casing.md +++ b/packages/eslint-plugin/docs/rules/class-name-casing.md @@ -5,6 +5,17 @@ This rule enforces PascalCased names for classes and interfaces. ## Rule Details This rule aims to make it easy to differentiate classes from regular variables at a glance. +The `_` prefix is sometimes used to designate a private declaration, so the rule also supports a name +that might be `_Example` instead of `Example`. + +## Options + +This rule has an object option: + +- `"allowUnderscorePrefix": false`: (default) does not allow the name to have an underscore prefix +- `"allowUnderscorePrefix": true`: allows the name to optionally have an underscore prefix + +## Examples Examples of **incorrect** code for this rule: @@ -16,6 +27,8 @@ class Another_Invalid_Class_Name {} var bar = class invalidName {}; interface someInterface {} + +class _InternalClass {} ``` Examples of **correct** code for this rule: @@ -28,6 +41,9 @@ export default class {} var foo = class {}; interface SomeInterface {} + +/* eslint @typescript-eslint/class-name-casing: { "allowUnderscorePrefix": true } */ +class _InternalClass {} ``` ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/interface-name-prefix.md b/packages/eslint-plugin/docs/rules/interface-name-prefix.md index c6d907568a1..309dcbe4f24 100644 --- a/packages/eslint-plugin/docs/rules/interface-name-prefix.md +++ b/packages/eslint-plugin/docs/rules/interface-name-prefix.md @@ -1,22 +1,35 @@ # Require that interface names be prefixed with `I` (interface-name-prefix) -It can be hard to differentiate between classes and interfaces. -Prefixing interfaces with "I" can help telling them apart at a glance. +Interfaces often represent important software contracts, so it can be helpful to prefix their names with `I`. +The unprefixed name is then available for a class that provides a standard implementation of the interface. +Alternatively, the contributor guidelines for the TypeScript repo suggest +[never prefixing](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#names) interfaces with `I`. ## Rule Details -This rule enforces consistency of interface naming prefix conventions. +This rule enforces whether or not the `I` prefix is required for interface names. +The `_` prefix is sometimes used to designate a private declaration, so the rule also supports a private interface +that might be named `_IAnimal` instead of `IAnimal`. ## Options -This rule has a string option. +This rule has an object option: -- `"never"` (default) disallows all interfaces being prefixed with `"I"` -- `"always"` requires all interfaces be prefixed with `"I"` +- `{ "prefixWithI": "never" }`: (default) disallows all interfaces being prefixed with `"I"` or `"_I"` +- `{ "prefixWithI": "always" }`: requires all interfaces be prefixed with `"I"` (but does not allow `"_I"`) +- `{ "prefixWithI": "always", "allowUnderscorePrefix": true }`: requires all interfaces be prefixed with + either `"I"` or `"_I"` + +For backwards compatibility, this rule supports a string option instead: + +- `"never"`: Equivalent to `{ "prefixWithI": "never" }` +- `"always"`: Equivalent to `{ "prefixWithI": "always" }` + +## Examples ### never -TypeScript suggests [never prefixing](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#names) interfaces with "I". +**Configuration:** `{ "prefixWithI": "never" }` The following patterns are considered warnings: @@ -24,6 +37,14 @@ The following patterns are considered warnings: interface IAnimal { name: string; } + +interface IIguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` The following patterns are not warnings: @@ -32,16 +53,30 @@ The following patterns are not warnings: interface Animal { name: string; } + +interface Iguana { + name: string; +} ``` ### always +**Configuration:** `{ "prefixWithI": "always" }` + The following patterns are considered warnings: ```ts interface Animal { name: string; } + +interface Iguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` The following patterns are not warnings: @@ -50,6 +85,42 @@ The following patterns are not warnings: interface IAnimal { name: string; } + +interface IIguana { + name: string; +} +``` + +### always and allowing underscores + +**Configuration:** `{ "prefixWithI": "always", "allowUnderscorePrefix": true }` + +The following patterns are considered warnings: + +```ts +interface Animal { + name: string; +} + +interface Iguana { + name: string; +} +``` + +The following patterns are not warnings: + +```ts +interface IAnimal { + name: string; +} + +interface IIguana { + name: string; +} + +interface _IAnimal { + name: string; +} ``` ## When Not To Use It diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index cb238f87ac7..c71a39fd2ac 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -4,7 +4,14 @@ import { } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; -export default util.createRule({ +type Options = [ + { + allowUnderscorePrefix?: boolean; + }, +]; +type MessageIds = 'notPascalCased'; + +export default util.createRule({ name: 'class-name-casing', meta: { type: 'suggestion', @@ -16,16 +23,31 @@ export default util.createRule({ messages: { notPascalCased: "{{friendlyName}} '{{name}}' must be PascalCased.", }, - schema: [], + schema: [ + { + type: 'object', + properties: { + allowUnderscorePrefix: { + type: 'boolean', + default: false, + }, + }, + additionalProperties: false, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [{ allowUnderscorePrefix: false }], + create(context, [options]) { /** * Determine if the identifier name is PascalCased * @param name The identifier name */ function isPascalCase(name: string): boolean { - return /^[A-Z][0-9A-Za-z]*$/.test(name); + if (options.allowUnderscorePrefix) { + return /^_?[A-Z][0-9A-Za-z]*$/.test(name); + } else { + return /^[A-Z][0-9A-Za-z]*$/.test(name); + } } /** diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 11976552221..13284fc2aa3 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -1,8 +1,43 @@ import * as util from '../util'; -type Options = ['never' | 'always']; +type ParsedOptions = + | { + prefixWithI: 'never'; + } + | { + prefixWithI: 'always'; + allowUnderscorePrefix: boolean; + }; +type Options = [ + + | 'never' + | 'always' + | { + prefixWithI?: 'never'; + } + | { + prefixWithI: 'always'; + allowUnderscorePrefix?: boolean; + }, +]; type MessageIds = 'noPrefix' | 'alwaysPrefix'; +/** + * Parses a given value as options. + */ +export function parseOptions([options]: Options): ParsedOptions { + if (options === 'always') { + return { prefixWithI: 'always', allowUnderscorePrefix: false }; + } + if (options !== 'never' && options.prefixWithI === 'always') { + return { + prefixWithI: 'always', + allowUnderscorePrefix: !!options.allowUnderscorePrefix, + }; + } + return { prefixWithI: 'never' }; +} + export default util.createRule({ name: 'interface-name-prefix', meta: { @@ -21,13 +56,46 @@ export default util.createRule({ }, schema: [ { - enum: ['never', 'always'], + oneOf: [ + { + enum: [ + // Deprecated, equivalent to: { prefixWithI: 'never' } + 'never', + // Deprecated, equivalent to: { prefixWithI: 'always', allowUnderscorePrefix: false } + 'always', + ], + }, + { + type: 'object', + properties: { + prefixWithI: { + type: 'string', + enum: ['never'], + }, + }, + additionalProperties: false, + }, + { + type: 'object', + properties: { + prefixWithI: { + type: 'string', + enum: ['always'], + }, + allowUnderscorePrefix: { + type: 'boolean', + }, + }, + required: ['prefixWithI'], // required to select this "oneOf" alternative + additionalProperties: false, + }, + ], }, ], }, - defaultOptions: ['never'], - create(context, [option]) { - const never = option !== 'always'; + defaultOptions: [{ prefixWithI: 'never' }], + create(context, [options]) { + const parsedOptions = parseOptions([options]); /** * Checks if a string is prefixed with "I". @@ -41,21 +109,42 @@ export default util.createRule({ return /^I[A-Z]/.test(name); } + /** + * Checks if a string is prefixed with "I" or "_I". + * @param name The string to check + */ + function isPrefixedWithIOrUnderscoreI(name: string): boolean { + if (typeof name !== 'string') { + return false; + } + + return /^_?I[A-Z]/.test(name); + } + return { TSInterfaceDeclaration(node): void { - if (never) { - if (isPrefixedWithI(node.id.name)) { + if (parsedOptions.prefixWithI === 'never') { + if (isPrefixedWithIOrUnderscoreI(node.id.name)) { context.report({ node: node.id, messageId: 'noPrefix', }); } } else { - if (!isPrefixedWithI(node.id.name)) { - context.report({ - node: node.id, - messageId: 'alwaysPrefix', - }); + if (parsedOptions.allowUnderscorePrefix) { + if (!isPrefixedWithIOrUnderscoreI(node.id.name)) { + context.report({ + node: node.id, + messageId: 'alwaysPrefix', + }); + } + } else { + if (!isPrefixedWithI(node.id.name)) { + context.report({ + node: node.id, + messageId: 'alwaysPrefix', + }); + } } } }, diff --git a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts index af85e24472f..7409fd927e6 100644 --- a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts +++ b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts @@ -14,6 +14,10 @@ ruleTester.run('class-name-casing', rule, { sourceType: 'module', }, }, + { + code: 'class _NameWithUnderscore {}', + options: [{ allowUnderscorePrefix: true }], + }, 'var Foo = class {};', 'interface SomeInterface {}', 'class ClassNameWithDigit2 {}', @@ -50,6 +54,20 @@ ruleTester.run('class-name-casing', rule, { }, ], }, + { + code: 'class _NameWithUnderscore {}', + errors: [ + { + messageId: 'notPascalCased', + data: { + friendlyName: 'Class', + name: '_NameWithUnderscore', + }, + line: 1, + column: 7, + }, + ], + }, { code: 'var foo = class {};', errors: [ diff --git a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts index 09cf548c7ac..337a96a368f 100644 --- a/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts +++ b/packages/eslint-plugin/tests/rules/interface-name-prefix.test.ts @@ -1,6 +1,29 @@ -import rule from '../../src/rules/interface-name-prefix'; +import assert from 'assert'; +import rule, { parseOptions } from '../../src/rules/interface-name-prefix'; import { RuleTester } from '../RuleTester'; +describe('interface-name-prefix', () => { + it('parseOptions', () => { + assert.deepEqual(parseOptions(['never']), { prefixWithI: 'never' }); + assert.deepEqual(parseOptions(['always']), { + prefixWithI: 'always', + allowUnderscorePrefix: false, + }); + assert.deepEqual(parseOptions([{}]), { prefixWithI: 'never' }); + assert.deepEqual(parseOptions([{ prefixWithI: 'never' }]), { + prefixWithI: 'never', + }); + assert.deepEqual(parseOptions([{ prefixWithI: 'always' }]), { + prefixWithI: 'always', + allowUnderscorePrefix: false, + }); + assert.deepEqual( + parseOptions([{ prefixWithI: 'always', allowUnderscorePrefix: true }]), + { prefixWithI: 'always', allowUnderscorePrefix: true }, + ); + }); +}); + const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); @@ -22,6 +45,14 @@ interface IAnimal { }, { code: ` +interface _IAnimal { + name: string; +} + `, + options: [{ prefixWithI: 'always', allowUnderscorePrefix: true }], + }, + { + code: ` interface IIguana { name: string; } @@ -85,6 +116,21 @@ interface Animal { }, { code: ` +interface Animal { + name: string; +} + `, + options: [{ prefixWithI: 'always', allowUnderscorePrefix: true }], + errors: [ + { + messageId: 'alwaysPrefix', + line: 2, + column: 11, + }, + ], + }, + { + code: ` interface Iguana { name: string; } @@ -117,6 +163,21 @@ interface IIguana { code: ` interface IAnimal { name: string; +} + `, + options: ['never'], + errors: [ + { + messageId: 'noPrefix', + line: 2, + column: 11, + }, + ], + }, + { + code: ` +interface _IAnimal { + name: string; } `, options: ['never'], From 0cfc48e1e8a2222a542006361005aa57824c4a4f Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 13 Aug 2019 16:30:42 -0400 Subject: [PATCH 008/317] fix(typescript-estree): jsx comment parsing (#703) --- .../tests/lib/__snapshots__/comments.ts.snap | 790 ++++++++++++++++++ .../jsx-tag-comment-after-prop.src.js | 11 + .../typescript-estree/src/convert-comments.ts | 4 +- .../tests/lib/__snapshots__/comments.ts.snap | 790 ++++++++++++++++++ .../semantic-diagnostics-enabled.ts.snap | 2 + 5 files changed, 1596 insertions(+), 1 deletion(-) create mode 100644 packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js diff --git a/packages/parser/tests/lib/__snapshots__/comments.ts.snap b/packages/parser/tests/lib/__snapshots__/comments.ts.snap index d04a7d39a32..92affb66677 100644 --- a/packages/parser/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/comments.ts.snap @@ -7282,6 +7282,796 @@ Object { } `; +exports[`Comments fixtures/jsx-tag-comment-after-prop.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 66, + 75, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "raw": "123", + "type": "Literal", + "value": 123, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 99, + 109, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "raw": "\\"woof\\"", + "type": "Literal", + "value": "woof", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 38, + 118, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 38, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 123, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 125, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 125, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 125, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 125, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "Line", + "value": " one", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 84, + 90, + ], + "type": "Line", + "value": " two", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "sourceType": "module", + "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": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + 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": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Numeric", + "value": "123", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "type": "JSXText", + "value": "\\"woof\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` Object { "body": Array [ diff --git a/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js b/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js new file mode 100644 index 00000000000..f6321a0a0c2 --- /dev/null +++ b/packages/shared-fixtures/fixtures/comments/jsx-tag-comment-after-prop.src.js @@ -0,0 +1,11 @@ +const pure = () => { + return ( + + ); +} + diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 159c24cf3ef..d3738774cd9 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -147,7 +147,9 @@ export function convertComments( // Rescan after a JSX expression if ( container.parent && - container.parent.kind === ts.SyntaxKind.JsxExpression + container.parent.kind === ts.SyntaxKind.JsxExpression && + container.parent.parent && + container.parent.parent.kind === ts.SyntaxKind.JsxElement ) { kind = triviaScanner.reScanJsxToken(); continue; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap index e143fdb8524..b90f5eb4548 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap @@ -7282,6 +7282,796 @@ Object { } `; +exports[`Comments fixtures/jsx-tag-comment-after-prop.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 66, + 75, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "raw": "123", + "type": "Literal", + "value": 123, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 99, + 109, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "raw": "\\"woof\\"", + "type": "Literal", + "value": "woof", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 38, + 118, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 38, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 123, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 125, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 125, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 125, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 125, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "Line", + "value": " one", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 84, + 90, + ], + "type": "Line", + "value": " two", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "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": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + 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": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Numeric", + "value": "123", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "type": "JSXText", + "value": "\\"woof\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` Object { "body": Array [ 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 7af41c0f302..b4f79cd04d1 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 @@ -18,6 +18,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-generic-with-comment-in-tag.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comment-after-prop.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-tag-comments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-text-with-multiline-non-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; From 05ba26879dd5a5a0e1159951c8b24dc5e0e5cc4a Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 21:31:17 +0000 Subject: [PATCH 009/317] chore: publish v2.0.0 --- CHANGELOG.md | 66 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 22 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +- packages/eslint-plugin/CHANGELOG.md | 62 ++++++++++++++++++++ packages/eslint-plugin/package.json | 4 +- packages/experimental-utils/CHANGELOG.md | 30 ++++++++++ packages/experimental-utils/package.json | 4 +- packages/parser/CHANGELOG.md | 28 +++++++++ packages/parser/package.json | 8 +-- packages/shared-fixtures/CHANGELOG.md | 12 ++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 30 ++++++++++ packages/typescript-estree/package.json | 4 +- 14 files changed, 265 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff90c01198b..306e1582021 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,72 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) +* feat(eslint-plugin)!: [array-type] rework options (#654) ([1389393](https://github.com/typescript-eslint/typescript-eslint/commit/1389393)), closes [#654](https://github.com/typescript-eslint/typescript-eslint/issues/654) [#635](https://github.com/typescript-eslint/typescript-eslint/issues/635) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] flag default export w/allowExpressions ([#831](https://github.com/typescript-eslint/typescript-eslint/issues/831)) ([ebbcc01](https://github.com/typescript-eslint/typescript-eslint/commit/ebbcc01)) +* **eslint-plugin:** [no-explicit-any] Fix ignoreRestArgs for interfaces ([#777](https://github.com/typescript-eslint/typescript-eslint/issues/777)) ([22e9ae5](https://github.com/typescript-eslint/typescript-eslint/commit/22e9ae5)) +* **eslint-plugin:** [no-useless-constructor] handle bodyless constructor ([#685](https://github.com/typescript-eslint/typescript-eslint/issues/685)) ([55e788c](https://github.com/typescript-eslint/typescript-eslint/commit/55e788c)) +* **eslint-plugin:** [prefer-readonly] TypeError when having comp… ([#761](https://github.com/typescript-eslint/typescript-eslint/issues/761)) ([211b1b5](https://github.com/typescript-eslint/typescript-eslint/commit/211b1b5)) +* **eslint-plugin:** [typedef] support "for..in", "for..of" ([#787](https://github.com/typescript-eslint/typescript-eslint/issues/787)) ([39e41b5](https://github.com/typescript-eslint/typescript-eslint/commit/39e41b5)) +* **eslint-plugin:** [typedef] support default value for parameter ([#785](https://github.com/typescript-eslint/typescript-eslint/issues/785)) ([84916e6](https://github.com/typescript-eslint/typescript-eslint/commit/84916e6)) +* **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) +* **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +* **eslint-plugin:** [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations ([#790](https://github.com/typescript-eslint/typescript-eslint/issues/790)) ([0c4f474](https://github.com/typescript-eslint/typescript-eslint/commit/0c4f474)) +* **eslint-plugin:** [no-var-requires] report on foo(require('')) ([#725](https://github.com/typescript-eslint/typescript-eslint/issues/725)) ([b2ca20d](https://github.com/typescript-eslint/typescript-eslint/commit/b2ca20d)), closes [#665](https://github.com/typescript-eslint/typescript-eslint/issues/665) +* **eslint-plugin:** [promise-function-async] make allowAny default true ([#733](https://github.com/typescript-eslint/typescript-eslint/issues/733)) ([590ca50](https://github.com/typescript-eslint/typescript-eslint/commit/590ca50)) +* **eslint-plugin:** [strict-boolean-expressions] add ignoreRhs option ([#691](https://github.com/typescript-eslint/typescript-eslint/issues/691)) ([fd6be42](https://github.com/typescript-eslint/typescript-eslint/commit/fd6be42)) +* **eslint-plugin:** add support for object props in CallExpressions ([#728](https://github.com/typescript-eslint/typescript-eslint/issues/728)) ([8141f01](https://github.com/typescript-eslint/typescript-eslint/commit/8141f01)) +* **eslint-plugin:** added new rule typedef ([#581](https://github.com/typescript-eslint/typescript-eslint/issues/581)) ([35cc99b](https://github.com/typescript-eslint/typescript-eslint/commit/35cc99b)) +* **eslint-plugin:** added new rule use-default-type-parameter ([#562](https://github.com/typescript-eslint/typescript-eslint/issues/562)) ([2b942ba](https://github.com/typescript-eslint/typescript-eslint/commit/2b942ba)) +* **eslint-plugin:** move opinionated rules between configs ([#595](https://github.com/typescript-eslint/typescript-eslint/issues/595)) ([4893aec](https://github.com/typescript-eslint/typescript-eslint/commit/4893aec)) +* **eslint-plugin:** remove deprecated rules ([#739](https://github.com/typescript-eslint/typescript-eslint/issues/739)) ([e32c7ad](https://github.com/typescript-eslint/typescript-eslint/commit/e32c7ad)) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* **eslint-plugin:** both 'eslint-recommended' and 'recommended' have changed. +* **eslint-plugin:** removing rules +* changes config structure + +```ts +type ArrayOption = 'array' | 'generic' | 'array-simple'; +type Options = [ + { + // default case for all arrays + default: ArrayOption, + // optional override for readonly arrays + readonly?: ArrayOption, + }, +]; +``` +* **eslint-plugin:** changing default rule config +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/lerna.json b/lerna.json index b700c7342eb..e4b8a907880 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.13.0", + "version": "2.0.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index fc36ec03175..1339f31787c 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index bf40809b2db..a35949dc244 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": "1.13.0", + "version": "2.0.0", "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": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.13.0" + "@typescript-eslint/parser": "2.0.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index b7ff8b2d6ac..ac4b1f894c4 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,68 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] flag default export w/allowExpressions ([#831](https://github.com/typescript-eslint/typescript-eslint/issues/831)) ([ebbcc01](https://github.com/typescript-eslint/typescript-eslint/commit/ebbcc01)) +* **eslint-plugin:** [no-explicit-any] Fix ignoreRestArgs for interfaces ([#777](https://github.com/typescript-eslint/typescript-eslint/issues/777)) ([22e9ae5](https://github.com/typescript-eslint/typescript-eslint/commit/22e9ae5)) +* **eslint-plugin:** [no-useless-constructor] handle bodyless constructor ([#685](https://github.com/typescript-eslint/typescript-eslint/issues/685)) ([55e788c](https://github.com/typescript-eslint/typescript-eslint/commit/55e788c)) +* **eslint-plugin:** [prefer-readonly] TypeError when having comp… ([#761](https://github.com/typescript-eslint/typescript-eslint/issues/761)) ([211b1b5](https://github.com/typescript-eslint/typescript-eslint/commit/211b1b5)) +* **eslint-plugin:** [typedef] support "for..in", "for..of" ([#787](https://github.com/typescript-eslint/typescript-eslint/issues/787)) ([39e41b5](https://github.com/typescript-eslint/typescript-eslint/commit/39e41b5)) +* **eslint-plugin:** [typedef] support default value for parameter ([#785](https://github.com/typescript-eslint/typescript-eslint/issues/785)) ([84916e6](https://github.com/typescript-eslint/typescript-eslint/commit/84916e6)) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) +* feat(eslint-plugin)!: [array-type] rework options (#654) ([1389393](https://github.com/typescript-eslint/typescript-eslint/commit/1389393)), closes [#654](https://github.com/typescript-eslint/typescript-eslint/issues/654) [#635](https://github.com/typescript-eslint/typescript-eslint/issues/635) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) +* **eslint-plugin:** [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations ([#790](https://github.com/typescript-eslint/typescript-eslint/issues/790)) ([0c4f474](https://github.com/typescript-eslint/typescript-eslint/commit/0c4f474)) +* **eslint-plugin:** [no-var-requires] report on foo(require('')) ([#725](https://github.com/typescript-eslint/typescript-eslint/issues/725)) ([b2ca20d](https://github.com/typescript-eslint/typescript-eslint/commit/b2ca20d)), closes [#665](https://github.com/typescript-eslint/typescript-eslint/issues/665) +* **eslint-plugin:** [promise-function-async] make allowAny default true ([#733](https://github.com/typescript-eslint/typescript-eslint/issues/733)) ([590ca50](https://github.com/typescript-eslint/typescript-eslint/commit/590ca50)) +* **eslint-plugin:** [strict-boolean-expressions] add ignoreRhs option ([#691](https://github.com/typescript-eslint/typescript-eslint/issues/691)) ([fd6be42](https://github.com/typescript-eslint/typescript-eslint/commit/fd6be42)) +* **eslint-plugin:** add support for object props in CallExpressions ([#728](https://github.com/typescript-eslint/typescript-eslint/issues/728)) ([8141f01](https://github.com/typescript-eslint/typescript-eslint/commit/8141f01)) +* **eslint-plugin:** added new rule typedef ([#581](https://github.com/typescript-eslint/typescript-eslint/issues/581)) ([35cc99b](https://github.com/typescript-eslint/typescript-eslint/commit/35cc99b)) +* **eslint-plugin:** added new rule use-default-type-parameter ([#562](https://github.com/typescript-eslint/typescript-eslint/issues/562)) ([2b942ba](https://github.com/typescript-eslint/typescript-eslint/commit/2b942ba)) +* **eslint-plugin:** move opinionated rules between configs ([#595](https://github.com/typescript-eslint/typescript-eslint/issues/595)) ([4893aec](https://github.com/typescript-eslint/typescript-eslint/commit/4893aec)) +* **eslint-plugin:** remove deprecated rules ([#739](https://github.com/typescript-eslint/typescript-eslint/issues/739)) ([e32c7ad](https://github.com/typescript-eslint/typescript-eslint/commit/e32c7ad)) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* **eslint-plugin:** both 'eslint-recommended' and 'recommended' have changed. +* **eslint-plugin:** removing rules +* changes config structure + +```ts +type ArrayOption = 'array' | 'generic' | 'array-simple'; +type Options = [ + { + // default case for all arrays + default: ArrayOption, + // optional override for readonly arrays + readonly?: ArrayOption, + }, +]; +``` +* **eslint-plugin:** changing default rule config +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e0d1c05a9fe..b3d3734d15e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.13.0", + "version": "2.0.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", "eslint-utils": "^1.4.0", "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 243445d33cd..8ea9fd4a22c 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) +* **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +* feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) + + +### BREAKING CHANGES + +* removed some rules from recommended config +* recommended config changes are considered breaking +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 4574f3129d1..c4fde675f18 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "1.13.0", + "version": "2.0.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": "1.13.0", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 0b158483fcf..23eb1182e2a 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index bc3f3cf29b0..4d67b9a555e 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.13.0", + "version": "2.0.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -42,13 +42,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.13.0", - "@typescript-eslint/typescript-estree": "1.13.0", + "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/typescript-estree": "2.0.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "1.13.0", + "@typescript-eslint/shared-fixtures": "2.0.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 2c796c965bb..3aec5aabbcd 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/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.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-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 d211eed6e38..0fedd2edbe9 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.13.0", + "version": "2.0.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2267143f5c7..27a2f9ea6a3 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) + + +* feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) +* feat(typescript-estree)!: throw error on file not in project when `project` set (#760) ([3777b77](https://github.com/typescript-eslint/typescript-eslint/commit/3777b77)), closes [#760](https://github.com/typescript-eslint/typescript-eslint/issues/760) +* feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) + + +### Bug Fixes + +* **typescript-estree:** fix `is` token typed as `Keyword ([#750](https://github.com/typescript-eslint/typescript-eslint/issues/750)) ([35dec52](https://github.com/typescript-eslint/typescript-eslint/commit/35dec52)) +* **typescript-estree:** jsx comment parsing ([#703](https://github.com/typescript-eslint/typescript-eslint/issues/703)) ([0cfc48e](https://github.com/typescript-eslint/typescript-eslint/commit/0cfc48e)) + + +### Features + +* explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) + + +### BREAKING CHANGES + +* recommended config changes are considered breaking +* by default we will now throw when a file is not in the `project` provided +* Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule +* Node 6 is no longer supported + + + + + # [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) **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 e0a0e661882..d7c8bae66ef 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.13.0", + "version": "2.0.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -53,7 +53,7 @@ "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "1.13.0", + "@typescript-eslint/shared-fixtures": "2.0.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 2e2fe90c6645cfc59e59a90b6542415e735dcbb9 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 13 Aug 2019 22:50:38 +0100 Subject: [PATCH 010/317] chore: reenable automated canary releases for master (#849) --- azure-pipelines.yml | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e3bdabad347..960eb86b11d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,28 +77,28 @@ jobs: yarn test displayName: 'Run unit tests' - # - job: publish_canary_version - # displayName: Publish the latest code as a canary version - # dependsOn: - # - primary_code_validation_and_tests - # - unit_tests_on_other_node_versions - # condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest')) - # pool: - # vmImage: 'Ubuntu-16.04' - # steps: - # - task: NodeTool@0 - # inputs: - # versionSpec: 11 - # displayName: 'Install Node.js 11' - - # - script: | - # # This also runs a build as part of the postinstall - # # bootstrap - # yarn --ignore-engines --frozen-lockfile - - # - script: | - # npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) - - # - script: | - # npx lerna publish --canary --exact --force-publish --yes - # displayName: 'Publish all packages to npm' + - job: publish_canary_version + displayName: Publish the latest code as a canary version + dependsOn: + - primary_code_validation_and_tests + - unit_tests_on_other_node_versions + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.Reason'], 'PullRequest')) + pool: + vmImage: 'Ubuntu-16.04' + steps: + - task: NodeTool@0 + inputs: + versionSpec: 11 + displayName: 'Install Node.js 11' + + - script: | + # This also runs a build as part of the postinstall + # bootstrap + yarn --ignore-engines --frozen-lockfile + + - script: | + npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) + + - script: | + npx lerna publish --canary --exact --force-publish --yes + displayName: 'Publish all packages to npm' From ca3b6a57b589213c6761cc311127cf3aa7e42082 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 14 Aug 2019 19:23:39 +0300 Subject: [PATCH 011/317] docs(parser): fix typo (#855) --- packages/parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index 45c620280f1..cbabebd95f8 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -55,7 +55,7 @@ The following additional configuration options are available by specifying them ```ts { "extends": "./tsconfig.json", // path to existing tsconfig - "includes": [ + "include": [ "src/**/*.ts", "test/**/*.ts", // etc From a8da33010a87e61f6fc03fb93b7ea20853c90bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=97=E4=BD=A0=E6=98=AF=E5=B0=8F=E7=8C=AB=E5=92=AA?= Date: Thu, 15 Aug 2019 11:56:59 +0800 Subject: [PATCH 012/317] docs(eslint-plugin): fix link in indent docs (#860) --- packages/eslint-plugin/docs/rules/indent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/indent.md b/packages/eslint-plugin/docs/rules/indent.md index 5678ba291da..4ffd6f894c7 100644 --- a/packages/eslint-plugin/docs/rules/indent.md +++ b/packages/eslint-plugin/docs/rules/indent.md @@ -90,7 +90,7 @@ This rule has an object option: - `"ObjectExpression"` (default: 1) enforces indentation level for properties in objects. It can be set to the string `"first"`, indicating that all properties in the object should be aligned with the first property. This can also be set to `"off"` to disable checking for object properties. - `"ImportDeclaration"` (default: 1) enforces indentation level for import statements. It can be set to the string `"first"`, indicating that all imported members from a module should be aligned with the first member in the list. This can also be set to `"off"` to disable checking for imported module members. - `"flatTernaryExpressions": true` (`false` by default) requires no indentation for ternary expressions which are nested in other ternary expressions. -- `"ignoredNodes"` accepts an array of [selectors](/docs/developer-guide/selectors.md). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. +- `"ignoredNodes"` accepts an array of [selectors](https://eslint.org/docs/developer-guide/selectors). If an AST node is matched by any of the selectors, the indentation of tokens which are direct children of that node will be ignored. This can be used as an escape hatch to relax the rule if you disagree with the indentation that it enforces for a particular syntactic pattern. - `"ignoreComments"` (default: false) can be used when comments do not need to be aligned with nodes on the previous or next line. Level of indentation denotes the multiple of the indent specified. Example: From 5eb40dc323720778955c68202117cec38f1f478a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bouhier Date: Thu, 15 Aug 2019 14:13:32 -0700 Subject: [PATCH 013/317] fix(eslint-plugin): readme typo (#867) --- 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 1ecc3e86cf9..e0f32686c9d 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -65,7 +65,7 @@ You can also use [eslint:recommended](https://eslint.org/docs/rules/) (the set o As of version 2 of this plugin, _by design_, none of the rules in the main `recommended` config require type-checking in order to run. This means that they are more lightweight and faster to run. -Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You wou apply this _in addition_ to the recommended configs previously mentioned, e.g.: +Some highly valuable rules simply require type-checking in order to be implemented correctly, however, so we provide an additional config you can extend from called `recommended-requiring-type-checking`. You would apply this _in addition_ to the recommended configs previously mentioned, e.g.: ```json { From 32d37453121743b329df9b587b78a75c1bdd5efb Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Thu, 15 Aug 2019 18:56:49 -0700 Subject: [PATCH 014/317] chore: fix line end character for json/md (#869) --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index 8db1f2632df..73968f2a614 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,7 @@ * text=auto *.js eol=lf +*.json eol=lf +*.md eol=lf *.ts eol=lf *.tsx eol=lf *.yml eol=lf From 4b0d2d9f9b8ab370150119eb9bee0908b6751203 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 00:19:17 -0700 Subject: [PATCH 015/317] chore(eslint-plugin): fix peer dependency (#859) --- packages/eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index b3d3734d15e..6706be22576 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -56,7 +56,7 @@ "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^2.0.0-alpha.0", + "@typescript-eslint/parser": "^2.0.0", "eslint": "^5.0.0 || ^6.0.0" } } From 580eceb83183ddc7a4798eb5bc55a36f71dcda89 Mon Sep 17 00:00:00 2001 From: Ben Lichtman Date: Mon, 19 Aug 2019 01:50:35 -0700 Subject: [PATCH 016/317] fix(eslint-plugin): [unified-signatures] type comparison and exported nodes (#839) --- .gitignore | 3 + .../src/rules/unified-signatures.ts | 38 +++++++++--- .../tests/rules/unified-signatures.test.ts | 58 +++++++++++++++++++ .../src/ts-estree/ts-estree.ts | 1 + 4 files changed, 93 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 55599f0c184..3a06baccf6f 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ jspm_packages/ .DS_Store .idea dist + +# Editor-specific metadata folders +.vs diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 1c3f747bc51..c4c7f9bf427 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -35,6 +35,9 @@ type ScopeNode = | TSESTree.TSTypeLiteral; type OverloadNode = MethodDefinition | SignatureDefinition; +type ContainingNode = + | TSESTree.ExportNamedDeclaration + | TSESTree.ExportDefaultDeclaration; type SignatureDefinition = | TSESTree.FunctionExpression @@ -424,7 +427,8 @@ export default util.createRule({ a === b || (a !== undefined && b !== undefined && - a.typeAnnotation.type === b.typeAnnotation.type) + sourceCode.getText(a.typeAnnotation) === + sourceCode.getText(b.typeAnnotation)) ); } @@ -495,9 +499,16 @@ export default util.createRule({ currentScope = scopes.pop()!; } - function addOverload(signature: OverloadNode, key?: string): void { + function addOverload( + signature: OverloadNode, + key?: string, + containingNode?: ContainingNode, + ): void { key = key || getOverloadKey(signature); - if (currentScope && signature.parent === currentScope.parent && key) { + if ( + currentScope && + (containingNode || signature).parent === currentScope.parent + ) { const overloads = currentScope.overloads.get(key); if (overloads !== undefined) { overloads.push(signature); @@ -521,11 +532,10 @@ export default util.createRule({ createScope(node.body, node.typeParameters); }, TSTypeLiteral: createScope, + // collect overloads TSDeclareFunction(node): void { - if (node.id && !node.body) { - addOverload(node, node.id.name); - } + addOverload(node, node.id.name, getExportingNode(node)); }, TSCallSignatureDeclaration: addOverload, TSConstructSignatureDeclaration: addOverload, @@ -540,6 +550,7 @@ export default util.createRule({ addOverload(node); } }, + // validate scopes 'Program:exit': checkScope, 'TSModuleBlock:exit': checkScope, @@ -550,7 +561,20 @@ export default util.createRule({ }, }); -function getOverloadKey(node: OverloadNode): string | undefined { +function getExportingNode( + node: TSESTree.TSDeclareFunction, +): + | TSESTree.ExportNamedDeclaration + | TSESTree.ExportDefaultDeclaration + | undefined { + return node.parent && + (node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration || + node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration) + ? node.parent + : undefined; +} + +function getOverloadKey(node: OverloadNode): string { const info = getOverloadInfo(node); return ( diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index 5d65e2f1801..c8f9740662d 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -105,6 +105,30 @@ interface I { function f(x: T[]): void; function f(x: T): void; `, + // Same name, different scopes + ` +declare function foo(n: number): number; + +declare module "hello" { + function foo(n: number, s: string): number; +} +`, + // children of block not checked to match TSLint + ` +{ + function block(): number; + function block(n: number): number; + function block(n?: number): number { + return 3; + } +} +`, + ` +export interface Foo { + bar(baz: string): number[]; + bar(): string[]; +} +`, ], invalid: [ { @@ -591,5 +615,39 @@ class Foo { }, ], }, + { + code: ` +export function foo(line: number): number; +export function foo(line: number, character?: number): number; +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 3, + column: 35, + }, + ], + }, + { + code: ` +declare function foo(line: number): number; +export function foo(line: number, character?: number): number; +`, + errors: [ + { + messageId: 'omittingSingleParameter', + data: { + failureStringStart: + 'These overloads can be combined into one signature', + }, + line: 3, + column: 35, + }, + ], + }, ], }); diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index f079fd68d47..7276f8d93e3 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -1040,6 +1040,7 @@ export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { } export interface TSDeclareFunction extends FunctionDeclarationBase { + id: Identifier; type: AST_NODE_TYPES.TSDeclareFunction; } From 656d25528f6e9772a80d2569312c302c4bb6329b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 01:51:33 -0700 Subject: [PATCH 017/317] docs: add more issue templates (#811) --- .github/ISSUE_TEMPLATE.md | 37 +++++++++++++++++++ .../eslint-plugin-typescript.md | 2 +- .../ISSUE_TEMPLATE/typescript-eslint-utils.md | 20 ++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/typescript-eslint-utils.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..e219ef75b4f --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,37 @@ +--- +name: catch-all template +about: Provides some general structure to issues that people choose to log outside the normal flow +title: '' +labels: triage +assignees: '' +--- + +**What were you trying to do?** + +```json +{ + "rules": { + "@typescript-eslint/": [""] + } +} +``` + +```ts +// Put your code here +``` + +**What did you expect to happen?** + +**What actually happened?** + +**Versions** + +| package | version | +| --------------------------------------- | ------- | +| `@typescript-eslint/eslint-plugin` | `X.Y.Z` | +| `@typescript-eslint/parser` | `X.Y.Z` | +| `@typescript-eslint/typescript-estree` | `X.Y.Z` | +| `@typescript-eslint/experimental-utils` | `X.Y.Z` | +| `TypeScript` | `X.Y.Z` | +| `node` | `X.Y.Z` | +| `npm` | `X.Y.Z` | diff --git a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md index 010b5c01cb3..ad7d8fb4944 100644 --- a/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md +++ b/.github/ISSUE_TEMPLATE/eslint-plugin-typescript.md @@ -22,7 +22,7 @@ Are you opening an issue because the rule you're trying to use is not found? 1) Check the releases log: https://github.com/typescript-eslint/typescript-eslint/releases - If the rule isn't listed there, then chances are it hasn't been released to the main npm tag yet. 2) Try installing the `canary` tag: `npm i @typescript-eslint/eslint-plugin@canary`. - - The canary tag is built for every commit to master, so it contains the bleeding edge build. + - The canary tag is built for every commit to master, so it contains the bleeding edge build. 3) If ESLint still can't find the rule, then consider reporting an issue. --> diff --git a/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md b/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md new file mode 100644 index 00000000000..8403568e4ac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/typescript-eslint-utils.md @@ -0,0 +1,20 @@ +--- +name: '@typescript-eslint/experimental-utils' +about: Report an issue with the `@typescript-eslint/experimental-utils` package +title: '' +labels: 'package: utils, triage' +assignees: '' +--- + +**What did you expect to happen?** + +**What actually happened?** + +**Versions** + +| package | version | +| --------------------------------------- | ------- | +| `@typescript-eslint/experimental-utils` | `X.Y.Z` | +| `TypeScript` | `X.Y.Z` | +| `node` | `X.Y.Z` | +| `npm` | `X.Y.Z` | From 9f8209952c2325763f490b6b283dfa717e3df1b5 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 19 Aug 2019 12:03:14 +0300 Subject: [PATCH 018/317] feat(eslint-plugin): add quotes [extension] (#762) --- packages/eslint-plugin/README.md | 1 + packages/eslint-plugin/docs/rules/quotes.md | 22 + packages/eslint-plugin/src/configs/all.json | 2 + packages/eslint-plugin/src/rules/index.ts | 2 + packages/eslint-plugin/src/rules/quotes.ts | 62 ++ .../eslint-plugin/tests/rules/quotes.test.ts | 662 ++++++++++++++++++ .../eslint-plugin/tools/generate-configs.ts | 1 + .../eslint-plugin/typings/eslint-rules.d.ts | 20 + 8 files changed, 772 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/quotes.md create mode 100644 packages/eslint-plugin/src/rules/quotes.ts create mode 100644 packages/eslint-plugin/tests/rules/quotes.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index e0f32686c9d..a3ce816616b 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -191,6 +191,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/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/quotes.md b/packages/eslint-plugin/docs/rules/quotes.md new file mode 100644 index 00000000000..e707a94b3d3 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/quotes.md @@ -0,0 +1,22 @@ +# Enforce the consistent use of either backticks, double, or single quotes + +## Rule Details + +This rule extends the base [eslint/quotes](https://eslint.org/docs/rules/quotes) rule. +It supports all options and features of the base rule. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "quotes": "off", + "@typescript-eslint/quotes": ["error"] +} +``` + +## Options + +See [eslint/quotes options](https://eslint.org/docs/rules/quotes#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/quotes.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 30a7cafafb5..cce896718db 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -62,6 +62,8 @@ "@typescript-eslint/prefer-regexp-exec": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error", "@typescript-eslint/promise-function-async": "error", + "quotes": "off", + "@typescript-eslint/quotes": "error", "@typescript-eslint/require-array-sort-compare": "error", "require-await": "off", "@typescript-eslint/require-await": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index db155e691bf..bd39c7867e3 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -48,6 +48,7 @@ import preferReadonly from './prefer-readonly'; import preferRegexpExec from './prefer-regexp-exec'; import preferStringStartsEndsWith from './prefer-string-starts-ends-with'; import promiseFunctionAsync from './promise-function-async'; +import quotes from './quotes'; import requireArraySortCompare from './require-array-sort-compare'; import requireAwait from './require-await'; import restrictPlusOperands from './restrict-plus-operands'; @@ -112,6 +113,7 @@ export default { 'prefer-regexp-exec': preferRegexpExec, 'prefer-string-starts-ends-with': preferStringStartsEndsWith, 'promise-function-async': promiseFunctionAsync, + quotes: quotes, 'require-array-sort-compare': requireArraySortCompare, 'require-await': requireAwait, 'restrict-plus-operands': restrictPlusOperands, diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts new file mode 100644 index 00000000000..97efc04c821 --- /dev/null +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -0,0 +1,62 @@ +import { + AST_NODE_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/quotes'; +import * as util from '../util'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'quotes', + meta: { + type: 'layout', + docs: { + description: + 'Enforce the consistent use of either backticks, double, or single quotes', + category: 'Stylistic Issues', + recommended: false, + }, + fixable: 'code', + messages: baseRule.meta.messages, + schema: baseRule.meta.schema, + }, + defaultOptions: [ + 'double', + { + allowTemplateLiterals: false, + avoidEscape: false, + }, + ], + create(context, [option]) { + const rules = baseRule.create(context); + + const isModuleDeclaration = (node: TSESTree.Literal): boolean => { + return ( + !!node.parent && node.parent.type === AST_NODE_TYPES.TSModuleDeclaration + ); + }; + + const isTypeLiteral = (node: TSESTree.Literal): boolean => { + return !!node.parent && node.parent.type === AST_NODE_TYPES.TSLiteralType; + }; + + return { + Literal(node) { + if ( + option === 'backtick' && + (isModuleDeclaration(node) || isTypeLiteral(node)) + ) { + return; + } + + rules.Literal(node); + }, + + TemplateLiteral(node) { + rules.TemplateLiteral(node); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/quotes.test.ts b/packages/eslint-plugin/tests/rules/quotes.test.ts new file mode 100644 index 00000000000..bec1f4b7e98 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/quotes.test.ts @@ -0,0 +1,662 @@ +import rule from '../../src/rules/quotes'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, +}); + +/** + * the base rule `quotes` doesn't use a message id + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useDoubleQuote: any = { + message: 'Strings must use doublequote.', +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useSingleQuote: any = { + message: 'Strings must use singlequote.', +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const useBacktick: any = { + message: 'Strings must use backtick.', +}; + +ruleTester.run('quotes', rule, { + valid: [ + { + code: `declare module '*.html' {}`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` + class A { + public prop: IProps['prop']; + } + `, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + + /** ESLint */ + `var foo = "bar";`, + { + code: `var foo = 'bar';`, + options: ['single'], + }, + { + code: `var foo = "bar";`, + options: ['double'], + }, + { + code: `var foo = 1;`, + options: ['single'], + }, + { + code: `var foo = 1;`, + options: ['double'], + }, + { + code: `var foo = "'";`, + options: [ + 'single', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo = '"';`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo = <>Hello world;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: ['double'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo = <>Hello world;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
;`, + options: ['single'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['double'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: "var foo = `bar 'baz'`;", + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `bar "baz"`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `var foo = 1;`, + options: ['backtick'], + }, + { + code: 'var foo = "a string containing `backtick` quotes";', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + }, + { + code: `var foo =
;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + { + code: `var foo =
Hello world
;`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + }, + }, + }, + + // Backticks are only okay if they have substitutions, contain a line break, or are tagged + { + code: 'var foo = `back\ntick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\rtick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\u2028tick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\u2029tick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\\\\\ntick`;', // 2 backslashes followed by a newline + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back\\\\\\\\\ntick`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `\n`;', + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `back${x}tick`;', + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = tag`backtick`;', + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + }, + + // Backticks are also okay if allowTemplateLiterals + { + code: "var foo = `bar 'foo' baz` + 'bar';", + options: [ + 'single', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: 'var foo = `bar \'foo\' baz` + "bar";', + options: [ + 'double', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: "var foo = `bar 'foo' baz` + `bar`;", + options: [ + 'backtick', + { + allowTemplateLiterals: true, + }, + ], + parserOptions: { ecmaVersion: 6 }, + }, + + // `backtick` should not warn the directive prologues. + { + code: '"use strict"; var foo = `backtick`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: '"use strict"; \'use strong\'; "use asm"; var foo = `backtick`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + 'function foo() { "use strict"; "use strong"; "use asm"; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + "(function() { 'use strict'; 'use strong'; 'use asm'; var foo = `backtick`; })();", + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: + '(() => { "use strict"; "use strong"; "use asm"; var foo = `backtick`; })();', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + + // `backtick` should not warn import/export sources. + { + code: `import "a"; import 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + { + code: `import a from "a"; import b from 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + { + code: `export * from "a"; export * from 'b';`, + options: ['backtick'], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + }, + + // `backtick` should not warn property/method names (not computed). + { + code: `var obj = {"key0": 0, 'key1': 1};`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `class Foo { 'bar'(){} }`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: `class Foo { static ''(){} }`, + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + }, + ], + + invalid: [ + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: ['single'], + errors: [useSingleQuote], + }, + { + code: 'var foo = `bar`;', + output: `var foo = 'bar';`, + options: ['single'], + parserOptions: { ecmaVersion: 6 }, + errors: [useSingleQuote], + }, + { + code: `var foo = 'don\\'t';`, + output: `var foo = "don't";`, + errors: [useDoubleQuote], + }, + { + code: `var msg = "Plugin '" + name + "' not found"`, + output: `var msg = 'Plugin \\'' + name + '\\' not found'`, + options: ['single'], + errors: [ + { ...useSingleQuote, column: 11 }, + { ...useSingleQuote, column: 31 }, + ], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: ['double'], + errors: [useDoubleQuote], + }, + { + code: 'var foo = `bar`;', + output: `var foo = "bar";`, + options: ['double'], + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: [ + 'single', + { + avoidEscape: true, + }, + ], + errors: [useSingleQuote], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: [ + 'double', + { + avoidEscape: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = '\\\\';`, + output: `var foo = "\\\\\";`, // eslint-disable-line no-useless-escape + options: [ + 'double', + { + avoidEscape: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = "bar";`, + output: `var foo = 'bar';`, + options: [ + 'single', + { + allowTemplateLiterals: true, + }, + ], + errors: [useSingleQuote], + }, + { + code: `var foo = 'bar';`, + output: `var foo = "bar";`, + options: [ + 'double', + { + allowTemplateLiterals: true, + }, + ], + errors: [useDoubleQuote], + }, + { + code: `var foo = 'bar';`, + output: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: "var foo = 'b${x}a$r';", + output: 'var foo = `b\\${x}a$r`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: 'var foo = "bar";', + output: 'var foo = `bar`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: `var foo = "bar";`, + output: 'var foo = `bar`;', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + { + code: `var foo = 'bar';`, + output: 'var foo = `bar`;', + options: [ + 'backtick', + { + avoidEscape: true, + }, + ], + parserOptions: { ecmaVersion: 2015 }, + errors: [useBacktick], + }, + + // "use strict" is *not* a directive prologue in these statements so is subject to the rule + { + code: 'var foo = `backtick`; "use strict";', + output: 'var foo = `backtick`; `use strict`;', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + { + code: '{ "use strict"; var foo = `backtick`; }', + output: '{ `use strict`; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + { + code: 'if (1) { "use strict"; var foo = `backtick`; }', + output: 'if (1) { `use strict`; var foo = `backtick`; }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick], + }, + + // `backtick` should warn computed property names. + { + code: `var obj = {["key0"]: 0, ['key1']: 1};`, + output: 'var obj = {[`key0`]: 0, [`key1`]: 1};', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick, useBacktick], + }, + { + code: `class Foo { ['a'](){} static ['b'](){} }`, + output: 'class Foo { [`a`](){} static [`b`](){} }', + options: ['backtick'], + parserOptions: { ecmaVersion: 6 }, + errors: [useBacktick, useBacktick], + }, + + // https://github.com/eslint/eslint/issues/7084 + { + code: `
`, + output: `
`, + options: [`single`], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + errors: [useSingleQuote], + }, + { + code: `
`, + output: `
`, + options: ['double'], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + errors: [useDoubleQuote], + }, + { + code: `
`, + output: '
', + options: ['backtick'], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 2015, + }, + errors: [useBacktick], + }, + + // https://github.com/eslint/eslint/issues/7610 + { + code: '`use strict`;', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'function foo() { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'foo = function() { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '() => { `use strict`; foo(); }', + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '() => { foo(); `use strict`; }', + output: `() => { foo(); "use strict"; }`, + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'foo(); `use strict`;', + output: 'foo(); "use strict";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + + // https://github.com/eslint/eslint/issues/7646 + { + code: 'var foo = `foo\\nbar`;', + output: 'var foo = "foo\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'var foo = `foo\\\nbar`;', // 1 backslash followed by a newline + output: 'var foo = "foo\\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: 'var foo = `foo\\\\\\\nbar`;', // 3 backslashes followed by a newline + output: 'var foo = "foo\\\\\\\nbar";', + parserOptions: { ecmaVersion: 6 }, + errors: [useDoubleQuote], + }, + { + code: '````', + output: '""``', + parserOptions: { ecmaVersion: 6 }, + errors: [{ ...useDoubleQuote, line: 1, column: 1 }], + }, + ], +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index cda1b0771ea..b400ca05722 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -29,6 +29,7 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ 'no-empty-function', 'no-extra-parens', 'no-magic-numbers', + 'quotes', 'no-unused-vars', 'no-use-before-define', 'no-useless-constructor', diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 4e5fe5b6449..dcc37035c9d 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -461,3 +461,23 @@ declare module 'eslint/lib/rules/semi' { >; export = rule; } + +declare module 'eslint/lib/rules/quotes' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + never, + [ + 'single' | 'double' | 'backtick', + { + allowTemplateLiterals?: boolean; + avoidEscape?: boolean; + }?, + ], + { + Literal(node: TSESTree.Literal): void; + TemplateLiteral(node: TSESTree.TemplateLiteral): void; + } + >; + export = rule; +} From b00666735bc6f7fc0580e9342cf92aba7cf4185c Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 19 Aug 2019 13:50:23 +0300 Subject: [PATCH 019/317] fix(eslint-plugin): [member-naming] should match constructor args (#771) --- .../eslint-plugin/src/rules/member-naming.ts | 69 ++++++++++++++---- .../tests/rules/member-naming.test.ts | 70 +++++++++++++++++++ 2 files changed, 124 insertions(+), 15 deletions(-) diff --git a/packages/eslint-plugin/src/rules/member-naming.ts b/packages/eslint-plugin/src/rules/member-naming.ts index 9995b6cf1e3..d850ef69060 100644 --- a/packages/eslint-plugin/src/rules/member-naming.ts +++ b/packages/eslint-plugin/src/rules/member-naming.ts @@ -1,4 +1,7 @@ -import { TSESTree } from '@typescript-eslint/experimental-utils'; +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; import * as util from '../util'; interface Config { @@ -61,37 +64,73 @@ export default util.createRule({ return acc; }, {}); - /** - * Check that the property name matches the convention for its - * accessibility. - * @param {ASTNode} node the named node to evaluate. - * @returns {void} - * @private - */ + function getParameterNode( + node: TSESTree.TSParameterProperty, + ): TSESTree.Identifier | null { + if (node.parameter.type === AST_NODE_TYPES.AssignmentPattern) { + return node.parameter.left as TSESTree.Identifier; + } + + if (node.parameter.type === AST_NODE_TYPES.Identifier) { + return node.parameter; + } + + return null; + } + + function validateParameterName(node: TSESTree.TSParameterProperty): void { + const parameterNode = getParameterNode(node); + if (!parameterNode) { + return; + } + + validate(parameterNode, parameterNode.name, node.accessibility); + } + function validateName( node: TSESTree.MethodDefinition | TSESTree.ClassProperty, ): void { - const name = util.getNameFromClassMember(node, sourceCode); - const accessibility: Modifiers = node.accessibility || 'public'; - const convention = conventions[accessibility]; - - const method = node as TSESTree.MethodDefinition; - if (method.kind === 'constructor') { + if ( + node.type === AST_NODE_TYPES.MethodDefinition && + node.kind === 'constructor' + ) { return; } + validate( + node.key, + util.getNameFromClassMember(node, sourceCode), + node.accessibility, + ); + } + + /** + * Check that the name matches the convention for its accessibility. + * @param {ASTNode} node the named node to evaluate. + * @param {string} name + * @param {Modifiers} accessibility + * @returns {void} + * @private + */ + function validate( + node: TSESTree.Identifier | TSESTree.Expression, + name: string, + accessibility: Modifiers = 'public', + ): void { + const convention = conventions[accessibility]; if (!convention || convention.test(name)) { return; } context.report({ - node: node.key, + node, messageId: 'incorrectName', data: { accessibility, name, convention }, }); } return { + TSParameterProperty: validateParameterName, MethodDefinition: validateName, ClassProperty: validateName, }; diff --git a/packages/eslint-plugin/tests/rules/member-naming.test.ts b/packages/eslint-plugin/tests/rules/member-naming.test.ts index 96ec4b104f3..851d70ea706 100644 --- a/packages/eslint-plugin/tests/rules/member-naming.test.ts +++ b/packages/eslint-plugin/tests/rules/member-naming.test.ts @@ -86,6 +86,30 @@ class Class { }, ], }, + + { + code: ` +class Test { + constructor(public __a: string, protected __b: string, private __c: string = 100) {} +} + `, + options: [ + { + protected: '^__', + private: '^__', + public: '^__', + }, + ], + }, + { + code: + // Semantically invalid test case, TS has to throw an error. + ` +class Foo { + constructor(private ...name: string[], private [test]: [string]) {} +} + `, + }, ], invalid: [ { @@ -329,5 +353,51 @@ class Class { }, ], }, + { + code: ` +class Test { + constructor(public a: string, protected b: string, private c: string = 100) {} +} + `, + options: [ + { + public: '^__', + protected: '^__', + private: '^__', + }, + ], + errors: [ + { + messageId: 'incorrectName', + data: { + accessibility: 'public', + convention: '/^__/', + name: 'a', + }, + line: 3, + column: 24, + }, + { + messageId: 'incorrectName', + data: { + accessibility: 'protected', + convention: '/^__/', + name: 'b', + }, + line: 3, + column: 45, + }, + { + messageId: 'incorrectName', + data: { + accessibility: 'private', + convention: '/^__/', + name: 'c', + }, + line: 3, + column: 64, + }, + ], + }, ], }); From 14c6f807ec3e3184b358952cdc4d01977d112ff1 Mon Sep 17 00:00:00 2001 From: Zen <843968788@qq.com> Date: Mon, 19 Aug 2019 19:14:57 +0800 Subject: [PATCH 020/317] feat: [no-unnecessary-type-assertion] allow `as const` arrow functions (#876) --- .../rules/explicit-function-return-type.ts | 38 +++++++++++++ .../explicit-function-return-type.test.ts | 56 +++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 67692c20fc0..da3e7334b6a 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -9,6 +9,7 @@ type Options = [ allowExpressions?: boolean; allowTypedFunctionExpressions?: boolean; allowHigherOrderFunctions?: boolean; + allowDirectConstAssertionInArrowFunctions?: boolean; }, ]; type MessageIds = 'missingReturnType'; @@ -39,6 +40,9 @@ export default util.createRule({ allowHigherOrderFunctions: { type: 'boolean', }, + allowDirectConstAssertionInArrowFunctions: { + type: 'boolean', + }, }, additionalProperties: false, }, @@ -49,6 +53,7 @@ export default util.createRule({ allowExpressions: false, allowTypedFunctionExpressions: true, allowHigherOrderFunctions: true, + allowDirectConstAssertionInArrowFunctions: true, }, ], create(context, [options]) { @@ -203,6 +208,30 @@ export default util.createRule({ ); } + /** + * Checks if a function belongs to: + * `() => ({ action: 'xxx' }) as const` + */ + function returnsConstAssertionDirectly( + node: TSESTree.ArrowFunctionExpression, + ): boolean { + const { body } = node; + if (body.type === AST_NODE_TYPES.TSAsExpression) { + const { typeAnnotation } = body; + if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) { + const { typeName } = typeAnnotation; + if ( + typeName.type === AST_NODE_TYPES.Identifier && + typeName.name === 'const' + ) { + return true; + } + } + } + + return false; + } + /** * Checks if a function declaration/expression has a return type. */ @@ -263,6 +292,15 @@ export default util.createRule({ } } + // https://github.com/typescript-eslint/typescript-eslint/issues/653 + if ( + node.type === AST_NODE_TYPES.ArrowFunctionExpression && + options.allowDirectConstAssertionInArrowFunctions && + returnsConstAssertionDirectly(node) + ) { + return; + } + checkFunctionReturnType(node); } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 32f23792591..942ed5ea2e8 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -308,6 +308,20 @@ foo({ }, ], }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => (({ type: "X", value }) as const); +const func = (value: number) => ({ type: "X", value } as const); +const func = (value: number) => (x as const); +const func = (value: number) => x as const; + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: true, + }, + ], + }, ], invalid: [ { @@ -749,5 +763,47 @@ foo({ }, ], }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => ({ type: "X", value } as any); +const func = (value: number) => ({ type: "X", value } as Action); + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: true, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 2, + column: 14, + }, + { + messageId: 'missingReturnType', + line: 3, + column: 14, + }, + ], + }, + { + filename: 'test.ts', + code: ` +const func = (value: number) => ({ type: "X", value } as const); + `, + options: [ + { + allowDirectConstAssertionInArrowFunctions: false, + }, + ], + errors: [ + { + messageId: 'missingReturnType', + line: 2, + column: 14, + }, + ], + }, ], }); From c68e033f423d1143330e8e21104d5de10185e9a8 Mon Sep 17 00:00:00 2001 From: Ankeet Maini Date: Mon, 19 Aug 2019 18:57:34 +0530 Subject: [PATCH 021/317] feat(eslint-plugin): [no-type-alias] support tuples (#775) --- .../eslint-plugin/docs/rules/no-type-alias.md | 76 +++++ .../eslint-plugin/src/rules/no-type-alias.ts | 145 +++++----- .../tests/rules/no-type-alias.test.ts | 261 ++++++++++++++++++ .../src/ts-estree/ts-estree.ts | 2 +- 4 files changed, 408 insertions(+), 76 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 63656dfada8..46230f3d329 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -86,6 +86,7 @@ or more of the following you may pass an object with the options set as follows: - `allowCallbacks` set to `"always"` will allow you to use type aliases with callbacks (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"`) ### allowAliases @@ -453,6 +454,81 @@ type Foo = { readonly [P in keyof T]: T[P] } & type Foo = { [P in keyof T]?: T[P] } & { [P in keyof U]?: U[P] }; ``` +### allowTupleTypes + +This applies to tuple types (`type Foo = [number]`). + +The setting accepts the following options: + +- `"always"` or `"never"` to active or deactivate the feature. +- `"in-unions"`, allows tuples in union statements, e.g. `type Foo = [string] | [string, string];` +- `"in-intersections"`, allows tuples in intersection statements, e.g. `type Foo = [string] & [string, string];` +- `"in-unions-and-intersections"`, allows tuples in union and/or intersection statements. + +Examples of **correct** code for the `{ "allowTupleTypes": "always" }` options: + +```ts +type Foo = [number]; + +type Foo = [number] | [number, number]; + +type Foo = [number] & [number, number]; + +type Foo = [number] | [number, number] & [string, string]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions" }` option: + +```ts +type Foo = [number]; + +type Foo = [number] & [number, number]; + +type Foo = [string] & [number]; +``` + +Examples of **correct** code for the `{ "allowTupleTypes": "in-unions" }` option: + +```ts +type Foo = [number] | [number, number]; + +type Foo = [string] | [number]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-intersections" }` option: + +```ts +type Foo = [number]; + +type Foo = [number] | [number, number]; + +type Foo = [string] | [number]; +``` + +Examples of **correct** code for the `{ "allowTupleTypes": "in-intersections" }` option: + +```ts +type Foo = [number] & [number, number]; + +type Foo = [string] & [number]; +``` + +Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions-and-intersections" }` option: + +```ts +type Foo = [number]; + +type Foo = [string]; +``` + +Examples of **correct** code for the `{ "allowLiterals": "in-unions-and-intersections" }` option: + +```ts +type Foo = [number] & [number, number]; + +type Foo = [string] | [number]; +``` + ## When Not To Use It When you can't express some shape with an interface or you need to use a union, tuple type, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 1648b89f0df..68d537cc09b 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -4,27 +4,27 @@ import { } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; +type Values = + | 'always' + | 'never' + | 'in-unions' + | 'in-intersections' + | 'in-unions-and-intersections'; +const enumValues: Values[] = [ + 'always', + 'never', + 'in-unions', + 'in-intersections', + 'in-unions-and-intersections', +]; + type Options = [ { - allowAliases?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; + allowAliases?: Values; allowCallbacks?: 'always' | 'never'; - allowLiterals?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; - allowMappedTypes?: - | 'always' - | 'never' - | 'in-unions' - | 'in-intersections' - | 'in-unions-and-intersections'; + allowLiterals?: Values; + allowMappedTypes?: Values; + allowTupleTypes?: Values; }, ]; type MessageIds = 'noTypeAlias' | 'noCompositionAlias'; @@ -57,34 +57,19 @@ export default util.createRule({ type: 'object', properties: { allowAliases: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, }, allowCallbacks: { enum: ['always', 'never'], }, allowLiterals: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, }, allowMappedTypes: { - enum: [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', - ], + enum: enumValues, + }, + allowTupleTypes: { + enum: enumValues, }, }, additionalProperties: false, @@ -97,11 +82,20 @@ export default util.createRule({ allowCallbacks: 'never', allowLiterals: 'never', allowMappedTypes: 'never', + allowTupleTypes: 'never', }, ], create( context, - [{ allowAliases, allowCallbacks, allowLiterals, allowMappedTypes }], + [ + { + allowAliases, + allowCallbacks, + allowLiterals, + allowMappedTypes, + allowTupleTypes, + }, + ], ) { const unions = ['always', 'in-unions', 'in-unions-and-intersections']; const intersections = [ @@ -180,6 +174,36 @@ export default util.createRule({ }); } + const isValidTupleType = (type: TypeWithLabel) => { + if (type.node.type === AST_NODE_TYPES.TSTupleType) { + return true; + } + if (type.node.type === AST_NODE_TYPES.TSTypeOperator) { + if ( + ['keyof', 'readonly'].includes(type.node.operator) && + type.node.typeAnnotation && + type.node.typeAnnotation.type === AST_NODE_TYPES.TSTupleType + ) { + return true; + } + } + return false; + }; + + const checkAndReport = ( + optionValue: Values, + isTopLevel: boolean, + type: TypeWithLabel, + label: string, + ) => { + if ( + optionValue === 'never' || + !isSupportedComposition(isTopLevel, type.compositionType, optionValue) + ) { + reportError(type.node, type.compositionType, isTopLevel, label); + } + }; + /** * Validates the node looking for aliases, callbacks and literals. * @param node the node to be validated. @@ -198,48 +222,19 @@ export default util.createRule({ } } else if (type.node.type === AST_NODE_TYPES.TSTypeLiteral) { // literal object type - if ( - allowLiterals === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowLiterals!, - ) - ) { - reportError(type.node, type.compositionType, isTopLevel, 'Literals'); - } + checkAndReport(allowLiterals!, isTopLevel, type, 'Literals'); } else if (type.node.type === AST_NODE_TYPES.TSMappedType) { // mapped type - if ( - allowMappedTypes === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowMappedTypes!, - ) - ) { - reportError( - type.node, - type.compositionType, - isTopLevel, - 'Mapped types', - ); - } + checkAndReport(allowMappedTypes!, isTopLevel, type, 'Mapped types'); + } else if (isValidTupleType(type)) { + // tuple types + checkAndReport(allowTupleTypes!, isTopLevel, type, 'Tuple Types'); } else if ( type.node.type.endsWith('Keyword') || aliasTypes.has(type.node.type) ) { // alias / keyword - if ( - allowAliases === 'never' || - !isSupportedComposition( - isTopLevel, - type.compositionType, - allowAliases!, - ) - ) { - reportError(type.node, type.compositionType, isTopLevel, 'Aliases'); - } + checkAndReport(allowAliases!, isTopLevel, type, 'Aliases'); } else { // unhandled type - shouldn't happen reportError(type.node, type.compositionType, isTopLevel, 'Unhandled'); 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 3c3d83520e8..d17348af746 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -376,6 +376,69 @@ type Foo = { code: 'type Foo = typeof bar | typeof baz;', options: [{ allowAliases: 'in-unions' }], }, + { + code: 'type Foo = keyof [string]', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, + { + code: 'type Foo = readonly [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = readonly [string] | readonly [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = readonly [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & readonly [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | readonly [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, + { + code: 'type Foo = keyof [string] | [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = keyof [string] | keyof [number, number];', + options: [{ allowTupleTypes: 'always' }], + }, + { + code: 'type Foo = keyof [string] | [number, number];', + options: [{ allowTupleTypes: 'in-unions' }], + }, + { + code: 'type Foo = [string] & keyof [number, number];', + options: [{ allowTupleTypes: 'in-intersections' }], + }, + { + code: + 'type Foo = [string] & [number, number] | keyof [number, number, number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + }, ], invalid: [ { @@ -2915,5 +2978,203 @@ type Foo = { }, ], }, + { + code: 'type Foo = [number] | [number, number]', + options: [{ allowTupleTypes: 'never' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number] & [number, number]', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number] | [number, number]', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = [number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = readonly [number] | keyof [number, number]', + options: [{ allowTupleTypes: 'never' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 32, + }, + ], + }, + { + code: 'type Foo = keyof [number] & [number, number]', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'intersection', + typeName: 'Tuple Types', + }, + line: 1, + column: 29, + }, + ], + }, + { + code: 'type Foo = [number] | readonly [number, number]', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 12, + }, + { + messageId: 'noCompositionAlias', + data: { + compositionType: 'union', + typeName: 'Tuple Types', + }, + line: 1, + column: 23, + }, + ], + }, + { + code: 'type Foo = readonly [number];', + options: [{ allowTupleTypes: 'in-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = keyof [number];', + options: [{ allowTupleTypes: 'in-unions' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, + { + code: 'type Foo = readonly [number];', + options: [{ allowTupleTypes: 'in-unions-and-intersections' }], + errors: [ + { + messageId: 'noTypeAlias', + }, + ], + }, ], }); diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 7276f8d93e3..51529a470cb 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -1324,7 +1324,7 @@ export interface TSTypeLiteral extends BaseNode { export interface TSTypeOperator extends BaseNode { type: AST_NODE_TYPES.TSTypeOperator; operator: 'keyof' | 'unique' | 'readonly'; - typeAnnotation?: TSTypeAnnotation; + typeAnnotation?: TypeNode; } export interface TSTypeParameter extends BaseNode { From 8f3b0a8e48abaffe5707d401e37ae5d2b616d1b9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 08:56:01 -0700 Subject: [PATCH 022/317] fix(typescript-estree): improve missing project file error msg (#866) Fixes #853 --- .../no-unnecessary-type-assertion.test.ts | 6 -- .../rules/restrict-plus-operands.test.ts | 16 ++--- packages/parser/README.md | 29 +++++---- packages/typescript-estree/jest.config.js | 8 +++ packages/typescript-estree/src/convert.ts | 2 +- packages/typescript-estree/src/parser.ts | 39 +++++++++++- .../typescript-estree/src/tsconfig-parser.ts | 5 +- .../fixtures/invalidFileErrors/js/included.js | 1 + .../invalidFileErrors/js/included.jsx | 1 + .../invalidFileErrors/js/notIncluded.js | 1 + .../invalidFileErrors/js/notIncluded.jsx | 1 + .../invalidFileErrors/other/included.vue | 1 + .../invalidFileErrors/other/notIncluded.vue | 1 + .../other/unknownFileType.unknown | 1 + .../fixtures/invalidFileErrors/ts/included.ts | 1 + .../invalidFileErrors/ts/included.tsx | 1 + .../invalidFileErrors/ts/notIncluded.ts | 1 + .../invalidFileErrors/ts/notIncluded.tsx | 1 + .../fixtures/invalidFileErrors/tsconfig.json | 9 +++ .../tests/lib/__snapshots__/parse.ts.snap | 36 +++++++++++ packages/typescript-estree/tests/lib/parse.ts | 60 ++++++++++++++++++- .../tests/lib/semanticInfo.ts | 4 +- packages/typescript-estree/tsconfig.json | 3 +- 23 files changed, 190 insertions(+), 38 deletions(-) create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx create mode 100644 packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts index 4c06e95a042..4b4e496253f 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -99,12 +99,6 @@ foo(str!); ` declare function a(a: string): any; declare const b: string | null; -class Mx { - @a(b!) - private prop = 1; -} - `, - ` class Mx { @a(b!) private prop = 1; diff --git a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts index fdda8fe0ef4..44583a202a1 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -26,37 +26,37 @@ ruleTester.run('restrict-plus-operands', rule, { `var foo = BigInt(1) + 1n`, `var foo = 1n; foo + 2n`, ` -function test () : number { return 2; } +function test(s: string, n: number) : number { return 2; } var foo = test("5.5", 10) + 10; - `, + `, ` var x = 5; var z = 8.2; var foo = x + z; - `, + `, ` var w = "6.5"; var y = "10"; var foo = y + w; - `, + `, 'var foo = 1 + 1;', "var foo = '1' + '1';", ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = pair.first + 10; - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = pair.first + (10 as number); - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = "5.5" + pair.second; - `, + `, ` var pair: { first: number, second: string } = { first: 5, second: "10" }; var foo = ("5.5" as string) + pair.second; - `, + `, `const foo = 'hello' + (someBoolean ? 'a' : 'b') + (() => someBoolean ? 'c' : 'd')() + 'e';`, `const balls = true;`, `balls === true;`, diff --git a/packages/parser/README.md b/packages/parser/README.md index cbabebd95f8..718e2c82ba5 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -52,25 +52,30 @@ The following additional configuration options are available by specifying them - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```ts - { - "extends": "./tsconfig.json", // path to existing tsconfig - "include": [ - "src/**/*.ts", - "test/**/*.ts", - // etc - ] - } - ``` + ```ts + { + // extend your base config so you don't have to redefine your compilerOptions + "extends": "./tsconfig.json", + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "typings/**/*.ts", + // etc + + // if you have a mixed JS/TS codebase, don't forget to include your JS files + "src/**/*.js" + ] + } + ``` - **`tsconfigRootDir`** - default `undefined`. This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. -- **`createDefaultProgram`** - default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. However, this may incur significant performance costs, so this option is primarily included for backwards-compatibility. See the **`project`** section for more information. - - **`extraFileExtensions`** - default `undefined`. This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. E.g. a `.vue` file - **`warnOnUnsupportedTypeScriptVersion`** - default `true`. This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported +- **`createDefaultProgram`** - default `false`. This option allows you to request that when the `project` setting is specified, files will be allowed when not included in the projects defined by the provided `tsconfig.json` files. **Using this option will incur significant performance costs. This option is primarily included for backwards-compatibility.** See the **`project`** section above for more information. + ### .eslintrc.json ```json diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 4005947d277..e01f6ed0775 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -10,4 +10,12 @@ module.exports = { collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], coverageReporters: ['text-summary', 'lcov'], + globals: { + 'ts-jest': { + diagnostics: { + // ignore the diagnostic error for the invalidFileErrors fixtures + ignoreCodes: [5056], + }, + }, + }, }; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 3a7d2de99dc..43ab7889c6b 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -67,7 +67,7 @@ export class Converter { */ constructor(ast: ts.SourceFile, options: ConverterOptions) { this.ast = ast; - this.options = options; + this.options = { ...options }; } getASTMaps(): ASTMaps { diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index f215fa44492..1b89136928a 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,3 +1,4 @@ +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 { astConverter } from './ast-converter'; @@ -9,6 +10,7 @@ import { TSESTree } from './ts-estree'; import { calculateProjectParserOptions, createProgram, + defaultCompilerOptions, } from './tsconfig-parser'; /** @@ -87,9 +89,39 @@ function getASTFromProject( ); if (!astAndProgram && !createDefaultProgram) { - throw new Error( - `If "parserOptions.project" has been set for @typescript-eslint/parser, ${filePath} must be included in at least one of the projects provided.`, - ); + // 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; @@ -158,6 +190,7 @@ function createNewProgram(code: string): ASTAndProgram { noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined, + ...defaultCompilerOptions, }, compilerHost, ); diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 88c63171545..affbe090627 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -9,9 +9,10 @@ import { Extra } from './parser-options'; /** * Default compiler options for program generation from single root file */ -const defaultCompilerOptions: ts.CompilerOptions = { +export const defaultCompilerOptions: ts.CompilerOptions = { allowNonTsExtensions: true, allowJs: true, + checkJs: true, }; /** @@ -109,7 +110,7 @@ export function calculateProjectParserOptions( // create compiler host const watchCompilerHost = ts.createWatchCompilerHost( tsconfigPath, - /*optionsToExtend*/ { allowNonTsExtensions: true } as ts.CompilerOptions, + defaultCompilerOptions, ts.sys, ts.createSemanticDiagnosticsBuilderProgram, diagnosticReporter, diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.js @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/included.jsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.js @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/js/notIncluded.jsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/included.vue @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/notIncluded.vue @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/other/unknownFileType.unknown @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.ts @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/included.tsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.ts @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx new file mode 100644 index 00000000000..25005f98f8f --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/ts/notIncluded.tsx @@ -0,0 +1 @@ +export var a = true; diff --git a/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json new file mode 100644 index 00000000000..de5d69d736c --- /dev/null +++ b/packages/typescript-estree/tests/fixtures/invalidFileErrors/tsconfig.json @@ -0,0 +1,9 @@ +{ + "include": [ + "ts/included.ts", + "ts/included.tsx", + "js/included.js", + "js/included.jsx", + "other/included.vue" + ] +} diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap index 38e378d9f7e..bca89ec8d8c 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.ts.snap @@ -189,6 +189,42 @@ Object { } `; +exports[`parse() invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension does not match 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/other/unknownFileType.unknown. +The extension for the file (.unknown) is non-standard. It should be added to your existing \\"parserOptions.extraFileExtensions\\"." +`; + +exports[`parse() invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches the file isn't included 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/other/notIncluded.vue. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 1`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/ts/notIncluded.ts. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 2`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/ts/notIncluded.tsx. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 3`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/js/notIncluded.js. +The file must be included in at least one of the projects provided." +`; + +exports[`parse() invalid file error messages project includes errors for not included files 4`] = ` +"\\"parserOptions.project\\" has been set for @typescript-eslint/parser. +The file does not match your project config: tests/fixtures/invalidFileErrors/js/notIncluded.jsx. +The file must be included in at least one of the projects provided." +`; + 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 57a4bc05742..6ed8db76cbc 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -1,8 +1,8 @@ +import { join, resolve, relative } from 'path'; import * as parser from '../../src/parser'; import * as astConverter from '../../src/ast-converter'; import { TSESTreeOptions } from '../../src/parser-options'; import { createSnapshotTestBlock } from '../../tools/test-utils'; -import { join } from 'path'; const FIXTURES_DIR = './tests/fixtures/simpleProject'; @@ -145,7 +145,7 @@ describe('parse()', () => { }; const projectConfig: TSESTreeOptions = { ...baseConfig, - tsconfigRootDir: join(process.cwd(), FIXTURES_DIR), + tsconfigRootDir: FIXTURES_DIR, project: './tsconfig.json', }; @@ -241,4 +241,60 @@ describe('parse()', () => { ).toBeUndefined(); }); }); + + describe('invalid file error messages', () => { + const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: './tsconfig.json', + extraFileExtensions: ['.vue'], + }; + const testParse = (filePath: string) => (): void => { + parser.parseAndGenerateServices(code, { + ...config, + filePath: relative(process.cwd(), join(PROJECT_DIR, filePath)), + }); + }; + + describe('project includes', () => { + it("doesn't error for matched files", () => { + expect(testParse('ts/included.ts')).not.toThrow(); + expect(testParse('ts/included.tsx')).not.toThrow(); + expect(testParse('js/included.js')).not.toThrow(); + expect(testParse('js/included.jsx')).not.toThrow(); + }); + + it('errors for not included files', () => { + expect(testParse('ts/notIncluded.ts')).toThrowErrorMatchingSnapshot(); + expect(testParse('ts/notIncluded.tsx')).toThrowErrorMatchingSnapshot(); + expect(testParse('js/notIncluded.js')).toThrowErrorMatchingSnapshot(); + expect(testParse('js/notIncluded.jsx')).toThrowErrorMatchingSnapshot(); + }); + }); + + describe('"parserOptions.extraFileExtensions" is non-empty', () => { + describe('the extension matches', () => { + it('the file is included', () => { + expect(testParse('other/included.vue')).not.toThrow(); + }); + + it("the file isn't included", () => { + expect( + testParse('other/notIncluded.vue'), + ).toThrowErrorMatchingSnapshot(); + }); + }); + + it('the extension does not match', () => { + expect( + testParse('other/unknownFileType.unknown'), + ).toThrowErrorMatchingSnapshot(); + }); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.ts b/packages/typescript-estree/tests/lib/semanticInfo.ts index 1afab0c5e44..157edec7412 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.ts @@ -236,9 +236,7 @@ describe('semanticInfo', () => { `function M() { return Base }`, createOptions(''), ), - ).toThrow( - `If "parserOptions.project" has been set for @typescript-eslint/parser, must be included in at least one of the projects provided.`, - ); + ).toThrow(/The file does not match your project config: /); }); it('non-existent project file', () => { diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index e389d7edef3..2ea9199d263 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -3,5 +3,6 @@ "compilerOptions": { "outDir": "./dist" }, - "include": ["src", "tests", "tools"] + "include": ["src", "tests", "tools"], + "exclude": ["tests/fixtures/**/*"] } From 9e5f21e65afee3b6f4384f6cf1e45ff4d8e720a8 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+Teoxoy@users.noreply.github.com> Date: Mon, 19 Aug 2019 18:11:18 +0200 Subject: [PATCH 023/317] feat(typescript-estree): Accept a glob pattern for `options.project` (#806) --- packages/parser/README.md | 18 +++++++++++++++++- packages/typescript-estree/package.json | 3 +++ packages/typescript-estree/src/parser.ts | 11 +++++++++++ .../typescript-estree/src/tsconfig-parser.ts | 4 ++-- yarn.lock | 7 ++++++- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index 718e2c82ba5..c0e0187b314 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -50,9 +50,25 @@ The following additional configuration options are available by specifying them - **`project`** - default `undefined`. This option allows you to provide a path to your project's `tsconfig.json`. **This setting is required if you want to use rules which require type information**. You may want to use this setting in tandem with the `tsconfigRootDir` option below. + - Accepted values: + + ```js + // path + project: './tsconfig.json'; + + // glob pattern + project: './packages/**/tsconfig.json'; + + // array of paths and/or glob patterns + project: [ + './packages/**/tsconfig.json', + './separate-package/tsconfig.json', + ]; + ``` + - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```ts + ```js { // extend your base config so you don't have to redefine your compilerOptions "extends": "./tsconfig.json", diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d7c8bae66ef..9400fb5def3 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -41,6 +41,8 @@ "unit-tests": "jest \"./tests/lib/.*\"" }, "dependencies": { + "glob": "^7.1.4", + "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", "semver": "^6.2.0" }, @@ -50,6 +52,7 @@ "@babel/types": "^7.3.2", "@types/babel-code-frame": "^6.20.1", "@types/glob": "^7.1.1", + "@types/is-glob": "^4.0.1", "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 1b89136928a..df8df03f0c2 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -1,6 +1,8 @@ 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'; @@ -285,6 +287,15 @@ function applyParserOptionsToExtra(options: TSESTreeOptions): void { extra.projects = options.project; } + // Transform glob patterns into paths + if (extra.projects) { + extra.projects = extra.projects.reduce( + (projects, project) => + projects.concat(isGlob(project) ? globSync(project) : project), + [], + ); + } + if (typeof options.tsconfigRootDir === 'string') { extra.tsconfigRootDir = options.tsconfigRootDir; } diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index affbe090627..364dd0543c8 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -72,7 +72,7 @@ function getTsconfigPath(tsconfigPath: string, extra: Extra): string { * @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.project Provided tsconfig paths + * @param extra.projects Provided tsconfig paths * @returns The programs corresponding to the supplied tsconfig paths */ export function calculateProjectParserOptions( @@ -207,7 +207,7 @@ export function calculateProjectParserOptions( * @param code The code being linted * @param filePath The file being linted * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.project Provided tsconfig paths + * @param extra.projects Provided tsconfig paths * @returns The program containing just the file being linted and associated library files */ export function createProgram( diff --git a/yarn.lock b/yarn.lock index c86527946ff..559279edf28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1345,6 +1345,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/is-glob@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.1.tgz#a93eec1714172c8eb3225a1cc5eb88c2477b7d00" + integrity sha512-k3RS5HyBPu4h+5hTmIEfPB2rl5P3LnGdQEZrV2b9OWTJVtsUQ2VBcedqYKGqxvZqle5UALUXdSfVA8nf3HfyWQ== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -4706,7 +4711,7 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0: +is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== From 4a29098c5b2484c144f48594d6a62ec342a5cf30 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 19 Aug 2019 17:21:15 -0700 Subject: [PATCH 024/317] docs(parser): clarify project references (#884) Closes #856 --- packages/parser/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/parser/README.md b/packages/parser/README.md index c0e0187b314..042fb4f5f54 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -66,9 +66,11 @@ The following additional configuration options are available by specifying them ]; ``` + - Note that if you use project references, TypeScript will not automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the `project` field either separately, or via a glob. + - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: - ```js + ```jsonc { // extend your base config so you don't have to redefine your compilerOptions "extends": "./tsconfig.json", From c1c94601a1ab578b2521e3c4fba12650d02a700b Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 21 Aug 2019 01:15:24 +0900 Subject: [PATCH 025/317] docs(eslint-plugin): [explicit-member-accessibility] example (#887) --- .../docs/rules/explicit-member-accessibility.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 3ed9bb7e5d0..9f8c313d3df 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -79,7 +79,7 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, animalName) { + public constructor(public breed, name) { // Parameter property and constructor this.animalName = name; } @@ -102,7 +102,7 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, animalName) { + public constructor(public breed, name) { // Parameter property and constructor this.animalName = name; } @@ -125,7 +125,7 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, animalName) { + constructor(protected breed, name) { // Parameter property and constructor this.name = name; } From 2a710233e7b00c811c91f866f5d4a1c258bac250 Mon Sep 17 00:00:00 2001 From: Niles Date: Wed, 21 Aug 2019 10:42:58 -0500 Subject: [PATCH 026/317] docs(eslint-plugin): correct typo (#891) --- packages/eslint-plugin/src/configs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/configs/README.md b/packages/eslint-plugin/src/configs/README.md index 3ba76f661e6..95accb69490 100644 --- a/packages/eslint-plugin/src/configs/README.md +++ b/packages/eslint-plugin/src/configs/README.md @@ -52,4 +52,4 @@ If you disagree with a rule (or it disagrees with your codebase), consider using ### Suggesting changes to the recommended set -If you feel _very_, **very**, **_very_** strongly that a specific rule should (or should not) be in the recommended ruleset, please feel free to file an issue along with a **detailed** argument explaning your reasoning. We expect to see you citing concrete evidence supporting why (or why not) a rule is considered best practice. **Please note that if your reasoning is along the lines of "it's what my project/company does", or "I don't like the rule", then we will likely close the request without discussion.** +If you feel _very_, **very**, **_very_** strongly that a specific rule should (or should not) be in the recommended ruleset, please feel free to file an issue along with a **detailed** argument explaining your reasoning. We expect to see you citing concrete evidence supporting why (or why not) a rule is considered best practice. **Please note that if your reasoning is along the lines of "it's what my project/company does", or "I don't like the rule", then we will likely close the request without discussion.** From 6a30de2e00828563d2ddedf5d931f30d07f1a682 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 21 Aug 2019 09:11:41 -0700 Subject: [PATCH 027/317] docs: update contributors list --- .all-contributorsrc | 106 +++++++++++++++++++++++++++------ .prettierignore | 2 + CONTRIBUTORS.md | 56 ++++++++++++++++- package.json | 2 +- tools/generate-contributors.ts | 2 +- yarn.lock | 8 +-- 6 files changed, 149 insertions(+), 27 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index b6b3e43aa31..f44ccc64c55 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -23,13 +23,6 @@ "profile": "https://github.com/armano2", "contributions": [] }, - { - "login": "soda0289", - "name": "Reyad Attiyat", - "avatar_url": "https://avatars1.githubusercontent.com/u/2373964?v=4", - "profile": "https://github.com/soda0289", - "contributions": [] - }, { "login": "bradzacher", "name": "Brad Zacher", @@ -37,6 +30,13 @@ "profile": "https://github.com/bradzacher", "contributions": [] }, + { + "login": "soda0289", + "name": "Reyad Attiyat", + "avatar_url": "https://avatars1.githubusercontent.com/u/2373964?v=4", + "profile": "https://github.com/soda0289", + "contributions": [] + }, { "login": "weirdpattern", "name": "Patricio Trevino", @@ -60,7 +60,7 @@ }, { "login": "uniqueiniquity", - "name": "Benjamin Lichtman", + "name": "Ben Lichtman", "avatar_url": "https://avatars1.githubusercontent.com/u/9092011?v=4", "profile": "https://github.com/uniqueiniquity", "contributions": [] @@ -79,6 +79,20 @@ "profile": "https://github.com/Pajn", "contributions": [] }, + { + "login": "mysticatea", + "name": "Toru Nagashima", + "avatar_url": "https://avatars2.githubusercontent.com/u/1937871?v=4", + "profile": "https://github.com/mysticatea", + "contributions": [] + }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars1.githubusercontent.com/u/3335181?v=4", + "profile": "https://github.com/JoshuaKGoldberg", + "contributions": [] + }, { "login": "azz", "name": "Lucas Azzola", @@ -101,10 +115,10 @@ "contributions": [] }, { - "login": "mysticatea", - "name": "Toru Nagashima", - "avatar_url": "https://avatars2.githubusercontent.com/u/1937871?v=4", - "profile": "https://github.com/mysticatea", + "login": "scottohara", + "name": "Scott O'Hara", + "avatar_url": "https://avatars3.githubusercontent.com/u/289327?v=4", + "profile": "https://github.com/scottohara", "contributions": [] }, { @@ -121,6 +135,27 @@ "profile": "https://github.com/lukyth", "contributions": [] }, + { + "login": "ldrick", + "name": "Ricky Lippmann", + "avatar_url": "https://avatars3.githubusercontent.com/u/3674067?v=4", + "profile": "https://github.com/ldrick", + "contributions": [] + }, + { + "login": "SimenB", + "name": "Simen Bekkhus", + "avatar_url": "https://avatars1.githubusercontent.com/u/1404810?v=4", + "profile": "https://github.com/SimenB", + "contributions": [] + }, + { + "login": "gavinbarron", + "name": "Gavin Barron", + "avatar_url": "https://avatars2.githubusercontent.com/u/7122716?v=4", + "profile": "https://github.com/gavinbarron", + "contributions": [] + }, { "login": "platinumazure", "name": "Kevin Partington", @@ -128,18 +163,39 @@ "profile": "https://github.com/platinumazure", "contributions": [] }, + { + "login": "duailibe", + "name": "Lucas Duailibe", + "avatar_url": "https://avatars3.githubusercontent.com/u/1574588?v=4", + "profile": "https://github.com/duailibe", + "contributions": [] + }, + { + "login": "octogonz", + "name": "Pete Gonzalez", + "avatar_url": "https://avatars0.githubusercontent.com/u/4673363?v=4", + "profile": "https://github.com/octogonz", + "contributions": [] + }, { "login": "mightyiam", - "name": "Shahar Or", + "name": "Shahar Dawn Or", "avatar_url": "https://avatars2.githubusercontent.com/u/635591?v=4", "profile": "https://github.com/mightyiam", "contributions": [] }, { - "login": "invalid-email-address", - "name": "Check your git settings!", - "avatar_url": "https://avatars0.githubusercontent.com/u/148100?v=4", - "profile": "https://github.com/invalid-email-address", + "login": "a-tarasyuk", + "name": "Alexander T.", + "avatar_url": "https://avatars0.githubusercontent.com/u/509265?v=4", + "profile": "https://github.com/a-tarasyuk", + "contributions": [] + }, + { + "login": "webschik", + "name": "Denys Kniazevych", + "avatar_url": "https://avatars2.githubusercontent.com/u/1665314?v=4", + "profile": "https://github.com/webschik", "contributions": [] }, { @@ -155,7 +211,21 @@ "avatar_url": "https://avatars1.githubusercontent.com/u/17216317?v=4", "profile": "https://github.com/g-plane", "contributions": [] + }, + { + "login": "ThomasdenH", + "name": "Thomas den Hollander", + "avatar_url": "https://avatars0.githubusercontent.com/u/3889750?v=4", + "profile": "https://github.com/ThomasdenH", + "contributions": [] + }, + { + "login": "madbence", + "name": "Bence Dányi", + "avatar_url": "https://avatars2.githubusercontent.com/u/296735?v=4", + "profile": "https://github.com/madbence", + "contributions": [] } ], - "contributorsPerLine": 7 + "contributorsPerLine": 5 } \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index a86a2f04fc9..aed86e816d4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,6 +9,8 @@ packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js .github packages/eslint-plugin/src/configs/*.json +.all-contributorsrc +CONTRIBUTORS.md # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d0f6e0b84d6..d458acc3c54 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -3,8 +3,58 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)): - -
James Henry
James Henry

Armano
Armano

Reyad Attiyat
Reyad Attiyat

Brad Zacher
Brad Zacher

Patricio Trevino
Patricio Trevino

Nicholas C. Zakas
Nicholas C. Zakas

Jed Fox
Jed Fox

Benjamin Lichtman
Benjamin Lichtman

Kai Cataldo
Kai Cataldo

Rasmus Eneman
Rasmus Eneman

Lucas Azzola
Lucas Azzola

Danny Fritz
Danny Fritz

Ika
Ika

Toru Nagashima
Toru Nagashima

mackie
mackie

Kanitkorn Sujautra
Kanitkorn Sujautra

Kevin Partington
Kevin Partington

Shahar Or
Shahar Or

Check your git settings!
Check your git settings!

Philipp A.
Philipp A.

Pig Fang
Pig Fang

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
James Henry
James Henry

Armano
Armano

Brad Zacher
Brad Zacher

Reyad Attiyat
Reyad Attiyat

Patricio Trevino
Patricio Trevino

Nicholas C. Zakas
Nicholas C. Zakas

Jed Fox
Jed Fox

Ben Lichtman
Ben Lichtman

Kai Cataldo
Kai Cataldo

Rasmus Eneman
Rasmus Eneman

Toru Nagashima
Toru Nagashima

Josh Goldberg
Josh Goldberg

Lucas Azzola
Lucas Azzola

Danny Fritz
Danny Fritz

Ika
Ika

Scott O'Hara
Scott O'Hara

mackie
mackie

Kanitkorn Sujautra
Kanitkorn Sujautra

Ricky Lippmann
Ricky Lippmann

Simen Bekkhus
Simen Bekkhus

Gavin Barron
Gavin Barron

Kevin Partington
Kevin Partington

Lucas Duailibe
Lucas Duailibe

Pete Gonzalez
Pete Gonzalez

Shahar Dawn Or
Shahar Dawn Or

Alexander T.
Alexander T.

Denys Kniazevych
Denys Kniazevych

Philipp A.
Philipp A.

Pig Fang
Pig Fang

Thomas den Hollander
Thomas den Hollander

Bence Dányi
Bence Dányi

+ + + -This list is auto-generated using `yarn generate-contributors`. +This list is auto-generated using `yarn generate-contributors`. It shows the top 100 contributors with > 3 contributions. diff --git a/package.json b/package.json index d0c730ff1b4..da363951d70 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@commitlint/travis-cli": "^8.1.0", "@types/jest": "^24.0.15", "@types/node": "^12.6.8", - "all-contributors-cli": "^6.8.0", + "all-contributors-cli": "^6.8.1", "cz-conventional-changelog": "2.1.0", "eslint": "^6.0.0", "eslint-plugin-eslint-comments": "^3.1.2", diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 11b23765615..86de0772395 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -99,7 +99,7 @@ async function main(): Promise { imageSize: 100, commit: false, contributors, - contributorsPerLine: 7, + contributorsPerLine: 5, }; const rcPath = path.resolve(__dirname, '../.all-contributorsrc'); fs.writeFileSync(rcPath, JSON.stringify(allContributorsConfig, null, 2)); diff --git a/yarn.lock b/yarn.lock index 559279edf28..7fef7edc509 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1706,10 +1706,10 @@ ajv@^6.10.0, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -all-contributors-cli@^6.8.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.8.0.tgz#1b98e9ee60ca3724ef50fb7469b8e85de1ebdec9" - integrity sha512-7xYAmljxgGL4w0XTRBuGTJMqf/xTGhvPyRbIp2InKfn0INo08faCT6gP18iyYMpVPotgAUcaGTeLrewh2IP54Q== +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== dependencies: "@babel/runtime" "^7.2.0" async "^3.0.1" From 29fddfd149599c241d011fb9e1eb2bc830098d4e Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Thu, 22 Aug 2019 02:48:44 +1000 Subject: [PATCH 028/317] fix(eslint-plugin): [require-await] Allow concise arrow function bodies (#826) --- .../eslint-plugin/src/rules/require-await.ts | 26 ++++++++++-- .../tests/rules/require-await.test.ts | 42 ++++++++++++++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 7441b464896..065066dece2 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -64,6 +64,15 @@ export default util.createRule({ case AST_NODE_TYPES.ArrowFunctionExpression: rules.ArrowFunctionExpression(node); + + // If body type is not BlockStatment, we need to check the return type here + if (node.body.type !== AST_NODE_TYPES.BlockStatement) { + const expression = parserServices.esTreeNodeToTSNodeMap.get( + node.body, + ); + scopeInfo.returnsPromise = isThenableType(expression); + } + break; } } @@ -102,6 +111,18 @@ export default util.createRule({ } } + /** + * Checks if the node returns a thenable type + * + * @param {ASTNode} node - The node to check + * @returns {boolean} + */ + function isThenableType(node: ts.Node) { + const type = checker.getTypeAtLocation(node); + + return tsutils.isThenableType(checker, node, type); + } + return { 'FunctionDeclaration[async = true]': enterFunction, 'FunctionExpression[async = true]': enterFunction, @@ -122,10 +143,7 @@ export default util.createRule({ return; } - const type = checker.getTypeAtLocation(expression); - if (tsutils.isThenableType(checker, expression, type)) { - scopeInfo.returnsPromise = true; - } + scopeInfo.returnsPromise = isThenableType(expression); }, AwaitExpression: rules.AwaitExpression as TSESLint.RuleFunction< diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 3ea207713b2..38a925de1d2 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -41,9 +41,15 @@ ruleTester.run('require-await', rule, { }`, }, { - // Non-async arrow function expression + // Non-async arrow function expression (concise-body) code: `const numberOne = (): number => 1;`, }, + { + // Non-async arrow function expression (block-body) + code: `const numberOne = (): number => { + return 1; + };`, + }, { // Async function declaration with await code: `async function numberOne(): Promise { @@ -57,9 +63,15 @@ ruleTester.run('require-await', rule, { }`, }, { - // Async arrow function expression with await + // Async arrow function expression with await (concise-body) code: `const numberOne = async (): Promise => await 1;`, }, + { + // Async arrow function expression with await (block-body) + code: `const numberOne = async (): Promise => { + return await 1; + };`, + }, { // Async function declaration with promise return code: `async function numberOne(): Promise { @@ -72,6 +84,16 @@ ruleTester.run('require-await', rule, { return Promise.resolve(1); }`, }, + { + // Async arrow function with promise return (concise-body) + code: `const numberOne = async (): Promise => Promise.resolve(1);`, + }, + { + // Async arrow function with promise return (block-body) + code: `const numberOne = async (): Promise => { + return Promise.resolve(1); + };`, + }, { // Async function declaration with async function return code: `async function numberOne(): Promise { @@ -90,6 +112,22 @@ ruleTester.run('require-await', rule, { return Promise.resolve(x); }`, }, + { + // Async arrow function with async function return (concise-body) + code: `const numberOne = async (): Promise => getAsyncNumber(1); + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + }, + { + // Async arrow function with async function return (block-body) + code: `const numberOne = async (): Promise => { + return getAsyncNumber(1); + }; + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + }, ], invalid: [ From 92e2b31c77bae0c8c541ef2ae5032e1f0a37aae9 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 23 Aug 2019 12:41:28 +1200 Subject: [PATCH 029/317] chore(parser): add `types` field to `package.json` (#893) --- packages/parser/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/parser/package.json b/packages/parser/package.json index 4d67b9a555e..bda37838c79 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -3,6 +3,7 @@ "version": "2.0.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", + "types": "dist/parser.d.ts", "files": [ "dist", "README.md", From cddfdca913b1baa958151e237eac947eaea8f31b Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Sat, 24 Aug 2019 01:30:51 +1000 Subject: [PATCH 030/317] fix(eslint-plugin): [promise-function-async] Allow async get/set (#820) --- .../eslint-plugin/src/rules/promise-function-async.ts | 8 ++++++++ .../tests/rules/promise-function-async.test.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 225b2bd8367..8ec816b456b 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -103,6 +103,14 @@ export default util.createRule({ return; } + if ( + node.parent && + node.parent.type === 'Property' && + (node.parent.kind === 'get' || node.parent.kind === 'set') + ) { + return; + } + context.report({ messageId: 'missingAsync', node, 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 829bb9a091c..ed798ca18e2 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -63,6 +63,12 @@ const invalidAsyncModifiers = { }, set asyncGetter(p: Promise) { return p; + }, + get asyncGetterFunc() { + return async () => new Promise(); + }, + set asyncGetterFunc(p: () => Promise) { + return p; } } `, From 5ab13a8d651f02dbf60a41ff2d2ac646f632635b Mon Sep 17 00:00:00 2001 From: Ryan Wilson-Perkin Date: Sat, 24 Aug 2019 15:20:14 -0400 Subject: [PATCH 031/317] docs(eslint-plugin): no-var-requires: Add example for ES6 modules (#900) Fixes #899 Adds an example to the documentation for replacing `require` with ES6 modules. Since this isn't going to work on everyone's system, I'm happy to also add a comment on this line stating the restrictions if the maintainers of this think it would be appropriate. --- packages/eslint-plugin/docs/rules/no-var-requires.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-plugin/docs/rules/no-var-requires.md b/packages/eslint-plugin/docs/rules/no-var-requires.md index b5e57bdcbfe..fb8e7a54721 100644 --- a/packages/eslint-plugin/docs/rules/no-var-requires.md +++ b/packages/eslint-plugin/docs/rules/no-var-requires.md @@ -17,6 +17,7 @@ Examples of **correct** code for this rule: ```ts import foo = require('foo'); require('foo'); +import foo from 'foo'; ``` ## When Not To Use It From 16136f3ef8a58450e416967d4cb9d1ee0158eae8 Mon Sep 17 00:00:00 2001 From: Austin Gatlin Date: Tue, 27 Aug 2019 23:34:12 +0700 Subject: [PATCH 032/317] docs(eslint-plugin): correct typo in no-unused-vars (#910) --- packages/eslint-plugin/docs/rules/no-unused-vars.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-unused-vars.md b/packages/eslint-plugin/docs/rules/no-unused-vars.md index 9cb7a52fe65..f6091165b7c 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-vars.md +++ b/packages/eslint-plugin/docs/rules/no-unused-vars.md @@ -76,7 +76,7 @@ myFunc = setTimeout(function() { myFunc(); }, 50); -// Only the second argument from the descructured array is used. +// Only the second argument from the destructured array is used. function getY([, y]) { return y; } From 56034736fb3ce6b4d573996a78d408966f67649d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 27 Aug 2019 12:56:31 -0400 Subject: [PATCH 033/317] fix(eslint-plugin): [typedef] don't flag destructuring when variables is disabled (#819) --- packages/eslint-plugin/src/rules/typedef.ts | 51 +++++++++---------- .../eslint-plugin/tests/rules/typedef.test.ts | 18 +++++++ 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 182568e5748..3d9d76f3872 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -141,36 +141,35 @@ export default util.createRule<[Options], MessageIds>({ }, VariableDeclarator(node): void { if ( - options[OptionKeys.VariableDeclaration] && - !node.id.typeAnnotation + !options[OptionKeys.VariableDeclaration] || + node.id.typeAnnotation || + (node.id.type === AST_NODE_TYPES.ArrayPattern && + !options[OptionKeys.ArrayDestructuring]) || + (node.id.type === AST_NODE_TYPES.ObjectPattern && + !options[OptionKeys.ObjectDestructuring]) ) { - // Are we inside a context that does not allow type annotations? - let typeAnnotationRequired = true; - - let current: TSESTree.Node | undefined = node.parent; - while (current) { - switch (current.type) { - case AST_NODE_TYPES.VariableDeclaration: - // Keep looking upwards - current = current.parent; - break; - case AST_NODE_TYPES.ForOfStatement: - case AST_NODE_TYPES.ForInStatement: - // Stop traversing and don't report an error - typeAnnotationRequired = false; - current = undefined; - break; - default: - // Stop traversing - current = undefined; - break; - } - } + return; + } - if (typeAnnotationRequired) { - report(node, getNodeName(node.id)); + let current: TSESTree.Node | undefined = node.parent; + while (current) { + switch (current.type) { + case AST_NODE_TYPES.VariableDeclaration: + // Keep looking upwards + current = current.parent; + break; + case AST_NODE_TYPES.ForOfStatement: + case AST_NODE_TYPES.ForInStatement: + // Stop traversing and don't report an error + return; + default: + // Stop traversing + current = undefined; + break; } } + + report(node, getNodeName(node.id)); }, }; }, diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index b1a7b08bcf0..d5ea514f59e 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -198,6 +198,24 @@ ruleTester.run('typedef', rule, { }, ], }, + { + code: `const [a, b] = [1, 2];`, + options: [ + { + objectDestructuring: false, + variableDeclaration: true, + }, + ], + }, + { + code: `const { a, b } = { a: '', b: '' };`, + options: [ + { + objectDestructuring: false, + variableDeclaration: true, + }, + ], + }, // Contexts where TypeScript doesn't allow annotations { code: `for (x of [1, 2, 3]) { }`, From 344bafe5c7b17611f496de52f10c0ed556fe81c7 Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Wed, 28 Aug 2019 03:32:18 +1000 Subject: [PATCH 034/317] fix(eslint-plugin): [unbound-method] Allow typeof expressions (Fixes #692) (#904) --- packages/eslint-plugin/src/rules/unbound-method.ts | 3 +++ packages/eslint-plugin/tests/rules/unbound-method.test.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index c76ac76f9d0..8be7a842c46 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -120,6 +120,9 @@ function isSafeUse(node: TSESTree.Node): boolean { case AST_NODE_TYPES.TaggedTemplateExpression: return parent.tag === node; + case AST_NODE_TYPES.UnaryExpression: + return parent.operator === 'typeof'; + case AST_NODE_TYPES.TSNonNullExpression: case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 061b4edf524..2c0d1aaf188 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -97,6 +97,12 @@ instane.boundStatic && 0; ContainsMethods.boundStatic ? 1 : 0; ContainsMethods.unboundStatic ? 1 : 0; + +typeof instance.bound === 'function'; +typeof instance.unbound === 'function'; + +typeof ContainsMethods.boundStatic === 'function'; +typeof ContainsMethods.unboundStatic === 'function'; `, `interface RecordA { readonly type: "A" From 29a01b801063f661c396980810ffbebfd54a8fce Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 28 Aug 2019 21:30:23 +0300 Subject: [PATCH 035/317] fix(eslint-plugin): [unbound-method] false positive in equality comparisons (#914) --- packages/eslint-plugin/src/rules/unbound-method.ts | 3 +++ .../eslint-plugin/tests/rules/unbound-method.test.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 8be7a842c46..46bbe779c66 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -123,6 +123,9 @@ function isSafeUse(node: TSESTree.Node): boolean { case AST_NODE_TYPES.UnaryExpression: return parent.operator === 'typeof'; + case AST_NODE_TYPES.BinaryExpression: + return ['instanceof', '==', '!=', '===', '!=='].includes(parent.operator); + case AST_NODE_TYPES.TSNonNullExpression: case AST_NODE_TYPES.TSAsExpression: case AST_NODE_TYPES.TSTypeAssertion: diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 2c0d1aaf188..520b28fc1d1 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -52,15 +52,27 @@ instance.unbound\`\`; if (instance.bound) { } if (instance.unbound) { } +if (instance.bound !== undefined) { } +if (instance.unbound !== undefined) { } + if (ContainsMethods.boundStatic) { } if (ContainsMethods.unboundStatic) { } +if (ContainsMethods.boundStatic !== undefined) { } +if (ContainsMethods.unboundStatic !== undefined) { } + while (instance.bound) { } while (instance.unbound) { } +while (instance.bound !== undefined) { } +while (instance.unbound !== undefined) { } + while (ContainsMethods.boundStatic) { } while (ContainsMethods.unboundStatic) { } +while (ContainsMethods.boundStatic !== undefined) { } +while (ContainsMethods.unboundStatic !== undefined) { } + instance.bound as any; ContainsMethods.boundStatic as any; From a4e625fc97d05e6bce82f58cd2a877cc35a87820 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 29 Aug 2019 19:33:12 +0300 Subject: [PATCH 036/317] fix(eslint-plugin): [no-inferrable-types] ignore optional props (#918) --- packages/eslint-plugin/src/rules/no-inferrable-types.ts | 2 +- .../tests/rules/no-inferrable-types.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index 40fc6a60c7e..92a58252679 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -250,7 +250,7 @@ export default util.createRule({ // Essentially a readonly property without a type // will result in its value being the type, leading to // compile errors if the type is stripped. - if (ignoreProperties || node.readonly) { + if (ignoreProperties || node.readonly || node.optional) { return; } reportInferrableType(node, node.typeAnnotation, node.value); diff --git a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts index fb2563ed4ee..2301d6eda5c 100644 --- a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts +++ b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts @@ -123,6 +123,15 @@ ruleTester.run('no-inferrable-types', rule, { "class Foo { a: number = 5; b: boolean = true; c: string = 'foo'; }", options: [{ ignoreProperties: true }], }, + { + code: ` +class Foo { + a?: number = 5; + b?: boolean = true; + c?: string = 'foo'; +} + `, + }, ], invalid: [ From 6bd7f2d0c0df0361b96509e337e60c77467fde36 Mon Sep 17 00:00:00 2001 From: Denis Malinochkin Date: Fri, 30 Aug 2019 04:32:03 +0300 Subject: [PATCH 037/317] fix(eslint-plugin): [typedef] handle AssignmentPattern inside TSParameterProperty (#923) --- packages/eslint-plugin/src/rules/typedef.ts | 9 ++++ .../eslint-plugin/tests/rules/typedef.test.ts | 47 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index 3d9d76f3872..19c4244d9f9 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -79,6 +79,15 @@ export default util.createRule<[Options], MessageIds>({ break; case AST_NODE_TYPES.TSParameterProperty: annotationNode = param.parameter; + + // Check TS parameter property with default value like `constructor(private param: string = 'something') {}` + if ( + annotationNode && + annotationNode.type === AST_NODE_TYPES.AssignmentPattern + ) { + annotationNode = annotationNode.left; + } + break; default: annotationNode = param; diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index d5ea514f59e..c9e35c356eb 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -109,6 +109,19 @@ ruleTester.run('typedef', rule, { `function receivesString({ a }: { a: string }): void { }`, `function receivesStrings({ a, b }: { [i: string ]: string }): void { }`, `function receivesNumber(a: number = 123): void { }`, + // Constructor parameters + `class Test { + constructor() {} + }`, + `class Test { + constructor(param: string) {} + }`, + `class Test { + constructor(param: string = 'something') {} + }`, + `class Test { + constructor(private param: string = 'something') {} + }`, // Method parameters `class Test { public method(x: number): number { return x; } @@ -401,6 +414,40 @@ ruleTester.run('typedef', rule, { }, ], }, + // Constructor parameters + { + code: `class Test { + constructor(param) {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedefNamed', + }, + ], + }, + { + code: `class Test { + constructor(param = 'something') {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedef', + }, + ], + }, + { + code: `class Test { + constructor(private param = 'something') {} + }`, + errors: [ + { + column: 21, + messageId: 'expectedTypedef', + }, + ], + }, // Method parameters { code: `class Test { From 65eb99348c8694fc1437f6b601454d2ad0e2834f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 30 Aug 2019 19:17:21 +0300 Subject: [PATCH 038/317] feat(eslint-plugin): [expl-func-ret-type] make error loc smaller (#919) --- .../rules/explicit-function-return-type.ts | 49 +++++++ .../explicit-function-return-type.test.ts | 122 +++++++++++++++++- 2 files changed, 166 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index da3e7334b6a..b050578c189 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -1,6 +1,7 @@ import { TSESTree, AST_NODE_TYPES, + AST_TOKEN_TYPES, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; @@ -57,6 +58,53 @@ export default util.createRule({ }, ], create(context, [options]) { + const sourceCode = context.getSourceCode(); + + /** + * Returns start column position + * @param node + */ + function getLocStart( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): TSESTree.LineAndColumnData { + /* highlight method name */ + const parent = node.parent; + if ( + parent && + (parent.type === AST_NODE_TYPES.MethodDefinition || + (parent.type === AST_NODE_TYPES.Property && parent.method)) + ) { + return parent.loc.start; + } + + return node.loc.start; + } + + /** + * Returns end column position + * @param node + */ + function getLocEnd( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + ): TSESTree.LineAndColumnData { + /* highlight `=>` */ + if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { + return sourceCode.getTokenBefore( + node.body, + token => + token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', + )!.loc.end; + } + + return sourceCode.getTokenBefore(node.body!)!.loc.end; + } + /** * Checks if a node is a constructor. * @param node The node to check @@ -258,6 +306,7 @@ export default util.createRule({ context.report({ node, + loc: { start: getLocStart(node), end: getLocEnd(node) }, messageId: 'missingReturnType', }); } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 942ed5ea2e8..0c67b903cee 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -327,15 +327,37 @@ const func = (value: number) => x as const; { filename: 'test.ts', code: ` +function test( + a: number, + b: number, +) { + return; +} + `, + errors: [ + { + messageId: 'missingReturnType', + line: 2, + endLine: 5, + column: 1, + endColumn: 2, + }, + ], + }, + { + filename: 'test.ts', + code: ` function test() { - return; + return; } `, errors: [ { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 1, + endColumn: 16, }, ], }, @@ -343,14 +365,16 @@ function test() { filename: 'test.ts', code: ` var fn = function() { - return 1; + return 1; }; `, errors: [ { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 10, + endColumn: 20, }, ], }, @@ -363,7 +387,9 @@ var arrowFn = () => 'test'; { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 15, + endColumn: 20, }, ], }, @@ -380,23 +406,39 @@ class Test { return; } arrow = () => 'arrow'; + private method() { + return; + } } `, errors: [ { messageId: 'missingReturnType', line: 4, - column: 11, + endLine: 4, + column: 3, + endColumn: 13, }, { messageId: 'missingReturnType', line: 8, - column: 9, + endLine: 8, + column: 3, + endColumn: 11, }, { messageId: 'missingReturnType', line: 11, + endLine: 11, column: 11, + endColumn: 16, + }, + { + messageId: 'missingReturnType', + line: 12, + endLine: 12, + column: 3, + endColumn: 19, }, ], }, @@ -412,7 +454,9 @@ function test() { { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 1, + endColumn: 16, }, ], }, @@ -424,7 +468,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 13, + endColumn: 18, }, ], }, @@ -436,7 +482,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 13, + endColumn: 23, }, ], }, @@ -448,7 +496,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 21, }, ], }, @@ -460,7 +510,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 26, }, ], }, @@ -472,7 +524,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 15, + endColumn: 20, }, ], }, @@ -484,7 +538,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 26, }, ], }, @@ -497,6 +553,9 @@ function test() { { messageId: 'missingReturnType', line: 1, + endLine: 1, + column: 12, + endColumn: 17, }, ], }, @@ -513,6 +572,9 @@ const x = { { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 8, + endColumn: 13, }, ], }, @@ -529,6 +591,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 8, + endColumn: 13, }, ], }, @@ -540,7 +605,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 7, + endColumn: 12, }, ], }, @@ -552,7 +619,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 7, + endColumn: 18, }, ], }, @@ -564,7 +633,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 21, }, ], }, @@ -576,7 +647,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 16, + endColumn: 27, }, ], }, @@ -588,7 +661,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 24, + endColumn: 29, }, ], }, @@ -600,7 +675,9 @@ const x: Foo = { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 24, + endColumn: 35, }, ], }, @@ -623,7 +700,9 @@ function FunctionDeclaration() { { messageId: 'missingReturnType', line: 7, + endLine: 7, column: 11, + endColumn: 16, }, ], }, @@ -635,7 +714,9 @@ function FunctionDeclaration() { { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 22, + endColumn: 27, }, ], }, @@ -659,22 +740,37 @@ foo(() => '') { messageId: 'missingReturnType', line: 3, + endLine: 3, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 4, + endLine: 4, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 5, + endLine: 5, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 6, + endLine: 6, + column: 5, + endColumn: 10, }, { messageId: 'missingReturnType', line: 7, + endLine: 7, + column: 5, + endColumn: 10, }, ], }, @@ -700,7 +796,9 @@ new Accumulator().accumulate(() => 1); { messageId: 'missingReturnType', line: 10, + endLine: 10, column: 30, + endColumn: 35, }, ], }, @@ -716,7 +814,9 @@ new Accumulator().accumulate(() => 1); { messageId: 'missingReturnType', line: 1, + endLine: 1, column: 2, + endColumn: 7, }, ], }, @@ -749,17 +849,23 @@ foo({ { messageId: 'missingReturnType', line: 4, - column: 7, + endLine: 4, + column: 3, + endColumn: 9, }, { messageId: 'missingReturnType', line: 9, + endLine: 9, column: 9, + endColumn: 20, }, { messageId: 'missingReturnType', line: 14, + endLine: 14, column: 9, + endColumn: 14, }, ], }, @@ -778,12 +884,16 @@ const func = (value: number) => ({ type: "X", value } as Action); { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 14, + endColumn: 32, }, { messageId: 'missingReturnType', line: 3, + endLine: 3, column: 14, + endColumn: 32, }, ], }, @@ -801,7 +911,9 @@ const func = (value: number) => ({ type: "X", value } as const); { messageId: 'missingReturnType', line: 2, + endLine: 2, column: 14, + endColumn: 32, }, ], }, From 989c13a359519f40fc8c74cc86c4a017dee94c09 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 30 Aug 2019 16:14:05 -0700 Subject: [PATCH 039/317] docs(eslint-plugin): [efrt] fix default values in docs --- .../eslint-plugin/docs/rules/explicit-function-return-type.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index f31d6f42b8b..5f729129b7a 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -73,8 +73,8 @@ type Options = { const defaults = { allowExpressions: false, - allowTypedFunctionExpressions: false, - allowHigherOrderFunctions: false, + allowTypedFunctionExpressions: true, + allowHigherOrderFunctions: true, }; ``` From 6849dc849797289267df17e2425c5098d76ed89f Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 2 Sep 2019 17:02:07 +0000 Subject: [PATCH 040/317] chore: publish v2.1.0 --- CHANGELOG.md | 30 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++ packages/eslint-plugin-tslint/package.json | 6 ++--- packages/eslint-plugin/CHANGELOG.md | 29 +++++++++++++++++++++ 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 | 8 ++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 18 +++++++++++++ packages/typescript-estree/package.json | 4 +-- 14 files changed, 132 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 306e1582021..547ce16d62b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [member-naming] should match constructor args ([#771](https://github.com/typescript-eslint/typescript-eslint/issues/771)) ([b006667](https://github.com/typescript-eslint/typescript-eslint/commit/b006667)) +* **eslint-plugin:** [no-inferrable-types] ignore optional props ([#918](https://github.com/typescript-eslint/typescript-eslint/issues/918)) ([a4e625f](https://github.com/typescript-eslint/typescript-eslint/commit/a4e625f)) +* **eslint-plugin:** [promise-function-async] Allow async get/set ([#820](https://github.com/typescript-eslint/typescript-eslint/issues/820)) ([cddfdca](https://github.com/typescript-eslint/typescript-eslint/commit/cddfdca)) +* **eslint-plugin:** [require-await] Allow concise arrow function bodies ([#826](https://github.com/typescript-eslint/typescript-eslint/issues/826)) ([29fddfd](https://github.com/typescript-eslint/typescript-eslint/commit/29fddfd)) +* **eslint-plugin:** [typedef] don't flag destructuring when variables is disabled ([#819](https://github.com/typescript-eslint/typescript-eslint/issues/819)) ([5603473](https://github.com/typescript-eslint/typescript-eslint/commit/5603473)) +* **eslint-plugin:** [typedef] handle AssignmentPattern inside TSParameterProperty ([#923](https://github.com/typescript-eslint/typescript-eslint/issues/923)) ([6bd7f2d](https://github.com/typescript-eslint/typescript-eslint/commit/6bd7f2d)) +* **eslint-plugin:** [unbound-method] Allow typeof expressions (Fixes [#692](https://github.com/typescript-eslint/typescript-eslint/issues/692)) ([#904](https://github.com/typescript-eslint/typescript-eslint/issues/904)) ([344bafe](https://github.com/typescript-eslint/typescript-eslint/commit/344bafe)) +* **eslint-plugin:** [unbound-method] false positive in equality comparisons ([#914](https://github.com/typescript-eslint/typescript-eslint/issues/914)) ([29a01b8](https://github.com/typescript-eslint/typescript-eslint/commit/29a01b8)) +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **eslint-plugin:** readme typo ([#867](https://github.com/typescript-eslint/typescript-eslint/issues/867)) ([5eb40dc](https://github.com/typescript-eslint/typescript-eslint/commit/5eb40dc)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* [no-unnecessary-type-assertion] allow `as const` arrow functions ([#876](https://github.com/typescript-eslint/typescript-eslint/issues/876)) ([14c6f80](https://github.com/typescript-eslint/typescript-eslint/commit/14c6f80)) +* **eslint-plugin:** [expl-func-ret-type] make error loc smaller ([#919](https://github.com/typescript-eslint/typescript-eslint/issues/919)) ([65eb993](https://github.com/typescript-eslint/typescript-eslint/commit/65eb993)) +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **eslint-plugin:** add quotes [extension] ([#762](https://github.com/typescript-eslint/typescript-eslint/issues/762)) ([9f82099](https://github.com/typescript-eslint/typescript-eslint/commit/9f82099)) +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/lerna.json b/lerna.json index e4b8a907880..0380f9287e8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.0", + "version": "2.1.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 1339f31787c..ff9b5e6cece 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.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index a35949dc244..7250c2f6cb7 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.0.0", + "version": "2.1.0", "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.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.0.0" + "@typescript-eslint/parser": "2.1.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index ac4b1f894c4..699d0e12c9b 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [member-naming] should match constructor args ([#771](https://github.com/typescript-eslint/typescript-eslint/issues/771)) ([b006667](https://github.com/typescript-eslint/typescript-eslint/commit/b006667)) +* **eslint-plugin:** [no-inferrable-types] ignore optional props ([#918](https://github.com/typescript-eslint/typescript-eslint/issues/918)) ([a4e625f](https://github.com/typescript-eslint/typescript-eslint/commit/a4e625f)) +* **eslint-plugin:** [promise-function-async] Allow async get/set ([#820](https://github.com/typescript-eslint/typescript-eslint/issues/820)) ([cddfdca](https://github.com/typescript-eslint/typescript-eslint/commit/cddfdca)) +* **eslint-plugin:** [require-await] Allow concise arrow function bodies ([#826](https://github.com/typescript-eslint/typescript-eslint/issues/826)) ([29fddfd](https://github.com/typescript-eslint/typescript-eslint/commit/29fddfd)) +* **eslint-plugin:** [typedef] don't flag destructuring when variables is disabled ([#819](https://github.com/typescript-eslint/typescript-eslint/issues/819)) ([5603473](https://github.com/typescript-eslint/typescript-eslint/commit/5603473)) +* **eslint-plugin:** [typedef] handle AssignmentPattern inside TSParameterProperty ([#923](https://github.com/typescript-eslint/typescript-eslint/issues/923)) ([6bd7f2d](https://github.com/typescript-eslint/typescript-eslint/commit/6bd7f2d)) +* **eslint-plugin:** [unbound-method] Allow typeof expressions (Fixes [#692](https://github.com/typescript-eslint/typescript-eslint/issues/692)) ([#904](https://github.com/typescript-eslint/typescript-eslint/issues/904)) ([344bafe](https://github.com/typescript-eslint/typescript-eslint/commit/344bafe)) +* **eslint-plugin:** [unbound-method] false positive in equality comparisons ([#914](https://github.com/typescript-eslint/typescript-eslint/issues/914)) ([29a01b8](https://github.com/typescript-eslint/typescript-eslint/commit/29a01b8)) +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **eslint-plugin:** readme typo ([#867](https://github.com/typescript-eslint/typescript-eslint/issues/867)) ([5eb40dc](https://github.com/typescript-eslint/typescript-eslint/commit/5eb40dc)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* [no-unnecessary-type-assertion] allow `as const` arrow functions ([#876](https://github.com/typescript-eslint/typescript-eslint/issues/876)) ([14c6f80](https://github.com/typescript-eslint/typescript-eslint/commit/14c6f80)) +* **eslint-plugin:** [expl-func-ret-type] make error loc smaller ([#919](https://github.com/typescript-eslint/typescript-eslint/issues/919)) ([65eb993](https://github.com/typescript-eslint/typescript-eslint/commit/65eb993)) +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **eslint-plugin:** add quotes [extension] ([#762](https://github.com/typescript-eslint/typescript-eslint/issues/762)) ([9f82099](https://github.com/typescript-eslint/typescript-eslint/commit/9f82099)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6706be22576..9eb195cabe5 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.0.0", + "version": "2.1.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", "eslint-utils": "^1.4.0", "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 8ea9fd4a22c..4ed8006f4c7 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.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index c4fde675f18..2f58babdc68 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.0.0", + "version": "2.1.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.0.0", + "@typescript-eslint/typescript-estree": "2.1.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 23eb1182e2a..0a9561dc15f 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.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/parser/package.json b/packages/parser/package.json index bda37838c79..34e5fb24f22 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.0.0", + "version": "2.1.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.0.0", - "@typescript-eslint/typescript-estree": "2.0.0", + "@typescript-eslint/experimental-utils": "2.1.0", + "@typescript-eslint/typescript-estree": "2.1.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.0.0", + "@typescript-eslint/shared-fixtures": "2.1.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 3aec5aabbcd..4f65be77af0 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.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 0fedd2edbe9..86b93d8157c 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.0.0", + "version": "2.1.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 27a2f9ea6a3..0fea11fa0f9 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) + + +### Bug Fixes + +* **eslint-plugin:** [unified-signatures] type comparison and exported nodes ([#839](https://github.com/typescript-eslint/typescript-eslint/issues/839)) ([580eceb](https://github.com/typescript-eslint/typescript-eslint/commit/580eceb)) +* **typescript-estree:** improve missing project file error msg ([#866](https://github.com/typescript-eslint/typescript-eslint/issues/866)) ([8f3b0a8](https://github.com/typescript-eslint/typescript-eslint/commit/8f3b0a8)), closes [#853](https://github.com/typescript-eslint/typescript-eslint/issues/853) + + +### Features + +* **eslint-plugin:** [no-type-alias] support tuples ([#775](https://github.com/typescript-eslint/typescript-eslint/issues/775)) ([c68e033](https://github.com/typescript-eslint/typescript-eslint/commit/c68e033)) +* **typescript-estree:** Accept a glob pattern for `options.project` ([#806](https://github.com/typescript-eslint/typescript-eslint/issues/806)) ([9e5f21e](https://github.com/typescript-eslint/typescript-eslint/commit/9e5f21e)) + + + + + # [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 9400fb5def3..4abba4d4ca0 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.0.0", + "version": "2.1.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.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.0.0", + "@typescript-eslint/shared-fixtures": "2.1.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 9fce08d555f54f66c6de69f9d9e7f062e46f7782 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 2 Sep 2019 13:41:49 -0400 Subject: [PATCH 041/317] chore(README): update notes regarding releases (#936) --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eabb3ee2eac..7fb38e91766 100644 --- a/README.md +++ b/README.md @@ -187,16 +187,20 @@ If you are interested in using TypeScript and ESLint together, you will want to All of the packages are published with the same version number to make it easier to coordinate both releases and installations. -Additionally, we also publish a canary release on every successful merge to master, so you never need to wait for a new stable version to make use of any updates. +We publish a canary release on every successful merge to master, so **you never need to wait for a new stable version to make use of any updates**. -The `latest` (stable) version is: +Additionally, we promote the to the `latest` tag on NPM once per week, **on Mondays at 1pm Eastern**. + +The latest version under the `latest` tag is: NPM Version -The `canary` (latest master) version is: +The latest version under the `canary` tag **(latest commit to master)** is: NPM Version +(Note: The only exceptions to the automated publishes described above are when we are in the final phases of creating the next major version of the libraries - e.g. going from 1.x.x to 2.x.x. During these periods, we manually publish `canary` releases until we are happy with the release and promote it to `latest`.) +
## Supported TypeScript Version From 0f63e3fefbb240e3d80e885b44bbf0d3f841e064 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 2 Sep 2019 12:40:46 -0700 Subject: [PATCH 042/317] chore: support typescript 3.6 (#916) --- .eslintrc.js | 1 + package.json | 26 +- .../eslint-plugin-tslint/tests/index.spec.ts | 2 +- packages/eslint-plugin/package.json | 6 +- .../src/rules/no-extra-parens.ts | 5 + .../eslint-plugin/src/rules/no-type-alias.ts | 4 +- packages/eslint-plugin/src/rules/quotes.ts | 4 +- .../eslint-plugin/src/rules/require-await.ts | 2 +- .../eslint-plugin/typings/eslint-rules.d.ts | 1 + packages/experimental-utils/package.json | 2 +- packages/parser/package.json | 2 +- .../lib/__snapshots__/typescript.ts.snap | 1037 ++++--- .../basics/keyword-variables.src.ts | 14 +- packages/typescript-estree/package.json | 6 +- packages/typescript-estree/src/parser.ts | 2 +- .../tests/ast-alignment/fixtures-to-test.ts | 22 + .../tests/lib/__snapshots__/convert.ts.snap | 2 +- .../lib/__snapshots__/javascript.ts.snap | 5 +- .../lib/__snapshots__/typescript.ts.snap | 1417 +++++----- yarn.lock | 2439 ++++++++++------- 20 files changed, 2825 insertions(+), 2174 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ef3d195354e..6ae76ac3b6c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,6 +23,7 @@ module.exports = { // '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], + '@typescript-eslint/explicit-function-return-type': 'error', '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-use-before-define': 'off', diff --git a/package.json b/package.json index da363951d70..2cd6dc2b9e3 100644 --- a/package.json +++ b/package.json @@ -53,26 +53,26 @@ "@commitlint/cli": "^8.1.0", "@commitlint/config-conventional": "^8.1.0", "@commitlint/travis-cli": "^8.1.0", - "@types/jest": "^24.0.15", - "@types/node": "^12.6.8", + "@types/jest": "^24.0.18", + "@types/node": "^12.7.2", "all-contributors-cli": "^6.8.1", - "cz-conventional-changelog": "2.1.0", - "eslint": "^6.0.0", + "cz-conventional-changelog": "^3.0.2", + "eslint": "^6.2.2", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-plugin": "^2.1.0", - "eslint-plugin-import": "^2.18.0", - "eslint-plugin-jest": "^22.10.0", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-jest": "^22.15.2", "glob": "^7.1.4", - "husky": "^3.0.0", + "husky": "^3.0.4", "isomorphic-fetch": "^2.2.1", - "jest": "^24.8.0", - "lerna": "^3.15.0", - "lint-staged": "^9.2.0", + "jest": "^24.9.0", + "lerna": "^3.16.4", + "lint-staged": "^9.2.5", "prettier": "^1.18.2", - "rimraf": "^2.6.3", + "rimraf": "^3.0.0", "ts-jest": "^24.0.0", "ts-node": "^8.3.0", - "tslint": "^5.18.0", - "typescript": ">=3.2.1 <3.6.0" + "tslint": "^5.19.0", + "typescript": ">=3.2.1 <3.7.0" } } diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts index 0de1046ecf3..4a4de5ac8d5 100644 --- a/packages/eslint-plugin-tslint/tests/index.spec.ts +++ b/packages/eslint-plugin-tslint/tests/index.spec.ts @@ -139,7 +139,7 @@ ruleTester.run('tslint/config', rule, { messageId: 'failure', data: { message: - 'Operands of \'+\' operation must either be both strings or both numbers, but found 1 + "2". Consider using template literals.', + 'Operands of \'+\' operation must either be both strings or both numbers or both bigints, but found 1 + "2". Consider using template literals.', ruleName: 'restrict-plus-operands', }, }, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 9eb195cabe5..c4b76fa4bdb 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -41,15 +41,15 @@ }, "dependencies": { "@typescript-eslint/experimental-utils": "2.1.0", - "eslint-utils": "^1.4.0", + "eslint-utils": "^1.4.2", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", - "tsutils": "^3.14.0" + "tsutils": "^3.17.1" }, "devDependencies": { "@types/json-schema": "^7.0.3", "@types/marked": "^0.6.5", - "@types/prettier": "^1.18.0", + "@types/prettier": "^1.18.2", "chalk": "^2.4.2", "marked": "^0.7.0", "prettier": "*", diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 7b8d091807c..32904f3199c 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -179,6 +179,11 @@ export default util.createRule({ return rules.ForStatement(node); }, + 'ForStatement > *.init:exit'(node: TSESTree.Node) { + if (node.type !== AST_NODE_TYPES.TSAsExpression) { + return rules['ForStatement > *.init:exit'](node); + } + }, // IfStatement LogicalExpression: binaryExp, MemberExpression(node) { diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 68d537cc09b..38816b60a2f 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -174,7 +174,7 @@ export default util.createRule({ }); } - const isValidTupleType = (type: TypeWithLabel) => { + const isValidTupleType = (type: TypeWithLabel): boolean => { if (type.node.type === AST_NODE_TYPES.TSTupleType) { return true; } @@ -195,7 +195,7 @@ export default util.createRule({ isTopLevel: boolean, type: TypeWithLabel, label: string, - ) => { + ): void => { if ( optionValue === 'never' || !isSupportedComposition(isTopLevel, type.compositionType, optionValue) diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts index 97efc04c821..97b7a0a17ca 100644 --- a/packages/eslint-plugin/src/rules/quotes.ts +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -43,7 +43,7 @@ export default util.createRule({ }; return { - Literal(node) { + Literal(node): void { if ( option === 'backtick' && (isModuleDeclaration(node) || isTypeLiteral(node)) @@ -54,7 +54,7 @@ export default util.createRule({ rules.Literal(node); }, - TemplateLiteral(node) { + TemplateLiteral(node): void { rules.TemplateLiteral(node); }, }; diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 065066dece2..cc5ecc8bf60 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -117,7 +117,7 @@ export default util.createRule({ * @param {ASTNode} node - The node to check * @returns {boolean} */ - function isThenableType(node: ts.Node) { + function isThenableType(node: ts.Node): boolean { const type = checker.getTypeAtLocation(node); return tsutils.isThenableType(checker, node, type); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index dcc37035c9d..9eb02d5cce0 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -387,6 +387,7 @@ declare module 'eslint/lib/rules/no-extra-parens' { node: TSESTree.ForInStatement | TSESTree.ForOfStatement, ): void; ForStatement(node: TSESTree.ForStatement): void; + 'ForStatement > *.init:exit'(node: TSESTree.Node): void; IfStatement(node: TSESTree.IfStatement): void; LogicalExpression(node: TSESTree.LogicalExpression): void; MemberExpression(node: TSESTree.MemberExpression): void; diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 2f58babdc68..5b87c0b88e1 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -38,7 +38,7 @@ "dependencies": { "@types/json-schema": "^7.0.3", "@typescript-eslint/typescript-estree": "2.1.0", - "eslint-scope": "^4.0.0" + "eslint-scope": "^5.0.0" }, "peerDependencies": { "eslint": "*" diff --git a/packages/parser/package.json b/packages/parser/package.json index 34e5fb24f22..2f5012268b7 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -45,7 +45,7 @@ "@types/eslint-visitor-keys": "^1.0.0", "@typescript-eslint/experimental-utils": "2.1.0", "@typescript-eslint/typescript-estree": "2.1.0", - "eslint-visitor-keys": "^1.0.0" + "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 7b48c204e9c..7bf48b5ef3a 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -18536,256 +18536,576 @@ Object { exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` Object { - "$id": 13, + "$id": 20, "block": Object { "range": Array [ 0, - 174, + 190, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 12, + "$id": 19, "block": Object { "range": Array [ 0, - 174, + 190, ], "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "get", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 12, - 13, - ], - "type": "Literal", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "set", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 1, - }, - "writeExpr": Object { - "range": Array [ - 27, - 28, - ], - "type": "Literal", - }, - }, - Object { - "$id": 8, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "module", - "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 2, - }, - "writeExpr": Object { - "range": Array [ - 45, - 46, - ], - "type": "Literal", - }, - }, - Object { - "$id": 9, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "type", - "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 3, - }, - "writeExpr": Object { - "range": Array [ - 61, - 62, - ], - "type": "Literal", - }, - }, - Object { - "$id": 10, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "async", - "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 4, - }, - "writeExpr": Object { - "range": Array [ - 78, - 79, - ], - "type": "Literal", - }, - }, + "childScopes": Array [ Object { - "$id": 11, - "from": Object { - "$ref": 12, - }, - "identifier": Object { - "name": "is", - "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { + "$id": 18, + "block": Object { "range": Array [ - 92, - 93, + 0, + 110, ], - "type": "Literal", + "type": "BlockStatement", }, - }, - ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 13, - }, - "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": 12, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ Object { - "name": Object { + "$id": 12, + "from": Object { + "$ref": 18, + }, + "identifier": Object { "name": "get", "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", }, - "node": Object { + "kind": "w", + "resolved": Object { + "$ref": 6, + }, + "writeExpr": Object { "range": Array [ - 6, - 13, + 16, + 17, ], - "type": "VariableDeclarator", + "type": "Literal", }, - "parent": Object { + }, + Object { + "$id": 13, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "set", "range": Array [ - 0, - 14, + 27, + 30, ], - "type": "VariableDeclaration", + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 7, + }, + "writeExpr": Object { + "range": Array [ + 33, + 34, + ], + "type": "Literal", + }, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 8, + }, + "writeExpr": Object { + "range": Array [ + 53, + 54, + ], + "type": "Literal", }, - "type": "Variable", }, + Object { + "$id": 15, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 9, + }, + "writeExpr": Object { + "range": Array [ + 71, + 72, + ], + "type": "Literal", + }, + }, + Object { + "$id": 16, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 10, + }, + "writeExpr": Object { + "range": Array [ + 90, + 91, + ], + "type": "Literal", + }, + }, + Object { + "$id": 17, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 11, + }, + "writeExpr": Object { + "range": Array [ + 106, + 107, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "async": Object { + "$ref": 10, + }, + "get": Object { + "$ref": 6, + }, + "is": Object { + "$ref": 11, + }, + "module": Object { + "$ref": 8, + }, + "set": Object { + "$ref": 7, + }, + "type": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 10, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 4, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 35, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 54, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 55, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [ + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 64, + 72, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 58, + 73, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [ + Object { + "$ref": 15, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + 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", + }, + ], + "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 [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "node": Object { "range": Array [ - 107, - 110, + 123, + 126, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18797,28 +19117,16 @@ Object { Object { "name": "get", "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - Object { - "name": "get", - "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, ], "name": "get", - "references": Array [ - Object { - "$ref": 6, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18828,47 +19136,22 @@ Object { "name": Object { "name": "set", "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 21, - 28, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 15, - 29, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "set", - "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "node": Object { "range": Array [ - 114, - 117, + 130, + 133, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18880,28 +19163,16 @@ Object { Object { "name": "set", "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - Object { - "name": "set", - "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, ], "name": "set", - "references": Array [ - Object { - "$ref": 7, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18911,47 +19182,22 @@ Object { "name": Object { "name": "module", "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 36, - 46, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 30, - 47, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "module", - "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "node": Object { "range": Array [ - 121, - 127, + 137, + 143, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -18963,28 +19209,16 @@ Object { Object { "name": "module", "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - Object { - "name": "module", - "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, ], "name": "module", - "references": Array [ - Object { - "$ref": 8, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -18994,47 +19228,22 @@ Object { "name": Object { "name": "type", "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 54, - 62, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 48, - 63, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "type", - "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "node": Object { "range": Array [ - 131, - 135, + 147, + 151, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19046,28 +19255,16 @@ Object { Object { "name": "type", "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - Object { - "name": "type", - "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, ], "name": "type", - "references": Array [ - Object { - "$ref": 9, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -19077,47 +19274,22 @@ Object { "name": Object { "name": "async", "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 70, - 79, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "async", - "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "node": Object { "range": Array [ - 139, - 144, + 155, + 160, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19129,28 +19301,16 @@ Object { Object { "name": "async", "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - Object { - "name": "async", - "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, ], "name": "async", - "references": Array [ - Object { - "$ref": 10, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, Object { @@ -19160,47 +19320,22 @@ Object { "name": Object { "name": "is", "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 87, - 93, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 81, - 94, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - Object { - "name": Object { - "name": "is", - "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "node": Object { "range": Array [ - 148, - 150, + 164, + 166, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 96, - 173, + 112, + 189, ], "type": "ImportDeclaration", }, @@ -19212,28 +19347,16 @@ Object { Object { "name": "is", "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - Object { - "name": "is", - "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, ], "name": "is", - "references": Array [ - Object { - "$ref": 11, - }, - ], + "references": Array [], "scope": Object { - "$ref": 12, + "$ref": 19, }, }, ], @@ -19247,7 +19370,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 13, + "$ref": 20, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts index a54c3851de8..a6b69461af8 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts @@ -1,9 +1,11 @@ -const get = 1; -const set = 1; -const module = 1; -const type = 1; -const async = 1; -const is = 1; +{ + const get = 1; + const set = 1; + const module = 1; + const type = 1; + const async = 1; + const is = 1; +} import { get, diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 4abba4d4ca0..13cc8202dd9 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -44,11 +44,11 @@ "glob": "^7.1.4", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", - "semver": "^6.2.0" + "semver": "^6.3.0" }, "devDependencies": { - "@babel/code-frame": "7.0.0", - "@babel/parser": "7.3.2", + "@babel/code-frame": "7.5.5", + "@babel/parser": "7.5.5", "@babel/types": "^7.3.2", "@types/babel-code-frame": "^6.20.1", "@types/glob": "^7.1.1", diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index df8df03f0c2..642b41aa488 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.6.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.7.0'; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, 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 64f2453fc60..dfa1b047f36 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -201,6 +201,10 @@ tester.addFixturePatternConfig('javascript/classes', { * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. */ 'class-one-method-super', // babel parse errors + /** + * TS3.6 made computed constructors parse as actual constructors. + */ + 'class-two-methods-computed-constructor', ], }); @@ -233,6 +237,11 @@ tester.addFixturePatternConfig('javascript/forIn', { * TODO: Investigate this in more detail */ 'for-in-with-assigment', // babel parse errors + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * SyntaxError: Invalid left-hand side in for-loop + */ + 'for-in-with-bare-assigment', ], }); @@ -249,6 +258,14 @@ tester.addFixturePatternConfig('javascript/modules', { * Expected babel parse errors - ts-estree is not currently throwing */ 'invalid-export-named-default', // babel parse errors + + // babel does not recognise these as modules + 'export-named-as-default', + 'export-named-as-specifier', + 'export-named-as-specifiers', + 'export-named-specifier', + 'export-named-specifiers-comma', + 'export-named-specifiers', ], ignoreSourceType: [ 'error-function', @@ -393,6 +410,11 @@ tester.addFixturePatternConfig('typescript/basics', { 'const-assertions', 'readonly-arrays', 'readonly-tuples', + /** + * [TS-ESTREE ERRORED, BUT BABEL DID NOT] + * SyntaxError: 'abstract' modifier can only appear on a class, method, or property declaration. + */ + 'abstract-class-with-abstract-constructor', ], ignoreSourceType: [ /** diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index 354bdd90f27..b7266a75dd0 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -34,7 +34,7 @@ Object { }, "isDeclarationFile": false, "languageVariant": 1, - "languageVersion": 8, + "languageVersion": 99, "libReferenceDirectives": Array [], "lineMap": Array [ null, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index ca466f994e9..5bf7a0b6adc 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -26347,13 +26347,12 @@ Object { "line": 1, }, }, + "name": "constructor", "range": Array [ 9, 22, ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", + "type": "Identifier", }, "kind": "constructor", "loc": Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index e433f0a3fc6..f614a8e3c78 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -58612,478 +58612,497 @@ exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ + "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", }, - }, - "name": "get", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 12, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, }, + "range": Array [ + 10, + 17, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 12, - 13, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 6, - 13, + 4, + 18, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "VariableDeclaration", }, - }, - "range": Array [ - 0, - 14, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", }, - }, - "name": "set", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 12, - "line": 2, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, }, + "range": Array [ + 27, + 34, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 27, - 28, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ 21, - 28, + 35, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "VariableDeclaration", }, - }, - "range": Array [ - 15, - 29, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "module", + "range": Array [ + 44, + 50, + ], + "type": "Identifier", }, - }, - "name": "module", - "range": Array [ - 36, - 42, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 15, - "line": 3, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, }, + "range": Array [ + 44, + 54, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 45, - 46, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 36, - 46, + 38, + 55, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 17, - "line": 3, + "type": "VariableDeclaration", }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 30, - 47, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 4, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "type", + "range": Array [ + 64, + 68, + ], + "type": "Identifier", }, - }, - "name": "type", - "range": Array [ - 54, - 58, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 13, - "line": 4, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, }, + "range": Array [ + 64, + 72, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 61, - 62, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 17, + "line": 5, }, "start": Object { - "column": 6, - "line": 4, + "column": 2, + "line": 5, }, }, "range": Array [ - 54, - 62, + 58, + 73, ], - "type": "VariableDeclarator", + "type": "VariableDeclaration", }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 48, - 63, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "name": "async", - "range": Array [ - 70, - 75, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "async", + "range": Array [ + 82, + 87, + ], + "type": "Identifier", }, - "start": Object { - "column": 14, - "line": 5, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 90, + 91, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - }, - "range": Array [ - 78, - 79, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 91, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 18, + "line": 6, }, "start": Object { - "column": 6, - "line": 5, + "column": 2, + "line": 6, }, }, "range": Array [ - 70, - 79, + 76, + 92, ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 16, - "line": 5, + "type": "VariableDeclaration", }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 6, - }, - "start": Object { - "column": 6, - "line": 6, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "is", + "range": Array [ + 101, + 103, + ], + "type": "Identifier", }, - }, - "name": "is", - "range": Array [ - 87, - 89, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - "start": Object { - "column": 11, - "line": 6, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, }, + "range": Array [ + 101, + 107, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 92, - 93, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 15, + "line": 7, }, "start": Object { - "column": 6, - "line": 6, + "column": 2, + "line": 7, }, }, "range": Array [ - 87, - 93, + 95, + 108, ], - "type": "VariableDeclarator", + "type": "VariableDeclaration", }, ], - "kind": "const", "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 1, + "line": 8, }, "start": Object { "column": 0, - "line": 6, + "line": 1, }, }, "range": Array [ - 81, - 94, + 0, + 110, ], - "type": "VariableDeclaration", + "type": "BlockStatement", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 15, + "line": 17, }, "start": Object { "column": 0, - "line": 8, + "line": 10, }, }, "range": Array [ - 96, - 173, + 112, + 189, ], "source": Object { "loc": Object { "end": Object { "column": 20, - "line": 15, + "line": 17, }, "start": Object { "column": 7, - "line": 15, + "line": 17, }, }, "range": Array [ - 159, - 172, + 175, + 188, ], "raw": "'fake-module'", "type": "Literal", @@ -59095,51 +59114,51 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "name": "get", "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "local": Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "name": "get", "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", }, "range": Array [ - 107, - 110, + 123, + 126, ], "type": "ImportSpecifier", }, @@ -59148,51 +59167,51 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "name": "set", "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "local": Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "name": "set", "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", }, "range": Array [ - 114, - 117, + 130, + 133, ], "type": "ImportSpecifier", }, @@ -59201,51 +59220,51 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "name": "module", "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "local": Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "name": "module", "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", }, "range": Array [ - 121, - 127, + 137, + 143, ], "type": "ImportSpecifier", }, @@ -59254,51 +59273,51 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "name": "type", "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "local": Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "name": "type", "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", }, "range": Array [ - 131, - 135, + 147, + 151, ], "type": "ImportSpecifier", }, @@ -59307,51 +59326,51 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "name": "async", "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "local": Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "name": "async", "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", }, "range": Array [ - 139, - 144, + 155, + 160, ], "type": "ImportSpecifier", }, @@ -59360,51 +59379,51 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "name": "is", "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "local": Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "name": "is", "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", }, "range": Array [ - 148, - 150, + 164, + 166, ], "type": "ImportSpecifier", }, @@ -59415,7 +59434,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 16, + "line": 18, }, "start": Object { "column": 0, @@ -59424,24 +59443,42 @@ Object { }, "range": Array [ 0, - 174, + 190, ], "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, "line": 1, }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 0, - 5, + 4, + 9, ], "type": "Keyword", "value": "const", @@ -59449,17 +59486,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 6, - 9, + 10, + 13, ], "type": "Identifier", "value": "get", @@ -59467,17 +59504,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 10, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 10, - 11, + 14, + 15, ], "type": "Punctuator", "value": "=", @@ -59485,17 +59522,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], "type": "Numeric", "value": "1", @@ -59503,17 +59540,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 13, - 14, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -59521,17 +59558,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 0, - "line": 2, + "column": 2, + "line": 3, }, }, "range": Array [ - 15, - 20, + 21, + 26, ], "type": "Keyword", "value": "const", @@ -59539,17 +59576,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 11, + "line": 3, }, "start": Object { - "column": 6, - "line": 2, + "column": 8, + "line": 3, }, }, "range": Array [ - 21, - 24, + 27, + 30, ], "type": "Identifier", "value": "set", @@ -59557,17 +59594,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 13, + "line": 3, }, "start": Object { - "column": 10, - "line": 2, + "column": 12, + "line": 3, }, }, "range": Array [ - 25, - 26, + 31, + 32, ], "type": "Punctuator", "value": "=", @@ -59575,17 +59612,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 15, + "line": 3, }, "start": Object { - "column": 12, - "line": 2, + "column": 14, + "line": 3, }, }, "range": Array [ - 27, - 28, + 33, + 34, ], "type": "Numeric", "value": "1", @@ -59593,17 +59630,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 16, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 15, + "line": 3, }, }, "range": Array [ - 28, - 29, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -59611,17 +59648,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 4, }, "start": Object { - "column": 0, - "line": 3, + "column": 2, + "line": 4, }, }, "range": Array [ - 30, - 35, + 38, + 43, ], "type": "Keyword", "value": "const", @@ -59629,17 +59666,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 14, + "line": 4, }, "start": Object { - "column": 6, - "line": 3, + "column": 8, + "line": 4, }, }, "range": Array [ - 36, - 42, + 44, + 50, ], "type": "Identifier", "value": "module", @@ -59647,17 +59684,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 16, + "line": 4, }, "start": Object { - "column": 13, - "line": 3, + "column": 15, + "line": 4, }, }, "range": Array [ - 43, - 44, + 51, + 52, ], "type": "Punctuator", "value": "=", @@ -59665,17 +59702,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 18, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 17, + "line": 4, }, }, "range": Array [ - 45, - 46, + 53, + 54, ], "type": "Numeric", "value": "1", @@ -59683,17 +59720,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 19, + "line": 4, }, "start": Object { - "column": 16, - "line": 3, + "column": 18, + "line": 4, }, }, "range": Array [ - 46, - 47, + 54, + 55, ], "type": "Punctuator", "value": ";", @@ -59701,17 +59738,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 7, + "line": 5, }, "start": Object { - "column": 0, - "line": 4, + "column": 2, + "line": 5, }, }, "range": Array [ - 48, - 53, + 58, + 63, ], "type": "Keyword", "value": "const", @@ -59719,17 +59756,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 4, + "column": 12, + "line": 5, }, "start": Object { - "column": 6, - "line": 4, + "column": 8, + "line": 5, }, }, "range": Array [ - 54, - 58, + 64, + 68, ], "type": "Identifier", "value": "type", @@ -59737,17 +59774,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 14, + "line": 5, }, "start": Object { - "column": 11, - "line": 4, + "column": 13, + "line": 5, }, }, "range": Array [ - 59, - 60, + 69, + 70, ], "type": "Punctuator", "value": "=", @@ -59755,17 +59792,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 16, + "line": 5, }, "start": Object { - "column": 13, - "line": 4, + "column": 15, + "line": 5, }, }, "range": Array [ - 61, - 62, + 71, + 72, ], "type": "Numeric", "value": "1", @@ -59773,17 +59810,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 4, + "column": 17, + "line": 5, }, "start": Object { - "column": 14, - "line": 4, + "column": 16, + "line": 5, }, }, "range": Array [ - 62, - 63, + 72, + 73, ], "type": "Punctuator", "value": ";", @@ -59791,17 +59828,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 7, + "line": 6, }, "start": Object { - "column": 0, - "line": 5, + "column": 2, + "line": 6, }, }, "range": Array [ - 64, - 69, + 76, + 81, ], "type": "Keyword", "value": "const", @@ -59809,17 +59846,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 5, + "column": 13, + "line": 6, }, "start": Object { - "column": 6, - "line": 5, + "column": 8, + "line": 6, }, }, "range": Array [ - 70, - 75, + 82, + 87, ], "type": "Identifier", "value": "async", @@ -59827,17 +59864,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 5, + "column": 15, + "line": 6, }, "start": Object { - "column": 12, - "line": 5, + "column": 14, + "line": 6, }, }, "range": Array [ - 76, - 77, + 88, + 89, ], "type": "Punctuator", "value": "=", @@ -59845,17 +59882,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 17, + "line": 6, }, "start": Object { - "column": 14, - "line": 5, + "column": 16, + "line": 6, }, }, "range": Array [ - 78, - 79, + 90, + 91, ], "type": "Numeric", "value": "1", @@ -59863,17 +59900,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 18, + "line": 6, }, "start": Object { - "column": 15, - "line": 5, + "column": 17, + "line": 6, }, }, "range": Array [ - 79, - 80, + 91, + 92, ], "type": "Punctuator", "value": ";", @@ -59881,17 +59918,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 7, + "line": 7, }, "start": Object { - "column": 0, - "line": 6, + "column": 2, + "line": 7, }, }, "range": Array [ - 81, - 86, + 95, + 100, ], "type": "Keyword", "value": "const", @@ -59899,17 +59936,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 10, + "line": 7, }, "start": Object { - "column": 6, - "line": 6, + "column": 8, + "line": 7, }, }, "range": Array [ - 87, - 89, + 101, + 103, ], "type": "Identifier", "value": "is", @@ -59917,17 +59954,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 6, + "column": 12, + "line": 7, }, "start": Object { - "column": 9, - "line": 6, + "column": 11, + "line": 7, }, }, "range": Array [ - 90, - 91, + 104, + 105, ], "type": "Punctuator", "value": "=", @@ -59935,17 +59972,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 14, + "line": 7, }, "start": Object { - "column": 11, - "line": 6, + "column": 13, + "line": 7, }, }, "range": Array [ - 92, - 93, + 106, + 107, ], "type": "Numeric", "value": "1", @@ -59953,17 +59990,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 15, + "line": 7, }, "start": Object { - "column": 12, - "line": 6, + "column": 14, + "line": 7, }, }, "range": Array [ - 93, - 94, + 107, + 108, ], "type": "Punctuator", "value": ";", @@ -59971,7 +60008,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 1, "line": 8, }, "start": Object { @@ -59980,8 +60017,26 @@ Object { }, }, "range": Array [ - 96, - 102, + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 112, + 118, ], "type": "Keyword", "value": "import", @@ -59990,16 +60045,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 8, + "line": 10, }, "start": Object { "column": 7, - "line": 8, + "line": 10, }, }, "range": Array [ - 103, - 104, + 119, + 120, ], "type": "Punctuator", "value": "{", @@ -60008,16 +60063,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, "range": Array [ - 107, - 110, + 123, + 126, ], "type": "Identifier", "value": "get", @@ -60026,16 +60081,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 9, + "line": 11, }, "start": Object { "column": 5, - "line": 9, + "line": 11, }, }, "range": Array [ - 110, - 111, + 126, + 127, ], "type": "Punctuator", "value": ",", @@ -60044,16 +60099,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 10, + "line": 12, }, "start": Object { "column": 2, - "line": 10, + "line": 12, }, }, "range": Array [ - 114, - 117, + 130, + 133, ], "type": "Identifier", "value": "set", @@ -60062,16 +60117,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 10, + "line": 12, }, "start": Object { "column": 5, - "line": 10, + "line": 12, }, }, "range": Array [ - 117, - 118, + 133, + 134, ], "type": "Punctuator", "value": ",", @@ -60080,16 +60135,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 11, + "line": 13, }, "start": Object { "column": 2, - "line": 11, + "line": 13, }, }, "range": Array [ - 121, - 127, + 137, + 143, ], "type": "Identifier", "value": "module", @@ -60098,16 +60153,16 @@ Object { "loc": Object { "end": Object { "column": 9, - "line": 11, + "line": 13, }, "start": Object { "column": 8, - "line": 11, + "line": 13, }, }, "range": Array [ - 127, - 128, + 143, + 144, ], "type": "Punctuator", "value": ",", @@ -60116,16 +60171,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 12, + "line": 14, }, "start": Object { "column": 2, - "line": 12, + "line": 14, }, }, "range": Array [ - 131, - 135, + 147, + 151, ], "type": "Identifier", "value": "type", @@ -60134,16 +60189,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 12, + "line": 14, }, "start": Object { "column": 6, - "line": 12, + "line": 14, }, }, "range": Array [ - 135, - 136, + 151, + 152, ], "type": "Punctuator", "value": ",", @@ -60152,16 +60207,16 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 13, + "line": 15, }, "start": Object { "column": 2, - "line": 13, + "line": 15, }, }, "range": Array [ - 139, - 144, + 155, + 160, ], "type": "Identifier", "value": "async", @@ -60170,16 +60225,16 @@ Object { "loc": Object { "end": Object { "column": 8, - "line": 13, + "line": 15, }, "start": Object { "column": 7, - "line": 13, + "line": 15, }, }, "range": Array [ - 144, - 145, + 160, + 161, ], "type": "Punctuator", "value": ",", @@ -60188,16 +60243,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 14, + "line": 16, }, "start": Object { "column": 2, - "line": 14, + "line": 16, }, }, "range": Array [ - 148, - 150, + 164, + 166, ], "type": "Identifier", "value": "is", @@ -60206,16 +60261,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 14, + "line": 16, }, "start": Object { "column": 4, - "line": 14, + "line": 16, }, }, "range": Array [ - 150, - 151, + 166, + 167, ], "type": "Punctuator", "value": ",", @@ -60224,16 +60279,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 15, + "line": 17, }, "start": Object { "column": 0, - "line": 15, + "line": 17, }, }, "range": Array [ - 152, - 153, + 168, + 169, ], "type": "Punctuator", "value": "}", @@ -60242,16 +60297,16 @@ Object { "loc": Object { "end": Object { "column": 6, - "line": 15, + "line": 17, }, "start": Object { "column": 2, - "line": 15, + "line": 17, }, }, "range": Array [ - 154, - 158, + 170, + 174, ], "type": "Identifier", "value": "from", @@ -60260,16 +60315,16 @@ Object { "loc": Object { "end": Object { "column": 20, - "line": 15, + "line": 17, }, "start": Object { "column": 7, - "line": 15, + "line": 17, }, }, "range": Array [ - 159, - 172, + 175, + 188, ], "type": "String", "value": "'fake-module'", @@ -60278,16 +60333,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 15, + "line": 17, }, "start": Object { "column": 20, - "line": 15, + "line": 17, }, }, "range": Array [ - 172, - 173, + 188, + 189, ], "type": "Punctuator", "value": ";", diff --git a/yarn.lock b/yarn.lock index 7fef7edc509..9f41d090fe9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,14 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" - integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== - dependencies: - "@babel/highlight" "^7.0.0" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": +"@babel/code-frame@7.5.5", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== @@ -93,12 +86,7 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.2.tgz#95cdeddfc3992a6ca2a1315191c1679ca32c55cd" - integrity sha512-QzNUC2RO1gadg+fs21fi0Uu0OuGNzRKEmgCxoLNzbCdoprLwjfmZwzUrpUNfJPaVRwBpDY47A17yYEGWyRelnQ== - -"@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", "@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": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== @@ -218,7 +206,7 @@ babel-runtime "^6.23.0" lodash "4.17.14" -"@commitlint/load@^8.1.0": +"@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== @@ -297,7 +285,7 @@ babel-runtime "6.26.0" execa "0.9.0" -"@evocateur/libnpmaccess@^3.1.0": +"@evocateur/libnpmaccess@^3.1.2": version "3.1.2" resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" integrity sha512-KSCAHwNWro0CF2ukxufCitT9K5LjL/KuMmNzSu8wuwN2rjyKHD8+cmOsiybK+W5hdnwc5M1SmRlVCaMHQo+3rg== @@ -308,7 +296,7 @@ get-stream "^4.0.0" npm-package-arg "^6.1.0" -"@evocateur/libnpmpublish@^1.2.0": +"@evocateur/libnpmpublish@^1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.2.tgz#55df09d2dca136afba9c88c759ca272198db9f1a" integrity sha512-MJrrk9ct1FeY9zRlyeoyMieBjGDG9ihyyD9/Ft6MMrTxql9NyoEx2hw9casTIP4CdqEVu+3nQ2nXxoJ8RCXyFg== @@ -323,19 +311,6 @@ semver "^5.5.1" ssri "^6.0.1" -"@evocateur/npm-registry-fetch@^3.9.1": - version "3.9.2" - resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-3.9.2.tgz#4e23b8b6c812c34828520ce42b31fcdb927c77a3" - integrity sha512-lz4cWdC32z6iI05YT9y79YuJtp4IXUu9lAP5JA/Z/difUXJRLAKlemboY64ELa8BKDav/ktjeCKUUJL8jxNTig== - dependencies: - JSONStream "^1.3.4" - bluebird "^3.5.1" - figgy-pudding "^3.4.1" - lru-cache "^5.1.1" - make-fetch-happen "^4.0.2" - npm-package-arg "^6.1.0" - safe-buffer "^5.1.2" - "@evocateur/npm-registry-fetch@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz#8c4c38766d8d32d3200fcb0a83f064b57365ed66" @@ -349,17 +324,19 @@ npm-package-arg "^6.1.0" safe-buffer "^5.1.2" -"@evocateur/pacote@^9.6.0": - version "9.6.3" - resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.3.tgz#bcd7adbd3c2ef303aa89bd24166f06dd9c080d89" - integrity sha512-ExqNqcbdHQprEgKnY/uQz7WRtyHRbQxRl4JnVkSkmtF8qffRrF9K+piZKNLNSkRMOT/3H0e3IP44QVCHaXMWOQ== +"@evocateur/pacote@^9.6.3": + version "9.6.5" + resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.5.tgz#33de32ba210b6f17c20ebab4d497efc6755f4ae5" + integrity sha512-EI552lf0aG2nOV8NnZpTxNo2PcXKPmDbF9K8eCBFQdIZwHNGN/mi815fxtmUMa2wTa1yndotICIDt/V0vpEx2w== dependencies: "@evocateur/npm-registry-fetch" "^4.0.0" bluebird "^3.5.3" - cacache "^12.0.0" + cacache "^12.0.3" + chownr "^1.1.2" figgy-pudding "^3.5.1" get-stream "^4.1.0" glob "^7.1.4" + infer-owner "^1.0.4" lru-cache "^5.1.1" make-fetch-happen "^5.0.0" minimatch "^3.0.4" @@ -369,7 +346,7 @@ normalize-package-data "^2.5.0" npm-package-arg "^6.1.0" npm-packlist "^1.4.4" - npm-pick-manifest "^2.2.3" + npm-pick-manifest "^3.0.0" osenv "^0.1.5" promise-inflight "^1.0.1" promise-retry "^1.1.1" @@ -391,67 +368,77 @@ chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" - integrity sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A== +"@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== + dependencies: + "@jest/source-map" "^24.9.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== dependencies: "@jest/console" "^24.7.1" - "@jest/reporters" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.8.0" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" - jest-watcher "^24.8.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" micromatch "^3.1.10" p-each-series "^1.0.0" - pirates "^4.0.1" realpath-native "^1.1.0" rimraf "^2.5.4" + slash "^2.0.0" strip-ansi "^5.0.0" -"@jest/environment@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.8.0.tgz#0342261383c776bdd652168f68065ef144af0eac" - integrity sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw== - dependencies: - "@jest/fake-timers" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - -"@jest/fake-timers@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.8.0.tgz#2e5b80a4f78f284bcb4bd5714b8e10dd36a8d3d1" - integrity sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw== - dependencies: - "@jest/types" "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" - -"@jest/reporters@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" - integrity sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -459,13 +446,13 @@ istanbul-lib-instrument "^3.0.1" istanbul-lib-report "^2.0.4" istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.1.1" - jest-haste-map "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" - node-notifier "^5.2.1" + node-notifier "^5.4.2" slash "^2.0.0" source-map "^0.6.0" string-length "^2.0.0" @@ -479,119 +466,129 @@ graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" - integrity sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng== +"@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== dependencies: - "@jest/console" "^24.7.1" - "@jest/types" "^24.8.0" + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== + dependencies: + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/test-sequencer@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" - integrity sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg== +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== dependencies: - "@jest/test-result" "^24.8.0" - jest-haste-map "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" -"@jest/transform@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.8.0.tgz#628fb99dce4f9d254c6fd9341e3eea262e06fef5" - integrity sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA== +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" babel-plugin-istanbul "^5.1.0" chalk "^2.0.1" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.15" - jest-haste-map "^24.8.0" - jest-regex-util "^24.3.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" micromatch "^3.1.10" + pirates "^4.0.1" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" - integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg== +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^12.0.9" - -"@lerna/add@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.15.0.tgz#10be562f43cde59b60f299083d54ac39520ec60a" - integrity sha512-+KrG4GFy/6FISZ+DwWf5Fj5YB4ESa4VTnSn/ujf3VEda6dxngHPN629j+TcPbsdOxUYVah+HuZbC/B8NnkrKpQ== - dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-conf" "3.13.0" + "@types/yargs" "^13.0.0" + +"@lerna/add@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.16.2.tgz#90ecc1be7051cfcec75496ce122f656295bd6e94" + integrity sha512-RAAaF8aODPogj2Ge9Wj3uxPFIBGpog9M+HwSuq03ZnkkO831AmasCTJDqV+GEpl1U2DvnhZQEwHpWmTT0uUeEw== + dependencies: + "@evocateur/pacote" "^9.6.3" + "@lerna/bootstrap" "3.16.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" npm-package-arg "^6.1.0" - p-map "^1.2.0" - semver "^5.5.0" + p-map "^2.1.0" + semver "^6.2.0" -"@lerna/batch-packages@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.14.0.tgz#0208663bab3ddbf57956b370aaec4c9ebee6c800" - integrity sha512-RlBkQVNTqk1qvn6PFWiWNiskllUHh6tXbTVm43mZRNd+vhAyvrQC8RWJxH0ECVvnFAt9rSNGRIVbEJ31WnNQLg== +"@lerna/batch-packages@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.16.0.tgz#1c16cb697e7d718177db744cbcbdac4e30253c8c" + integrity sha512-7AdMkANpubY/FKFI01im01tlx6ygOBJ/0JcixMUWoWP/7Ds3SWQF22ID6fbBr38jUWptYLDs2fagtTDL7YUPuA== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.16.0" npmlog "^4.1.2" -"@lerna/bootstrap@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.15.0.tgz#f53e0bbbbfb8367e609a06378409bfc673ff2930" - integrity sha512-4AxsPKKbgj2Ju03qDddQTpOHvpqnwd0yaiEU/aCcWv/4tDTe79NqUne2Z3+P2WZY0Zzb8+nUKcskwYBMTeq+Mw== - dependencies: - "@lerna/batch-packages" "3.14.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/has-npm-version" "3.14.2" - "@lerna/npm-install" "3.14.2" - "@lerna/package-graph" "3.14.0" +"@lerna/bootstrap@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.16.2.tgz#be268d940221d3c3270656b9b791b492559ad9d8" + integrity sha512-I+gs7eh6rv9Vyd+CwqL7sftRfOOsSzCle8cv/CGlMN7/p7EAVhxEdAw8SYoHIKHzipXszuqqy1Y3opyleD0qdA== + dependencies: + "@lerna/batch-packages" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/has-npm-version" "3.16.0" + "@lerna/npm-install" "3.16.0" + "@lerna/package-graph" "3.16.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-parallel-batches" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - "@lerna/symlink-dependencies" "3.14.2" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-parallel-batches" "3.16.0" + "@lerna/symlink-binary" "3.16.2" + "@lerna/symlink-dependencies" "3.16.2" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - get-port "^3.2.0" - multimatch "^2.1.0" + get-port "^4.2.0" + multimatch "^3.0.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" read-package-tree "^5.1.6" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/changed@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.15.0.tgz#20db9d992d697e4288c260aa38b989dcb93f4b40" - integrity sha512-Hns1ssI9T9xOTGVc7PT2jUaqzsSkxV3hV/Y7iFO0uKTk+fduyTwGTHU9A/ybQ/xi/9iaJbvaXyjxKiGoEnzmhg== +"@lerna/changed@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.16.4.tgz#c3e727d01453513140eee32c94b695de577dc955" + integrity sha512-NCD7XkK744T23iW0wqKEgF4R9MYmReUbyHCZKopFnsNpQdqumc3SOIvQUAkKCP6hQJmYvxvOieoVgy/CVDpZ5g== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/listable" "3.14.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.16.4" "@lerna/check-working-tree@3.14.2": version "3.14.2" @@ -611,17 +608,17 @@ execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.15.0.tgz#a94da50908a80ba443a0a682706aca79ac2ecf27" - integrity sha512-D1BN7BnJk6YjrSR7E7RiCmWiFVWDo3L+OSe6zDq6rNNYexPBtSi2JOCeF/Dibi3jd2luVu0zkVpUtuEEdPiD+A== +"@lerna/clean@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.16.0.tgz#1c134334cacea1b1dbeacdc580e8b9240db8efa1" + integrity sha512-5P9U5Y19WmYZr7UAMGXBpY7xCRdlR7zhHy8MAPDKVx70rFIBS6nWXn5n7Kntv74g7Lm1gJ2rsiH5tj1OPcRJgg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.14.2" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" @@ -645,78 +642,79 @@ figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.14.2.tgz#396201f6568ec5916bf2c11e7a29b0931fcd3e5b" - integrity sha512-+zSQ2ZovH8Uc0do5dR+sk8VvRJc6Xl+ZnJJGESIl17KSpEw/lVjcOyt6f3BP+WHn+iSOjMWcGvUVA601FIEdZw== +"@lerna/collect-updates@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.16.0.tgz#6db3ce8a740a4e2b972c033a63bdfb77f2553d8c" + integrity sha512-HwAIl815X2TNlmcp28zCrSdXfoZWNP7GJPEqNWYk7xDJTYLqQ+SrmKUePjb3AMGBwYAraZSEJLbHdBpJ5+cHmQ== dependencies: "@lerna/child-process" "3.14.2" "@lerna/describe-ref" "3.14.2" minimatch "^3.0.4" npmlog "^4.1.2" - slash "^1.0.0" + slash "^2.0.0" -"@lerna/command@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.15.0.tgz#e1dc1319054f1cf0b135aa0c5730f3335641a0ca" - integrity sha512-dZqr4rKFN+veuXakIQ1DcGUpzBgcWKaYFNN4O6/skOdVQaEfGefzo1sZET+q7k/BkypxkhXHXpv5UqqSuL/EHQ== +"@lerna/command@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.16.0.tgz#ba3dba49cb5ce4d11b48269cf95becd86e30773f" + integrity sha512-u7tE4GC4/gfbPA9eQg+0ulnoJ+PMoMqomx033r/IxqZrHtmJR9+pF/37S0fsxJ2hX/RMFPC7c9Q/i8NEufSpdQ== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/package-graph" "3.14.0" - "@lerna/project" "3.15.0" + "@lerna/package-graph" "3.16.0" + "@lerna/project" "3.16.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" dedent "^0.7.0" execa "^1.0.0" - is-ci "^1.0.10" - lodash "^4.17.5" + is-ci "^2.0.0" + lodash "^4.17.14" npmlog "^4.1.2" -"@lerna/conventional-commits@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.14.0.tgz#24f643550dc29d4f1249cc26d0eb453d7a1c513d" - integrity sha512-hGZ2qQZ9uEGf2eeIiIpEodSs9Qkkf/2uYEtNT7QN1RYISPUh6/lKGBssc5dpbCF64aEuxmemWLdlDf1ogG6++w== +"@lerna/conventional-commits@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.16.4.tgz#bf464f11b2f6534dad204db00430e1651b346a04" + integrity sha512-QSZJ0bC9n6FVaf+7KDIq5zMv8WnHXnwhyL5jG1Nyh3SgOg9q2uflqh7YsYB+G6FwaRfnPaKosh6obijpYg0llA== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" conventional-changelog-core "^3.1.6" - conventional-recommended-bump "^4.0.4" - fs-extra "^7.0.0" + conventional-recommended-bump "^5.0.0" + fs-extra "^8.1.0" get-stream "^4.0.0" + lodash.template "^4.5.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" - semver "^5.5.0" + pify "^4.0.1" + semver "^6.2.0" -"@lerna/create-symlink@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.14.0.tgz#f40ae06e8cebe70c694368ebf9a4af5ab380fbea" - integrity sha512-Kw51HYOOi6UfCKncqkgEU1k/SYueSBXgkNL91FR8HAZH7EPSRTEtp9mnJo568g0+Hog5C+3cOaWySwhHpRG29A== +"@lerna/create-symlink@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.16.2.tgz#412cb8e59a72f5a7d9463e4e4721ad2070149967" + integrity sha512-pzXIJp6av15P325sgiIRpsPXLFmkisLhMBCy4764d+7yjf2bzrJ4gkWVMhsv4AdF0NN3OyZ5jjzzTtLNqfR+Jw== dependencies: - cmd-shim "^2.0.2" - fs-extra "^7.0.0" + "@zkochan/cmd-shim" "^3.1.0" + fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.15.0.tgz#27bfadcbdf71d34226aa82432293f5290f7ab1aa" - integrity sha512-doXGt0HTwTQl8GkC2tOrraA/5OWbz35hJqi7Dsl3Fl0bAxiv9XmF3LykHFJ+YTDHfGpdoJ8tKu66f/VKP16G0w== +"@lerna/create@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.16.0.tgz#4de841ec7d98b29bb19fb7d6ad982e65f7a150e8" + integrity sha512-OZApR1Iz7awutbmj4sAArwhqCyKgcrnw9rH0aWAUrkYWrD1w4TwkvAcYAsfx5GpQGbLQwoXhoyyPwPfZRRWz3Q== dependencies: - "@evocateur/pacote" "^9.6.0" + "@evocateur/pacote" "^9.6.3" "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/npm-conf" "3.13.0" + "@lerna/command" "3.16.0" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" dedent "^0.7.0" - fs-extra "^7.0.0" - globby "^8.0.1" + fs-extra "^8.1.0" + globby "^9.2.0" init-package-json "^1.10.3" npm-package-arg "^6.1.0" p-reduce "^1.0.0" - pify "^3.0.0" - semver "^5.5.0" - slash "^1.0.0" + pify "^4.0.1" + semver "^6.2.0" + slash "^2.0.0" validate-npm-package-license "^3.0.3" validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" @@ -729,44 +727,44 @@ "@lerna/child-process" "3.14.2" npmlog "^4.1.2" -"@lerna/diff@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.15.0.tgz#573d6f58f6809d16752dcfab74c5e286b6678371" - integrity sha512-N1Pr0M554Bt+DlVoD+DXWGh92gcq6G9icn8sH5GSqfwi0XCpPNJ2i1BNEZpUQ6ulLWOMa1YHR4PypPxecRGBjA== +"@lerna/diff@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.16.0.tgz#6d09a786f9f5b343a2fdc460eb0be08a05b420aa" + integrity sha512-QUpVs5TPl8vBIne10/vyjUxanQBQQp7Lk3iaB8MnCysKr0O+oy7trWeFVDPEkBTCD177By7yPGyW5Yey1nCBbA== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/command" "3.16.0" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.15.0.tgz#b31510f47255367eb0d3e4a4f7b6ef8f7e41b985" - integrity sha512-YuXPd64TNG9wbb3lRvyMARQbdlbMZ1bJZ+GCm0enivnIWUyg0qtBDcfPY2dWpIgOif04zx+K/gmOX4lCaGM4UQ== +"@lerna/exec@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.16.0.tgz#2b6c033cee46181b6eede0eb12aad5c2c0181e89" + integrity sha512-mH3O5NXf/O88jBaBBTUf+d56CUkxpg782s3Jxy7HWbVuSUULt3iMRPTh+zEXO5/555etsIVVDDyUR76meklrJA== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/run-topologically" "3.14.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" + p-map "^2.1.0" -"@lerna/filter-options@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.14.2.tgz#7ba91cb54ff3fd9f4650ad8d7c40bc1075e44c2d" - integrity sha512-Ct8oYvRttbYB9JalngHhirb8o9ZVyLm5a9MpXNevXoHiu6j0vNhI19BQCwNnrL6wZvEHJnzPuUl/jO23tWxemg== +"@lerna/filter-options@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.16.0.tgz#b1660b4480c02a5c6efa4d0cd98b9afde4ed0bba" + integrity sha512-InIi1fF8+PxpCwir9bIy+pGxrdE6hvN0enIs1eNGCVS1TTE8osNgiZXa838bMQ1yaEccdcnVX6Z03BNKd56kNg== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/filter-packages" "3.13.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/filter-packages" "3.16.0" dedent "^0.7.0" -"@lerna/filter-packages@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.13.0.tgz#f5371249e7e1a15928e5e88c544a242e0162c21c" - integrity sha512-RWiZWyGy3Mp7GRVBn//CacSnE3Kw82PxE4+H6bQ3pDUw/9atXn7NRX+gkBVQIYeKamh7HyumJtyOKq3Pp9BADQ== +"@lerna/filter-packages@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.16.0.tgz#7d34dc8530c71016263d6f67dc65308ecf11c9fc" + integrity sha512-eGFzQTx0ogkGDCnbTuXqssryR6ilp8+dcXt6B+aq1MaqL/vOJRZyqMm4TY3CUOUnzZCi9S2WWyMw3PnAJOF+kg== dependencies: "@lerna/validation-error" "3.13.0" - multimatch "^2.1.0" + multimatch "^3.0.0" npmlog "^4.1.2" "@lerna/get-npm-exec-opts@3.13.0": @@ -776,23 +774,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/get-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.13.0.tgz#335e40d77f3c1855aa248587d3e0b2d8f4b06e16" - integrity sha512-EgSim24sjIjqQDC57bgXD9l22/HCS93uQBbGpkzEOzxAVzEgpZVm7Fm1t8BVlRcT2P2zwGnRadIvxTbpQuDPTg== +"@lerna/get-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.16.0.tgz#1b316b706dcee86c7baa55e50b087959447852ff" + integrity sha512-AjsFiaJzo1GCPnJUJZiTW6J1EihrPkc2y3nMu6m3uWFxoleklsSCyImumzVZJssxMi3CPpztj8LmADLedl9kXw== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.14.2.tgz#a743792b51cd9bdfb785186e429568827a6372eb" - integrity sha512-+2Xh7t4qVmXiXE2utPnh5T7YwSltG74JP7c+EiooRY5+3zjh9MpPOcTKxVY3xKclzpsyXMohk2KpTF4tzA5rrg== +"@lerna/github-client@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.0.tgz#619874e461641d4f59ab1b3f1a7ba22dba88125d" + integrity sha512-IVJjcKjkYaUEPJsDyAblHGEFFNKCRyMagbIDm14L7Ab94ccN6i4TKOqAFEJn2SJHYvKKBdp3Zj2zNlASOMe3DA== dependencies: "@lerna/child-process" "3.14.2" - "@octokit/plugin-enterprise-rest" "^2.1.1" - "@octokit/rest" "^16.16.0" + "@octokit/plugin-enterprise-rest" "^3.6.1" + "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" npmlog "^4.1.2" @@ -810,124 +808,124 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.14.2.tgz#ac17f7c68e92114b8332b95ae6cffec9c0d67a7b" - integrity sha512-cG+z5bB8JPd5f+nT2eLN2LmKg06O11AxlnUxgw2W7cLyc7cnsmMSp/rxt2JBMwW2r4Yn+CLLJIRwJZ2Es8jFSw== +"@lerna/has-npm-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.0.tgz#55764a4ce792f0c8553cf996a17f554b9e843288" + integrity sha512-TIY036dA9J8OyTrZq9J+it2DVKifL65k7hK8HhkUPpitJkw6jwbMObA/8D40LOGgWNPweJWqmlrTbRSwsR7DrQ== dependencies: "@lerna/child-process" "3.14.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/import@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.15.0.tgz#47f2da52059a96bb08a4c09e18d985258fce9ce1" - integrity sha512-4GKQgeTXBTwMbZNkYyPdQIVA41HIISD7D6XRNrDaG0falUfvoPsknijQPCBmGqeh66u1Fcn2+4lkL3OCTj2FMg== +"@lerna/import@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.16.0.tgz#b57cb453f4acfc60f6541fcbba10674055cb179d" + integrity sha512-trsOmGHzw0rL/f8BLNvd+9PjoTkXq2Dt4/V2UCha254hMQaYutbxcYu8iKPxz9x86jSPlH7FpbTkkHXDsoY7Yg== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/command" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.15.0.tgz#bda36de44c365972f87cbd287fe85b6fb7bb1070" - integrity sha512-VOqH6kFbFtfUbXxhSqXKY6bjnVp9nLuLRI6x9tVHOANX2LmSlXm17OUGBnNt+eM4uJLuiUsAR8nTlpCiz//lPQ== +"@lerna/init@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.16.0.tgz#31e0d66bbededee603338b487a42674a072b7a7d" + integrity sha512-Ybol/x5xMtBgokx4j7/Y3u0ZmNh0NiSWzBFVaOs2NOJKvuqrWimF67DKVz7yYtTYEjtaMdug64ohFF4jcT/iag== dependencies: "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - fs-extra "^7.0.0" - p-map "^1.2.0" - write-json-file "^2.3.0" - -"@lerna/link@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.15.0.tgz#718b4116a8eacb3fc73414ae8d97f8fdaf8125da" - integrity sha512-yKHuifADINobvDOLljBGkVGpVwy6J3mg5p9lQXBdOLXBoIKC8o/UKBR9JvZMFvT/Iy6zn6FPy1v5lz9iU1Ib0Q== - dependencies: - "@lerna/command" "3.15.0" - "@lerna/package-graph" "3.14.0" - "@lerna/symlink-dependencies" "3.14.2" - p-map "^1.2.0" - slash "^1.0.0" + "@lerna/command" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + write-json-file "^3.2.0" + +"@lerna/link@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.16.2.tgz#6c3a5658f6448a64dddca93d9348ac756776f6f6" + integrity sha512-eCPg5Lo8HT525fIivNoYF3vWghO3UgEVFdbsiPmhzwI7IQyZro5HWYzLtywSAdEog5XZpd2Bbn0CsoHWBB3gww== + dependencies: + "@lerna/command" "3.16.0" + "@lerna/package-graph" "3.16.0" + "@lerna/symlink-dependencies" "3.16.2" + p-map "^2.1.0" + slash "^2.0.0" -"@lerna/list@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.15.0.tgz#4e401c1ad990bb12bd38298cb61d21136420ff68" - integrity sha512-8SvxnlfAnbEzQDf2NL0IxWyUuqWTykF9cHt5/f5TOzgESClpaOkDtqwh/UlE8nVTzWMnxnQUPQi3UTKyJD3i3g== +"@lerna/list@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.16.0.tgz#883c00b2baf1e03c93e54391372f67a01b773c2f" + integrity sha512-TkvstoPsgKqqQ0KfRumpsdMXfRSEhdXqOLq519XyI5IRWYxhoqXqfi8gG37UoBPhBNoe64japn5OjphF3rOmQA== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/listable" "3.14.0" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" + "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" -"@lerna/listable@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.14.0.tgz#08f4c78e0466568e8e8a57d4ad09537f2bb7bbb9" - integrity sha512-ZK44Mo8xf/N97eQZ236SPSq0ek6+gk4HqHIx05foEMZVV1iIDH4a/nblLsJNjGQVsIdMYFPaqNJ0z+ZQfiJazQ== +"@lerna/listable@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.16.0.tgz#e6dc47a2d5a6295222663486f50e5cffc580f043" + integrity sha512-mtdAT2EEECqrJSDm/aXlOUFr1MRE4p6hppzY//Klp05CogQy6uGaKk+iKG5yyCLaOXFFZvG4HfO11CmoGSDWzw== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.16.0" chalk "^2.3.1" columnify "^1.5.4" -"@lerna/log-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.13.0.tgz#497b5f692a8d0e3f669125da97b0dadfd9e480f3" - integrity sha512-Rmjrcz+6aM6AEcEVWmurbo8+AnHOvYtDpoeMMJh9IZ9SmZr2ClXzmD7wSvjTQc8BwOaiWjjC/ukcT0UYA2m7wg== +"@lerna/log-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.16.0.tgz#f83991041ee77b2495634e14470b42259fd2bc16" + integrity sha512-Fp+McSNBV/P2mnLUYTaSlG8GSmpXM7krKWcllqElGxvAqv6chk2K3c2k80MeVB4WvJ9tRjUUf+i7HUTiQ9/ckQ== dependencies: - byte-size "^4.0.3" + byte-size "^5.0.1" columnify "^1.5.4" has-unicode "^2.0.1" npmlog "^4.1.2" -"@lerna/npm-conf@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.13.0.tgz#6b434ed75ff757e8c14381b9bbfe5d5ddec134a7" - integrity sha512-Jg2kANsGnhg+fbPEzE0X9nX5oviEAvWj0nYyOkcE+cgWuT7W0zpnPXC4hA4C5IPQGhwhhh0IxhWNNHtjTuw53g== +"@lerna/npm-conf@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.16.0.tgz#1c10a89ae2f6c2ee96962557738685300d376827" + integrity sha512-HbO3DUrTkCAn2iQ9+FF/eisDpWY5POQAOF1m7q//CZjdC2HSW3UYbKEGsSisFxSfaF9Z4jtrV+F/wX6qWs3CuA== dependencies: config-chain "^1.1.11" - pify "^3.0.0" + pify "^4.0.1" -"@lerna/npm-dist-tag@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.15.0.tgz#262dd1e67a4cf82ae78fadfe02622ebce4add078" - integrity sha512-lnbdwc4Ebs7/EI9fTIgbH3dxXnP+SuCcGhG7P5ZjOqo67SY09sRZGcygEzabpvIwXvKpBF8vCd4xxzjnF2u+PA== +"@lerna/npm-dist-tag@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.16.0.tgz#b2184cee5e1f291277396854820e1117a544b7ee" + integrity sha512-MQrBkqJJB9+eNphuj9w90QPMOs4NQXMuSRk9NqzeFunOmdDopPCV0Q7IThSxEuWnhJ2n3B7G0vWUP7tNMPdqIQ== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" - "@lerna/otplease" "3.14.0" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@lerna/otplease" "3.16.0" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.14.2.tgz#fd22ff432f8b7cbe05bedfd36b0506482f1a4732" - integrity sha512-JYJJRtLETrGpcQZa8Rj16vbye399RqnaXmJlZuZ2twjJ2DYVYtwkfsGEOdvdaKw5KVOEpWcAxBA9OMmKQtCLQw== +"@lerna/npm-install@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.0.tgz#8ec76a7a13b183bde438fd46296bf7a0d6f86017" + integrity sha512-APUOIilZCzDzce92uLEwzt1r7AEMKT/hWA1ThGJL+PO9Rn8A95Km3o2XZAYG4W0hR+P4O2nSVuKbsjQtz8CjFQ== dependencies: "@lerna/child-process" "3.14.2" "@lerna/get-npm-exec-opts" "3.13.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.15.0.tgz#89126d74ec97186475767b852954a5f55b732a71" - integrity sha512-G7rcNcSGjG0La8eHPXDvCvoNXbwNnP6XJ+GPh3CH5xiR/nikfLOa+Bfm4ytdjVWWxnKfCT4qyMTCoV1rROlqQQ== +"@lerna/npm-publish@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.16.2.tgz#a850b54739446c4aa766a0ceabfa9283bb0be676" + integrity sha512-tGMb9vfTxP57vUV5svkBQxd5Tzc+imZbu9ZYf8Mtwe0+HYfDjNiiHLIQw7G95w4YRdc5KsCE8sQ0uSj+f2soIg== dependencies: - "@evocateur/libnpmpublish" "^1.2.0" - "@lerna/otplease" "3.14.0" - "@lerna/run-lifecycle" "3.14.0" + "@evocateur/libnpmpublish" "^1.2.2" + "@lerna/otplease" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" + pify "^4.0.1" read-package-json "^2.0.13" "@lerna/npm-run-script@3.14.2": @@ -939,10 +937,10 @@ "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" -"@lerna/otplease@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.14.0.tgz#b539fd3e7a08452fc0db3b10010ca3cf0e4a73e7" - integrity sha512-rYAWzaYZ81bwnrmTkYWGgcc13bl/6DlG7pjWQWNGAJNLzO5zzj0xmXN5sMFJnNvDpSiS/ZS1sIuPvb4xnwLUkg== +"@lerna/otplease@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.16.0.tgz#de66aec4f3e835a465d7bea84b58a4ab6590a0fa" + integrity sha512-uqZ15wYOHC+/V0WnD2iTLXARjvx3vNrpiIeyIvVlDB7rWse9mL4egex/QSgZ+lDx1OID7l2kgvcUD9cFpbqB7Q== dependencies: "@lerna/prompt" "3.13.0" figgy-pudding "^3.5.1" @@ -954,64 +952,64 @@ dependencies: npmlog "^4.1.2" -"@lerna/pack-directory@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.14.2.tgz#577b8ebf867c9b636a2e4659a27552ee24d83b9d" - integrity sha512-b3LnJEmIml3sDj94TQT8R+kVyrDlmE7Su0WwcBYZDySXPMSZ38WA2/2Xjy/EWhXlFxp/nUJKyUG78nDrZ/00Uw== +"@lerna/pack-directory@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.16.4.tgz#3eae5f91bdf5acfe0384510ed53faddc4c074693" + integrity sha512-uxSF0HZeGyKaaVHz5FroDY9A5NDDiCibrbYR6+khmrhZtY0Bgn6hWq8Gswl9iIlymA+VzCbshWIMX4o2O8C8ng== dependencies: - "@lerna/get-packed" "3.13.0" - "@lerna/package" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" + "@lerna/get-packed" "3.16.0" + "@lerna/package" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - npm-packlist "^1.4.1" + npm-packlist "^1.4.4" npmlog "^4.1.2" - tar "^4.4.8" + tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.14.0.tgz#4ccdf446dccedfbbeb4efff3eb720cb6fcb109fc" - integrity sha512-dNpA/64STD5YXhaSlg4gT6Z474WPJVCHoX1ibsVIFu0fVgH609Y69bsdmbvTRdI7r6Dcu4ZfGxdR636RTrH+Eg== +"@lerna/package-graph@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.16.0.tgz#909c90fb41e02f2c19387342d2a5eefc36d56836" + integrity sha512-A2mum/gNbv7zCtAwJqoxzqv89As73OQNK2MgSX1SHWya46qoxO9a9Z2c5lOFQ8UFN5ZxqWMfFYXRCz7qzwmFXw== dependencies: - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/package@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.14.2.tgz#f893cb42e26c869df272dafbe1dd5a3473b0bd4d" - integrity sha512-YR/+CzYdufJYfsUlrfuhTjA35iSZpXK7mVOZmeR9iRWhSaqesm4kq2zfxm9vCpZV2oAQQZOwi4eo5h0rQBtdiw== +"@lerna/package@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.16.0.tgz#7e0a46e4697ed8b8a9c14d59c7f890e0d38ba13c" + integrity sha512-2lHBWpaxcBoiNVbtyLtPUuTYEaB/Z+eEqRS9duxpZs6D+mTTZMNy6/5vpEVSCBmzvdYpyqhqaYjjSLvjjr5Riw== dependencies: - load-json-file "^4.0.0" + load-json-file "^5.3.0" npm-package-arg "^6.1.0" write-pkg "^3.1.0" -"@lerna/prerelease-id-from-version@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.14.0.tgz#d5da9c26ac4a0d0ecde09018f06e41ca4dd444c2" - integrity sha512-Ap3Z/dNhqQuSrKmK+JmzYvQYI2vowxHvUVxZJiDVilW8dyNnxkCsYFmkuZytk5sxVz4VeGLNPS2RSsU5eeSS+Q== +"@lerna/prerelease-id-from-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.16.0.tgz#b24bfa789f5e1baab914d7b08baae9b7bd7d83a1" + integrity sha512-qZyeUyrE59uOK8rKdGn7jQz+9uOpAaF/3hbslJVFL1NqF9ELDTqjCPXivuejMX/lN4OgD6BugTO4cR7UTq/sZA== dependencies: - semver "^5.5.0" + semver "^6.2.0" -"@lerna/project@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.15.0.tgz#733b0993a849dcf5b68fcd0ec11d8f7de38a6999" - integrity sha512-eNGUWiMbQ9kh9kGkomtMnsLypS0rfLqxKgZP2+VnNVtIXjnLv4paeTm+1lkL+naNJUwhnpMk2NSLEeoxT/20QA== +"@lerna/project@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.16.0.tgz#2469a4e346e623fd922f38f5a12931dfb8f2a946" + integrity sha512-NrKcKK1EqXqhrGvslz6Q36+ZHuK3zlDhGdghRqnxDcHxMPT01NgLcmsnymmQ+gjMljuLRmvKYYCuHrknzX8VrA== dependencies: - "@lerna/package" "3.14.2" + "@lerna/package" "3.16.0" "@lerna/validation-error" "3.13.0" cosmiconfig "^5.1.0" dedent "^0.7.0" dot-prop "^4.2.0" - glob-parent "^3.1.0" - globby "^8.0.1" - load-json-file "^4.0.0" + glob-parent "^5.0.0" + globby "^9.2.0" + load-json-file "^5.3.0" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" resolve-from "^4.0.0" - write-json-file "^2.3.0" + write-json-file "^3.2.0" "@lerna/prompt@3.13.0": version "3.13.0" @@ -1021,40 +1019,41 @@ inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.15.0.tgz#54f93f8f0820d2d419d0b65df1eb55d8277090c9" - integrity sha512-6tRRBJ8olLSXfrUsR4f7vSfx0cT1oPi6/v06yI3afDSsUX6eQ3ooZh7gMY4RWmd+nM/IJHTUzhlKF6WhTvo+9g== +"@lerna/publish@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.16.4.tgz#4cd55d8be9943d9a68e316e930a90cda8590500e" + integrity sha512-XZY+gRuF7/v6PDQwl7lvZaGWs8CnX6WIPIu+OCcyFPSL/rdWegdN7HieKBHskgX798qRQc2GrveaY7bNoTKXAw== dependencies: - "@evocateur/libnpmaccess" "^3.1.0" - "@evocateur/npm-registry-fetch" "^3.9.1" - "@evocateur/pacote" "^9.6.0" + "@evocateur/libnpmaccess" "^3.1.2" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@evocateur/pacote" "^9.6.3" "@lerna/check-working-tree" "3.14.2" "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" "@lerna/describe-ref" "3.14.2" - "@lerna/log-packed" "3.13.0" - "@lerna/npm-conf" "3.13.0" - "@lerna/npm-dist-tag" "3.15.0" - "@lerna/npm-publish" "3.15.0" + "@lerna/log-packed" "3.16.0" + "@lerna/npm-conf" "3.16.0" + "@lerna/npm-dist-tag" "3.16.0" + "@lerna/npm-publish" "3.16.2" + "@lerna/otplease" "3.16.0" "@lerna/output" "3.13.0" - "@lerna/pack-directory" "3.14.2" - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/pack-directory" "3.16.4" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.16.4" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" - semver "^5.5.0" + semver "^6.2.0" "@lerna/pulse-till-done@3.13.0": version "3.13.0" @@ -1063,20 +1062,20 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.14.0.tgz#2abb36f445bd924d0f85ac7aec1445e9ef1e2c6c" - integrity sha512-6YTh3vDMW2hUxHdKeRvx4bosc9lZClKaN+DzC1XKTkwDbWrsjmEzLcemKL6QnyyeuryN2f/eto7P9iSe3z3pQQ== +"@lerna/query-graph@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.16.0.tgz#e6a46ebcd9d5b03f018a06eca2b471735353953c" + integrity sha512-p0RO+xmHDO95ChJdWkcy9TNLysLkoDARXeRHzY5U54VCwl3Ot/2q8fMCVlA5UeGXDutEyyByl3URqEpcQCWI7Q== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.16.0" figgy-pudding "^3.5.1" -"@lerna/resolve-symlink@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" - integrity sha512-Lc0USSFxwDxUs5JvIisS8JegjA6SHSAWJCMvi2osZx6wVRkEDlWG2B1JAfXUzCMNfHoZX0/XX9iYZ+4JIpjAtg== +"@lerna/resolve-symlink@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.16.0.tgz#37fc7095fabdbcf317c26eb74e0d0bde8efd2386" + integrity sha512-Ibj5e7njVHNJ/NOqT4HlEgPFPtPLWsO7iu59AM5bJDcAJcR96mLZ7KGVIsS2tvaO7akMEJvt2P+ErwCdloG3jQ== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" npmlog "^4.1.2" read-cmd-shim "^1.0.1" @@ -1090,68 +1089,68 @@ path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.14.0.tgz#0499eca0e7f393faf4e24e6c8737302a9059c22b" - integrity sha512-GUM3L9MzGRSW0WQ8wbLW1+SYStU1OFjW0GBzShhBnFrO4nGRrU7VchsLpcLu0hk2uCzyhsrDKzifEdOdUyMoEQ== +"@lerna/run-lifecycle@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.16.2.tgz#67b288f8ea964db9ea4fb1fbc7715d5bbb0bce00" + integrity sha512-RqFoznE8rDpyyF0rOJy3+KjZCeTkO8y/OB9orPauR7G2xQ7PTdCpgo7EO6ZNdz3Al+k1BydClZz/j78gNCmL2A== dependencies: - "@lerna/npm-conf" "3.13.0" + "@lerna/npm-conf" "3.16.0" figgy-pudding "^3.5.1" - npm-lifecycle "^2.1.1" + npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.13.0.tgz#0276bb4e7cd0995297db82d134ca2bd08d63e311" - integrity sha512-bICFBR+cYVF1FFW+Tlm0EhWDioTUTM6dOiVziDEGE1UZha1dFkMYqzqdSf4bQzfLS31UW/KBd/2z8jy2OIjEjg== +"@lerna/run-parallel-batches@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.16.0.tgz#5ace7911a2dd31dfd1e53c61356034e27df0e1fb" + integrity sha512-2J/Nyv+MvogmQEfC7VcS21ifk7w0HVvzo2yOZRPvkCzGRu/rducxtB4RTcr58XCZ8h/Bt1aqQYKExu3c/3GXwg== dependencies: - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" -"@lerna/run-topologically@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.14.0.tgz#2a560cb657f0ef1565c680b6001b4b01b872dc07" - integrity sha512-y+KBpC1YExFzGynovt9MY4O/bc3RrJaKeuXieiPfKGKxrdtmZe/r33oj/xePTXZq65jnw3SaU3H8S5CrrdkwDg== +"@lerna/run-topologically@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.16.0.tgz#39e29cfc628bbc8e736d8e0d0e984997ac01bbf5" + integrity sha512-4Hlpv4zDtKWa5Z0tPkeu0sK+bxZEKgkNESMGmWrUCNfj7xwvAJurcraK8+a2Y0TFYwf0qjSLY/MzX+ZbJA3Cgw== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.16.0" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.15.0.tgz#465028b5b561a050bd760924e4a0749de3f43172" - integrity sha512-KQBkzZYoEKmzILKjbjsm1KKVWFBXwAdwzqJWj/lfxxd3V5LRF8STASk8aiw8bSpB0bUL9TU/pbXakRxiNzjDwQ== +"@lerna/run@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.16.0.tgz#1ea568c6f303e47fa00b3403a457836d40738fd2" + integrity sha512-woTeLlB1OAAz4zzjdI6RyIxSGuxiUPHJZm89E1pDEPoWwtQV6HMdMgrsQd9ATsJ5Ez280HH4bF/LStAlqW8Ufg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" + "@lerna/command" "3.16.0" + "@lerna/filter-options" "3.16.0" "@lerna/npm-run-script" "3.14.2" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-topologically" "3.16.0" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" - -"@lerna/symlink-binary@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.14.2.tgz#a832fdc6c4b1e5aaf9e6ac9c7e6c322746965eb0" - integrity sha512-tqMwuWi6z1da0AFFbleWyu3H9fqayiV50rjj4anFTfayel9jSjlA1xPG+56sGIP6zUUNuUSc9kLh7oRRmlauoA== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/package" "3.14.2" - fs-extra "^7.0.0" - p-map "^1.2.0" - -"@lerna/symlink-dependencies@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.14.2.tgz#e6b2a9544ff26addc1f4324734595e2f71dfc795" - integrity sha512-Ox7WKXnHZ7IwWlejcCq3n0Hd/yMLv8AwIryhvWxM/RauAge+ML4wg578SsdCyKob8ecgm/R0ytHiU06j81iL1w== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/resolve-symlink" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - fs-extra "^7.0.0" + p-map "^2.1.0" + +"@lerna/symlink-binary@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.16.2.tgz#f98a3d9da9e56f1d302dc0d5c2efeb951483ee66" + integrity sha512-kz9XVoFOGSF83gg4gBqH+mG6uxfJfTp8Uy+Cam40CvMiuzfODrGkjuBEFoM/uO2QOAwZvbQDYOBpKUa9ZxHS1Q== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/package" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + +"@lerna/symlink-dependencies@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.16.2.tgz#91d9909d35897aebd76a03644a00cd03c4128240" + integrity sha512-wnZqGJQ+Jvr1I3inxrkffrFZfmQI7Ta8gySw/UWCy95QtZWF/f5yk8zVIocCAsjzD0wgb3jJE3CFJ9W5iwWk1A== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/resolve-symlink" "3.16.0" + "@lerna/symlink-binary" "3.16.2" + fs-extra "^8.1.0" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" "@lerna/timer@3.13.0": @@ -1166,34 +1165,34 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.15.0.tgz#3c65d223d94f211312995266abb07ee6606d5f73" - integrity sha512-vReYX1NMXZ9PwzTZm97wAl/k3bmRnRZhnQi3mq/m49xTnDavq7p4sbUdFpvu8cVZNKnYS02pNIVGHrQw+K8ZCw== +"@lerna/version@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.16.4.tgz#b5cc37f3ad98358d599c6196c30b6efc396d42bf" + integrity sha512-ikhbMeIn5ljCtWTlHDzO4YvTmpGTX1lWFFIZ79Vd1TNyOr+OUuKLo/+p06mCl2WEdZu0W2s5E9oxfAAQbyDxEg== dependencies: "@lerna/check-working-tree" "3.14.2" "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/conventional-commits" "3.14.0" - "@lerna/github-client" "3.14.2" + "@lerna/collect-updates" "3.16.0" + "@lerna/command" "3.16.0" + "@lerna/conventional-commits" "3.16.4" + "@lerna/github-client" "3.16.0" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/prompt" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" minimatch "^3.0.4" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" p-reduce "^1.0.0" p-waterfall "^1.0.0" - semver "^5.5.0" - slash "^1.0.0" + semver "^6.2.0" + slash "^2.0.0" temp-write "^3.4.0" "@lerna/write-log-file@3.13.0": @@ -1221,11 +1220,32 @@ 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== + dependencies: + "@nodelib/fs.stat" "2.0.2" + 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@^1.1.2": version "1.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" 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== + dependencies: + "@nodelib/fs.scandir" "2.1.2" + 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" @@ -1236,10 +1256,10 @@ universal-user-agent "^3.0.0" url-template "^2.0.8" -"@octokit/plugin-enterprise-rest@^2.1.1": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-2.2.2.tgz#c0e22067a043e19f96ff9c7832e2a3019f9be75c" - integrity sha512-CTZr64jZYhGWNTDGlSJ2mvIlFsm9OEO3LqWn9I/gmoHI4jRBp4kpHoFYNemG4oA75zUAcmbuWblb7jjP877YZw== +"@octokit/plugin-enterprise-rest@^3.6.1": + version "3.6.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-3.6.2.tgz#74de25bef21e0182b4fa03a8678cd00a4e67e561" + integrity sha512-3wF5eueS5OHQYuAEudkpN+xVeUsg8vYEMMenEzLphUZ7PRZ8OJtDcsreL3ad9zxXmBbaFWzLmFcdob5CLyZftA== "@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": version "1.0.4" @@ -1262,10 +1282,10 @@ once "^1.4.0" universal-user-agent "^3.0.0" -"@octokit/rest@^16.16.0": - version "16.28.4" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.28.4.tgz#2f8ef08305033bc91256530d6a3c98eada700660" - integrity sha512-ZBsfD46t3VNkwealxm5zloVgQta8d8o4KYBR/hMAZ582IgjmSDKZdkjyv5w37IUCM3tcPZWKUT+kml9pEIC2GA== +"@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== dependencies: "@octokit/request" "^5.0.0" "@octokit/request-error" "^1.0.2" @@ -1375,10 +1395,10 @@ resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== -"@types/jest@^24.0.15": - version "24.0.15" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.15.tgz#6c42d5af7fe3b44ffff7cc65de7bf741e8fa427f" - integrity sha512-MU1HIvWUme74stAoc3mgAi+aMlgKOudgEvQDIm1v4RkrDudBh1T+NFp5sftpBAdXdx1J0PbdpJ+M2EsSOi1djA== +"@types/jest@^24.0.18": + version "24.0.18" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" + integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== dependencies: "@types/jest-diff" "*" @@ -1423,20 +1443,25 @@ 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", "@types/node@^12.6.8": +"@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/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== -"@types/prettier@^1.18.0": - version "1.18.0" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.0.tgz#d2dbe4d5f76b455138f13a2d881278e2c06a733d" - integrity sha512-5N6WK/XXs9PLPpge2KOmOSaIym2vIo32GsrxM5YOFs7uZ8R9L/acg+hQzWsfwoHEpasqQkH0+3LzLTbiF1GFLQ== +"@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== "@types/semver@^6.0.1": version "6.0.1" @@ -1448,10 +1473,34 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== -"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": - version "12.0.12" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" - integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== +"@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== + +"@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== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/experimental-utils@^1.13.0": + version "1.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e" + integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "1.13.0" + eslint-scope "^4.0.0" + +"@typescript-eslint/typescript-estree@1.13.0": + version "1.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e" + integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" "@webassemblyjs/ast@1.8.5": version "1.8.5" @@ -1609,6 +1658,15 @@ 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" + integrity sha512-o8l0+x7C7sMZU3v9GuJIAU10qQLtwR1dtRQIOmlNMtyaqhmpXOzx1HWiYoWfmmf9HHZoAkXpc9TM9PQYF9d4Jg== + dependencies: + is-windows "^1.0.0" + mkdirp-promise "^5.0.1" + mz "^2.5.0" + JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1635,10 +1693,10 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +acorn-jsx@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" + integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== acorn-walk@^6.0.1: version "6.2.0" @@ -1650,11 +1708,16 @@ 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.0.7, acorn@^6.2.0: +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@^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== + agent-base@4, agent-base@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" @@ -1676,6 +1739,14 @@ agentkeepalive@^3.4.1: dependencies: 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== + 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" @@ -1759,6 +1830,11 @@ any-observable@^0.3.0: resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -1820,10 +1896,10 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= -array-differ@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" - integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= +array-differ@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" + integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== array-equal@^1.0.0: version "1.0.0" @@ -1853,13 +1929,18 @@ array-includes@^3.0.3: define-properties "^1.1.2" es-abstract "^1.7.0" -array-union@^1.0.1: +array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= dependencies: array-uniq "^1.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" @@ -1870,7 +1951,7 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -arrify@^1.0.0, arrify@^1.0.1: +arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= @@ -1992,16 +2073,16 @@ babel-eslint@^10.0.1: eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babel-jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.8.0.tgz#5c15ff2b28e20b0f45df43fe6b7f2aae93dba589" - integrity sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw== +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== dependencies: - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.6.0" + babel-preset-jest "^24.9.0" chalk "^2.4.2" slash "^2.0.0" @@ -2014,10 +2095,10 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.3.0" test-exclude "^5.2.3" -babel-plugin-jest-hoist@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" - integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== dependencies: "@types/babel__traverse" "^7.0.6" @@ -2030,13 +2111,13 @@ babel-polyfill@6.26.0: core-js "^2.5.0" regenerator-runtime "^0.10.5" -babel-preset-jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" - integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.6.0" + babel-plugin-jest-hoist "^24.9.0" babel-runtime@6.26.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" @@ -2266,12 +2347,12 @@ byline@^5.0.0: resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE= -byte-size@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-4.0.4.tgz#29d381709f41aae0d89c631f1c81aec88cd40b23" - integrity sha512-82RPeneC6nqCdSwCX2hZUz3JPOvN5at/nTEw/CMf05Smu3Hrpo9Psb7LjN+k+XndNArG1EY8L4+BM3aTM4BCvw== +byte-size@^5.0.1: + version "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, cacache@^11.3.3: +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== @@ -2311,6 +2392,27 @@ cacache@^12.0.0: unique-filename "^1.1.1" y18n "^4.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== + dependencies: + bluebird "^3.5.5" + chownr "^1.1.1" + figgy-pudding "^3.5.1" + glob "^7.1.4" + graceful-fs "^4.1.15" + infer-owner "^1.0.3" + 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" + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -2326,6 +2428,11 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cachedir@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.2.0.tgz#19afa4305e05d79e417566882e0c8f960f62ff0e" + integrity sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ== + call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" @@ -2382,7 +2489,7 @@ camelcase@^4.1.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -2452,7 +2559,7 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.7" -chownr@^1.1.1: +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== @@ -2464,11 +2571,6 @@ chrome-trace-event@^1.0.0: dependencies: tslib "^1.9.0" -ci-info@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" - integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -2492,6 +2594,11 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== + cli-cursor@^2.0.0, cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" @@ -2535,14 +2642,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -cmd-shim@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" - integrity sha1-b8vamUg6j9FdfTChlspp1oii79s= - dependencies: - graceful-fs "^4.1.2" - mkdirp "~0.5.0" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -2593,6 +2692,27 @@ commander@^2.11.0, commander@^2.12.1, commander@^2.20.0, commander@~2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commitizen@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.0.3.tgz#c19a4213257d0525b85139e2f36db7cc3b4f6dae" + integrity sha512-lxu0F/Iq4dudoFeIl5pY3h3CQJzkmQuh3ygnaOvqhAD8Wu2pYBI17ofqSuPHNsBTEOh1r1AVa9kR4Hp0FAHKcQ== + dependencies: + cachedir "2.2.0" + cz-conventional-changelog "3.0.1" + dedent "0.7.0" + detect-indent "6.0.0" + find-node-modules "2.0.0" + find-root "1.1.0" + fs-extra "8.1.0" + glob "7.1.4" + inquirer "6.5.0" + is-utf8 "^0.2.1" + lodash "4.17.15" + minimist "1.2.0" + shelljs "0.7.6" + 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" @@ -2748,7 +2868,7 @@ 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.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== @@ -2761,17 +2881,17 @@ conventional-commits-parser@^3.0.2: through2 "^3.0.0" trim-off-newlines "^1.0.0" -conventional-recommended-bump@^4.0.4: - version "4.1.1" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-4.1.1.tgz#37014fadeda267d0607e2fc81124da840a585127" - integrity sha512-JT2vKfSP9kR18RXXf55BRY1O3AHG8FPg5btP3l7LYfcWJsiXI6MCf30DepQ98E8Qhowvgv7a8iev0J1bEDkTFA== +conventional-recommended-bump@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz#5af63903947b6e089e77767601cb592cabb106ba" + integrity sha512-RVdt0elRcCxL90IrNP0fYCpq1uGt2MALko0eyeQ+zQuDVWtMGAy9ng6yYn3kax42lCj9+XBxQ8ZN6S9bdKxDhQ== dependencies: concat-stream "^2.0.0" conventional-changelog-preset-loader "^2.1.1" conventional-commits-filter "^2.0.2" - conventional-commits-parser "^3.0.2" + conventional-commits-parser "^3.0.3" git-raw-commits "2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" meow "^4.0.0" q "^1.5.1" @@ -2911,16 +3031,34 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -cz-conventional-changelog@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz#2f4bc7390e3244e4df293e6ba351e4c740a7c764" - integrity sha1-L0vHOQ4yROTfKT5ro1Hkx0Cnx2Q= +cz-conventional-changelog@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-3.0.1.tgz#b1f207ae050355e7ada65aad5c52e9de3d0c8e5b" + integrity sha512-7KASIwB8/ClEyCRvQrCPbN7WkQnUSjSSVNyPM+gDJ0jskLi8h8N2hrdpyeCk7fIqKMRzziqVSOBTB8yyLTMHGQ== dependencies: + chalk "^2.4.1" conventional-commit-types "^2.0.0" lodash.map "^4.5.1" - longest "^1.0.1" + longest "^2.0.1" right-pad "^1.0.1" word-wrap "^1.0.3" + optionalDependencies: + "@commitlint/load" ">6.1.1" + +cz-conventional-changelog@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/cz-conventional-changelog/-/cz-conventional-changelog-3.0.2.tgz#f6b9a406177ab07f9a3a087e06103a045b376260" + integrity sha512-MPxERbtQyVp0nnpCBiwzKGKmMBSswmCV3Jpef3Axqd5f3c/SOc6VFiSUlclOyZXBn3Xtf4snzt4O15hBTRb2gA== + dependencies: + chalk "^2.4.1" + commitizen "^4.0.3" + conventional-commit-types "^2.0.0" + lodash.map "^4.5.1" + longest "^2.0.1" + right-pad "^1.0.1" + word-wrap "^1.0.3" + optionalDependencies: + "@commitlint/load" ">6.1.1" damerau-levenshtein@^1.0.4: version "1.0.5" @@ -3016,7 +3154,7 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -dedent@^0.7.0: +dedent@0.7.0, dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= @@ -3072,18 +3210,19 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" -del@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" - integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== - dependencies: - "@types/glob" "^7.1.1" - globby "^6.1.0" - is-path-cwd "^2.0.0" - is-path-in-cwd "^2.0.0" - p-map "^2.0.0" - pify "^4.0.1" - rimraf "^2.6.3" +del@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/del/-/del-5.1.0.tgz#d9487c94e367410e6eff2925ee58c0c84a75b3a7" + integrity sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA== + dependencies: + globby "^10.0.1" + graceful-fs "^4.2.2" + is-glob "^4.0.1" + is-path-cwd "^2.2.0" + is-path-inside "^3.0.1" + p-map "^3.0.0" + rimraf "^3.0.0" + slash "^3.0.0" delayed-stream@~1.0.0: version "1.0.0" @@ -3108,6 +3247,16 @@ des.js@^1.0.0: 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" + integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= + +detect-indent@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd" + integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA== + detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" @@ -3136,10 +3285,10 @@ didyoumean@^1.2.1: resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.1.tgz#e92edfdada6537d484d73c0172fd1eba0c4976ff" integrity sha1-6S7f2tplN9SE1zwBcv0eugxJdv8= -diff-sequences@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" - integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== +diff-sequences@^24.9.0: + version "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" @@ -3160,14 +3309,20 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" - integrity sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag== +dir-glob@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" + integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== dependencies: - arrify "^1.0.1" path-type "^3.0.0" +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -3299,6 +3454,11 @@ enhanced-resolve@~0.9.0: 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" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= + err-code@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" @@ -3445,7 +3605,7 @@ 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, eslint-plugin-import@^2.18.0: +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== @@ -3462,7 +3622,31 @@ eslint-plugin-import@^2.17.1, eslint-plugin-import@^2.18.0: read-pkg-up "^2.0.0" resolve "^1.11.0" -eslint-plugin-jest@^22.10.0, eslint-plugin-jest@^22.4.1: +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" + integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== + 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" + minimatch "^3.0.4" + object.values "^1.1.0" + read-pkg-up "^2.0.0" + 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== + 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== @@ -3515,7 +3699,7 @@ eslint-scope@3.7.1: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^4.0.0, eslint-scope@^4.0.3: +eslint-scope@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -3523,10 +3707,18 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.3.1, eslint-utils@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" - integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ== +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== dependencies: eslint-visitor-keys "^1.0.0" @@ -3535,10 +3727,15 @@ eslint-visitor-keys@^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@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.0.0.tgz#9223f19223de73b4ed730e11bff44a376b65844d" - integrity sha512-SrrIfcd4tOgsspOKTSwamuTOAMZOUigHQhVMrzNjz4/B9Za6SHQDIocMIyIDfwDgx6MhS15nS6HC8kumCV2qBQ== +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== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3546,45 +3743,46 @@ eslint@^6.0.0: cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^6.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.2" + eslint-visitor-keys "^1.1.0" + espree "^6.1.1" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^3.1.0" + glob-parent "^5.0.0" globals "^11.7.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" + inquirer "^6.4.1" is-glob "^4.0.0" js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" - integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q== +espree@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" + integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.0.0" + acorn-jsx "^5.0.2" + eslint-visitor-keys "^1.1.0" esprima@^3.1.3: version "3.1.3" @@ -3669,10 +3867,10 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.3.tgz#4b84301b33042cfb622771e886ed0b10e5634642" - integrity sha512-iM124nlyGSrXmuyZF1EMe83ESY2chIYVyDRZKgmcDynid2Q2v/+GuE7gNMl6Sy9Niwf4MC0DDxagOxeMPjuLsw== +execa@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.0.4.tgz#2f5cc589c81db316628627004ea4e37b93391d8e" + integrity sha512-VcQfhuGD51vQUQtKIq2fjGDLDbL6N1DTQVpYzxZ7LPIXw3HqTuIz6uxRmpV1qf8i31LHf2kjiaGI+GdHwRgbnQ== dependencies: cross-spawn "^6.0.5" get-stream "^5.0.0" @@ -3702,17 +3900,24 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.8.0.tgz#471f8ec256b7b6129ca2524b2a62f030df38718d" - integrity sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA== +expand-tilde@^2.0.0, expand-tilde@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= dependencies: - "@jest/types" "^24.8.0" + homedir-polyfill "^1.0.1" + +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== + dependencies: + "@jest/types" "^24.9.0" ansi-styles "^3.2.0" - jest-get-type "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-regex-util "^24.3.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" extend-shallow@^2.0.1: version "2.0.1" @@ -3772,7 +3977,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-glob@^2.0.2: +fast-glob@^2.2.6: version "2.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== @@ -3784,6 +3989,18 @@ fast-glob@^2.0.2: merge2 "^1.2.3" micromatch "^3.1.10" +fast-glob@^3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.0.4.tgz#d484a41005cb6faeb399b951fd1bd70ddaebb602" + integrity sha512-wkIbV6qg37xTJwqSsdnIphL1e+LaGz4AIQqr00mIubMaEhv1/HEmJ0uuCGZRNRUkZZmOB5mJKO0ZUTVq+SxMQg== + dependencies: + "@nodelib/fs.stat" "^2.0.1" + "@nodelib/fs.walk" "^1.2.1" + glob-parent "^5.0.0" + is-glob "^4.0.1" + merge2 "^1.2.3" + micromatch "^4.0.2" + fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -3794,6 +4011,13 @@ fast-levenshtein@~2.0.4: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastq@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.6.0.tgz#4ec8a38f4ac25f21492673adb7eae9cfef47d1c2" + integrity sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA== + dependencies: + reusify "^1.0.0" + fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" @@ -3854,7 +4078,15 @@ find-cache-dir@^2.0.0: make-dir "^2.0.0" pkg-dir "^3.0.0" -find-root@^1.1.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" + integrity sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw== + dependencies: + findup-sync "^3.0.0" + merge "^1.2.1" + +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== @@ -3889,6 +4121,16 @@ find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +findup-sync@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1" + integrity sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg== + dependencies: + detect-file "^1.0.0" + is-glob "^4.0.0" + micromatch "^3.0.4" + resolve-dir "^1.0.1" + flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -3945,12 +4187,12 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" - integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== +fs-extra@8.1.0, fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== dependencies: - graceful-fs "^4.1.2" + graceful-fs "^4.2.0" jsonfile "^4.0.0" universalify "^0.1.0" @@ -4039,10 +4281,10 @@ get-pkg-repo@^1.0.0: parse-github-repo-url "^1.3.0" through2 "^2.0.0" -get-port@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" - integrity sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw= +get-port@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" + integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== get-stdin@7.0.0, get-stdin@^7.0.0: version "7.0.0" @@ -4128,6 +4370,14 @@ git-semver-tags@^2.0.2: 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" + integrity sha512-tj4FD4ww2RX2ae//jSrXZzrocla9db5h0V7ikPl1P/WwoZar9epdUhwR7XHXSgc+ZkNq72BEEerqQuicoEQfzA== + dependencies: + meow "^4.0.0" + semver "^6.0.0" + git-up@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.1.tgz#cb2ef086653640e721d2042fe3104857d89007c0" @@ -4158,12 +4408,19 @@ glob-parent@^3.1.0: is-glob "^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== + dependencies: + is-glob "^4.0.1" + glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@7.1.4, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -4182,40 +4439,69 @@ global-dirs@^0.1.1: dependencies: ini "^1.3.4" +global-modules@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" + integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== + dependencies: + global-prefix "^1.0.1" + is-windows "^1.0.1" + resolve-dir "^1.0.0" + +global-prefix@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" + integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= + dependencies: + expand-tilde "^2.0.2" + homedir-polyfill "^1.0.1" + ini "^1.3.4" + is-windows "^1.0.1" + which "^1.2.14" + globals@^11.1.0, globals@^11.7.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= +globby@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" + integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" -globby@^8.0.1: - version "8.0.2" - resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" - integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w== +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== dependencies: - array-union "^1.0.1" - dir-glob "2.0.0" - fast-glob "^2.0.2" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + 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: + 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== + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" @@ -4330,6 +4616,13 @@ hmac-drbg@^1.0.0: 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" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== + 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" @@ -4384,18 +4677,19 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.0.tgz#de63821a7049dc412b1afd753c259e2f6e227562" - integrity sha512-lKMEn7bRK+7f5eWPNGclDVciYNQt0GIkAQmhKl+uHP1qFzoN0h92kmH9HZ8PCwyVA2EQPD8KHf0FYWqnTxau+Q== +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== dependencies: + chalk "^2.4.2" cosmiconfig "^5.2.1" execa "^1.0.0" get-stdin "^7.0.0" is-ci "^2.0.0" opencollective-postinstall "^2.0.2" pkg-dir "^4.2.0" - please-upgrade-node "^3.1.1" + please-upgrade-node "^3.2.0" read-pkg "^5.1.1" run-node "^1.0.0" slash "^3.0.0" @@ -4424,12 +4718,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -ignore@^4.0.6: +ignore@^4.0.3, ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== @@ -4439,6 +4728,11 @@ ignore@^5.0.5: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" integrity sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ== +ignore@^5.1.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -4455,14 +4749,6 @@ import-fresh@^3.0.0: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - integrity sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ== - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -4483,11 +4769,16 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" -indent-string@^3.0.0: +indent-string@^3.0.0, indent-string@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= +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" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -4530,7 +4821,7 @@ init-package-json@^1.10.3: validate-npm-package-license "^3.0.1" validate-npm-package-name "^3.0.0" -inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.2.2: +inquirer@6.5.0, inquirer@^6.2.0, inquirer@^6.2.1: version "6.5.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== @@ -4549,6 +4840,25 @@ inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.2.2: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@^6.4.1: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + interpret@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" @@ -4607,13 +4917,6 @@ is-callable@^1.1.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@^1.0.10: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" - integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== - dependencies: - ci-info "^1.5.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -4742,24 +5045,15 @@ is-observable@^1.1.0: dependencies: symbol-observable "^1.1.0" -is-path-cwd@^2.0.0: +is-path-cwd@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== -is-path-in-cwd@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" - integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== - dependencies: - is-path-inside "^2.1.0" - -is-path-inside@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" - integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== - dependencies: - path-is-inside "^1.0.2" +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== is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" @@ -4840,12 +5134,12 @@ is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-utf8@^0.2.0: +is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= -is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== @@ -4933,73 +5227,73 @@ istanbul-lib-source-maps@^3.0.1: rimraf "^2.6.3" source-map "^0.6.1" -istanbul-reports@^2.1.1: +istanbul-reports@^2.2.6: version "2.2.6" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== dependencies: handlebars "^4.1.2" -jest-changed-files@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.8.0.tgz#7e7eb21cf687587a85e50f3d249d1327e15b157b" - integrity sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug== +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.8.0.tgz#b075ac914492ed114fa338ade7362a301693e989" - integrity sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA== +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== dependencies: - "@jest/core" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" prompts "^2.0.1" realpath-native "^1.1.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-config@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.8.0.tgz#77db3d265a6f726294687cbbccc36f8a76ee0f4f" - integrity sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw== +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.8.0" - "@jest/types" "^24.8.0" - babel-jest "^24.8.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.8.0" - jest-environment-node "^24.8.0" - jest-get-type "^24.8.0" - jest-jasmine2 "^24.8.0" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" micromatch "^3.1.10" - pretty-format "^24.8.0" + pretty-format "^24.9.0" realpath-native "^1.1.0" -jest-diff@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172" - integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g== +jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.3.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" jest-docblock@^24.3.0: version "24.3.0" @@ -5008,123 +5302,124 @@ jest-docblock@^24.3.0: dependencies: detect-newline "^2.1.0" -jest-each@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.8.0.tgz#a05fd2bf94ddc0b1da66c6d13ec2457f35e52775" - integrity sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA== +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - jest-get-type "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" - -jest-environment-jsdom@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz#300f6949a146cabe1c9357ad9e9ecf9f43f38857" - integrity sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" jsdom "^11.5.1" -jest-environment-node@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.8.0.tgz#d3f726ba8bc53087a60e7a84ca08883a4c892231" - integrity sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q== +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" -jest-get-type@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc" - integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== -jest-haste-map@^24.8.0: - version "24.8.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.1.tgz#f39cc1d2b1d907e014165b4bd5a957afcb992982" - integrity sha512-SwaxMGVdAZk3ernAx2Uv2sorA7jm3Kx+lR0grp6rMmnY06Kn/urtKx1LPN2mGTea4fCT38impYT28FfcLUhX0g== +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" anymatch "^2.0.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.4.0" - jest-util "^24.8.0" - jest-worker "^24.6.0" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" micromatch "^3.1.10" sane "^4.0.3" walker "^1.0.7" optionalDependencies: fsevents "^1.2.7" -jest-jasmine2@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz#a9c7e14c83dd77d8b15e820549ce8987cc8cd898" - integrity sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong== +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.8.0" + expect "^24.9.0" is-generator-fn "^2.0.0" - jest-each "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" throat "^4.0.0" -jest-leak-detector@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" - integrity sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g== +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== dependencies: - pretty-format "^24.8.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-matcher-utils@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz#2bce42204c9af12bde46f83dc839efe8be832495" - integrity sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw== +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== dependencies: chalk "^2.0.1" - jest-diff "^24.8.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-message-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.8.0.tgz#0d6891e72a4beacc0292b638685df42e28d6218b" - integrity sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g== +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" - integrity sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A== +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -5136,113 +5431,119 @@ jest-regex-util@^24.3.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== -jest-resolve-dependencies@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" - integrity sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw== +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== + +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.8.0" + jest-snapshot "^24.9.0" -jest-resolve@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.8.0.tgz#84b8e5408c1f6a11539793e2b5feb1b6e722439f" - integrity sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw== +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.8.0.tgz#4f9ae07b767db27b740d7deffad0cf67ccb4c5bb" - integrity sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow== +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.8.0" + jest-config "^24.9.0" jest-docblock "^24.3.0" - jest-haste-map "^24.8.0" - jest-jasmine2 "^24.8.0" - jest-leak-detector "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.8.0.tgz#05f94d5b05c21f6dc54e427cd2e4980923350620" - integrity sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA== +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" + "@jest/environment" "^24.9.0" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.2" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-serializer@^24.4.0: - version "24.4.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" - integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== -jest-snapshot@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" - integrity sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg== +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - expect "^24.8.0" - jest-diff "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.8.0" - semver "^5.5.0" - -jest-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.8.0.tgz#41f0e945da11df44cc76d64ffb915d0716f46cd1" - integrity sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA== - dependencies: - "@jest/console" "^24.7.1" - "@jest/fake-timers" "^24.8.0" - "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5251,29 +5552,29 @@ jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" - integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== dependencies: - "@jest/types" "^24.8.0" - camelcase "^5.0.0" + "@jest/types" "^24.9.0" + camelcase "^5.3.1" chalk "^2.0.1" - jest-get-type "^24.8.0" - leven "^2.1.0" - pretty-format "^24.8.0" - -jest-watcher@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.8.0.tgz#58d49915ceddd2de85e238f6213cef1c93715de4" - integrity sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw== - dependencies: - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.9" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.8.0" + jest-util "^24.9.0" string-length "^2.0.0" jest-worker@^24.6.0: @@ -5284,13 +5585,21 @@ jest-worker@^24.6.0: merge-stream "^1.0.1" supports-color "^6.1.0" -jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" - integrity sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg== +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== + dependencies: + merge-stream "^2.0.0" + supports-color "^6.1.0" + +jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== dependencies: import-local "^2.0.0" - jest-cli "^24.8.0" + jest-cli "^24.9.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -5472,33 +5781,33 @@ left-pad@^1.3.0: resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -lerna@^3.15.0: - version "3.15.0" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.15.0.tgz#b044dba8138d7a1a8dd48ac1d80e7541bdde0d1f" - integrity sha512-kRIQ3bgzkmew5/WZQ0C9WjH0IUf3ZmTNnBwTHfXgLkVY7td0lbwMQFD7zehflUn0zG4ou54o/gn+IfjF0ti/5A== +lerna@^3.16.4: + version "3.16.4" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.16.4.tgz#158cb4f478b680f46f871d5891f531f3a2cb31ec" + integrity sha512-0HfwXIkqe72lBLZcNO9NMRfylh5Ng1l8tETgYQ260ZdHRbPuaLKE3Wqnd2YYRRkWfwPyEyZO8mZweBR+slVe1A== dependencies: - "@lerna/add" "3.15.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/changed" "3.15.0" - "@lerna/clean" "3.15.0" + "@lerna/add" "3.16.2" + "@lerna/bootstrap" "3.16.2" + "@lerna/changed" "3.16.4" + "@lerna/clean" "3.16.0" "@lerna/cli" "3.13.0" - "@lerna/create" "3.15.0" - "@lerna/diff" "3.15.0" - "@lerna/exec" "3.15.0" - "@lerna/import" "3.15.0" - "@lerna/init" "3.15.0" - "@lerna/link" "3.15.0" - "@lerna/list" "3.15.0" - "@lerna/publish" "3.15.0" - "@lerna/run" "3.15.0" - "@lerna/version" "3.15.0" - import-local "^1.0.0" + "@lerna/create" "3.16.0" + "@lerna/diff" "3.16.0" + "@lerna/exec" "3.16.0" + "@lerna/import" "3.16.0" + "@lerna/init" "3.16.0" + "@lerna/link" "3.16.2" + "@lerna/list" "3.16.0" + "@lerna/publish" "3.16.4" + "@lerna/run" "3.16.0" + "@lerna/version" "3.16.4" + import-local "^2.0.0" npmlog "^4.1.2" -leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" - integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -5513,21 +5822,22 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@^9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.2.0.tgz#155e5723dffdaa55d252c47bab05a2962c1e9781" - integrity sha512-K/CQWcxYunc8lGMNTFvtI4+ybJcHW3K4Ghudz2OrJhIWdW/i1WWu9rGiVj4yJ0+D/xh8a08kp5slt89VZC9Eqg== +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== dependencies: chalk "^2.4.2" commander "^2.20.0" cosmiconfig "^5.2.1" debug "^4.1.1" dedent "^0.7.0" - del "^4.1.1" - execa "^2.0.1" + del "^5.0.0" + execa "^2.0.3" listr "^0.14.3" log-symbols "^3.0.0" micromatch "^4.0.2" + normalize-path "^3.0.0" please-upgrade-node "^3.1.1" string-argv "^0.3.0" stringify-object "^3.3.0" @@ -5607,6 +5917,17 @@ load-json-file@^4.0.0: pify "^3.0.0" strip-bom "^3.0.0" +load-json-file@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-5.3.0.tgz#4d3c1e01fa1c03ea78a60ac7af932c9ce53403f3" + integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== + dependencies: + graceful-fs "^4.1.15" + parse-json "^4.0.0" + pify "^4.0.1" + 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" @@ -5689,7 +6010,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash.template@^4.0.2: +lodash.template@^4.0.2, lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== @@ -5714,11 +6035,16 @@ 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.17.5, lodash@^4.2.1: +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: 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: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" @@ -5742,10 +6068,10 @@ log-update@^2.3.0: cli-cursor "^2.0.0" wrap-ansi "^3.0.1" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= +longest@^2.0.1: + version "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: version "1.4.0" @@ -5802,23 +6128,6 @@ make-error@1.x, make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== -make-fetch-happen@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.2.tgz#2d156b11696fb32bffbafe1ac1bc085dd6c78a79" - integrity sha512-YMJrAjHSb/BordlsDEcVcPyTbiJKkzqMf48N8dAJZT9Zjctrkb6Yg4TY9Sq2AwSIQJFn5qBBKVTYt3vP5FMIHA== - dependencies: - agentkeepalive "^3.4.1" - cacache "^11.3.3" - http-cache-semantics "^3.8.1" - http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" - lru-cache "^5.1.1" - mississippi "^3.0.0" - node-fetch-npm "^2.0.2" - promise-retry "^1.1.1" - socks-proxy-agent "^4.0.0" - ssri "^6.0.0" - make-fetch-happen@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.0.tgz#a8e3fe41d3415dd656fe7b8e8172e1fb4458b38d" @@ -5976,7 +6285,12 @@ merge2@^1.2.3: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== -micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: +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: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6043,7 +6357,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^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.0, minimatch@^3.0.4: +minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -6063,7 +6377,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= @@ -6112,7 +6426,14 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp-promise@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= + dependencies: + mkdirp "*" + +mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -6146,15 +6467,15 @@ ms@^2.0.0, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multimatch@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" - integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= +multimatch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" + integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA== dependencies: - array-differ "^1.0.0" - array-union "^1.0.1" - arrify "^1.0.0" - minimatch "^3.0.0" + array-differ "^2.0.3" + array-union "^1.0.2" + arrify "^1.0.1" + minimatch "^3.0.4" mute-stream@0.0.7: version "0.0.7" @@ -6166,6 +6487,15 @@ mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mz@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" @@ -6234,17 +6564,17 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== -node-gyp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" - integrity sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA== +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== dependencies: + env-paths "^1.0.0" glob "^7.0.3" graceful-fs "^4.1.2" mkdirp "^0.5.0" nopt "2 || 3" npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" request "^2.87.0" rimraf "2" semver "~5.3.0" @@ -6290,10 +6620,10 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.2.1: - version "5.4.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" - integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== dependencies: growly "^1.3.0" is-wsl "^1.1.0" @@ -6364,14 +6694,14 @@ npm-bundled@^1.0.1: resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== -npm-lifecycle@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.1.tgz#0027c09646f0fd346c5c93377bdaba59c6748fdf" - integrity sha512-+Vg6I60Z75V/09pdcH5iUo/99Q/vop35PaI99elvxk56azSVVsdsSsS/sXqKDNwbRRNN1qSxkcO45ZOu0yOWew== +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== dependencies: byline "^5.0.0" graceful-fs "^4.1.15" - node-gyp "^4.0.0" + node-gyp "^5.0.2" resolve-from "^4.0.0" slide "^1.1.6" uid-number "0.0.6" @@ -6388,7 +6718,7 @@ npm-lifecycle@^2.1.1: semver "^5.5.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.6, npm-packlist@^1.4.1, npm-packlist@^1.4.4: +npm-packlist@^1.1.6, npm-packlist@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.4.tgz#866224233850ac534b63d1a6e76050092b5d2f44" integrity sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw== @@ -6396,10 +6726,10 @@ npm-packlist@^1.1.6, npm-packlist@^1.4.1, npm-packlist@^1.4.4: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -npm-pick-manifest@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" - integrity sha512-+IluBC5K201+gRU85vFlUwX3PFShZAbAgDNp2ewJdWMVSppdo/Zih0ul2Ecky/X7b51J7LrrUAP+XOmOCvYZqA== +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== dependencies: figgy-pudding "^3.5.1" npm-package-arg "^6.0.0" @@ -6608,7 +6938,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -6685,16 +7015,18 @@ p-map-series@^1.0.0: dependencies: p-reduce "^1.0.0" -p-map@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" - integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== - -p-map@^2.0.0: +p-map@^2.0.0, p-map@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== +p-map@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" + integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== + dependencies: + aggregate-error "^3.0.0" + p-pipe@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-1.2.0.tgz#4b1a11399a11520a67790ee5a0c1d5881d6befe9" @@ -6792,6 +7124,11 @@ parse-json@^5.0.0: json-parse-better-errors "^1.0.1" lines-and-columns "^1.1.6" +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= + parse-path@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.1.tgz#0ec769704949778cb3b8eda5e994c32073a1adff" @@ -6852,11 +7189,6 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -6895,6 +7227,11 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" +path-type@^4.0.0: + version "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" @@ -6983,6 +7320,13 @@ please-upgrade-node@^3.1.1: dependencies: semver-compare "^1.0.0" +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== + dependencies: + semver-compare "^1.0.0" + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -7003,12 +7347,12 @@ prettier@*, prettier@^1.18.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== -pretty-format@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" - integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw== +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" @@ -7365,6 +7709,13 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -7495,6 +7846,14 @@ resolve-cwd@^2.0.0: dependencies: resolve-from "^3.0.0" +resolve-dir@^1.0.0, resolve-dir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" + integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= + dependencies: + expand-tilde "^2.0.0" + global-modules "^1.0.0" + resolve-from@5.0.0, resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -7534,6 +7893,13 @@ resolve@1.x, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.3.2, dependencies: path-parse "^1.0.6" +resolve@^1.1.6: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -7552,6 +7918,11 @@ retry@^0.10.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= +reusify@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + right-pad@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" @@ -7564,6 +7935,13 @@ rimraf@2, rimraf@2.6.3, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6 dependencies: glob "^7.1.3" +rimraf@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" + integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg== + 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" @@ -7589,6 +7967,11 @@ run-node@^1.0.0: resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== +run-parallel@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" + integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -7664,16 +8047,26 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== +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: +semver@^6.0.0, semver@^6.1.1: 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: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -7724,6 +8117,15 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +shelljs@0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" + integrity sha1-N5zM+1a5HIYB5HkzVutTgpJN6a0= + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" @@ -8077,6 +8479,11 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-bom@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -8111,7 +8518,12 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@3.0.1, strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + +strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -8254,6 +8666,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= + dependencies: + any-promise "^1.0.0" + throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" @@ -8414,10 +8840,10 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint@^5.18.0: - version "5.18.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.18.0.tgz#f61a6ddcf372344ac5e41708095bbf043a147ac6" - integrity sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w== +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== dependencies: "@babel/code-frame" "^7.0.0" builtin-modules "^1.1.1" @@ -8440,10 +8866,10 @@ tsutils@^2.29.0: dependencies: tslib "^1.8.1" -tsutils@^3.14.0: - version "3.14.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.14.0.tgz#bf8d5a7bae5369331fa0f2b0a5a10bd7f7396c77" - integrity sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw== +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== dependencies: tslib "^1.8.1" @@ -8471,6 +8897,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.3.0: + version "0.3.1" + 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" @@ -8486,15 +8917,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== - -"typescript@>=3.2.1 <3.6.0": - version "3.5.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202" - integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw== +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== uglify-js@^3.1.4: version "3.6.0" @@ -8632,6 +9058,11 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -8773,7 +9204,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -8855,7 +9286,7 @@ write-file-atomic@2.4.1: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: +write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.2: version "2.4.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== @@ -8864,7 +9295,7 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-json-file@^2.2.0, write-json-file@^2.3.0: +write-json-file@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.3.0.tgz#2b64c8a33004d54b8698c76d585a77ceb61da32f" integrity sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8= @@ -8876,6 +9307,18 @@ write-json-file@^2.2.0, write-json-file@^2.3.0: sort-keys "^2.0.0" write-file-atomic "^2.0.0" +write-json-file@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" + integrity sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ== + dependencies: + detect-indent "^5.0.0" + graceful-fs "^4.1.15" + make-dir "^2.1.0" + pify "^4.0.1" + sort-keys "^2.0.0" + write-file-atomic "^2.4.2" + write-pkg@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-pkg/-/write-pkg-3.2.0.tgz#0e178fe97820d389a8928bc79535dbe68c2cff21" @@ -8946,7 +9389,7 @@ yargs-parser@^13.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@^12.0.1, yargs@^12.0.2: +yargs@^12.0.1: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== @@ -8964,7 +9407,7 @@ yargs@^12.0.1, yargs@^12.0.2: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^13.1.0: +yargs@^13.1.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== From ccb98d8288d8f7346c0065f36a2d1ae8c054681a Mon Sep 17 00:00:00 2001 From: Ankeet Maini Date: Tue, 3 Sep 2019 01:58:40 +0530 Subject: [PATCH 043/317] fix(eslint-plugin): [expl-member-a11y] fix parameter properties (#912) --- .../rules/explicit-member-accessibility.md | 40 ++++ .../rules/explicit-member-accessibility.ts | 20 +- .../explicit-member-accessibility.test.ts | 211 ++++++++++++++++-- 3 files changed, 250 insertions(+), 21 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 9f8c313d3df..ce9163700c5 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -214,6 +214,46 @@ class Animal { } ``` +e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'explicit' } } ]` + +The following code is considered incorrect with the example override + +```ts +class Animal { + constructor(readonly animalName: string) {} +} +``` + +The following code patterns are considered correct with the example override + +```ts +class Animal { + constructor(public readonly animalName: string) {} +} + +class Animal { + constructor(public animalName: string) {} +} +``` + +e.g. `[ { accessibility: 'off', overrides: { parameterProperties: 'no-public' } } ]` + +The following code is considered incorrect with the example override + +```ts +class Animal { + constructor(public readonly animalName: string) {} +} +``` + +The following code is considered correct with the example override + +```ts +class Animal { + constructor(public animalName: string) {} +} +``` + #### Disable any checks on given member type e.g. `[{ overrides: { accessors : 'off' } } ]` diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 21a5a8cda18..a1d61d56ded 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -196,8 +196,24 @@ export default util.createRule({ : // has to be an Identifier or TSC will throw an error (node.parameter.left as TSESTree.Identifier).name; - if (paramPropCheck === 'no-public' && node.accessibility === 'public') { - reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName); + switch (paramPropCheck) { + case 'explicit': { + if (!node.accessibility) { + reportIssue('missingAccessibility', nodeType, node, nodeName); + } + break; + } + case 'no-public': { + if (node.accessibility === 'public' && node.readonly) { + reportIssue( + 'unwantedPublicAccessibility', + nodeType, + node, + nodeName, + ); + } + break; + } } } diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index abf6ca2b25e..051cfb30642 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -10,6 +10,104 @@ ruleTester.run('explicit-member-accessibility', rule, { { filename: 'test.ts', code: ` +class Test { + public constructor(private foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(protected foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(public foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(private readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'off' }, + }, + ], + }, + { + filename: 'test.ts', + code: ` class Test { protected name: string private x: number @@ -147,11 +245,90 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: ` +class Test { + constructor(public foo: number){} +} + `, + options: [ + { + accessibility: 'no-public', + }, + ], + }, ], invalid: [ { filename: 'test.ts', code: ` +export class XXXX { + public constructor(readonly value: string) {} +} + `, + options: [ + { + accessibility: 'off', + overrides: { + parameterProperties: 'explicit', + }, + }, + ], + errors: [ + { + messageId: 'missingAccessibility', + column: 22, + line: 3, + }, + ], + }, + { + filename: 'test.ts', + code: ` +export class WithParameterProperty { + public constructor(readonly value: string) {} +} + `, + options: [{ accessibility: 'explicit' }], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` +export class XXXX { + public constructor(readonly samosa: string) {} +} + `, + options: [ + { + accessibility: 'off', + overrides: { + constructors: 'explicit', + parameterProperties: 'explicit', + }, + }, + ], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` +class Test { + public constructor(readonly foo: string) {} +} + `, + options: [ + { + accessibility: 'explicit', + overrides: { parameterProperties: 'explicit' }, + }, + ], + errors: [{ messageId: 'missingAccessibility' }], + }, + { + filename: 'test.ts', + code: ` class Test { x: number public getX () { @@ -365,18 +542,21 @@ class Test { code: ` class Test { constructor(public x: number){} + public foo(): string { + return 'foo'; + } } `, errors: [ { - messageId: 'unwantedPublicAccessibility', + messageId: 'missingAccessibility', line: 3, - column: 15, + column: 3, }, ], options: [ { - accessibility: 'no-public', + overrides: { parameterProperties: 'no-public' }, }, ], }, @@ -385,9 +565,6 @@ class Test { code: ` class Test { constructor(public x: number){} - public foo(): string { - return 'foo'; - } } `, errors: [ @@ -396,30 +573,26 @@ class Test { line: 3, column: 3, }, - { - messageId: 'unwantedPublicAccessibility', - line: 3, - column: 15, - }, - ], - options: [ - { - overrides: { parameterProperties: 'no-public' }, - }, ], }, { filename: 'test.ts', code: ` class Test { - constructor(public x: number){} + constructor(public readonly x: number){} } `, + options: [ + { + accessibility: 'off', + overrides: { parameterProperties: 'no-public' }, + }, + ], errors: [ { - messageId: 'missingAccessibility', + messageId: 'unwantedPublicAccessibility', line: 3, - column: 3, + column: 15, }, ], }, From 736a074b80eafd88376a90e6595a42217d939890 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 3 Sep 2019 08:25:40 -0700 Subject: [PATCH 044/317] =?UTF-8?q?docs(eslint-plugin):=20explicitly=20doc?= =?UTF-8?q?ument=20mixed=20codebase=20usage=20fo=E2=80=A6=20(#939)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rules/explicit-function-return-type.md | 22 ++++++++++++++ .../rules/explicit-member-accessibility.md | 30 ++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 5f729129b7a..7e3093ebfaa 100644 --- a/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ b/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -78,6 +78,28 @@ const defaults = { }; ``` +### Configuring in a mixed JS/TS codebase + +If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files. + +```jsonc +{ + "rules": { + // disable the rule for all files + "@typescript-eslint/explicit-function-return-type": "off" + }, + "overrides": [ + { + // enable the rule specifically for TypeScript files + "files": ["*.ts", "*.tsx"], + "rules": { + "@typescript-eslint/explicit-function-return-type": ["error"] + } + } + ] +} +``` + ### allowExpressions Examples of **incorrect** code for this rule with `{ allowExpressions: true }`: diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index ce9163700c5..38be4f21a3c 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -18,7 +18,7 @@ type AccessibilityLevel = | 'no-public' // don't require public | 'off'; // don't check -interface Config { +type Options = { accessibility?: AccessibilityLevel; overrides?: { accessors?: AccessibilityLevel; @@ -28,14 +28,36 @@ interface Config { parameterProperties?: AccessibilityLevel; }; } + +const defaultOptions: Options = { + accessibility: 'explicit', +}; ``` -Default config: +### Configuring in a mixed JS/TS codebase + +If you are working on a codebase within which you lint non-TypeScript code (i.e. `.js`/`.jsx`), you should ensure that you should use [ESLint `overrides`](https://eslint.org/docs/user-guide/configuring#disabling-rules-only-for-a-group-of-files) to only enable the rule on `.ts`/`.tsx` files. If you don't, then you will get unfixable lint errors reported within `.js`/`.jsx` files. -```JSON -{ "accessibility": "explicit" } +```jsonc +{ + "rules": { + // disable the rule for all files + "@typescript-eslint/explicit-member-accessibility": "off" + }, + "overrides": [ + { + // enable the rule specifically for TypeScript files + "files": ["*.ts", "*.tsx"], + "rules": { + "@typescript-eslint/explicit-member-accessibility": ["error"] + } + } + ] +} ``` +### `accessibility` + This rule in it's default state requires no configuration and will enforce that every class member has an accessibility modifier. If you would like to allow for some implicit public members then you have the following options: A possible configuration could be: From 6a5c77cf048e5415faa75a5b7a6b5714b6c47d08 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 3 Sep 2019 08:59:39 -0700 Subject: [PATCH 045/317] docs(eslint-plugin): fix formatting typo --- .../eslint-plugin/docs/rules/explicit-member-accessibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 38be4f21a3c..96295809138 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -27,7 +27,7 @@ type Options = { properties?: AccessibilityLevel; parameterProperties?: AccessibilityLevel; }; -} +}; const defaultOptions: Options = { accessibility: 'explicit', From e9fcf70da607f5aca4ed4cae26089923b9824908 Mon Sep 17 00:00:00 2001 From: Anandaroop Roy Date: Fri, 6 Sep 2019 12:30:57 -0400 Subject: [PATCH 046/317] docs: Update supported TypeScript version range (#951) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fb38e91766..216f89cdc37 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ The latest version under the `canary` tag **(latest commit to master)** is: 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. -**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.6.0`.** +**The version range of TypeScript currently supported by this parser is `>=3.2.1 <3.7.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. From e01dc5f1dfbb7a0ac7641314f0fa2f23c2dd2248 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 6 Sep 2019 22:08:34 +0300 Subject: [PATCH 047/317] feat(eslint-plugin): add brace-style [extension] (#810) --- packages/eslint-plugin/README.md | 1 + .../eslint-plugin/docs/rules/brace-style.md | 22 + packages/eslint-plugin/src/configs/all.json | 2 + .../eslint-plugin/src/rules/brace-style.ts | 45 + packages/eslint-plugin/src/rules/index.ts | 2 + .../tests/rules/brace-style.test.ts | 1113 +++++++++++++++++ .../eslint-plugin/tools/generate-configs.ts | 1 + .../eslint-plugin/typings/eslint-rules.d.ts | 27 + 8 files changed, 1213 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/brace-style.md create mode 100644 packages/eslint-plugin/src/rules/brace-style.ts create mode 100644 packages/eslint-plugin/tests/rules/brace-style.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index a3ce816616b..178ca903a9f 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -145,6 +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/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: | | | diff --git a/packages/eslint-plugin/docs/rules/brace-style.md b/packages/eslint-plugin/docs/rules/brace-style.md new file mode 100644 index 00000000000..908fca707c1 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/brace-style.md @@ -0,0 +1,22 @@ +# Enforce consistent brace style for blocks + +## Rule Details + +This rule extends the base [eslint/brace-style](https://eslint.org/docs/rules/brace-style) rule. +It supports all options and features of the base rule. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "brace-style": "off", + "@typescript-eslint/brace-style": ["error"] +} +``` + +## Options + +See [eslint/brace-style options](https://eslint.org/docs/rules/brace-style#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/brace-style.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index cce896718db..0974b7a7263 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -6,6 +6,8 @@ "@typescript-eslint/await-thenable": "error", "@typescript-eslint/ban-ts-ignore": "error", "@typescript-eslint/ban-types": "error", + "brace-style": "off", + "@typescript-eslint/brace-style": "error", "camelcase": "off", "@typescript-eslint/camelcase": "error", "@typescript-eslint/class-name-casing": "error", diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts new file mode 100644 index 00000000000..0f0f75afb30 --- /dev/null +++ b/packages/eslint-plugin/src/rules/brace-style.ts @@ -0,0 +1,45 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/brace-style'; +import * as util from '../util'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'brace-style', + meta: { + type: 'layout', + docs: { + description: 'Enforce consistent brace style for blocks', + category: 'Stylistic Issues', + recommended: false, + }, + messages: baseRule.meta.messages, + fixable: baseRule.meta.fixable, + schema: baseRule.meta.schema, + }, + defaultOptions: ['1tbs'], + create(context) { + const rules = baseRule.create(context); + const checkBlockStatement = ( + node: TSESTree.TSModuleBlock | TSESTree.TSInterfaceBody, + ): void => { + rules.BlockStatement({ + type: AST_NODE_TYPES.BlockStatement, + parent: node.parent, + range: node.range, + body: node.body as any, // eslint-disable-line @typescript-eslint/no-explicit-any + loc: node.loc, + }); + }; + + return { + ...rules, + TSInterfaceBody: checkBlockStatement, + TSModuleBlock: checkBlockStatement, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index bd39c7867e3..8ae9d698cca 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -3,6 +3,7 @@ import arrayType from './array-type'; import awaitThenable from './await-thenable'; import banTsIgnore from './ban-ts-ignore'; import banTypes from './ban-types'; +import braceStyle from './brace-style'; import camelcase from './camelcase'; import classNameCasing from './class-name-casing'; import consistentTypeAssertions from './consistent-type-assertions'; @@ -67,6 +68,7 @@ export default { 'await-thenable': awaitThenable, 'ban-ts-ignore': banTsIgnore, 'ban-types': banTypes, + 'brace-style': braceStyle, camelcase: camelcase, 'class-name-casing': classNameCasing, 'consistent-type-assertions': consistentTypeAssertions, diff --git a/packages/eslint-plugin/tests/rules/brace-style.test.ts b/packages/eslint-plugin/tests/rules/brace-style.test.ts new file mode 100644 index 00000000000..d1f586afc2f --- /dev/null +++ b/packages/eslint-plugin/tests/rules/brace-style.test.ts @@ -0,0 +1,1113 @@ +import rule from '../../src/rules/brace-style'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: {}, + }, +}); + +ruleTester.run('brace-style', rule, { + valid: [ + { + code: ` +function f() { + if (true) + return { x: 1 }; + else { + var y = 2; + return y; + } +} + `, + }, + { + code: ` +if (tag === 1) glyph.id = pbf.readVarint(); +else if (tag === 2) glyph.bitmap = pbf.readBytes(); + `, + }, + { + code: ` +function foo () { + return; +} + `, + }, + { + code: ` +function a(b, +c, +d) { } + `, + }, + { + code: ` +!function foo () { + return; +} + `, + }, + { + code: ` +!function a(b, +c, +d) { } + `, + }, + { + code: ` +if (foo) { + bar(); +} + `, + }, + { + code: ` +if (a) { + b(); +} else { + c(); +} + `, + }, + { + code: ` +while (foo) { + bar(); +} + `, + }, + { + code: ` +for (;;) { + bar(); +} + `, + }, + { + code: ` +with (foo) { + bar(); +} + `, + }, + { + code: ` +switch (foo) { + case 'bar': break; +} + `, + }, + { + code: ` +try { + bar(); +} catch (e) { + baz(); +} + `, + }, + { + code: ` +do { + bar(); +} while (true) + `, + }, + { + code: ` +for (foo in bar) { + baz(); +} + `, + }, + { + code: ` +if (a && + b && + c) { + } + `, + }, + { + code: ` +switch(0) { +} + `, + }, + { + code: ` +class Foo { +} + `, + }, + { + code: ` +(class { +}) + `, + }, + { + code: ` +class +Foo { +} + `, + }, + { + code: ` +class Foo { + bar() { + } +} + `, + }, + { + code: ` +if (foo) { +} +else { +} + `, + options: ['stroustrup'], + }, + { + code: ` +if (foo) +{ +} +else +{ +} + `, + options: ['allman'], + }, + { + code: ` +try { + bar(); +} +catch (e) { + baz(); +} + `, + options: ['stroustrup'], + }, + { + code: ` +try +{ + bar(); +} +catch (e) +{ + baz(); +} + `, + options: ['allman'], + }, + { + code: `function foo () { return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `function foo () { a(); b(); return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `function a(b,c,d) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `!function foo () { return; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `!function a(b,c,d) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (a) { b(); } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `while (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `for (;;) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `with (foo) { bar(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `switch (foo) { case 'bar': break; }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `try { bar(); } catch (e) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `do { bar(); } while (true)`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `for (foo in bar) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `if (a && b && c) { }`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `switch(0) {}`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: ` +if (foo) {} +else {} + `, + options: ['stroustrup', { allowSingleLine: true }], + }, + { + code: ` +try { bar(); } +catch (e) { baz(); } + `, + options: ['stroustrup', { allowSingleLine: true }], + }, + { + code: `var foo = () => { return; }`, + options: ['stroustrup', { allowSingleLine: true }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` +if (foo) {} +else {} + `, + options: ['allman', { allowSingleLine: true }], + }, + { + code: ` +try { bar(); } +catch (e) { baz(); } + `, + options: ['allman', { allowSingleLine: true }], + }, + { + code: `var foo = () => { return; }`, + options: ['allman', { allowSingleLine: true }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: ` +if (tag === 1) fontstack.name = pbf.readString(); +else if (tag === 2) fontstack.range = pbf.readString(); +else if (tag === 3) { + var glyph = pbf.readMessage(readGlyph, {}); + fontstack.glyphs[glyph.id] = glyph; +} + `, + options: ['1tbs'], + }, + { + code: ` +if (tag === 1) fontstack.name = pbf.readString(); +else if (tag === 2) fontstack.range = pbf.readString(); +else if (tag === 3) { + var glyph = pbf.readMessage(readGlyph, {}); + fontstack.glyphs[glyph.id] = glyph; +} + `, + options: ['stroustrup'], + }, + { + code: ` +switch(x) +{ + case 1: + bar(); +} + `, + options: ['allman'], + }, + { + code: `switch(x) {}`, + options: ['allman', { allowSingleLine: true }], + }, + { + code: ` +class Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +(class { +}) + `, + options: ['stroustrup'], + }, + { + code: ` +class Foo +{ +} + `, + options: ['allman'], + }, + { + code: ` +(class +{ +}) + `, + options: ['allman'], + }, + { + code: ` +class +Foo +{ +} + `, + options: ['allman'], + }, + { + code: `class Foo {}`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `class Foo {}`, + options: ['allman', { allowSingleLine: true }], + }, + { + code: `(class {})`, + options: ['1tbs', { allowSingleLine: true }], + }, + { + code: `(class {})`, + options: ['allman', { allowSingleLine: true }], + }, + + // https://github.com/eslint/eslint/issues/7908 + { + code: `{}`, + }, + { + code: ` +if (foo) { +} +{ +} + `, + }, + { + code: ` +switch (foo) { + case bar: + baz(); + { + qux(); + } +} + `, + }, + { + code: ` +{ +} + `, + }, + { + code: ` +{ + { + } +} + `, + }, + + // https://github.com/eslint/eslint/issues/7974 + { + code: ` +class Ball { + throw() {} + catch() {} +} + `, + }, + { + code: ` +({ + and() {}, + finally() {} +}) + `, + }, + { + code: ` +(class { + or() {} + else() {} +}) + `, + }, + { + code: ` +if (foo) bar = function() {} +else baz() + `, + }, + { + code: ` +interface Foo { +} + `, + options: ['1tbs'], + }, + { + code: ` +interface Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +interface Foo +{ +} + `, + options: ['allman'], + }, + { + code: ` +module "Foo" { +} + `, + options: ['1tbs'], + }, + { + code: ` +module "Foo" { +} + `, + options: ['stroustrup'], + }, + { + code: ` +module "Foo" +{ +} + `, + options: ['allman'], + }, + { + code: ` +namespace Foo { +} + `, + options: ['1tbs'], + }, + { + code: ` +namespace Foo { +} + `, + options: ['stroustrup'], + }, + { + code: ` +namespace Foo +{ +} + `, + options: ['allman'], + }, + ], + + invalid: [ + { + code: ` +if (f) { + bar; +} +else + baz; + `, + output: ` +if (f) { + bar; +} else + baz; + `, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `var foo = () => { return; }`, + output: `var foo = () => {\n return; \n}`, + parserOptions: { ecmaVersion: 6 }, + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `function foo() { return; }`, + output: `function foo() {\n return; \n}`, + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `function foo() \n { \n return; }`, + output: `function foo() { \n return; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `!function foo() \n { \n return; }`, + output: `!function foo() { \n return; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `if (foo) \n { \n bar(); }`, + output: `if (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `if (a) { \nb();\n } else \n { c(); }`, + output: `if (a) { \nb();\n } else {\n c(); \n}`, + errors: [ + { messageId: 'nextLineOpen' }, + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `while (foo) \n { \n bar(); }`, + output: `while (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `for (;;) \n { \n bar(); }`, + output: `for (;;) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `with (foo) \n { \n bar(); }`, + output: `with (foo) { \n bar(); \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { \n case 'bar': break; }`, + output: `switch (foo) { \n case 'bar': break; \n}`, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { }`, + output: `switch (foo) { }`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try \n { \n bar(); \n } catch (e) {}`, + output: `try { \n bar(); \n } catch (e) {}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n } catch (e) \n {}`, + output: `try { \n bar(); \n } catch (e) {}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `do \n { \n bar(); \n} while (true)`, + output: `do { \n bar(); \n} while (true)`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo in bar) \n { \n baz(); \n }`, + output: `for (foo in bar) { \n baz(); \n }`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo of bar) \n { \n baz(); \n }`, + output: `for (foo of bar) { \n baz(); \n }`, + parserOptions: { ecmaVersion: 6 }, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n}`, + output: `try { \n bar(); \n } catch (e) {\n}`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n } catch (e) {\n} finally {\n}`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `if (a) { \nb();\n } \n else { \nc();\n }`, + output: `if (a) { \nb();\n } else { \nc();\n }`, + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n} finally {\n}`, + output: `try { \n bar(); \n }\ncatch (e) {\n}\n finally {\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) { \nb();\n }\n else { \nc();\n }`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + output: `if (foo) {\nbaz();\n}\n else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo) {\npoop();\n} \nelse if (bar) {\nbaz();\n}\n else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + options: ['stroustrup'], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + output: `try \n{ \n bar(); \n }\n catch (e) \n{\n}\n finally \n{\n}`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen', line: 1 }, + { messageId: 'sameLineOpen', line: 4 }, + { messageId: 'sameLineOpen', line: 6 }, + ], + }, + { + code: `switch(x) { case 1: \nbar(); }\n `, + output: `switch(x) \n{\n case 1: \nbar(); \n}\n `, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen', line: 1 }, + { messageId: 'blockSameLine', line: 1 }, + { messageId: 'singleLineClose', line: 2 }, + ], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) \n{ \nb();\n }\n else \n{ \nc();\n }`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo) {\nbaz();\n} else if (bar) {\nbaz();\n}\nelse {\nqux();\n}`, + output: `if (foo) \n{\nbaz();\n}\n else if (bar) \n{\nbaz();\n}\nelse \n{\nqux();\n}`, + options: ['allman'], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}`, + options: ['allman'], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + { + code: `if (foo)\n{\n bar(); }`, + output: `if (foo)\n{\n bar(); \n}`, + options: ['allman'], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `try\n{\n somethingRisky();\n} catch (e)\n{\n handleError()\n}`, + output: `try\n{\n somethingRisky();\n}\n catch (e)\n{\n handleError()\n}`, + options: ['allman'], + errors: [{ messageId: 'sameLineClose' }], + }, + + // allowSingleLine: true + { + code: `function foo() { return; \n}`, + output: `function foo() {\n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `function foo() { a(); b(); return; \n}`, + output: `function foo() {\n a(); b(); return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `function foo() { \n return; }`, + output: `function foo() { \n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `function foo() {\na();\nb();\nreturn; }`, + output: `function foo() {\na();\nb();\nreturn; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `!function foo() { \n return; }`, + output: `!function foo() { \n return; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (a) { b();\n } else { c(); }`, + output: `if (a) {\n b();\n } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `if (a) { b(); }\nelse { c(); }`, + output: `if (a) { b(); } else { c(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `while (foo) { \n bar(); }`, + output: `while (foo) { \n bar(); \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `for (;;) { bar(); \n }`, + output: `for (;;) {\n bar(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `with (foo) { bar(); \n }`, + output: `with (foo) {\n bar(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'blockSameLine' }], + }, + { + code: `switch (foo) \n { \n case \`bar\`: break; }`, + output: `switch (foo) { \n case \`bar\`: break; \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'singleLineClose' }], + }, + { + code: `switch (foo) \n { }`, + output: `switch (foo) { }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { bar(); }\ncatch (e) { baz(); }`, + output: `try { bar(); } catch (e) { baz(); }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try \n { \n bar(); \n } catch (e) {}`, + output: `try { \n bar(); \n } catch (e) {}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n } catch (e) \n {}`, + output: `try { \n bar(); \n } catch (e) {}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `do \n { \n bar(); \n} while (true)`, + output: `do { \n bar(); \n} while (true)`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `for (foo in bar) \n { \n baz(); \n }`, + output: `for (foo in bar) { \n baz(); \n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n}`, + output: `try { \n bar(); \n } catch (e) {\n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n } catch (e) {\n} finally {\n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `if (a) { \nb();\n } \n else { \nc();\n }`, + output: `if (a) { \nb();\n } else { \nc();\n }`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'nextLineClose' }], + }, + { + code: `try { \n bar(); \n }\ncatch (e) {\n} finally {\n}`, + output: `try { \n bar(); \n }\ncatch (e) {\n}\n finally {\n}`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `try { \n bar(); \n } catch (e) {\n}\n finally {\n}`, + output: `try { \n bar(); \n }\n catch (e) {\n}\n finally {\n}`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (a) { \nb();\n } else { \nc();\n }`, + output: `if (a) { \nb();\n }\n else { \nc();\n }`, + options: ['stroustrup', { allowSingleLine: true }], + errors: [{ messageId: 'sameLineClose' }], + }, + { + code: `if (foo)\n{ poop();\n} \nelse if (bar) {\nbaz();\n} else if (thing) {\nboom();\n}\nelse {\nqux();\n}`, + output: `if (foo)\n{\n poop();\n} \nelse if (bar) \n{\nbaz();\n}\n else if (thing) \n{\nboom();\n}\nelse \n{\nqux();\n}`, + options: ['allman', { allowSingleLine: true }], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineClose' }, + { messageId: 'sameLineOpen' }, + { messageId: 'sameLineOpen' }, + ], + }, + + // Comment interferes with fix + { + code: `if (foo) // comment \n{\nbar();\n}`, + output: null, + errors: [{ messageId: 'nextLineOpen' }], + }, + + // https://github.com/eslint/eslint/issues/7493 + { + code: `if (foo) {\n bar\n.baz }`, + output: `if (foo) {\n bar\n.baz \n}`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (foo)\n{\n bar\n.baz }`, + output: `if (foo)\n{\n bar\n.baz \n}`, + options: ['allman'], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `if (foo) { bar\n.baz }`, + output: `if (foo) {\n bar\n.baz \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [ + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `if (foo) { bar\n.baz }`, + output: `if (foo) \n{\n bar\n.baz \n}`, + options: ['allman', { allowSingleLine: true }], + errors: [ + { messageId: 'sameLineOpen' }, + { messageId: 'blockSameLine' }, + { messageId: 'singleLineClose' }, + ], + }, + { + code: `switch (x) {\n case 1: foo() }`, + output: `switch (x) {\n case 1: foo() \n}`, + options: ['1tbs', { allowSingleLine: true }], + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `class Foo\n{\n}`, + output: `class Foo {\n}`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `(class\n{\n})`, + output: `(class {\n})`, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `class Foo{\n}`, + output: `class Foo\n{\n}`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: `(class {\n})`, + output: `(class \n{\n})`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: `class Foo {\nbar() {\n}}`, + output: `class Foo {\nbar() {\n}\n}`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `(class Foo {\nbar() {\n}})`, + output: `(class Foo {\nbar() {\n}\n})`, + errors: [{ messageId: 'singleLineClose' }], + }, + { + code: `class\nFoo{}`, + output: `class\nFoo\n{}`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + + // https://github.com/eslint/eslint/issues/7621 + { + code: ` +if (foo) +{ + bar +} +else { + baz +} + `, + output: ` +if (foo) { + bar +} else { + baz +} + `, + errors: [{ messageId: 'nextLineOpen' }, { messageId: 'nextLineClose' }], + }, + { + code: ` +interface Foo +{ +} + `, + output: ` +interface Foo { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +interface Foo +{ +} + `, + output: ` +interface Foo { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `interface Foo { \n }`, + output: `interface Foo \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: ` +module "Foo" +{ +} + `, + output: ` +module "Foo" { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +module "Foo" +{ +} + `, + output: ` +module "Foo" { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `module "Foo" { \n }`, + output: `module "Foo" \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + { + code: ` +namespace Foo +{ +} + `, + output: ` +namespace Foo { +} + `, + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: ` +namespace Foo +{ +} + `, + output: ` +namespace Foo { +} + `, + options: ['stroustrup'], + errors: [{ messageId: 'nextLineOpen' }], + }, + { + code: `namespace Foo { \n }`, + output: `namespace Foo \n{ \n }`, + options: ['allman'], + errors: [{ messageId: 'sameLineOpen' }], + }, + ], +}); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index b400ca05722..664504783f0 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -22,6 +22,7 @@ const RULE_NAME_PREFIX = '@typescript-eslint/'; const MAX_RULE_NAME_LENGTH = 32; const DEFAULT_RULE_SETTING = 'warn'; const BASE_RULES_TO_BE_OVERRIDDEN = new Set([ + 'brace-style', 'camelcase', 'func-call-spacing', 'indent', diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 9eb02d5cce0..de6545f744d 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -482,3 +482,30 @@ declare module 'eslint/lib/rules/quotes' { >; export = rule; } + +declare module 'eslint/lib/rules/brace-style' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + | 'nextLineOpen' + | 'sameLineOpen' + | 'blockSameLine' + | 'nextLineClose' + | 'singleLineClose' + | 'sameLineClose', + [ + '1tbs' | 'stroustrup' | 'allman', + { + allowSingleLine?: boolean; + }?, + ], + { + BlockStatement(node: TSESTree.BlockStatement): void; + ClassBody(node: TSESTree.ClassBody): void; + SwitchStatement(node: TSESTree.SwitchStatement): void; + IfStatement(node: TSESTree.IfStatement): void; + TryStatement(node: TSESTree.TryStatement): void; + } + >; + export = rule; +} From e011e90d2b975f70ace8c22e96f08b0a102cdb35 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sat, 7 Sep 2019 03:11:19 +0300 Subject: [PATCH 048/317] fix(eslint-plugin): [prefer-readonly] add handling for destructuring assignments --- .../src/rules/prefer-readonly.ts | 31 +++++++++++- .../tests/rules/prefer-readonly.test.ts | 48 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 2c8ab3671be..280213dde0f 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -68,7 +68,7 @@ export default util.createRule({ return; } - if (ts.isDeleteExpression(parent)) { + if (ts.isDeleteExpression(parent) || isDestructuringAssignment(node)) { classScope.addVariableModification(node); return; } @@ -108,6 +108,35 @@ export default util.createRule({ } } + function isDestructuringAssignment( + node: ts.PropertyAccessExpression, + ): boolean { + let current: ts.Node = node.parent; + + while (current) { + const parent = current.parent; + + if ( + ts.isObjectLiteralExpression(parent) || + ts.isArrayLiteralExpression(parent) || + ts.isSpreadAssignment(parent) || + (ts.isSpreadElement(parent) && + ts.isArrayLiteralExpression(parent.parent)) + ) { + current = parent; + } else if (ts.isBinaryExpression(parent)) { + return ( + parent.left === current && + parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ); + } else { + break; + } + } + + return false; + } + function isConstructor(node: TSESTree.Node): boolean { return ( node.type === AST_NODE_TYPES.MethodDefinition && diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index 5b2a6687339..8d6ffbf0f7a 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -220,6 +220,54 @@ ruleTester.run('prefer-readonly', rule, { this['computed'] = 1; } }`, + { + code: ` +class Foo { + private value: number = 0 + + bar(newValue: { value: number }) { + ({ value: this.value } = newValue); + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: Record = {}; + + bar(newValue: Record) { + ({ ...this.value } = newValue); + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: number[] = [] + + bar(newValue: number[]) { + [...this.value] = newValue; + return this.value; + } +} + `, + }, + { + code: ` +class Foo { + private value: number = 0; + + bar(newValue: number[]) { + [this.value] = newValue; + return this.value; + } +} + `, + }, ], invalid: [ { From f1059d82eae77e6d78800ed38ac1ce89692a419f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sat, 7 Sep 2019 08:34:38 +0300 Subject: [PATCH 049/317] fix(eslint-plugin): [efrt] allowExpressions - check functions in class field properties (#952) --- .../rules/explicit-function-return-type.ts | 3 +- .../explicit-function-return-type.test.ts | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b050578c189..43a1cac41fb 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -335,7 +335,8 @@ export default util.createRule({ options.allowExpressions && node.parent.type !== AST_NODE_TYPES.VariableDeclarator && node.parent.type !== AST_NODE_TYPES.MethodDefinition && - node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && + node.parent.type !== AST_NODE_TYPES.ClassProperty ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index 0c67b903cee..bd69534089d 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -516,6 +516,57 @@ function test() { }, ], }, + { + filename: 'test.ts', + code: ` +class Foo { + public a = () => {}; + public b = function () {}; + public c = function test() {}; + + static d = () => {}; + static e = function () {}; +} + `, + options: [{ allowExpressions: true }], + errors: [ + { + messageId: 'missingReturnType', + line: 3, + endLine: 3, + column: 14, + endColumn: 19, + }, + { + messageId: 'missingReturnType', + line: 4, + endLine: 4, + column: 14, + endColumn: 25, + }, + { + messageId: 'missingReturnType', + line: 5, + endLine: 5, + column: 14, + endColumn: 29, + }, + { + messageId: 'missingReturnType', + line: 7, + endLine: 7, + column: 14, + endColumn: 19, + }, + { + messageId: 'missingReturnType', + line: 8, + endLine: 8, + column: 14, + endColumn: 25, + }, + ], + }, { filename: 'test.ts', code: "var arrowFn = () => 'test';", From d8767f01245b0d817a6921e79aa0a5f1b19c8b2a Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 9 Sep 2019 17:02:20 +0000 Subject: [PATCH 050/317] chore: publish v2.2.0 --- CHANGELOG.md | 18 ++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 18 ++++++++++++++++++ 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 | 8 ++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 91 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 547ce16d62b..870ae588ac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] allowExpressions - check functions in class field properties ([#952](https://github.com/typescript-eslint/typescript-eslint/issues/952)) ([f1059d8](https://github.com/typescript-eslint/typescript-eslint/commit/f1059d8)) +* **eslint-plugin:** [expl-member-a11y] fix parameter properties ([#912](https://github.com/typescript-eslint/typescript-eslint/issues/912)) ([ccb98d8](https://github.com/typescript-eslint/typescript-eslint/commit/ccb98d8)) +* **eslint-plugin:** [prefer-readonly] add handling for destructuring assignments ([e011e90](https://github.com/typescript-eslint/typescript-eslint/commit/e011e90)) + + +### Features + +* **eslint-plugin:** add brace-style [extension] ([#810](https://github.com/typescript-eslint/typescript-eslint/issues/810)) ([e01dc5f](https://github.com/typescript-eslint/typescript-eslint/commit/e01dc5f)) + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) diff --git a/lerna.json b/lerna.json index 0380f9287e8..d605df702a9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.0", + "version": "2.2.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index ff9b5e6cece..ce13360be83 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.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **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 7250c2f6cb7..bcf7455d69d 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.1.0", + "version": "2.2.0", "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.1.0", + "@typescript-eslint/experimental-utils": "2.2.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.1.0" + "@typescript-eslint/parser": "2.2.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 699d0e12c9b..7e0867066c8 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + + +### Bug Fixes + +* **eslint-plugin:** [efrt] allowExpressions - check functions in class field properties ([#952](https://github.com/typescript-eslint/typescript-eslint/issues/952)) ([f1059d8](https://github.com/typescript-eslint/typescript-eslint/commit/f1059d8)) +* **eslint-plugin:** [expl-member-a11y] fix parameter properties ([#912](https://github.com/typescript-eslint/typescript-eslint/issues/912)) ([ccb98d8](https://github.com/typescript-eslint/typescript-eslint/commit/ccb98d8)) +* **eslint-plugin:** [prefer-readonly] add handling for destructuring assignments ([e011e90](https://github.com/typescript-eslint/typescript-eslint/commit/e011e90)) + + +### Features + +* **eslint-plugin:** add brace-style [extension] ([#810](https://github.com/typescript-eslint/typescript-eslint/issues/810)) ([e01dc5f](https://github.com/typescript-eslint/typescript-eslint/commit/e01dc5f)) + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c4b76fa4bdb..7a8a84a0e2d 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.1.0", + "version": "2.2.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.1.0", + "@typescript-eslint/experimental-utils": "2.2.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 4ed8006f4c7..9352d0a4c46 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.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **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 5b87c0b88e1..a28cfb2c89e 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.1.0", + "version": "2.2.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.1.0", + "@typescript-eslint/typescript-estree": "2.2.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 0a9561dc15f..507eac315f7 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.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) diff --git a/packages/parser/package.json b/packages/parser/package.json index 2f5012268b7..9deee00e0bb 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.1.0", + "version": "2.2.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.1.0", - "@typescript-eslint/typescript-estree": "2.1.0", + "@typescript-eslint/experimental-utils": "2.2.0", + "@typescript-eslint/typescript-estree": "2.2.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.1.0", + "@typescript-eslint/shared-fixtures": "2.2.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 4f65be77af0..4dfa4cd5e51 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.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) **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 86b93d8157c..4081dcf5f03 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.1.0", + "version": "2.2.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 0fea11fa0f9..4fff19407f1 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.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + # [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 13cc8202dd9..b1edc190b3e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.1.0", + "version": "2.2.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.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.1.0", + "@typescript-eslint/shared-fixtures": "2.2.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From b99e83167ebc9ca97ce9c932a007e5066b4f5616 Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 12 Sep 2019 10:16:26 +0200 Subject: [PATCH 051/317] docs: financial contributors and TSLint migration updates (#970) --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 7 ++++++- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 216f89cdc37..b5736851523 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@

Azure Pipelines + GitHub license NPM Downloads Codecov @@ -60,6 +61,14 @@ Palantir, the backers behind TSLint announced earlier this year that **they woul The TypeScript Team themselves also announced their plans to move the TypeScript codebase from TSLint to `typescript-eslint`, and they have been big supporters of this project. More details at https://github.com/microsoft/TypeScript/issues/30553 +### Migrating from TSLint to ESLint + +If you are looking for help in migrating from TSLint to ESLint, you can check out this project: https://github.com/typescript-eslint/tslint-to-eslint-config + +You can look at [`the plugin ROADMAP.md`](./packages/eslint-plugin/ROADMAP.md) for an up to date overview of how TSLint rules compare to the ones in this package. + +There is also the ultimate fallback option of using both linters together for a while during your transition if you absolutely have to by using TSLint _within_ ESLint. For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](./packages/eslint-plugin-tslint/). +
## How does `typescript-eslint` work and why do you have multiple packages? @@ -161,6 +170,8 @@ See an issue? Report it in as much detail as possible, ideally with a clear and If you have the time and the inclination, you can even take it a step further and submit a PR to improve the project. +There are also financial ways to contribute, please see [Financial Contributors](#Financial-Contributors) for more details. + All positive contributions are welcome here!
@@ -223,9 +234,44 @@ TypeScript ESLint inherits from the the original TypeScript ESLint Parser licens
-## Contributors +## Code Contributors + +This project exists thanks to every one of the awesome people who contribute code and documentation: + +
+ + + +
+ +🙏 An extra special thanks goes out to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md) + +
+ +## Financial Contributors + +In addition to submitting code and documentation updates, you can help us sustain our community by becoming a financial contributor [[Click here to contribute - every little helps!](https://opencollective.com/typescript-eslint/contribute)] + +
+ +### Individuals + + + +### Organizations + +Support this project with your organization. Your logo will show up here with a link to your website. [[Click here to contribute - every little helps!](https://opencollective.com/typescript-eslint/contribute)] -Thanks goes to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md). + + + + + + + + + +
diff --git a/package.json b/package.json index 2cd6dc2b9e3..2dce8eb9335 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint-fix": "eslint . --ext .js,.ts --fix", "pre-commit": "yarn lint-staged", "pre-push": "yarn format-check", - "postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install", + "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", "typecheck": "lerna run typecheck" @@ -68,11 +68,16 @@ "jest": "^24.9.0", "lerna": "^3.16.4", "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", "typescript": ">=3.2.1 <3.7.0" + }, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } From b49dbfd6b47b3b5f31ce1ba3db33d0d93ce5d6b3 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 12 Sep 2019 01:30:33 -0700 Subject: [PATCH 052/317] docs(typescript-estree): document that duplicate filenames are unsupported (#957) --- .vscode/launch.json | 14 +++++++ packages/parser/README.md | 4 +- .../src/WatchCompilerHostOfConfigFile.ts | 37 +++++++++++++++++++ .../typescript-estree/src/tsconfig-parser.ts | 35 ++++++++---------- 4 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index 35c5c3194ec..1c2b4b3dd80 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,6 +18,20 @@ "sourceMaps": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened typescript-estree test", + "cwd": "${workspaceFolder}/packages/typescript-estree/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "${relativeFile}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" } ] } diff --git a/packages/parser/README.md b/packages/parser/README.md index 042fb4f5f54..9fcb9d04363 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -66,7 +66,9 @@ The following additional configuration options are available by specifying them ]; ``` - - Note that if you use project references, TypeScript will not automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the `project` field either separately, or via a glob. + - If you use project references, TypeScript will not automatically use project references to resolve files. This means that you will have to add each referenced tsconfig to the `project` field either separately, or via a glob. + + - TypeScript will ignore files with duplicate filenames in the same folder (for example, `src/file.ts` and `src/file.js`). TypeScript purposely ignore all but one of the files, only keeping the one file with the highest priority extension (the extension priority order (from highest to lowest) is `.ts`, `.tsx`, `.d.ts`, `.js`, `.jsx`). For more info see #955. - Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: diff --git a/packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts new file mode 100644 index 00000000000..7fb4663b985 --- /dev/null +++ b/packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts @@ -0,0 +1,37 @@ +// These types are internal to TS. +// They have been trimmed down to only include the relevant bits +// We use some special internal TS apis to help us do our parsing flexibly + +import * as ts from 'typescript'; // leave this as * as ts so people using util package don't need syntheticDefaultImports + +// https://github.com/microsoft/TypeScript/blob/b84e65db4ea5c39dbaa2ccd6594efe4653318251/src/compiler/watchUtilities.ts#L6-L18 +interface DirectoryStructureHost { + readDirectory?( + path: string, + extensions?: ReadonlyArray, + exclude?: ReadonlyArray, + include?: ReadonlyArray, + depth?: number, + ): string[]; +} + +// https://github.com/microsoft/TypeScript/blob/b84e65db4ea5c39dbaa2ccd6594efe4653318251/src/compiler/watchUtilities.ts#L25-L35 +interface CachedDirectoryStructureHost extends DirectoryStructureHost { + readDirectory( + path: string, + extensions?: ReadonlyArray, + exclude?: ReadonlyArray, + include?: ReadonlyArray, + depth?: number, + ): string[]; +} + +// https://github.com/microsoft/TypeScript/blob/5d36aab06f12b0a3ba6197eb14e98204ec0195fb/src/compiler/watch.ts#L548-L554 +interface WatchCompilerHostOfConfigFile + extends ts.WatchCompilerHostOfConfigFile { + onCachedDirectoryStructureHostCreate( + host: CachedDirectoryStructureHost, + ): void; +} + +export { WatchCompilerHostOfConfigFile }; diff --git a/packages/typescript-estree/src/tsconfig-parser.ts b/packages/typescript-estree/src/tsconfig-parser.ts index 364dd0543c8..e6ef356b6f3 100644 --- a/packages/typescript-estree/src/tsconfig-parser.ts +++ b/packages/typescript-estree/src/tsconfig-parser.ts @@ -1,6 +1,7 @@ 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 @@ -13,6 +14,8 @@ export const defaultCompilerOptions: ts.CompilerOptions = { allowNonTsExtensions: true, allowJs: true, checkJs: true, + noEmit: true, + // extendedDiagnostics: true, }; /** @@ -115,7 +118,7 @@ export function calculateProjectParserOptions( ts.createSemanticDiagnosticsBuilderProgram, diagnosticReporter, /*reportWatchStatus*/ () => {}, - ); + ) as WatchCompilerHostOfConfigFile; // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; @@ -144,8 +147,7 @@ export function calculateProjectParserOptions( }; // register callbacks to trigger program updates without using fileWatchers - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type - watchCompilerHost.watchFile = (fileName, callback) => { + watchCompilerHost.watchFile = (fileName, callback): ts.FileWatcher => { const normalizedFileName = path.normalize(fileName); watchCallbackTrackingMap.set(normalizedFileName, callback); return { @@ -156,26 +158,20 @@ export function calculateProjectParserOptions( }; // ensure fileWatchers aren't created for directories - watchCompilerHost.watchDirectory = (): typeof noopFileWatcher => - noopFileWatcher; + watchCompilerHost.watchDirectory = (): ts.FileWatcher => noopFileWatcher; - // we're using internal typescript APIs which aren't on the types - /* eslint-disable @typescript-eslint/no-explicit-any */ // allow files with custom extensions to be included in program (uses internal ts api) - const oldOnDirectoryStructureHostCreate = (watchCompilerHost as any) - .onCachedDirectoryStructureHostCreate; - (watchCompilerHost as any).onCachedDirectoryStructureHostCreate = ( - host: any, - ): void => { + const oldOnDirectoryStructureHostCreate = + watchCompilerHost.onCachedDirectoryStructureHostCreate; + watchCompilerHost.onCachedDirectoryStructureHostCreate = (host): void => { const oldReadDirectory = host.readDirectory; - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type host.readDirectory = ( - path: string, - extensions?: readonly string[], - exclude?: readonly string[], - include?: readonly string[], - depth?: number, - ) => + path, + extensions, + exclude, + include, + depth, + ): string[] => oldReadDirectory( path, !extensions @@ -187,7 +183,6 @@ export function calculateProjectParserOptions( ); oldOnDirectoryStructureHostCreate(host); }; - /* eslint-enable @typescript-eslint/no-explicit-any */ // create program const programWatch = ts.createWatchProgram(watchCompilerHost); From 571548243a7ce2cc3c42134ae18c03c065b2d560 Mon Sep 17 00:00:00 2001 From: Retsam Date: Thu, 12 Sep 2019 04:42:09 -0400 Subject: [PATCH 053/317] feat(eslint-plugin): add no-unnecessary-condition rule (#699) --- packages/eslint-plugin/README.md | 1 + .../docs/rules/no-unnecessary-condition.md | 64 ++++++ .../docs/rules/strict-boolean-expressions.md | 2 + packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/no-unnecessary-condition.ts | 192 +++++++++++++++++ .../rules/no-unnecessary-condition.test.ts | 195 ++++++++++++++++++ 7 files changed, 457 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/no-unnecessary-condition.md create mode 100644 packages/eslint-plugin/src/rules/no-unnecessary-condition.ts create mode 100644 packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 178ca903a9f..baec8f2426e 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -177,6 +177,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | | [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | | [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | +| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | | :thought_balloon: | | [`@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: | diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md new file mode 100644 index 00000000000..ac54dba64ca --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -0,0 +1,64 @@ +# Condition expressions must be necessary + +Any expression being used as a condition must be able to evaluate as truthy or falsy in order to be considered "necessary". Conversely, any expression that always evaluates to truthy or always evaluates to falsy, as determined by the type of the expression, is considered unnecessary and will be flagged by this rule. + +The following expressions are checked: + +- Arguments to the `&&`, `||` and `?:` (ternary) operators +- Conditions for `if`, `for`, `while`, and `do-while` statements. + +Examples of **incorrect** code for this rule: + +```ts +function head(items: T[]) { + // items can never be nullable, so this is unnecessary + if (items) { + return items[0].toUpperCase(); + } +} + +function foo(arg: 'bar' | 'baz') { + // arg is never nullable or empty string, so this is unnecessary + if (arg) { + } +} +``` + +Examples of **correct** code for this rule: + +```ts +function head(items: T[]) { + // Necessary, since items.length might be 0 + if (items.length) { + return items[0].toUpperCase(); + } +} + +function foo(arg: string) { + // Necessary, since foo might be ''. + if (arg) { + } +} +``` + +## Options + +Accepts an object with the following options: + +- `ignoreRhs` (default `false`) - doesn't check if the right-hand side of `&&` and `||` is a necessary condition. For example, the following code is valid with this option on: + +```ts +function head(items: T[]) { + return items.length && items[0].toUpperCase(); +} +``` + +## When Not To Use It + +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 + +- [strict-boolean-expression](./strict-boolean-expressions.md) - a stricter alternative to this rule. diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index de27437a47c..6bed5b03fe3 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -61,3 +61,5 @@ Options may be provided as an object with: ## Related To - 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. diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 0974b7a7263..377f4b58f0e 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -46,6 +46,7 @@ "@typescript-eslint/no-require-imports": "error", "@typescript-eslint/no-this-alias": "error", "@typescript-eslint/no-type-alias": "error", + "@typescript-eslint/no-unnecessary-condition": "error", "@typescript-eslint/no-unnecessary-qualifier": "error", "@typescript-eslint/no-unnecessary-type-arguments": "error", "@typescript-eslint/no-unnecessary-type-assertion": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 8ae9d698cca..5302abd05de 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -35,6 +35,7 @@ import noParameterProperties from './no-parameter-properties'; import noRequireImports from './no-require-imports'; import noThisAlias from './no-this-alias'; import noTypeAlias from './no-type-alias'; +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'; @@ -100,6 +101,7 @@ export default { 'no-require-imports': noRequireImports, 'no-this-alias': noThisAlias, 'no-type-alias': noTypeAlias, + 'no-unnecessary-condition': noUnnecessaryCondition, 'no-unnecessary-qualifier': noUnnecessaryQualifier, 'no-unnecessary-type-arguments': useDefaultTypeParameter, 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion, diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts new file mode 100644 index 00000000000..49c8f13401c --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -0,0 +1,192 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import ts, { TypeFlags } from 'typescript'; +import { + isTypeFlagSet, + unionTypeParts, + isFalsyType, + isBooleanLiteralType, + isLiteralType, +} from 'tsutils'; +import { + createRule, + getParserServices, + getConstrainedTypeAtLocation, +} from '../util'; + +// Truthiness utilities +// #region +const isTruthyLiteral = (type: ts.Type): boolean => + isBooleanLiteralType(type, true) || (isLiteralType(type) && !!type.value); + +const isPossiblyFalsy = (type: ts.Type): boolean => + unionTypeParts(type) + // PossiblyFalsy flag includes literal values, so exclude ones that + // are definitely truthy + .filter(t => !isTruthyLiteral(t)) + .some(type => isTypeFlagSet(type, ts.TypeFlags.PossiblyFalsy)); + +const isPossiblyTruthy = (type: ts.Type): boolean => + unionTypeParts(type).some(type => !isFalsyType(type)); + +// isLiteralType only covers numbers and strings, this is a more exhaustive check. +const isLiteral = (type: ts.Type): boolean => + isBooleanLiteralType(type, true) || + isBooleanLiteralType(type, false) || + type.flags === ts.TypeFlags.Undefined || + type.flags === ts.TypeFlags.Null || + type.flags === ts.TypeFlags.Void || + isLiteralType(type); +// #endregion + +type ExpressionWithTest = + | TSESTree.ConditionalExpression + | TSESTree.DoWhileStatement + | TSESTree.ForStatement + | TSESTree.IfStatement + | TSESTree.WhileStatement; + +export type Options = [ + { + ignoreRhs?: boolean; + }, +]; + +export type MessageId = + | 'alwaysTruthy' + | 'alwaysFalsy' + | 'literalBooleanExpression' + | 'never'; +export default createRule({ + name: 'no-unnecessary-conditionals', + meta: { + type: 'suggestion', + docs: { + description: + 'Prevents conditionals where the type is always truthy or always falsy', + category: 'Best Practices', + recommended: false, + requiresTypeChecking: true, + }, + schema: [ + { + type: 'object', + properties: { + ignoreRhs: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], + messages: { + alwaysTruthy: 'Unnecessary conditional, value is always truthy.', + alwaysFalsy: 'Unnecessary conditional, value is always falsy.', + literalBooleanExpression: + 'Unnecessary conditional, both sides of the expression are literal values', + never: 'Unnecessary conditional, value is `never`', + }, + }, + defaultOptions: [ + { + ignoreRhs: false, + }, + ], + create(context, [{ ignoreRhs }]) { + const service = getParserServices(context); + const checker = service.program.getTypeChecker(); + + function getNodeType(node: TSESTree.Node): ts.Type { + const tsNode = service.esTreeNodeToTSNodeMap.get(node); + return getConstrainedTypeAtLocation(checker, tsNode); + } + + /** + * Checks if a conditional node is necessary: + * if the type of the node is always true or always false, it's not necessary. + */ + function checkNode(node: TSESTree.Node): void { + const type = getNodeType(node); + + // Conditional is always necessary if it involves `any` or `unknown` + if (isTypeFlagSet(type, TypeFlags.Any | TypeFlags.Unknown)) { + return; + } + if (isTypeFlagSet(type, TypeFlags.Never)) { + context.report({ node, messageId: 'never' }); + } else if (!isPossiblyTruthy(type)) { + context.report({ node, messageId: 'alwaysFalsy' }); + } else if (!isPossiblyFalsy(type)) { + context.report({ node, messageId: 'alwaysTruthy' }); + } + } + + /** + * Checks that a binary expression is necessarily conditional, reports otherwise. + * If both sides of the binary expression are literal values, it's not a necessary condition. + * + * NOTE: It's also unnecessary if the types that don't overlap at all + * but that case is handled by the Typescript compiler itself. + */ + const BOOL_OPERATORS = new Set([ + '<', + '>', + '<=', + '>=', + '==', + '===', + '!=', + '!==', + ]); + function checkIfBinaryExpressionIsNecessaryConditional( + node: TSESTree.BinaryExpression, + ): void { + if ( + BOOL_OPERATORS.has(node.operator) && + isLiteral(getNodeType(node.left)) && + isLiteral(getNodeType(node.right)) + ) { + context.report({ node, messageId: 'literalBooleanExpression' }); + } + } + + /** + * Checks that a testable expression is necessarily conditional, reports otherwise. + * Filters all LogicalExpressions to prevent some duplicate reports. + */ + function checkIfTestExpressionIsNecessaryConditional( + node: ExpressionWithTest, + ): void { + if ( + node.test !== null && + node.test.type !== AST_NODE_TYPES.LogicalExpression + ) { + checkNode(node.test); + } + } + + /** + * Checks that a logical expression contains a boolean, reports otherwise. + */ + function checkLogicalExpressionForUnnecessaryConditionals( + node: TSESTree.LogicalExpression, + ): void { + checkNode(node.left); + if (!ignoreRhs) { + checkNode(node.right); + } + } + + return { + BinaryExpression: checkIfBinaryExpressionIsNecessaryConditional, + ConditionalExpression: checkIfTestExpressionIsNecessaryConditional, + DoWhileStatement: checkIfTestExpressionIsNecessaryConditional, + ForStatement: checkIfTestExpressionIsNecessaryConditional, + IfStatement: checkIfTestExpressionIsNecessaryConditional, + WhileStatement: checkIfTestExpressionIsNecessaryConditional, + LogicalExpression: checkLogicalExpressionForUnnecessaryConditionals, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts new file mode 100644 index 00000000000..f298495a26f --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -0,0 +1,195 @@ +import path from 'path'; +import rule, { + Options, + MessageId, +} from '../../src/rules/no-unnecessary-condition'; +import { RuleTester } from '../RuleTester'; +import { + TestCaseError, + InvalidTestCase, +} from '@typescript-eslint/experimental-utils/dist/ts-eslint'; + +const rootPath = path.join(process.cwd(), 'tests/fixtures/'); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +const ruleError = ( + line: number, + column: number, + messageId: MessageId, +): TestCaseError => ({ + messageId, + line, + column, +}); + +const necessaryConditionTest = (condition: string): string => ` +declare const b1: ${condition}; +declare const b2: boolean; +const t1 = b1 && b2; +`; + +const unnecessaryConditionTest = ( + condition: string, + messageId: MessageId, +): InvalidTestCase => ({ + code: necessaryConditionTest(condition), + errors: [ruleError(4, 12, messageId)], +}); + +ruleTester.run('no-unnecessary-conditionals', rule, { + valid: [ + ` +declare const b1: boolean; +declare const b2: boolean; +const t1 = b1 && b2; +const t2 = b1 || b2; +if(b1 && b2) {} +while(b1 && b2) {} +for (let i = 0; (b1 && b2); i++) { break; } +const t1 = (b1 && b2) ? 'yes' : 'no'`, + necessaryConditionTest('false | 5'), // Truthy literal and falsy literal + necessaryConditionTest('boolean | "foo"'), // boolean and truthy literal + necessaryConditionTest('0 | boolean'), // boolean and falsy literal + necessaryConditionTest('boolean | object'), // boolean and always-truthy type + necessaryConditionTest('false | object'), // always truthy type and falsy literal + // always falsy type and always truthy type + necessaryConditionTest('null | object'), + necessaryConditionTest('undefined | true'), + necessaryConditionTest('void | true'), + + necessaryConditionTest('any'), // any + necessaryConditionTest('unknown'), // unknown + + // Generic type params + ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + + // Boolean expressions + ` +function test(a: string) { + return a === "a" +}`, + + // Supports ignoring the RHS + { + code: ` +declare const b1: boolean; +declare const b2: true; +if(b1 && b2) {}`, + options: [{ ignoreRhs: true }], + }, + ], + invalid: [ + // Ensure that it's checking in all the right places + { + code: ` +const b1 = true; +declare const b2: boolean; +const t1 = b1 && b2; +const t2 = b1 || b2; +if(b1 && b2) {} +while(b1 && b2) {} +for (let i = 0; (b1 && b2); i++) { break; } +const t1 = (b1 && b2) ? 'yes' : 'no'`, + errors: [ + ruleError(4, 12, 'alwaysTruthy'), + ruleError(5, 12, 'alwaysTruthy'), + ruleError(6, 4, 'alwaysTruthy'), + ruleError(7, 7, 'alwaysTruthy'), + ruleError(8, 18, 'alwaysTruthy'), + ruleError(9, 13, 'alwaysTruthy'), + ], + }, + // Ensure that it's complaining about the right things + unnecessaryConditionTest('object', 'alwaysTruthy'), + unnecessaryConditionTest('object | true', 'alwaysTruthy'), + unnecessaryConditionTest('"" | false', 'alwaysFalsy'), // Two falsy literals + unnecessaryConditionTest('"always truthy"', 'alwaysTruthy'), + unnecessaryConditionTest(`undefined`, 'alwaysFalsy'), + unnecessaryConditionTest('null', 'alwaysFalsy'), + unnecessaryConditionTest('void', 'alwaysFalsy'), + unnecessaryConditionTest('never', 'never'), + + // Generic type params + { + code: ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + errors: [ruleError(3, 10, 'alwaysTruthy')], + }, + { + code: ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + errors: [ruleError(3, 10, 'alwaysFalsy')], + }, + { + code: ` +function test(t: T) { + return t ? 'yes' : 'no' +}`, + errors: [ruleError(3, 10, 'alwaysTruthy')], + }, + + // Boolean expressions + { + code: ` +function test(a: "a") { + return a === "a" +}`, + errors: [ruleError(3, 10, 'literalBooleanExpression')], + }, + { + code: ` +const y = 1; +if (y === 0) {} +`, + errors: [ruleError(3, 5, 'literalBooleanExpression')], + }, + { + code: ` +enum Foo { + a = 1, + b = 2 +} + +const x = Foo.a; +if (x === Foo.a) {} +`, + errors: [ruleError(8, 5, 'literalBooleanExpression')], + }, + + // Still errors on in the expected locations when ignoring RHS + { + options: [{ ignoreRhs: true }], + code: ` +const b1 = true; +const b2 = false; +const t1 = b1 && b2; +const t2 = b1 || b2; +if(b1 && b2) {} +while(b1 && b2) {} +for (let i = 0; (b1 && b2); i++) { break; } +const t1 = (b1 && b2) ? 'yes' : 'no'`, + errors: [ + ruleError(4, 12, 'alwaysTruthy'), + ruleError(5, 12, 'alwaysTruthy'), + ruleError(6, 4, 'alwaysTruthy'), + ruleError(7, 7, 'alwaysTruthy'), + ruleError(8, 18, 'alwaysTruthy'), + ruleError(9, 13, 'alwaysTruthy'), + ], + }, + ], +}); From c713ca43adb1527e6ed997a549ea327d3f8b29c0 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 12 Sep 2019 10:44:10 +0200 Subject: [PATCH 054/317] feat(eslint-plugin): [strict-boolean-expressions] Add allowNullable option (#794) --- .../docs/rules/strict-boolean-expressions.md | 1 + .../src/rules/strict-boolean-expressions.ts | 38 +++++++++++++++++-- .../rules/strict-boolean-expressions.test.ts | 28 ++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 6bed5b03fe3..72d38f1ed66 100644 --- a/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ b/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -56,6 +56,7 @@ while (typeof str !== 'undefined') { Options may be provided as an object with: +- `allowNullable` to allow `undefined` and `null` in addition to `boolean` as a type of all boolean expressions. (`false` by default). - `ignoreRhs` to skip the check on the right hand side of expressions like `a && b` or `a || b` - allows these operators to be used for their short-circuiting behavior. (`false` by default). ## Related To diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index 9c3c5b6ea98..e67e4d1f687 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -16,6 +16,7 @@ type ExpressionWithTest = type Options = [ { ignoreRhs?: boolean; + allowNullable?: boolean; }, ]; @@ -36,6 +37,9 @@ export default util.createRule({ ignoreRhs: { type: 'boolean', }, + allowNullable: { + type: 'boolean', + }, }, additionalProperties: false, }, @@ -47,9 +51,10 @@ export default util.createRule({ defaultOptions: [ { ignoreRhs: false, + allowNullable: false, }, ], - create(context, [{ ignoreRhs }]) { + create(context, [options]) { const service = util.getParserServices(context); const checker = service.program.getTypeChecker(); @@ -61,7 +66,34 @@ export default util.createRule({ node, ); const type = util.getConstrainedTypeAtLocation(checker, tsNode); - return tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLike); + + if (tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLike)) { + return true; + } + + // Check variants of union + if (tsutils.isTypeFlagSet(type, ts.TypeFlags.Union)) { + let hasBoolean = false; + for (const ty of (type as ts.UnionType).types) { + if (tsutils.isTypeFlagSet(ty, ts.TypeFlags.BooleanLike)) { + hasBoolean = true; + continue; + } + if (options.allowNullable) { + if (tsutils.isTypeFlagSet(ty, ts.TypeFlags.Null)) { + continue; + } + if (tsutils.isTypeFlagSet(ty, ts.TypeFlags.Undefined)) { + continue; + } + } + // Union variant is something else + return false; + } + return hasBoolean; + } + + return false; } /** @@ -88,7 +120,7 @@ export default util.createRule({ ): void { if ( !isBooleanType(node.left) || - (!ignoreRhs && !isBooleanType(node.right)) + (!options.ignoreRhs && !isBooleanType(node.right)) ) { reportNode(node); } diff --git a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts index 1067b5fa4c6..c95228b6743 100644 --- a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts @@ -165,6 +165,15 @@ const boolOrObj = bool || obj; const boolAndObj = bool && obj; `, }, + { + options: [{ allowNullable: true }], + code: ` + const f1 = (x?: boolean) => x ? 1 : 0; + const f2 = (x: boolean | null) => x ? 1 : 0; + const f3 = (x?: true | null) => x ? 1 : 0; + const f4 = (x?: false) => x ? 1 : 0; + `, + }, ], invalid: [ @@ -933,5 +942,24 @@ const objOrBool = obj || bool; const objAndBool = obj && bool; `, }, + { + options: [{ allowNullable: true }], + errors: [ + { + messageId: 'strictBooleanExpression', + line: 2, + column: 44, + }, + { + messageId: 'strictBooleanExpression', + line: 3, + column: 35, + }, + ], + code: ` + const f = (x: null | undefined) => x ? 1 : 0; + const f = (x?: number) => x ? 1 : 0; + `, + }, ], }); From 6a55921e2b9245102c4c373759dde4c36c3b4c08 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 12 Sep 2019 10:56:08 +0200 Subject: [PATCH 055/317] feat(eslint-plugin): [no-floating-promises] Add ignoreVoid option (#796) --- .../docs/rules/no-floating-promises.md | 30 ++++ .../src/rules/no-floating-promises.ts | 141 ++++++++++-------- .../tests/rules/no-floating-promises.test.ts | 8 + 3 files changed, 120 insertions(+), 59 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index 75bc49efa66..f52a510b546 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -36,6 +36,36 @@ returnsPromise().then(() => {}, () => {}); Promise.reject('value').catch(() => {}); ``` +## Options + +The rule accepts an options object with the following properties: + +```ts +type Options = { + // if true, checking void expresions will be skipped + ignoreVoid?: boolean; +}; + +const defaults = { + ignoreVoid: false, +}; +``` + +### ignoreVoid + +This allows to easily suppress false-positives with void operator. + +Examples of **correct** code for this rule with `{ ignoreVoid: true }`: + +```ts +async function returnsPromise() { + return 'value'; +} +void returnsPromise(); + +void Promise.reject('value'); +``` + ## When Not To Use It If you do not use Promise-like values in your codebase or want to allow them to diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index 816cc084670..32538271b94 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -3,7 +3,13 @@ import * as ts from 'typescript'; import * as util from '../util'; -export default util.createRule({ +type Options = [ + { + ignoreVoid?: boolean; + }, +]; + +export default util.createRule({ name: 'no-floating-promises', meta: { docs: { @@ -15,12 +21,24 @@ export default util.createRule({ messages: { floating: 'Promises must be handled appropriately', }, - schema: [], + schema: [ + { + type: 'object', + properties: { + ignoreVoid: { type: 'boolean' }, + }, + additionalProperties: false, + }, + ], type: 'problem', }, - defaultOptions: [], + defaultOptions: [ + { + ignoreVoid: false, + }, + ], - create(context) { + create(context, [options]) { const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); @@ -38,64 +56,69 @@ export default util.createRule({ } }, }; + + function isUnhandledPromise( + checker: ts.TypeChecker, + node: ts.Node, + ): boolean { + // First, check expressions whose resulting types may not be promise-like + if ( + ts.isBinaryExpression(node) && + node.operatorToken.kind === ts.SyntaxKind.CommaToken + ) { + // Any child in a comma expression could return a potentially unhandled + // promise, so we check them all regardless of whether the final returned + // value is promise-like. + return ( + isUnhandledPromise(checker, node.left) || + isUnhandledPromise(checker, node.right) + ); + } + + if (ts.isVoidExpression(node) && !options.ignoreVoid) { + // Similarly, a `void` expression always returns undefined, so we need to + // see what's inside it without checking the type of the overall expression. + return isUnhandledPromise(checker, node.expression); + } + + // Check the type. At this point it can't be unhandled if it isn't a promise + if (!isPromiseLike(checker, node)) { + return false; + } + + if (ts.isCallExpression(node)) { + // If the outer expression is a call, it must be either a `.then()` or + // `.catch()` that handles the promise. + return ( + !isPromiseCatchCallWithHandler(node) && + !isPromiseThenCallWithRejectionHandler(node) + ); + } else if (ts.isConditionalExpression(node)) { + // We must be getting the promise-like value from one of the branches of the + // ternary. Check them directly. + return ( + isUnhandledPromise(checker, node.whenFalse) || + isUnhandledPromise(checker, node.whenTrue) + ); + } else if ( + ts.isPropertyAccessExpression(node) || + ts.isIdentifier(node) || + ts.isNewExpression(node) + ) { + // If it is just a property access chain or a `new` call (e.g. `foo.bar` or + // `new Promise()`), the promise is not handled because it doesn't have the + // necessary then/catch call at the end of the chain. + return true; + } + + // We conservatively return false for all other types of expressions because + // we don't want to accidentally fail if the promise is handled internally but + // we just can't tell. + return false; + } }, }); -function isUnhandledPromise(checker: ts.TypeChecker, node: ts.Node): boolean { - // First, check expressions whose resulting types may not be promise-like - if ( - ts.isBinaryExpression(node) && - node.operatorToken.kind === ts.SyntaxKind.CommaToken - ) { - // Any child in a comma expression could return a potentially unhandled - // promise, so we check them all regardless of whether the final returned - // value is promise-like. - return ( - isUnhandledPromise(checker, node.left) || - isUnhandledPromise(checker, node.right) - ); - } else if (ts.isVoidExpression(node)) { - // Similarly, a `void` expression always returns undefined, so we need to - // see what's inside it without checking the type of the overall expression. - return isUnhandledPromise(checker, node.expression); - } - - // Check the type. At this point it can't be unhandled if it isn't a promise - if (!isPromiseLike(checker, node)) { - return false; - } - - if (ts.isCallExpression(node)) { - // If the outer expression is a call, it must be either a `.then()` or - // `.catch()` that handles the promise. - return ( - !isPromiseCatchCallWithHandler(node) && - !isPromiseThenCallWithRejectionHandler(node) - ); - } else if (ts.isConditionalExpression(node)) { - // We must be getting the promise-like value from one of the branches of the - // ternary. Check them directly. - return ( - isUnhandledPromise(checker, node.whenFalse) || - isUnhandledPromise(checker, node.whenTrue) - ); - } else if ( - ts.isPropertyAccessExpression(node) || - ts.isIdentifier(node) || - ts.isNewExpression(node) - ) { - // If it is just a property access chain or a `new` call (e.g. `foo.bar` or - // `new Promise()`), the promise is not handled because it doesn't have the - // necessary then/catch call at the end of the chain. - return true; - } - - // We conservatively return false for all other types of expressions because - // we don't want to accidentally fail if the promise is handled internally but - // we just can't tell. - return false; -} - // Modified from tsutils.isThenable() to only consider thenables which can be // rejected/caught via a second parameter. Original source (MIT licensed): // diff --git a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts index 63a360715d9..013edb41bc0 100644 --- a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts @@ -24,6 +24,14 @@ async function test() { return Promise.resolve("value"); } `, + { + options: [{ ignoreVoid: true }], + code: ` +async function test() { + void Promise.resolve("value"); +} +`, + }, ` async function test() { await Promise.reject(new Error("message")); From 46ee4c9d6d83bf55d9003a78c18b5df5f2f629fe Mon Sep 17 00:00:00 2001 From: Taeheon Kim Date: Thu, 12 Sep 2019 18:29:25 +0900 Subject: [PATCH 056/317] feat(eslint-plugin): [explicit-member-accessibility] add support of "ignoredMethodNames" (#895) --- .../rules/explicit-member-accessibility.md | 20 +++++++ .../rules/explicit-member-accessibility.ts | 18 ++++-- .../explicit-member-accessibility.test.ts | 60 +++++++++++++++++++ 3 files changed, 94 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 96295809138..a8625778391 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -20,6 +20,7 @@ type AccessibilityLevel = type Options = { accessibility?: AccessibilityLevel; + ignoredMethodNames?: string[]; overrides?: { accessors?: AccessibilityLevel; constructors?: AccessibilityLevel; @@ -310,6 +311,25 @@ class Animal { } ``` +### Except specific methods + +If you want to ignore some specific methods, you can do it by specifing method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly. +e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]` + +```ts +class Animal { + get specificMethod() { + console.log('No error because you specified this method on option'); + } + get whateverMethod() { + console.log('No error because you specified this method on option'); + } + public get otherMethod() { + console.log('This method comply with this rule'); + } +} +``` + ## When Not To Use It If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule. diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index a1d61d56ded..864c630da17 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -11,6 +11,7 @@ type AccessibilityLevel = interface Config { accessibility?: AccessibilityLevel; + ignoredMethodNames?: string[]; overrides?: { accessors?: AccessibilityLevel; constructors?: AccessibilityLevel; @@ -57,8 +58,15 @@ export default util.createRule({ properties: accessibilityLevel, parameterProperties: accessibilityLevel, }, + additionalProperties: false, }, + ignoredMethodNames: { + type: 'array', + items: { + type: 'string', + }, + }, }, additionalProperties: false, }, @@ -74,7 +82,7 @@ export default util.createRule({ const methodCheck = overrides.methods || baseCheck; const propCheck = overrides.properties || baseCheck; const paramPropCheck = overrides.parameterProperties || baseCheck; - + const ignoredMethodNames = new Set(option.ignoredMethodNames || []); /** * Generates the report for rule violations */ @@ -116,14 +124,16 @@ export default util.createRule({ nodeType = `${methodDefinition.kind} property accessor`; break; } - if (check === 'off') { - return; - } const methodName = util.getNameFromClassMember( methodDefinition, sourceCode, ); + + if (check === 'off' || ignoredMethodNames.has(methodName)) { + return; + } + if ( check === 'no-public' && methodDefinition.accessibility === 'public' diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index 051cfb30642..7eb6bcd076b 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -258,6 +258,66 @@ class Test { }, ], }, + { + filename: 'test.ts', + code: ` +class Test { + public getX () { + return this.x + } +} + `, + options: [ + { + ignoredMethodNames: ['getX'], + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + public static getX () { + return this.x + } +} + `, + options: [ + { + ignoredMethodNames: ['getX'], + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + get getX () { + return this.x + } +} + `, + options: [ + { + ignoredMethodNames: ['getX'], + }, + ], + }, + { + filename: 'test.ts', + code: ` +class Test { + getX () { + return this.x + } +} + `, + options: [ + { + ignoredMethodNames: ['getX'], + }, + ], + }, ], invalid: [ { From aeea4cd40e2ac66ff596a205ba7bfc95aa376128 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 12 Sep 2019 13:05:04 +0300 Subject: [PATCH 057/317] feat(eslint-plugin): [no-magic-numbers] add ignoreReadonlyClassProperties option (#938) --- .../docs/rules/no-magic-numbers.md | 28 ++++++++++++ .../src/rules/no-magic-numbers.ts | 25 +++++++++++ .../tests/rules/no-magic-numbers.test.ts | 44 +++++++++++++++++++ .../eslint-plugin/typings/eslint-rules.d.ts | 1 + 4 files changed, 98 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-magic-numbers.md b/packages/eslint-plugin/docs/rules/no-magic-numbers.md index cf647833887..215890a2e83 100644 --- a/packages/eslint-plugin/docs/rules/no-magic-numbers.md +++ b/packages/eslint-plugin/docs/rules/no-magic-numbers.md @@ -41,6 +41,34 @@ Examples of **correct** code for the `{ "ignoreNumericLiteralTypes": true }` opt type SmallPrimes = 2 | 3 | 5 | 7 | 11; ``` +### ignoreReadonlyClassProperties + +Examples of **incorrect** code for the `{ "ignoreReadonlyClassProperties": false }` option: + +```ts +/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": false }]*/ + +class Foo { + readonly A = 1; + readonly B = 2; + public static readonly C = 1; + static readonly D = 1; +} +``` + +Examples of **correct** code for the `{ "ignoreReadonlyClassProperties": true }` option: + +```ts +/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": true }]*/ + +class Foo { + readonly A = 1; + readonly B = 2; + public static readonly C = 1; + static readonly D = 1; +} +``` + ### ignoreEnums A boolean to specify if enums used in Typescript are considered okay. `false` by default. diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 005bae9eb0a..01a2505498f 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -33,6 +33,9 @@ export default util.createRule({ ignoreEnums: { type: 'boolean', }, + ignoreReadonlyClassProperties: { + type: 'boolean', + }, }, }, ], @@ -46,6 +49,7 @@ export default util.createRule({ detectObjects: false, ignoreNumericLiteralTypes: false, ignoreEnums: false, + ignoreReadonlyClassProperties: false, }, ], create(context, [options]) { @@ -149,6 +153,20 @@ export default util.createRule({ return false; } + /** + * Checks if the node parent is a readonly class property + * @param node the node to be validated. + * @returns true if the node parent is a readonly class property + * @private + */ + function isParentTSReadonlyClassProperty(node: TSESTree.Node): boolean { + return ( + !!node.parent && + node.parent.type === AST_NODE_TYPES.ClassProperty && + !!node.parent.readonly + ); + } + return { Literal(node): void { // Check if the node is a TypeScript enum declaration @@ -156,6 +174,13 @@ export default util.createRule({ return; } + if ( + options.ignoreReadonlyClassProperties && + isParentTSReadonlyClassProperty(node) + ) { + return; + } + // Check TypeScript specific nodes for Numeric Literal if ( options.ignoreNumericLiteralTypes && 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 09b6c35d0b4..1ab26cfa704 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -41,6 +41,17 @@ ruleTester.run('no-magic-numbers', rule, { code: 'enum foo { SECOND = 1000, NUM = "0123456789" }', options: [{ ignoreEnums: true }], }, + { + code: ` +class Foo { + readonly A = 1; + readonly B = 2; + public static readonly C = 1; + static readonly D = 1; +} + `, + options: [{ ignoreReadonlyClassProperties: true }], + }, ], invalid: [ @@ -166,5 +177,38 @@ ruleTester.run('no-magic-numbers', rule, { }, ], }, + { + code: ` +class Foo { + readonly A = 1; + readonly B = 2; + public static readonly C = 1; + static readonly D = 1; +} + `, + options: [{ ignoreReadonlyClassProperties: false }], + errors: [ + { + messageId: 'noMagic', + line: 3, + column: 16, + }, + { + messageId: 'noMagic', + line: 4, + column: 16, + }, + { + messageId: 'noMagic', + line: 5, + column: 30, + }, + { + messageId: 'noMagic', + line: 6, + column: 23, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index de6545f744d..120b11433cb 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -199,6 +199,7 @@ declare module 'eslint/lib/rules/no-magic-numbers' { detectObjects?: boolean; ignoreNumericLiteralTypes?: boolean; ignoreEnums?: boolean; + ignoreReadonlyClassProperties?: boolean; }, ], { From 2bf823176927278a08df1c9df255b39c6515e948 Mon Sep 17 00:00:00 2001 From: Pavel Birukov Date: Fri, 13 Sep 2019 20:04:20 +0300 Subject: [PATCH 058/317] fix(typescript-estree): ImportDeclaration.specifier to Literal (#974) --- packages/eslint-plugin/src/rules/triple-slash-reference.ts | 3 +-- packages/typescript-estree/src/ts-estree/ts-estree.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index c5ab5772523..8ce64e5748a 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -73,8 +73,7 @@ export default util.createRule({ return { ImportDeclaration(node): void { if (programNode) { - const source = node.source as TSESTree.Literal; - hasMatchingReference(source); + hasMatchingReference(node.source); } }, TSImportEqualsDeclaration(node): void { diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 51529a470cb..296e62b0bfb 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -732,7 +732,7 @@ export interface Import extends BaseNode { export interface ImportDeclaration extends BaseNode { type: AST_NODE_TYPES.ImportDeclaration; - source: Expression; + source: Literal; specifiers: ImportClause[]; } From 752fb31ff044fb3db206e86a977385250a925228 Mon Sep 17 00:00:00 2001 From: gorff5 Date: Sun, 15 Sep 2019 20:41:11 +0300 Subject: [PATCH 059/317] docs(eslint-plugin): fix typo in typedef docs (#976) --- packages/eslint-plugin/docs/rules/typedef.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/typedef.md b/packages/eslint-plugin/docs/rules/typedef.md index 4498ab95610..89bc1d41e6f 100644 --- a/packages/eslint-plugin/docs/rules/typedef.md +++ b/packages/eslint-plugin/docs/rules/typedef.md @@ -44,7 +44,7 @@ For example, with the following configuration: ```json { "rules": { - "typedef": [ + "@typescript-eslint/typedef": [ "error", { "arrowParameter": false, From fa1cf71af4af75f3fcd3105af45f512cb2705117 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 16 Sep 2019 17:02:11 +0000 Subject: [PATCH 060/317] chore: publish v2.3.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 | 20 ++++++++++++++++++++ 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 | 11 +++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 98 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 870ae588ac7..a45c6f82df0 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.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + + +### Bug Fixes + +* **typescript-estree:** ImportDeclaration.specifier to Literal ([#974](https://github.com/typescript-eslint/typescript-eslint/issues/974)) ([2bf8231](https://github.com/typescript-eslint/typescript-eslint/commit/2bf8231)) + + +### Features + +* **eslint-plugin:** [explicit-member-accessibility] add support of "ignoredMethodNames" ([#895](https://github.com/typescript-eslint/typescript-eslint/issues/895)) ([46ee4c9](https://github.com/typescript-eslint/typescript-eslint/commit/46ee4c9)) +* **eslint-plugin:** [no-floating-promises] Add ignoreVoid option ([#796](https://github.com/typescript-eslint/typescript-eslint/issues/796)) ([6a55921](https://github.com/typescript-eslint/typescript-eslint/commit/6a55921)) +* **eslint-plugin:** [no-magic-numbers] add ignoreReadonlyClassProperties option ([#938](https://github.com/typescript-eslint/typescript-eslint/issues/938)) ([aeea4cd](https://github.com/typescript-eslint/typescript-eslint/commit/aeea4cd)) +* **eslint-plugin:** [strict-boolean-expressions] Add allowNullable option ([#794](https://github.com/typescript-eslint/typescript-eslint/issues/794)) ([c713ca4](https://github.com/typescript-eslint/typescript-eslint/commit/c713ca4)) +* **eslint-plugin:** add no-unnecessary-condition rule ([#699](https://github.com/typescript-eslint/typescript-eslint/issues/699)) ([5715482](https://github.com/typescript-eslint/typescript-eslint/commit/5715482)) + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) diff --git a/lerna.json b/lerna.json index d605df702a9..ea1d9387a74 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.0", + "version": "2.3.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index ce13360be83..04abe45358b 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.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **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 bcf7455d69d..b824c1d3808 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.2.0", + "version": "2.3.0", "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.2.0", + "@typescript-eslint/experimental-utils": "2.3.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.2.0" + "@typescript-eslint/parser": "2.3.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 7e0867066c8..92ad694e32a 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/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.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + + +### Bug Fixes + +* **typescript-estree:** ImportDeclaration.specifier to Literal ([#974](https://github.com/typescript-eslint/typescript-eslint/issues/974)) ([2bf8231](https://github.com/typescript-eslint/typescript-eslint/commit/2bf8231)) + + +### Features + +* **eslint-plugin:** [explicit-member-accessibility] add support of "ignoredMethodNames" ([#895](https://github.com/typescript-eslint/typescript-eslint/issues/895)) ([46ee4c9](https://github.com/typescript-eslint/typescript-eslint/commit/46ee4c9)) +* **eslint-plugin:** [no-floating-promises] Add ignoreVoid option ([#796](https://github.com/typescript-eslint/typescript-eslint/issues/796)) ([6a55921](https://github.com/typescript-eslint/typescript-eslint/commit/6a55921)) +* **eslint-plugin:** [no-magic-numbers] add ignoreReadonlyClassProperties option ([#938](https://github.com/typescript-eslint/typescript-eslint/issues/938)) ([aeea4cd](https://github.com/typescript-eslint/typescript-eslint/commit/aeea4cd)) +* **eslint-plugin:** [strict-boolean-expressions] Add allowNullable option ([#794](https://github.com/typescript-eslint/typescript-eslint/issues/794)) ([c713ca4](https://github.com/typescript-eslint/typescript-eslint/commit/c713ca4)) +* **eslint-plugin:** add no-unnecessary-condition rule ([#699](https://github.com/typescript-eslint/typescript-eslint/issues/699)) ([5715482](https://github.com/typescript-eslint/typescript-eslint/commit/5715482)) + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 7a8a84a0e2d..ee8d22ae84e 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.2.0", + "version": "2.3.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.2.0", + "@typescript-eslint/experimental-utils": "2.3.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 9352d0a4c46..9b3abf341a2 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.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **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 a28cfb2c89e..86f65797bf2 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.2.0", + "version": "2.3.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.2.0", + "@typescript-eslint/typescript-estree": "2.3.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 507eac315f7..f9120a7acde 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.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 9deee00e0bb..a0b6a09cead 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.2.0", + "version": "2.3.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.2.0", - "@typescript-eslint/typescript-estree": "2.2.0", + "@typescript-eslint/experimental-utils": "2.3.0", + "@typescript-eslint/typescript-estree": "2.3.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.2.0", + "@typescript-eslint/shared-fixtures": "2.3.0", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 4dfa4cd5e51..7d8e9d76f5d 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.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **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 4081dcf5f03..0c48c0177f7 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.2.0", + "version": "2.3.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 4fff19407f1..4d3c460a389 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) + + +### Bug Fixes + +* **typescript-estree:** ImportDeclaration.specifier to Literal ([#974](https://github.com/typescript-eslint/typescript-eslint/issues/974)) ([2bf8231](https://github.com/typescript-eslint/typescript-eslint/commit/2bf8231)) + + + + + # [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) **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 b1edc190b3e..6f1217c4352 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.2.0", + "version": "2.3.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.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.0.1", - "@typescript-eslint/shared-fixtures": "2.2.0", + "@typescript-eslint/shared-fixtures": "2.3.0", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From e348cb298a2e88758028218ec7bd37ef351a2873 Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Tue, 17 Sep 2019 12:35:15 +1000 Subject: [PATCH 061/317] fix(eslint-plugin): [pfa] Allow async getter/setter in classes (#980) --- packages/eslint-plugin/src/rules/promise-function-async.ts | 3 ++- .../tests/rules/promise-function-async.test.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 8ec816b456b..1575cf02dfc 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -105,7 +105,8 @@ export default util.createRule({ if ( node.parent && - node.parent.type === 'Property' && + (node.parent.type === 'Property' || + node.parent.type === 'MethodDefinition') && (node.parent.kind === 'get' || node.parent.kind === 'set') ) { return; 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 ed798ca18e2..46100db7982 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -54,6 +54,12 @@ class InvalidAsyncModifiers { public set asyncGetter(p: Promise) { return p; } + public get asyncGetterFunc() { + return async () => new Promise(); + } + public set asyncGetterFunc(p: () => Promise) { + return p; + } } `, ` From c3c8b8643553057398395df73c9d43757b576f11 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 17 Sep 2019 05:48:07 +0300 Subject: [PATCH 062/317] fix(eslint-plugin): [cons-type-assns] handle namespaced types (#975) --- .../src/rules/consistent-type-assertions.ts | 13 +++++++++---- .../tests/rules/consistent-type-assertions.test.ts | 10 ++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index a5f87250da0..8c1b853c147 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -95,11 +95,14 @@ export default util.createRule({ case AST_NODE_TYPES.TSUnknownKeyword: return false; case AST_NODE_TYPES.TSTypeReference: - // Ignore `as const` and `` return ( - node.typeName.type === AST_NODE_TYPES.Identifier && - node.typeName.name !== 'const' + // Ignore `as const` and `` + (node.typeName.type === AST_NODE_TYPES.Identifier && + node.typeName.name !== 'const') || + // Allow qualified names which have dots between identifiers, `Foo.Bar` + node.typeName.type === AST_NODE_TYPES.TSQualifiedName ); + default: return true; } @@ -115,12 +118,14 @@ export default util.createRule({ ) { return; } + if ( options.objectLiteralTypeAssertions === 'allow-as-parameter' && node.parent && (node.parent.type === AST_NODE_TYPES.NewExpression || node.parent.type === AST_NODE_TYPES.CallExpression || - node.parent.type === AST_NODE_TYPES.ThrowStatement) + node.parent.type === AST_NODE_TYPES.ThrowStatement || + node.parent.type === AST_NODE_TYPES.AssignmentPattern) ) { return; } diff --git a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts index b631fdda9d4..71f51492d23 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts @@ -29,6 +29,8 @@ const OBJECT_LITERAL_ARGUMENT_AS_CASTS = ` print({ bar: 5 } as Foo) new print({ bar: 5 } as Foo) function foo() { throw { bar: 5 } as Foo } +function b(x = {} as Foo.Bar) {} +function c(x = {} as Foo) {} `; const OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS = ` print({ bar: 5 }) @@ -269,6 +271,14 @@ ruleTester.run('consistent-type-assertions', rule, { messageId: 'unexpectedObjectTypeAssertion', line: 5, }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 6, + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 7, + }, ], }), ...batchedSingleLineTests({ From 19abbe0d7450dd144480eba425b410a69ea9434d Mon Sep 17 00:00:00 2001 From: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> Date: Wed, 18 Sep 2019 23:58:47 -0400 Subject: [PATCH 063/317] fix(typescript-estree): parsing error for await in non-async func (#988) --- .../lib/__snapshots__/typescript.ts.snap | 266 ++++++++ .../await-without-async-function.src.ts | 4 + packages/typescript-estree/src/parser.ts | 2 +- ...ors.ts => semantic-or-syntactic-errors.ts} | 1 + .../semantic-diagnostics-enabled.ts.snap | 9 + .../lib/__snapshots__/typescript.ts.snap | 604 ++++++++++++++++++ 6 files changed, 885 insertions(+), 1 deletion(-) create mode 100644 packages/shared-fixtures/fixtures/typescript/basics/await-without-async-function.src.ts rename packages/typescript-estree/src/{semantic-errors.ts => semantic-or-syntactic-errors.ts} (98%) diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 7bf48b5ef3a..a2b241e3e82 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -1967,6 +1967,272 @@ Object { } `; +exports[`typescript fixtures/basics/await-without-async-function.src 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 64, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 64, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + "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, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": 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": "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": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "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, + "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, diff --git a/packages/shared-fixtures/fixtures/typescript/basics/await-without-async-function.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/await-without-async-function.src.ts new file mode 100644 index 00000000000..ae6be9bb7fb --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/basics/await-without-async-function.src.ts @@ -0,0 +1,4 @@ +function foo() { + const bar = await baz(); + return bar.qux; +} diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index 642b41aa488..882a8bbff7e 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -7,7 +7,7 @@ import { astConverter } from './ast-converter'; import { convertError } from './convert'; import { firstDefined } from './node-utils'; import { Extra, TSESTreeOptions, ParserServices } from './parser-options'; -import { getFirstSemanticOrSyntacticError } from './semantic-errors'; +import { getFirstSemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import { TSESTree } from './ts-estree'; import { calculateProjectParserOptions, diff --git a/packages/typescript-estree/src/semantic-errors.ts b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts similarity index 98% rename from packages/typescript-estree/src/semantic-errors.ts rename to packages/typescript-estree/src/semantic-or-syntactic-errors.ts index c580697a185..a8ac8728798 100644 --- a/packages/typescript-estree/src/semantic-errors.ts +++ b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts @@ -86,6 +86,7 @@ function whitelistSupportedDiagnostics( case 1242: // ts 3.2 "'abstract' modifier can only appear on a class, method, or property declaration." case 1246: // ts 3.2 "An interface property cannot have an initializer." case 1255: // ts 3.2 "A definite assignment assertion '!' is not permitted in this context." + case 1308: // ts 3.2 "'await' expression is only allowed within an async function." case 2364: // ts 3.2 "The left-hand side of an assignment expression must be a variable or a property access." case 2369: // ts 3.2 "A parameter property is only allowed in a constructor implementation." case 2462: // ts 3.2 "A rest element must be last in a destructuring pattern." 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 b4f79cd04d1..52d62f3fd90 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 @@ -1669,6 +1669,15 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/await-without-async-function.src 1`] = ` +Object { + "column": 14, + "index": 31, + "lineNumber": 2, + "message": "'await' expression is only allowed within an async function.", +} +`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/call-signatures.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/basics/call-signatures-with-generics.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 f614a8e3c78..3b31431ff71 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -5114,6 +5114,610 @@ Object { } `; +exports[`typescript fixtures/basics/await-without-async-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "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": "bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 42, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 43, + ], + "type": "VariableDeclaration", + }, + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "qux", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "range": Array [ + 53, + 60, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 46, + 61, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 63, + ], + "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 [], + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "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": 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": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/call-signatures.src 1`] = ` Object { "body": Array [ From dfb4fd6bde880fb165542ee447baed2463790acf Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Sat, 21 Sep 2019 18:17:46 -0700 Subject: [PATCH 064/317] docs(typescript-estree): correct typo (#995) --- packages/typescript-estree/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 8cb7d48b3e0..55cf645d88e 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -136,7 +136,7 @@ Please check the current list of open and known issues and ensure the issue has A couple of years after work on this parser began, the TypeScript Team at Microsoft began [officially supporting TypeScript parsing via Babel](https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/). -I work closely with TypeScript Team and we are gradually aliging the AST of this project with the one produced by Babel's parser. To that end, I have created a full test harness to compare the ASTs of the two projects which runs on every PR, please see the code for more details. +I work closely with the TypeScript Team and we are gradually aliging the AST of this project with the one produced by Babel's parser. To that end, I have created a full test harness to compare the ASTs of the two projects which runs on every PR, please see the code for more details. ## Build/Test Commands From ca8ac793a5dbf6bde89c9f6a8f365984a3c0e4f2 Mon Sep 17 00:00:00 2001 From: Andrew Shim Date: Mon, 23 Sep 2019 08:31:48 -0700 Subject: [PATCH 065/317] docs(eslint-plugin): add missing ROADMAP link (#998) --- packages/eslint-plugin/ROADMAP.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 65b5dcd46ba..06326a5439e 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -603,6 +603,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint- [`@typescript-eslint/no-unused-vars`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md [`@typescript-eslint/no-use-before-define`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md [`@typescript-eslint/restrict-plus-operands`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md +[`@typescript-eslint/strict-boolean-expressions`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md [`@typescript-eslint/indent`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md [`@typescript-eslint/no-require-imports`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md [`@typescript-eslint/array-type`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md From 6279c5b93ab7ec75caf9e28f45c9c3bec159796e Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 23 Sep 2019 17:02:22 +0000 Subject: [PATCH 066/317] chore: publish v2.3.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 | 12 ++++++++++++ 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 | 11 +++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 11 +++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 89 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a45c6f82df0..e7e3f1abca6 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.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + + +### Bug Fixes + +* **eslint-plugin:** [cons-type-assns] handle namespaced types ([#975](https://github.com/typescript-eslint/typescript-eslint/issues/975)) ([c3c8b86](https://github.com/typescript-eslint/typescript-eslint/commit/c3c8b86)) +* **eslint-plugin:** [pfa] Allow async getter/setter in classes ([#980](https://github.com/typescript-eslint/typescript-eslint/issues/980)) ([e348cb2](https://github.com/typescript-eslint/typescript-eslint/commit/e348cb2)) +* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) diff --git a/lerna.json b/lerna.json index ea1d9387a74..9ce79426f6a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.3.0", + "version": "2.3.1", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 04abe45358b..93061fb4365 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.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **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 b824c1d3808..8ecc7d9ce56 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.0", + "version": "2.3.1", "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.0", + "@typescript-eslint/experimental-utils": "2.3.1", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.3.0" + "@typescript-eslint/parser": "2.3.1" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 92ad694e32a..ba778927648 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.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + + +### Bug Fixes + +* **eslint-plugin:** [cons-type-assns] handle namespaced types ([#975](https://github.com/typescript-eslint/typescript-eslint/issues/975)) ([c3c8b86](https://github.com/typescript-eslint/typescript-eslint/commit/c3c8b86)) +* **eslint-plugin:** [pfa] Allow async getter/setter in classes ([#980](https://github.com/typescript-eslint/typescript-eslint/issues/980)) ([e348cb2](https://github.com/typescript-eslint/typescript-eslint/commit/e348cb2)) + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index ee8d22ae84e..f69cb9db4e5 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.0", + "version": "2.3.1", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.0", + "@typescript-eslint/experimental-utils": "2.3.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 9b3abf341a2..ec6b8aa74ec 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.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **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 86f65797bf2..efcb42f4fdb 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.0", + "version": "2.3.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.3.0", + "@typescript-eslint/typescript-estree": "2.3.1", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index f9120a7acde..716e9cbaaea 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.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + + +### Bug Fixes + +* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index a0b6a09cead..5dab6bcc84a 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.3.0", + "version": "2.3.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.3.0", - "@typescript-eslint/typescript-estree": "2.3.0", + "@typescript-eslint/experimental-utils": "2.3.1", + "@typescript-eslint/typescript-estree": "2.3.1", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.3.0", + "@typescript-eslint/shared-fixtures": "2.3.1", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 7d8e9d76f5d..ce614b93101 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.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + + +### Bug Fixes + +* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) **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 0c48c0177f7..0361519db33 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.0", + "version": "2.3.1", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 4d3c460a389..c4a5449df00 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) + + +### Bug Fixes + +* **typescript-estree:** parsing error for await in non-async func ([#988](https://github.com/typescript-eslint/typescript-eslint/issues/988)) ([19abbe0](https://github.com/typescript-eslint/typescript-eslint/commit/19abbe0)) + + + + + # [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 6f1217c4352..4600ef5015b 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.0", + "version": "2.3.1", "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.0", + "@typescript-eslint/shared-fixtures": "2.3.1", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From cdf92949bec4686a74233ae49b6a28ff99b12cbd Mon Sep 17 00:00:00 2001 From: quentin-jaquier-sonarsource <43733433+quentin-jaquier-sonarsource@users.noreply.github.com> Date: Tue, 24 Sep 2019 17:46:00 +0200 Subject: [PATCH 067/317] fix(eslint-plugin): [no-unnec-type-arg] undefined symbol crash (#1007) --- .../src/rules/no-unnecessary-type-arguments.ts | 7 ++++++- .../tests/rules/no-unnecessary-type-arguments.test.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 040650ea05d..12d9c041dfe 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -121,7 +121,12 @@ function getTypeParametersFromType( type: ts.EntityName | ts.Expression | ts.ClassDeclaration, checker: ts.TypeChecker, ): readonly ts.TypeParameterDeclaration[] | undefined { - const sym = getAliasedSymbol(checker.getSymbolAtLocation(type)!, checker); + const symAtLocation = checker.getSymbolAtLocation(type); + if (symAtLocation === undefined) { + return undefined; + } + + const sym = getAliasedSymbol(symAtLocation, checker); if (sym === undefined || sym.declarations === undefined) { return undefined; } diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index d6ea679f823..7bb37deda8f 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -52,6 +52,7 @@ ruleTester.run('no-unnecessary-type-arguments', rule, { class D extends C { }`, `declare const C: unknown; class D extends C { }`, + `let a: A`, ], invalid: [ { From 8ce3a81affff2dcd484e455be47a9bde1acf114f Mon Sep 17 00:00:00 2001 From: Pavel Birukov Date: Wed, 25 Sep 2019 18:36:26 +0300 Subject: [PATCH 068/317] fix(typescript-estree): correct ClassDeclarationBase type (#1008) according to the spec, ClassDeclarationBase.id and ClassDeclarationBase.superClass are always present and nullable --- packages/eslint-plugin/src/rules/indent.ts | 2 +- packages/typescript-estree/src/ts-estree/ts-estree.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index aca492d4b4d..2c135fea6a7 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -344,7 +344,7 @@ export default util.createRule({ ]({ type: AST_NODE_TYPES.ClassDeclaration, body: node.body as any, - id: undefined, + id: null, // TODO: This is invalid, there can be more than one extends in interface superClass: node.extends![0].expression as any, diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 296e62b0bfb..d4361bf3d5c 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -454,9 +454,9 @@ interface BinaryExpressionBase extends BaseNode { interface ClassDeclarationBase extends BaseNode { typeParameters?: TSTypeParameterDeclaration; superTypeParameters?: TSTypeParameterInstantiation; - id?: Identifier; + id: Identifier | null; body: ClassBody; - superClass?: LeftHandSideExpression; + superClass: LeftHandSideExpression | null; implements?: ExpressionWithTypeArguments[]; abstract?: boolean; declare?: boolean; From 95c13fe7583458286a840429a856ab20be6db20a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 30 Sep 2019 09:31:44 -0700 Subject: [PATCH 069/317] fix(typescript-estree): handle optional computed prop w/o type (#1026) --- .../lib/__snapshots__/typescript.ts.snap | 269 ++- .../class-with-optional-properties.src.ts | 8 + packages/typescript-estree/src/convert.ts | 6 +- .../lib/__snapshots__/typescript.ts.snap | 1766 ++++++++++++++--- 4 files changed, 1793 insertions(+), 256 deletions(-) diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index a2b241e3e82..cf9bd22368c 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -7660,68 +7660,114 @@ Object { exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` Object { - "$id": 4, + "$id": 10, "block": Object { "range": Array [ 0, - 64, + 219, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 3, + "$id": 9, "block": Object { "range": Array [ 0, - 64, + 219, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 2, + "$id": 8, "block": Object { "range": Array [ - 0, - 63, + 51, + 218, ], "type": "ClassDeclaration", }, "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], - "throughReferences": Array [], + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "computed", + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "computed2", + "range": Array [ + 155, + 164, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], "type": "class", "upperScope": Object { - "$ref": 3, + "$ref": 9, }, "variableMap": Object { "Foo": Object { - "$ref": 1, + "$ref": 5, }, }, "variableScope": Object { - "$ref": 3, + "$ref": 9, }, "variables": Array [ Object { - "$id": 1, + "$id": 5, "defs": Array [ Object { "name": Object { "name": "Foo", "range": Array [ - 6, - 9, + 57, + 60, ], "type": "Identifier", }, "node": Object { "range": Array [ - 0, - 63, + 51, + 218, ], "type": "ClassDeclaration", }, @@ -7734,8 +7780,8 @@ Object { Object { "name": "Foo", "range": Array [ - 6, - 9, + 57, + 60, ], "type": "Identifier", }, @@ -7743,7 +7789,7 @@ Object { "name": "Foo", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 8, }, }, ], @@ -7751,19 +7797,76 @@ Object { ], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "computed", + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 17, + 23, + ], + "type": "Literal", + }, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "computed2", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 43, + 49, + ], + "type": "Literal", + }, + }, + ], "throughReferences": Array [], "type": "module", "upperScope": Object { - "$ref": 4, + "$ref": 10, }, "variableMap": Object { "Foo": Object { + "$ref": 2, + }, + "computed": Object { "$ref": 0, }, + "computed2": Object { + "$ref": 1, + }, }, "variableScope": Object { - "$ref": 3, + "$ref": 9, }, "variables": Array [ Object { @@ -7771,17 +7874,123 @@ Object { "defs": Array [ Object { "name": Object { - "name": "Foo", + "name": "computed", "range": Array [ 6, - 9, + 14, ], "type": "Identifier", }, "node": Object { + "range": Array [ + 6, + 23, + ], + "type": "VariableDeclarator", + }, + "parent": Object { "range": Array [ 0, - 63, + 24, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "computed", + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + }, + ], + "name": "computed", + "references": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "computed2", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 31, + 49, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 25, + 50, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "computed2", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + ], + "name": "computed2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 51, + 218, ], "type": "ClassDeclaration", }, @@ -7794,8 +8003,8 @@ Object { Object { "name": "Foo", "range": Array [ - 6, - 9, + 57, + 60, ], "type": "Identifier", }, @@ -7803,7 +8012,7 @@ Object { "name": "Foo", "references": Array [], "scope": Object { - "$ref": 3, + "$ref": 9, }, }, ], @@ -7817,7 +8026,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 4, + "$ref": 10, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts index 536aab8062d..e9292de2e06 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/class-with-optional-properties.src.ts @@ -1,5 +1,13 @@ +const computed = 'buzz'; +const computed2 = 'bazz'; class Foo { foo?; bar? : string; private baz? : string; + [computed]?; + ['literal']?; + [1]?; + [computed2]?: string; + ['literal2']?: string; + [2]?: string; } diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 43ab7889c6b..203fbe2b494 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -941,7 +941,11 @@ export class Converter { result.accessibility = accessibility; } - if (node.name.kind === SyntaxKind.Identifier && node.questionToken) { + if ( + (node.name.kind === SyntaxKind.Identifier || + node.name.kind === SyntaxKind.ComputedPropertyName) && + node.questionToken + ) { result.optional = true; } diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index 3b31431ff71..5cbee776bf2 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -21093,6 +21093,154 @@ Object { exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` Object { "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "computed", + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "raw": "'buzz'", + "type": "Literal", + "value": "buzz", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "computed2", + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "raw": "'bazz'", + "type": "Literal", + "value": "bazz", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 31, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 50, + ], + "type": "VariableDeclaration", + }, Object { "body": Object { "body": Array [ @@ -21102,34 +21250,34 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 2, + "line": 4, }, "start": Object { "column": 2, - "line": 2, + "line": 4, }, }, "name": "foo", "range": Array [ - 14, - 17, + 65, + 68, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 7, - "line": 2, + "line": 4, }, "start": Object { "column": 2, - "line": 2, + "line": 4, }, }, "optional": true, "range": Array [ - 14, - 19, + 65, + 70, ], "static": false, "type": "ClassProperty", @@ -21141,34 +21289,34 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 5, }, "start": Object { "column": 2, - "line": 3, + "line": 5, }, }, "name": "bar", "range": Array [ - 22, - 25, + 73, + 76, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 16, - "line": 3, + "line": 5, }, "start": Object { "column": 2, - "line": 3, + "line": 5, }, }, "optional": true, "range": Array [ - 22, - 36, + 73, + 87, ], "static": false, "type": "ClassProperty", @@ -21176,32 +21324,32 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 3, + "line": 5, }, "start": Object { "column": 7, - "line": 3, + "line": 5, }, }, "range": Array [ - 27, - 35, + 78, + 86, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { "column": 15, - "line": 3, + "line": 5, }, "start": Object { "column": 9, - "line": 3, + "line": 5, }, }, "range": Array [ - 29, - 35, + 80, + 86, ], "type": "TSStringKeyword", }, @@ -21215,34 +21363,34 @@ Object { "loc": Object { "end": Object { "column": 13, - "line": 4, + "line": 6, }, "start": Object { "column": 10, - "line": 4, + "line": 6, }, }, "name": "baz", "range": Array [ - 47, - 50, + 98, + 101, ], "type": "Identifier", }, "loc": Object { "end": Object { "column": 24, - "line": 4, + "line": 6, }, "start": Object { "column": 2, - "line": 4, + "line": 6, }, }, "optional": true, "range": Array [ - 39, - 61, + 90, + 112, ], "static": false, "type": "ClassProperty", @@ -21250,355 +21398,1523 @@ Object { "loc": Object { "end": Object { "column": 23, - "line": 4, + "line": 6, }, "start": Object { "column": 15, - "line": 4, + "line": 6, }, }, "range": Array [ - 52, - 60, + 103, + 111, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { "column": 23, - "line": 4, + "line": 6, }, "start": Object { "column": 17, - "line": 4, + "line": 6, }, }, "range": Array [ - 54, - 60, + 105, + 111, ], "type": "TSStringKeyword", }, }, "value": null, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 63, - ], - "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 { + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "computed", + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": true, + "range": Array [ + 115, + 127, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 131, + 140, + ], + "raw": "'literal'", + "type": "Literal", + "value": "literal", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 130, + 143, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 146, + 151, + ], + "static": false, + "type": "ClassProperty", + "value": null, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "computed2", + "range": Array [ + 155, + 164, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 154, + 175, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 166, + 174, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 168, + 174, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 179, + 189, + ], + "raw": "'literal2'", + "type": "Literal", + "value": "literal2", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "optional": true, + "range": Array [ + 178, + 200, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 191, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 204, + 205, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 203, + 216, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 207, + 215, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 209, + 215, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 61, + 218, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 218, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 219, + ], + "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": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + "value": "computed", + }, + 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": "String", + "value": "'buzz'", + }, + 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": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "String", + "value": "'bazz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 56, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 90, + 97, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 105, + 111, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + "value": "computed", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 3, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 8, }, }, "range": Array [ - 0, - 63, + 130, + 131, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "[", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 6, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 131, + 140, + ], + "type": "String", + "value": "'literal'", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 155, + 164, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": "?", }, - }, - "range": Array [ - 0, - 64, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 15, + "line": 10, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 10, }, }, "range": Array [ - 0, - 5, + 166, + 167, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 22, + "line": 10, }, "start": Object { - "column": 6, - "line": 1, + "column": 16, + "line": 10, }, }, "range": Array [ - 6, - 9, + 168, + 174, ], "type": "Identifier", - "value": "Foo", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 23, + "line": 10, }, "start": Object { - "column": 10, - "line": 1, + "column": 22, + "line": 10, }, }, "range": Array [ - 10, - 11, + 174, + 175, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 3, + "line": 11, }, "start": Object { "column": 2, - "line": 2, + "line": 11, }, }, "range": Array [ - 14, - 17, + 178, + 179, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 13, + "line": 11, }, "start": Object { - "column": 5, - "line": 2, + "column": 3, + "line": 11, }, }, "range": Array [ - 17, - 18, + 179, + 189, ], - "type": "Punctuator", - "value": "?", + "type": "String", + "value": "'literal2'", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 14, + "line": 11, }, "start": Object { - "column": 6, - "line": 2, + "column": 13, + "line": 11, }, }, "range": Array [ - 18, - 19, + 189, + 190, ], "type": "Punctuator", - "value": ";", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 15, + "line": 11, }, "start": Object { - "column": 2, - "line": 3, + "column": 14, + "line": 11, }, }, "range": Array [ - 22, - 25, + 190, + 191, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "?", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 16, + "line": 11, }, "start": Object { - "column": 5, - "line": 3, + "column": 15, + "line": 11, }, }, "range": Array [ - 25, - 26, + 191, + 192, ], "type": "Punctuator", - "value": "?", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 23, + "line": 11, }, "start": Object { - "column": 7, - "line": 3, + "column": 17, + "line": 11, }, }, "range": Array [ - 27, - 28, + 193, + 199, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 11, }, "start": Object { - "column": 9, - "line": 3, + "column": 23, + "line": 11, }, }, "range": Array [ - 29, - 35, + 199, + 200, ], - "type": "Identifier", - "value": "string", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 3, + "line": 12, }, "start": Object { - "column": 15, - "line": 3, + "column": 2, + "line": 12, }, }, "range": Array [ - 35, - 36, + 203, + 204, ], "type": "Punctuator", - "value": ";", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 4, + "line": 12, }, "start": Object { - "column": 2, - "line": 4, + "column": 3, + "line": 12, }, }, "range": Array [ - 39, - 46, + 204, + 205, ], - "type": "Keyword", - "value": "private", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 5, + "line": 12, }, "start": Object { - "column": 10, - "line": 4, + "column": 4, + "line": 12, }, }, "range": Array [ - 47, - 50, + 205, + 206, ], - "type": "Identifier", - "value": "baz", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 6, + "line": 12, }, "start": Object { - "column": 13, - "line": 4, + "column": 5, + "line": 12, }, }, "range": Array [ - 50, - 51, + 206, + 207, ], "type": "Punctuator", "value": "?", @@ -21606,17 +22922,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 7, + "line": 12, }, "start": Object { - "column": 15, - "line": 4, + "column": 6, + "line": 12, }, }, "range": Array [ - 52, - 53, + 207, + 208, ], "type": "Punctuator", "value": ":", @@ -21624,17 +22940,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 4, + "column": 14, + "line": 12, }, "start": Object { - "column": 17, - "line": 4, + "column": 8, + "line": 12, }, }, "range": Array [ - 54, - 60, + 209, + 215, ], "type": "Identifier", "value": "string", @@ -21642,17 +22958,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 15, + "line": 12, }, "start": Object { - "column": 23, - "line": 4, + "column": 14, + "line": 12, }, }, "range": Array [ - 60, - 61, + 215, + 216, ], "type": "Punctuator", "value": ";", @@ -21661,16 +22977,16 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 13, }, "start": Object { "column": 0, - "line": 5, + "line": 13, }, }, "range": Array [ - 62, - 63, + 217, + 218, ], "type": "Punctuator", "value": "}", From 926cf646a441a0cca3a9bf83a767f00bc4a4d854 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 30 Sep 2019 17:02:23 +0000 Subject: [PATCH 070/317] chore: publish v2.3.2 --- 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 | 8 ++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 11 +++++++++++ packages/parser/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 11 +++++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 12 ++++++++++++ packages/typescript-estree/package.json | 4 ++-- 14 files changed, 90 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7e3f1abca6..ac7f8e0ca8a 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.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnec-type-arg] undefined symbol crash ([#1007](https://github.com/typescript-eslint/typescript-eslint/issues/1007)) ([cdf9294](https://github.com/typescript-eslint/typescript-eslint/commit/cdf9294)) +* **typescript-estree:** correct ClassDeclarationBase type ([#1008](https://github.com/typescript-eslint/typescript-eslint/issues/1008)) ([8ce3a81](https://github.com/typescript-eslint/typescript-eslint/commit/8ce3a81)) +* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) diff --git a/lerna.json b/lerna.json index 9ce79426f6a..16ca1c0d0e8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.3.1", + "version": "2.3.2", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 93061fb4365..bebccf5ca5e 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.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 + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) **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 8ecc7d9ce56..0d1dd95c219 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.1", + "version": "2.3.2", "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.1", + "@typescript-eslint/experimental-utils": "2.3.2", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.3.1" + "@typescript-eslint/parser": "2.3.2" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index ba778927648..d9be8637d98 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.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnec-type-arg] undefined symbol crash ([#1007](https://github.com/typescript-eslint/typescript-eslint/issues/1007)) ([cdf9294](https://github.com/typescript-eslint/typescript-eslint/commit/cdf9294)) +* **typescript-estree:** correct ClassDeclarationBase type ([#1008](https://github.com/typescript-eslint/typescript-eslint/issues/1008)) ([8ce3a81](https://github.com/typescript-eslint/typescript-eslint/commit/8ce3a81)) + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index f69cb9db4e5..3251f3b93cd 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.1", + "version": "2.3.2", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.3.1", + "@typescript-eslint/experimental-utils": "2.3.2", "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 ec6b8aa74ec..598085cefc8 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.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 + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) **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 efcb42f4fdb..753fd606a28 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.1", + "version": "2.3.2", "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.1", + "@typescript-eslint/typescript-estree": "2.3.2", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 716e9cbaaea..1098745e130 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.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) + + +### Bug Fixes + +* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) diff --git a/packages/parser/package.json b/packages/parser/package.json index 5dab6bcc84a..aa14e9e3f77 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.3.1", + "version": "2.3.2", "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.1", - "@typescript-eslint/typescript-estree": "2.3.1", + "@typescript-eslint/experimental-utils": "2.3.2", + "@typescript-eslint/typescript-estree": "2.3.2", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.3.1", + "@typescript-eslint/shared-fixtures": "2.3.2", "glob": "^7.1.4" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index ce614b93101..938f88a906b 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.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) + + +### Bug Fixes + +* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 0361519db33..fc7944ea50d 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.1", + "version": "2.3.2", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index c4a5449df00..ae3e39147ed 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.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) + + +### Bug Fixes + +* **typescript-estree:** correct ClassDeclarationBase type ([#1008](https://github.com/typescript-eslint/typescript-eslint/issues/1008)) ([8ce3a81](https://github.com/typescript-eslint/typescript-eslint/commit/8ce3a81)) +* **typescript-estree:** handle optional computed prop w/o type ([#1026](https://github.com/typescript-eslint/typescript-eslint/issues/1026)) ([95c13fe](https://github.com/typescript-eslint/typescript-eslint/commit/95c13fe)) + + + + + ## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 4600ef5015b..906c23639a3 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.1", + "version": "2.3.2", "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.1", + "@typescript-eslint/shared-fixtures": "2.3.2", "babel-code-frame": "^6.26.0", "glob": "^7.1.4", "lodash.isplainobject": "4.0.6", From 192e23dc0a185dd4482a5080af380c54cdd3ec68 Mon Sep 17 00:00:00 2001 From: Pavel Birukov Date: Wed, 2 Oct 2019 19:55:50 +0300 Subject: [PATCH 071/317] fix(experimental-utils): remove Rule.meta.extraDescription (#1036) --- packages/experimental-utils/src/ts-eslint/Rule.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 75acea5988c..1724dec828b 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -18,10 +18,6 @@ interface RuleMetaDataDocs { * Concise description of the rule */ description: string; - /** - * Extra information linking the rule to a tslint rule - */ - extraDescription?: string[]; /** * The recommendation level for the rule. * Used by the build tools to generate the recommended config. From 47895c078f8ecc679c3c5f794863646d0e6dbcad Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 4 Oct 2019 19:13:49 +0300 Subject: [PATCH 072/317] fix(eslint-plugin): [class-name-casing] allow unicode letters (#1043) --- .../src/rules/class-name-casing.ts | 22 ++++++++++++---- .../tests/rules/class-name-casing.test.ts | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/class-name-casing.ts b/packages/eslint-plugin/src/rules/class-name-casing.ts index c71a39fd2ac..b27bf1ebcf1 100644 --- a/packages/eslint-plugin/src/rules/class-name-casing.ts +++ b/packages/eslint-plugin/src/rules/class-name-casing.ts @@ -38,16 +38,28 @@ export default util.createRule({ }, defaultOptions: [{ allowUnderscorePrefix: false }], create(context, [options]) { + const UNDERSCORE = '_'; + + /** + * Determine if the string is Upper cased + * @param str + */ + function isUpperCase(str: string): boolean { + return str === str.toUpperCase(); + } + /** * Determine if the identifier name is PascalCased * @param name The identifier name */ function isPascalCase(name: string): boolean { - if (options.allowUnderscorePrefix) { - return /^_?[A-Z][0-9A-Za-z]*$/.test(name); - } else { - return /^[A-Z][0-9A-Za-z]*$/.test(name); - } + const startIndex = + options.allowUnderscorePrefix && name.startsWith(UNDERSCORE) ? 1 : 0; + + return ( + isUpperCase(name.charAt(startIndex)) && + !name.includes(UNDERSCORE, startIndex) + ); } /** diff --git a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts index 7409fd927e6..7c89c699d5e 100644 --- a/packages/eslint-plugin/tests/rules/class-name-casing.test.ts +++ b/packages/eslint-plugin/tests/rules/class-name-casing.test.ts @@ -18,11 +18,22 @@ ruleTester.run('class-name-casing', rule, { code: 'class _NameWithUnderscore {}', options: [{ allowUnderscorePrefix: true }], }, + { + code: 'class Foo {}', + options: [{ allowUnderscorePrefix: true }], + }, + { + code: 'class _ÈFoo {}', + options: [{ allowUnderscorePrefix: true }], + }, 'var Foo = class {};', 'interface SomeInterface {}', 'class ClassNameWithDigit2 {}', 'abstract class ClassNameWithDigit2 {}', 'var ba_zz = class Foo {};', + 'class ClassNameWithUnicodeÈ {}', + 'class ÈClassNameWithUnicode {}', + 'class ClassNameWithæUnicode {}', ], invalid: [ @@ -152,5 +163,19 @@ ruleTester.run('class-name-casing', rule, { }, ], }, + { + code: `class æInvalidClassNameWithUnicode {}`, + errors: [ + { + messageId: 'notPascalCased', + data: { + friendlyName: 'Class', + name: 'æInvalidClassNameWithUnicode', + }, + line: 1, + column: 7, + }, + ], + }, ], }); From 60943e6f270e02a9779d11b6b86b9913b02d2968 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 7 Oct 2019 06:35:41 +0300 Subject: [PATCH 073/317] fix(eslint-plugin): [efrt] support constructor arguments (#1021) Co-authored-by: Brad Zacher --- .../src/rules/explicit-function-return-type.ts | 12 +++++++++++- .../rules/explicit-function-return-type.test.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index 43a1cac41fb..d7e5fe18b7b 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -152,6 +152,15 @@ export default util.createRule({ ); } + /** + * Checks if a node belongs to: + * new Foo(() => {}) + * ^^^^^^^^ + */ + function isConstructorArgument(parent: TSESTree.Node): boolean { + return parent.type === AST_NODE_TYPES.NewExpression; + } + /** * Checks if a node is a type cast * `(() => {}) as Foo` @@ -325,7 +334,8 @@ export default util.createRule({ isVariableDeclaratorWithTypeAnnotation(node.parent) || isClassPropertyWithTypeAnnotation(node.parent) || isPropertyOfObjectWithType(node.parent) || - isFunctionArgument(node.parent, node) + isFunctionArgument(node.parent, node) || + isConstructorArgument(node.parent) ) { return; } diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index bd69534089d..3552c718d65 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -322,6 +322,18 @@ const func = (value: number) => x as const; }, ], }, + { + filename: 'test.ts', + code: ` +new Promise(resolve => {}); +new Foo(1, () => {}); + `, + options: [ + { + allowTypedFunctionExpressions: true, + }, + ], + }, ], invalid: [ { From 054df278d6b7064a44b5f78fec453bf9ae6ad281 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 7 Oct 2019 17:02:23 +0000 Subject: [PATCH 074/317] 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 ac7f8e0ca8a..fd6a1421944 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 16ca1c0d0e8..093a7b7253e 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 bebccf5ca5e..50d3ff8d511 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 0d1dd95c219..1944e16e02e 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 d9be8637d98..ecbd6059dfb 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 3251f3b93cd..2458e18eb1b 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 598085cefc8..43271d72e81 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 753fd606a28..b17f79a2ca3 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 1098745e130..9ccea9c2f80 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 aa14e9e3f77..a5a641ef517 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 938f88a906b..959a366b0e6 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 fc7944ea50d..6b55d5122d8 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 ae3e39147ed..0bf4baa176b 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 906c23639a3..b5918d8d939 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 075/317] 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 56909f15fa7..7bbdd6522e0 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 2c135fea6a7..3f0e88926a2 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 1724dec828b..dad91e6a8e0 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 7cc4aa9d893..756527ff83f 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 4ae1b5dcf86..b7ff28646a6 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 d4361bf3d5c..799c3e917c0 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 076/317] =?UTF-8?q?fix(eslint-plugin):=20[promise-function?= =?UTF-8?q?-async]=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 5ccddf45ed4..79000974cea 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 1575cf02dfc..d907f3d45a5 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 6f769d7f950..72213da6ebb 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 46100db7982..66a65a21ffd 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 077/317] 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 f20381c2071..40f3398fb7d 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 078/317] docs: add TOC to root README (#838) --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index b5736851523..7dbe5f150a5 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 079/317] 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 7dbe5f150a5..801c15aa1a1 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 080/317] 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 6ae76ac3b6c..337e239983b 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 3a06baccf6f..582f78d2d60 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 adcf2422e8f..9f2782e2bb5 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 2dce8eb9335..e4d690b0bb4 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 1944e16e02e..78d58d38427 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 b0fced27d72..d6987c27afe 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 7db2d0520ff..5362fa1c79c 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 2458e18eb1b..9eeb7f31616 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 978adc10966..f96d1739f18 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 1ab98da19ab..86f3842dae3 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 fb7e21da237..4ef2253e8b4 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 b17f79a2ca3..e312f6b1114 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 eea1a957768..87f91912905 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 863d0c076f2..84da228fb81 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 c052e521130..e1b49976461 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 f469d044ef4..4ef2253e8b4 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 a5a641ef517..9979d210ed8 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 830a282da1e..bcb6dde759a 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 530b26c444b..39548ea1b3b 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 a94802fb081..b1d34cc5c3d 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 6f763b588b5..adda86ea16c 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 b5918d8d939..0e2dcc97914 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 77a649f6f30..1a47f30f16d 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 882a8bbff7e..75d3983cf55 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 e6ef356b6f3..4dab9030a55 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 dfa1b047f36..59c7b8b2b55 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 a3e0148907c..f5d3f31b27c 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 6ed8db76cbc..38b80aafbaa 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 00000000000..c588570bf73 --- /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 792172fb82f..145fd09f633 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 2ea9199d263..7dc0e63275b 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 00000000000..2d9938163ea --- /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 9f41d090fe9..8054910b566 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 081/317] 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 1c2b4b3dd80..474d245895c 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 9f2782e2bb5..0174acc7be3 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 801c15aa1a1..f296ee034ef 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 e4d690b0bb4..c848499ff78 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 5362fa1c79c..65fc5ce6584 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 b2f22b8a0aa..6f3f31c9c6e 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 3f0e88926a2..9951db4ea8b 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 280213dde0f..3daa37e14dd 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 4ef2253e8b4..9cea515ba6b 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 4ef2253e8b4..9cea515ba6b 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 756527ff83f..e594fb240e0 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 92affb66677..86f198bdab9 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 cf9bd22368c..ab627ecea75 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 39548ea1b3b..7055ca98d19 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 b1d34cc5c3d..2f7c5d79609 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 adda86ea16c..a987c8b550d 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 00000000000..6ecd2db00aa --- /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 00000000000..7de9343489e --- /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 00000000000..6a3ba4500d1 --- /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 00000000000..6fbf4219de0 --- /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 00000000000..584155016de --- /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 00000000000..28727047a6d --- /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 00000000000..22b280ec535 --- /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 00000000000..5d2ab8745a1 --- /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 00000000000..586fda06dfd --- /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 00000000000..027a4c1197d --- /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 00000000000..fe226cfc388 --- /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 00000000000..146b4ce1484 --- /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 6b55d5122d8..30eb5af1899 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 00000000000..a4799817b0e --- /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 00000000000..75086e9799b --- /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 203fbe2b494..598178158b0 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 c23daf6e317..392c08fabb8 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 75d3983cf55..07435780a37 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 b7ff28646a6..13f2485819f 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 799c3e917c0..178ed9efe59 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 59c7b8b2b55..68639cb01b5 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 7fba488c78d..b236e5a9861 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 b90f5eb4548..5671b2447c1 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 5bf7a0b6adc..a73f908a362 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 52d62f3fd90..645b6114f8a 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 f5722861dd2..c1ba4580efd 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 76cb6fb260d..c0240d2580e 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 5cbee776bf2..44425c5e4a5 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 f5d3f31b27c..cfcc68284cc 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 157edec7412..6afffd43029 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 7dc0e63275b..9c39ef4a085 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 8054910b566..3a524d7a1cb 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 082/317] 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 fd6a1421944..66ff74784f0 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 093a7b7253e..f4653f7fb8d 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 50d3ff8d511..f76756a7a3e 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 78d58d38427..88c3cfe1d72 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 ecbd6059dfb..e39f75e5617 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 9eeb7f31616..c9e1b0fe0da 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 43271d72e81..f3721e9a3a8 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 e312f6b1114..d39a9110f7e 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 9ccea9c2f80..0017c21cb6a 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 9979d210ed8..e551b4d86ef 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 959a366b0e6..945b637ecb1 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 30eb5af1899..a833a2bd0ee 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 0bf4baa176b..0278cba2f3f 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 0e2dcc97914..4716b2ba19d 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 083/317] 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 c9e1b0fe0da..6633b8f2ca5 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 4716b2ba19d..7b0a0ed58fd 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 084/317] 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 50c4a7eacd3..517673f09d6 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 72020afc600..b1707685694 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 cae887c229f..58c41249d47 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 81e67999b8d..936fe3a8900 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 085/317] 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 55cf645d88e..fe1515c869e 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 7b0a0ed58fd..225380a2bd2 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 07435780a37..6aec2452e5a 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 4dab9030a55..5f3b97c036e 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 3a524d7a1cb..1817d623b81 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 086/317] 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 6aec2452e5a..7efde256c81 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 97493a5915a..9e6a26a39a6 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 087/317] 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 01a2505498f..e3597cf8348 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 1ab26cfa704..f65610ea3f4 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 088/317] 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 474d245895c..6552aae6613 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 f96d1739f18..7d8bdb2c695 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 00000000000..e124bd8ed57 --- /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 00000000000..8588b3c1bc4 --- /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 00000000000..9864c20cea0 --- /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 00000000000..9f14ec274ff --- /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 00000000000..4bfde8d2ba8 --- /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 00000000000..3607a7fb897 --- /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 1a47f30f16d..63e14a2fffb 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 7efde256c81..cb56c179a00 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 5f3b97c036e..00000000000 --- 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 de5d69d736c..9f3d8cab0be 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 38b80aafbaa..21664b7bd41 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 c588570bf73..bb77cefd7f7 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 6afffd43029..ccbc9d90581 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 089/317] 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 225380a2bd2..d8ca623677f 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 1817d623b81..888b1ba35fc 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 090/317] 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 c848499ff78..6390641fcae 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 cb56c179a00..c887193365f 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 888b1ba35fc..88507646d6d 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 091/317] 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 4bfde8d2ba8..a0a8eeefb48 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 f20f5baf174..7b9b183b59b 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 00000000000..ade2b409a3b --- /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 49bd30cc389..df23862a125 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 ba89362dcd1..b61a140ff5b 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 86423f3e4aa..861b7d99bed 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 092/317] 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 ac54dba64ca..996d1d9aae1 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 093/317] 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 66ff74784f0..490f45a7b3e 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 f4653f7fb8d..2a40ae9e906 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 f76756a7a3e..5128c179c54 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 88c3cfe1d72..7e2168b5ff1 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 e39f75e5617..f40f2624eec 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 6633b8f2ca5..cacc21e4713 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 f3721e9a3a8..dd63f064e21 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 d39a9110f7e..0f26e278fec 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 0017c21cb6a..1e2d3c4d0f6 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 e551b4d86ef..7e3f5e3ce34 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 945b637ecb1..3fef3f0ee9a 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 a833a2bd0ee..b482cfdcf92 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 0278cba2f3f..2389fef6c56 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 d8ca623677f..508d8400531 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 094/317] 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 a0a8eeefb48..3acf67d385a 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 3607a7fb897..a436ec7082d 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 bb77cefd7f7..e1cb8b9f9b7 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 ccbc9d90581..05e65137db4 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 095/317] 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 c887193365f..7ee2cdacbc3 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 9e6a26a39a6..581d28a7e96 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 096/317] 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 a436ec7082d..ac2dc3d5e62 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 097/317] 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 9951db4ea8b..704bc09dc65 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 ab627ecea75..84770969761 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 00000000000..307d36a6616 --- /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 00000000000..3b37e42e4b1 --- /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 598178158b0..8ffbc03b3ce 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 178ed9efe59..10cd0b7e0fb 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 68639cb01b5..4c7276573ff 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 645b6114f8a..423d0c5bc65 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 c1ba4580efd..f6b67ce5556 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 44425c5e4a5..6437b88068c 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 098/317] 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 84770969761..3d94d81e424 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 00000000000..4024fffa9d5 --- /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 7de9343489e..c411490d129 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 00000000000..a4a30b2d5df --- /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 00000000000..69c9e8efee5 --- /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 8ffbc03b3ce..67ca0be79b8 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 ac2dc3d5e62..c210ddee43e 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 7ee2cdacbc3..141ba25cce6 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 4c7276573ff..557ac0c11ce 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 423d0c5bc65..7454835c3ae 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 6437b88068c..14b0a341b7a 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 099/317] 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 3acf67d385a..ddd2d90ccb1 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 100/317] 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 996d1d9aae1..48b98849c41 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 72d38f1ed66..fd23d75cb5e 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 101/317] 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 490f45a7b3e..7df61feebd2 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 2a40ae9e906..f3a88ed9b37 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 5128c179c54..b3a92499169 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 7e2168b5ff1..00f7281ffef 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 f40f2624eec..09dfcf80463 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 cacc21e4713..e5ba66ba040 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 dd63f064e21..5d1e618d442 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 0f26e278fec..7cc729040e5 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 1e2d3c4d0f6..6075ce3ac7d 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 7e3f5e3ce34..d6ea0d95f60 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 3fef3f0ee9a..87ceff1bc55 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 b482cfdcf92..a19e0cd1e5a 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 2389fef6c56..e1232b70926 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 508d8400531..e28166f1eb8 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 102/317] 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 e124bd8ed57..383d10bd43d 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 8588b3c1bc4..d2e8c22901e 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 9f14ec274ff..04815b24648 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 ddd2d90ccb1..beabcdd6888 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 c210ddee43e..3e948841773 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 103/317] 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 6390641fcae..559b4e79271 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 9fcb9d04363..011fb69b13d 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 fe1515c869e..aca6f215dcb 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 d2e8c22901e..296aee2e5ba 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 04815b24648..d1ab5f98d21 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 3e948841773..6509997094f 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 bca89ec8d8c..e953f852a8e 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 21664b7bd41..53197b7a73d 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 00000000000..eb33e8bd62d --- /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 74bfb63dab2..c3a0b450d65 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 00000000000..92575183cd9 --- /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 00000000000..0d6eabe455e --- /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 00000000000..3b281e624c8 --- /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 00000000000..4fc96f79abc --- /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 00000000000..4641a6b33f4 --- /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 00000000000..45234bf35aa --- /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 00000000000..ea4319ac718 --- /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 00000000000..3b281e624c8 --- /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 00000000000..c08599249c3 --- /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 00000000000..d4432e47428 --- /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 00000000000..f59b6348fd6 --- /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 00000000000..861b7d99bed --- /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 b61a140ff5b..f59b6348fd6 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 4506da77349..8964e319869 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 88507646d6d..58e28ad5ec0 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 104/317] 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 e28166f1eb8..f4798d0d307 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 d3738774cd9..9a7de3e112a 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 392c08fabb8..da0034ee6ae 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 105/317] 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 7df61feebd2..5e89159a5e7 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 f3a88ed9b37..f467fc228a1 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 b3a92499169..bfbc5e38741 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 00f7281ffef..c0432f50ed1 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 09dfcf80463..bf30ed088fc 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 e5ba66ba040..75b4a0d903f 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 5d1e618d442..cabf42dd1a9 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 7cc729040e5..d05bf07280f 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 6075ce3ac7d..b6b7fc716a6 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 d6ea0d95f60..8283ffd3303 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 87ceff1bc55..320f1ba9ed0 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 a19e0cd1e5a..9d94966b4e1 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 e1232b70926..c90a056ec27 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 f4798d0d307..1104de8adbd 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 106/317] 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 b9977618c40..0ed4266a240 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 32de7e32c89..86cb1940826 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 107/317] 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 baec8f2426e..6d874a9c2b1 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 108/317] 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 9a7de3e112a..a82d9941dbd 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 109/317] 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 beabcdd6888..9223107986a 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 110/317] 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 40f3398fb7d..0cb6ec5d291 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 84626c38201..38d58b482fd 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 00000000000..4571cd04afb --- /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 1b98c064db0..27e90a46565 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 3d94d81e424..39f3da70df9 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 111/317] 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 6d874a9c2b1..b616245454e 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 00000000000..7da998ab2c6 --- /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 377f4b58f0e..395c1af592e 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 5302abd05de..4aa8beea1f6 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 00000000000..f7d86f50c1c --- /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 00000000000..46653b30c66 --- /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 120b11433cb..c21b235be44 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 112/317] 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 5e89159a5e7..f800e619f2d 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 f467fc228a1..991899f5133 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 bfbc5e38741..9613287c060 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 c0432f50ed1..b23071880ad 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 bf30ed088fc..1759b88a3c1 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 75b4a0d903f..b315da58059 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 cabf42dd1a9..fa483c6bd8f 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 d05bf07280f..2bbb6ddc9ec 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 b6b7fc716a6..45ba8b728f6 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 8283ffd3303..549dda9e82f 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 320f1ba9ed0..aa253e3d46e 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 9d94966b4e1..c457e83d4dd 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 c90a056ec27..28d91bddc6b 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 1104de8adbd..85a3a2b92b1 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 113/317] 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 b616245454e..75feac4ee49 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 06326a5439e..82e7737feb5 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 00000000000..63004682338 --- /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 395c1af592e..c7e9a99bc76 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 4aa8beea1f6..11c774610a0 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 00000000000..0ee1636ea64 --- /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 00000000000..e3b4e5366e8 --- /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 114/317] 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 27e90a46565..67d553fac46 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 bcb6dde759a..46878a9cdea 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 85a3a2b92b1..45386970cfa 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 fffb9ea15cf..270d50dde3f 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 141ba25cce6..0ef765ed8b6 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 a616f239a7b..e21d24d0de8 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 e953f852a8e..c09d5159cd4 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 53197b7a73d..ebfb922b839 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 fd8ab4970f9..6d16e90d00b 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 115/317] 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 75feac4ee49..20d3d817a21 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 00000000000..7ffafd5a5ae --- /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 c7e9a99bc76..84c450b0723 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 11c774610a0..87d02d56a3b 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 00000000000..2ecb1cbd62c --- /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 00000000000..1a167d64e30 --- /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 116/317] 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 46230f3d329..496188d4c0a 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 38816b60a2f..f10fbeaf3c9 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 d17348af746..d66691dd955 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 117/317] 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 84c450b0723..7df63e93856 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 664504783f0..5e3db377d0d 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 118/317] 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 82e7737feb5..2d4e37bded7 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 119/317] 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 20d3d817a21..9f82b851d29 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 00000000000..df8d848c7b4 --- /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 7df63e93856..23b38b458a3 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 87d02d56a3b..35f2d758291 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 00000000000..1def91e08f2 --- /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 00000000000..7acb61fa85f --- /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 5e3db377d0d..ff6c5c63a0c 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 120/317] 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 4bb614cba9d..0928484b629 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 e0e142c70a4..d2d3287ce66 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, + }, + ], + }, ], }); From 259ff20dfb52281243f442bc9e3b858f41863ce7 Mon Sep 17 00:00:00 2001 From: Hidemi Yukita Date: Fri, 15 Nov 2019 03:02:18 +0900 Subject: [PATCH 121/317] feat(eslint-plugin): [no-type-alias] handle conditional types (#953) --- .../eslint-plugin/docs/rules/no-type-alias.md | 11 ++++++ .../eslint-plugin/src/rules/no-type-alias.ts | 16 +++++++++ .../tests/rules/no-type-alias.test.ts | 35 +++++++++++++++++-- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 496188d4c0a..1927fdd54c9 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"`) +- `allowConditionalTypes` set to `"always"` will allow you to use type aliases with conditional types (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"`) @@ -249,6 +250,16 @@ type Foo = (name: string, age: number) => string | Person; type Foo = (name: string, age: number) => string & Person; ``` +### allowConditionalTypes + +This applies to conditional types. + +Examples of **correct** code for the `{ "allowConditionalTypes": "always" }` option: + +```ts +type Foo = T extends number ? number : null; +``` + ### allowConstructors This applies to constructor types. diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index f10fbeaf3c9..02aca84e315 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'; + allowConditionalTypes?: 'always' | 'never'; allowConstructors?: 'always' | 'never'; allowLiterals?: Values; allowMappedTypes?: Values; @@ -63,6 +64,9 @@ export default util.createRule({ allowCallbacks: { enum: ['always', 'never'], }, + allowConditionalTypes: { + enum: ['always', 'never'], + }, allowConstructors: { enum: ['always', 'never'], }, @@ -84,6 +88,7 @@ export default util.createRule({ { allowAliases: 'never', allowCallbacks: 'never', + allowConditionalTypes: 'never', allowConstructors: 'never', allowLiterals: 'never', allowMappedTypes: 'never', @@ -96,6 +101,7 @@ export default util.createRule({ { allowAliases, allowCallbacks, + allowConditionalTypes, allowConstructors, allowLiterals, allowMappedTypes, @@ -226,6 +232,16 @@ export default util.createRule({ if (allowCallbacks === 'never') { reportError(type.node, type.compositionType, isTopLevel, 'Callbacks'); } + } else if (type.node.type === AST_NODE_TYPES.TSConditionalType) { + // conditional type + if (allowConditionalTypes === 'never') { + reportError( + type.node, + type.compositionType, + isTopLevel, + 'Conditional types', + ); + } } else if (type.node.type === AST_NODE_TYPES.TSConstructorType) { if (allowConstructors === 'never') { reportError( 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 d66691dd955..be5ca84b9e5 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 MyType = T extends number ? number : null;', + options: [{ allowConditionalTypes: 'always' }], + }, { code: 'type Foo = new (bar: number) => string | null;', options: [{ allowConstructors: 'always' }], @@ -3188,9 +3192,36 @@ type Foo = { messageId: 'noTypeAlias', data: { alias: 'constructors', - line: 1, - column: 12, }, + line: 1, + column: 12, + }, + ], + }, + { + code: 'type MyType = T extends number ? number : null;', + errors: [ + { + messageId: 'noTypeAlias', + data: { + alias: 'conditional types', + }, + line: 1, + column: 18, + }, + ], + }, + { + code: 'type MyType = T extends number ? number : null;', + options: [{ allowConditionalTypes: 'never' }], + errors: [ + { + messageId: 'noTypeAlias', + data: { + alias: 'conditional types', + }, + line: 1, + column: 18, }, ], }, From 4fac6c5c40b1ff171db7ff6913534d307ac5a169 Mon Sep 17 00:00:00 2001 From: Retsam Date: Thu, 14 Nov 2019 20:25:27 -0500 Subject: [PATCH 122/317] fix(eslint-plugin): [no-unnecessary-cond] fix naked type param (#1207) --- .../src/rules/no-unnecessary-condition.ts | 12 ++++++++++-- .../tests/rules/no-unnecessary-condition.test.ts | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 49c8f13401c..8e75f7adb3f 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -110,8 +110,16 @@ export default createRule({ function checkNode(node: TSESTree.Node): void { const type = getNodeType(node); - // Conditional is always necessary if it involves `any` or `unknown` - if (isTypeFlagSet(type, TypeFlags.Any | TypeFlags.Unknown)) { + // Conditional is always necessary if it involves: + // `any` or `unknown` or a naked type parameter + if ( + unionTypeParts(type).some(part => + isTypeFlagSet( + part, + TypeFlags.Any | TypeFlags.Unknown | ts.TypeFlags.TypeParameter, + ), + ) + ) { return; } if (isTypeFlagSet(type, TypeFlags.Never)) { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index f298495a26f..c5d90fd01ef 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -72,6 +72,16 @@ const t1 = (b1 && b2) ? 'yes' : 'no'`, function test(t: T) { return t ? 'yes' : 'no' }`, + ` +// Naked type param +function test(t: T) { + return t ? 'yes' : 'no' +}`, + ` +// Naked type param in union +function test(t: T | []) { + return t ? 'yes' : 'no' +}`, // Boolean expressions ` From e2008e3878f46e9fc573a518f7e7e8d0d5aedfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AA=97=E4=BD=A0=E6=98=AF=E5=B0=8F=E7=8C=AB=E5=92=AA?= Date: Fri, 15 Nov 2019 09:27:29 +0800 Subject: [PATCH 123/317] fix(eslint-plugin): [indent] fix decorator type (#1189) --- packages/eslint-plugin/src/rules/indent.ts | 1 + .../tests/rules/indent/indent.test.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 704bc09dc65..a8845fb6cd9 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -81,6 +81,7 @@ const KNOWN_NODES = new Set([ AST_NODE_TYPES.TSTypeParameterInstantiation, AST_NODE_TYPES.TSTypeReference, AST_NODE_TYPES.TSUnionType, + AST_NODE_TYPES.Decorator, ]); export default util.createRule({ diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index 9fb9ef7dadd..f49be833005 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -1717,5 +1717,26 @@ declare module "Validation" { }, ], }, + { + code: ` + @Decorator() +class Foo {} + `, + output: ` +@Decorator() +class Foo {} + `, + errors: [ + { + messageId: 'wrongIndentation', + data: { + expected: '0 spaces', + actual: 4, + }, + line: 2, + column: 1, + }, + ], + }, ], }); From 74192f86236501a8a0c170d37af692f6c97f0830 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 15 Nov 2019 08:56:49 -0800 Subject: [PATCH 124/317] chore: bump dependencies (#1208) --- .all-contributorsrc | 63 +- CONTRIBUTORS.md | 25 +- package.json | 29 +- .../eslint-plugin/docs/rules/array-type.md | 2 +- .../docs/rules/no-floating-promises.md | 5 +- .../eslint-plugin/docs/rules/no-type-alias.md | 2 +- packages/eslint-plugin/package.json | 14 +- packages/eslint-plugin/src/rules/indent.ts | 3 +- .../src/rules/interface-name-prefix.ts | 19 +- .../src/rules/space-before-function-paren.ts | 13 +- .../src/rules/triple-slash-reference.ts | 4 +- .../tools/validate-docs/parse-readme.ts | 1 - .../eslint-plugin/typings/eslint-rules.d.ts | 16 +- .../src/eslint-utils/deepMerge.ts | 37 +- packages/experimental-utils/src/index.ts | 4 +- packages/parser/package.json | 2 +- packages/typescript-estree/package.json | 5 +- packages/typescript-estree/src/node-utils.ts | 3 +- .../src/ts-estree/ts-nodes.ts | 3 +- packages/typescript-estree/tests/lib/parse.ts | 7 +- tools/generate-contributors.ts | 24 +- yarn.lock | 966 +++++++++--------- 22 files changed, 656 insertions(+), 591 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index f44ccc64c55..bdd6f75d8c9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -58,6 +58,13 @@ "profile": "https://github.com/j-f1", "contributions": [] }, + { + "login": "a-tarasyuk", + "name": "Alexander T.", + "avatar_url": "https://avatars0.githubusercontent.com/u/509265?v=4", + "profile": "https://github.com/a-tarasyuk", + "contributions": [] + }, { "login": "uniqueiniquity", "name": "Ben Lichtman", @@ -65,6 +72,20 @@ "profile": "https://github.com/uniqueiniquity", "contributions": [] }, + { + "login": "scottohara", + "name": "Scott O'Hara", + "avatar_url": "https://avatars3.githubusercontent.com/u/289327?v=4", + "profile": "https://github.com/scottohara", + "contributions": [] + }, + { + "login": "JoshuaKGoldberg", + "name": "Josh Goldberg", + "avatar_url": "https://avatars1.githubusercontent.com/u/3335181?v=4", + "profile": "https://github.com/JoshuaKGoldberg", + "contributions": [] + }, { "login": "kaicataldo", "name": "Kai Cataldo", @@ -86,13 +107,6 @@ "profile": "https://github.com/mysticatea", "contributions": [] }, - { - "login": "JoshuaKGoldberg", - "name": "Josh Goldberg", - "avatar_url": "https://avatars1.githubusercontent.com/u/3335181?v=4", - "profile": "https://github.com/JoshuaKGoldberg", - "contributions": [] - }, { "login": "azz", "name": "Lucas Azzola", @@ -114,13 +128,6 @@ "profile": "https://github.com/ikatyang", "contributions": [] }, - { - "login": "scottohara", - "name": "Scott O'Hara", - "avatar_url": "https://avatars3.githubusercontent.com/u/289327?v=4", - "profile": "https://github.com/scottohara", - "contributions": [] - }, { "login": "macklinu", "name": "mackie", @@ -177,6 +184,13 @@ "profile": "https://github.com/octogonz", "contributions": [] }, + { + "login": "Retsam", + "name": "Retsam", + "avatar_url": "https://avatars0.githubusercontent.com/u/2281166?v=4", + "profile": "https://github.com/Retsam", + "contributions": [] + }, { "login": "mightyiam", "name": "Shahar Dawn Or", @@ -184,13 +198,6 @@ "profile": "https://github.com/mightyiam", "contributions": [] }, - { - "login": "a-tarasyuk", - "name": "Alexander T.", - "avatar_url": "https://avatars0.githubusercontent.com/u/509265?v=4", - "profile": "https://github.com/a-tarasyuk", - "contributions": [] - }, { "login": "webschik", "name": "Denys Kniazevych", @@ -198,6 +205,20 @@ "profile": "https://github.com/webschik", "contributions": [] }, + { + "login": "Validark", + "name": "Niles", + "avatar_url": "https://avatars2.githubusercontent.com/u/15217173?v=4", + "profile": "https://github.com/Validark", + "contributions": [] + }, + { + "login": "pablobirukov", + "name": "Pavel Birukov ", + "avatar_url": "https://avatars2.githubusercontent.com/u/1861546?v=4", + "profile": "https://github.com/pablobirukov", + "contributions": [] + }, { "login": "flying-sheep", "name": "Philipp A.", diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d458acc3c54..04023618bf8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,39 +16,42 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri Nicholas C. Zakas
Nicholas C. Zakas

Jed Fox
Jed Fox

+ Alexander T.
Alexander T.

Ben Lichtman
Ben Lichtman

- Kai Cataldo
Kai Cataldo

- Rasmus Eneman
Rasmus Eneman

+ Scott O'Hara
Scott O'Hara

- Toru Nagashima
Toru Nagashima

Josh Goldberg
Josh Goldberg

+ Kai Cataldo
Kai Cataldo

+ Rasmus Eneman
Rasmus Eneman

+ Toru Nagashima
Toru Nagashima

Lucas Azzola
Lucas Azzola

- Danny Fritz
Danny Fritz

- Ika
Ika

- Scott O'Hara
Scott O'Hara

+ Danny Fritz
Danny Fritz

+ Ika
Ika

mackie
mackie

Kanitkorn Sujautra
Kanitkorn Sujautra

Ricky Lippmann
Ricky Lippmann

- Simen Bekkhus
Simen Bekkhus

+ Simen Bekkhus
Simen Bekkhus

Gavin Barron
Gavin Barron

Kevin Partington
Kevin Partington

Lucas Duailibe
Lucas Duailibe

Pete Gonzalez
Pete Gonzalez

- Shahar Dawn Or
Shahar Dawn Or

- Alexander T.
Alexander T.

+ Retsam
Retsam

+ Shahar Dawn Or
Shahar Dawn Or

Denys Kniazevych
Denys Kniazevych

+ Niles
Niles

+ Pavel Birukov
Pavel Birukov

+ + Philipp A.
Philipp A.

Pig Fang
Pig Fang

Thomas den Hollander
Thomas den Hollander

- - Bence Dányi
Bence Dányi

diff --git a/package.json b/package.json index 559b4e79271..111bf02de8b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "cz": "git-cz", "check:docs": "lerna run check:docs", "check:configs": "lerna run check:configs", - "generate-contributors": "yarn ts-node ./tools/generate-contributors.ts && yarn all-contributors generate", + "generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate", "format": "prettier --write \"./**/*.{ts,js,json,md}\"", "format-check": "prettier --list-different \"./**/*.{ts,js,json,md}\"", "integration-tests": "./tests/integration/run-all-tests.sh", @@ -53,33 +53,32 @@ "@commitlint/cli": "^8.1.0", "@commitlint/config-conventional": "^8.1.0", "@commitlint/travis-cli": "^8.1.0", - "@types/jest": "^24.0.18", - "@types/node": "^12.7.2", - "all-contributors-cli": "^6.8.1", + "@types/jest": "^24.0.23", + "@types/node": "^12.12.7", + "all-contributors-cli": "^6.11.0", "cz-conventional-changelog": "^3.0.2", - "eslint": "^6.2.2", + "eslint": "^6.6.0", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-plugin": "^2.1.0", "eslint-plugin-import": "^2.18.2", - "eslint-plugin-jest": "^22.15.2", - "glob": "^7.1.4", - "husky": "^3.0.4", + "eslint-plugin-jest": "^23.0.4", + "husky": "^3.0.9", "isomorphic-fetch": "^2.2.1", "jest": "^24.9.0", - "lerna": "^3.16.4", - "lint-staged": "^9.2.5", + "lerna": "^3.18.4", + "lint-staged": "^9.4.3", "opencollective-postinstall": "^2.0.2", - "prettier": "^1.18.2", + "prettier": "^1.19.1", "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" + "ts-node": "^8.5.0", + "tslint": "^5.20.1", + "typescript": ">=3.2.1 <3.8.0" }, "collective": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "resolutions": { - "typescript": "^3.7.0-dev.20191021" + "typescript": "^3.7.2" } } diff --git a/packages/eslint-plugin/docs/rules/array-type.md b/packages/eslint-plugin/docs/rules/array-type.md index 275b4fbd617..9acab2200c8 100644 --- a/packages/eslint-plugin/docs/rules/array-type.md +++ b/packages/eslint-plugin/docs/rules/array-type.md @@ -74,7 +74,7 @@ Incorrect code for `"array-simple"`: ```ts const a: (string | number)[] = ['a', 'b']; -const b: ({ prop: string })[] = [{ prop: 'a' }]; +const b: { prop: string }[] = [{ prop: 'a' }]; const c: (() => void)[] = [() => {}]; const d: Array = ['a', 'b']; const e: Array = ['a', 'b']; diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index f52a510b546..9af9aebf1e6 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -31,7 +31,10 @@ await promise; async function returnsPromise() { return 'value'; } -returnsPromise().then(() => {}, () => {}); +returnsPromise().then( + () => {}, + () => {}, +); Promise.reject('value').catch(() => {}); ``` diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index 1927fdd54c9..285837f2935 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -500,7 +500,7 @@ type Foo = [number] | [number, number]; type Foo = [number] & [number, number]; -type Foo = [number] | [number, number] & [string, string]; +type Foo = [number] | ([number, number] & [string, string]); ``` Examples of **incorrect** code for the `{ "allowTupleTypes": "in-unions" }` option: diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index b315da58059..17eb148ab35 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -30,27 +30,27 @@ "main": "dist/index.js", "scripts": { "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", + "check:docs": "../../node_modules/.bin/ts-node --files --transpile-only ./tools/validate-docs/index.ts", + "check:configs": "../../node_modules/.bin/ts-node --files --transpile-only ./tools/validate-configs/index.ts", "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", + "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@typescript-eslint/experimental-utils": "2.7.0", - "eslint-utils": "^1.4.2", + "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", - "regexpp": "^2.0.1", + "regexpp": "^3.0.0", "tsutils": "^3.17.1" }, "devDependencies": { "@types/json-schema": "^7.0.3", - "@types/marked": "^0.6.5", + "@types/marked": "^0.7.1", "@types/prettier": "^1.18.2", - "chalk": "^2.4.2", + "chalk": "^3.0.0", "marked": "^0.7.0", "prettier": "*", "typescript": "*" diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index a8845fb6cd9..571767d5e00 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -239,7 +239,8 @@ export default util.createRule({ type: AST_NODE_TYPES.ObjectExpression, properties: (node.members as ( | TSESTree.TSEnumMember - | TSESTree.TypeElement)[]).map( + | TSESTree.TypeElement + )[]).map( member => TSPropertySignatureToProperty(member) as TSESTree.Property, ), diff --git a/packages/eslint-plugin/src/rules/interface-name-prefix.ts b/packages/eslint-plugin/src/rules/interface-name-prefix.ts index 13284fc2aa3..6f2c57dc315 100644 --- a/packages/eslint-plugin/src/rules/interface-name-prefix.ts +++ b/packages/eslint-plugin/src/rules/interface-name-prefix.ts @@ -9,16 +9,15 @@ type ParsedOptions = allowUnderscorePrefix: boolean; }; type Options = [ - - | 'never' - | 'always' - | { - prefixWithI?: 'never'; - } - | { - prefixWithI: 'always'; - allowUnderscorePrefix?: boolean; - }, + | 'never' + | 'always' + | { + prefixWithI?: 'never'; + } + | { + prefixWithI: 'always'; + allowUnderscorePrefix?: boolean; + }, ]; type MessageIds = 'noPrefix' | 'alwaysPrefix'; diff --git a/packages/eslint-plugin/src/rules/space-before-function-paren.ts b/packages/eslint-plugin/src/rules/space-before-function-paren.ts index 1def91e08f2..a23865f4a17 100644 --- a/packages/eslint-plugin/src/rules/space-before-function-paren.ts +++ b/packages/eslint-plugin/src/rules/space-before-function-paren.ts @@ -9,13 +9,12 @@ type Option = 'never' | 'always'; type FuncOption = Option | 'ignore'; export type Options = [ - - | Option - | Partial<{ - anonymous: FuncOption; - named: FuncOption; - asyncArrow: FuncOption; - }>, + | Option + | Partial<{ + anonymous: FuncOption; + named: FuncOption; + asyncArrow: FuncOption; + }>, ]; export type MessageIds = 'unexpected' | 'missing'; diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 8ce64e5748a..6669fe940bc 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -52,10 +52,10 @@ export default util.createRule({ create(context, [{ lib, path, types }]) { let programNode: TSESTree.Node; const sourceCode = context.getSourceCode(); - const references: ({ + const references: { comment: TSESTree.Comment; importName: string; - })[] = []; + }[] = []; function hasMatchingReference(source: TSESTree.Literal): void { references.forEach(reference => { diff --git a/packages/eslint-plugin/tools/validate-docs/parse-readme.ts b/packages/eslint-plugin/tools/validate-docs/parse-readme.ts index 92afaa37dd2..aace3736fcb 100644 --- a/packages/eslint-plugin/tools/validate-docs/parse-readme.ts +++ b/packages/eslint-plugin/tools/validate-docs/parse-readme.ts @@ -9,7 +9,6 @@ function parseReadme(): marked.Tokens.Table { ); const readme = marked.lexer(readmeRaw, { gfm: true, - tables: true, silent: false, }); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index c21b235be44..8037e624c4f 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -53,7 +53,7 @@ declare module 'eslint/lib/rules/indent' { 'wrongIndentation', [ ('tab' | number)?, - ({ + { SwitchCase?: number; VariableDeclarator?: | ElementList @@ -81,7 +81,7 @@ declare module 'eslint/lib/rules/indent' { flatTernaryExpressions?: boolean; ignoredNodes?: string[]; ignoreComments?: boolean; - })?, + }?, ], { '*:exit'(node: TSESTree.Node): void; @@ -236,7 +236,8 @@ declare module 'eslint/lib/rules/no-restricted-globals' { | { name: string; message?: string; - })[], + } + )[], { ArrowFunctionExpression(node: TSESTree.ArrowFunctionExpression): void; } @@ -296,7 +297,8 @@ declare module 'eslint/lib/rules/no-unused-vars' { argsIgnorePattern?: string; caughtErrors?: 'all' | 'none'; caughtErrorsIgnorePattern?: string; - })[], + } + )[], { ArrowFunctionExpression(node: TSESTree.ArrowFunctionExpression): void; } @@ -316,7 +318,8 @@ declare module 'eslint/lib/rules/no-unused-expressions' { allowShortCircuit?: boolean; allowTernary?: boolean; allowTaggedTemplates?: boolean; - })[], + } + )[], { ExpressionStatement(node: TSESTree.ExpressionStatement): void; } @@ -335,7 +338,8 @@ declare module 'eslint/lib/rules/no-use-before-define' { functions?: boolean; classes?: boolean; variables?: boolean; - })[], + } + )[], { ArrowFunctionExpression(node: TSESTree.ArrowFunctionExpression): void; } diff --git a/packages/experimental-utils/src/eslint-utils/deepMerge.ts b/packages/experimental-utils/src/eslint-utils/deepMerge.ts index 3db67a59407..b11083014c6 100644 --- a/packages/experimental-utils/src/eslint-utils/deepMerge.ts +++ b/packages/experimental-utils/src/eslint-utils/deepMerge.ts @@ -25,29 +25,26 @@ export function deepMerge( // get the unique set of keys across both objects const keys = new Set(Object.keys(first).concat(Object.keys(second))); - return Array.from(keys).reduce( - (acc, key) => { - const firstHasKey = key in first; - const secondHasKey = key in second; - const firstValue = first[key]; - const secondValue = second[key]; + return Array.from(keys).reduce((acc, key) => { + const firstHasKey = key in first; + const secondHasKey = key in second; + const firstValue = first[key]; + const secondValue = second[key]; - if (firstHasKey && secondHasKey) { - if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) { - // object type - acc[key] = deepMerge(firstValue, secondValue); - } else { - // value type - acc[key] = secondValue; - } - } else if (firstHasKey) { - acc[key] = firstValue; + if (firstHasKey && secondHasKey) { + if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) { + // object type + acc[key] = deepMerge(firstValue, secondValue); } else { + // value type acc[key] = secondValue; } + } else if (firstHasKey) { + acc[key] = firstValue; + } else { + acc[key] = secondValue; + } - return acc; - }, - {} as ObjectLike, - ); + return acc; + }, {} as ObjectLike); } diff --git a/packages/experimental-utils/src/index.ts b/packages/experimental-utils/src/index.ts index 98b643c344a..c9bde462d14 100644 --- a/packages/experimental-utils/src/index.ts +++ b/packages/experimental-utils/src/index.ts @@ -16,6 +16,4 @@ export { AST_TOKEN_TYPES, TSESTree, } from '@typescript-eslint/typescript-estree/dist/ts-estree'; -export { - ParserServices, -} from '@typescript-eslint/typescript-estree/dist/parser-options'; +export { ParserServices } from '@typescript-eslint/typescript-estree/dist/parser-options'; diff --git a/packages/parser/package.json b/packages/parser/package.json index 549dda9e82f..0511697a88c 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -50,6 +50,6 @@ "devDependencies": { "@types/glob": "^7.1.1", "@typescript-eslint/shared-fixtures": "2.7.0", - "glob": "^7.1.4" + "glob": "*" } } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 45386970cfa..ac09e497227 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -41,7 +41,7 @@ "dependencies": { "debug": "^4.1.1", "eslint-visitor-keys": "^1.1.0", - "glob": "^7.1.4", + "glob": "^7.1.6", "is-glob": "^4.0.1", "lodash.unescape": "4.0.1", "semver": "^6.3.0", @@ -57,11 +57,10 @@ "@types/is-glob": "^4.0.1", "@types/lodash.isplainobject": "^4.0.4", "@types/lodash.unescape": "^4.0.4", - "@types/semver": "^6.0.1", + "@types/semver": "^6.2.0", "@types/tmp": "^0.1.0", "@typescript-eslint/shared-fixtures": "2.7.0", "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/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index da0034ee6ae..69e4542b106 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -22,7 +22,8 @@ const ASSIGNMENT_OPERATORS: ts.AssignmentOperator[] = [ const LOGICAL_OPERATORS: ( | ts.LogicalOperator - | ts.SyntaxKind.QuestionQuestionToken)[] = [ + | ts.SyntaxKind.QuestionQuestionToken +)[] = [ SyntaxKind.BarBarToken, SyntaxKind.AmpersandAmpersandToken, SyntaxKind.QuestionQuestionToken, diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index b4298fa1530..4903ed3ab8b 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -176,4 +176,5 @@ export type TSNode = ts.Node & | ts.Bundle | ts.InputFiles | ts.UnparsedSource - | ts.JsonMinusNumericLiteral); + | ts.JsonMinusNumericLiteral + ); diff --git a/packages/typescript-estree/tests/lib/parse.ts b/packages/typescript-estree/tests/lib/parse.ts index ebfb922b839..9f469f4405d 100644 --- a/packages/typescript-estree/tests/lib/parse.ts +++ b/packages/typescript-estree/tests/lib/parse.ts @@ -268,7 +268,7 @@ describe('parse()', () => { jsxContent ? 'with' : 'without' } JSX content - parserOptions.jsx = ${jsxSetting}`, () => { let result; - let exp = expect(() => { + const exp = expect(() => { result = parser.parseAndGenerateServices(code, { ...config, jsx: jsxSetting, @@ -276,9 +276,10 @@ describe('parse()', () => { }); }); if (!shouldThrow) { - exp = exp.not; + exp.not.toThrow(); + } else { + exp.toThrow(); } - exp.toThrow(); if (!shouldThrow) { expect(result).toMatchSnapshot(); diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 86de0772395..8fd51a82033 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -41,7 +41,13 @@ async function* fetchUsers(page = 1): AsyncIterableIterator { const response = await fetch(`${contributorsApiUrl}&page=${page}`, { method: 'GET', }); - const contributors: Contributor[] = await response.json(); + const contributors: + | Contributor[] + | { message: string } = await response.json(); + + if (!Array.isArray(contributors)) { + throw new Error(contributors.message); + } const thresholdedContributors = contributors.filter( user => user.contributions >= COMPLETELY_ARBITRARY_CONTRIBUTION_COUNT, @@ -81,13 +87,15 @@ async function main(): Promise { // remove ignored users .filter(u => !IGNORED_USERS.has(u.login)) // fetch the in-depth information for each user - .map(u => ({ - login: u.login, - name: u.name, - avatar_url: u.avatar_url, // eslint-disable-line @typescript-eslint/camelcase - profile: u.html_url, - contributions: [], - })); + .map(usr => { + return { + login: usr.login, + name: usr.name || usr.login, + avatar_url: usr.avatar_url, // eslint-disable-line @typescript-eslint/camelcase + profile: usr.html_url, + contributions: [], + }; + }); // build + write the .all-contributorsrc const allContributorsConfig = { diff --git a/yarn.lock b/yarn.lock index 58e28ad5ec0..d344f2f426c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -511,15 +511,15 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" -"@lerna/add@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.16.2.tgz#90ecc1be7051cfcec75496ce122f656295bd6e94" - integrity sha512-RAAaF8aODPogj2Ge9Wj3uxPFIBGpog9M+HwSuq03ZnkkO831AmasCTJDqV+GEpl1U2DvnhZQEwHpWmTT0uUeEw== +"@lerna/add@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.18.4.tgz#0d97c75b64febc10a9a38546a3019f0f2c24b0e6" + integrity sha512-R+9RmYrSbcmnmaFL2aB0HJtTq95ePEa0FMS4r4NnA7Xw07l5buVBPOfxv6P8kFrVvIcNpaa7S0Eo/KkbycMhKA== dependencies: "@evocateur/pacote" "^9.6.3" - "@lerna/bootstrap" "3.16.2" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/bootstrap" "3.18.4" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" @@ -527,31 +527,22 @@ p-map "^2.1.0" semver "^6.2.0" -"@lerna/batch-packages@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.16.0.tgz#1c16cb697e7d718177db744cbcbdac4e30253c8c" - integrity sha512-7AdMkANpubY/FKFI01im01tlx6ygOBJ/0JcixMUWoWP/7Ds3SWQF22ID6fbBr38jUWptYLDs2fagtTDL7YUPuA== +"@lerna/bootstrap@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.18.4.tgz#b5340800358e4916e9d2ba728d266a23fdd7665c" + integrity sha512-mvqMyionPSqhbeGhoUQYEBTgbJ47LkONHfQ1AKBET0fJOjIZf6x0pWC17KvfCjsiE017325ySLKDH23z1Kb9ww== dependencies: - "@lerna/package-graph" "3.16.0" - npmlog "^4.1.2" - -"@lerna/bootstrap@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.16.2.tgz#be268d940221d3c3270656b9b791b492559ad9d8" - integrity sha512-I+gs7eh6rv9Vyd+CwqL7sftRfOOsSzCle8cv/CGlMN7/p7EAVhxEdAw8SYoHIKHzipXszuqqy1Y3opyleD0qdA== - dependencies: - "@lerna/batch-packages" "3.16.0" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/has-npm-version" "3.16.0" - "@lerna/npm-install" "3.16.0" - "@lerna/package-graph" "3.16.0" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" + "@lerna/has-npm-version" "3.16.5" + "@lerna/npm-install" "3.16.5" + "@lerna/package-graph" "3.18.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-parallel-batches" "3.16.0" - "@lerna/symlink-binary" "3.16.2" - "@lerna/symlink-dependencies" "3.16.2" + "@lerna/run-topologically" "3.18.0" + "@lerna/symlink-binary" "3.17.0" + "@lerna/symlink-dependencies" "3.17.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" get-port "^4.2.0" @@ -565,88 +556,87 @@ read-package-tree "^5.1.6" semver "^6.2.0" -"@lerna/changed@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.16.4.tgz#c3e727d01453513140eee32c94b695de577dc955" - integrity sha512-NCD7XkK744T23iW0wqKEgF4R9MYmReUbyHCZKopFnsNpQdqumc3SOIvQUAkKCP6hQJmYvxvOieoVgy/CVDpZ5g== +"@lerna/changed@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.18.4.tgz#2453ad7b3545554eaa365347a229042918b6decc" + integrity sha512-Ui4UsneDk9gCuJRfTpR5js+Ctt9Je+j+3Q4z7H7HhBn6WeWDTp6FBGJZ7SfrBCdQ47EKK27Mr95LbJ4I77xFfQ== dependencies: - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" - "@lerna/listable" "3.16.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.0" + "@lerna/listable" "3.18.4" "@lerna/output" "3.13.0" - "@lerna/version" "3.16.4" -"@lerna/check-working-tree@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.14.2.tgz#5ce007722180a69643a8456766ed8a91fc7e9ae1" - integrity sha512-7safqxM/MYoAoxZxulUDtIJIbnBIgo0PB/FHytueG+9VaX7GMnDte2Bt1EKa0dz2sAyQdmQ3Q8ZXpf/6JDjaeg== +"@lerna/check-working-tree@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.16.5.tgz#b4f8ae61bb4523561dfb9f8f8d874dd46bb44baa" + integrity sha512-xWjVBcuhvB8+UmCSb5tKVLB5OuzSpw96WEhS2uz6hkWVa/Euh1A0/HJwn2cemyK47wUrCQXtczBUiqnq9yX5VQ== dependencies: - "@lerna/collect-uncommitted" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/collect-uncommitted" "3.16.5" + "@lerna/describe-ref" "3.16.5" "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.14.2.tgz#950240cba83f7dfe25247cfa6c9cebf30b7d94f6" - integrity sha512-xnq+W5yQb6RkwI0p16ZQnrn6HkloH/MWTw4lGE1nKsBLAUbmSU5oTE93W1nrG0X3IMF/xWc9UYvNdUGMWvZZ4w== +"@lerna/child-process@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.16.5.tgz#38fa3c18064aa4ac0754ad80114776a7b36a69b2" + integrity sha512-vdcI7mzei9ERRV4oO8Y1LHBZ3A5+ampRKg1wq5nutLsUA4mEBN6H7JqjWOMY9xZemv6+kATm2ofjJ3lW5TszQg== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.16.0.tgz#1c134334cacea1b1dbeacdc580e8b9240db8efa1" - integrity sha512-5P9U5Y19WmYZr7UAMGXBpY7xCRdlR7zhHy8MAPDKVx70rFIBS6nWXn5n7Kntv74g7Lm1gJ2rsiH5tj1OPcRJgg== +"@lerna/clean@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.18.4.tgz#704b345dfec4610823d6670e37f9984196d58874" + integrity sha512-puuL0sBHIv3Tvq8cdu3kCGfRpdsXuaDGIRha33GVmRPfMBi2GN8nPPysVyWmP99PfgfafO6eT5R3jqXjvASAZA== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" -"@lerna/cli@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.13.0.tgz#3d7b357fdd7818423e9681a7b7f2abd106c8a266" - integrity sha512-HgFGlyCZbYaYrjOr3w/EsY18PdvtsTmDfpUQe8HwDjXlPeCCUgliZjXLOVBxSjiOvPeOSwvopwIHKWQmYbwywg== +"@lerna/cli@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.18.0.tgz#2b6f8605bee299c6ada65bc2e4b3ed7bf715af3a" + integrity sha512-AwDyfGx7fxJgeaZllEuyJ9LZ6Tdv9yqRD9RX762yCJu+PCAFvB9bp6OYuRSGli7QQgM0CuOYnSg4xVNOmuGKDA== dependencies: "@lerna/global-options" "3.13.0" dedent "^0.7.0" npmlog "^4.1.2" - yargs "^12.0.1" + yargs "^14.2.0" -"@lerna/collect-uncommitted@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.14.2.tgz#b5ed00d800bea26bb0d18404432b051eee8d030e" - integrity sha512-4EkQu4jIOdNL2BMzy/N0ydHB8+Z6syu6xiiKXOoFl0WoWU9H1jEJCX4TH7CmVxXL1+jcs8FIS2pfQz4oew99Eg== +"@lerna/collect-uncommitted@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.16.5.tgz#a494d61aac31cdc7aec4bbe52c96550274132e63" + integrity sha512-ZgqnGwpDZiWyzIQVZtQaj9tRizsL4dUOhuOStWgTAw1EMe47cvAY2kL709DzxFhjr6JpJSjXV5rZEAeU3VE0Hg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" chalk "^2.3.1" figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.16.0.tgz#6db3ce8a740a4e2b972c033a63bdfb77f2553d8c" - integrity sha512-HwAIl815X2TNlmcp28zCrSdXfoZWNP7GJPEqNWYk7xDJTYLqQ+SrmKUePjb3AMGBwYAraZSEJLbHdBpJ5+cHmQ== +"@lerna/collect-updates@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.18.0.tgz#6086c64df3244993cc0a7f8fc0ddd6a0103008a6" + integrity sha512-LJMKgWsE/var1RSvpKDIxS8eJ7POADEc0HM3FQiTpEczhP6aZfv9x3wlDjaHpZm9MxJyQilqxZcasRANmRcNgw== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/child-process" "3.16.5" + "@lerna/describe-ref" "3.16.5" minimatch "^3.0.4" npmlog "^4.1.2" slash "^2.0.0" -"@lerna/command@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.16.0.tgz#ba3dba49cb5ce4d11b48269cf95becd86e30773f" - integrity sha512-u7tE4GC4/gfbPA9eQg+0ulnoJ+PMoMqomx033r/IxqZrHtmJR9+pF/37S0fsxJ2hX/RMFPC7c9Q/i8NEufSpdQ== +"@lerna/command@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.18.0.tgz#1e40399324a69d26a78969d59cf60e19b2f13fc3" + integrity sha512-JQ0TGzuZc9Ky8xtwtSLywuvmkU8X62NTUT3rMNrUykIkOxBaO+tE0O98u2yo/9BYOeTRji9IsjKZEl5i9Qt0xQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/package-graph" "3.16.0" - "@lerna/project" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/package-graph" "3.18.0" + "@lerna/project" "3.18.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" dedent "^0.7.0" @@ -681,14 +671,14 @@ fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.16.0.tgz#4de841ec7d98b29bb19fb7d6ad982e65f7a150e8" - integrity sha512-OZApR1Iz7awutbmj4sAArwhqCyKgcrnw9rH0aWAUrkYWrD1w4TwkvAcYAsfx5GpQGbLQwoXhoyyPwPfZRRWz3Q== +"@lerna/create@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.18.0.tgz#78ba4af5eced661944a12b9d7da8553c096c390d" + integrity sha512-y9oS7ND5T13c+cCTJHa2Y9in02ppzyjsNynVWFuS40eIzZ3z058d9+3qSBt1nkbbQlVyfLoP6+bZPsjyzap5ig== dependencies: "@evocateur/pacote" "^9.6.3" - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.0" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" @@ -705,49 +695,51 @@ validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.14.2.tgz#edc3c973f5ca9728d23358c4f4d3b55a21f65be5" - integrity sha512-qa5pzDRK2oBQXNjyRmRnN7E8a78NMYfQjjlRFB0KNHMsT6mCiL9+8kIS39sSE2NqT8p7xVNo2r2KAS8R/m3CoQ== +"@lerna/describe-ref@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.16.5.tgz#a338c25aaed837d3dc70b8a72c447c5c66346ac0" + integrity sha512-c01+4gUF0saOOtDBzbLMFOTJDHTKbDFNErEY6q6i9QaXuzy9LNN62z+Hw4acAAZuJQhrVWncVathcmkkjvSVGw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" -"@lerna/diff@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.16.0.tgz#6d09a786f9f5b343a2fdc460eb0be08a05b420aa" - integrity sha512-QUpVs5TPl8vBIne10/vyjUxanQBQQp7Lk3iaB8MnCysKr0O+oy7trWeFVDPEkBTCD177By7yPGyW5Yey1nCBbA== +"@lerna/diff@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.18.0.tgz#9638ff4b46e2a8b0d4ebf54cf2f267ac2f8fdb29" + integrity sha512-3iLNlpurc2nV9k22w8ini2Zjm2UPo3xtQgWyqdA6eJjvge0+5AlNAWfPoV6cV+Hc1xDbJD2YDSFpZPJ1ZGilRw== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.0" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.16.0.tgz#2b6c033cee46181b6eede0eb12aad5c2c0181e89" - integrity sha512-mH3O5NXf/O88jBaBBTUf+d56CUkxpg782s3Jxy7HWbVuSUULt3iMRPTh+zEXO5/555etsIVVDDyUR76meklrJA== +"@lerna/exec@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.18.4.tgz#7f722abc3c7074dffe6aa48bca71171e0635f84a" + integrity sha512-BpBFxyCQXcfess9Nmj/OwQ9e1IhzPzNxqF5JK7dPIjko5oBn5Hm2EWVAcgUGSHKPZGLiOWPu3Wx/C92NtDBS1w== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/run-topologically" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" + "@lerna/run-topologically" "3.18.0" "@lerna/validation-error" "3.13.0" p-map "^2.1.0" -"@lerna/filter-options@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.16.0.tgz#b1660b4480c02a5c6efa4d0cd98b9afde4ed0bba" - integrity sha512-InIi1fF8+PxpCwir9bIy+pGxrdE6hvN0enIs1eNGCVS1TTE8osNgiZXa838bMQ1yaEccdcnVX6Z03BNKd56kNg== +"@lerna/filter-options@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.18.4.tgz#f5476a7ee2169abed27ad433222e92103f56f9f1" + integrity sha512-4giVQD6tauRwweO/322LP2gfVDOVrt/xN4khkXyfkJDfcsZziFXq+668otD9KSLL8Ps+To4Fah3XbK0MoNuEvA== dependencies: - "@lerna/collect-updates" "3.16.0" - "@lerna/filter-packages" "3.16.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/filter-packages" "3.18.0" dedent "^0.7.0" + figgy-pudding "^3.5.1" + npmlog "^4.1.2" -"@lerna/filter-packages@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.16.0.tgz#7d34dc8530c71016263d6f67dc65308ecf11c9fc" - integrity sha512-eGFzQTx0ogkGDCnbTuXqssryR6ilp8+dcXt6B+aq1MaqL/vOJRZyqMm4TY3CUOUnzZCi9S2WWyMw3PnAJOF+kg== +"@lerna/filter-packages@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.18.0.tgz#6a7a376d285208db03a82958cfb8172e179b4e70" + integrity sha512-6/0pMM04bCHNATIOkouuYmPg6KH3VkPCIgTfQmdkPJTullERyEQfNUKikrefjxo1vHOoCACDpy65JYyKiAbdwQ== dependencies: "@lerna/validation-error" "3.13.0" multimatch "^3.0.0" @@ -769,12 +761,12 @@ ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.0.tgz#619874e461641d4f59ab1b3f1a7ba22dba88125d" - integrity sha512-IVJjcKjkYaUEPJsDyAblHGEFFNKCRyMagbIDm14L7Ab94ccN6i4TKOqAFEJn2SJHYvKKBdp3Zj2zNlASOMe3DA== +"@lerna/github-client@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.5.tgz#2eb0235c3bf7a7e5d92d73e09b3761ab21f35c2e" + integrity sha512-rHQdn8Dv/CJrO3VouOP66zAcJzrHsm+wFuZ4uGAai2At2NkgKH+tpNhQy2H1PSC0Ezj9LxvdaHYrUzULqVK5Hw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@octokit/plugin-enterprise-rest" "^3.6.1" "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" @@ -794,21 +786,21 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.0.tgz#55764a4ce792f0c8553cf996a17f554b9e843288" - integrity sha512-TIY036dA9J8OyTrZq9J+it2DVKifL65k7hK8HhkUPpitJkw6jwbMObA/8D40LOGgWNPweJWqmlrTbRSwsR7DrQ== +"@lerna/has-npm-version@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.5.tgz#ab83956f211d8923ea6afe9b979b38cc73b15326" + integrity sha512-WL7LycR9bkftyqbYop5rEGJ9sRFIV55tSGmbN1HLrF9idwOCD7CLrT64t235t3t4O5gehDnwKI5h2U3oxTrF8Q== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" semver "^6.2.0" -"@lerna/import@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.16.0.tgz#b57cb453f4acfc60f6541fcbba10674055cb179d" - integrity sha512-trsOmGHzw0rL/f8BLNvd+9PjoTkXq2Dt4/V2UCha254hMQaYutbxcYu8iKPxz9x86jSPlH7FpbTkkHXDsoY7Yg== +"@lerna/import@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.18.0.tgz#c6b124b346a097e6c0f3f1ed4921a278d18bc80b" + integrity sha512-2pYIkkBTZsEdccfc+dPsKZeSw3tBzKSyl0b2lGrfmNX2Y41qqOzsJCyI1WO1uvEIP8aOaLy4hPpqRIBe4ee7hw== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.0" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" @@ -816,44 +808,44 @@ fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.16.0.tgz#31e0d66bbededee603338b487a42674a072b7a7d" - integrity sha512-Ybol/x5xMtBgokx4j7/Y3u0ZmNh0NiSWzBFVaOs2NOJKvuqrWimF67DKVz7yYtTYEjtaMdug64ohFF4jcT/iag== +"@lerna/init@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.18.0.tgz#b23b9170cce1f4630170dd744e8ee75785ea898d" + integrity sha512-/vHpmXkMlSaJaq25v5K13mcs/2L7E32O6dSsEkHaZCDRiV2BOqsZng9jjbE/4ynfsWfLLlU9ZcydwG72C3I+mQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.0" fs-extra "^8.1.0" p-map "^2.1.0" write-json-file "^3.2.0" -"@lerna/link@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.16.2.tgz#6c3a5658f6448a64dddca93d9348ac756776f6f6" - integrity sha512-eCPg5Lo8HT525fIivNoYF3vWghO3UgEVFdbsiPmhzwI7IQyZro5HWYzLtywSAdEog5XZpd2Bbn0CsoHWBB3gww== +"@lerna/link@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.18.0.tgz#bc72dc62ef4d8fb842b3286887980f98b764781d" + integrity sha512-FbbIpH0EpsC+dpAbvxCoF3cn7F1MAyJjEa5Lh3XkDGATOlinMFuKCbmX0NLpOPQZ5zghvrui97cx+jz5F2IlHw== dependencies: - "@lerna/command" "3.16.0" - "@lerna/package-graph" "3.16.0" - "@lerna/symlink-dependencies" "3.16.2" + "@lerna/command" "3.18.0" + "@lerna/package-graph" "3.18.0" + "@lerna/symlink-dependencies" "3.17.0" p-map "^2.1.0" slash "^2.0.0" -"@lerna/list@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.16.0.tgz#883c00b2baf1e03c93e54391372f67a01b773c2f" - integrity sha512-TkvstoPsgKqqQ0KfRumpsdMXfRSEhdXqOLq519XyI5IRWYxhoqXqfi8gG37UoBPhBNoe64japn5OjphF3rOmQA== +"@lerna/list@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.18.4.tgz#4320f262cdb2df54b57b3ef0da935c568e30f1e9" + integrity sha512-bgtlhAwhjHOTLq0iIuPs30abeuLbwZvVB60Ym8kPp+chh939obKU3vy2KMyX+Gpxf8pzuQG+k986YXcUBvXVsw== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/listable" "3.16.0" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" + "@lerna/listable" "3.18.4" "@lerna/output" "3.13.0" -"@lerna/listable@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.16.0.tgz#e6dc47a2d5a6295222663486f50e5cffc580f043" - integrity sha512-mtdAT2EEECqrJSDm/aXlOUFr1MRE4p6hppzY//Klp05CogQy6uGaKk+iKG5yyCLaOXFFZvG4HfO11CmoGSDWzw== +"@lerna/listable@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.18.4.tgz#45d14ad4eba00d7da71deba839312bed78e02680" + integrity sha512-EKSsnST5k3dZfw+UTwBH1/sHQ1YfgjYjGxXCabyn55mMgc2GjoDekODMYzZ1TNF2NNy6RgIZ24X2JI8G22nZUw== dependencies: - "@lerna/query-graph" "3.16.0" + "@lerna/query-graph" "3.18.0" chalk "^2.3.1" columnify "^1.5.4" @@ -875,10 +867,10 @@ config-chain "^1.1.11" pify "^4.0.1" -"@lerna/npm-dist-tag@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.16.0.tgz#b2184cee5e1f291277396854820e1117a544b7ee" - integrity sha512-MQrBkqJJB9+eNphuj9w90QPMOs4NQXMuSRk9NqzeFunOmdDopPCV0Q7IThSxEuWnhJ2n3B7G0vWUP7tNMPdqIQ== +"@lerna/npm-dist-tag@3.18.1": + version "3.18.1" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.1.tgz#d4dd82ea92e41e960b7117f83102ebcd7a23e511" + integrity sha512-vWkZh2T/O9OjPLDrba0BTWO7ug/C3sCwjw7Qyk1aEbxMBXB/eEJPqirwJTWT+EtRJQYB01ky3K8ZFOhElVyjLw== dependencies: "@evocateur/npm-registry-fetch" "^4.0.0" "@lerna/otplease" "3.16.0" @@ -886,12 +878,12 @@ npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.0.tgz#8ec76a7a13b183bde438fd46296bf7a0d6f86017" - integrity sha512-APUOIilZCzDzce92uLEwzt1r7AEMKT/hWA1ThGJL+PO9Rn8A95Km3o2XZAYG4W0hR+P4O2nSVuKbsjQtz8CjFQ== +"@lerna/npm-install@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.5.tgz#d6bfdc16f81285da66515ae47924d6e278d637d3" + integrity sha512-hfiKk8Eku6rB9uApqsalHHTHY+mOrrHeWEs+gtg7+meQZMTS3kzv4oVp5cBZigndQr3knTLjwthT/FX4KvseFg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" fs-extra "^8.1.0" npm-package-arg "^6.1.0" @@ -914,12 +906,12 @@ pify "^4.0.1" read-package-json "^2.0.13" -"@lerna/npm-run-script@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.14.2.tgz#8c518ea9d241a641273e77aad6f6fddc16779c3f" - integrity sha512-LbVFv+nvAoRTYLMrJlJ8RiakHXrLslL7Jp/m1R18vYrB8LYWA3ey+nz5Tel2OELzmjUiemAKZsD9h6i+Re5egg== +"@lerna/npm-run-script@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.16.5.tgz#9c2ec82453a26c0b46edc0bb7c15816c821f5c15" + integrity sha512-1asRi+LjmVn3pMjEdpqKJZFT/3ZNpb+VVeJMwrJaV/3DivdNg7XlPK9LTrORuKU4PSvhdEZvJmSlxCKyDpiXsQ== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" @@ -952,10 +944,10 @@ tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.16.0.tgz#909c90fb41e02f2c19387342d2a5eefc36d56836" - integrity sha512-A2mum/gNbv7zCtAwJqoxzqv89As73OQNK2MgSX1SHWya46qoxO9a9Z2c5lOFQ8UFN5ZxqWMfFYXRCz7qzwmFXw== +"@lerna/package-graph@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.18.0.tgz#eb42d14404a55b26b2472081615e26b0817cd91a" + integrity sha512-BLYDHO5ihPh20i3zoXfLZ5ZWDCrPuGANgVhl7k5pCmRj90LCvT+C7V3zrw70fErGAfvkcYepMqxD+oBrAYwquQ== dependencies: "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" @@ -979,10 +971,10 @@ dependencies: semver "^6.2.0" -"@lerna/project@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.16.0.tgz#2469a4e346e623fd922f38f5a12931dfb8f2a946" - integrity sha512-NrKcKK1EqXqhrGvslz6Q36+ZHuK3zlDhGdghRqnxDcHxMPT01NgLcmsnymmQ+gjMljuLRmvKYYCuHrknzX8VrA== +"@lerna/project@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.18.0.tgz#56feee01daeb42c03cbdf0ed8a2a10cbce32f670" + integrity sha512-+LDwvdAp0BurOAWmeHE3uuticsq9hNxBI0+FMHiIai8jrygpJGahaQrBYWpwbshbQyVLeQgx3+YJdW2TbEdFWA== dependencies: "@lerna/package" "3.16.0" "@lerna/validation-error" "3.13.0" @@ -1005,22 +997,22 @@ inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.16.4.tgz#4cd55d8be9943d9a68e316e930a90cda8590500e" - integrity sha512-XZY+gRuF7/v6PDQwl7lvZaGWs8CnX6WIPIu+OCcyFPSL/rdWegdN7HieKBHskgX798qRQc2GrveaY7bNoTKXAw== +"@lerna/publish@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.18.4.tgz#2f3de9d00ae63ec89b5411199e8bac96445b9f17" + integrity sha512-Q+MqM5DUZvk+uT6hdEyO3khXET6LwED0YEuCu8fRwtHad03HkZ9i8PtTY5h8Sn6D6RCyCOlHTuf8O0KKAUy3ow== dependencies: "@evocateur/libnpmaccess" "^3.1.2" "@evocateur/npm-registry-fetch" "^4.0.0" "@evocateur/pacote" "^9.6.3" - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" - "@lerna/describe-ref" "3.14.2" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.0" + "@lerna/describe-ref" "3.16.5" "@lerna/log-packed" "3.16.0" "@lerna/npm-conf" "3.16.0" - "@lerna/npm-dist-tag" "3.16.0" + "@lerna/npm-dist-tag" "3.18.1" "@lerna/npm-publish" "3.16.2" "@lerna/otplease" "3.16.0" "@lerna/output" "3.13.0" @@ -1029,9 +1021,9 @@ "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-topologically" "3.16.0" + "@lerna/run-topologically" "3.18.0" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.16.4" + "@lerna/version" "3.18.4" figgy-pudding "^3.5.1" fs-extra "^8.1.0" npm-package-arg "^6.1.0" @@ -1048,12 +1040,12 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.16.0.tgz#e6a46ebcd9d5b03f018a06eca2b471735353953c" - integrity sha512-p0RO+xmHDO95ChJdWkcy9TNLysLkoDARXeRHzY5U54VCwl3Ot/2q8fMCVlA5UeGXDutEyyByl3URqEpcQCWI7Q== +"@lerna/query-graph@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.18.0.tgz#43801a2f1b80a0ea0bfd9d42d470605326a3035d" + integrity sha512-fgUhLx6V0jDuKZaKj562jkuuhrfVcjl5sscdfttJ8dXNVADfDz76nzzwLY0ZU7/0m69jDedohn5Fx5p7hDEVEg== dependencies: - "@lerna/package-graph" "3.16.0" + "@lerna/package-graph" "3.18.0" figgy-pudding "^3.5.1" "@lerna/resolve-symlink@3.16.0": @@ -1065,12 +1057,12 @@ npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.14.2.tgz#103a49882abd85d42285d05cc76869b89f21ffd2" - integrity sha512-eFNkZsy44Bu9v1Hrj5Zk6omzg8O9h/7W6QYK1TTUHeyrjTEwytaNQlqF0lrTLmEvq55sviV42NC/8P3M2cvq8Q== +"@lerna/rimraf-dir@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.16.5.tgz#04316ab5ffd2909657aaf388ea502cb8c2f20a09" + integrity sha512-bQlKmO0pXUsXoF8lOLknhyQjOZsCc0bosQDoX4lujBXSWxHVTg1VxURtWf2lUjz/ACsJVDfvHZbDm8kyBk5okA== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" @@ -1085,55 +1077,47 @@ npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.16.0.tgz#5ace7911a2dd31dfd1e53c61356034e27df0e1fb" - integrity sha512-2J/Nyv+MvogmQEfC7VcS21ifk7w0HVvzo2yOZRPvkCzGRu/rducxtB4RTcr58XCZ8h/Bt1aqQYKExu3c/3GXwg== +"@lerna/run-topologically@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.18.0.tgz#9508604553cfbeba106cd84b711fade17947f94a" + integrity sha512-lrfEewwuUMC3ioxf9Z9NdHUakN6ihekcPfdYbzR2slmdbjYKmIA5srkWdrK8NwOpQCAuekpOovH2s8X3FGEopg== dependencies: - p-map "^2.1.0" - p-map-series "^1.0.0" - -"@lerna/run-topologically@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.16.0.tgz#39e29cfc628bbc8e736d8e0d0e984997ac01bbf5" - integrity sha512-4Hlpv4zDtKWa5Z0tPkeu0sK+bxZEKgkNESMGmWrUCNfj7xwvAJurcraK8+a2Y0TFYwf0qjSLY/MzX+ZbJA3Cgw== - dependencies: - "@lerna/query-graph" "3.16.0" + "@lerna/query-graph" "3.18.0" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.16.0.tgz#1ea568c6f303e47fa00b3403a457836d40738fd2" - integrity sha512-woTeLlB1OAAz4zzjdI6RyIxSGuxiUPHJZm89E1pDEPoWwtQV6HMdMgrsQd9ATsJ5Ez280HH4bF/LStAlqW8Ufg== +"@lerna/run@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.18.4.tgz#c3ab3bffe4f098761c210a3215582f3b5b0d7227" + integrity sha512-u2ZNO2fVk5kVEpbpn4DLJZZxZ08LFnIFuaXJMAhxvOgvm12ZF2rabA9kZc3NXp5+DedG5nHHgyoyLVVbStKzBA== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/npm-run-script" "3.14.2" + "@lerna/command" "3.18.0" + "@lerna/filter-options" "3.18.4" + "@lerna/npm-run-script" "3.16.5" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.16.0" + "@lerna/run-topologically" "3.18.0" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" p-map "^2.1.0" -"@lerna/symlink-binary@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.16.2.tgz#f98a3d9da9e56f1d302dc0d5c2efeb951483ee66" - integrity sha512-kz9XVoFOGSF83gg4gBqH+mG6uxfJfTp8Uy+Cam40CvMiuzfODrGkjuBEFoM/uO2QOAwZvbQDYOBpKUa9ZxHS1Q== +"@lerna/symlink-binary@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.17.0.tgz#8f8031b309863814883d3f009877f82e38aef45a" + integrity sha512-RLpy9UY6+3nT5J+5jkM5MZyMmjNHxZIZvXLV+Q3MXrf7Eaa1hNqyynyj4RO95fxbS+EZc4XVSk25DGFQbcRNSQ== dependencies: "@lerna/create-symlink" "3.16.2" "@lerna/package" "3.16.0" fs-extra "^8.1.0" p-map "^2.1.0" -"@lerna/symlink-dependencies@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.16.2.tgz#91d9909d35897aebd76a03644a00cd03c4128240" - integrity sha512-wnZqGJQ+Jvr1I3inxrkffrFZfmQI7Ta8gySw/UWCy95QtZWF/f5yk8zVIocCAsjzD0wgb3jJE3CFJ9W5iwWk1A== +"@lerna/symlink-dependencies@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.17.0.tgz#48d6360e985865a0e56cd8b51b308a526308784a" + integrity sha512-KmjU5YT1bpt6coOmdFueTJ7DFJL4H1w5eF8yAQ2zsGNTtZ+i5SGFBWpb9AQaw168dydc3s4eu0W0Sirda+F59Q== dependencies: "@lerna/create-symlink" "3.16.2" "@lerna/resolve-symlink" "3.16.0" - "@lerna/symlink-binary" "3.16.2" + "@lerna/symlink-binary" "3.17.0" fs-extra "^8.1.0" p-finally "^1.0.0" p-map "^2.1.0" @@ -1151,26 +1135,27 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.16.4.tgz#b5cc37f3ad98358d599c6196c30b6efc396d42bf" - integrity sha512-ikhbMeIn5ljCtWTlHDzO4YvTmpGTX1lWFFIZ79Vd1TNyOr+OUuKLo/+p06mCl2WEdZu0W2s5E9oxfAAQbyDxEg== +"@lerna/version@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.18.4.tgz#48261a8a69d1b15ab40a7cc6400381c4e480ec6b" + integrity sha512-+gR9H89qSP8iqzNi4tRVQUbWlFMOlhbY6+5TXkP72Ibb/z87O+C46DBqizSMVaPQYdSYjS1c9Xfa1oOhEWxGaw== dependencies: - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.0" "@lerna/conventional-commits" "3.16.4" - "@lerna/github-client" "3.16.0" + "@lerna/github-client" "3.16.5" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/prompt" "3.13.0" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-topologically" "3.16.0" + "@lerna/run-topologically" "3.18.0" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" + load-json-file "^5.3.0" minimatch "^3.0.4" npmlog "^4.1.2" p-map "^2.1.0" @@ -1180,6 +1165,7 @@ semver "^6.2.0" slash "^2.0.0" temp-write "^3.4.0" + write-json-file "^3.2.0" "@lerna/write-log-file@3.13.0": version "3.13.0" @@ -1329,6 +1315,11 @@ dependencies: "@babel/types" "^7.3.0" +"@types/color-name@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" + integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== + "@types/debug@^4.1.5": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" @@ -1378,17 +1369,12 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" -"@types/jest-diff@*": - version "20.0.1" - resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" - integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== - -"@types/jest@^24.0.18": - version "24.0.18" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" - integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== +"@types/jest@^24.0.23": + version "24.0.23" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.23.tgz#046f8e2ade026fe831623e361a36b6fb9a4463e4" + integrity sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg== dependencies: - "@types/jest-diff" "*" + jest-diff "^24.3.0" "@types/json-schema@^7.0.3": version "7.0.3" @@ -1421,21 +1407,26 @@ 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" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.6.5.tgz#3cf2a56ef615dad24aaf99784ef90a9eba4e29d8" - integrity sha512-6kBKf64aVfx93UJrcyEZ+OBM5nGv4RLsI6sR1Ar34bpgvGVRoyTgpxn4ZmtxOM5aDTAaaznYuYUH8bUX3Nk3YA== +"@types/marked@^0.7.1": + version "0.7.1" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.7.1.tgz#2f56cb2aa942efde23bd2beb9e07f4b6ddd25563" + integrity sha512-QMgeCgUMyNKfteIzmVuFcyGXORiD67fbEQbwbfJLIn+HejcyaQm0H00q66PJz8bMb8Ve4JrsJ2JXuStyZ4DjZg== "@types/minimatch@*": version "3.0.3" 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", "@types/node@^12.7.2": +"@types/node@*", "@types/node@^12.0.2": version "12.7.11" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== +"@types/node@^12.12.7": + version "12.12.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" + integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -1451,6 +1442,11 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.2.tgz#5e8b09f0e4af53034b1d0fb9977a277847836205" integrity sha512-G1Ggy7/9Nsa1Jt2yiBR2riEuyK2DFNnqow6R7cromXPMNynackRY1vqFTLz/gwnef1LHokbXThcPhqMRjUbkpQ== +"@types/semver@^6.2.0": + version "6.2.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.0.tgz#d688d574400d96c5b0114968705366f431831e1a" + integrity sha512-1OzrNb4RuAzIT7wHSsgZRlMBlNsJl+do6UblR7JMW4oB7bbR+uBEYtUh7gEc/jM84GGilh68lSOokyM/zNUlBA== + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -1473,23 +1469,6 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/experimental-utils@^1.13.0": - version "1.13.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e" - integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg== - dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "1.13.0" - eslint-scope "^4.0.0" - -"@typescript-eslint/typescript-estree@1.13.0": - version "1.13.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e" - integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw== - dependencies: - lodash.unescape "4.0.1" - semver "5.5.0" - "@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" @@ -1525,10 +1504,10 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" -acorn-jsx@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" - integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== acorn-walk@^6.0.1: version "6.2.0" @@ -1545,7 +1524,7 @@ acorn@^6.0.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== -acorn@^7.0.0: +acorn@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== @@ -1589,14 +1568,14 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -all-contributors-cli@^6.8.1: - 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== +all-contributors-cli@^6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.11.0.tgz#ee30151ef7df3971a968ccfe1e94e40d19555beb" + integrity sha512-QhOzpYHyzz9hmPCKO5nbRVjoeQDsCAovZpx3RlleeabfBRBohHkAZzJwPiQB5wmX5ZTwo3/9r3gkJ8zmj+j4vQ== dependencies: "@babel/runtime" "^7.2.0" async "^3.0.1" - chalk "^2.3.0" + chalk "^3.0.0" didyoumean "^1.2.1" inquirer "^6.2.1" json-fixer "^1.3.1-0" @@ -1610,6 +1589,13 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" + integrity sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q== + dependencies: + type-fest "^0.5.2" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -1625,6 +1611,11 @@ ansi-regex@^4.0.0, ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -1637,6 +1628,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.0.tgz#5681f0dcf7ae5880a7841d8831c4724ed9cc0172" + integrity sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg== + dependencies: + "@types/color-name" "^1.1.1" + color-convert "^2.0.1" + any-observable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" @@ -2137,6 +2136,14 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -2174,6 +2181,13 @@ cli-cursor@^2.0.0, cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + cli-truncate@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" @@ -2187,15 +2201,6 @@ cli-width@^2.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= -cliui@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -2235,11 +2240,23 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" @@ -2849,6 +2866,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" @@ -2980,20 +3002,12 @@ eslint-plugin-import@^2.18.2: read-pkg-up "^2.0.0" resolve "^1.11.0" -eslint-plugin-jest@^22.15.2: - 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== +eslint-plugin-jest@^23.0.4: + version "23.0.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.0.4.tgz#1ab81ffe3b16c5168efa72cbd4db14d335092aa0" + integrity sha512-OaP8hhT8chJNodUPvLJ6vl8gnalcsU/Ww1t9oR3HnGdEWjm/DdCCUXLOral+IPGAeWu/EwgVQCK/QtxALpH1Yw== dependencies: - "@typescript-eslint/experimental-utils" "^1.13.0" - -eslint-scope@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" + "@typescript-eslint/experimental-utils" "^2.5.0" eslint-scope@^5.0.0: version "5.0.0" @@ -3003,22 +3017,22 @@ eslint-scope@^5.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" - integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== dependencies: - eslint-visitor-keys "^1.0.0" + eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.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.5.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.5.1.tgz#828e4c469697d43bb586144be152198b91e96ed6" - integrity sha512-32h99BoLYStT1iq1v2P9uwpyznQ4M2jRiFB6acitKz52Gqn+vPaMDUTB1bYi1WN4Nquj2w+t+bimYUG83DC55A== +eslint@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.6.0.tgz#4a01a2fb48d32aacef5530ee9c5a78f11a8afd04" + integrity sha512-PpEBq7b6qY/qrOmpYQ/jTMDYfuQMELR4g4WI1M/NaSDDD/bdcMb+dj4Hgks7p41kW2caXsPsEZAEAyAgjVVC0g== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3027,9 +3041,9 @@ eslint@^6.2.2: debug "^4.0.1" doctrine "^3.0.0" eslint-scope "^5.0.0" - eslint-utils "^1.4.2" + eslint-utils "^1.4.3" eslint-visitor-keys "^1.1.0" - espree "^6.1.1" + espree "^6.1.2" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" @@ -3039,7 +3053,7 @@ eslint@^6.2.2: ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.4.1" + inquirer "^7.0.0" is-glob "^4.0.0" js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" @@ -3058,13 +3072,13 @@ eslint@^6.2.2: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" - integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== dependencies: - acorn "^7.0.0" - acorn-jsx "^5.0.2" + acorn "^7.1.0" + acorn-jsx "^5.1.0" eslint-visitor-keys "^1.1.0" esprima@^3.1.3: @@ -3315,6 +3329,13 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" @@ -3516,11 +3537,6 @@ genfun@^5.0.0: resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" integrity sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA== -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== - get-caller-file@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -3663,6 +3679,18 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= +glob@*, glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@7.1.4, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -3781,6 +3809,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" @@ -3885,20 +3918,20 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^3.0.4: - version "3.0.8" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.8.tgz#8de3fed26ce9b43034ef51013c4ad368b6b74ea8" - integrity sha512-HFOsgcyrX3qe/rBuqyTt+P4Gxn5P0seJmr215LAZ/vnwK3jWB3r0ck7swbzGRUbufCf9w/lgHPVbF/YXQALgfQ== +husky@^3.0.9: + version "3.0.9" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.9.tgz#a2c3e9829bfd6b4957509a9500d2eef5dbfc8044" + integrity sha512-Yolhupm7le2/MqC1VYLk/cNmYxsSsqKkTyBhzQHhPK1jFnC89mmmNVuGtLNabjDI6Aj8UNIr0KpRNuBkiC4+sg== dependencies: chalk "^2.4.2" + ci-info "^2.0.0" cosmiconfig "^5.2.1" execa "^1.0.0" get-stdin "^7.0.0" - is-ci "^2.0.0" opencollective-postinstall "^2.0.2" pkg-dir "^4.2.0" please-upgrade-node "^3.2.0" - read-pkg "^5.1.1" + read-pkg "^5.2.0" run-node "^1.0.0" slash "^3.0.0" @@ -4033,7 +4066,7 @@ inquirer@6.5.0: strip-ansi "^5.1.0" through "^2.3.6" -inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.4.1: +inquirer@^6.2.0, inquirer@^6.2.1: version "6.5.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== @@ -4052,6 +4085,25 @@ inquirer@^6.2.0, inquirer@^6.2.1, inquirer@^6.4.1: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" + integrity sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^4.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + interpret@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" @@ -4064,11 +4116,6 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== - ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" @@ -4188,6 +4235,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" @@ -4471,7 +4523,7 @@ jest-config@^24.9.0: pretty-format "^24.9.0" realpath-native "^1.1.0" -jest-diff@^24.9.0: +jest-diff@^24.3.0, jest-diff@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== @@ -4926,38 +4978,31 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - left-pad@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -lerna@^3.16.4: - version "3.16.4" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.16.4.tgz#158cb4f478b680f46f871d5891f531f3a2cb31ec" - integrity sha512-0HfwXIkqe72lBLZcNO9NMRfylh5Ng1l8tETgYQ260ZdHRbPuaLKE3Wqnd2YYRRkWfwPyEyZO8mZweBR+slVe1A== - dependencies: - "@lerna/add" "3.16.2" - "@lerna/bootstrap" "3.16.2" - "@lerna/changed" "3.16.4" - "@lerna/clean" "3.16.0" - "@lerna/cli" "3.13.0" - "@lerna/create" "3.16.0" - "@lerna/diff" "3.16.0" - "@lerna/exec" "3.16.0" - "@lerna/import" "3.16.0" - "@lerna/init" "3.16.0" - "@lerna/link" "3.16.2" - "@lerna/list" "3.16.0" - "@lerna/publish" "3.16.4" - "@lerna/run" "3.16.0" - "@lerna/version" "3.16.4" +lerna@^3.18.4: + version "3.18.4" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.18.4.tgz#132858cabb8fc8393341ddddbbbd85dd0ca82a79" + integrity sha512-DiU53cvMxaU07Bj2HwBwUQ2O3c/ORNq/QwKj1vGJH4vSkZSTUxPryp2baSNlt8PmnLNXOVpw0vOTRkEF+6n/cA== + dependencies: + "@lerna/add" "3.18.4" + "@lerna/bootstrap" "3.18.4" + "@lerna/changed" "3.18.4" + "@lerna/clean" "3.18.4" + "@lerna/cli" "3.18.0" + "@lerna/create" "3.18.0" + "@lerna/diff" "3.18.0" + "@lerna/exec" "3.18.4" + "@lerna/import" "3.18.0" + "@lerna/init" "3.18.0" + "@lerna/link" "3.18.0" + "@lerna/list" "3.18.4" + "@lerna/publish" "3.18.4" + "@lerna/run" "3.18.4" + "@lerna/version" "3.18.4" import-local "^2.0.0" npmlog "^4.1.2" @@ -4979,10 +5024,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@^9.2.5: - 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== +lint-staged@^9.4.3: + version "9.4.3" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.3.tgz#f55ad5f94f6e105294bfd6499b23142961f7b982" + integrity sha512-PejnI+rwOAmKAIO+5UuAZU9gxdej/ovSEOAY34yMfC3OS4Ac82vCBPzAWLReR9zCPOMqeVwQRaZ3bUBpAsaL2Q== dependencies: chalk "^2.4.2" commander "^2.20.0" @@ -5183,7 +5228,7 @@ lodash@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.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.2.1: +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.17.15, 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== @@ -5287,13 +5332,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -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" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -5321,15 +5359,6 @@ marked@^0.7.0: resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e" integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg== -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - meow@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" @@ -5435,7 +5464,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -mimic-fn@^2.0.0, mimic-fn@^2.1.0: +mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -5565,7 +5594,7 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -mute-stream@~0.0.4: +mute-stream@0.0.8, mute-stream@~0.0.4: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== @@ -5940,15 +5969,6 @@ os-homedir@^1.0.0: resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= -os-locale@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.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" @@ -5970,11 +5990,6 @@ osenv@^0.1.4, osenv@^0.1.5: os-homedir "^1.0.0" os-tmpdir "^1.0.0" -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - p-each-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" @@ -5992,11 +6007,6 @@ p-finally@^2.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -6326,10 +6336,10 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@*, prettier@^1.18.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== +prettier@*, prettier@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== pretty-format@^24.9.0: version "24.9.0" @@ -6553,7 +6563,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -read-pkg@^5.1.1: +read-pkg@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== @@ -6660,6 +6670,11 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regexpp@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e" + integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" @@ -6729,11 +6744,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -6801,6 +6811,14 @@ restore-cursor@^2.0.0: onetime "^2.0.0" signal-exit "^3.0.2" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -6930,11 +6948,6 @@ semver-compare@^1.0.0: 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.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" @@ -7254,7 +7267,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -7271,6 +7284,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + 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" @@ -7331,6 +7353,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + strip-bom@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -7408,6 +7437,13 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" +supports-color@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -7632,10 +7668,10 @@ ts-jest@^24.0.0: semver "^5.5" yargs-parser "10.x" -ts-node@^8.3.0: - 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== +ts-node@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.5.0.tgz#bc7d5a39133d222bf25b1693651e4d893785f884" + integrity sha512-fbG32iZEupNV2E2Fd2m2yt1TdAwR3GTCrJQBHDevIiEBNy1A8kqnyl1fv7jmRmmbtcapFab2glZXHJvfD1ed0Q== dependencies: arg "^4.1.0" diff "^4.0.1" @@ -7648,10 +7684,10 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== -tslint@^5.19.0: - 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== +tslint@^5.20.1: + version "5.20.1" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.20.1.tgz#e401e8aeda0152bc44dd07e614034f3f80c67b7d" + integrity sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg== dependencies: "@babel/code-frame" "^7.0.0" builtin-modules "^1.1.1" @@ -7705,6 +7741,11 @@ 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.2: + 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" @@ -7715,10 +7756,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.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== +typescript@*, "typescript@>=3.2.1 <3.8.0", typescript@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" + integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== uglify-js@^3.1.4: version "3.6.0" @@ -7955,14 +7996,6 @@ wordwrap@~1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" @@ -8059,7 +8092,7 @@ xtend@~4.0.1: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== @@ -8076,14 +8109,6 @@ yargs-parser@10.x, yargs-parser@^10.0.0: dependencies: camelcase "^4.1.0" -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" - integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@^13.1.1: version "13.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" @@ -8092,23 +8117,13 @@ yargs-parser@^13.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs@^12.0.1: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" - integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== +yargs-parser@^15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.0.tgz#cdd7a97490ec836195f59f3f4dbe5ea9e8f75f08" + integrity sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ== dependencies: - cliui "^4.0.0" + camelcase "^5.0.0" decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" yargs@^13.3.0: version "13.3.0" @@ -8143,6 +8158,23 @@ yargs@^14.0.0: y18n "^4.0.0" yargs-parser "^13.1.1" +yargs@^14.2.0: + version "14.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.0.tgz#f116a9242c4ed8668790b40759b4906c276e76c3" + integrity sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg== + 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 "^15.0.0" + yn@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" From 9aee06cf4c47e38b5959d45f28bad6499b605352 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 15 Nov 2019 19:26:00 +0200 Subject: [PATCH 125/317] fix(eslint-plugin): [indent] handle empty generic declarations (#1211) Co-authored-by: Brad Zacher --- packages/eslint-plugin/src/rules/indent.ts | 4 ++++ packages/eslint-plugin/tests/rules/indent/indent.test.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 571767d5e00..46ac924f4c7 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -444,6 +444,10 @@ export default util.createRule({ }, TSTypeParameterDeclaration(node: TSESTree.TSTypeParameterDeclaration) { + if (!node.params.length) { + return; + } + const [name, ...attributes] = node.params; // JSX is about the closest we can get because the angle brackets diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index f49be833005..fca5629655b 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -770,6 +770,11 @@ const div: JQuery = $('
') }, // https://github.com/typescript-eslint/typescript-eslint/issues/441 `const;`, + + // https://github.com/typescript-eslint/typescript-eslint/issues/1115 + { + code: `const foo = function<> (): void {}`, + }, ], invalid: [ ...individualNodeTests.invalid, From d1de3a7eb02f1f0eb12a5b09fe32623d276367fb Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sat, 16 Nov 2019 03:22:14 +0200 Subject: [PATCH 126/317] =?UTF-8?q?fix(eslint-plugin):=20[unified-signatur?= =?UTF-8?q?es]=20crash:=20cannot=20read=20pro=E2=80=A6=20(#1096)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Brad Zacher --- .../src/rules/unified-signatures.ts | 3 +- .../tests/rules/unified-signatures.test.ts | 36 +++++++++++++++++++ .../src/ts-estree/ts-estree.ts | 1 - 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index c4c7f9bf427..66f783ec1a8 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -535,7 +535,8 @@ export default util.createRule({ // collect overloads TSDeclareFunction(node): void { - addOverload(node, node.id.name, getExportingNode(node)); + const exportingNode = getExportingNode(node); + addOverload(node, node.id?.name ?? exportingNode?.type, exportingNode); }, TSCallSignatureDeclaration: addOverload, TSConstructSignatureDeclaration: addOverload, diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index c8f9740662d..38a74429af7 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -128,6 +128,14 @@ export interface Foo { bar(baz: string): number[]; bar(): string[]; } +`, + ` +declare module "foo" { + export default function(foo: number): string[]; +} +`, + ` +export default function(foo: number): string[]; `, ], invalid: [ @@ -649,5 +657,33 @@ export function foo(line: number, character?: number): number; }, ], }, + { + code: ` +declare module "foo" { + export default function(foo: number): string[]; + export default function(foo: number, bar?: string): string[]; +} +`, + errors: [ + { + messageId: 'omittingSingleParameter', + line: 4, + column: 40, + }, + ], + }, + { + code: ` +export default function(foo: number): string[]; +export default function(foo: number, bar?: string): string[]; +`, + errors: [ + { + messageId: 'omittingSingleParameter', + line: 3, + column: 38, + }, + ], + }, ], }); diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index 10cd0b7e0fb..afda76ead68 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -1061,7 +1061,6 @@ export interface TSConstructSignatureDeclaration extends FunctionSignatureBase { } export interface TSDeclareFunction extends FunctionDeclarationBase { - id: Identifier; type: AST_NODE_TYPES.TSDeclareFunction; } From 9829dd34cae7e9bf4434f593186c92302d157a6b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 15 Nov 2019 17:24:26 -0800 Subject: [PATCH 127/317] fix(eslint-plugin): [nuta] correctly handle null/undefined separation (#1201) --- .../src/rules/no-unnecessary-type-assertion.ts | 15 +++++++++++---- .../rules/no-unnecessary-type-assertion.test.ts | 11 +++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 61583878bae..141959ca7af 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -216,10 +216,17 @@ export default util.createRule({ contextualType, ts.TypeFlags.Null, ); - if ( - (typeIncludesUndefined && contextualTypeIncludesUndefined) || - (typeIncludesNull && contextualTypeIncludesNull) - ) { + + // make sure that the parent accepts the same types + // i.e. assigning `string | null | undefined` to `string | undefined` is invalid + const isValidUndefined = typeIncludesUndefined + ? contextualTypeIncludesUndefined + : true; + const isValidNull = typeIncludesNull + ? contextualTypeIncludesNull + : true; + + if (isValidUndefined && isValidNull) { context.report({ node, messageId: 'contextuallyUnnecessary', diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts index 4b4e496253f..73a8619b6a4 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -104,6 +104,17 @@ class Mx { private prop = 1; } `, + // https://github.com/typescript-eslint/typescript-eslint/issues/1199 + ` +function testFunction(_param: string | undefined): void { /* noop */ } +const value = 'test' as string | null | undefined +testFunction(value!) + `, + ` +function testFunction(_param: string | null): void { /* noop */ } +const value = 'test' as string | null | undefined +testFunction(value!) + `, ], invalid: [ From eb83af1b00e29010d899bc461d0a883370faa962 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 15 Nov 2019 17:36:01 -0800 Subject: [PATCH 128/317] fix(eslint-plugin): [require-await] better handle nesting (#1193) --- .../eslint-plugin/src/rules/require-await.ts | 131 ++++-------------- .../tests/rules/require-await.test.ts | 9 ++ 2 files changed, 37 insertions(+), 103 deletions(-) diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index cc5ecc8bf60..5f27f8ad8a1 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -1,6 +1,5 @@ import { TSESTree, - TSESLint, AST_NODE_TYPES, } from '@typescript-eslint/experimental-utils'; import baseRule from 'eslint/lib/rules/require-await'; @@ -11,11 +10,6 @@ import * as util from '../util'; type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; -interface ScopeInfo { - upper: ScopeInfo | null; - returnsPromise: boolean; -} - export default util.createRule({ name: 'require-await', meta: { @@ -35,82 +29,6 @@ export default util.createRule({ const parserServices = util.getParserServices(context); const checker = parserServices.program.getTypeChecker(); - let scopeInfo: ScopeInfo | null = null; - - /** - * Push the scope info object to the stack. - * - * @returns {void} - */ - function enterFunction( - node: - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression, - ): void { - scopeInfo = { - upper: scopeInfo, - returnsPromise: false, - }; - - switch (node.type) { - case AST_NODE_TYPES.FunctionDeclaration: - rules.FunctionDeclaration(node); - break; - - case AST_NODE_TYPES.FunctionExpression: - rules.FunctionExpression(node); - break; - - case AST_NODE_TYPES.ArrowFunctionExpression: - rules.ArrowFunctionExpression(node); - - // If body type is not BlockStatment, we need to check the return type here - if (node.body.type !== AST_NODE_TYPES.BlockStatement) { - const expression = parserServices.esTreeNodeToTSNodeMap.get( - node.body, - ); - scopeInfo.returnsPromise = isThenableType(expression); - } - - break; - } - } - - /** - * Pop the top scope info object from the stack. - * Passes through to the base rule if the function doesn't return a promise - * - * @param {ASTNode} node - The node exiting - * @returns {void} - */ - function exitFunction( - node: - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression, - ): void { - if (scopeInfo) { - if (!scopeInfo.returnsPromise) { - switch (node.type) { - case AST_NODE_TYPES.FunctionDeclaration: - rules['FunctionDeclaration:exit'](node); - break; - - case AST_NODE_TYPES.FunctionExpression: - rules['FunctionExpression:exit'](node); - break; - - case AST_NODE_TYPES.ArrowFunctionExpression: - rules['ArrowFunctionExpression:exit'](node); - break; - } - } - - scopeInfo = scopeInfo.upper; - } - } - /** * Checks if the node returns a thenable type * @@ -124,34 +42,41 @@ export default util.createRule({ } return { - 'FunctionDeclaration[async = true]': enterFunction, - 'FunctionExpression[async = true]': enterFunction, - 'ArrowFunctionExpression[async = true]': enterFunction, - 'FunctionDeclaration[async = true]:exit': exitFunction, - 'FunctionExpression[async = true]:exit': exitFunction, - 'ArrowFunctionExpression[async = true]:exit': exitFunction, - - ReturnStatement(node): void { - if (!scopeInfo) { - return; + 'FunctionDeclaration[async = true]': rules.FunctionDeclaration, + 'FunctionExpression[async = true]': rules.FunctionExpression, + 'ArrowFunctionExpression[async = true]'( + node: TSESTree.ArrowFunctionExpression, + ): void { + rules.ArrowFunctionExpression(node); + + // If body type is not BlockStatment, we need to check the return type here + if (node.body.type !== AST_NODE_TYPES.BlockStatement) { + const expression = parserServices.esTreeNodeToTSNodeMap.get( + node.body, + ); + if (expression && isThenableType(expression)) { + // tell the base rule to mark the scope as having an await so it ignores it + rules.AwaitExpression(node as never); + } } + }, + 'FunctionDeclaration[async = true]:exit': + rules['FunctionDeclaration:exit'], + 'FunctionExpression[async = true]:exit': rules['FunctionExpression:exit'], + 'ArrowFunctionExpression[async = true]:exit': + rules['ArrowFunctionExpression:exit'], + AwaitExpression: rules.AwaitExpression, + ForOfStatement: rules.ForOfStatement, + ReturnStatement(node): void { const { expression } = parserServices.esTreeNodeToTSNodeMap.get< ts.ReturnStatement >(node); - if (!expression) { - return; + if (expression && isThenableType(expression)) { + // tell the base rule to mark the scope as having an await so it ignores it + rules.AwaitExpression(node as never); } - - scopeInfo.returnsPromise = isThenableType(expression); }, - - AwaitExpression: rules.AwaitExpression as TSESLint.RuleFunction< - TSESTree.Node - >, - ForOfStatement: rules.ForOfStatement as TSESLint.RuleFunction< - TSESTree.Node - >, }; }, }); diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 38a925de1d2..09b54bd3a99 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -128,6 +128,15 @@ ruleTester.run('require-await', rule, { return Promise.resolve(x); }`, }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1188 + ` +async function testFunction(): Promise { + await Promise.all([1, 2, 3].map( + // this should not trigger an error on the parent function + async value => Promise.resolve(value) + )) +} + `, ], invalid: [ From ba891681ed39677347d1d70e198f050a3d6c28dd Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 15 Nov 2019 17:37:13 -0800 Subject: [PATCH 129/317] =?UTF-8?q?fix(typescript-estree):=20correctly=20a?= =?UTF-8?q?ccount=20for=20trailing=20slash=20in=E2=80=A6=20(#1205)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/create-program/createWatchProgram.ts | 6 +- .../src/create-program/shared.ts | 17 ++++-- .../tests/lib/persistentParse.ts | 57 ++++++++++++++++--- 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 9223107986a..38bd209ff3f 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -1,6 +1,5 @@ import debug from 'debug'; import fs from 'fs'; -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'; @@ -67,7 +66,7 @@ function saveWatchCallback( fileName: string, callback: ts.FileWatcherCallback, ): ts.FileWatcher => { - const normalizedFileName = getCanonicalFileName(path.normalize(fileName)); + const normalizedFileName = getCanonicalFileName(fileName); const watchers = ((): Set => { let watchers = trackingMap.get(normalizedFileName); if (!watchers) { @@ -246,8 +245,7 @@ function createWatchProgram( watchCompilerHost.readFile = (filePathIn, encoding): string | undefined => { const filePath = getCanonicalFileName(filePathIn); const fileContent = - path.normalize(filePath) === - path.normalize(currentLintOperationState.filePath) + filePath === currentLintOperationState.filePath ? currentLintOperationState.code : oldReadFile(filePath, encoding); if (fileContent) { diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 6509997094f..a19bef27413 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -20,14 +20,21 @@ 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 }; + // 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 => - path.normalize(filePath).toLowerCase() as CanonicalPath; +const correctPathCasing = useCaseSensitiveFileNames + ? (filePath: string): string => filePath + : (filePath: string): string => filePath.toLowerCase(); + +function getCanonicalFileName(filePath: string): CanonicalPath { + let normalized = path.normalize(filePath); + if (normalized.endsWith('/')) { + normalized = normalized.substr(0, normalized.length - 1); + } + return correctPathCasing(normalized) as CanonicalPath; +} function getTsconfigPath(tsconfigPath: string, extra: Extra): CanonicalPath { return getCanonicalFileName( diff --git a/packages/typescript-estree/tests/lib/persistentParse.ts b/packages/typescript-estree/tests/lib/persistentParse.ts index e1cb8b9f9b7..502245977bd 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.ts @@ -3,14 +3,6 @@ import path from 'path'; import tmp from 'tmp'; import { clearCaches, parseAndGenerateServices } from '../../src/parser'; -const tsConfigExcludeBar = { - include: ['src'], - exclude: ['./src/bar.ts'], -}; -const tsConfigIncludeAll = { - include: ['src'], - exclude: [], -}; const CONTENTS = { foo: 'console.log("foo")', bar: 'console.log("bar")', @@ -69,7 +61,10 @@ function parseFile(filename: 'foo' | 'bar' | 'baz/bar', tmpDir: string): void { }); } -describe('persistent lint session', () => { +function baseTests( + tsConfigExcludeBar: Record, + tsConfigIncludeAll: Record, +): void { it('parses both files successfully when included', () => { const PROJECT_DIR = setup(tsConfigIncludeAll); @@ -175,4 +170,48 @@ describe('persistent lint session', () => { }); // TODO - support the complex monorepo case with a tsconfig with no include/exclude +} + +describe('persistent parse', () => { + describe('includes not ending in a slash', () => { + const tsConfigExcludeBar = { + include: ['src'], + exclude: ['./src/bar.ts'], + }; + const tsConfigIncludeAll = { + include: ['src'], + exclude: [], + }; + + baseTests(tsConfigExcludeBar, tsConfigIncludeAll); + }); + + /* + If the includes ends in a slash, typescript will ask for watchers ending in a slash. + These tests ensure the normalisation code works as expected in this case. + */ + describe('includes ending in a slash', () => { + const tsConfigExcludeBar = { + include: ['src/'], + exclude: ['./src/bar.ts'], + }; + const tsConfigIncludeAll = { + include: ['src/'], + exclude: [], + }; + + baseTests(tsConfigExcludeBar, tsConfigIncludeAll); + }); + + /* + If there is no includes, then typescript will ask for a slightly different set of watchers. + */ + describe('tsconfig with no includes / files', () => { + const tsConfigExcludeBar = { + exclude: ['./src/bar.ts'], + }; + const tsConfigIncludeAll = {}; + + baseTests(tsConfigExcludeBar, tsConfigIncludeAll); + }); }); From 42a48de4b5e3bed5e4e1a58333e8830b8fcca6cd Mon Sep 17 00:00:00 2001 From: Alexander T Date: Sun, 17 Nov 2019 21:24:31 +0200 Subject: [PATCH 130/317] fix(eslint-plugin): [no-unnec-type-arg] throwing on call/new expr (#1217) Co-authored-by: Brad Zacher --- .../src/rules/no-unnecessary-type-arguments.ts | 6 +++++- .../rules/no-unnecessary-type-arguments.test.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 12d9c041dfe..c5c439c7bd0 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -114,7 +114,11 @@ function getTypeParametersFromNode( return getTypeParametersFromType(node.typeName, checker); } - return getTypeParametersFromCall(node, checker); + if (ts.isCallExpression(node) || ts.isNewExpression(node)) { + return getTypeParametersFromCall(node, checker); + } + + return undefined; } function getTypeParametersFromType( diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index 7bb37deda8f..05794ee30f4 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -53,6 +53,9 @@ ruleTester.run('no-unnecessary-type-arguments', rule, { `declare const C: unknown; class D extends C { }`, `let a: A`, + `class Foo {} + const foo = new Foo();`, + `type Foo = import('foo').Foo;`, ], invalid: [ { @@ -123,5 +126,16 @@ ruleTester.run('no-unnecessary-type-arguments', rule, { output: `interface I { } class Impl implements I { }`, }, + { + code: `class Foo {} + const foo = new Foo();`, + errors: [ + { + messageId: 'unnecessaryTypeParameter', + }, + ], + output: `class Foo {} + const foo = new Foo();`, + }, ], }); From 46b58b4e4d59ddd822774ff13cf1f815cb7423c8 Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 18 Nov 2019 18:34:52 +0100 Subject: [PATCH 131/317] feat(eslint-plugin): add rule restrict-template-expressions (#850) Co-authored-by: Brad Zacher --- packages/eslint-plugin/README.md | 1 + .../rules/restrict-template-expressions.md | 69 ++++++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../rules/restrict-template-expressions.ts | 150 ++++++++++++ .../restrict-template-expressions.test.ts | 213 ++++++++++++++++++ 6 files changed, 436 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/restrict-template-expressions.md create mode 100644 packages/eslint-plugin/src/rules/restrict-template-expressions.ts create mode 100644 packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 9f82b851d29..4a7557f6f46 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -200,6 +200,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@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: | +| [`@typescript-eslint/restrict-template-expressions`](./docs/rules/restrict-template-expressions.md) | Enforce template literal expressions to be of string type | | | :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: | diff --git a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md new file mode 100644 index 00000000000..afd6976a227 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md @@ -0,0 +1,69 @@ +# Enforce template literal expressions to be of string type. (restrict-template-expressions) + +Examples of **correct** code: + +```ts +const arg = 'foo'; +const msg1 = `arg = ${arg}`; +const msg2 = `arg = ${arg || 'default'}`; +``` + +Examples of **incorrect** code: + +```ts +const arg1 = [1, 2]; +const msg1 = `arg1 = ${arg1}`; + +const arg2 = { name: 'Foo' }; +const msg2 = `arg2 = ${arg2 || null}`; +``` + +## Options + +The rule accepts an options object with the following properties: + +```ts +type Options = { + // if true, also allow number type in template expressions + allowNumber?: boolean; + // if true, also allow boolean type in template expressions + allowBoolean?: boolean; + // if true, also allow null and undefined in template expressions + allowNullable?: boolean; +}; + +const defaults = { + allowNumber: false, + allowBoolean: false, + allowNullable: false, +}; +``` + +### allowNumber + +Examples of additional **correct** code for this rule with `{ allowNumber: true }`: + +```ts +const arg = 123; +const msg1 = `arg = ${arg}`; +const msg2 = `arg = ${arg || 'zero'}`; +``` + +### allowBoolean + +Examples of additional **correct** code for this rule with `{ allowBoolean: true }`: + +```ts +const arg = true; +const msg1 = `arg = ${arg}`; +const msg2 = `arg = ${arg || 'not truthy'}`; +``` + +### allowNullable + +Examples of additional **correct** code for this rule with `{ allowNullable: true }`: + +```ts +const arg = condition ? 'ok' : null; +const msg1 = `arg = ${arg}`; +``` diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 23b38b458a3..53d1cf8a87f 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -75,6 +75,7 @@ "require-await": "off", "@typescript-eslint/require-await": "error", "@typescript-eslint/restrict-plus-operands": "error", + "@typescript-eslint/restrict-template-expressions": "error", "semi": "off", "@typescript-eslint/semi": "error", "space-before-function-paren": "off", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 35f2d758291..d706378e934 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -57,6 +57,7 @@ import quotes from './quotes'; import requireArraySortCompare from './require-array-sort-compare'; import requireAwait from './require-await'; import restrictPlusOperands from './restrict-plus-operands'; +import restrictTemplateExpressions from './restrict-template-expressions'; import semi from './semi'; import spaceBeforeFunctionParen from './space-before-function-paren'; import strictBooleanExpressions from './strict-boolean-expressions'; @@ -128,6 +129,7 @@ export default { 'require-array-sort-compare': requireArraySortCompare, 'require-await': requireAwait, 'restrict-plus-operands': restrictPlusOperands, + 'restrict-template-expressions': restrictTemplateExpressions, semi: semi, 'space-before-function-paren': spaceBeforeFunctionParen, 'strict-boolean-expressions': strictBooleanExpressions, diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts new file mode 100644 index 00000000000..199664036c9 --- /dev/null +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -0,0 +1,150 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import ts from 'typescript'; +import * as util from '../util'; + +type Options = [ + { + allowNullable?: boolean; + allowNumber?: boolean; + allowBoolean?: boolean; + }, +]; + +type MessageId = 'invalidType'; + +export default util.createRule({ + name: 'restrict-template-expressions', + meta: { + type: 'problem', + docs: { + description: 'Enforce template literal expressions to be of string type', + category: 'Best Practices', + recommended: false, + requiresTypeChecking: true, + }, + messages: { + invalidType: 'Invalid type of template literal expression.', + }, + schema: [ + { + type: 'object', + properties: { + allowBoolean: { type: 'boolean' }, + allowNullable: { type: 'boolean' }, + allowNumber: { type: 'boolean' }, + }, + }, + ], + }, + defaultOptions: [{}], + create(context, [options]) { + const service = util.getParserServices(context); + const typeChecker = service.program.getTypeChecker(); + + type BaseType = + | 'string' + | 'number' + | 'bigint' + | 'boolean' + | 'null' + | 'undefined' + | 'other'; + + const allowedTypes: BaseType[] = [ + 'string', + ...(options.allowNumber ? (['number', 'bigint'] as const) : []), + ...(options.allowBoolean ? (['boolean'] as const) : []), + ...(options.allowNullable ? (['null', 'undefined'] as const) : []), + ]; + + function isAllowedType(types: BaseType[]): boolean { + for (const type of types) { + if (!allowedTypes.includes(type)) { + return false; + } + } + return true; + } + + return { + TemplateLiteral(node: TSESTree.TemplateLiteral): void { + // don't check tagged template literals + if (node.parent!.type === AST_NODE_TYPES.TaggedTemplateExpression) { + return; + } + + for (const expr of node.expressions) { + const type = getNodeType(expr); + if (!isAllowedType(type)) { + context.report({ + node: expr, + messageId: 'invalidType', + }); + } + } + }, + }; + + /** + * Helper function to get base type of node + * @param node the node to be evaluated. + */ + function getNodeType(node: TSESTree.Node): BaseType[] { + const tsNode = service.esTreeNodeToTSNodeMap.get(node); + const type = typeChecker.getTypeAtLocation(tsNode); + + return getBaseType(type); + } + + function getBaseType(type: ts.Type): BaseType[] { + const constraint = type.getConstraint(); + if ( + constraint && + // for generic types with union constraints, it will return itself + constraint !== type + ) { + return getBaseType(constraint); + } + + if (type.isStringLiteral()) { + return ['string']; + } + if (type.isNumberLiteral()) { + return ['number']; + } + if (type.flags & ts.TypeFlags.BigIntLiteral) { + return ['bigint']; + } + if (type.flags & ts.TypeFlags.BooleanLiteral) { + return ['boolean']; + } + if (type.flags & ts.TypeFlags.Null) { + return ['null']; + } + if (type.flags & ts.TypeFlags.Undefined) { + return ['undefined']; + } + + if (type.isUnion()) { + return type.types + .map(getBaseType) + .reduce((all, array) => [...all, ...array], []); + } + + const stringType = typeChecker.typeToString(type); + if ( + stringType === 'string' || + stringType === 'number' || + stringType === 'bigint' || + stringType === 'boolean' + ) { + return [stringType]; + } + + return ['other']; + } + }, +}); diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts new file mode 100644 index 00000000000..ef7657d6a00 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -0,0 +1,213 @@ +import path from 'path'; +import rule from '../../src/rules/restrict-template-expressions'; +import { RuleTester } from '../RuleTester'; + +const rootPath = path.join(process.cwd(), 'tests/fixtures/'); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +ruleTester.run('restrict-template-expressions', rule, { + valid: [ + // Base case + ` + const msg = \`arg = \${"foo"}\`; + `, + ` + const arg = "foo"; + const msg = \`arg = \${arg}\`; + `, + ` + const arg = "foo"; + const msg = \`arg = \${arg || "default"}\`; + `, + ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + // Base case - don't check tagged templates + ` + tag\`arg = \${null}\`; + `, + ` + const arg = {}; + tag\`arg = \${arg}\`; + `, + // allowNumber + { + options: [{ allowNumber: true }], + code: ` + const arg = 123; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowNumber: true }], + code: ` + const arg = 123; + const msg = \`arg = \${arg || "default"}\`; + `, + }, + { + options: [{ allowNumber: true }], + code: ` + const arg = 123n; + const msg = \`arg = \${arg || "default"}\`; + `, + }, + { + options: [{ allowNumber: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + { + options: [{ allowNumber: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + { + options: [{ allowNumber: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + // allowBoolean + { + options: [{ allowBoolean: true }], + code: ` + const arg = true; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowBoolean: true }], + code: ` + const arg = true; + const msg = \`arg = \${arg || "default"}\`; + `, + }, + { + options: [{ allowBoolean: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + { + options: [{ allowBoolean: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + // allowNullable + { + options: [{ allowNullable: true }], + code: ` + const arg = null; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowNullable: true }], + code: ` + declare const arg: string | null | undefined; + const msg = \`arg = \${arg}\`; + `, + }, + { + options: [{ allowNullable: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + { + options: [{ allowNullable: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + // allow ALL + { + options: [{ allowNumber: true, allowBoolean: true, allowNullable: true }], + code: ` + type All = string | number | boolean | null | undefined + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + }, + ], + + invalid: [ + { + code: ` + const msg = \`arg = \${123}\`; + `, + errors: [{ messageId: 'invalidType', line: 2, column: 30 }], + }, + { + code: ` + const msg = \`arg = \${false}\`; + `, + errors: [{ messageId: 'invalidType', line: 2, column: 30 }], + }, + { + code: ` + const msg = \`arg = \${null}\`; + `, + errors: [{ messageId: 'invalidType', line: 2, column: 30 }], + }, + { + code: ` + declare const arg: number; + const msg = \`arg = \${arg}\`; + `, + errors: [{ messageId: 'invalidType', line: 3, column: 30 }], + }, + { + code: ` + declare const arg: boolean; + const msg = \`arg = \${arg}\`; + `, + errors: [{ messageId: 'invalidType', line: 3, column: 30 }], + }, + { + options: [{ allowNumber: true, allowBoolean: true, allowNullable: true }], + code: ` + const arg = {}; + const msg = \`arg = \${arg}\`; + `, + errors: [{ messageId: 'invalidType', line: 3, column: 30 }], + }, + { + options: [{ allowNumber: true, allowBoolean: true, allowNullable: true }], + code: ` + function test(arg: T) { + return \`arg = \${arg}\`; + } + `, + errors: [{ messageId: 'invalidType', line: 3, column: 27 }], + }, + ], +}); From a9117f525e457966a718164ae6cf7ad086c0dd7b Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 18 Nov 2019 18:01:43 +0000 Subject: [PATCH 132/317] chore: publish v2.8.0 --- CHANGELOG.md | 31 ++++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++ packages/eslint-plugin-tslint/package.json | 6 ++--- packages/eslint-plugin/CHANGELOG.md | 29 ++++++++++++++++++++ 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, 123 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f800e619f2d..f5b8fddd22b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,37 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + + +### Bug Fixes + +* **eslint-plugin:** [camelcase] handle optional member expr ([#1204](https://github.com/typescript-eslint/typescript-eslint/issues/1204)) ([9c8203f](https://github.com/typescript-eslint/typescript-eslint/commit/9c8203f)) +* **eslint-plugin:** [indent] fix decorator type ([#1189](https://github.com/typescript-eslint/typescript-eslint/issues/1189)) ([e2008e3](https://github.com/typescript-eslint/typescript-eslint/commit/e2008e3)) +* **eslint-plugin:** [indent] handle empty generic declarations ([#1211](https://github.com/typescript-eslint/typescript-eslint/issues/1211)) ([9aee06c](https://github.com/typescript-eslint/typescript-eslint/commit/9aee06c)) +* **eslint-plugin:** [no-type-alias] handle constructor aliases ([#1198](https://github.com/typescript-eslint/typescript-eslint/issues/1198)) ([1bb4d63](https://github.com/typescript-eslint/typescript-eslint/commit/1bb4d63)) +* **eslint-plugin:** [no-unnec-type-arg] throwing on call/new expr ([#1217](https://github.com/typescript-eslint/typescript-eslint/issues/1217)) ([42a48de](https://github.com/typescript-eslint/typescript-eslint/commit/42a48de)) +* **eslint-plugin:** [no-unnecessary-cond] fix naked type param ([#1207](https://github.com/typescript-eslint/typescript-eslint/issues/1207)) ([4fac6c5](https://github.com/typescript-eslint/typescript-eslint/commit/4fac6c5)) +* **eslint-plugin:** [nuta] correctly handle null/undefined separation ([#1201](https://github.com/typescript-eslint/typescript-eslint/issues/1201)) ([9829dd3](https://github.com/typescript-eslint/typescript-eslint/commit/9829dd3)) +* **eslint-plugin:** [require-await] better handle nesting ([#1193](https://github.com/typescript-eslint/typescript-eslint/issues/1193)) ([eb83af1](https://github.com/typescript-eslint/typescript-eslint/commit/eb83af1)) +* **eslint-plugin:** [unified-signatures] crash: cannot read pro… ([#1096](https://github.com/typescript-eslint/typescript-eslint/issues/1096)) ([d1de3a7](https://github.com/typescript-eslint/typescript-eslint/commit/d1de3a7)) +* **eslint-plugin:** disable base no-unused-expressions in all config ([ecb3f4e](https://github.com/typescript-eslint/typescript-eslint/commit/ecb3f4e)) +* **typescript-estree:** correctly account for trailing slash in… ([#1205](https://github.com/typescript-eslint/typescript-eslint/issues/1205)) ([ba89168](https://github.com/typescript-eslint/typescript-eslint/commit/ba89168)) +* **typescript-estree:** options range loc being always true ([#704](https://github.com/typescript-eslint/typescript-eslint/issues/704)) ([db1aa18](https://github.com/typescript-eslint/typescript-eslint/commit/db1aa18)) + + +### Features + +* **eslint-plugin:** [no-type-alias] handle conditional types ([#953](https://github.com/typescript-eslint/typescript-eslint/issues/953)) ([259ff20](https://github.com/typescript-eslint/typescript-eslint/commit/259ff20)) +* **eslint-plugin:** add rule restrict-template-expressions ([#850](https://github.com/typescript-eslint/typescript-eslint/issues/850)) ([46b58b4](https://github.com/typescript-eslint/typescript-eslint/commit/46b58b4)) +* **eslint-plugin:** add space-before-function-paren [extension] ([#924](https://github.com/typescript-eslint/typescript-eslint/issues/924)) ([d8b07a7](https://github.com/typescript-eslint/typescript-eslint/commit/d8b07a7)) +* **eslint-plugin:** added new rule no-dynamic-delete ([#565](https://github.com/typescript-eslint/typescript-eslint/issues/565)) ([864c811](https://github.com/typescript-eslint/typescript-eslint/commit/864c811)) +* **eslint-plugin:** added new rule no-untyped-public-signature ([#801](https://github.com/typescript-eslint/typescript-eslint/issues/801)) ([c5835f3](https://github.com/typescript-eslint/typescript-eslint/commit/c5835f3)) + + + + + # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) diff --git a/lerna.json b/lerna.json index 991899f5133..2eec75f4f59 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.7.0", + "version": "2.8.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 9613287c060..7b7467bd457 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.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [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 diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index b23071880ad..631e7d54ad4 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.7.0", + "version": "2.8.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.7.0", + "@typescript-eslint/experimental-utils": "2.8.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "2.7.0" + "@typescript-eslint/parser": "2.8.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 1759b88a3c1..295a43be6cc 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + + +### Bug Fixes + +* **eslint-plugin:** [camelcase] handle optional member expr ([#1204](https://github.com/typescript-eslint/typescript-eslint/issues/1204)) ([9c8203f](https://github.com/typescript-eslint/typescript-eslint/commit/9c8203f)) +* **eslint-plugin:** [indent] fix decorator type ([#1189](https://github.com/typescript-eslint/typescript-eslint/issues/1189)) ([e2008e3](https://github.com/typescript-eslint/typescript-eslint/commit/e2008e3)) +* **eslint-plugin:** [indent] handle empty generic declarations ([#1211](https://github.com/typescript-eslint/typescript-eslint/issues/1211)) ([9aee06c](https://github.com/typescript-eslint/typescript-eslint/commit/9aee06c)) +* **eslint-plugin:** [no-type-alias] handle constructor aliases ([#1198](https://github.com/typescript-eslint/typescript-eslint/issues/1198)) ([1bb4d63](https://github.com/typescript-eslint/typescript-eslint/commit/1bb4d63)) +* **eslint-plugin:** [no-unnec-type-arg] throwing on call/new expr ([#1217](https://github.com/typescript-eslint/typescript-eslint/issues/1217)) ([42a48de](https://github.com/typescript-eslint/typescript-eslint/commit/42a48de)) +* **eslint-plugin:** [no-unnecessary-cond] fix naked type param ([#1207](https://github.com/typescript-eslint/typescript-eslint/issues/1207)) ([4fac6c5](https://github.com/typescript-eslint/typescript-eslint/commit/4fac6c5)) +* **eslint-plugin:** [nuta] correctly handle null/undefined separation ([#1201](https://github.com/typescript-eslint/typescript-eslint/issues/1201)) ([9829dd3](https://github.com/typescript-eslint/typescript-eslint/commit/9829dd3)) +* **eslint-plugin:** [require-await] better handle nesting ([#1193](https://github.com/typescript-eslint/typescript-eslint/issues/1193)) ([eb83af1](https://github.com/typescript-eslint/typescript-eslint/commit/eb83af1)) +* **eslint-plugin:** [unified-signatures] crash: cannot read pro… ([#1096](https://github.com/typescript-eslint/typescript-eslint/issues/1096)) ([d1de3a7](https://github.com/typescript-eslint/typescript-eslint/commit/d1de3a7)) +* **eslint-plugin:** disable base no-unused-expressions in all config ([ecb3f4e](https://github.com/typescript-eslint/typescript-eslint/commit/ecb3f4e)) + + +### Features + +* **eslint-plugin:** [no-type-alias] handle conditional types ([#953](https://github.com/typescript-eslint/typescript-eslint/issues/953)) ([259ff20](https://github.com/typescript-eslint/typescript-eslint/commit/259ff20)) +* **eslint-plugin:** add rule restrict-template-expressions ([#850](https://github.com/typescript-eslint/typescript-eslint/issues/850)) ([46b58b4](https://github.com/typescript-eslint/typescript-eslint/commit/46b58b4)) +* **eslint-plugin:** add space-before-function-paren [extension] ([#924](https://github.com/typescript-eslint/typescript-eslint/issues/924)) ([d8b07a7](https://github.com/typescript-eslint/typescript-eslint/commit/d8b07a7)) +* **eslint-plugin:** added new rule no-dynamic-delete ([#565](https://github.com/typescript-eslint/typescript-eslint/issues/565)) ([864c811](https://github.com/typescript-eslint/typescript-eslint/commit/864c811)) +* **eslint-plugin:** added new rule no-untyped-public-signature ([#801](https://github.com/typescript-eslint/typescript-eslint/issues/801)) ([c5835f3](https://github.com/typescript-eslint/typescript-eslint/commit/c5835f3)) + + + + + # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 17eb148ab35..0a84ab84ddb 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.7.0", + "version": "2.8.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -40,7 +40,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.7.0", + "@typescript-eslint/experimental-utils": "2.8.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index fa483c6bd8f..719fea3d87b 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.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [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 diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 2bbb6ddc9ec..5fef538da56 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.7.0", + "version": "2.8.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.7.0", + "@typescript-eslint/typescript-estree": "2.8.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 45ba8b728f6..cd1688d72e5 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.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + + +### Bug Fixes + +* **typescript-estree:** options range loc being always true ([#704](https://github.com/typescript-eslint/typescript-eslint/issues/704)) ([db1aa18](https://github.com/typescript-eslint/typescript-eslint/commit/db1aa18)) + + + + + # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) diff --git a/packages/parser/package.json b/packages/parser/package.json index 0511697a88c..d494917898c 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.7.0", + "version": "2.8.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.7.0", - "@typescript-eslint/typescript-estree": "2.7.0", + "@typescript-eslint/experimental-utils": "2.8.0", + "@typescript-eslint/typescript-estree": "2.8.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.7.0", + "@typescript-eslint/shared-fixtures": "2.8.0", "glob": "*" } } diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index aa253e3d46e..4b84a123ae3 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.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + # [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 diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index c457e83d4dd..dd930d1575d 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.7.0", + "version": "2.8.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 28d91bddc6b..8500277af65 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.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) + + +### Bug Fixes + +* **eslint-plugin:** [unified-signatures] crash: cannot read pro… ([#1096](https://github.com/typescript-eslint/typescript-eslint/issues/1096)) ([d1de3a7](https://github.com/typescript-eslint/typescript-eslint/commit/d1de3a7)) +* **typescript-estree:** correctly account for trailing slash in… ([#1205](https://github.com/typescript-eslint/typescript-eslint/issues/1205)) ([ba89168](https://github.com/typescript-eslint/typescript-eslint/commit/ba89168)) +* **typescript-estree:** options range loc being always true ([#704](https://github.com/typescript-eslint/typescript-eslint/issues/704)) ([db1aa18](https://github.com/typescript-eslint/typescript-eslint/commit/db1aa18)) + + + + + # [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index ac09e497227..c169fad437e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.7.0", + "version": "2.8.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -59,7 +59,7 @@ "@types/lodash.unescape": "^4.0.4", "@types/semver": "^6.2.0", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.7.0", + "@typescript-eslint/shared-fixtures": "2.8.0", "babel-code-frame": "^6.26.0", "lodash.isplainobject": "4.0.6", "tmp": "^0.1.0", From 2b3b5d6d144f1df152385d8460b23b514c7c518b Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 18 Nov 2019 20:02:11 +0200 Subject: [PATCH 133/317] feat(eslint-plugin): add no-extra-non-null-assertion (#1183) Co-authored-by: Brad Zacher --- packages/eslint-plugin/README.md | 1 + .../docs/rules/no-extra-non-null-assertion.md | 37 +++++++++++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/no-extra-non-null-assertion.ts | 25 +++++++ .../rules/no-extra-non-null-assertion.test.ts | 66 +++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md create mode 100644 packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts create mode 100644 packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 4a7557f6f46..76b68e32a92 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -164,6 +164,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@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: | | +| [`@typescript-eslint/no-extra-non-null-assertion`](./docs/rules/no-extra-non-null-assertion.md) | Disallow extra non-null assertion | | | | | [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | | [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | | [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately. | | | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md new file mode 100644 index 00000000000..37f4d2e3a52 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md @@ -0,0 +1,37 @@ +# Disallow extra non-null assertion + +## Rule Details + +Examples of **incorrect** code for this rule: + +```ts +const foo: { bar: number } | null = null; +const bar = foo!!!.bar; +``` + +```ts +function foo(bar: number | undefined) { + const bar: number = bar!!!; +} +``` + +Examples of **correct** code for this rule: + +```ts +const foo: { bar: number } | null = null; +const bar = foo!.bar; +``` + +```ts +function foo(bar: number | undefined) { + const bar: number = bar!; +} +``` + +## How to use + +```json +{ + "@typescript-eslint/no-extra-non-null-assertion": ["error"] +} +``` diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 53d1cf8a87f..96d264106cc 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -32,6 +32,7 @@ "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "error", "no-extra-parens": "off", + "@typescript-eslint/no-extra-non-null-assertion": "error", "@typescript-eslint/no-extra-parens": "error", "@typescript-eslint/no-extraneous-class": "error", "@typescript-eslint/no-floating-promises": "error", diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index d706378e934..d28b23edca6 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -22,6 +22,7 @@ import noDynamicDelete from './no-dynamic-delete'; import noEmptyFunction from './no-empty-function'; import noEmptyInterface from './no-empty-interface'; import noExplicitAny from './no-explicit-any'; +import noExtraNonNullAssertion from './no-extra-non-null-assertion'; import noExtraParens from './no-extra-parens'; import noExtraneousClass from './no-extraneous-class'; import noFloatingPromises from './no-floating-promises'; @@ -93,6 +94,7 @@ export default { 'no-empty-function': noEmptyFunction, 'no-empty-interface': noEmptyInterface, 'no-explicit-any': noExplicitAny, + 'no-extra-non-null-assertion': noExtraNonNullAssertion, 'no-extra-parens': noExtraParens, 'no-extraneous-class': noExtraneousClass, 'no-floating-promises': noFloatingPromises, diff --git a/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts new file mode 100644 index 00000000000..cd116a3a4d7 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts @@ -0,0 +1,25 @@ +import * as util from '../util'; + +export default util.createRule({ + name: 'no-extra-non-null-assertion', + meta: { + type: 'problem', + docs: { + description: 'Disallow extra non-null assertion', + category: 'Stylistic Issues', + recommended: false, + }, + schema: [], + messages: { + noExtraNonNullAssertion: 'Forbidden extra non-null assertion.', + }, + }, + defaultOptions: [], + create(context) { + return { + 'TSNonNullExpression > TSNonNullExpression'(node): void { + context.report({ messageId: 'noExtraNonNullAssertion', node }); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts new file mode 100644 index 00000000000..a851fe9a060 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts @@ -0,0 +1,66 @@ +import rule from '../../src/rules/no-extra-non-null-assertion'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-extra-non-null-assertion', rule, { + valid: [ + { + code: ` +const foo: { bar: number } | null = null; +const bar = foo!.bar; + `, + }, + { + code: ` +function foo(bar: number | undefined) { + const bar: number = bar!; +} `, + }, + ], + invalid: [ + { + code: ` +const foo: { bar: number } | null = null; +const bar = foo!!!!.bar; + `, + errors: [ + { + messageId: 'noExtraNonNullAssertion', + endColumn: 19, + column: 13, + line: 3, + }, + { + messageId: 'noExtraNonNullAssertion', + endColumn: 18, + column: 13, + line: 3, + }, + { + messageId: 'noExtraNonNullAssertion', + endColumn: 17, + column: 13, + line: 3, + }, + ], + }, + { + code: ` +function foo(bar: number | undefined) { + const bar: number = bar!!; +} + `, + errors: [ + { + messageId: 'noExtraNonNullAssertion', + endColumn: 27, + column: 23, + line: 3, + }, + ], + }, + ], +}); From 45500155a653db502d059d8dc444161309e461b7 Mon Sep 17 00:00:00 2001 From: Jamison Dance Date: Mon, 18 Nov 2019 18:29:47 -0700 Subject: [PATCH 134/317] docs: tweak grammar (#1227) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f296ee034ef..1f6d7c3cac1 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ This is not valid JavaScript code, because it contains a so-called type annotati However, we can leverage the fact that ESLint has been designed with these use-cases in mind! -It turns out that ESLint is not just comprised of one library, instead it is comprised of a few important moving parts. One of those moving parts is **the parser**. ESLint ships with a parser built in (called [`espree`](https://github.com/eslint/espree)), and so if you only ever write standard JavaScript, you don't need to care about this implementation detail. +It turns out that ESLint is not just one library. Instead it is composed of a few important moving parts. One of those moving parts is **the parser**. ESLint ships with a parser built in (called [`espree`](https://github.com/eslint/espree)), and so if you only ever write standard JavaScript, you don't need to care about this implementation detail. The great thing is, though, if we want to support non-standard JavaScript syntax, all we need to do is provide ESLint with an alternative parser to use - that is a first-class use-case offered by ESLint. From dd9f58ccfcfe982d299f0de639b9eee26b27d1bc Mon Sep 17 00:00:00 2001 From: garyking Date: Tue, 19 Nov 2019 01:01:26 -0500 Subject: [PATCH 135/317] docs(eslint-plugin): fix title in no-unused-expressions docs (#1230) --- packages/eslint-plugin/docs/rules/no-unused-expressions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-unused-expressions.md b/packages/eslint-plugin/docs/rules/no-unused-expressions.md index 7da998ab2c6..e1a86449181 100644 --- a/packages/eslint-plugin/docs/rules/no-unused-expressions.md +++ b/packages/eslint-plugin/docs/rules/no-unused-expressions.md @@ -1,4 +1,4 @@ -# require or disallow semicolons instead of ASI (semi) +# Disallow Unused Expressions (no-unused-expressions) This rule aims to eliminate unused expressions which have no effect on the state of the program. From 56c00b32e47967ec0fb065e49063317e02181d0b Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 19 Nov 2019 09:09:23 -0800 Subject: [PATCH 136/317] fix(eslint-plugin): [req-await] crash on nonasync promise return (#1228) --- .../eslint-plugin/src/rules/require-await.ts | 19 +- .../tests/rules/require-await.test.ts | 181 ++++++++---------- .../eslint-plugin/typings/eslint-rules.d.ts | 2 +- 3 files changed, 90 insertions(+), 112 deletions(-) diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 5f27f8ad8a1..4db47f9e075 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -42,13 +42,12 @@ export default util.createRule({ } return { - 'FunctionDeclaration[async = true]': rules.FunctionDeclaration, - 'FunctionExpression[async = true]': rules.FunctionExpression, + FunctionDeclaration: rules.FunctionDeclaration, + FunctionExpression: rules.FunctionExpression, + ArrowFunctionExpression: rules.ArrowFunctionExpression, 'ArrowFunctionExpression[async = true]'( node: TSESTree.ArrowFunctionExpression, ): void { - rules.ArrowFunctionExpression(node); - // If body type is not BlockStatment, we need to check the return type here if (node.body.type !== AST_NODE_TYPES.BlockStatement) { const expression = parserServices.esTreeNodeToTSNodeMap.get( @@ -56,15 +55,13 @@ export default util.createRule({ ); if (expression && isThenableType(expression)) { // tell the base rule to mark the scope as having an await so it ignores it - rules.AwaitExpression(node as never); + rules.AwaitExpression(); } } }, - 'FunctionDeclaration[async = true]:exit': - rules['FunctionDeclaration:exit'], - 'FunctionExpression[async = true]:exit': rules['FunctionExpression:exit'], - 'ArrowFunctionExpression[async = true]:exit': - rules['ArrowFunctionExpression:exit'], + 'FunctionDeclaration:exit': rules['FunctionDeclaration:exit'], + 'FunctionExpression:exit': rules['FunctionExpression:exit'], + 'ArrowFunctionExpression:exit': rules['ArrowFunctionExpression:exit'], AwaitExpression: rules.AwaitExpression, ForOfStatement: rules.ForOfStatement, @@ -74,7 +71,7 @@ export default util.createRule({ >(node); if (expression && isThenableType(expression)) { // tell the base rule to mark the scope as having an await so it ignores it - rules.AwaitExpression(node as never); + rules.AwaitExpression(); } }, }; diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index 09b54bd3a99..fff294f7ccb 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -28,106 +28,87 @@ const noAwaitAsyncFunctionExpression: any = { ruleTester.run('require-await', rule, { valid: [ - { - // Non-async function declaration - code: `function numberOne(): number { - return 1; - }`, - }, - { - // Non-async function expression - code: `const numberOne = function(): number { - return 1; - }`, - }, - { - // Non-async arrow function expression (concise-body) - code: `const numberOne = (): number => 1;`, - }, - { - // Non-async arrow function expression (block-body) - code: `const numberOne = (): number => { - return 1; - };`, - }, - { - // Async function declaration with await - code: `async function numberOne(): Promise { - return await 1; - }`, - }, - { - // Async function expression with await - code: `const numberOne = async function(): Promise { - return await 1; - }`, - }, - { - // Async arrow function expression with await (concise-body) - code: `const numberOne = async (): Promise => await 1;`, - }, - { - // Async arrow function expression with await (block-body) - code: `const numberOne = async (): Promise => { - return await 1; - };`, - }, - { - // Async function declaration with promise return - code: `async function numberOne(): Promise { - return Promise.resolve(1); - }`, - }, - { - // Async function expression with promise return - code: `const numberOne = async function(): Promise { - return Promise.resolve(1); - }`, - }, - { - // Async arrow function with promise return (concise-body) - code: `const numberOne = async (): Promise => Promise.resolve(1);`, - }, - { - // Async arrow function with promise return (block-body) - code: `const numberOne = async (): Promise => { - return Promise.resolve(1); - };`, - }, - { - // Async function declaration with async function return - code: `async function numberOne(): Promise { - return getAsyncNumber(1); - } - async function getAsyncNumber(x: number): Promise { - return Promise.resolve(x); - }`, - }, - { - // Async function expression with async function return - code: `const numberOne = async function(): Promise { - return getAsyncNumber(1); - } - const getAsyncNumber = async function(x: number): Promise { - return Promise.resolve(x); - }`, - }, - { - // Async arrow function with async function return (concise-body) - code: `const numberOne = async (): Promise => getAsyncNumber(1); - const getAsyncNumber = async function(x: number): Promise { - return Promise.resolve(x); - }`, - }, - { - // Async arrow function with async function return (block-body) - code: `const numberOne = async (): Promise => { - return getAsyncNumber(1); - }; - const getAsyncNumber = async function(x: number): Promise { - return Promise.resolve(x); - }`, - }, + // Non-async function declaration + `function numberOne(): number { + return 1; + }`, + // Non-async function expression + `const numberOne = function(): number { + return 1; + }`, + // Non-async arrow function expression (concise-body) + `const numberOne = (): number => 1;`, + // Non-async arrow function expression (block-body) + `const numberOne = (): number => { + return 1; + };`, + // Non-async function that returns a promise + // https://github.com/typescript-eslint/typescript-eslint/issues/1226 + ` +function delay() { + return Promise.resolve(); +} + `, + ` +const delay = () => { + return Promise.resolve(); +} + `, + `const delay = () => Promise.resolve();`, + // Async function declaration with await + `async function numberOne(): Promise { + return await 1; + }`, + // Async function expression with await + `const numberOne = async function(): Promise { + return await 1; + }`, + // Async arrow function expression with await (concise-body) + `const numberOne = async (): Promise => await 1;`, + // Async arrow function expression with await (block-body) + `const numberOne = async (): Promise => { + return await 1; + };`, + // Async function declaration with promise return + `async function numberOne(): Promise { + return Promise.resolve(1); + }`, + // Async function expression with promise return + `const numberOne = async function(): Promise { + return Promise.resolve(1); + }`, + // Async arrow function with promise return (concise-body) + `const numberOne = async (): Promise => Promise.resolve(1);`, + // Async arrow function with promise return (block-body) + `const numberOne = async (): Promise => { + return Promise.resolve(1); + };`, + // Async function declaration with async function return + `async function numberOne(): Promise { + return getAsyncNumber(1); + } + async function getAsyncNumber(x: number): Promise { + return Promise.resolve(x); + }`, + // Async function expression with async function return + `const numberOne = async function(): Promise { + return getAsyncNumber(1); + } + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + // Async arrow function with async function return (concise-body) + `const numberOne = async (): Promise => getAsyncNumber(1); + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, + // Async arrow function with async function return (block-body) + `const numberOne = async (): Promise => { + return getAsyncNumber(1); + }; + const getAsyncNumber = async function(x: number): Promise { + return Promise.resolve(x); + }`, // https://github.com/typescript-eslint/typescript-eslint/issues/1188 ` async function testFunction(): Promise { diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 8037e624c4f..2ec44b6dbc2 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -451,7 +451,7 @@ declare module 'eslint/lib/rules/require-await' { node: TSESTree.ArrowFunctionExpression, ): void; ReturnStatement(node: TSESTree.ReturnStatement): void; - AwaitExpression(node: TSESTree.AwaitExpression): void; + AwaitExpression(): void; ForOfStatement(node: TSESTree.ForOfStatement): void; } >; From f1ab9a248c986e3ceda40ec385a104cae3d2955f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 19 Nov 2019 19:28:15 +0200 Subject: [PATCH 137/317] feat(eslint-plugin): [no-extran-class] add allowWithDecorator opt (#886) Co-authored-by: Brad Zacher --- .../docs/rules/no-extraneous-class.md | 22 ++++++++++++++--- .../src/rules/no-extraneous-class.ts | 24 ++++++++++++++++--- .../tests/rules/no-extraneous-class.test.ts | 19 +++++++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-extraneous-class.md b/packages/eslint-plugin/docs/rules/no-extraneous-class.md index 882d7e26a55..3c1fa052835 100644 --- a/packages/eslint-plugin/docs/rules/no-extraneous-class.md +++ b/packages/eslint-plugin/docs/rules/no-extraneous-class.md @@ -50,9 +50,25 @@ const StaticOnly = { This rule accepts a single object option. -- `allowConstructorOnly: true` will silence warnings about classes containing only a constructor. -- `allowEmpty: true` will silence warnings about empty classes. -- `allowStaticOnly: true` will silence warnings about classes containing only static members. +```ts +type Options = { + // allow extraneous classes if they only contain a constructor + allowConstructorOnly?: boolean; + // allow extraneous classes if they have no body (i.e. are empty) + allowEmpty?: boolean; + // allow extraneous classes if they only contain static members + allowStaticOnly?: boolean; + // allow extraneous classes if they are have a decorator + allowWithDecorator?: boolean; +}; + +const defaultOptions: Options = { + allowConstructorOnly: false, + allowEmpty: false, + allowStaticOnly: false, + allowWithDecorator: false, +}; +``` ## When Not To Use It diff --git a/packages/eslint-plugin/src/rules/no-extraneous-class.ts b/packages/eslint-plugin/src/rules/no-extraneous-class.ts index 4756b5928f3..996dd0ea71c 100644 --- a/packages/eslint-plugin/src/rules/no-extraneous-class.ts +++ b/packages/eslint-plugin/src/rules/no-extraneous-class.ts @@ -9,6 +9,7 @@ type Options = [ allowConstructorOnly?: boolean; allowEmpty?: boolean; allowStaticOnly?: boolean; + allowWithDecorator?: boolean; }, ]; type MessageIds = 'empty' | 'onlyStatic' | 'onlyConstructor'; @@ -36,6 +37,9 @@ export default util.createRule({ allowStaticOnly: { type: 'boolean', }, + allowWithDecorator: { + type: 'boolean', + }, }, }, ], @@ -50,9 +54,24 @@ export default util.createRule({ allowConstructorOnly: false, allowEmpty: false, allowStaticOnly: false, + allowWithDecorator: false, }, ], - create(context, [{ allowConstructorOnly, allowEmpty, allowStaticOnly }]) { + create( + context, + [{ allowConstructorOnly, allowEmpty, allowStaticOnly, allowWithDecorator }], + ) { + const isAllowWithDecorator = ( + node: TSESTree.ClassDeclaration | TSESTree.ClassExpression | undefined, + ): boolean => { + return !!( + allowWithDecorator && + node && + node.decorators && + node.decorators.length + ); + }; + return { ClassBody(node): void { const parent = node.parent as @@ -65,9 +84,8 @@ export default util.createRule({ } const reportNode = 'id' in parent && parent.id ? parent.id : parent; - if (node.body.length === 0) { - if (allowEmpty) { + if (allowEmpty || isAllowWithDecorator(parent)) { return; } diff --git a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts index 1d2742ed040..e009aa153ae 100644 --- a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts @@ -65,6 +65,13 @@ export class Bar { }, // https://github.com/typescript-eslint/typescript-eslint/issues/170 'export default class { hello() { return "I am foo!"; } }', + { + code: ` +@FooDecorator +class Foo {} + `, + options: [{ allowWithDecorator: true }], + }, ], invalid: [ @@ -125,5 +132,17 @@ export class AClass { }, ], }, + { + code: ` +@FooDecorator +class Foo {} + `, + options: [{ allowWithDecorator: false }], + errors: [ + { + messageId: 'empty', + }, + ], + }, ], }); From 6cfd468f79df4edd3c2e2a082004361bfd37da36 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 19 Nov 2019 09:57:12 -0800 Subject: [PATCH 138/317] fix(eslint-plugin): [no-untyped-pub-sig] constructor return (#1231) --- .../src/rules/no-untyped-public-signature.ts | 5 +- .../rules/no-untyped-public-signature.test.ts | 52 ++++++++++++++++--- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts b/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts index 2ecb1cbd62c..39a635b850e 100644 --- a/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts +++ b/packages/eslint-plugin/src/rules/no-untyped-public-signature.ts @@ -106,7 +106,10 @@ export default util.createRule({ }); } - if (!isReturnTyped(node.value.returnType)) { + if ( + node.kind !== 'constructor' && + !isReturnTyped(node.value.returnType) + ) { context.report({ node, messageId: 'noReturnType', 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 index 1a167d64e30..164f11b4bd7 100644 --- a/packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts +++ b/packages/eslint-plugin/tests/rules/no-untyped-public-signature.test.ts @@ -28,7 +28,7 @@ ruleTester.run('no-untyped-public-signature', rule, { code: ` class A { public b(c: string):void { - + } }`, }, @@ -36,7 +36,7 @@ ruleTester.run('no-untyped-public-signature', rule, { code: ` class A { public b(...c):void { - + } }`, }, @@ -44,7 +44,7 @@ ruleTester.run('no-untyped-public-signature', rule, { code: ` class A { b(c):void { - + } }`, options: [{ ignoredMethods: ['b'] }], @@ -71,22 +71,43 @@ ruleTester.run('no-untyped-public-signature', rule, { code: ` class A { b(...c):void { - + } - + d(c):void { - + } }`, options: [{ ignoredMethods: ['b', 'd'] }], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1229 + ` +class Foo { + constructor() {} +} + `, + ` +class Foo { + abstract constructor() {} +} + `, + ` +class Foo { + constructor(c: string) {} +} + `, + ` +class Foo { + abstract constructor(c: string) {} +} + `, ], invalid: [ //untyped parameter { code: `class A { public b(c):void { - + } }`, errors: [{ messageId: 'untypedParameter' }], @@ -206,5 +227,22 @@ ruleTester.run('no-untyped-public-signature', rule, { }`, errors: [{ messageId: 'noReturnType' }], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1229 + { + code: ` +class Foo { + constructor(c) {} +} + `, + errors: [{ messageId: 'untypedParameter' }], + }, + { + code: ` +class Foo { + abstract constructor(c) {} +} + `, + errors: [{ messageId: 'untypedParameter' }], + }, ], }); From 5b1300da3c5f3346bc9d74a59be67efab283b6f9 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 21 Nov 2019 01:39:36 +0200 Subject: [PATCH 139/317] fix(eslint-plugin): [no-dynamic-delete] correct invalid fixer for identifiers (#1244) --- .../src/rules/no-dynamic-delete.ts | 8 ++----- .../tests/rules/no-dynamic-delete.test.ts | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts index 0ee1636ea64..6fbdba1058f 100644 --- a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts +++ b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts @@ -33,14 +33,10 @@ export default util.createRule({ ) { return createPropertyReplacement( member.property, - member.property.value, + `.${member.property.value}`, ); } - if (member.property.type === AST_NODE_TYPES.Identifier) { - return createPropertyReplacement(member.property, member.property.name); - } - return undefined; } @@ -69,7 +65,7 @@ export default util.createRule({ replacement: string, ) { return (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => - fixer.replaceTextRange(getTokenRange(property), `.${replacement}`); + fixer.replaceTextRange(getTokenRange(property), replacement); } function getTokenRange(property: TSESTree.Expression): [number, number] { diff --git a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts index e3b4e5366e8..aa12c33c9e5 100644 --- a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts +++ b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts @@ -52,6 +52,8 @@ ruleTester.run('no-dynamic-delete', rule, { code: `const container: { [i: string]: 0 } = {}; delete container['aa' + 'b'];`, errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container['aa' + 'b'];`, }, { code: `const container: { [i: string]: 0 } = {}; @@ -64,16 +66,22 @@ ruleTester.run('no-dynamic-delete', rule, { code: `const container: { [i: string]: 0 } = {}; delete container[-Infinity];`, errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container[-Infinity];`, }, { code: `const container: { [i: string]: 0 } = {}; delete container[+Infinity];`, errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + delete container[+Infinity];`, }, { 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 } = {}; @@ -94,11 +102,26 @@ ruleTester.run('no-dynamic-delete', rule, { const name = 'name'; delete container[name];`, errors: [{ messageId: 'dynamicDelete' }], + output: `const container: { [i: string]: 0 } = {}; + const name = 'name'; + delete container[name];`, }, { code: `const container: { [i: string]: 0 } = {}; const getName = () => 'aaa'; delete container[getName()];`, + output: `const container: { [i: string]: 0 } = {}; + const getName = () => 'aaa'; + delete container[getName()];`, + errors: [{ messageId: 'dynamicDelete' }], + }, + { + code: `const container: { [i: string]: 0 } = {}; + const name = { foo: { bar: 'bar' } }; + delete container[name.foo.bar];`, + output: `const container: { [i: string]: 0 } = {}; + const name = { foo: { bar: 'bar' } }; + delete container[name.foo.bar];`, errors: [{ messageId: 'dynamicDelete' }], }, ], From d97f809c673c57be7e41b2121c4a1c8408d3f47c Mon Sep 17 00:00:00 2001 From: Eric Wang Date: Fri, 22 Nov 2019 04:13:20 +1100 Subject: [PATCH 140/317] fix(typescript-estree): fix synthetic default import (#1245) --- packages/typescript-estree/src/visitor-keys.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/visitor-keys.ts b/packages/typescript-estree/src/visitor-keys.ts index e594fb240e0..d7ee3ed356f 100644 --- a/packages/typescript-estree/src/visitor-keys.ts +++ b/packages/typescript-estree/src/visitor-keys.ts @@ -1,4 +1,4 @@ -import eslintVisitorKeys from 'eslint-visitor-keys'; +import * as eslintVisitorKeys from 'eslint-visitor-keys'; export const visitorKeys = eslintVisitorKeys.unionWith({ // Additional estree nodes. From fa88cb940af87c371946d83fbd31fb0b8007ff06 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 21 Nov 2019 19:16:18 +0200 Subject: [PATCH 141/317] feat(eslint-plugin): [restrict-plus-operands] check += (#892) Co-authored-by: Brad Zacher --- .../docs/rules/restrict-plus-operands.md | 31 +++++++ .../src/rules/restrict-plus-operands.ts | 89 ++++++++++++------- .../rules/restrict-plus-operands.test.ts | 58 ++++++++++++ 3 files changed, 148 insertions(+), 30 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md index 1efffa83e69..7b5af55a84f 100644 --- a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md +++ b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md @@ -16,6 +16,37 @@ var foo = 1n + 1; ## Options +This rule has an object option: + +- `"checkCompoundAssignments": false`: (default) does not check compound assignments (`+=`) +- `"checkCompoundAssignments": true` + +### checkCompoundAssignments + +Examples of **incorrect** code for the `{ "checkCompoundAssignments": true }` option: + +```ts +/*eslint @typescript-eslint/restrict-plus-operands: ["error", { "checkCompoundAssignments": true }]*/ + +let foo: string | undefined; +foo += 'some data'; + +let bar: string = ''; +bar += 0; +``` + +Examples of **correct** code for the `{ "checkCompoundAssignments": true }` option: + +```ts +/*eslint @typescript-eslint/restrict-plus-operands: ["error", { "checkCompoundAssignments": true }]*/ + +let foo: number = 0; +foo += 1; + +let bar = ''; +bar += 'test'; +``` + ```json { "@typescript-eslint/restrict-plus-operands": "error" diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index 1f715f1f902..c41587a169a 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -2,7 +2,14 @@ import { TSESTree } from '@typescript-eslint/experimental-utils'; import ts from 'typescript'; import * as util from '../util'; -export default util.createRule({ +type Options = [ + { + checkCompoundAssignments?: boolean; + }, +]; +type MessageIds = 'notNumbers' | 'notStrings' | 'notBigInts'; + +export default util.createRule({ name: 'restrict-plus-operands', meta: { type: 'problem', @@ -20,12 +27,25 @@ export default util.createRule({ "Operands of '+' operation must either be both strings or both numbers. Consider using a template literal.", notBigInts: "Operands of '+' operation must be both bigints.", }, - schema: [], + schema: [ + { + type: 'object', + additionalProperties: false, + properties: { + checkCompoundAssignments: { + type: 'boolean', + }, + }, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [ + { + checkCompoundAssignments: false, + }, + ], + create(context, [{ checkCompoundAssignments }]) { const service = util.getParserServices(context); - const typeChecker = service.program.getTypeChecker(); type BaseLiteral = 'string' | 'number' | 'bigint' | 'invalid'; @@ -83,32 +103,41 @@ export default util.createRule({ return getBaseTypeOfLiteralType(type); } - return { - "BinaryExpression[operator='+']"(node: TSESTree.BinaryExpression): void { - const leftType = getNodeType(node.left); - const rightType = getNodeType(node.right); + function checkPlusOperands( + node: TSESTree.BinaryExpression | TSESTree.AssignmentExpression, + ): void { + const leftType = getNodeType(node.left); + const rightType = getNodeType(node.right); - if ( - leftType === 'invalid' || - rightType === 'invalid' || - leftType !== rightType - ) { - if (leftType === 'string' || rightType === 'string') { - context.report({ - node, - messageId: 'notStrings', - }); - } else if (leftType === 'bigint' || rightType === 'bigint') { - context.report({ - node, - messageId: 'notBigInts', - }); - } else { - context.report({ - node, - messageId: 'notNumbers', - }); - } + if ( + leftType === 'invalid' || + rightType === 'invalid' || + leftType !== rightType + ) { + if (leftType === 'string' || rightType === 'string') { + context.report({ + node, + messageId: 'notStrings', + }); + } else if (leftType === 'bigint' || rightType === 'bigint') { + context.report({ + node, + messageId: 'notBigInts', + }); + } else { + context.report({ + node, + messageId: 'notNumbers', + }); + } + } + } + + return { + "BinaryExpression[operator='+']": checkPlusOperands, + "AssignmentExpression[operator='+=']"(node): void { + if (checkCompoundAssignments) { + checkPlusOperands(node); } }, }; diff --git a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts index 44583a202a1..5d979706f84 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -81,6 +81,28 @@ function foo(a: T) { return a + 1; } `, + { + code: ` +let foo: number = 0; +foo += 1; + `, + options: [ + { + checkCompoundAssignments: false, + }, + ], + }, + { + code: ` +let foo: number = 0; +foo += "string"; + `, + options: [ + { + checkCompoundAssignments: false, + }, + ], + }, ], invalid: [ { @@ -383,5 +405,41 @@ function foo(a: T) { }, ], }, + { + code: ` +let foo: string | undefined; +foo += "some data"; + `, + options: [ + { + checkCompoundAssignments: true, + }, + ], + errors: [ + { + messageId: 'notStrings', + line: 3, + column: 1, + }, + ], + }, + { + code: ` +let foo = ''; +foo += 0; + `, + options: [ + { + checkCompoundAssignments: true, + }, + ], + errors: [ + { + messageId: 'notStrings', + line: 3, + column: 1, + }, + ], + }, ], }); From ceb6f1ce225ad663111dd9d19083d20e1a45d30f Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 21 Nov 2019 19:17:50 +0200 Subject: [PATCH 142/317] feat(eslint-plugin): [no-unnece-cond] Add allowConstantLoopConditions (#1029) Co-authored-by: Brad Zacher --- .../docs/rules/no-unnecessary-condition.md | 10 +++ .../src/rules/no-unnecessary-condition.ts | 63 ++++++++++++++----- .../rules/no-unnecessary-condition.test.ts | 21 +++++++ 3 files changed, 77 insertions(+), 17 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md index 48b98849c41..4bc160e68cc 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md @@ -53,6 +53,16 @@ function head(items: T[]) { } ``` +- `allowConstantLoopConditions` (default `false`) - allows constant expressions in loops. + +Example of correct code for when `allowConstantLoopConditions` is `true`: + +```ts +while (true) {} +for (; true; ) {} +do {} while (true); +``` + ## When Not To Use It The main downside to using this rule is the need for type information. diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 8e75f7adb3f..420271a23b8 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -41,15 +41,9 @@ const isLiteral = (type: ts.Type): boolean => isLiteralType(type); // #endregion -type ExpressionWithTest = - | TSESTree.ConditionalExpression - | TSESTree.DoWhileStatement - | TSESTree.ForStatement - | TSESTree.IfStatement - | TSESTree.WhileStatement; - export type Options = [ { + allowConstantLoopConditions?: boolean; ignoreRhs?: boolean; }, ]; @@ -74,6 +68,9 @@ export default createRule({ { type: 'object', properties: { + allowConstantLoopConditions: { + type: 'boolean', + }, ignoreRhs: { type: 'boolean', }, @@ -91,10 +88,11 @@ export default createRule({ }, defaultOptions: [ { + allowConstantLoopConditions: false, ignoreRhs: false, }, ], - create(context, [{ ignoreRhs }]) { + create(context, [{ allowConstantLoopConditions, ignoreRhs }]) { const service = getParserServices(context); const checker = service.program.getTypeChecker(); @@ -165,14 +163,13 @@ export default createRule({ * Filters all LogicalExpressions to prevent some duplicate reports. */ function checkIfTestExpressionIsNecessaryConditional( - node: ExpressionWithTest, + node: TSESTree.ConditionalExpression | TSESTree.IfStatement, ): void { - if ( - node.test !== null && - node.test.type !== AST_NODE_TYPES.LogicalExpression - ) { - checkNode(node.test); + if (node.test.type === AST_NODE_TYPES.LogicalExpression) { + return; } + + checkNode(node.test); } /** @@ -187,14 +184,46 @@ export default createRule({ } } + /** + * Checks that a testable expression of a loop is necessarily conditional, reports otherwise. + */ + function checkIfLoopIsNecessaryConditional( + node: + | TSESTree.DoWhileStatement + | TSESTree.ForStatement + | TSESTree.WhileStatement, + ): void { + if ( + node.test === null || + node.test.type === AST_NODE_TYPES.LogicalExpression + ) { + return; + } + + /** + * Allow: + * while (true) {} + * for (;true;) {} + * do {} while (true) + */ + if ( + allowConstantLoopConditions && + isBooleanLiteralType(getNodeType(node.test), true) + ) { + return; + } + + checkNode(node.test); + } + return { BinaryExpression: checkIfBinaryExpressionIsNecessaryConditional, ConditionalExpression: checkIfTestExpressionIsNecessaryConditional, - DoWhileStatement: checkIfTestExpressionIsNecessaryConditional, - ForStatement: checkIfTestExpressionIsNecessaryConditional, + DoWhileStatement: checkIfLoopIsNecessaryConditional, + ForStatement: checkIfLoopIsNecessaryConditional, IfStatement: checkIfTestExpressionIsNecessaryConditional, - WhileStatement: checkIfTestExpressionIsNecessaryConditional, LogicalExpression: checkLogicalExpressionForUnnecessaryConditionals, + WhileStatement: checkIfLoopIsNecessaryConditional, }; }, }); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index c5d90fd01ef..30e511ac119 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -97,6 +97,14 @@ declare const b2: true; if(b1 && b2) {}`, options: [{ ignoreRhs: true }], }, + { + code: ` +while(true) {} +for (;true;) {} +do {} while(true) + `, + options: [{ allowConstantLoopConditions: true }], + }, ], invalid: [ // Ensure that it's checking in all the right places @@ -201,5 +209,18 @@ const t1 = (b1 && b2) ? 'yes' : 'no'`, ruleError(9, 13, 'alwaysTruthy'), ], }, + { + code: ` +while(true) {} +for (;true;) {} +do {} while(true) + `, + options: [{ allowConstantLoopConditions: false }], + errors: [ + ruleError(2, 7, 'alwaysTruthy'), + ruleError(3, 7, 'alwaysTruthy'), + ruleError(4, 13, 'alwaysTruthy'), + ], + }, ], }); From d785c61f9e518ebefdd09614a0dc69494bdf2e85 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 21 Nov 2019 19:25:22 +0200 Subject: [PATCH 143/317] feat(eslint-plugin): [camelcase] add genericType option (#925) --- .../eslint-plugin/docs/rules/camelcase.md | 100 ++++++++- packages/eslint-plugin/src/rules/camelcase.ts | 25 ++- .../tests/rules/camelcase.test.ts | 206 ++++++++++++++++++ .../eslint-plugin/typings/eslint-rules.d.ts | 1 + 4 files changed, 329 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/camelcase.md b/packages/eslint-plugin/docs/rules/camelcase.md index 84c4d9d13b5..5fa0c8e530f 100644 --- a/packages/eslint-plugin/docs/rules/camelcase.md +++ b/packages/eslint-plugin/docs/rules/camelcase.md @@ -30,8 +30,10 @@ variable that will be imported into the local module scope. This rule has an object option: -- `"properties": "always"` (default) enforces camelcase style for property names -- `"properties": "never"` does not check property names +- `"properties": "never"` (default) does not check property names +- `"properties": "always"` enforces camelcase style for property names +- `"genericType": "never"` (default) does not check generic identifiers +- `"genericType": "always"` enforces camelcase style for generic identifiers - `"ignoreDestructuring": false` (default) enforces camelcase style for destructured identifiers - `"ignoreDestructuring": true` does not check destructured identifiers - `allow` (`string[]`) list of properties to accept. Accept regex. @@ -129,6 +131,100 @@ var obj = { }; ``` +### genericType: "always" + +Examples of **incorrect** code for this rule with the default `{ "genericType": "always" }` option: + +```typescript +/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "always" }] */ + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} +``` + +Examples of **correct** code for this rule with the default `{ "genericType": "always" }` option: + +```typescript +/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "always" }] */ + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} +``` + +### genericType: "never" + +Examples of **correct** code for this rule with the `{ "genericType": "never" }` option: + +```typescript +/* eslint @typescript-eslint/camelcase: ["error", { "genericType": "never" }] */ + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} + +interface Foo {} +function foo() {} +class Foo {} +type Foo = {}; +class Foo { + method() {} +} +``` + ### ignoreDestructuring: false Examples of **incorrect** code for this rule with the default `{ "ignoreDestructuring": false }` option: diff --git a/packages/eslint-plugin/src/rules/camelcase.ts b/packages/eslint-plugin/src/rules/camelcase.ts index 0928484b629..a2be8a1c695 100644 --- a/packages/eslint-plugin/src/rules/camelcase.ts +++ b/packages/eslint-plugin/src/rules/camelcase.ts @@ -8,6 +8,19 @@ import * as util from '../util'; type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; +const schema = util.deepMerge( + Array.isArray(baseRule.meta.schema) + ? baseRule.meta.schema[0] + : baseRule.meta.schema, + { + properties: { + genericType: { + enum: ['always', 'never'], + }, + }, + }, +); + export default util.createRule({ name: 'camelcase', meta: { @@ -17,7 +30,7 @@ export default util.createRule({ category: 'Stylistic Issues', recommended: 'error', }, - schema: baseRule.meta.schema, + schema: [schema], messages: baseRule.meta.messages, }, defaultOptions: [ @@ -25,6 +38,7 @@ export default util.createRule({ allow: ['^UNSAFE_'], ignoreDestructuring: false, properties: 'never', + genericType: 'never', }, ], create(context, [options]) { @@ -36,6 +50,7 @@ export default util.createRule({ AST_NODE_TYPES.TSAbstractClassProperty, ]; + const genericType = options.genericType; const properties = options.properties; const allow = (options.allow || []).map(entry => ({ name: entry, @@ -117,6 +132,14 @@ export default util.createRule({ return; } + if (parent && parent.type === AST_NODE_TYPES.TSTypeParameter) { + if (genericType === 'always' && isUnderscored(name)) { + report(node); + } + + return; + } + if (parent && parent.type === AST_NODE_TYPES.OptionalMemberExpression) { // Report underscored object names if ( diff --git a/packages/eslint-plugin/tests/rules/camelcase.test.ts b/packages/eslint-plugin/tests/rules/camelcase.test.ts index d2d3287ce66..617cdf3e40f 100644 --- a/packages/eslint-plugin/tests/rules/camelcase.test.ts +++ b/packages/eslint-plugin/tests/rules/camelcase.test.ts @@ -79,6 +79,100 @@ ruleTester.run('camelcase', rule, { code: 'abstract class Foo { abstract bar: number = 0; }', options: [{ properties: 'always' }], }, + { + code: 'interface Foo {}', + options: [{ genericType: 'never' }], + }, + { + code: 'interface Foo {}', + options: [{ genericType: 'always' }], + }, + { + code: 'interface Foo {}', + options: [{ genericType: 'always' }], + }, + { + code: 'function fn() {}', + options: [{ genericType: 'never' }], + }, + { + code: 'function fn() {}', + options: [{ genericType: 'always' }], + }, + { + code: 'function fn() {}', + options: [{ genericType: 'always' }], + }, + { + code: 'class Foo {}', + options: [{ genericType: 'never' }], + }, + { + code: 'class Foo {}', + options: [{ genericType: 'always' }], + }, + { + code: 'class Foo {}', + options: [{ genericType: 'always' }], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'never' }], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'always' }], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'always' }], + }, + { + code: ` +type Foo = {} + `, + options: [{ genericType: 'always' }], + }, + { + code: ` +type Foo = {} + `, + options: [{ genericType: 'always' }], + }, + { + code: ` +type Foo = {} + `, + options: [{ genericType: 'never' }], + }, + { + code: ` +class Foo { + FOO_method() {} +} + `, + options: [{ allow: ['^FOO'] }], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{}], + }, { code: 'const foo = foo?.baz;', }, @@ -238,5 +332,117 @@ ruleTester.run('camelcase', rule, { }, ], }, + { + code: 'interface Foo {}', + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 1, + column: 15, + }, + ], + }, + { + code: 'function fn() {}', + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 1, + column: 13, + }, + ], + }, + { + code: 'class Foo {}', + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 1, + column: 11, + }, + ], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 3, + column: 10, + }, + ], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 3, + column: 10, + }, + { + messageId: 'notCamelCase', + data: { + name: 't_bar', + }, + line: 3, + column: 24, + }, + ], + }, + { + code: ` +class Foo { + method() {} +} + `, + options: [{ genericType: 'always' }], + errors: [ + { + messageId: 'notCamelCase', + data: { + name: 't_foo', + }, + line: 3, + column: 10, + }, + { + messageId: 'notCamelCase', + data: { + name: 't_bar', + }, + line: 3, + column: 18, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 2ec44b6dbc2..62f45419b18 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -35,6 +35,7 @@ declare module 'eslint/lib/rules/camelcase' { allow?: string[]; ignoreDestructuring?: boolean; properties?: 'always' | 'never'; + genericType?: 'never' | 'always'; }, ], { From 1bd863efd09f754a54aa36b829f51ebe39ec7145 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 23 Nov 2019 16:02:25 +1300 Subject: [PATCH 144/317] docs(eslint-plugin): correct typo in configs README (#1251) --- packages/eslint-plugin/src/configs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/configs/README.md b/packages/eslint-plugin/src/configs/README.md index 95accb69490..28747608efb 100644 --- a/packages/eslint-plugin/src/configs/README.md +++ b/packages/eslint-plugin/src/configs/README.md @@ -1,6 +1,6 @@ # Premade configs -These configs exist for your convenience. They contain configuration intended to save you time and effort when configuring your project by disabling rules known to conflict with this repository, or cause issues in typesript codebases. +These configs exist for your convenience. They contain configuration intended to save you time and effort when configuring your project by disabling rules known to conflict with this repository, or cause issues in TypeScript codebases. ## All @@ -26,7 +26,7 @@ The recommended set is an **_opinionated_** set of rules that we think you shoul 1. They help you adhere to TypeScript best practices. 2. They help catch probable issue vectors in your code. -That being said, it is not the only way to use `@typescript-eslint/eslint-plugin`, nor is it the way that will necesasrily work 100% for your project/company. It has been built based off of two main things: +That being said, it is not the only way to use `@typescript-eslint/eslint-plugin`, nor is it the way that will necessarily work 100% for your project/company. It has been built based off of two main things: 1. TypeScript best practices collected and collated from places like: - [TypeScript repo](https://github.com/Microsoft/TypeScript). From 1d56c8247deb67edc37d671311af9e8ab8614dec Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 23 Nov 2019 16:02:35 +1300 Subject: [PATCH 145/317] docs(eslint-plugin): fix typo in no-this-alias (#1252) --- packages/eslint-plugin/docs/rules/no-this-alias.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-this-alias.md b/packages/eslint-plugin/docs/rules/no-this-alias.md index b2c891fa0e6..4a512be31eb 100644 --- a/packages/eslint-plugin/docs/rules/no-this-alias.md +++ b/packages/eslint-plugin/docs/rules/no-this-alias.md @@ -1,6 +1,6 @@ # Disallow aliasing `this` (no-this-alias) -This rule prohibts assigning variables to `this`. +This rule prohibits assigning variables to `this`. ## Rule Details From b16a4b6a79637d0ac7c61526da6777a0ac3dddd5 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 24 Nov 2019 14:11:04 -0800 Subject: [PATCH 146/317] feat: suggestion types, suggestions for no-explicit-any (#1250) --- package.json | 2 +- .../src/rules/no-explicit-any.ts | 31 +++- .../tests/rules/no-explicit-any.test.ts | 163 +++++++++++++++++- .../experimental-utils/src/ts-eslint/Rule.ts | 22 ++- .../src/ts-eslint/RuleTester.ts | 12 ++ tests/integration/README.md | 2 +- .../fixtures/markdown/test.js.snap | 96 +++++++++++ .../integration/fixtures/vue-jsx/test.js.snap | 24 +++ .../integration/fixtures/vue-sfc/test.js.snap | 24 +++ yarn.lock | 44 +++-- 10 files changed, 394 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 111bf02de8b..aca3b80aee4 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@types/node": "^12.12.7", "all-contributors-cli": "^6.11.0", "cz-conventional-changelog": "^3.0.2", - "eslint": "^6.6.0", + "eslint": "^6.7.0", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-plugin": "^2.1.0", "eslint-plugin-import": "^2.18.2", diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 249265a7683..29fb16651a2 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -11,7 +11,7 @@ export type Options = [ ignoreRestArgs?: boolean; }, ]; -export type MessageIds = 'unexpectedAny'; +export type MessageIds = 'unexpectedAny' | 'suggestUnknown' | 'suggestNever'; export default util.createRule({ name: 'no-explicit-any', @@ -25,6 +25,10 @@ export default util.createRule({ fixable: 'code', messages: { unexpectedAny: 'Unexpected any. Specify a different type.', + suggestUnknown: + 'Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.', + suggestNever: + "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", }, schema: [ { @@ -172,17 +176,36 @@ export default util.createRule({ return; } - let fix: TSESLint.ReportFixFunction | null = null; + const fixOrSuggest: { + fix: TSESLint.ReportFixFunction | null; + suggest: TSESLint.ReportSuggestionArray | null; + } = { + fix: null, + suggest: [ + { + messageId: 'suggestUnknown', + fix(fixer): TSESLint.RuleFix { + return fixer.replaceText(node, 'unknown'); + }, + }, + { + messageId: 'suggestNever', + fix(fixer): TSESLint.RuleFix { + return fixer.replaceText(node, 'never'); + }, + }, + ], + }; if (fixToUnknown) { - fix = (fixer => + fixOrSuggest.fix = (fixer => fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction; } context.report({ node, messageId: 'unexpectedAny', - fix, + ...fixOrSuggest, }); }, }; diff --git a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts index c5624ba0635..0bc8e5f3438 100644 --- a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts +++ b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts @@ -3,6 +3,7 @@ import { RuleTester } from '../RuleTester'; import { TSESLint } from '@typescript-eslint/experimental-utils'; type InvalidTestCase = TSESLint.InvalidTestCase; +type SuggestionOutput = TSESLint.SuggestionOutput; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -306,11 +307,31 @@ type obj = { messageId: 'unexpectedAny', line: 1, column: 31, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'function generic(param: Array): Array {}', + }, + { + messageId: 'suggestNever', + output: 'function generic(param: Array): Array {}', + }, + ], }, { messageId: 'unexpectedAny', line: 1, column: 44, + suggestions: [ + { + messageId: 'suggestUnknown', + output: 'function generic(param: Array): Array {}', + }, + { + messageId: 'suggestNever', + output: 'function generic(param: Array): Array {}', + }, + ], }, ], }, @@ -705,11 +726,31 @@ type obj = { messageId: 'unexpectedAny', line: 1, column: 15, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `class Foo extends Bar {}`, + }, + { + messageId: 'suggestNever', + output: `class Foo extends Bar {}`, + }, + ], }, { messageId: 'unexpectedAny', line: 1, column: 32, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `class Foo extends Bar {}`, + }, + { + messageId: 'suggestNever', + output: `class Foo extends Bar {}`, + }, + ], }, ], }, @@ -720,11 +761,31 @@ type obj = { messageId: 'unexpectedAny', line: 1, column: 24, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `abstract class Foo extends Bar {}`, + }, + { + messageId: 'suggestNever', + output: `abstract class Foo extends Bar {}`, + }, + ], }, { messageId: 'unexpectedAny', line: 1, column: 41, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `abstract class Foo extends Bar {}`, + }, + { + messageId: 'suggestNever', + output: `abstract class Foo extends Bar {}`, + }, + ], }, ], }, @@ -735,16 +796,46 @@ type obj = { messageId: 'unexpectedAny', line: 1, column: 24, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `abstract class Foo implements Bar, Baz {}`, + }, + { + messageId: 'suggestNever', + output: `abstract class Foo implements Bar, Baz {}`, + }, + ], }, { messageId: 'unexpectedAny', line: 1, column: 44, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `abstract class Foo implements Bar, Baz {}`, + }, + { + messageId: 'suggestNever', + output: `abstract class Foo implements Bar, Baz {}`, + }, + ], }, { messageId: 'unexpectedAny', line: 1, column: 54, + suggestions: [ + { + messageId: 'suggestUnknown', + output: `abstract class Foo implements Bar, Baz {}`, + }, + { + messageId: 'suggestNever', + output: `abstract class Foo implements Bar, Baz {}`, + }, + ], }, ], }, @@ -771,19 +862,51 @@ type obj = { { // https://github.com/typescript-eslint/typescript-eslint/issues/64 code: ` - function test>() {} - const test = >() => {}; - `, +function test>() {} +const test = >() => {}; + `.trimRight(), errors: [ { messageId: 'unexpectedAny', line: 2, - column: 41, + column: 33, + suggestions: [ + { + messageId: 'suggestUnknown', + output: ` +function test>() {} +const test = >() => {}; + `.trimRight(), + }, + { + messageId: 'suggestNever', + output: ` +function test>() {} +const test = >() => {}; + `.trimRight(), + }, + ], }, { messageId: 'unexpectedAny', line: 3, - column: 41, + column: 33, + suggestions: [ + { + messageId: 'suggestUnknown', + output: ` +function test>() {} +const test = >() => {}; + `.trimRight(), + }, + { + messageId: 'suggestNever', + output: ` +function test>() {} +const test = >() => {}; + `.trimRight(), + }, + ], }, ], }, @@ -869,7 +992,23 @@ type obj = { ], }, ] as InvalidTestCase[]).reduce((acc, testCase) => { - acc.push(testCase); + const suggestions = (code: string): SuggestionOutput[] => [ + { + messageId: 'suggestUnknown', + output: code.replace(/any/, 'unknown'), + }, + { + messageId: 'suggestNever', + output: code.replace(/any/, 'never'), + }, + ]; + acc.push({ + ...testCase, + errors: testCase.errors.map(e => ({ + ...e, + suggestions: e.suggestions ?? suggestions(testCase.code), + })), + }); const options = testCase.options || []; const code = `// fixToUnknown: true\n${testCase.code}`; acc.push({ @@ -881,7 +1020,17 @@ type obj = { return err; } - return { ...err, line: err.line + 1 }; + return { + ...err, + line: err.line + 1, + suggestions: + err.suggestions?.map( + (s): SuggestionOutput => ({ + ...s, + output: `// fixToUnknown: true\n${s.output}`, + }), + ) ?? suggestions(code), + }; }), }); diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index dad91e6a8e0..5cf79e3e16e 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -105,6 +105,9 @@ interface RuleFixer { type ReportFixFunction = ( fixer: RuleFixer, ) => null | RuleFix | RuleFix[] | IterableIterator; +type ReportSuggestionArray = ReportDescriptorBase< + TMessageIds +>[]; interface ReportDescriptorBase { /** @@ -119,7 +122,19 @@ interface ReportDescriptorBase { * The messageId which is being reported. */ messageId: TMessageIds; + // we disallow this because it's much better to use messageIds for reusable errors that are easily testable + // message?: string; + // suggestions instead have this property that works the same, but again it's much better to use messageIds + // desc?: string; +} +interface ReportDescriptorWithSuggestion + extends ReportDescriptorBase { + /** + * 6.7's Suggestions API + */ + suggest?: ReportSuggestionArray | null; } + interface ReportDescriptorNodeOptionalLoc { /** * The Node or AST Token which the report is being attached to @@ -136,9 +151,9 @@ interface ReportDescriptorLocOnly { */ loc: TSESTree.SourceLocation | TSESTree.LineAndColumnData; } -type ReportDescriptor = ReportDescriptorBase< - TMessageIds -> & +type ReportDescriptor< + TMessageIds extends string +> = ReportDescriptorWithSuggestion & (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly); interface RuleContext< @@ -416,6 +431,7 @@ interface RuleModule< export { ReportDescriptor, ReportFixFunction, + ReportSuggestionArray, RuleContext, RuleFix, RuleFixer, diff --git a/packages/experimental-utils/src/ts-eslint/RuleTester.ts b/packages/experimental-utils/src/ts-eslint/RuleTester.ts index 84da228fb81..2a32daa5a9e 100644 --- a/packages/experimental-utils/src/ts-eslint/RuleTester.ts +++ b/packages/experimental-utils/src/ts-eslint/RuleTester.ts @@ -19,6 +19,16 @@ interface ValidTestCase> { }; } +interface SuggestionOutput { + messageId: TMessageIds; + data?: Record; + /** + * NOTE: Suggestions will be applied as a stand-alone change, without triggering multipass fixes. + * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion. + */ + output: string; +} + interface InvalidTestCase< TMessageIds extends string, TOptions extends Readonly @@ -35,6 +45,7 @@ interface TestCaseError { column?: number; endLine?: number; endColumn?: number; + suggestions?: SuggestionOutput[]; } interface RunTests< @@ -79,6 +90,7 @@ class RuleTester extends (ESLintRuleTester as { export { InvalidTestCase, + SuggestionOutput, RuleTester, RuleTesterConfig, RunTests, diff --git a/tests/integration/README.md b/tests/integration/README.md index eb33e8bd62d..c0aa0b97643 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -14,5 +14,5 @@ These tests are setup to run within docker containers to ensure that each test i 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 . +1. Run your integration test by running the single command you copied in the previous step. - If your test finishes successfully, a `test.js.snap` will be created. diff --git a/tests/integration/fixtures/markdown/test.js.snap b/tests/integration/fixtures/markdown/test.js.snap index 4fc96f79abc..5f28d2474ea 100644 --- a/tests/integration/fixtures/markdown/test.js.snap +++ b/tests/integration/fixtures/markdown/test.js.snap @@ -29,6 +29,30 @@ Array [ "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", "severity": 2, + "suggestions": Array [ + Object { + "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", + "fix": Object { + "range": Array [ + 51, + 54, + ], + "text": "unknown", + }, + "messageId": "suggestUnknown", + }, + Object { + "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", + "fix": Object { + "range": Array [ + 51, + 54, + ], + "text": "never", + }, + "messageId": "suggestNever", + }, + ], }, Object { "column": 3, @@ -62,6 +86,30 @@ Array [ "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", "severity": 2, + "suggestions": Array [ + Object { + "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "unknown", + }, + "messageId": "suggestUnknown", + }, + Object { + "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "never", + }, + "messageId": "suggestNever", + }, + ], }, Object { "column": 3, @@ -84,6 +132,30 @@ Array [ "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", "severity": 2, + "suggestions": Array [ + Object { + "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "unknown", + }, + "messageId": "suggestUnknown", + }, + Object { + "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "never", + }, + "messageId": "suggestNever", + }, + ], }, Object { "column": 3, @@ -106,6 +178,30 @@ Array [ "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", "severity": 2, + "suggestions": Array [ + Object { + "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "unknown", + }, + "messageId": "suggestUnknown", + }, + Object { + "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", + "fix": Object { + "range": Array [ + 16, + 19, + ], + "text": "never", + }, + "messageId": "suggestNever", + }, + ], }, Object { "column": 3, diff --git a/tests/integration/fixtures/vue-jsx/test.js.snap b/tests/integration/fixtures/vue-jsx/test.js.snap index d4432e47428..e0fbff509d4 100644 --- a/tests/integration/fixtures/vue-jsx/test.js.snap +++ b/tests/integration/fixtures/vue-jsx/test.js.snap @@ -18,6 +18,30 @@ Array [ "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", "severity": 2, + "suggestions": Array [ + Object { + "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", + "fix": Object { + "range": Array [ + 390, + 393, + ], + "text": "unknown", + }, + "messageId": "suggestUnknown", + }, + Object { + "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", + "fix": Object { + "range": Array [ + 390, + 393, + ], + "text": "never", + }, + "messageId": "suggestNever", + }, + ], }, ], "source": "