Skip to content

Commit 9aee06c

Browse files
fix(eslint-plugin): [indent] handle empty generic declarations (typescript-eslint#1211)
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
1 parent 74192f8 commit 9aee06c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/eslint-plugin/src/rules/indent.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ export default util.createRule<Options, MessageIds>({
444444
},
445445

446446
TSTypeParameterDeclaration(node: TSESTree.TSTypeParameterDeclaration) {
447+
if (!node.params.length) {
448+
return;
449+
}
450+
447451
const [name, ...attributes] = node.params;
448452

449453
// JSX is about the closest we can get because the angle brackets

packages/eslint-plugin/tests/rules/indent/indent.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,11 @@ const div: JQuery<HTMLElement> = $('<div>')
770770
},
771771
// https://github.com/typescript-eslint/typescript-eslint/issues/441
772772
`const;`,
773+
774+
// https://github.com/typescript-eslint/typescript-eslint/issues/1115
775+
{
776+
code: `const foo = function<> (): void {}`,
777+
},
773778
],
774779
invalid: [
775780
...individualNodeTests.invalid,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy