Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typescript-estree): account for namespace nesting in AST conversion #6272

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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 },
},
},
]
`;