Skip to content

Commit

Permalink
fix(eslint-plugin): [indent] handle empty generic declarations (#1211)
Browse files Browse the repository at this point in the history

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
  • Loading branch information
a-tarasyuk and bradzacher committed Nov 15, 2019
1 parent 74192f8 commit 9aee06c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/eslint-plugin/src/rules/indent.ts
Expand Up @@ -444,6 +444,10 @@ export default util.createRule<Options, MessageIds>({
},

TSTypeParameterDeclaration(node: TSESTree.TSTypeParameterDeclaration) {
if (!node.params.length) {
return;
}

const [name, ...attributes] = node.params;

// JSX is about the closest we can get because the angle brackets
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-plugin/tests/rules/indent/indent.test.ts
Expand Up @@ -770,6 +770,11 @@ const div: JQuery<HTMLElement> = $('<div>')
},
// https://github.com/typescript-eslint/typescript-eslint/issues/441
`const;`,

// https://github.com/typescript-eslint/typescript-eslint/issues/1115
{
code: `const foo = function<> (): void {}`,
},
],
invalid: [
...individualNodeTests.invalid,
Expand Down

0 comments on commit 9aee06c

Please sign in to comment.