From a000e000dcde3163c4b6fac2c09ebc31bc91da71 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Jun 2023 15:28:15 +1000 Subject: [PATCH] Added component-dashed fixture --- .../fixtures/component-dashed/fixture.tsx | 7 + .../snapshots/1-TSESTree-AST.shot | 211 +++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 236 +++++++++++++++++ .../snapshots/3-Babel-AST.shot | 210 +++++++++++++++ .../snapshots/4-Babel-Tokens.shot | 236 +++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 215 +++++++++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 246 ++++++++++++++++++ .../tests/fixtures-with-differences-ast.shot | 1 + .../fixtures-with-differences-tokens.shot | 1 + 9 files changed, 1363 insertions(+) create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx new file mode 100644 index 00000000000..9ee258b4ae8 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx @@ -0,0 +1,7 @@ +namespace JSX { + export interface IntrinsicElements { + 'foo-bar:baz-bam': any; + } +} + +const x = ; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..1b6ec08d157 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: [], + declaration: TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: "'foo-bar:baz-bam'", + value: "foo-bar:baz-bam", + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [76, 81], + loc: { + start: { column: 21, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [59, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [53, 86], + loc: { + start: { column: 37, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "IntrinsicElements", + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + + range: [25, 86], + loc: { + start: { column: 9, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + exportKind: "type", + source: null, + specifiers: [], + + range: [18, 86], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + ], + + range: [14, 88], + loc: { + start: { column: 14, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "JSX", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + kind: "namespace", + + range: [0, 88], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "baz-bam", + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + + range: [101, 116], + loc: { + start: { column: 11, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + selfClosing: true, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [96, 119], + loc: { + start: { column: 6, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + ], + kind: "const", + + range: [90, 120], + loc: { + start: { column: 0, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, + ], + sourceType: "script", + + range: [0, 121], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 8 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7913346eb9f --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,236 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "JSX", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "export", + + range: [18, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [25, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "IntrinsicElements", + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [53, 54], + loc: { + start: { column: 37, line: 2 }, + end: { column: 38, line: 2 }, + }, + }, + String { + type: "String", + value: "'foo-bar:baz-bam'", + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [76, 77], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [81, 82], + loc: { + start: { column: 26, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [85, 86], + loc: { + start: { column: 2, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [87, 88], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [90, 95], + loc: { + start: { column: 0, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [98, 99], + loc: { + start: { column: 8, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [100, 101], + loc: { + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo-bar", + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [108, 109], + loc: { + start: { column: 18, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz-bam", + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [117, 118], + loc: { + start: { column: 27, line: 7 }, + end: { column: 28, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [118, 119], + loc: { + start: { column: 28, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [119, 120], + loc: { + start: { column: 29, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..6871265b0e8 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot @@ -0,0 +1,210 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: [], + declaration: TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: "'foo-bar:baz-bam'", + value: "foo-bar:baz-bam", + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [76, 81], + loc: { + start: { column: 21, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [59, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [53, 86], + loc: { + start: { column: 37, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "IntrinsicElements", + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + + range: [25, 86], + loc: { + start: { column: 9, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + exportKind: "type", + source: null, + specifiers: [], + + range: [18, 86], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + ], + + range: [14, 88], + loc: { + start: { column: 14, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "JSX", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [0, 88], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "baz-bam", + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + + range: [101, 116], + loc: { + start: { column: 11, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + selfClosing: true, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [96, 119], + loc: { + start: { column: 6, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + ], + kind: "const", + + range: [90, 120], + loc: { + start: { column: 0, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, + ], + sourceType: "script", + + range: [0, 121], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 8 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..330f42f3079 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,236 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "JSX", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "export", + + range: [18, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [25, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "IntrinsicElements", + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [53, 54], + loc: { + start: { column: 37, line: 2 }, + end: { column: 38, line: 2 }, + }, + }, + String { + type: "String", + value: "'foo-bar:baz-bam'", + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [76, 77], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [81, 82], + loc: { + start: { column: 26, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [85, 86], + loc: { + start: { column: 2, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [87, 88], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 5 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [90, 95], + loc: { + start: { column: 0, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [98, 99], + loc: { + start: { column: 8, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [100, 101], + loc: { + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "foo-bar", + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [108, 109], + loc: { + start: { column: 18, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "baz-bam", + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [117, 118], + loc: { + start: { column: 27, line: 7 }, + end: { column: 28, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [118, 119], + loc: { + start: { column: 28, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [119, 120], + loc: { + start: { column: 29, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..89a4e186fab --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,215 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSModuleDeclaration { + type: 'TSModuleDeclaration', + body: TSModuleBlock { + type: 'TSModuleBlock', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Literal { + type: 'Literal', + raw: '\\'foo-bar:baz-bam\\'', + value: 'foo-bar:baz-bam', + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [76, 81], + loc: { + start: { column: 21, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [59, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [53, 86], + loc: { + start: { column: 37, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'IntrinsicElements', + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + + range: [25, 86], + loc: { + start: { column: 9, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + exportKind: 'type', + source: null, + specifiers: Array [], + + range: [18, 86], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 4 }, + }, + }, + ], + + range: [14, 88], + loc: { + start: { column: 14, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'JSX', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, +- kind: 'namespace', + + range: [0, 88], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 5 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'x', + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + init: JSXElement { + type: 'JSXElement', + children: Array [], + closingElement: null, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [], + name: JSXNamespacedName { + type: 'JSXNamespacedName', + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'baz-bam', + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: 'JSXIdentifier', + name: 'foo-bar', + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + + range: [101, 116], + loc: { + start: { column: 11, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + selfClosing: true, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [100, 119], + loc: { + start: { column: 10, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [96, 119], + loc: { + start: { column: 6, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + ], + kind: 'const', + + range: [90, 120], + loc: { + start: { column: 0, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 121], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 8 }, + }, + }" +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..8d2eaf054fe --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,246 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'namespace', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'JSX', + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'export', + + range: [18, 24], + loc: { + start: { column: 2, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [25, 34], + loc: { + start: { column: 9, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'IntrinsicElements', + + range: [35, 52], + loc: { + start: { column: 19, line: 2 }, + end: { column: 36, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [53, 54], + loc: { + start: { column: 37, line: 2 }, + end: { column: 38, line: 2 }, + }, + }, + String { + type: 'String', + value: '\\'foo-bar:baz-bam\\'', + + range: [59, 76], + loc: { + start: { column: 4, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [76, 77], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [78, 81], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [81, 82], + loc: { + start: { column: 26, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [85, 86], + loc: { + start: { column: 2, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [87, 88], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 5 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'const', + + range: [90, 95], + loc: { + start: { column: 0, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [96, 97], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [98, 99], + loc: { + start: { column: 8, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [100, 101], + loc: { + start: { column: 10, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'foo-bar', + + range: [101, 108], + loc: { + start: { column: 11, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [108, 109], + loc: { + start: { column: 18, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'baz-bam', + + range: [109, 116], + loc: { + start: { column: 19, line: 7 }, + end: { column: 26, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [117, 118], + loc: { + start: { column: 27, line: 7 }, + end: { column: 28, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [118, 119], + loc: { + start: { column: 28, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [119, 120], + loc: { + start: { column: 29, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index c02044d615a..87667f4b5db 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -55,6 +55,7 @@ exports[`AST Fixtures List fixtures with AST differences 1`] = ` "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts", "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts", "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts", + "jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index 9f47f7fb973..b15734b809f 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -26,6 +26,7 @@ exports[`AST Fixtures List fixtures with Token differences 1`] = ` "element/AccessorProperty/fixtures/modifier-private/fixture.ts", "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", "element/AccessorProperty/fixtures/modifier-public/fixture.ts", + "jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx", "jsx/JSXNamespacedName/fixtures/component/fixture.tsx", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/fixture.ts",