Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…) (#15172) * Add regression tests * Add passing tests * Add more passing tests * Add failing tests * Fix the issue
- Loading branch information
1 parent
a1f7ad7
commit d9d84a0
Showing
4 changed files
with
371 additions
and
2 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
125 changes: 125 additions & 0 deletions
125
tests/fixtures/parsers/keyword-spacing/prefix-cast-operator-no-space.js
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,125 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Parser: @typescript-eslint/parser@5.0.0 | ||
* | ||
* Source code: | ||
* <Thing>this.blah | ||
*/ | ||
|
||
exports.parse = () => ({ | ||
type: "Program", | ||
body: [ | ||
{ | ||
type: "ExpressionStatement", | ||
expression: { | ||
type: "TSTypeAssertion", | ||
typeAnnotation: { | ||
type: "TSTypeReference", | ||
typeName: { | ||
type: "Identifier", | ||
name: "Thing", | ||
range: [1, 6], | ||
loc: { | ||
start: { line: 1, column: 1 }, | ||
end: { line: 1, column: 6 }, | ||
}, | ||
}, | ||
range: [1, 6], | ||
loc: { | ||
start: { line: 1, column: 1 }, | ||
end: { line: 1, column: 6 }, | ||
}, | ||
}, | ||
expression: { | ||
type: "MemberExpression", | ||
object: { | ||
type: "ThisExpression", | ||
range: [7, 11], | ||
loc: { | ||
start: { line: 1, column: 7 }, | ||
end: { line: 1, column: 11 }, | ||
}, | ||
}, | ||
property: { | ||
type: "Identifier", | ||
name: "blah", | ||
range: [12, 16], | ||
loc: { | ||
start: { line: 1, column: 12 }, | ||
end: { line: 1, column: 16 }, | ||
}, | ||
}, | ||
computed: false, | ||
optional: false, | ||
range: [7, 16], | ||
loc: { | ||
start: { line: 1, column: 7 }, | ||
end: { line: 1, column: 16 }, | ||
}, | ||
}, | ||
range: [0, 16], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 16 }, | ||
}, | ||
}, | ||
range: [0, 16], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 16 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
range: [0, 16], | ||
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 16 } }, | ||
tokens: [ | ||
{ | ||
type: "Punctuator", | ||
value: "<", | ||
range: [0, 1], | ||
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }, | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "Thing", | ||
range: [1, 6], | ||
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 6 } }, | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ">", | ||
range: [6, 7], | ||
loc: { start: { line: 1, column: 6 }, end: { line: 1, column: 7 } }, | ||
}, | ||
{ | ||
type: "Keyword", | ||
value: "this", | ||
range: [7, 11], | ||
loc: { | ||
start: { line: 1, column: 7 }, | ||
end: { line: 1, column: 11 }, | ||
}, | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ".", | ||
range: [11, 12], | ||
loc: { | ||
start: { line: 1, column: 11 }, | ||
end: { line: 1, column: 12 }, | ||
}, | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "blah", | ||
range: [12, 16], | ||
loc: { | ||
start: { line: 1, column: 12 }, | ||
end: { line: 1, column: 16 }, | ||
}, | ||
}, | ||
], | ||
comments: [], | ||
}); |
125 changes: 125 additions & 0 deletions
125
tests/fixtures/parsers/keyword-spacing/prefix-cast-operator-space.js
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,125 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Parser: @typescript-eslint/parser@5.0.0 | ||
* | ||
* Source code: | ||
* <Thing> this.blah | ||
*/ | ||
|
||
exports.parse = () => ({ | ||
type: "Program", | ||
body: [ | ||
{ | ||
type: "ExpressionStatement", | ||
expression: { | ||
type: "TSTypeAssertion", | ||
typeAnnotation: { | ||
type: "TSTypeReference", | ||
typeName: { | ||
type: "Identifier", | ||
name: "Thing", | ||
range: [1, 6], | ||
loc: { | ||
start: { line: 1, column: 1 }, | ||
end: { line: 1, column: 6 }, | ||
}, | ||
}, | ||
range: [1, 6], | ||
loc: { | ||
start: { line: 1, column: 1 }, | ||
end: { line: 1, column: 6 }, | ||
}, | ||
}, | ||
expression: { | ||
type: "MemberExpression", | ||
object: { | ||
type: "ThisExpression", | ||
range: [8, 12], | ||
loc: { | ||
start: { line: 1, column: 8 }, | ||
end: { line: 1, column: 12 }, | ||
}, | ||
}, | ||
property: { | ||
type: "Identifier", | ||
name: "blah", | ||
range: [13, 17], | ||
loc: { | ||
start: { line: 1, column: 13 }, | ||
end: { line: 1, column: 17 }, | ||
}, | ||
}, | ||
computed: false, | ||
optional: false, | ||
range: [8, 17], | ||
loc: { | ||
start: { line: 1, column: 8 }, | ||
end: { line: 1, column: 17 }, | ||
}, | ||
}, | ||
range: [0, 17], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 17 }, | ||
}, | ||
}, | ||
range: [0, 17], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 17 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
range: [0, 17], | ||
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 17 } }, | ||
tokens: [ | ||
{ | ||
type: "Punctuator", | ||
value: "<", | ||
range: [0, 1], | ||
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }, | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "Thing", | ||
range: [1, 6], | ||
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 6 } }, | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ">", | ||
range: [6, 7], | ||
loc: { start: { line: 1, column: 6 }, end: { line: 1, column: 7 } }, | ||
}, | ||
{ | ||
type: "Keyword", | ||
value: "this", | ||
range: [8, 12], | ||
loc: { | ||
start: { line: 1, column: 8 }, | ||
end: { line: 1, column: 12 }, | ||
}, | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ".", | ||
range: [12, 13], | ||
loc: { | ||
start: { line: 1, column: 12 }, | ||
end: { line: 1, column: 13 }, | ||
}, | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "blah", | ||
range: [13, 17], | ||
loc: { | ||
start: { line: 1, column: 13 }, | ||
end: { line: 1, column: 17 }, | ||
}, | ||
}, | ||
], | ||
comments: [], | ||
}); |
Oops, something went wrong.