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

feat: add .kind to TSModuleDeclaration #6443

Merged
merged 6 commits into from Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Expand Up @@ -29,6 +29,7 @@ Program {
end: { column: 20, line: 1 },
},
},
kind: "namespace",

range: [7, 23],
loc: {
Expand Down
Expand Up @@ -2,5 +2,62 @@

exports[`AST Fixtures declaration ExportNamedDeclaration namespace AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

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 },
},
},
- kind: 'namespace',

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 },
},
}"
`;
Expand Up @@ -28,6 +28,7 @@ Program {
end: { column: 14, line: 1 },
},
},
kind: "global",

range: [0, 17],
loc: {
Expand Down
Expand Up @@ -2,5 +2,51 @@

exports[`AST Fixtures declaration TSModuleDeclaration global AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

Program {
type: 'Program',
body: Array [
TSModuleDeclaration {
type: 'TSModuleDeclaration',
body: TSModuleBlock {
type: 'TSModuleBlock',
body: Array [],

range: [15, 17],
loc: {
start: { column: 15, line: 1 },
end: { column: 17, line: 1 },
},
},
declare: true,
global: true,
id: Identifier {
type: 'Identifier',
name: 'global',

range: [8, 14],
loc: {
start: { column: 8, line: 1 },
end: { column: 14, line: 1 },
},
},
- kind: 'global',

range: [0, 17],
loc: {
start: { column: 0, line: 1 },
end: { column: 17, line: 1 },
},
},
],
sourceType: 'script',

range: [0, 18],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
},
}"
`;
Expand Up @@ -18,6 +18,7 @@ Program {
end: { column: 18, line: 1 },
},
},
kind: "module",

range: [0, 19],
loc: {
Expand Down
Expand Up @@ -2,5 +2,41 @@

exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

Program {
type: 'Program',
body: Array [
TSModuleDeclaration {
type: 'TSModuleDeclaration',
declare: true,
id: Literal {
type: 'Literal',
raw: '\\\\'a\\\\'',
value: 'a',

range: [15, 18],
loc: {
start: { column: 15, line: 1 },
end: { column: 18, line: 1 },
},
},
- kind: 'module',

range: [0, 19],
loc: {
start: { column: 0, line: 1 },
end: { column: 19, line: 1 },
},
},
],
sourceType: 'script',

range: [0, 20],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
},
}"
`;
Expand Up @@ -27,6 +27,7 @@ Program {
end: { column: 16, line: 1 },
},
},
kind: "module",

range: [0, 19],
loc: {
Expand Down
Expand Up @@ -2,5 +2,50 @@

exports[`AST Fixtures declaration TSModuleDeclaration module-declare AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

Program {
type: 'Program',
body: Array [
TSModuleDeclaration {
type: 'TSModuleDeclaration',
body: TSModuleBlock {
type: 'TSModuleBlock',
body: Array [],

range: [17, 19],
loc: {
start: { column: 17, line: 1 },
end: { column: 19, line: 1 },
},
},
declare: true,
id: Identifier {
type: 'Identifier',
name: 'F',

range: [15, 16],
loc: {
start: { column: 15, line: 1 },
end: { column: 16, line: 1 },
},
},
- kind: 'module',

range: [0, 19],
loc: {
start: { column: 0, line: 1 },
end: { column: 19, line: 1 },
},
},
],
sourceType: 'script',

range: [0, 20],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
},
}"
`;
Expand Up @@ -26,6 +26,7 @@ Program {
end: { column: 8, line: 1 },
},
},
kind: "module",

range: [0, 11],
loc: {
Expand Down
Expand Up @@ -2,5 +2,49 @@

exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

Program {
type: 'Program',
body: Array [
TSModuleDeclaration {
type: 'TSModuleDeclaration',
body: TSModuleBlock {
type: 'TSModuleBlock',
body: Array [],

range: [9, 11],
loc: {
start: { column: 9, line: 1 },
end: { column: 11, line: 1 },
},
},
id: Identifier {
type: 'Identifier',
name: 'F',

range: [7, 8],
loc: {
start: { column: 7, line: 1 },
end: { column: 8, line: 1 },
},
},
- kind: 'module',

range: [0, 11],
loc: {
start: { column: 0, line: 1 },
end: { column: 11, line: 1 },
},
},
],
sourceType: 'script',

range: [0, 12],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
},
}"
`;
Expand Up @@ -27,6 +27,7 @@ Program {
end: { column: 10, line: 1 },
},
},
kind: "module",

range: [0, 13],
loc: {
Expand Down
Expand Up @@ -2,5 +2,50 @@

exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
- TSESTree
+ Babel

Program {
type: 'Program',
body: Array [
TSModuleDeclaration {
type: 'TSModuleDeclaration',
body: TSModuleBlock {
type: 'TSModuleBlock',
body: Array [],

range: [11, 13],
loc: {
start: { column: 11, line: 1 },
end: { column: 13, line: 1 },
},
},
id: Literal {
type: 'Literal',
raw: '\\\\'a\\\\'',
value: 'a',

range: [7, 10],
loc: {
start: { column: 7, line: 1 },
end: { column: 10, line: 1 },
},
},
- kind: 'module',

range: [0, 13],
loc: {
start: { column: 0, line: 1 },
end: { column: 13, line: 1 },
},
},
],
sourceType: 'script',

range: [0, 14],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
},
}"
`;
Expand Up @@ -30,6 +30,7 @@ Program {
end: { column: 12, line: 1 },
},
},
kind: "module",

range: [11, 15],
loc: {
Expand All @@ -47,6 +48,7 @@ Program {
end: { column: 10, line: 1 },
},
},
kind: "module",

range: [9, 15],
loc: {
Expand All @@ -64,6 +66,7 @@ Program {
end: { column: 8, line: 1 },
},
},
kind: "module",

range: [0, 15],
loc: {
Expand Down