From 11e49b95065789ecfcbc1b8d18f94d204d5928c6 Mon Sep 17 00:00:00 2001 From: Scott O'Hara Date: Thu, 28 Mar 2019 08:25:04 +1100 Subject: [PATCH] fix(eslint-plugin): indent: fix false positive on type parameters --- 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 1595ae54deb..b67b3fcbb98 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -76,6 +76,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 = $('