From d476f15a9d3e2642419a8facc6231b952de9a934 Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Sun, 7 Apr 2019 19:35:37 +1000 Subject: [PATCH] fix(eslint-plugin): indent: fix false positive on type parameters (#385) --- packages/eslint-plugin/src/rules/indent.ts | 1 + .../eslint-plugin/tests/rules/indent.test.ts | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index a3c6f5971d5..85187a7046b 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -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, ]); diff --git a/packages/eslint-plugin/tests/rules/indent.test.ts b/packages/eslint-plugin/tests/rules/indent.test.ts index d845a871172..7fb18428d9f 100644 --- a/packages/eslint-plugin/tests/rules/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent.test.ts @@ -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 = $('
') + .addClass('some-class') + .appendTo($('body')), + + button: JQuery = $('