Skip to content

Commit

Permalink
fix(eslint-plugin): indent: fix false positive on type parameters (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottohara authored and bradzacher committed Apr 7, 2019
1 parent 4b3d820 commit d476f15
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/rules/indent.ts
Expand Up @@ -74,6 +74,7 @@ const KNOWN_NODES = new Set([
AST_NODE_TYPES.TSTypeOperator,
AST_NODE_TYPES.TSTypeParameter,
AST_NODE_TYPES.TSTypeParameterDeclaration,
AST_NODE_TYPES.TSTypeParameterInstantiation,
AST_NODE_TYPES.TSTypeReference,
AST_NODE_TYPES.TSUnionType,
]);
Expand Down
24 changes: 24 additions & 0 deletions packages/eslint-plugin/tests/rules/indent.test.ts
Expand Up @@ -742,6 +742,30 @@ const foo : Foo = {
`,
options: [4, { VariableDeclarator: { const: 3 } }],
},
{
code: `
const name: string = ' Typescript '
.toUpperCase()
.trim(),
greeting: string = (" Hello " + name)
.toUpperCase()
.trim();
`,
options: [2, { VariableDeclarator: { const: 3 } }],
},
{
code: `
const div: JQuery<HTMLElement> = $('<div>')
.addClass('some-class')
.appendTo($('body')),
button: JQuery<HTMLElement> = $('<button>')
.text('Cancel')
.appendTo(div);
`,
options: [2, { VariableDeclarator: { const: 3 } }],
},
],
invalid: [
...individualNodeTests.invalid,
Expand Down

0 comments on commit d476f15

Please sign in to comment.