forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support config option to enforce delimiter even in one liners (palant…
- Loading branch information
1 parent
9280754
commit f77812c
Showing
7 changed files
with
120 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
test/rules/type-literal-delimiter/one-liners-with-no-trailings/test.ts.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { x: number; y: string }; | ||
|
||
// Works even when there's extra whitespace | ||
type T = { x: number ; y: number }; | ||
type T = { x: number ; y: number }; | ||
|
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
test/rules/type-literal-delimiter/one-liners-with-trailings/test.ts.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { x: number; y: string; }; | ||
|
||
// Works even when there's extra whitespace | ||
type T = { x: number ; y: number; }; | ||
type T = { x: number ; y: number ; }; | ||
|
31 changes: 31 additions & 0 deletions
31
test/rules/type-literal-delimiter/one-liners-with-trailings/test.ts.lint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
type T = { | ||
x: number, | ||
~ [COMMA] | ||
y: string | ||
~ [MISSING] | ||
}; | ||
|
||
type T = { | ||
x: number | ||
~ [MISSING] | ||
y: string, | ||
~ [COMMA] | ||
}; | ||
|
||
type T = { | ||
x: number; | ||
y: string; | ||
}; | ||
|
||
type T = { x: number; y: string }; | ||
~ [MISSING] | ||
|
||
// Works even when there's extra whitespace | ||
type T = { x: number ; y: number }; | ||
~ [MISSING] | ||
type T = { x: number , y: number ; }; | ||
~ [COMMA] | ||
|
||
[MISSING]: Expected type literal to use ';' to separate members. | ||
[COMMA]: Expected type literal to use ';' instead of ','. | ||
[EXTRA]: Did not expect single-line type literal to have a trailing ';'. |
10 changes: 10 additions & 0 deletions
10
test/rules/type-literal-delimiter/one-liners-with-trailings/tslint.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"rules": { | ||
"type-literal-delimiter": [ | ||
true, | ||
{ | ||
"singleLine": "always" | ||
} | ||
] | ||
} | ||
} |