From 41d4a4752369f48b4362965ec8c0e6c0b9fadcc9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 15 Sep 2020 00:04:32 -0400 Subject: [PATCH 1/9] docs(eslint-plugin): added missing `no-restricted-globals` to `ban` in ROADMAP.md (#2564) --- packages/eslint-plugin/ROADMAP.md | 134 +++++++++++++++--------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index 5d9724a194f8..aece78f33577 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -44,73 +44,73 @@ It lists all TSLint rules along side rules from the ESLint ecosystem that are th ### Functionality -| TSLint rule | | ESLint rule | -| ------------------------------------ | :-: | ---------------------------------------------------------------------------------------------------- | -| [`await-promise`] | βœ… | [`@typescript-eslint/await-thenable`] | -| [`ban-comma-operator`] | 🌟 | [`no-sequences`][no-sequences] | -| [`ban`] | 🌟 | [`no-restricted-properties`][no-restricted-properties] | -| [`curly`] | 🌟 | [`curly`][curly] | -| [`forin`] | 🌟 | [`guard-for-in`][guard-for-in] | -| [`function-constructor`] | 🌟 | [`no-new-func`][no-new-func] | -| [`import-blacklist`] | 🌟 | [`no-restricted-imports`][no-restricted-imports] | -| [`label-position`] | 🌟 | [`no-unused-labels`][no-unused-labels] (similar) | -| [`no-arg`] | 🌟 | [`no-caller`][no-caller] (also blocks `arguments.caller`) | -| [`no-async-without-await`] | βœ… | [`@typescript-eslint/require-await`] | -| [`no-bitwise`] | 🌟 | [`no-bitwise`][no-bitwise] | -| [`no-conditional-assignment`] | 🌟 | [`no-cond-assign`][no-cond-assign][1] | -| [`no-console`] | 🌟 | [`no-console`][no-console] (configuration works slightly differently) | -| [`no-construct`] | 🌟 | [`no-new-wrappers`][no-new-wrappers] | -| [`no-debugger`] | 🌟 | [`no-debugger`][no-debugger] | -| [`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`] | βœ… | [`@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`] | -| [`no-for-in-array`] | βœ… | [`@typescript-eslint/no-for-in-array`] | -| [`no-implicit-dependencies`] | πŸ”Œ | [`import/no-extraneous-dependencies`] | -| [`no-inferred-empty-object-type`] | πŸ›‘ | N/A | -| [`no-invalid-template-strings`] | 🌟 | [`no-template-curly-in-string`][no-template-curly-in-string] | -| [`no-invalid-this`] | 🌟 | [`no-invalid-this`][no-invalid-this] | -| [`no-misused-new`] | βœ… | [`@typescript-eslint/no-misused-new`] | -| [`no-null-keyword`] | πŸ”Œ | [`no-null/no-null`] (doesn’t handle `null` type) | -| [`no-null-undefined-union`] | πŸ›‘ | N/A | -| [`no-object-literal-type-assertion`] | βœ… | [`@typescript-eslint/consistent-type-assertions`] | -| [`no-promise-as-boolean`] | βœ… | [`@typescript-eslint/no-misused-promises`] | -| [`no-restricted-globals`] | βœ… | [`no-restricted-globals`][no-restricted-globals] | -| [`no-return-await`] | 🌟 | [`no-return-await`][no-return-await] | -| [`no-shadowed-variable`] | 🌟 | [`no-shadow`][no-shadow] | -| [`no-sparse-arrays`] | 🌟 | [`no-sparse-arrays`][no-sparse-arrays] | -| [`no-string-literal`] | 🌟 | [`dot-notation`][dot-notation] | -| [`no-string-throw`] | βœ… | [`@typescript-eslint/no-throw-literal`] | -| [`no-submodule-imports`] | πŸŒ“ | [`import/no-internal-modules`] (slightly different) | -| [`no-switch-case-fall-through`] | 🌟 | [`no-fallthrough`][no-fallthrough] | -| [`no-tautology-expression`] | πŸ›‘ | N/A | -| [`no-this-assignment`] | βœ… | [`@typescript-eslint/no-this-alias`] | -| [`no-unbound-method`] | βœ… | [`@typescript-eslint/unbound-method`] | -| [`no-unnecessary-class`] | βœ… | [`@typescript-eslint/no-extraneous-class`] | -| [`no-unsafe-any`] | πŸŒ“ | [`@typescript-eslint/no-unsafe-member-access`][2] | -| [`no-unsafe-finally`] | 🌟 | [`no-unsafe-finally`][no-unsafe-finally] | -| [`no-unused-expression`] | 🌟 | [`no-unused-expressions`][no-unused-expressions] | -| [`no-unused-variable`] | πŸŒ“ | [`@typescript-eslint/no-unused-vars`] | -| [`no-use-before-declare`] | βœ… | [`@typescript-eslint/no-use-before-define`] | -| [`no-var-keyword`] | 🌟 | [`no-var`][no-var] | -| [`no-void-expression`] | πŸ›‘ | N/A (unrelated to the similarly named ESLint rule `no-void`) | -| [`prefer-conditional-expression`] | πŸ›‘ | N/A | -| [`prefer-object-spread`] | 🌟 | [`prefer-object-spread`][prefer-object-spread] | -| [`radix`] | 🌟 | [`radix`][radix] | -| [`restrict-plus-operands`] | βœ… | [`@typescript-eslint/restrict-plus-operands`] | -| [`static-this`] | πŸ›‘ | N/A | -| [`strict-boolean-expressions`] | βœ… | [`@typescript-eslint/strict-boolean-expressions`] | -| [`strict-string-expressions`] | βœ… | [`@typescript-eslint/restrict-plus-operands`] & [`@typescript-eslint/restrict-template-expressions`] | -| [`strict-type-predicates`] | πŸ›‘ | N/A | -| [`switch-default`] | 🌟 | [`default-case`][default-case] | -| [`triple-equals`] | 🌟 | [`eqeqeq`][eqeqeq] | -| [`typeof-compare`] | 🌟 | [`valid-typeof`][valid-typeof] | -| [`unnecessary-constructor`] | 🌟 | [`no-useless-constructor`][no-useless-constructor] | -| [`use-default-type-parameter`] | βœ… | [`@typescript-eslint/no-unnecessary-type-arguments`] | -| [`use-isnan`] | 🌟 | [`use-isnan`][use-isnan] | +| TSLint rule | | ESLint rule | +| ------------------------------------ | :-: | --------------------------------------------------------------------------------------------------------- | +| [`await-promise`] | βœ… | [`@typescript-eslint/await-thenable`] | +| [`ban-comma-operator`] | 🌟 | [`no-sequences`][no-sequences] | +| [`ban`] | 🌟 | [`no-restricted-globals`][no-restricted-globals] & [`no-restricted-properties`][no-restricted-properties] | +| [`curly`] | 🌟 | [`curly`][curly] | +| [`forin`] | 🌟 | [`guard-for-in`][guard-for-in] | +| [`function-constructor`] | 🌟 | [`no-new-func`][no-new-func] | +| [`import-blacklist`] | 🌟 | [`no-restricted-imports`][no-restricted-imports] | +| [`label-position`] | 🌟 | [`no-unused-labels`][no-unused-labels] (similar) | +| [`no-arg`] | 🌟 | [`no-caller`][no-caller] (also blocks `arguments.caller`) | +| [`no-async-without-await`] | βœ… | [`@typescript-eslint/require-await`] | +| [`no-bitwise`] | 🌟 | [`no-bitwise`][no-bitwise] | +| [`no-conditional-assignment`] | 🌟 | [`no-cond-assign`][no-cond-assign][1] | +| [`no-console`] | 🌟 | [`no-console`][no-console] (configuration works slightly differently) | +| [`no-construct`] | 🌟 | [`no-new-wrappers`][no-new-wrappers] | +| [`no-debugger`] | 🌟 | [`no-debugger`][no-debugger] | +| [`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`] | βœ… | [`@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`] | +| [`no-for-in-array`] | βœ… | [`@typescript-eslint/no-for-in-array`] | +| [`no-implicit-dependencies`] | πŸ”Œ | [`import/no-extraneous-dependencies`] | +| [`no-inferred-empty-object-type`] | πŸ›‘ | N/A | +| [`no-invalid-template-strings`] | 🌟 | [`no-template-curly-in-string`][no-template-curly-in-string] | +| [`no-invalid-this`] | 🌟 | [`no-invalid-this`][no-invalid-this] | +| [`no-misused-new`] | βœ… | [`@typescript-eslint/no-misused-new`] | +| [`no-null-keyword`] | πŸ”Œ | [`no-null/no-null`] (doesn’t handle `null` type) | +| [`no-null-undefined-union`] | πŸ›‘ | N/A | +| [`no-object-literal-type-assertion`] | βœ… | [`@typescript-eslint/consistent-type-assertions`] | +| [`no-promise-as-boolean`] | βœ… | [`@typescript-eslint/no-misused-promises`] | +| [`no-restricted-globals`] | βœ… | [`no-restricted-globals`][no-restricted-globals] | +| [`no-return-await`] | 🌟 | [`no-return-await`][no-return-await] | +| [`no-shadowed-variable`] | 🌟 | [`no-shadow`][no-shadow] | +| [`no-sparse-arrays`] | 🌟 | [`no-sparse-arrays`][no-sparse-arrays] | +| [`no-string-literal`] | 🌟 | [`dot-notation`][dot-notation] | +| [`no-string-throw`] | βœ… | [`@typescript-eslint/no-throw-literal`] | +| [`no-submodule-imports`] | πŸŒ“ | [`import/no-internal-modules`] (slightly different) | +| [`no-switch-case-fall-through`] | 🌟 | [`no-fallthrough`][no-fallthrough] | +| [`no-tautology-expression`] | πŸ›‘ | N/A | +| [`no-this-assignment`] | βœ… | [`@typescript-eslint/no-this-alias`] | +| [`no-unbound-method`] | βœ… | [`@typescript-eslint/unbound-method`] | +| [`no-unnecessary-class`] | βœ… | [`@typescript-eslint/no-extraneous-class`] | +| [`no-unsafe-any`] | πŸŒ“ | [`@typescript-eslint/no-unsafe-member-access`][2] | +| [`no-unsafe-finally`] | 🌟 | [`no-unsafe-finally`][no-unsafe-finally] | +| [`no-unused-expression`] | 🌟 | [`no-unused-expressions`][no-unused-expressions] | +| [`no-unused-variable`] | πŸŒ“ | [`@typescript-eslint/no-unused-vars`] | +| [`no-use-before-declare`] | βœ… | [`@typescript-eslint/no-use-before-define`] | +| [`no-var-keyword`] | 🌟 | [`no-var`][no-var] | +| [`no-void-expression`] | πŸ›‘ | N/A (unrelated to the similarly named ESLint rule `no-void`) | +| [`prefer-conditional-expression`] | πŸ›‘ | N/A | +| [`prefer-object-spread`] | 🌟 | [`prefer-object-spread`][prefer-object-spread] | +| [`radix`] | 🌟 | [`radix`][radix] | +| [`restrict-plus-operands`] | βœ… | [`@typescript-eslint/restrict-plus-operands`] | +| [`static-this`] | πŸ›‘ | N/A | +| [`strict-boolean-expressions`] | βœ… | [`@typescript-eslint/strict-boolean-expressions`] | +| [`strict-string-expressions`] | βœ… | [`@typescript-eslint/restrict-plus-operands`] & [`@typescript-eslint/restrict-template-expressions`] | +| [`strict-type-predicates`] | πŸ›‘ | N/A | +| [`switch-default`] | 🌟 | [`default-case`][default-case] | +| [`triple-equals`] | 🌟 | [`eqeqeq`][eqeqeq] | +| [`typeof-compare`] | 🌟 | [`valid-typeof`][valid-typeof] | +| [`unnecessary-constructor`] | 🌟 | [`no-useless-constructor`][no-useless-constructor] | +| [`use-default-type-parameter`] | βœ… | [`@typescript-eslint/no-unnecessary-type-arguments`] | +| [`use-isnan`] | 🌟 | [`use-isnan`][use-isnan] | [1] The ESLint rule also supports silencing with an extra set of parentheses (`if ((foo = bar)) {}`)
[2] Only checks member expressions From 33522b4399b0566d893e08677e8579bc173efb4d Mon Sep 17 00:00:00 2001 From: Susisu Date: Wed, 16 Sep 2020 01:41:05 +0900 Subject: [PATCH 2/9] docs(eslint-plugin): [no-redeclare] fix type/variable names of base options (#2568) --- packages/eslint-plugin/docs/rules/no-redeclare.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-redeclare.md b/packages/eslint-plugin/docs/rules/no-redeclare.md index d9e7042447d3..4b5164d6f0e0 100644 --- a/packages/eslint-plugin/docs/rules/no-redeclare.md +++ b/packages/eslint-plugin/docs/rules/no-redeclare.md @@ -21,12 +21,12 @@ See [`eslint/no-redeclare` options](https://eslint.org/docs/rules/no-redeclare#o This rule adds the following options: ```ts -interface Options extends BaseNoShadowOptions { +interface Options extends BaseNoRedeclareOptions { ignoreDeclarationMerge?: boolean; } const defaultOptions: Options = { - ...baseNoShadowDefaultOptions, + ...baseNoRedeclareDefaultOptions, ignoreDeclarationMerge: true, }; ``` From 4f660fd31acbb88b30719f925dcb2b3022cc2bab Mon Sep 17 00:00:00 2001 From: Randy Hudson Date: Wed, 16 Sep 2020 12:11:17 -0400 Subject: [PATCH 3/9] fix(scope-manager): correct analysis of inferred types in conditional types (#2537) Co-authored-by: Brad Zacher --- .../tests/rules/no-shadow.test.ts | 8 + .../src/referencer/TypeVisitor.ts | 5 +- .../type-declaration/conditional-nested.ts | 5 + .../conditional-nested.ts.shot | 170 ++++++++++++++++++ 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts create mode 100644 packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts.shot diff --git a/packages/eslint-plugin/tests/rules/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow.test.ts index bbaad211a25f..d7c81d834492 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow.test.ts @@ -11,6 +11,14 @@ const ruleTester = new RuleTester({ ruleTester.run('no-shadow TS tests', rule, { valid: [ + // nested conditional types + ` +export type ArrayInput = Func extends (arg0: Array) => any + ? T[] + : Func extends (...args: infer T) => any + ? T + : never; + `, ` function foo() { var Object = 0; diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 5e43f83bb326..75b5f614e32f 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -94,9 +94,12 @@ class TypeVisitor extends Visitor { // which are only accessible from inside the conditional parameter this.#referencer.scopeManager.nestConditionalTypeScope(node); - this.visitChildren(node); + // type parameters inferred in the condition clause are not accessible within the false branch + this.visitChildren(node, ['falseType']); this.#referencer.close(node); + + this.visit(node.falseType); } protected TSConstructorType(node: TSESTree.TSConstructorType): void { diff --git a/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts b/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts new file mode 100644 index 000000000000..ba4335437e61 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts @@ -0,0 +1,5 @@ +type Test = T extends Array + ? U + : T extends Set + ? U + : never; diff --git a/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts.shot b/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts.shot new file mode 100644 index 000000000000..21cdfcca5f3f --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-declaration/conditional-nested.ts.shot @@ -0,0 +1,170 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-declaration conditional-nested 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + TypeDefinition$1 { + name: Identifier<"Test">, + node: TSTypeAliasDeclaration$1, + }, + ], + name: "Test", + references: Array [], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$3 { + defs: Array [ + TypeDefinition$2 { + name: Identifier<"T">, + node: TSTypeParameter$2, + }, + ], + name: "T", + references: Array [ + Reference$1 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$3, + }, + Reference$4 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$3, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$4 { + defs: Array [ + TypeDefinition$3 { + name: Identifier<"U">, + node: TSTypeParameter$3, + }, + ], + name: "U", + references: Array [ + Reference$3 { + identifier: Identifier<"U">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$4, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$5 { + defs: Array [ + TypeDefinition$4 { + name: Identifier<"U">, + node: TSTypeParameter$4, + }, + ], + name: "U", + references: Array [ + Reference$6 { + identifier: Identifier<"U">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$5, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$5, + isStrict: false, + references: Array [], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "Test" => Variable$2, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + ], + }, + TypeScope$2 { + block: TSTypeAliasDeclaration$1, + isStrict: true, + references: Array [], + set: Map { + "T" => Variable$3, + }, + type: "type", + upper: GlobalScope$1, + variables: Array [ + Variable$3, + ], + }, + ConditionalTypeScope$3 { + block: TSConditionalType$6, + isStrict: true, + references: Array [ + Reference$1, + Reference$2 { + identifier: Identifier<"Array">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: null, + }, + Reference$3, + ], + set: Map { + "U" => Variable$4, + }, + type: "conditionalType", + upper: TypeScope$2, + variables: Array [ + Variable$4, + ], + }, + ConditionalTypeScope$4 { + block: TSConditionalType$7, + isStrict: true, + references: Array [ + Reference$4, + Reference$5 { + identifier: Identifier<"Set">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: null, + }, + Reference$6, + ], + set: Map { + "U" => Variable$5, + }, + type: "conditionalType", + upper: TypeScope$2, + variables: Array [ + Variable$5, + ], + }, + ], +} +`; From e26e43ffba96f6d46198b22f1c8dd5c814db2652 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Wed, 16 Sep 2020 09:30:21 -0700 Subject: [PATCH 4/9] docs: add FAQ about multiple versions (#2571) --- docs/getting-started/linting/FAQ.md | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/getting-started/linting/FAQ.md b/docs/getting-started/linting/FAQ.md index 71651b18319c..e7cb79a8270c 100644 --- a/docs/getting-started/linting/FAQ.md +++ b/docs/getting-started/linting/FAQ.md @@ -10,6 +10,7 @@ - [How can I ban ``?](#how-can-i-ban-specific-language-feature) - [Why don't I see TypeScript errors in my ESLint output?](#why-dont-i-see-typescript-errors-in-my-eslint-output) - [I get errors from the `no-undef` rule about global variables not being defined, even though there are no TypeScript errors](#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors) +- [How do I check to see what versions are installed?](#how-do-i-check-to-see-what-versions-are-installed) - [My linting feels really slow](#my-linting-feels-really-slow) --- @@ -188,6 +189,37 @@ The `no-undef` lint rule does not use TypeScript to determine the global variabl You can [manually define the set of allowed `globals` in your ESLint config](https://eslint.org/docs/user-guide/configuring#specifying-globals), and/or you can use one of the [pre-defined environment (`env`) configurations](https://eslint.org/docs/user-guide/configuring#specifying-environments). +As of our v4.0.0 release, this also applies to types. If you use global types from a 3rd party package (i.e. anything from an `@types` package), then you will have to configure ESLint appropriately to define these global types. For example; the `JSX` namespace from `@types/react` is a global 3rd party type that you must define in your ESLint config. + +We strongly recommend that you do not use the `no-undef` lint rule on TypeScript projects. The checks it provides are already provided by TypeScript without the need for configuration - TypeScript just does this significantly better. + +
+
+
+ +--- + +
+
+
+ +## How do I check to see what versions are installed? + +If you have multiple versions of our tooling, it can cause various bugs for you. This is because ESLint may load a different version each run depending on how you run it - leading to inconsistent lint results. + +Installing our tooling in the root of your project does not mean that only one version is installed. One or more of your dependencies may have its own dependency on our tooling, meaning `npm`/`yarn` will additionally install that version for use by that package. For example, `react-scripts` (part of `create-react-app`) has a dependency on our tooling. + +You can check what versions are installed in your project using the following commands: + +```bash +$ npm list @typescript-eslint/eslint-plugin @typescript-eslint/parser +$ yarn list @typescript-eslint/eslint-plugin @typescript-eslint/parser +``` + +If you see more than one version installed, then you will have to either use [yarn resolutions](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) to force a single version, or you will have to downgrade your root versions to match the dependency versions. + +**The best course of action in this case is to wait until your dependency releases a new version with support for our latest versions.** +


From 13292942d063c3ab307197b0dbe78cee3a0d9743 Mon Sep 17 00:00:00 2001 From: DanielPopOut Date: Thu, 17 Sep 2020 23:27:46 +0200 Subject: [PATCH 5/9] docs(eslint-plugin): [no-unsafe-member-access] update variable naming (#2575) --- .../eslint-plugin/docs/rules/no-unsafe-member-access.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md index 2c2d8831f45b..e64294f4e990 100644 --- a/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md +++ b/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md @@ -35,11 +35,11 @@ Examples of **correct** code for this rule: ```ts declare const properlyTyped: { prop: { a: string } }; -nestedAny.prop.a; -nestedAny.prop['a']; +properlyTyped.prop.a; +properlyTyped.prop['a']; const key = 'a'; -nestedAny.prop[key]; +properlyTyped.prop[key]; const arr = [1, 2, 3]; arr[1]; From 53a3cbc6f002e55135efbdf4982a3ad308ac708b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 21 Sep 2020 12:18:03 -0400 Subject: [PATCH 6/9] fix(eslint-plugin): [naming-convention] ignore properties inside object patterns (#2566) --- .../src/rules/naming-convention.ts | 2 +- .../tests/rules/naming-convention.test.ts | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index fb814e17e047..3acfa116b8f7 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -579,7 +579,7 @@ export default util.createRule({ // #region property - 'Property[computed = false][kind = "init"][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]'( + ':not(ObjectPattern) > Property[computed = false][kind = "init"][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]'( node: TSESTree.PropertyNonComputedName, ): void { const modifiers = new Set([Modifiers.public]); diff --git a/packages/eslint-plugin/tests/rules/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention.test.ts index 8c855b3a8a51..634ad4245595 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention.test.ts @@ -906,6 +906,20 @@ ruleTester.run('naming-convention', rule, { }, ], }, + { + code: ` + class SomeClass { + static OtherConstant = 'hello'; + } + + export const { OtherConstant: otherConstant } = SomeClass; + `, + parserOptions, + options: [ + { selector: 'property', format: ['PascalCase'] }, + { selector: 'variable', format: ['camelCase'] }, + ], + }, ], invalid: [ { @@ -1282,5 +1296,25 @@ ruleTester.run('naming-convention', rule, { ], errors: [{ messageId: 'doesNotMatchFormatTrimmed' }], }, + { + code: ` + class SomeClass { + static otherConstant = 'hello'; + } + + export const { otherConstant } = SomeClass; + `, + parserOptions, + options: [ + { selector: 'property', format: ['PascalCase'] }, + { selector: 'variable', format: ['camelCase'] }, + ], + errors: [ + { + line: 3, + messageId: 'doesNotMatchFormat', + }, + ], + }, ], }); From c6f72fbd3ccc19e39954cfe3d36d358ef43b7daa Mon Sep 17 00:00:00 2001 From: Yasar Siddiqui Date: Mon, 21 Sep 2020 22:13:32 +0530 Subject: [PATCH 7/9] fix(eslint-plugin): [prefer-ts-expect-error] support block comments (#2541) --- packages/eslint-plugin/README.md | 2 +- .../docs/rules/prefer-ts-expect-error.md | 24 +++++- .../src/rules/prefer-ts-expect-error.ts | 69 +++++++++++---- .../rules/prefer-ts-expect-error.test.ts | 83 +++++++++++++++++-- 4 files changed, 149 insertions(+), 29 deletions(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 63b5b6e7f321..8fac3dcde078 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -161,7 +161,7 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int | [`@typescript-eslint/prefer-reduce-type-parameter`](./docs/rules/prefer-reduce-type-parameter.md) | Prefer using type parameter when calling `Array#reduce` instead of casting | | :wrench: | :thought_balloon: | | [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Enforce that `RegExp#exec` is used instead of `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 | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-ts-expect-error`](./docs/rules/prefer-ts-expect-error.md) | Recommends using `// @ts-expect-error` over `// @ts-ignore` | | :wrench: | | +| [`@typescript-eslint/prefer-ts-expect-error`](./docs/rules/prefer-ts-expect-error.md) | Recommends using `@ts-expect-error` over `@ts-ignore` | | :wrench: | | | [`@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) | Requires `Array#sort` calls to always provide a `compareFunction` | | | :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 | :heavy_check_mark: | | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md index 7ec0cac771ba..60fdf79c8069 100644 --- a/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md +++ b/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md @@ -1,6 +1,6 @@ -# Recommends using `// @ts-expect-error` over `// @ts-ignore` (`prefer-ts-expect-error`) +# Recommends using `@ts-expect-error` over `@ts-ignore` (`prefer-ts-expect-error`) -TypeScript allows you to suppress all errors on a line by placing a single-line comment starting with `@ts-ignore` immediately before the erroring line. +TypeScript allows you to suppress all errors on a line by placing a single-line comment or a comment block line starting with `@ts-ignore` immediately before the erroring line. While powerful, there is no way to know if a `@ts-ignore` is actually suppressing an error without manually investigating what happens when the `@ts-ignore` is removed. This means its easy for `@ts-ignore`s to be forgotten about, and remain in code even after the error they were suppressing is fixed. @@ -20,6 +20,15 @@ Examples of **incorrect** code for this rule: // @ts-ignore const str: string = 1; +/** + * Explaining comment + * + * @ts-ignore */ +const multiLine: number = 'value'; + +/** @ts-ignore */ +const block: string = 1; + const isOptionEnabled = (key: string): boolean => { // @ts-ignore: if key isn't in globalOptions it'll be undefined which is false return !!globalOptions[key]; @@ -32,6 +41,15 @@ Examples of **correct** code for this rule: // @ts-expect-error const str: string = 1; +/** + * Explaining comment + * + * @ts-expect-error */ +const multiLine: number = 'value'; + +/** @ts-expect-error */ +const block: string = 1; + const isOptionEnabled = (key: string): boolean => { // @ts-expect-error: if key isn't in globalOptions it'll be undefined which is false return !!globalOptions[key]; @@ -40,7 +58,7 @@ const isOptionEnabled = (key: string): boolean => { ## When Not To Use It -If you are not using TypeScript 3.9 (or greater), then you will not be able to use this rule, as the directive is not supported +If you are **NOT** using TypeScript 3.9 (or greater), then you will not be able to use this rule, as the directive is not supported ## Further Reading diff --git a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts index 1b87b1327861..d696fc045735 100644 --- a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts +++ b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts @@ -1,5 +1,12 @@ -import { AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; +import { + AST_TOKEN_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import { + RuleFixer, + RuleFix, +} from '@typescript-eslint/experimental-utils/dist/ts-eslint'; type MessageIds = 'preferExpectErrorComment'; @@ -8,44 +15,70 @@ export default util.createRule<[], MessageIds>({ meta: { type: 'problem', docs: { - description: - 'Recommends using `// @ts-expect-error` over `// @ts-ignore`', + description: 'Recommends using `@ts-expect-error` over `@ts-ignore`', category: 'Best Practices', recommended: false, }, fixable: 'code', messages: { preferExpectErrorComment: - 'Use "// @ts-expect-error" to ensure an error is actually being suppressed.', + 'Use "@ts-expect-error" to ensure an error is actually being suppressed.', }, schema: [], }, defaultOptions: [], create(context) { - const tsIgnoreRegExp = /^\/*\s*@ts-ignore/; + const tsIgnoreRegExpSingleLine = /^\s*\/?\s*@ts-ignore/; + const tsIgnoreRegExpMultiLine = /^\s*(?:\/|\*)*\s*@ts-ignore/; const sourceCode = context.getSourceCode(); + function isLineComment(comment: TSESTree.Comment): boolean { + return comment.type === AST_TOKEN_TYPES.Line; + } + + function getLastCommentLine(comment: TSESTree.Comment): string { + if (isLineComment(comment)) { + return comment.value; + } + + // For multiline comments - we look at only the last line. + const commentlines = comment.value.split('\n'); + return commentlines[commentlines.length - 1]; + } + + function isValidTsIgnorePresent(comment: TSESTree.Comment): boolean { + const line = getLastCommentLine(comment); + return isLineComment(comment) + ? tsIgnoreRegExpSingleLine.test(line) + : tsIgnoreRegExpMultiLine.test(line); + } + return { Program(): void { const comments = sourceCode.getAllComments(); - comments.forEach(comment => { - if (comment.type !== AST_TOKEN_TYPES.Line) { - return; - } + if (isValidTsIgnorePresent(comment)) { + const lineCommentRuleFixer = (fixer: RuleFixer): RuleFix => + fixer.replaceText( + comment, + `//${comment.value.replace('@ts-ignore', '@ts-expect-error')}`, + ); + + const blockCommentRuleFixer = (fixer: RuleFixer): RuleFix => + fixer.replaceText( + comment, + `/*${comment.value.replace( + '@ts-ignore', + '@ts-expect-error', + )}*/`, + ); - if (tsIgnoreRegExp.test(comment.value)) { context.report({ node: comment, messageId: 'preferExpectErrorComment', - fix: fixer => - fixer.replaceText( - comment, - `//${comment.value.replace( - '@ts-ignore', - '@ts-expect-error', - )}`, - ), + fix: isLineComment(comment) + ? lineCommentRuleFixer + : blockCommentRuleFixer, }); } }); diff --git a/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts b/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts index 8e9c04f09ed6..ccc510187d97 100644 --- a/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts @@ -10,12 +10,12 @@ ruleTester.run('prefer-ts-expect-error', rule, { '// @ts-nocheck', '// @ts-check', '// just a comment containing @ts-ignore somewhere', - '/* @ts-ignore */', - '/** @ts-ignore */', ` -/* -// @ts-ignore in a block -*/ +{ + /* + just a comment containing @ts-ignore somewhere in a block + */ +} `, '// @ts-expect-error', ` @@ -24,6 +24,15 @@ if (false) { console.log('hello'); } `, + ` +/** + * Explaining comment + * + * @ts-expect-error + * + * Not last line + * */ + `, ], invalid: [ { @@ -50,8 +59,8 @@ if (false) { ], }, { - code: '/////@ts-ignore: Suppress next line', - output: '/////@ts-expect-error: Suppress next line', + code: '///@ts-ignore: Suppress next line', + output: '///@ts-expect-error: Suppress next line', errors: [ { messageId: 'preferExpectErrorComment', @@ -81,5 +90,65 @@ if (false) { }, ], }, + { + code: '/* @ts-ignore */', + output: '/* @ts-expect-error */', + errors: [ + { + messageId: 'preferExpectErrorComment', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +/** + * Explaining comment + * + * @ts-ignore */ + `, + output: ` +/** + * Explaining comment + * + * @ts-expect-error */ + `, + errors: [ + { + messageId: 'preferExpectErrorComment', + line: 2, + column: 1, + }, + ], + }, + { + code: '/* @ts-ignore in a single block */', + output: '/* @ts-expect-error in a single block */', + errors: [ + { + messageId: 'preferExpectErrorComment', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +/* +// @ts-ignore in a block with single line comments */ + `, + output: ` +/* +// @ts-expect-error in a block with single line comments */ + `, + errors: [ + { + messageId: 'preferExpectErrorComment', + line: 2, + column: 1, + }, + ], + }, ], }); From f7babcf4e6da3e5cba8f2c75d57abf8089432d05 Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Tue, 22 Sep 2020 01:49:08 +0900 Subject: [PATCH 8/9] feat(eslint-plugin): add extension rule `comma-dangle` (#2416) --- packages/eslint-plugin/README.md | 1 + .../eslint-plugin/docs/rules/comma-dangle.md | 34 +++ packages/eslint-plugin/src/configs/all.ts | 2 + .../eslint-plugin/src/rules/comma-dangle.ts | 179 ++++++++++++ packages/eslint-plugin/src/rules/index.ts | 2 + .../tests/rules/comma-dangle.test.ts | 255 ++++++++++++++++++ .../eslint-plugin/typings/eslint-rules.d.ts | 33 +++ 7 files changed, 506 insertions(+) create mode 100644 packages/eslint-plugin/docs/rules/comma-dangle.md create mode 100644 packages/eslint-plugin/src/rules/comma-dangle.ts create mode 100644 packages/eslint-plugin/tests/rules/comma-dangle.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 8fac3dcde078..37a27ca9511f 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -188,6 +188,7 @@ In these cases, we create what we call an extension rule; a rule within our plug | Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------ | -------- | ----------------- | | [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | +| [`@typescript-eslint/comma-dangle`](./docs/rules/comma-dangle.md) | Require or disallow trailing comma | | :wrench: | | | [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | | [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | | [`@typescript-eslint/dot-notation`](./docs/rules/dot-notation.md) | enforce dot notation whenever possible | | :wrench: | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/comma-dangle.md b/packages/eslint-plugin/docs/rules/comma-dangle.md new file mode 100644 index 000000000000..bfb40d338bcf --- /dev/null +++ b/packages/eslint-plugin/docs/rules/comma-dangle.md @@ -0,0 +1,34 @@ +# Require or disallow trailing comma (`comma-dangle`) + +## Rule Details + +This rule extends the base [`eslint/comma-dangle`](https://eslint.org/docs/rules/comma-dangle) rule. +It adds support for TypeScript syntax. + +See the [ESLint documentation](https://eslint.org/docs/rules/comma-dangle) for more details on the `comma-dangle` rule. + +## Rule Changes + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "comma-dangle": "off", + "@typescript-eslint/comma-dangle": ["error"] +} +``` + +In addition to the options supported by the `comma-dangle` rule in ESLint core, the rule adds the following options: + +## Options + +This rule has a string option and an object option. + +- Object option: + + - `"enums"` is for trailing comma in enum. (e.g. `enum Foo = {Bar,}`) + - `"generics"` is for trailing comma in generic. (e.g. `function foo() {}`) + - `"tuples"` is for trailing comma in tuple. (e.g. `type Foo = [string,]`) + +- [See the other options allowed](https://github.com/eslint/eslint/blob/master/docs/rules/comma-dangle.md#options) + +Taken with ❀️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/comma-dangle.md) diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 7e457d7aa1f5..84b4e93fc90c 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -139,5 +139,7 @@ export = { '@typescript-eslint/typedef': 'error', '@typescript-eslint/unbound-method': 'error', '@typescript-eslint/unified-signatures': 'error', + 'comma-dangle': 'off', + '@typescript-eslint/comma-dangle': 'error', }, }; diff --git a/packages/eslint-plugin/src/rules/comma-dangle.ts b/packages/eslint-plugin/src/rules/comma-dangle.ts new file mode 100644 index 000000000000..e0e06a6711d7 --- /dev/null +++ b/packages/eslint-plugin/src/rules/comma-dangle.ts @@ -0,0 +1,179 @@ +import * as util from '../util'; +import baseRule from 'eslint/lib/rules/comma-dangle'; +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; + +export type Options = util.InferOptionsTypeFromRule; +export type MessageIds = util.InferMessageIdsTypeFromRule; + +type Option = Options[0]; +type NormalizedOptions = Required< + Pick, 'enums' | 'generics' | 'tuples'> +>; + +const OPTION_VALUE_SCHEME = [ + 'always-multiline', + 'always', + 'never', + 'only-multiline', +]; + +const DEFAULT_OPTION_VALUE = 'never'; + +function normalizeOptions(options: Option): NormalizedOptions { + if (typeof options === 'string') { + return { + enums: options, + generics: options, + tuples: options, + }; + } + return { + enums: options.enums ?? DEFAULT_OPTION_VALUE, + generics: options.generics ?? DEFAULT_OPTION_VALUE, + tuples: options.tuples ?? DEFAULT_OPTION_VALUE, + }; +} + +export default util.createRule({ + name: 'comma-dangle', + meta: { + type: 'layout', + docs: { + description: 'Require or disallow trailing comma', + category: 'Stylistic Issues', + recommended: false, + extendsBaseRule: true, + }, + schema: { + definitions: { + value: { + enum: OPTION_VALUE_SCHEME, + }, + valueWithIgnore: { + enum: [...OPTION_VALUE_SCHEME, 'ignore'], + }, + }, + type: 'array', + items: [ + { + oneOf: [ + { + $ref: '#/definitions/value', + }, + { + type: 'object', + properties: { + arrays: { $ref: '#/definitions/valueWithIgnore' }, + objects: { $ref: '#/definitions/valueWithIgnore' }, + imports: { $ref: '#/definitions/valueWithIgnore' }, + exports: { $ref: '#/definitions/valueWithIgnore' }, + functions: { $ref: '#/definitions/valueWithIgnore' }, + enums: { $ref: '#/definitions/valueWithIgnore' }, + generics: { $ref: '#/definitions/valueWithIgnore' }, + tuples: { $ref: '#/definitions/valueWithIgnore' }, + }, + additionalProperties: false, + }, + ], + }, + ], + }, + fixable: 'code', + messages: baseRule.meta.messages, + }, + defaultOptions: ['never'], + create(context, [options]) { + const rules = baseRule.create(context); + const sourceCode = context.getSourceCode(); + const normalizedOptions = normalizeOptions(options); + + const predicate = { + always: forceComma, + 'always-multiline': forceCommaIfMultiline, + 'only-multiline': allowCommaIfMultiline, + never: forbidComma, + ignore: (): void => {}, + }; + + function last(nodes: TSESTree.Node[]): TSESTree.Node | null { + return nodes[nodes.length - 1] ?? null; + } + + function getLastItem(node: TSESTree.Node): TSESTree.Node | null { + switch (node.type) { + case AST_NODE_TYPES.TSEnumDeclaration: + return last(node.members); + case AST_NODE_TYPES.TSTypeParameterDeclaration: + return last(node.params); + case AST_NODE_TYPES.TSTupleType: + return last(node.elementTypes); + default: + return null; + } + } + + function getTrailingToken(node: TSESTree.Node): TSESTree.Token | null { + const last = getLastItem(node); + const trailing = last && sourceCode.getTokenAfter(last); + return trailing; + } + + function isMultiline(node: TSESTree.Node): boolean { + const last = getLastItem(node); + const lastToken = sourceCode.getLastToken(node); + return last?.loc.end.line !== lastToken?.loc.end.line; + } + + function forbidComma(node: TSESTree.Node): void { + const last = getLastItem(node); + const trailing = getTrailingToken(node); + if (last && trailing && util.isCommaToken(trailing)) { + context.report({ + node, + messageId: 'unexpected', + fix(fixer) { + return fixer.remove(trailing); + }, + }); + } + } + + function forceComma(node: TSESTree.Node): void { + const last = getLastItem(node); + const trailing = getTrailingToken(node); + if (last && trailing && !util.isCommaToken(trailing)) { + context.report({ + node, + messageId: 'missing', + fix(fixer) { + return fixer.insertTextAfter(last, ','); + }, + }); + } + } + + function allowCommaIfMultiline(node: TSESTree.Node): void { + if (!isMultiline(node)) { + forbidComma(node); + } + } + + function forceCommaIfMultiline(node: TSESTree.Node): void { + if (isMultiline(node)) { + forceComma(node); + } else { + forbidComma(node); + } + } + + return { + ...rules, + TSEnumDeclaration: predicate[normalizedOptions.enums], + TSTypeParameterDeclaration: predicate[normalizedOptions.generics], + TSTupleType: predicate[normalizedOptions.tuples], + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index fa8dba93ed1d..8b5049e25022 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -6,6 +6,7 @@ import banTslintComment from './ban-tslint-comment'; import banTypes from './ban-types'; import braceStyle from './brace-style'; import classLiteralPropertyStyle from './class-literal-property-style'; +import commaDangle from './comma-dangle'; import commaSpacing from './comma-spacing'; import confusingNonNullAssertionLikeNotEqual from './no-confusing-non-null-assertion'; import consistentTypeAssertions from './consistent-type-assertions'; @@ -114,6 +115,7 @@ export default { 'ban-types': banTypes, 'brace-style': braceStyle, 'class-literal-property-style': classLiteralPropertyStyle, + 'comma-dangle': commaDangle, 'comma-spacing': commaSpacing, 'consistent-type-assertions': consistentTypeAssertions, 'consistent-type-definitions': consistentTypeDefinitions, diff --git a/packages/eslint-plugin/tests/rules/comma-dangle.test.ts b/packages/eslint-plugin/tests/rules/comma-dangle.test.ts new file mode 100644 index 000000000000..1e94e9829711 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/comma-dangle.test.ts @@ -0,0 +1,255 @@ +/* eslint-disable eslint-comments/no-use */ +// this rule tests the new lines, which prettier will want to fix and break the tests +/* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ +/* eslint-enable eslint-comments/no-use */ +import rule from '../../src/rules/comma-dangle'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('comma-dangle', rule, { + valid: [ + // default + { code: 'enum Foo {}' }, + { code: 'enum Foo {\n}' }, + { code: 'enum Foo {Bar}' }, + { code: 'function Foo() {}' }, + { code: 'type Foo = []' }, + { code: 'type Foo = [\n]' }, + + // never + { code: 'enum Foo {Bar}', options: ['never'] }, + { code: 'enum Foo {Bar\n}', options: ['never'] }, + { code: 'enum Foo {Bar\n}', options: [{ enums: 'never' }] }, + { code: 'function Foo() {}', options: ['never'] }, + { code: 'function Foo() {}', options: ['never'] }, + { code: 'function Foo() {}', options: [{ generics: 'never' }] }, + { code: 'type Foo = [string]', options: ['never'] }, + { code: 'type Foo = [string]', options: [{ tuples: 'never' }] }, + + // always + { code: 'enum Foo {Bar,}', options: ['always'] }, + { code: 'enum Foo {Bar,\n}', options: ['always'] }, + { code: 'enum Foo {Bar,\n}', options: [{ enums: 'always' }] }, + { code: 'function Foo() {}', options: ['always'] }, + { code: 'function Foo() {}', options: ['always'] }, + { code: 'function Foo() {}', options: [{ generics: 'always' }] }, + { code: 'type Foo = [string,]', options: ['always'] }, + { code: 'type Foo = [string,\n]', options: [{ tuples: 'always' }] }, + + // always-multiline + { code: 'enum Foo {Bar}', options: ['always-multiline'] }, + { code: 'enum Foo {Bar,\n}', options: ['always-multiline'] }, + { code: 'enum Foo {Bar,\n}', options: [{ enums: 'always-multiline' }] }, + { code: 'function Foo() {}', options: ['always-multiline'] }, + { code: 'function Foo() {}', options: ['always-multiline'] }, + { + code: 'function Foo() {}', + options: [{ generics: 'always-multiline' }], + }, + { code: 'type Foo = [string]', options: ['always-multiline'] }, + { code: 'type Foo = [string,\n]', options: ['always-multiline'] }, + { + code: 'type Foo = [string,\n]', + options: [{ tuples: 'always-multiline' }], + }, + + // only-multiline + { code: 'enum Foo {Bar}', options: ['only-multiline'] }, + { code: 'enum Foo {Bar\n}', options: ['only-multiline'] }, + { code: 'enum Foo {Bar,\n}', options: ['only-multiline'] }, + { code: 'enum Foo {Bar,\n}', options: [{ enums: 'only-multiline' }] }, + { code: 'function Foo() {}', options: ['only-multiline'] }, + { code: 'function Foo() {}', options: ['only-multiline'] }, + { code: 'function Foo() {}', options: ['only-multiline'] }, + { + code: 'function Foo() {}', + options: [{ generics: 'only-multiline' }], + }, + { + code: 'function Foo() {}', + options: [{ generics: 'only-multiline' }], + }, + { code: 'type Foo = [string\n]', options: [{ tuples: 'only-multiline' }] }, + { code: 'type Foo = [string,\n]', options: [{ tuples: 'only-multiline' }] }, + + // each options + { + code: ` +const Obj = { a: 1 }; +enum Foo {Bar} +function Baz() {} +type Qux = [string, +] + `, + options: [ + { + enums: 'never', + generics: 'always', + tuples: 'always-multiline', + }, + ], + }, + ], + invalid: [ + // base rule + { + code: 'const Foo = {bar: 1,}', + output: 'const Foo = {bar: 1}', + errors: [{ messageId: 'unexpected' }], + }, + + // default + { + code: 'enum Foo {Bar,}', + output: 'enum Foo {Bar}', + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'type Foo = [string,]', + output: 'type Foo = [string]', + errors: [{ messageId: 'unexpected' }], + }, + + // never + { + code: 'enum Foo {Bar,}', + output: 'enum Foo {Bar}', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'enum Foo {Bar,\n}', + output: 'enum Foo {Bar\n}', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'type Foo = [string,]', + output: 'type Foo = [string]', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'type Foo = [string,\n]', + output: 'type Foo = [string\n]', + options: ['never'], + errors: [{ messageId: 'unexpected' }], + }, + + // always + { + code: 'enum Foo {Bar}', + output: 'enum Foo {Bar,}', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'enum Foo {Bar\n}', + output: 'enum Foo {Bar,\n}', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'type Foo = [string]', + output: 'type Foo = [string,]', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'type Foo = [string\n]', + output: 'type Foo = [string,\n]', + options: ['always'], + errors: [{ messageId: 'missing' }], + }, + + // always-multiline + { + code: 'enum Foo {Bar,}', + output: 'enum Foo {Bar}', + options: ['always-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'enum Foo {Bar\n}', + output: 'enum Foo {Bar,\n}', + options: ['always-multiline'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['always-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['always-multiline'], + errors: [{ messageId: 'missing' }], + }, + { + code: 'type Foo = [string,]', + output: 'type Foo = [string]', + options: ['always-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'type Foo = [string\n]', + output: 'type Foo = [string,\n]', + options: ['always-multiline'], + errors: [{ messageId: 'missing' }], + }, + + // only-multiline + { + code: 'enum Foo {Bar,}', + output: 'enum Foo {Bar}', + options: ['only-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'function Foo() {}', + output: 'function Foo() {}', + options: ['only-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + { + code: 'type Foo = [string,]', + output: 'type Foo = [string]', + options: ['only-multiline'], + errors: [{ messageId: 'unexpected' }], + }, + ], +}); diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 7cabdf8a3c97..39d49db7328e 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -729,3 +729,36 @@ declare module 'eslint/lib/rules/no-loss-of-precision' { >; export = rule; } + +declare module 'eslint/lib/rules/comma-dangle' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + type StringOptions = + | 'always-multiline' + | 'always' + | 'never' + | 'only-multiline'; + type Selectors = + | 'arrays' + | 'objects' + | 'imports' + | 'exports' + | 'functions' + | 'enums' + | 'generics' + | 'tuples'; + type ObjectOptions = Partial>; + + const rule: TSESLint.RuleModule< + 'unexpected' | 'missing', + [StringOptions | ObjectOptions], + { + TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void; + TSTypeParameterDeclaration( + node: TSESTree.TSTypeParameterDeclaration, + ): void; + TSTupleType(node: TSESTree.TSTupleType): void; + } + >; + export = rule; +} From 39c45f360993f9689a8460dfe4735fc4ef2331fa Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 21 Sep 2020 17:02:06 +0000 Subject: [PATCH 9/9] chore: publish v4.2.0 --- CHANGELOG.md | 18 ++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-internal/package.json | 4 ++-- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 18 ++++++++++++++++++ packages/eslint-plugin/package.json | 6 +++--- packages/experimental-utils/CHANGELOG.md | 8 ++++++++ packages/experimental-utils/package.json | 8 ++++---- packages/parser/CHANGELOG.md | 8 ++++++++ packages/parser/package.json | 12 ++++++------ packages/scope-manager/CHANGELOG.md | 11 +++++++++++ packages/scope-manager/package.json | 8 ++++---- packages/shared-fixtures/CHANGELOG.md | 8 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/types/CHANGELOG.md | 8 ++++++++ packages/types/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 8 ++++++++ packages/typescript-estree/package.json | 8 ++++---- packages/visitor-keys/CHANGELOG.md | 8 ++++++++ packages/visitor-keys/package.json | 4 ++-- 22 files changed, 142 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3766595afa8c..f0d9d32f580c 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. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + + +### Bug Fixes + +* **eslint-plugin:** [naming-convention] ignore properties inside object patterns ([#2566](https://github.com/typescript-eslint/typescript-eslint/issues/2566)) ([53a3cbc](https://github.com/typescript-eslint/typescript-eslint/commit/53a3cbc6f002e55135efbdf4982a3ad308ac708b)) +* **eslint-plugin:** [prefer-ts-expect-error] support block comments ([#2541](https://github.com/typescript-eslint/typescript-eslint/issues/2541)) ([c6f72fb](https://github.com/typescript-eslint/typescript-eslint/commit/c6f72fbd3ccc19e39954cfe3d36d358ef43b7daa)) +* **scope-manager:** correct analysis of inferred types in conditional types ([#2537](https://github.com/typescript-eslint/typescript-eslint/issues/2537)) ([4f660fd](https://github.com/typescript-eslint/typescript-eslint/commit/4f660fd31acbb88b30719f925dcb2b3022cc2bab)) + + +### Features + +* **eslint-plugin:** add extension rule `comma-dangle` ([#2416](https://github.com/typescript-eslint/typescript-eslint/issues/2416)) ([f7babcf](https://github.com/typescript-eslint/typescript-eslint/commit/f7babcf4e6da3e5cba8f2c75d57abf8089432d05)) + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) diff --git a/lerna.json b/lerna.json index e4dacbc39913..60d71ebb777a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "4.1.1", + "version": "4.2.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index d9e300285162..601b9c9ddbf4 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index bacc4e4ee690..51b8a4b28d68 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "4.1.1", + "version": "4.2.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,7 +14,7 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/experimental-utils": "4.1.1", + "@typescript-eslint/experimental-utils": "4.2.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index bb8c58dd35e6..8683c9ff8fdf 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **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 db79bccef266..a84d1bdc8acc 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "4.1.1", + "version": "4.2.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.1.1", + "@typescript-eslint/experimental-utils": "4.2.0", "lodash": "^4.17.15" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "4.1.1" + "@typescript-eslint/parser": "4.2.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index c837f4965ea2..808a0022292b 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. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + + +### Bug Fixes + +* **eslint-plugin:** [naming-convention] ignore properties inside object patterns ([#2566](https://github.com/typescript-eslint/typescript-eslint/issues/2566)) ([53a3cbc](https://github.com/typescript-eslint/typescript-eslint/commit/53a3cbc6f002e55135efbdf4982a3ad308ac708b)) +* **eslint-plugin:** [prefer-ts-expect-error] support block comments ([#2541](https://github.com/typescript-eslint/typescript-eslint/issues/2541)) ([c6f72fb](https://github.com/typescript-eslint/typescript-eslint/commit/c6f72fbd3ccc19e39954cfe3d36d358ef43b7daa)) +* **scope-manager:** correct analysis of inferred types in conditional types ([#2537](https://github.com/typescript-eslint/typescript-eslint/issues/2537)) ([4f660fd](https://github.com/typescript-eslint/typescript-eslint/commit/4f660fd31acbb88b30719f925dcb2b3022cc2bab)) + + +### Features + +* **eslint-plugin:** add extension rule `comma-dangle` ([#2416](https://github.com/typescript-eslint/typescript-eslint/issues/2416)) ([f7babcf](https://github.com/typescript-eslint/typescript-eslint/commit/f7babcf4e6da3e5cba8f2c75d57abf8089432d05)) + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 170351bff680..3522598037f5 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "4.1.1", + "version": "4.2.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -42,8 +42,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "4.1.1", - "@typescript-eslint/scope-manager": "4.1.1", + "@typescript-eslint/experimental-utils": "4.2.0", + "@typescript-eslint/scope-manager": "4.2.0", "debug": "^4.1.1", "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 7a004064b69f..e4160881daa8 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 26380f215895..f3fe1e5d9303 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "4.1.1", + "version": "4.2.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -40,9 +40,9 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.1.1", - "@typescript-eslint/types": "4.1.1", - "@typescript-eslint/typescript-estree": "4.1.1", + "@typescript-eslint/scope-manager": "4.2.0", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/typescript-estree": "4.2.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" }, diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 5eaec7bf0073..e6587af9a5f4 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 14af7bb7876a..96580b94b982 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "4.1.1", + "version": "4.2.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -44,15 +44,15 @@ "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "4.1.1", - "@typescript-eslint/types": "4.1.1", - "@typescript-eslint/typescript-estree": "4.1.1", + "@typescript-eslint/scope-manager": "4.2.0", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/typescript-estree": "4.2.0", "debug": "^4.1.1" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/experimental-utils": "4.1.1", - "@typescript-eslint/shared-fixtures": "4.1.1", + "@typescript-eslint/experimental-utils": "4.2.0", + "@typescript-eslint/shared-fixtures": "4.2.0", "glob": "*", "typescript": "*" }, diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 9d51f4928c7a..b69bb9b861b3 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + + +### Bug Fixes + +* **scope-manager:** correct analysis of inferred types in conditional types ([#2537](https://github.com/typescript-eslint/typescript-eslint/issues/2537)) ([4f660fd](https://github.com/typescript-eslint/typescript-eslint/commit/4f660fd31acbb88b30719f925dcb2b3022cc2bab)) + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 4888d82f0d95..58845e57d674 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "4.1.1", + "version": "4.2.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.1.1", - "@typescript-eslint/visitor-keys": "4.1.1" + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "4.1.1", + "@typescript-eslint/typescript-estree": "4.2.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 1c35480acf0d..c57a16297049 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **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 878a59b7be0c..e56173fca727 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "4.1.1", + "version": "4.2.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 2ff5f13b0997..0581c895a635 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) diff --git a/packages/types/package.json b/packages/types/package.json index 93802edaf379..2d52d18b7fb9 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "4.1.1", + "version": "4.2.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 0c273b67bfd6..bb7225c97238 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **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 68c6fa116b9e..98cffe748bc1 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "4.1.1", + "version": "4.2.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -41,8 +41,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.1.1", - "@typescript-eslint/visitor-keys": "4.1.1", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -61,7 +61,7 @@ "@types/lodash": "*", "@types/semver": "^7.1.0", "@types/tmp": "^0.2.0", - "@typescript-eslint/shared-fixtures": "4.1.1", + "@typescript-eslint/shared-fixtures": "4.2.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index e360a743ee35..30f1b67de929 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + ## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index d7fe215fa5e3..9dc95229ff5c 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "4.1.1", + "version": "4.2.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "4.1.1", + "@typescript-eslint/types": "4.2.0", "eslint-visitor-keys": "^2.0.0" }, "devDependencies": {