From 4dae6d065340eabc8bd01b71649ce0290755009e Mon Sep 17 00:00:00 2001 From: Tetsuharu Ohzeki Date: Sat, 18 Nov 2023 07:23:52 +0900 Subject: [PATCH 1/5] fix(eslint-plugin): [no-shadow] fix lint error in tests --- .../eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts index 277233d88d68..d368bbe61fd8 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts @@ -36,8 +36,8 @@ function foo void>(arg: T) {} export type ArrayInput = Func extends (arg0: Array) => any ? T[] : Func extends (...args: infer T) => any - ? T - : never; + ? T + : never; `, ` function foo() { From e35ef507d77d7eecad69eca58483b1090604b5b5 Mon Sep 17 00:00:00 2001 From: Tetsuharu Ohzeki Date: Sat, 30 Sep 2023 05:46:57 +0900 Subject: [PATCH 2/5] fix(eslint-plugin): [class-methods-use-this] Add the test case for getter/setter --- .../class-methods-use-this.test.ts | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) diff --git a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts index 5f2532b7b3df..cd807397633c 100644 --- a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts +++ b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts @@ -18,6 +18,22 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + get getter() {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: true }], + }, + { + code: ` +class Foo implements Bar { + set setter() {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: true }], + }, + { + code: ` class Foo { override method() {} } @@ -26,6 +42,22 @@ class Foo { }, { code: ` +class Foo { + override get getter(): number {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` +class Foo { + override set setter(v: number) {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` class Foo implements Bar { override method() {} } @@ -39,6 +71,32 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + override get getter(): number {} +} + `, + options: [ + { + ignoreClassesThatImplementAnInterface: true, + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` +class Foo implements Bar { + override set setter(v: number) {} +} + `, + options: [ + { + ignoreClassesThatImplementAnInterface: true, + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` class Foo implements Bar { property = () => {}; } @@ -96,6 +154,45 @@ class Foo { invalid: [ { code: ` +class Foo { + method() {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + get getter(): number {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + set setter(b: number) {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { method() {} } @@ -109,6 +206,32 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + get getter(): number {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + set setter(v: number) {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { override method() {} } @@ -122,6 +245,32 @@ class Foo { }, { code: ` +class Foo { + override get getter(): number {} +} + `, + options: [{ ignoreOverrideMethods: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + override set setter(v: number) {} +} + `, + options: [{ ignoreOverrideMethods: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { override method() {} } @@ -140,6 +289,42 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + override get getter(): number {} +} + `, + options: [ + { + ignoreClassesThatImplementAnInterface: false, + ignoreOverrideMethods: false, + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + override set setter(v: number) {} +} + `, + options: [ + { + ignoreClassesThatImplementAnInterface: false, + ignoreOverrideMethods: false, + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { property = () => {}; } From 4f07b48c3d19e04e5c39b2f937014af100f844a5 Mon Sep 17 00:00:00 2001 From: Tetsuharu Ohzeki Date: Sat, 30 Sep 2023 06:04:33 +0900 Subject: [PATCH 3/5] fix(eslint-plugin): [class-methods-use-this] Add the test case for class private field --- .../class-methods-use-this.test.ts | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts index cd807397633c..e6394fb9aa96 100644 --- a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts +++ b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts @@ -167,6 +167,19 @@ class Foo { }, { code: ` +class Foo { + #method() {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { get getter(): number {} } @@ -180,6 +193,19 @@ class Foo { }, { code: ` +class Foo { + get #getter(): number {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { set setter(b: number) {} } @@ -193,6 +219,19 @@ class Foo { }, { code: ` +class Foo { + set #setter(b: number) {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { method() {} } @@ -206,6 +245,19 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + #method() {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { get getter(): number {} } @@ -219,6 +271,19 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + get #getter(): number {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { set setter(v: number) {} } @@ -232,6 +297,19 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + set #setter(v: number) {} +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { override method() {} } @@ -338,6 +416,19 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + #property = () => {}; +} + `, + options: [{ ignoreClassesThatImplementAnInterface: false }], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { override property = () => {}; } From b7beb578d1ab771d977ded5893060ab2358310c2 Mon Sep 17 00:00:00 2001 From: Tetsuharu Ohzeki Date: Sat, 30 Sep 2023 13:08:18 +0900 Subject: [PATCH 4/5] fix(eslint-plugin): [class-methods-use-this] Allow to detect a problematic case for private/protected members if `ignoreClassesThatImplementAnInterface` is set --- .../docs/rules/class-methods-use-this.md | 40 +- .../src/rules/class-methods-use-this.ts | 32 +- .../class-methods-use-this.test.ts | 429 ++++++++++++++++++ .../class-methods-use-this.shot | 20 +- 4 files changed, 513 insertions(+), 8 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/class-methods-use-this.md b/packages/eslint-plugin/docs/rules/class-methods-use-this.md index d694edd254d4..098d4c692b14 100644 --- a/packages/eslint-plugin/docs/rules/class-methods-use-this.md +++ b/packages/eslint-plugin/docs/rules/class-methods-use-this.md @@ -16,7 +16,7 @@ This rule adds the following options: ```ts interface Options extends BaseClassMethodsUseThisOptions { ignoreOverrideMethods?: boolean; - ignoreClassesThatImplementAnInterface?: boolean; + ignoreClassesThatImplementAnInterface?: boolean | 'public-fields'; } const defaultOptions: Options = { @@ -41,10 +41,16 @@ class X { ### `ignoreClassesThatImplementAnInterface` -Makes the rule ignore all class members that are defined within a class that `implements` a type. +Makes the rule ignore class members that are defined within a class that `implements` a type. +If specified, it can be either: + +- `true`: Ignore all classes that implement an interface +- `'public-fields'`: Ignore only the public fields of classes that implement an interface It's important to note that this option does not only apply to members defined in the interface as that would require type information. +#### `true` + Example of a correct code when `ignoreClassesThatImplementAnInterface` is set to `true`: ```ts option='{ "ignoreClassesThatImplementAnInterface": true }' showPlaygroundButton @@ -53,3 +59,33 @@ class X implements Y { property = () => {}; } ``` + +#### `'public-fields'` + +Example of a incorrect code when `ignoreClassesThatImplementAnInterface` is set to `'public-fields'`: + + + +##### ❌ Incorrect + +```ts +class X implements Y { + method() {} + property = () => {}; + + private privateMethod() {} + private privateProperty = () => {}; + + protected privateMethod() {} + protected privateProperty = () => {}; +} +``` + +##### ✅ Correct + +```ts +class X implements Y { + method() {} + property = () => {}; +} +``` diff --git a/packages/eslint-plugin/src/rules/class-methods-use-this.ts b/packages/eslint-plugin/src/rules/class-methods-use-this.ts index d67f054e9189..6940f11a7ae8 100644 --- a/packages/eslint-plugin/src/rules/class-methods-use-this.ts +++ b/packages/eslint-plugin/src/rules/class-methods-use-this.ts @@ -14,7 +14,7 @@ type Options = [ exceptMethods?: string[]; enforceForClassFields?: boolean; ignoreOverrideMethods?: boolean; - ignoreClassesThatImplementAnInterface?: boolean; + ignoreClassesThatImplementAnInterface?: boolean | 'public-fields'; }, ]; type MessageIds = 'missingThis'; @@ -53,7 +53,18 @@ export default createRule({ description: 'Ingore members marked with the `override` modifier', }, ignoreClassesThatImplementAnInterface: { - type: 'boolean', + oneOf: [ + { + type: 'boolean', + description: 'Ignore all classes that implement an interface', + }, + { + type: 'string', + enum: ['public-fields'], + description: + 'Ignore only the public fields of classes that implement an interface', + }, + ], description: 'Ignore classes that specifically implement some interface', }, @@ -146,6 +157,16 @@ export default createRule({ return oldStack; } + function isPublicField( + accessibility: TSESTree.Accessibility | undefined, + ): boolean { + if (!accessibility || accessibility === 'public') { + return true; + } + + return false; + } + /** * Check if the node is an instance method not excluded by config */ @@ -189,8 +210,11 @@ export default createRule({ stackContext?.member == null || stackContext.usesThis || (ignoreOverrideMethods && stackContext.member.override) || - (ignoreClassesThatImplementAnInterface && - stackContext.class.implements.length) + (ignoreClassesThatImplementAnInterface === true && + stackContext.class.implements.length > 0) || + (ignoreClassesThatImplementAnInterface === 'public-fields' && + stackContext.class.implements.length > 0 && + isPublicField(stackContext.member.accessibility)) ) { return; } diff --git a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts index e6394fb9aa96..31303569beab 100644 --- a/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts +++ b/packages/eslint-plugin/tests/rules/class-methods-use-this/class-methods-use-this.test.ts @@ -42,6 +42,22 @@ class Foo { }, { code: ` +class Foo { + private override method() {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` +class Foo { + protected override method() {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` class Foo { override get getter(): number {} } @@ -50,6 +66,22 @@ class Foo { }, { code: ` +class Foo { + private override get getter(): number {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` +class Foo { + protected override get getter(): number {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` class Foo { override set setter(v: number) {} } @@ -58,6 +90,22 @@ class Foo { }, { code: ` +class Foo { + private override set setter(v: number) {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` +class Foo { + protected override set setter(v: number) {} +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` class Foo implements Bar { override method() {} } @@ -71,6 +119,38 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private override method() {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected override method() {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` class Foo implements Bar { override get getter(): number {} } @@ -84,6 +164,38 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private override get getter(): number {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected override get getter(): number {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` class Foo implements Bar { override set setter(v: number) {} } @@ -97,6 +209,38 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private override set setter(v: number) {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected override set setter(v: number) {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` class Foo implements Bar { property = () => {}; } @@ -113,6 +257,22 @@ class Foo { }, { code: ` +class Foo { + private override property = () => {}; +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` +class Foo { + protected override property = () => {}; +} + `, + options: [{ ignoreOverrideMethods: true }], + }, + { + code: ` class Foo implements Bar { override property = () => {}; } @@ -150,6 +310,38 @@ class Foo { }, ], }, + { + code: ` +class Foo implements Bar { + private override property = () => {}; +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should check only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected override property = () => {}; +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should check only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + // But overridden properties should be ignored. + ignoreOverrideMethods: true, + }, + ], + }, ], invalid: [ { @@ -167,6 +359,32 @@ class Foo { }, { code: ` +class Foo { + private method() {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + protected method() {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { #method() {} } @@ -193,6 +411,32 @@ class Foo { }, { code: ` +class Foo { + private get getter(): number {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + protected get getter(): number {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { get #getter(): number {} } @@ -208,6 +452,37 @@ class Foo { code: ` class Foo { set setter(b: number) {} +} + `, + options: [ + { + ignoreClassesThatImplementAnInterface: false, + ignoreOverrideMethods: false, + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + private set setter(b: number) {} +} + `, + options: [{}], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo { + protected set setter(b: number) {} } `, options: [{}], @@ -258,6 +533,44 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private method() {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected method() {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { get getter(): number {} } @@ -284,6 +597,44 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private get getter(): number {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected get getter(): number {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo implements Bar { set setter(v: number) {} } @@ -310,6 +661,46 @@ class Foo implements Bar { }, { code: ` +class Foo implements Bar { + private set setter(v: number) {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + ignoreOverrideMethods: false, + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected set setter(v: number) {} +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + ignoreOverrideMethods: false, + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` class Foo { override method() {} } @@ -458,5 +849,43 @@ class Foo implements Bar { }, ], }, + { + code: ` +class Foo implements Bar { + private property = () => {}; +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, + { + code: ` +class Foo implements Bar { + protected property = () => {}; +} + `, + options: [ + { + // _interface_ cannot have `private`/`protected` modifier on members. + // We should ignore only public members. + ignoreClassesThatImplementAnInterface: 'public-fields', + }, + ], + errors: [ + { + messageId: 'missingThis', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot b/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot index 14858cd2617e..97e773bac407 100644 --- a/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot +++ b/packages/eslint-plugin/tests/schema-snapshots/class-methods-use-this.shot @@ -22,7 +22,17 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos }, "ignoreClassesThatImplementAnInterface": { "description": "Ignore classes that specifically implement some interface", - "type": "boolean" + "oneOf": [ + { + "description": "Ignore all classes that implement an interface", + "type": "boolean" + }, + { + "description": "Ignore only the public fields of classes that implement an interface", + "enum": ["public-fields"], + "type": "string" + } + ] }, "ignoreOverrideMethods": { "description": "Ingore members marked with the \`override\` modifier", @@ -43,7 +53,13 @@ type Options = [ /** Allows specified method names to be ignored with this rule */ exceptMethods?: string[]; /** Ignore classes that specifically implement some interface */ - ignoreClassesThatImplementAnInterface?: boolean; + ignoreClassesThatImplementAnInterface?: /** + * Ignore classes that specifically implement some interface + * Ignore all classes that implement an interface + */ + | boolean + /** Ignore only the public fields of classes that implement an interface */ + | 'public-fields'; /** Ingore members marked with the \`override\` modifier */ ignoreOverrideMethods?: boolean; }, From be7c886caf2e0ab418fcc0acdd81bbb117e2fabf Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 17 Nov 2023 17:40:26 -0500 Subject: [PATCH 5/5] Revert no-shadow.test.ts changes --- .../eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts index d368bbe61fd8..277233d88d68 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts @@ -36,8 +36,8 @@ function foo void>(arg: T) {} export type ArrayInput = Func extends (arg0: Array) => any ? T[] : Func extends (...args: infer T) => any - ? T - : never; + ? T + : never; `, ` function foo() {