This repository was archived by the owner on Jan 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
Closed
Labels
Description
This issue was originally posted over at eslint/typescript-eslint-parser#586; but it was suggested that it be raised here as well. Please refer to the original issue for additional commentary/discussion.
Repro
{
"parser": "typescript-eslint-parser",
"plugins": ["typescript"],
"rules": {
"indent": "off",
"typescript/indent": ["error", "tab", {"VariableDeclarator": {"const": 3}}]
}
}
(in the code below, ^ represents a tab character)
interface Foo {
a: number;
b: number;
}
const foo: Foo = {
^ ^ ^ ^ a: 1,
^ ^ ^ ^ b: 2
^ ^ ^ },
^ ^ ^ bar = 1;
Expected Result
No errors
Actual Result
In [email protected]
, code passes with no errors.
With [email protected]
onwards, the errors below occur:
7:1 error Expected indentation of 1 tab but found 4 indent
8:1 error Expected indentation of 1 tab but found 4 indent
9:1 error Expected indentation of 0 tabs but found 3 indent
Additional Info
The code can be modified like below to pass, but clearly this is not what the config intends:
const foo: Foo = {
a: 1,
b: 2
},
bar = 1
Vanilla JS code without a type annotation passes as expected:
const foo = {
a: 1,
b: 2
},
bar = 1;
It also worth noting that the same issue occurs when using:
- spaces instead of tabs
- the main
indent
rule fromeslint
instead of thetypescript/indent
rule fromeslint-plugin-typescript
eslint-plugin-typescript | typescript-eslint-parser | indent | typescript/indent |
---|---|---|---|
0.14.0 | 20.0.0 | ✅ | N/A |
1.0.0-rc.0 | 20.0.0 | ✅ | ✅ |
0.14.0 | 20.1.0+ | ❌ | N/A |
1.0.0-rc.0 | 20.1.0+ | ❌ | ❌ |
Versions
package | version |
---|---|
eslint |
5.11.1 |
typescript |
3.1.1 |
eslint-plugin-typescript |
0.14.0+ |
typescript-eslint-parser |
20.1.0+ |