Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript-estree): account for namespace nesting in AST conversi…
…on (#6272) * fix(typescript-estree): account for nested namespace nesting in AST conversion * Switched to TSQualifiedName
- Loading branch information
1 parent
ff6b190
commit 09e3877
Showing
36 changed files
with
2,299 additions
and
131 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-Babel-AST.shot
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,58 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - AST 1`] = ` | ||
Program { | ||
type: "Program", | ||
body: Array [ | ||
ExportNamedDeclaration { | ||
type: "ExportNamedDeclaration", | ||
assertions: Array [], | ||
declaration: TSModuleDeclaration { | ||
type: "TSModuleDeclaration", | ||
body: TSModuleBlock { | ||
type: "TSModuleBlock", | ||
body: Array [], | ||
range: [21, 23], | ||
loc: { | ||
start: { column: 21, line: 1 }, | ||
end: { column: 23, line: 1 }, | ||
}, | ||
}, | ||
id: Identifier { | ||
type: "Identifier", | ||
name: "Foo", | ||
range: [17, 20], | ||
loc: { | ||
start: { column: 17, line: 1 }, | ||
end: { column: 20, line: 1 }, | ||
}, | ||
}, | ||
range: [7, 23], | ||
loc: { | ||
start: { column: 7, line: 1 }, | ||
end: { column: 23, line: 1 }, | ||
}, | ||
}, | ||
exportKind: "value", | ||
source: null, | ||
specifiers: Array [], | ||
range: [0, 23], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 23, line: 1 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "module", | ||
range: [0, 24], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 0, line: 2 }, | ||
}, | ||
} | ||
`; |
56 changes: 56 additions & 0 deletions
56
...c/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-Babel-Tokens.shot
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,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - Tokens 1`] = ` | ||
Array [ | ||
Keyword { | ||
type: "Keyword", | ||
value: "export", | ||
range: [0, 6], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 6, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "namespace", | ||
range: [7, 16], | ||
loc: { | ||
start: { column: 7, line: 1 }, | ||
end: { column: 16, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "Foo", | ||
range: [17, 20], | ||
loc: { | ||
start: { column: 17, line: 1 }, | ||
end: { column: 20, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "{", | ||
range: [21, 22], | ||
loc: { | ||
start: { column: 21, line: 1 }, | ||
end: { column: 22, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "}", | ||
range: [22, 23], | ||
loc: { | ||
start: { column: 22, line: 1 }, | ||
end: { column: 23, line: 1 }, | ||
}, | ||
}, | ||
] | ||
`; |
46 changes: 46 additions & 0 deletions
46
...src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-Babel-AST.shot
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,46 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare Babel - AST 1`] = ` | ||
Program { | ||
type: "Program", | ||
body: Array [ | ||
TSModuleDeclaration { | ||
type: "TSModuleDeclaration", | ||
body: TSModuleBlock { | ||
type: "TSModuleBlock", | ||
body: Array [], | ||
range: [20, 22], | ||
loc: { | ||
start: { column: 20, line: 1 }, | ||
end: { column: 22, line: 1 }, | ||
}, | ||
}, | ||
declare: true, | ||
id: Identifier { | ||
type: "Identifier", | ||
name: "F", | ||
range: [18, 19], | ||
loc: { | ||
start: { column: 18, line: 1 }, | ||
end: { column: 19, line: 1 }, | ||
}, | ||
}, | ||
range: [0, 22], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 22, line: 1 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
range: [0, 23], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 0, line: 2 }, | ||
}, | ||
} | ||
`; |
56 changes: 56 additions & 0 deletions
56
.../declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-Babel-Tokens.shot
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,56 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare Babel - Tokens 1`] = ` | ||
Array [ | ||
Identifier { | ||
type: "Identifier", | ||
value: "declare", | ||
range: [0, 7], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 7, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "namespace", | ||
range: [8, 17], | ||
loc: { | ||
start: { column: 8, line: 1 }, | ||
end: { column: 17, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "F", | ||
range: [18, 19], | ||
loc: { | ||
start: { column: 18, line: 1 }, | ||
end: { column: 19, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "{", | ||
range: [20, 21], | ||
loc: { | ||
start: { column: 20, line: 1 }, | ||
end: { column: 21, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "}", | ||
range: [21, 22], | ||
loc: { | ||
start: { column: 21, line: 1 }, | ||
end: { column: 22, line: 1 }, | ||
}, | ||
}, | ||
] | ||
`; |
45 changes: 45 additions & 0 deletions
45
...claration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-Babel-AST.shot
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,45 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier Babel - AST 1`] = ` | ||
Program { | ||
type: "Program", | ||
body: Array [ | ||
TSModuleDeclaration { | ||
type: "TSModuleDeclaration", | ||
body: TSModuleBlock { | ||
type: "TSModuleBlock", | ||
body: Array [], | ||
range: [12, 14], | ||
loc: { | ||
start: { column: 12, line: 1 }, | ||
end: { column: 14, line: 1 }, | ||
}, | ||
}, | ||
id: Identifier { | ||
type: "Identifier", | ||
name: "F", | ||
range: [10, 11], | ||
loc: { | ||
start: { column: 10, line: 1 }, | ||
end: { column: 11, line: 1 }, | ||
}, | ||
}, | ||
range: [0, 14], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 14, line: 1 }, | ||
}, | ||
}, | ||
], | ||
sourceType: "script", | ||
range: [0, 15], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 0, line: 2 }, | ||
}, | ||
} | ||
`; |
46 changes: 46 additions & 0 deletions
46
...ration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-Babel-Tokens.shot
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,46 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier Babel - Tokens 1`] = ` | ||
Array [ | ||
Identifier { | ||
type: "Identifier", | ||
value: "namespace", | ||
range: [0, 9], | ||
loc: { | ||
start: { column: 0, line: 1 }, | ||
end: { column: 9, line: 1 }, | ||
}, | ||
}, | ||
Identifier { | ||
type: "Identifier", | ||
value: "F", | ||
range: [10, 11], | ||
loc: { | ||
start: { column: 10, line: 1 }, | ||
end: { column: 11, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "{", | ||
range: [12, 13], | ||
loc: { | ||
start: { column: 12, line: 1 }, | ||
end: { column: 13, line: 1 }, | ||
}, | ||
}, | ||
Punctuator { | ||
type: "Punctuator", | ||
value: "}", | ||
range: [13, 14], | ||
loc: { | ||
start: { column: 13, line: 1 }, | ||
end: { column: 14, line: 1 }, | ||
}, | ||
}, | ||
] | ||
`; |
Oops, something went wrong.