Skip to content

Commit

Permalink
fix(typescript-estree): account for namespace nesting in AST conversi…
Browse files Browse the repository at this point in the history
…on (#6272)

* fix(typescript-estree): account for nested namespace nesting in AST conversion

* Switched to TSQualifiedName
  • Loading branch information
JoshuaKGoldberg committed Feb 21, 2023
1 parent ff6b190 commit 09e3877
Show file tree
Hide file tree
Showing 36 changed files with 2,299 additions and 131 deletions.
@@ -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 },
},
}
`;
@@ -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 },
},
},
]
`;
@@ -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 },
},
}
`;
@@ -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 },
},
},
]
`;
@@ -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 },
},
}
`;
@@ -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 },
},
},
]
`;

0 comments on commit 09e3877

Please sign in to comment.