Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 52fa7c5

Browse files
authored
[FIX] [indent] add handling for TSTypeReference (#273)
1 parent 867df2e commit 52fa7c5

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

lib/rules/indent.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const KNOWN_NODES = new Set([
3030
"TSModuleDeclaration",
3131
"TSParameterProperty",
3232
"TSPropertySignature",
33+
"TSTypeAnnotation",
3334
"TSTypeLiteral",
35+
"TSTypeReference",
3436
]);
3537

3638
const defaultOptions = [

tests/lib/rules/indent.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ const firebaseApp = firebase.apps.length
7272
messagingSenderId: __FIREBASE_MESSAGING_SENDER_ID__,
7373
})
7474
`,
75+
// https://github.com/bradzacher/eslint-plugin-typescript/issues/271
76+
{
77+
code: `
78+
const foo = {
79+
a: 1,
80+
b: 2
81+
},
82+
bar = 1;
83+
`,
84+
options: [4, { VariableDeclarator: { const: 3 } }],
85+
},
86+
{
87+
code: `
88+
const foo : Foo = {
89+
a: 1,
90+
b: 2
91+
},
92+
bar = 1;
93+
`,
94+
options: [4, { VariableDeclarator: { const: 3 } }],
95+
},
7596
],
7697
invalid: [
7798
{

0 commit comments

Comments
 (0)