From 16d750f283122520efc8f9c651b2c7be9602daf2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 5 Jun 2023 22:08:51 -0700 Subject: [PATCH 01/47] feat: support TypeScript 5.1 --- .prettierignore | 4 + docs/maintenance/Versioning.mdx | 2 +- package.json | 5 +- .../fixtures/component/fixture.tsx | 10 + .../component/snapshots/1-TSESTree-AST.shot | 485 ++++++++++++++ .../snapshots/2-TSESTree-Tokens.shot | 586 +++++++++++++++++ .../component/snapshots/3-Babel-AST.shot | 485 ++++++++++++++ .../component/snapshots/4-Babel-Tokens.shot | 586 +++++++++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 604 ++++++++++++++++++ .../fixtures-with-differences-tokens.shot | 1 + packages/eslint-plugin-tslint/package.json | 1 - .../fixtures/jsx/namespaced-attribute.tsx | 13 + .../jsx/namespaced-attribute.tsx.shot | 203 ++++++ packages/typescript-estree/src/convert.ts | 22 +- .../src/parseSettings/warnAboutTSVersion.ts | 6 +- .../src/ts-estree/estree-to-ts-node-types.ts | 2 +- .../src/ts-estree/ts-nodes.ts | 1 + ...ipt+5.0.2.patch => typescript+5.1.3.patch} | 0 yarn.lock | 10 +- 20 files changed, 3017 insertions(+), 15 deletions(-) create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx create mode 100644 packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot rename patches/{typescript+5.0.2.patch => typescript+5.1.3.patch} (100%) diff --git a/.prettierignore b/.prettierignore index 548792bb901b..e75691bd4a2c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,6 +17,10 @@ packages/ast-spec/src/element/AccessorProperty/fixtures # prettier doesn't yet support `const` modifiers for type parameters packages/ast-spec/src/special/TSTypeParameter/fixtures +# prettier doesn't yet support JSX namespaced attributes +packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx +packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx + # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/docs/maintenance/Versioning.mdx b/docs/maintenance/Versioning.mdx index 4cd92c6c8577..092606111f1b 100644 --- a/docs/maintenance/Versioning.mdx +++ b/docs/maintenance/Versioning.mdx @@ -52,7 +52,7 @@ Support for specific Current status releases are considered periodically. ### TypeScript -> The version range of TypeScript currently supported is `>=3.3.1 <5.1.0`. +> The version range of TypeScript currently supported is `>=3.3.1 <5.2.0`. These versions are what we test against. diff --git a/package.json b/package.json index 3f881e0dc75c..224349ccb506 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "@types/is-glob": "^4.0.2", "@types/jest": "29.4.4", "@types/jest-specific-snapshot": "^0.5.5", - "@types/lodash": "^4.14.182", "@types/marked": "^4.0.3", "@types/ncp": "^2.0.5", "@types/node": "^18.11.9", @@ -112,10 +111,10 @@ "ts-node": "10.7.0", "tslint": "^6.1.3", "tsx": "^3.12.1", - "typescript": ">=3.3.1 <5.1.0" + "typescript": ">=3.3.1 <5.2.0" }, "resolutions": { - "typescript": "~5.0.2", + "typescript": "~5.1.3", "@types/node": "^18.11.9", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx new file mode 100644 index 000000000000..04117403f023 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx @@ -0,0 +1,10 @@ +const x = ; +const y = ; + +interface NamespacePropComponentProps { + "a:b": string; +} + +function NamespacePropComponent(props: NamespacePropComponentProps) { + return
{props["a:b"]}
; +} diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..592cbb5dc1af --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,485 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [34, 37], + loc: { + start: { column: 34, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""tight spacing"", + value: "tight spacing", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + + range: [34, 53], + loc: { + start: { column: 34, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + selfClosing: true, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [6, 56], + loc: { + start: { column: 6, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 57], + loc: { + start: { column: 0, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 34, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""loose spacing"", + value: "loose spacing", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + + range: [92, 113], + loc: { + start: { column: 34, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + selfClosing: true, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [64, 116], + loc: { + start: { column: 6, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + ], + kind: "const", + + range: [58, 117], + loc: { + start: { column: 0, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [168, 176], + loc: { + start: { column: 9, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [163, 177], + loc: { + start: { column: 4, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [157, 179], + loc: { + start: { column: 38, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + + range: [119, 179], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [ + ReturnStatement { + type: "ReturnStatement", + argument: JSXElement { + type: "JSXElement", + children: [ + JSXExpressionContainer { + type: "JSXExpressionContainer", + expression: MemberExpression { + type: "MemberExpression", + computed: true, + object: Identifier { + type: "Identifier", + name: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + + range: [268, 280], + loc: { + start: { column: 17, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [267, 281], + loc: { + start: { column: 16, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + closingElement: JSXClosingElement { + type: "JSXClosingElement", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + + range: [281, 287], + loc: { + start: { column: 30, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + selfClosing: false, + + range: [262, 267], + loc: { + start: { column: 11, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + + range: [262, 287], + loc: { + start: { column: 11, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + + range: [255, 288], + loc: { + start: { column: 4, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + ], + + range: [249, 290], + loc: { + start: { column: 68, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + params: [ + Identifier { + type: "Identifier", + name: "props", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [218, 247], + loc: { + start: { column: 37, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [213, 247], + loc: { + start: { column: 32, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + ], + + range: [181, 290], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: "script", + + range: [0, 291], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 11 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..9352a620aac9 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,586 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component TSESTree - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + JSXText { + type: "JSXText", + value: ""tight spacing"", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, + JSXText { + type: "JSXText", + value: ""loose spacing"", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: "Keyword", + value: "return", + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..7582f7301e58 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot @@ -0,0 +1,485 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [34, 37], + loc: { + start: { column: 34, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""tight spacing"", + value: "tight spacing", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + + range: [34, 53], + loc: { + start: { column: 34, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + selfClosing: true, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [6, 56], + loc: { + start: { column: 6, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 57], + loc: { + start: { column: 0, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 34, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""loose spacing"", + value: "loose spacing", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + + range: [92, 113], + loc: { + start: { column: 34, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + selfClosing: true, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [64, 116], + loc: { + start: { column: 6, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + ], + kind: "const", + + range: [58, 117], + loc: { + start: { column: 0, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [168, 176], + loc: { + start: { column: 9, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [163, 177], + loc: { + start: { column: 4, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [157, 179], + loc: { + start: { column: 38, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + + range: [119, 179], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [ + ReturnStatement { + type: "ReturnStatement", + argument: JSXElement { + type: "JSXElement", + children: [ + JSXExpressionContainer { + type: "JSXExpressionContainer", + expression: MemberExpression { + type: "MemberExpression", + computed: true, + object: Identifier { + type: "Identifier", + name: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + + range: [268, 280], + loc: { + start: { column: 17, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [267, 281], + loc: { + start: { column: 16, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + closingElement: JSXClosingElement { + type: "JSXClosingElement", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + + range: [281, 287], + loc: { + start: { column: 30, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + selfClosing: false, + + range: [262, 267], + loc: { + start: { column: 11, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + + range: [262, 287], + loc: { + start: { column: 11, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + + range: [255, 288], + loc: { + start: { column: 4, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + ], + + range: [249, 290], + loc: { + start: { column: 68, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + params: [ + Identifier { + type: "Identifier", + name: "props", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [218, 247], + loc: { + start: { column: 37, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [213, 247], + loc: { + start: { column: 32, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + ], + + range: [181, 290], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: "script", + + range: [0, 291], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 11 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..afdd8792c205 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,586 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component Babel - Tokens 1`] = ` +[ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + String { + type: "String", + value: ""tight spacing"", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, + String { + type: "String", + value: ""loose spacing"", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: "Keyword", + value: "return", + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..805eaa54c240 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2a72ccaf2fef --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,604 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'const', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'NamespacePropComponent', + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'a', + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'b', + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, +- JSXText { +- type: 'JSXText', ++ String { ++ type: 'String', + value: '"tight spacing"', + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'const', + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'y', + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'NamespacePropComponent', + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'a', + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'b', + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, +- JSXText { +- type: 'JSXText', ++ String { ++ type: 'String', + value: '"loose spacing"', + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponentProps', + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: 'String', + value: '"a:b"', + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'string', + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'function', + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponent', + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '(', + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'props', + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponentProps', + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ')', + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'return', + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'div', + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'props', + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '[', + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: 'String', + value: '"a:b"', + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ']', + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'div', + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index 5ee1a88d62e2..9f47f7fb9737 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/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", "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 4a72224bb504..8e8552cba486 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -46,7 +46,6 @@ "typescript": "*" }, "devDependencies": { - "@types/lodash": "*", "@typescript-eslint/parser": "5.59.9" } } diff --git a/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx new file mode 100644 index 000000000000..b42f48eaefdb --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx @@ -0,0 +1,13 @@ +import * as React from "react"; + +// Both of these are equivalent: +const x = ; +const y = ; + +interface FooProps { + "a:b": string; +} + +function Foo(props: FooProps) { + return
{props["a:b"]}
; +} diff --git a/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot new file mode 100644 index 000000000000..045b34b7964e --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot @@ -0,0 +1,203 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespaced-attribute 1`] = ` +ScopeManager { + variables: [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: [ + ImportBindingDefinition$1 { + name: Identifier<"React">, + node: ImportNamespaceSpecifier$1, + }, + ], + name: "React", + references: [ + Reference$2 { + identifier: Identifier<"React">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$3 { + defs: [ + VariableDefinition$2 { + name: Identifier<"x">, + node: VariableDeclarator$2, + }, + ], + name: "x", + references: [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$3, + writeExpr: JSXElement$3, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$4 { + defs: [ + VariableDefinition$3 { + name: Identifier<"y">, + node: VariableDeclarator$4, + }, + ], + name: "y", + references: [ + Reference$4 { + identifier: Identifier<"y">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$4, + writeExpr: JSXElement$5, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$5 { + defs: [ + TypeDefinition$4 { + name: Identifier<"FooProps">, + node: TSInterfaceDeclaration$6, + }, + ], + name: "FooProps", + references: [ + Reference$6 { + identifier: Identifier<"FooProps">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$5, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$6 { + defs: [ + FunctionNameDefinition$5 { + name: Identifier<"Foo">, + node: FunctionDeclaration$7, + }, + ], + name: "Foo", + references: [ + Reference$3 { + identifier: JSXIdentifier$8, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$6, + }, + Reference$5 { + identifier: JSXIdentifier$9, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$6, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$7 { + defs: [], + name: "arguments", + references: [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$8 { + defs: [ + ParameterDefinition$6 { + name: Identifier<"props">, + node: FunctionDeclaration$7, + }, + ], + name: "props", + references: [ + Reference$7 { + identifier: Identifier<"props">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$8, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + ], + scopes: [ + GlobalScope$1 { + block: Program$10, + isStrict: false, + references: [ + Reference$1, + Reference$2, + Reference$3, + Reference$4, + Reference$5, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "React" => Variable$2, + "x" => Variable$3, + "y" => Variable$4, + "FooProps" => Variable$5, + "Foo" => Variable$6, + }, + type: "global", + upper: null, + variables: [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$4, + Variable$5, + Variable$6, + ], + }, + FunctionScope$2 { + block: FunctionDeclaration$7, + isStrict: false, + references: [ + Reference$6, + Reference$7, + ], + set: Map { + "arguments" => Variable$7, + "props" => Variable$8, + }, + type: "function", + upper: GlobalScope$1, + variables: [ + Variable$7, + Variable$8, + ], + }, + ], +} +`; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index e9c3e39d7a92..71fe614abf25 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -564,13 +564,33 @@ export class Converter { } private convertJSXNamespaceOrIdentifier( - node: ts.Identifier | ts.ThisExpression, + node: ts.JsxNamespacedName | ts.Identifier | ts.ThisExpression, ): TSESTree.JSXIdentifier | TSESTree.JSXNamespacedName { + // TypeScript@5.1 added in ts.JsxNamespacedName directly + // We prefer using that if it's relevant for this node type + if (node.kind === ts.SyntaxKind.JsxNamespacedName) { + const result = this.createNode(node, { + type: AST_NODE_TYPES.JSXNamespacedName, + namespace: this.createNode(node.namespace, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.namespace.text, + }), + name: this.createNode(node.name, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.name.text, + }), + }); + this.registerTSNodeInNodeMap(node, result); + return result; + } + + // TypeScript@<5.1 has to manually parse the JSX attributes const text = node.getText(); const colonIndex = text.indexOf(':'); // this is intentional we can ignore conversion if `:` is in first character if (colonIndex > 0) { const range = getRange(node, this.ast); + // @ts-expect-error -- TypeScript@<5.1 doesn't have ts.JsxNamespacedName const result = this.createNode(node, { type: AST_NODE_TYPES.JSXNamespacedName, namespace: this.createNode(node, { diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 5d0069ed1606..a2a32a927c25 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -3,16 +3,16 @@ import * as ts from 'typescript'; import type { ParseSettings } from './index'; /** - * This needs to be kept in sync with /docs/maintenance/Versioning.md + * This needs to be kept in sync with /docs/maintenance/Versioning.mdx * in the typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.1.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.2.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = ['5.0.1-rc']; +const SUPPORTED_PRERELEASE_RANGES: string[] = []; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index c080a83559ba..e6e07addb4a4 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -97,7 +97,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.JSXSpreadAttribute]: ts.JsxSpreadAttribute; [AST_NODE_TYPES.JSXSpreadChild]: ts.JsxExpression; [AST_NODE_TYPES.JSXMemberExpression]: ts.PropertyAccessExpression; - [AST_NODE_TYPES.JSXNamespacedName]: ts.Identifier | ts.ThisExpression; + [AST_NODE_TYPES.JSXNamespacedName]: ts.JsxNamespacedName; [AST_NODE_TYPES.JSXText]: ts.JsxText; [AST_NODE_TYPES.LabeledStatement]: ts.LabeledStatement; [AST_NODE_TYPES.Literal]: diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index fe1042260d8d..00beec505d3f 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -131,6 +131,7 @@ export type TSNode = | ts.JsxSpreadAttribute | ts.JsxClosingElement | ts.JsxExpression + | ts.JsxNamespacedName | ts.JsxText | ts.NotEmittedStatement | ts.CommaListExpression diff --git a/patches/typescript+5.0.2.patch b/patches/typescript+5.1.3.patch similarity index 100% rename from patches/typescript+5.0.2.patch rename to patches/typescript+5.1.3.patch diff --git a/yarn.lock b/yarn.lock index dabaa778923e..9b33bcbf2ea8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4254,7 +4254,7 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/lodash@*", "@types/lodash@^4.14.182": +"@types/lodash@^4.14.182": version "4.14.194" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.194.tgz#b71eb6f7a0ff11bff59fc987134a093029258a76" integrity sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g== @@ -14723,10 +14723,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.1.0", typescript@next, typescript@~4.8.4, typescript@~5.0.2: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@*, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.2.0", typescript@next, typescript@~4.8.4, typescript@~5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826" + integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw== ua-parser-js@^0.7.30: version "0.7.31" From 45e19f84b09fa74b1434454a3c2e51a6dc4afbf5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Jun 2023 09:07:24 +1000 Subject: [PATCH 02/47] Re-apply patch-package typescript --- patches/typescript+5.1.3.patch | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/patches/typescript+5.1.3.patch b/patches/typescript+5.1.3.patch index 4f4c95641d28..ae1a674970f5 100644 --- a/patches/typescript+5.1.3.patch +++ b/patches/typescript+5.1.3.patch @@ -1,18 +1,18 @@ diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 374e65a..9d5a88c 100644 +index 0dae9f8..7415565 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts -@@ -368,8 +368,8 @@ declare namespace ts { - JSDocFunctionType = 320, - JSDocVariadicType = 321, - JSDocNamepathType = 322, +@@ -370,8 +370,8 @@ declare namespace ts { + JSDocFunctionType = 323, + JSDocVariadicType = 324, + JSDocNamepathType = 325, + /** @deprecated This was only added in 4.7 */ - JSDoc = 323, + JSDoc = 326, - /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 323, - JSDocText = 324, - JSDocTypeLiteral = 325, -@@ -4522,7 +4522,13 @@ declare namespace ts { + JSDocComment = 326, + JSDocText = 327, + JSDocTypeLiteral = 328, +@@ -4571,7 +4571,13 @@ declare namespace ts { function symbolName(symbol: Symbol): string; function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; @@ -26,7 +26,7 @@ index 374e65a..9d5a88c 100644 function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; /** * Gets the JSDoc parameter tags for the node if present. -@@ -5027,7 +5033,13 @@ declare namespace ts { +@@ -5097,7 +5103,13 @@ declare namespace ts { function isModuleName(node: Node): node is ModuleName; function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken; function setTextRange(range: T, location: TextRange | undefined): T; From 07a8a85a6c8d62e9a8ee08d6e18c8e535ada7c3f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Jun 2023 12:15:17 +1000 Subject: [PATCH 03/47] jsx: preserve in ast-spec --- packages/ast-spec/tsconfig.build.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json index 89b0284199a6..2812814bb30d 100644 --- a/packages/ast-spec/tsconfig.build.json +++ b/packages/ast-spec/tsconfig.build.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "composite": true, + "jsx": "preserve", "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true From a000e000dcde3163c4b6fac2c09ebc31bc91da71 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Jun 2023 15:28:15 +1000 Subject: [PATCH 04/47] 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 000000000000..9ee258b4ae83 --- /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 000000000000..1b6ec08d157f --- /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 000000000000..7913346eb9f7 --- /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 000000000000..6871265b0e8c --- /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 000000000000..330f42f30790 --- /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 000000000000..89a4e186fabd --- /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 000000000000..8d2eaf054fea --- /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 c02044d615af..87667f4b5dbc 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 9f47f7fb9737..b15734b809f0 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", From 65ae4f91fee861de9fdb54d81b52183e8827f02e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Jun 2023 15:44:47 +1000 Subject: [PATCH 05/47] Rename to avoid global naming conflict --- .../jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 9ee258b4ae83..ae10e30c0b1a 100644 --- a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx @@ -4,4 +4,4 @@ namespace JSX { } } -const x = ; +const componentDashed = ; From 676e900b93907d61686284e6ccd67ec080a2078a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Wed, 7 Jun 2023 14:49:05 +0400 Subject: [PATCH 06/47] chore: only run website tests on non-forks --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e62a6055620..f9ce8e84c8c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,6 +177,8 @@ jobs: retention-days: 1 website_tests: + # The NETLIFY_TOKEN secret will not be available on forks + if: github.repository == 'typescript-eslint/typescript-eslint' permissions: contents: read # to fetch code (actions/checkout) From 8bf3877f05ec44a133c30923cb552d9fa0fbb59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CJamesHenry=E2=80=9D?= Date: Wed, 7 Jun 2023 15:01:43 +0400 Subject: [PATCH 07/47] chore: only run website tests on non-forks --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9ce8e84c8c3..19d8514324ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,7 +178,7 @@ jobs: website_tests: # The NETLIFY_TOKEN secret will not be available on forks - if: github.repository == 'typescript-eslint/typescript-eslint' + if: github.repository_owner == 'typescript-eslint' permissions: contents: read # to fetch code (actions/checkout) From 16553c69dc3d11cd24b0196a847d7e13d1f20766 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 07:44:41 +1000 Subject: [PATCH 08/47] Updated ast-spec snapshots --- .../snapshots/1-TSESTree-AST.shot | 46 ++++++++-------- .../snapshots/2-TSESTree-Tokens.shot | 54 +++++++++---------- .../snapshots/3-Babel-AST.shot | 46 ++++++++-------- .../snapshots/4-Babel-Tokens.shot | 54 +++++++++---------- .../snapshots/5-AST-Alignment-AST.shot | 46 ++++++++-------- .../snapshots/6-AST-Alignment-Tokens.shot | 54 +++++++++---------- 6 files changed, 150 insertions(+), 150 deletions(-) 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 index 1b6ec08d157f..89265a3c778b 100644 --- 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 @@ -124,12 +124,12 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "componentDashed", - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, init: JSXElement { @@ -145,64 +145,64 @@ Program { type: "JSXIdentifier", name: "baz-bam", - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, namespace: JSXIdentifier { type: "JSXIdentifier", name: "foo-bar", - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, - range: [101, 116], + range: [115, 130], loc: { - start: { column: 11, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, }, }, selfClosing: true, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [96, 119], + range: [96, 133], loc: { start: { column: 6, line: 7 }, - end: { column: 29, line: 7 }, + end: { column: 43, line: 7 }, }, }, ], kind: "const", - range: [90, 120], + range: [90, 134], loc: { start: { column: 0, line: 7 }, - end: { column: 30, line: 7 }, + end: { column: 44, line: 7 }, }, }, ], sourceType: "script", - range: [0, 121], + range: [0, 135], 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 index 7913346eb9f7..c416578b7093 100644 --- 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 @@ -144,92 +144,92 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed TSESTree - Tokens 1 }, Identifier { type: "Identifier", - value: "x", + value: "componentDashed", - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [98, 99], + range: [112, 113], loc: { - start: { column: 8, line: 7 }, - end: { column: 9, line: 7 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "<", - range: [100, 101], + range: [114, 115], loc: { - start: { column: 10, line: 7 }, - end: { column: 11, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, }, }, Identifier { type: "Identifier", value: "foo-bar", - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [108, 109], + range: [122, 123], loc: { - start: { column: 18, line: 7 }, - end: { column: 19, line: 7 }, + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, }, }, Identifier { type: "Identifier", value: "baz-bam", - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "/", - range: [117, 118], + range: [131, 132], loc: { - start: { column: 27, line: 7 }, - end: { column: 28, line: 7 }, + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ">", - range: [118, 119], + range: [132, 133], loc: { - start: { column: 28, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [119, 120], + range: [133, 134], loc: { - start: { column: 29, line: 7 }, - end: { column: 30, line: 7 }, + start: { column: 43, line: 7 }, + end: { column: 44, 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 index 6871265b0e8c..0425d143c1b1 100644 --- 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 @@ -123,12 +123,12 @@ Program { type: "VariableDeclarator", id: Identifier { type: "Identifier", - name: "x", + name: "componentDashed", - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, init: JSXElement { @@ -144,64 +144,64 @@ Program { type: "JSXIdentifier", name: "baz-bam", - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, namespace: JSXIdentifier { type: "JSXIdentifier", name: "foo-bar", - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, - range: [101, 116], + range: [115, 130], loc: { - start: { column: 11, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, }, }, selfClosing: true, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [96, 119], + range: [96, 133], loc: { start: { column: 6, line: 7 }, - end: { column: 29, line: 7 }, + end: { column: 43, line: 7 }, }, }, ], kind: "const", - range: [90, 120], + range: [90, 134], loc: { start: { column: 0, line: 7 }, - end: { column: 30, line: 7 }, + end: { column: 44, line: 7 }, }, }, ], sourceType: "script", - range: [0, 121], + range: [0, 135], 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 index 330f42f30790..fba5e9f5f99f 100644 --- 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 @@ -144,92 +144,92 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed Babel - Tokens 1`] }, Identifier { type: "Identifier", - value: "x", + value: "componentDashed", - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [98, 99], + range: [112, 113], loc: { - start: { column: 8, line: 7 }, - end: { column: 9, line: 7 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "<", - range: [100, 101], + range: [114, 115], loc: { - start: { column: 10, line: 7 }, - end: { column: 11, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, }, }, JSXIdentifier { type: "JSXIdentifier", value: "foo-bar", - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [108, 109], + range: [122, 123], loc: { - start: { column: 18, line: 7 }, - end: { column: 19, line: 7 }, + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, }, }, JSXIdentifier { type: "JSXIdentifier", value: "baz-bam", - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, Punctuator { type: "Punctuator", value: "/", - range: [117, 118], + range: [131, 132], loc: { - start: { column: 27, line: 7 }, - end: { column: 28, line: 7 }, + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ">", - range: [118, 119], + range: [132, 133], loc: { - start: { column: 28, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [119, 120], + range: [133, 134], loc: { - start: { column: 29, line: 7 }, - end: { column: 30, line: 7 }, + start: { column: 43, line: 7 }, + end: { column: 44, 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 index 89a4e186fabd..9283b97b78d3 100644 --- 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 @@ -128,12 +128,12 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - AST type: 'VariableDeclarator', id: Identifier { type: 'Identifier', - name: 'x', + name: 'componentDashed', - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, init: JSXElement { @@ -149,64 +149,64 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - AST type: 'JSXIdentifier', name: 'baz-bam', - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, namespace: JSXIdentifier { type: 'JSXIdentifier', name: 'foo-bar', - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, - range: [101, 116], + range: [115, 130], loc: { - start: { column: 11, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, }, }, selfClosing: true, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [100, 119], + range: [114, 133], loc: { - start: { column: 10, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, }, }, - range: [96, 119], + range: [96, 133], loc: { start: { column: 6, line: 7 }, - end: { column: 29, line: 7 }, + end: { column: 43, line: 7 }, }, }, ], kind: 'const', - range: [90, 120], + range: [90, 134], loc: { start: { column: 0, line: 7 }, - end: { column: 30, line: 7 }, + end: { column: 44, line: 7 }, }, }, ], sourceType: 'script', - range: [0, 121], + range: [0, 135], 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 index 8d2eaf054fea..dcc68e747bcc 100644 --- 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 @@ -150,32 +150,32 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - Tok }, Identifier { type: 'Identifier', - value: 'x', + value: 'componentDashed', - range: [96, 97], + range: [96, 111], loc: { start: { column: 6, line: 7 }, - end: { column: 7, line: 7 }, + end: { column: 21, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: '=', - range: [98, 99], + range: [112, 113], loc: { - start: { column: 8, line: 7 }, - end: { column: 9, line: 7 }, + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: '<', - range: [100, 101], + range: [114, 115], loc: { - start: { column: 10, line: 7 }, - end: { column: 11, line: 7 }, + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, }, }, - Identifier { @@ -184,20 +184,20 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - Tok + type: 'JSXIdentifier', value: 'foo-bar', - range: [101, 108], + range: [115, 122], loc: { - start: { column: 11, line: 7 }, - end: { column: 18, line: 7 }, + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: ':', - range: [108, 109], + range: [122, 123], loc: { - start: { column: 18, line: 7 }, - end: { column: 19, line: 7 }, + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, }, }, - Identifier { @@ -206,40 +206,40 @@ exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - Tok + type: 'JSXIdentifier', value: 'baz-bam', - range: [109, 116], + range: [123, 130], loc: { - start: { column: 19, line: 7 }, - end: { column: 26, line: 7 }, + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: '/', - range: [117, 118], + range: [131, 132], loc: { - start: { column: 27, line: 7 }, - end: { column: 28, line: 7 }, + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: '>', - range: [118, 119], + range: [132, 133], loc: { - start: { column: 28, line: 7 }, - end: { column: 29, line: 7 }, + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, }, }, Punctuator { type: 'Punctuator', value: ';', - range: [119, 120], + range: [133, 134], loc: { - start: { column: 29, line: 7 }, - end: { column: 30, line: 7 }, + start: { column: 43, line: 7 }, + end: { column: 44, line: 7 }, }, }, ]" From 4bd487947e89740d166f515826f3da977e106652 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 08:08:58 +1000 Subject: [PATCH 09/47] Let's try --runInBand --- packages/typescript-estree/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 56b93f5ee8e9..ab62d7b87d3e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -38,7 +38,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", - "test": "jest --coverage", + "test": "jest --coverage --runInBand", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { From 6931b541175e387b00cc9b03b0537a3b941e01c1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 08:40:44 +1000 Subject: [PATCH 10/47] How about some logging --- .../parse.moduleResolver.default-program-error.test.ts | 8 ++++++++ .../parse.moduleResolver.default-program-success.test.ts | 8 ++++++++ .../lib/parse.moduleResolver.placeholder-error.test.ts | 6 ++++++ .../lib/parse.moduleResolver.placeholder-success.test.ts | 6 ++++++ 4 files changed, 28 insertions(+) diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts index 25557a24ef51..1ee7400798bd 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts @@ -2,11 +2,19 @@ import * as parser from '../../src'; import type { TSESTreeOptions } from '../../src/parser-options'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; +console.log( + 'Start of file: parse.moduleResolver.default-program-error.test.ts', +); + beforeEach(() => { jest.clearAllMocks(); }); describe('parseAndGenerateServices', () => { + console.log( + 'Start of describe: parse.moduleResolver.default-program-error.test.ts', + ); + describe('moduleResolver', () => { const { code, config } = createAndPrepareParseConfig(); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts index 9bebf21de1ae..cd614177b252 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts @@ -4,11 +4,19 @@ import * as parser from '../../src'; import type { TSESTreeOptions } from '../../src/parser-options'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; +console.log( + 'Start of file: parse.moduleResolver.default-program-success.test.ts', +); + beforeEach(() => { jest.clearAllMocks(); }); describe('parseAndGenerateServices', () => { + console.log( + 'Start of describe: parse.moduleResolver.default-program-success.test.ts', + ); + describe('moduleResolver', () => { const { code, config, projectDirectory } = createAndPrepareParseConfig(); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts index 699c88f0f235..91cd5fee58cc 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts @@ -3,11 +3,17 @@ import { resolve } from 'path'; import * as parser from '../../src'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; +console.log('Start of file: parse.moduleResolver.placeholder-error.test.ts'); + beforeEach(() => { jest.clearAllMocks(); }); describe('parseAndGenerateServices', () => { + console.log( + 'Start of describe: parse.moduleResolver.placeholder-error.test.ts', + ); + describe('moduleResolver', () => { const { code, config, projectDirectory } = createAndPrepareParseConfig(); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts index eebc01b9369a..9842f7c52f28 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts @@ -3,11 +3,17 @@ import { resolve } from 'path'; import * as parser from '../../src'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; +console.log('Start of file: parse.moduleResolver.placeholder-success.test.ts'); + beforeEach(() => { jest.clearAllMocks(); }); describe('parseAndGenerateServices', () => { + console.log( + 'Start of describe: parse.moduleResolver.placeholder-success.test.ts', + ); + describe('moduleResolver', () => { const { code, config, projectDirectory } = createAndPrepareParseConfig(); From ea0e298051aa453319cb56c9394f481632ec6b44 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 08:53:32 +1000 Subject: [PATCH 11/47] --verbose --- packages/typescript-estree/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index ab62d7b87d3e..4aaeb85a565a 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -38,7 +38,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", - "test": "jest --coverage --runInBand", + "test": "jest --coverage --runInBand --verbose", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { From 6a7c991bacb10fadcdc9c27d36b402019d3afc13 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 09:54:01 +1000 Subject: [PATCH 12/47] Skip parse.moduleResolver.+ tests in Node 14 --- packages/typescript-estree/jest.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 43f847a6fbfe..1a50e724cd8d 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -4,6 +4,9 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), + testPathIgnorePatterns: process.version.startsWith('14') + ? ['/node_modules/', '/parse.moduleResolver/'] + : undefined, testRegex: [ './tests/lib/.*\\.ts$', './tests/ast-alignment/spec\\.ts$', From 018e10feca54ff95b52e970f26e7b27c1fa45994 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 10:50:02 +1000 Subject: [PATCH 13/47] map of undefined --- packages/typescript-estree/jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 1a50e724cd8d..d0705a2e0b09 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -6,7 +6,7 @@ module.exports = { ...require('../../jest.config.base.js'), testPathIgnorePatterns: process.version.startsWith('14') ? ['/node_modules/', '/parse.moduleResolver/'] - : undefined, + : ['/node_modules/'], testRegex: [ './tests/lib/.*\\.ts$', './tests/ast-alignment/spec\\.ts$', From 50a51aea7aaf2ac79b744985eed51fcb71e4a1e0 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 11:16:50 +1000 Subject: [PATCH 14/47] more logging on process version --- packages/typescript-estree/jest.config.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index d0705a2e0b09..c61cbad33f4f 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -1,11 +1,18 @@ 'use strict'; - // @ts-check + +console.log( + 'Running with', + process.version, + 'which startsWith:', + process.version.startsWith('14'), +); + /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), testPathIgnorePatterns: process.version.startsWith('14') - ? ['/node_modules/', '/parse.moduleResolver/'] + ? ['/node_modules/', '/parse\\.moduleResolver/'] : ['/node_modules/'], testRegex: [ './tests/lib/.*\\.ts$', From 5bfbdacd197a95ffd57d63ec38e9b1af498d2469 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 14:14:13 +1000 Subject: [PATCH 15/47] Remove jest.config.js shenanigans --- package.json | 2 +- packages/typescript-estree/jest.config.js | 11 ----------- yarn.lock | 7 +++---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 224349ccb506..5823e222d6df 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "typescript": ">=3.3.1 <5.2.0" }, "resolutions": { - "typescript": "~5.1.3", + "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz", "@types/node": "^18.11.9", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index c61cbad33f4f..76ebc18a1b9c 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -1,19 +1,8 @@ 'use strict'; // @ts-check - -console.log( - 'Running with', - process.version, - 'which startsWith:', - process.version.startsWith('14'), -); - /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testPathIgnorePatterns: process.version.startsWith('14') - ? ['/node_modules/', '/parse\\.moduleResolver/'] - : ['/node_modules/'], testRegex: [ './tests/lib/.*\\.ts$', './tests/ast-alignment/spec\\.ts$', diff --git a/yarn.lock b/yarn.lock index 9b33bcbf2ea8..cc1e6f99b729 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14723,10 +14723,9 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.2.0", typescript@next, typescript@~4.8.4, typescript@~5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826" - integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw== +typescript@*, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.2.0", "typescript@https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz", typescript@next, typescript@~4.8.4: + version "5.2.0-insiders.20230605" + resolved "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz#4488f5f7ab8deeb1349b5b45d664ff0fcc8f432f" ua-parser-js@^0.7.30: version "0.7.31" From 377d69f2068845d55c5bb5d13ecaad3ed9408ffa Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 14:52:27 +1000 Subject: [PATCH 16/47] Remove --frozen-lockfile for now --- .github/actions/prepare-install/action.yml | 2 +- tests/performance/fixtures/lint-real-repo/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml index b437dce91363..c5976f9a0966 100644 --- a/.github/actions/prepare-install/action.yml +++ b/.github/actions/prepare-install/action.yml @@ -55,6 +55,6 @@ runs: shell: bash working-directory: ${{ inputs.working-directory }} run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn --ignore-engines --ignore-scripts yarn check-clean-workspace-after-install yarn patch-package diff --git a/tests/performance/fixtures/lint-real-repo/Dockerfile b/tests/performance/fixtures/lint-real-repo/Dockerfile index f3002796ecbb..9942af20f001 100644 --- a/tests/performance/fixtures/lint-real-repo/Dockerfile +++ b/tests/performance/fixtures/lint-real-repo/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /usr/vega-lite RUN git checkout f1e4c1ebe50fdf3b9131ba5dde915e6efbe4bd87 # Run the equivalent of the project's travis build before linting starts -RUN yarn install --frozen-lockfile && yarn cache clean +RUN yarn install && yarn cache clean RUN yarn build # Keep the container alive forever From 1d0484facfcbd957781b381513b898022d13b856 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 15:11:02 +1000 Subject: [PATCH 17/47] Mention ts version in jest.config.js --- packages/typescript-estree/jest.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 76ebc18a1b9c..bc89e516afa2 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -1,5 +1,9 @@ 'use strict'; // @ts-check + +const ts = require('typescript'); +console.log('Running with TypeScript version:', ts.version); + /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), From f97cf3371fc31e7897b97115b26f05ed0e8d7b2f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 23:00:09 +1000 Subject: [PATCH 18/47] Split placeholder-error in twain --- ...olver.placeholder-error-not-found.test.ts} | 17 +++------- ...ver.placeholder-error-not-resolved.test.ts | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 13 deletions(-) rename packages/typescript-estree/tests/lib/{parse.moduleResolver.placeholder-error.test.ts => parse.moduleResolver.placeholder-error-not-found.test.ts} (65%) create mode 100644 packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-resolved.test.ts diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-found.test.ts similarity index 65% rename from packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts rename to packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-found.test.ts index 91cd5fee58cc..b917bf7afc84 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-found.test.ts @@ -3,7 +3,9 @@ import { resolve } from 'path'; import * as parser from '../../src'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; -console.log('Start of file: parse.moduleResolver.placeholder-error.test.ts'); +console.log( + 'Start of file: parse.moduleResolver.placeholder-error-not-found.test.ts', +); beforeEach(() => { jest.clearAllMocks(); @@ -11,24 +13,13 @@ beforeEach(() => { describe('parseAndGenerateServices', () => { console.log( - 'Start of describe: parse.moduleResolver.placeholder-error.test.ts', + 'Start of describe: parse.moduleResolver.placeholder-error-not-found.test.ts', ); describe('moduleResolver', () => { const { code, config, projectDirectory } = createAndPrepareParseConfig(); describe('when file is in the project', () => { - it('returns error if __PLACEHOLDER__ can not be resolved', () => { - expect( - parser - .parseAndGenerateServices(code, config) - .services.program.getSemanticDiagnostics(), - ).toHaveProperty( - [0, 'messageText'], - "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", - ); - }); - it('throws error if moduleResolver can not be found', () => { expect(() => parser.parseAndGenerateServices(code, { diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-resolved.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-resolved.test.ts new file mode 100644 index 000000000000..d1c4f60d90e4 --- /dev/null +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-resolved.test.ts @@ -0,0 +1,33 @@ +import * as parser from '../../src'; +import { createAndPrepareParseConfig } from '../../tools/test-utils'; + +console.log( + 'Start of file: parse.moduleResolver.placeholder-error-not-resolved.test.ts', +); + +beforeEach(() => { + jest.clearAllMocks(); +}); + +describe('parseAndGenerateServices', () => { + console.log( + 'Start of describe: parse.moduleResolver.placeholder-error-not-resolved.test.ts', + ); + + describe('moduleResolver', () => { + const { code, config } = createAndPrepareParseConfig(); + + describe('when file is in the project', () => { + it('returns error if __PLACEHOLDER__ can not be resolved', () => { + expect( + parser + .parseAndGenerateServices(code, config) + .services.program.getSemanticDiagnostics(), + ).toHaveProperty( + [0, 'messageText'], + "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", + ); + }); + }); + }); +}); From 0b4eb193e7886fcbb4d6106265dc3ddc540c1c1e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 23:19:30 +1000 Subject: [PATCH 19/47] Try a .skip --- .../lib/parse.moduleResolver.default-program-success.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts index cd614177b252..badfbdd30181 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts @@ -27,7 +27,9 @@ describe('parseAndGenerateServices', () => { }; describe('when file is not in the project and createDefaultProgram=true', () => { - it('resolves __PLACEHOLDER__ correctly', () => { + // https://github.com/typescript-eslint/typescript-eslint/pull/7088 + // eslint-disable-next-line jest/no-disabled-tests + it.skip('resolves __PLACEHOLDER__ correctly', () => { expect( parser .parseAndGenerateServices(code, { From ad1541df24bff0430cc3b386bc4984562750d7b0 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 8 Jun 2023 23:44:32 +1000 Subject: [PATCH 20/47] Revert "Try a .skip" This reverts commit 0b4eb193e7886fcbb4d6106265dc3ddc540c1c1e. --- .../lib/parse.moduleResolver.default-program-success.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts index badfbdd30181..cd614177b252 100644 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts +++ b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts @@ -27,9 +27,7 @@ describe('parseAndGenerateServices', () => { }; describe('when file is not in the project and createDefaultProgram=true', () => { - // https://github.com/typescript-eslint/typescript-eslint/pull/7088 - // eslint-disable-next-line jest/no-disabled-tests - it.skip('resolves __PLACEHOLDER__ correctly', () => { + it('resolves __PLACEHOLDER__ correctly', () => { expect( parser .parseAndGenerateServices(code, { From c6f949bbafd25da94bced061abd8e175989fa1d6 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 03:57:01 +1000 Subject: [PATCH 21/47] Heck, let's try Node 20 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19d8514324ef..fddbab8b3077 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: strategy: matrix: # just run on the oldest and latest supported versions and assume the intermediate versions are good - node-version: [14, 18] + node-version: [20] package: [ 'ast-spec', From 564f73daf73bd811a984db4e0088a99a992570c1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 04:23:24 +1000 Subject: [PATCH 22/47] Revert "Heck, let's try Node 20" This reverts commit c6f949bbafd25da94bced061abd8e175989fa1d6. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fddbab8b3077..19d8514324ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: strategy: matrix: # just run on the oldest and latest supported versions and assume the intermediate versions are good - node-version: [20] + node-version: [14, 18] package: [ 'ast-spec', From b865a7a31838ddb1858816697a93849041b0081f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 04:31:56 +1000 Subject: [PATCH 23/47] testing: specific script for TypeScript 5.1 --- .github/workflows/test-against-versions.yml | 63 +++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/test-against-versions.yml diff --git a/.github/workflows/test-against-versions.yml b/.github/workflows/test-against-versions.yml new file mode 100644 index 000000000000..a286e7832002 --- /dev/null +++ b/.github/workflows/test-against-versions.yml @@ -0,0 +1,63 @@ +name: Test Against Versions + +on: + push: + branches: + - typescript-5.1-testing + pull_request: + branches: + - typescript-5.1-testing + +env: + PRIMARY_NODE_VERSION: 18 + # Only set the read-write token if we are on the main branch + NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }} + +defaults: + run: + shell: bash + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + build: + name: Build All Packages + needs: [install] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + - name: Build + uses: ./.github/actions/prepare-build + + unit_tests: + name: Run Unit Tests + needs: [build] + runs-on: ubuntu-latest + strategy: + matrix: + package: ['typescript-estree'] + env: + # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app + NX_CLOUD_ENV_NAME: 'Node 18 Testing -' + COLLECT_COVERAGE: false + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: 18 + - name: Build + uses: ./.github/actions/prepare-build + - name: Run unit tests for Node 18 + run: npx nx test ${{ matrix.package }} --coverage=false parse.moduleResolver + env: + CI: true From 98926aa3d4a77b55252466aa3d8e23c911f7d332 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 04:38:11 +1000 Subject: [PATCH 24/47] Trim down ci.yml to be easier --- .github/workflows/ci.yml | 239 --------------------------------------- 1 file changed, 239 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19d8514324ef..0a5522cff638 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,242 +55,3 @@ jobs: node-version: ${{ env.PRIMARY_NODE_VERSION }} - name: Build uses: ./.github/actions/prepare-build - - lint_without_build: - name: Lint - needs: [install] - runs-on: ubuntu-latest - strategy: - matrix: - lint-task: ['check-spelling', 'check-format', 'lint-markdown'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Run Check - run: yarn ${{ matrix.lint-task }} - - lint_with_build: - name: Lint - # because we lint with our own tooling, we need to build - needs: [build] - runs-on: ubuntu-latest - strategy: - matrix: - lint-task: ['lint', 'typecheck'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Build - uses: ./.github/actions/prepare-build - - - name: Run Check - run: yarn ${{ matrix.lint-task }} - - integration_tests: - name: Run integration tests on primary Node.js version - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Build - uses: ./.github/actions/prepare-build - - - name: Run integrations tests - run: yarn test-integration - env: - CI: true - - unit_tests: - name: Run Unit Tests - needs: [build] - runs-on: ubuntu-latest - strategy: - matrix: - # just run on the oldest and latest supported versions and assume the intermediate versions are good - node-version: [14, 18] - package: - [ - 'ast-spec', - 'eslint-plugin', - 'eslint-plugin-internal', - 'eslint-plugin-tslint', - 'parser', - 'scope-manager', - 'type-utils', - 'typescript-estree', - 'utils', - 'visitor-keys', - ] - env: - # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app - NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -' - COLLECT_COVERAGE: false - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ matrix.node-version }} - - name: Build - uses: ./.github/actions/prepare-build - - # collect coverage on the primary node version - # we don't collect coverage on other node versions so they run faster - # note that we don't do this as a single `run` with a flag because some - # packages don't collect coverage on purpose, so forcing `--coverage=true` - # would override the config - - name: Run unit tests with coverage for ${{ matrix.package }} - if: env.PRIMARY_NODE_VERSION == matrix.node-version - run: npx nx test ${{ matrix.package }} - env: - CI: true - - name: Run unit tests for ${{ matrix.package }} - if: env.PRIMARY_NODE_VERSION != matrix.node-version - run: npx nx test ${{ matrix.package }} --coverage=false - env: - CI: true - - - name: Store coverage for uploading - if: env.PRIMARY_NODE_VERSION == matrix.node-version - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.package }}-coverage - path: packages/${{ matrix.package }}/coverage/lcov.info - # Sadly 1 day is the minimum - retention-days: 1 - - website_tests: - # The NETLIFY_TOKEN secret will not be available on forks - if: github.repository_owner == 'typescript-eslint' - permissions: - contents: read # to fetch code (actions/checkout) - - name: Website tests - # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however, - # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources, - # we do still keep this requirement here. - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Install Playwright Browsers - run: npx playwright install --with-deps - - - name: Wait for Netlify deployment - uses: ./.github/actions/wait-for-netlify - id: waitForDeployment - with: - netlify_token: ${{ secrets.NETLIFY_TOKEN }} - - - name: Run Playwright tests against the Netlify deployment - run: yarn playwright test --reporter=list - working-directory: packages/website - env: - PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }} - - - if: always() - uses: actions/upload-artifact@v3 - with: - name: playwright-report - path: packages/website/playwright-report - - upload_coverage: - name: Upload Codecov Coverage - needs: [unit_tests] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Download coverage reports - uses: actions/download-artifact@v3 - with: - path: coverage - - - name: Publish code coverage report - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage/**/lcov.info - flags: unittest - name: codecov - - publish_canary_version: - name: Publish the latest code as a canary version - runs-on: ubuntu-latest - permissions: - id-token: write - needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] - if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: 'https://registry.npmjs.org' - - name: Build - uses: ./.github/actions/prepare-build - - # Fetch all history for all tags and branches in this job because lerna needs it - - run: | - git fetch --prune --unshallow - - - name: Publish all packages to npm - run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - publish_canary_version_v6: - name: Publish the next major version code as a canary version - runs-on: ubuntu-latest - permissions: - id-token: write - needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] - if: github.ref == 'refs/heads/v6' - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: 'https://registry.npmjs.org' - - name: Build - uses: ./.github/actions/prepare-build - - # Fetch all history for all tags and branches in this job because lerna needs it - - run: | - git fetch --prune --unshallow - - - name: Publish all packages to npm - run: npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v6 - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 063e4da111023b697225e4f7ec5b690e9d52fb48 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 04:38:51 +1000 Subject: [PATCH 25/47] Just move to ci.yml --- .github/workflows/ci.yml | 27 +++++++++ .github/workflows/test-against-versions.yml | 63 --------------------- 2 files changed, 27 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/test-against-versions.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a5522cff638..d96af15f44ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,30 @@ jobs: node-version: ${{ env.PRIMARY_NODE_VERSION }} - name: Build uses: ./.github/actions/prepare-build + + unit_tests: + name: Run Unit Tests + needs: [build] + runs-on: ubuntu-latest + strategy: + matrix: + package: ['typescript-estree'] + env: + # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app + NX_CLOUD_ENV_NAME: 'Node 18 Testing -' + COLLECT_COVERAGE: false + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: 18 + - name: Build + uses: ./.github/actions/prepare-build + - name: Run unit tests for Node 18 + run: npx nx test ${{ matrix.package }} --coverage=false parse.moduleResolver + env: + CI: true diff --git a/.github/workflows/test-against-versions.yml b/.github/workflows/test-against-versions.yml deleted file mode 100644 index a286e7832002..000000000000 --- a/.github/workflows/test-against-versions.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Test Against Versions - -on: - push: - branches: - - typescript-5.1-testing - pull_request: - branches: - - typescript-5.1-testing - -env: - PRIMARY_NODE_VERSION: 18 - # Only set the read-write token if we are on the main branch - NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }} - -defaults: - run: - shell: bash - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - build: - name: Build All Packages - needs: [install] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Build - uses: ./.github/actions/prepare-build - - unit_tests: - name: Run Unit Tests - needs: [build] - runs-on: ubuntu-latest - strategy: - matrix: - package: ['typescript-estree'] - env: - # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app - NX_CLOUD_ENV_NAME: 'Node 18 Testing -' - COLLECT_COVERAGE: false - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: Install - uses: ./.github/actions/prepare-install - with: - node-version: 18 - - name: Build - uses: ./.github/actions/prepare-build - - name: Run unit tests for Node 18 - run: npx nx test ${{ matrix.package }} --coverage=false parse.moduleResolver - env: - CI: true From 7fe0a5e75f50caf567fff4760cb6c625fb9bd93e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 04:39:04 +1000 Subject: [PATCH 26/47] Easier unit_tests.name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d96af15f44ff..25200f97fa6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: uses: ./.github/actions/prepare-build unit_tests: - name: Run Unit Tests + name: Run Specific Unit Tests needs: [build] runs-on: ubuntu-latest strategy: From 4d8e21c789f89c659b987c672a2cadc268b5abae Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:02:10 +1000 Subject: [PATCH 27/47] Added resolution swapper and ci.yml --- .github/workflows/ci.yml | 5 ++++- replace-typescript-resolution.mjs | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 replace-typescript-resolution.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25200f97fa6b..bf42080c47cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,7 @@ jobs: strategy: matrix: package: ['typescript-estree'] + version: ['5.0.4', '5.1.0-beta', '5.1.1-rc', '5.1.3'] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app NX_CLOUD_ENV_NAME: 'Node 18 Testing -' @@ -78,7 +79,9 @@ jobs: node-version: 18 - name: Build uses: ./.github/actions/prepare-build + - name: Swap TypeScript + run: node ./replace-typescript-resolution.mjs {{ matrix.version }} - name: Run unit tests for Node 18 - run: npx nx test ${{ matrix.package }} --coverage=false parse.moduleResolver + run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts env: CI: true diff --git a/replace-typescript-resolution.mjs b/replace-typescript-resolution.mjs new file mode 100644 index 000000000000..458d8b271f39 --- /dev/null +++ b/replace-typescript-resolution.mjs @@ -0,0 +1,7 @@ +import fs from 'node:fs/promises'; + +const existing = JSON.parse((await fs.readFile('./package.json')).toString()); + +existing.resolutions.typescript = process.argv[2]; + +await fs.writeFile('./package.json', JSON.stringify(existing, null, 2)); From af75b9c43f91a476a89caded83b2164fcff5ac27 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:12:50 +1000 Subject: [PATCH 28/47] Gotta install --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf42080c47cf..8751b910f965 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,8 +79,10 @@ jobs: node-version: 18 - name: Build uses: ./.github/actions/prepare-build - - name: Swap TypeScript + - name: Swap TypeScript Resolution run: node ./replace-typescript-resolution.mjs {{ matrix.version }} + - name: Install Again + run: yarn --ignore-engines --ignore-scripts - name: Run unit tests for Node 18 run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts env: From 49018789076c707107e5c095b04ef241fb36e37b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:28:49 +1000 Subject: [PATCH 29/47] fail-fast: false, and more versions in the matrix --- .github/workflows/ci.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8751b910f965..35e4afe73174 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,9 +61,22 @@ jobs: needs: [build] runs-on: ubuntu-latest strategy: + fail-fast: false matrix: package: ['typescript-estree'] - version: ['5.0.4', '5.1.0-beta', '5.1.1-rc', '5.1.3'] + version: + [ + '5.0.4', + '5.1.0-beta', + '5.1.1-rc', + '5.1.3', + '5.2.0-dev.20230516', + '5.2.0-dev.20230517', + '5.2.0-dev.20230520', + '5.2.0-dev.20230524', + '5.2.0-dev.20230528', + '5.2.0-dev.20230601', + ] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app NX_CLOUD_ENV_NAME: 'Node 18 Testing -' From 94d5e2da34992c2c1f639ed1d0e69c8991ae7b92 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:41:39 +1000 Subject: [PATCH 30/47] hmm, are we sure it's installing --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35e4afe73174..130fb41626df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,9 +93,11 @@ jobs: - name: Build uses: ./.github/actions/prepare-build - name: Swap TypeScript Resolution - run: node ./replace-typescript-resolution.mjs {{ matrix.version }} + run: | + node ./replace-typescript-resolution.mjs {{ matrix.version }} + cat package.json - name: Install Again - run: yarn --ignore-engines --ignore-scripts + run: yarn - name: Run unit tests for Node 18 run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts env: From f9b2f7550905497428dc7cd2fc57103c07de6312 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:50:15 +1000 Subject: [PATCH 31/47] There it is. a dollar --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 130fb41626df..7309e2ca065d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: uses: ./.github/actions/prepare-build - name: Swap TypeScript Resolution run: | - node ./replace-typescript-resolution.mjs {{ matrix.version }} + node ./replace-typescript-resolution.mjs ${{ matrix.version }} cat package.json - name: Install Again run: yarn From d444d5d9190fbc58bd551998e4d198e2f8690157 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 05:59:58 +1000 Subject: [PATCH 32/47] Remove the patch --- patches/typescript+5.1.3.patch | 42 ---------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 patches/typescript+5.1.3.patch diff --git a/patches/typescript+5.1.3.patch b/patches/typescript+5.1.3.patch deleted file mode 100644 index ae1a674970f5..000000000000 --- a/patches/typescript+5.1.3.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 0dae9f8..7415565 100644 ---- a/node_modules/typescript/lib/typescript.d.ts -+++ b/node_modules/typescript/lib/typescript.d.ts -@@ -370,8 +370,8 @@ declare namespace ts { - JSDocFunctionType = 323, - JSDocVariadicType = 324, - JSDocNamepathType = 325, -+ /** @deprecated This was only added in 4.7 */ - JSDoc = 326, -- /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 326, - JSDocText = 327, - JSDocTypeLiteral = 328, -@@ -4571,7 +4571,13 @@ declare namespace ts { - function symbolName(symbol: Symbol): string; - function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; - function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. -+ */ - function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. -+ */ - function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; - /** - * Gets the JSDoc parameter tags for the node if present. -@@ -5097,7 +5103,13 @@ declare namespace ts { - function isModuleName(node: Node): node is ModuleName; - function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken; - function setTextRange(range: T, location: TextRange | undefined): T; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. -+ */ - function canHaveModifiers(node: Node): node is HasModifiers; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. -+ */ - function canHaveDecorators(node: Node): node is HasDecorators; - /** - * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes From 637f78bc1a278c47c724a326c28041f94c05fc26 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 06:18:47 +1000 Subject: [PATCH 33/47] if: always, and older versions to test --- .github/workflows/ci.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7309e2ca065d..ddee39134503 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,15 +67,17 @@ jobs: version: [ '5.0.4', - '5.1.0-beta', - '5.1.1-rc', - '5.1.3', - '5.2.0-dev.20230516', - '5.2.0-dev.20230517', - '5.2.0-dev.20230520', - '5.2.0-dev.20230524', - '5.2.0-dev.20230528', - '5.2.0-dev.20230601', + '5.1.0-dev.20230418', + '5.1.0-dev.20230417', + '5.1.0-dev.20230416', + '5.1.0-dev.20230415', + '5.1.0-dev.20230414', + '5.1.0-dev.20230413', + '5.1.0-dev.20230412', + '5.1.0-dev.20230411', + '5.1.0-dev.20230410', + '5.1.0-dev.20230409', + '5.1.0-dev.20230408', ] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app @@ -99,6 +101,7 @@ jobs: - name: Install Again run: yarn - name: Run unit tests for Node 18 + if: always() run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts env: CI: true From f93940582ded878184fe0d11f0e56f0bab13e7d2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 06:33:32 +1000 Subject: [PATCH 34/47] Many more older ones --- .github/workflows/ci.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddee39134503..4cfacb98d997 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,17 +67,23 @@ jobs: version: [ '5.0.4', - '5.1.0-dev.20230418', - '5.1.0-dev.20230417', - '5.1.0-dev.20230416', - '5.1.0-dev.20230415', - '5.1.0-dev.20230414', - '5.1.0-dev.20230413', - '5.1.0-dev.20230412', - '5.1.0-dev.20230411', - '5.1.0-dev.20230410', - '5.1.0-dev.20230409', - '5.1.0-dev.20230408', + '5.1.0-dev.20230406', + '5.1.0-dev.20230404', + '5.1.0-dev.20230402', + '5.1.0-dev.20230330', + '5.1.0-dev.20230328', + '5.1.0-dev.20230326', + '5.1.0-dev.20230324', + '5.1.0-dev.20230322', + '5.1.0-dev.20230320', + '5.1.0-dev.20230318', + '5.1.0-dev.20230316', + '5.1.0-dev.20230312', + '5.1.0-dev.20230310', + '5.1.0-dev.20230308', + '5.1.0-dev.20230306', + '5.1.0-dev.20230304', + '5.1.0-dev.20230302', ] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app From 3020bf7605064afc53c4aad3a5b7f9f3c9abd90f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 07:01:04 +1000 Subject: [PATCH 35/47] eeeven older --- .github/workflows/ci.yml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cfacb98d997..9b8b0cd3ae0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,23 +67,11 @@ jobs: version: [ '5.0.4', - '5.1.0-dev.20230406', - '5.1.0-dev.20230404', - '5.1.0-dev.20230402', - '5.1.0-dev.20230330', - '5.1.0-dev.20230328', - '5.1.0-dev.20230326', - '5.1.0-dev.20230324', - '5.1.0-dev.20230322', - '5.1.0-dev.20230320', - '5.1.0-dev.20230318', - '5.1.0-dev.20230316', - '5.1.0-dev.20230312', - '5.1.0-dev.20230310', - '5.1.0-dev.20230308', - '5.1.0-dev.20230306', - '5.1.0-dev.20230304', - '5.1.0-dev.20230302', + '5.1.0-dev.20230301', + '5.1.0-dev.20230227', + '5.0.0-dev.20230226', + '5.0.0-dev.20230225', + '5.0.0-dev.20230224', ] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app From a0dc4b4c5be0a9217f9fa1bad694015581f864ea Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 07:26:21 +1000 Subject: [PATCH 36/47] patch-package to fix build --- .github/workflows/ci.yml | 1 + package.json | 2 +- packages/typescript-estree/src/convert.ts | 4 ++-- .../src/ts-estree/ts-nodes.ts | 6 +++++ patches/typescript+5.1.0-dev.20230301.patch | 22 +++++++++++++++++++ yarn.lock | 7 +++--- 6 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 patches/typescript+5.1.0-dev.20230301.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b8b0cd3ae0e..172198a27cb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,7 @@ jobs: version: [ '5.0.4', + '5.1.0-dev.20230302', '5.1.0-dev.20230301', '5.1.0-dev.20230227', '5.0.0-dev.20230226', diff --git a/package.json b/package.json index 5823e222d6df..5a72d4a2c75b 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "typescript": ">=3.3.1 <5.2.0" }, "resolutions": { - "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz", + "typescript": "5.1.0-dev.20230301", "@types/node": "^18.11.9", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 71fe614abf25..aad4848190e1 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -590,7 +590,7 @@ export class Converter { // this is intentional we can ignore conversion if `:` is in first character if (colonIndex > 0) { const range = getRange(node, this.ast); - // @ts-expect-error -- TypeScript@<5.1 doesn't have ts.JsxNamespacedName + // @ts-ignore -- -- TypeScript@<5.1 doesn't have ts.JsxNamespacedName const result = this.createNode(node, { type: AST_NODE_TYPES.JSXNamespacedName, namespace: this.createNode(node, { @@ -2574,7 +2574,7 @@ export class Converter { : undefined, initializer: this.convertChild( - // @ts-expect-error TODO breaking change remove this from the AST + // @ts-ignore -- TODO breaking change remove this from the AST node.initializer as ts.Node, ) || undefined, readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index 00beec505d3f..9134c868aefd 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -16,6 +16,12 @@ declare module 'typescript' { export interface AssertEntry extends ts.Node {} // added in TS 4.9 export interface SatisfiesExpression extends ts.Node {} + // added in TS 5.1 + export interface JsxNamespacedName extends ts.Node { + readonly kind: ts.SyntaxKind.JsxNamespacedName; + readonly name: ts.Identifier; + readonly namespace: ts.Identifier; + } /* eslint-enable @typescript-eslint/no-empty-interface */ } diff --git a/patches/typescript+5.1.0-dev.20230301.patch b/patches/typescript+5.1.0-dev.20230301.patch new file mode 100644 index 000000000000..221f60527dfe --- /dev/null +++ b/patches/typescript+5.1.0-dev.20230301.patch @@ -0,0 +1,22 @@ +diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts +index b7a1a45..14362a6 100644 +--- a/node_modules/typescript/lib/typescript.d.ts ++++ b/node_modules/typescript/lib/typescript.d.ts +@@ -43,6 +43,8 @@ declare namespace ts { + readonly end: number; + } + enum SyntaxKind { ++ JsxNamespacedName = 9001, ++ + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, +@@ -439,7 +441,7 @@ declare namespace ts { + FirstJSDocNode = 312, + LastJSDocNode = 353, + FirstJSDocTagNode = 330, +- LastJSDocTagNode = 353 ++ LastJSDocTagNode = 353, + } + type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; + type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; diff --git a/yarn.lock b/yarn.lock index cc1e6f99b729..3bb5b41f9085 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14723,9 +14723,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.2.0", "typescript@https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz", typescript@next, typescript@~4.8.4: - version "5.2.0-insiders.20230605" - resolved "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155350/artifacts?artifactName=tgz&fileId=25390837027CDB2F59440AFD227BEAC42D7474DF7E5DDBB45B82274982C27B3002&fileName=/typescript-5.2.0-insiders.20230605.tgz#4488f5f7ab8deeb1349b5b45d664ff0fcc8f432f" +typescript@*, typescript@5.1.0-dev.20230301, "typescript@>=3 < 6", "typescript@>=3.3.1 <5.2.0", typescript@next, typescript@~4.8.4: + version "5.1.0-dev.20230301" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.0-dev.20230301.tgz#3250b647dfd19942326bf904211350cdbbfdfe79" + integrity sha512-aJ0PIgQ00zlf9npD2tri7MWDAooMoh3iIn4v0hAMSRCSKqJjTzt7fVopvdtbvWPKripipxeXnX5mhkBZcGrEKQ== ua-parser-js@^0.7.30: version "0.7.31" From f6b126d7862d7ad9b837bf00daecaee3add2ecd8 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 10:59:24 +1000 Subject: [PATCH 37/47] Switch to commits with use-local-typescript-version.mjs --- .github/workflows/ci.yml | 19 ++++++--------- scratch.js | 28 ++++++++++++++++++++++ use-local-typescript-version.mjs | 41 ++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 scratch.js create mode 100644 use-local-typescript-version.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 172198a27cb1..daad7357231e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,17 +63,14 @@ jobs: strategy: fail-fast: false matrix: - package: ['typescript-estree'] - version: + commit: [ - '5.0.4', - '5.1.0-dev.20230302', - '5.1.0-dev.20230301', - '5.1.0-dev.20230227', - '5.0.0-dev.20230226', - '5.0.0-dev.20230225', - '5.0.0-dev.20230224', + 'HEAD', + 'dcc766f2b25796bea41e7118830326e8639eb7c8', + '941b30c975e6a58fbe535bbe9319412942b028f5', + '74814345ce99e939e21a82e9d311981f80c6de3a', ] + package: ['typescript-estree'] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app NX_CLOUD_ENV_NAME: 'Node 18 Testing -' @@ -91,10 +88,8 @@ jobs: uses: ./.github/actions/prepare-build - name: Swap TypeScript Resolution run: | - node ./replace-typescript-resolution.mjs ${{ matrix.version }} + node ./use-local-typescript-version.mjs ${{ matrix.commit }} cat package.json - - name: Install Again - run: yarn - name: Run unit tests for Node 18 if: always() run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts diff --git a/scratch.js b/scratch.js new file mode 100644 index 000000000000..78bb55e99f91 --- /dev/null +++ b/scratch.js @@ -0,0 +1,28 @@ +import * as execa from 'execa'; +import * as child_process from 'node:child_process'; +import * as util from 'node:util'; + +const commits = await new Promise(resolve => { + const spawned = child_process.spawn( + 'git', + ['rev-list', '74814345ce99e939e21a82e9d311981f80c6de3a..HEAD'], + { + cwd: 'typescript-local', + }, + ); + let result = ''; + + spawned.stdout.on('data', data => (result += data)); + spawned.on('exit', () => resolve(result.trim().split(/\n/))); +}); + +// Iterate through oldest commits first, checking fo +// (in theory, this should bisect... in practice, I'm tired) +for (const commit of commits.reverse()) { + console.log('\n\nTrying commit:', commit); + await execa.command(`git reset --hard ${commit}`, { + cwd: 'typescript-local', + stdio: 'inherit', + }); + // ... +} diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs new file mode 100644 index 000000000000..684e8f2b2add --- /dev/null +++ b/use-local-typescript-version.mjs @@ -0,0 +1,41 @@ +import * as execa from 'execa'; + +const commit = process.argv[2]; + +// Clear any existing typescript-local, then clone TypeScript into it +await execa.command(`rm -rf typescript-local`, { stdio: 'inherit' }); +await execa.command( + `git clone https://github.com/Microsoft/TypeScript typescript-local --depth=500`, + { stdio: 'inherit' }, +); + +// All within the typescript-local directory... +for (const command of [ + // Reset the TypeScript directory to the desired commit + `git reset --hard ${commit}`, + // Install and build up through having lib/ + 'npm i', + 'hereby', + 'hereby local', + 'hereby services', + 'cp -r built/local lib', + // Link it globally + 'yarn link', +]) { + console.log('\nRunning in typescript-local:', command); + await execa.command(command, { + cwd: 'typescript-local', + stdio: 'inherit', + }); +} + +// Link to the typescript-local version of TypeScript +for (const command of [ + 'yarn link typescript', + // TODO: Will this need to install/build? I hope not? +]) { + console.log('\nRunning:', command); + await execa.command(command, { + stdio: 'inherit', + }); +} From 54375f3010d6bd090a82a7b7124ca338f4a90c48 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 11:09:01 +1000 Subject: [PATCH 38/47] Tweaked naming, and npx hereby --- .github/workflows/ci.yml | 5 +++-- use-local-typescript-version.mjs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index daad7357231e..9a263502761d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,10 +86,11 @@ jobs: node-version: 18 - name: Build uses: ./.github/actions/prepare-build - - name: Swap TypeScript Resolution + - name: Use Local TypeScript Version run: | node ./use-local-typescript-version.mjs ${{ matrix.commit }} - cat package.json + cat typescript-local/package.json + node typescript-local/lib/tsc.js --version - name: Run unit tests for Node 18 if: always() run: npx nx test ${{ matrix.package }} --coverage=false default-program-success.test.ts diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs index 684e8f2b2add..118774d24371 100644 --- a/use-local-typescript-version.mjs +++ b/use-local-typescript-version.mjs @@ -15,9 +15,9 @@ for (const command of [ `git reset --hard ${commit}`, // Install and build up through having lib/ 'npm i', - 'hereby', - 'hereby local', - 'hereby services', + 'npx hereby', + 'npx hereby local', + 'npx hereby services', 'cp -r built/local lib', // Link it globally 'yarn link', From 44f61b3a08ec3c2a5a200208583db19dd7272db6 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 11:19:27 +1000 Subject: [PATCH 39/47] isVersionAtLeast is not working --- packages/typescript-estree/src/node-utils.ts | 3 +-- use-local-typescript-version.mjs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 4be3ae8e3739..b405aa0d2ecd 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -4,9 +4,8 @@ import { getModifiers } from './getModifiers'; import { xhtmlEntities } from './jsx/xhtml-entities'; import type { TSESTree } from './ts-estree'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from './ts-estree'; -import { typescriptVersionIsAtLeast } from './version-check'; -const isAtLeast50 = typescriptVersionIsAtLeast['5.0']; +const isAtLeast50 = false; // typescriptVersionIsAtLeast['5.0']; const SyntaxKind = ts.SyntaxKind; diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs index 118774d24371..720b5a1a814b 100644 --- a/use-local-typescript-version.mjs +++ b/use-local-typescript-version.mjs @@ -22,7 +22,7 @@ for (const command of [ // Link it globally 'yarn link', ]) { - console.log('\nRunning in typescript-local:', command); + console.log('\n\nRunning in typescript-local:', command); await execa.command(command, { cwd: 'typescript-local', stdio: 'inherit', @@ -34,7 +34,7 @@ for (const command of [ 'yarn link typescript', // TODO: Will this need to install/build? I hope not? ]) { - console.log('\nRunning:', command); + console.log('\n\nRunning:', command); await execa.command(command, { stdio: 'inherit', }); From 886a7ea67177dcefd72b19ef48387e9766986c01 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 11:32:57 +1000 Subject: [PATCH 40/47] Update commits range --- .github/workflows/ci.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a263502761d..58ca1f38cd62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,9 +66,18 @@ jobs: commit: [ 'HEAD', - 'dcc766f2b25796bea41e7118830326e8639eb7c8', - '941b30c975e6a58fbe535bbe9319412942b028f5', - '74814345ce99e939e21a82e9d311981f80c6de3a', + '4b6fb95f040c5c81743e19a56df8fa99bf3d139f', + 'd5ccec377def9ba398b097b10ceb7e351d188350', + 'b19cfc03f2cdd3b21bdec2ea1367732ef2bce937', + '40cd0de05b66bbb387db8ee6063b51959c7b6c45', + '6b71882c4caac478e612aa8ffecac7e2279380c7', + '7bee9c55b1b90a7711c8a635dfc6de102ab069fe', + '1da6d87a053746901a7eca6395a4bd15190b13c4', + '8b87de17503b15b08be40adcf3255d5d67aa2427', + '4c7e3279810318b389aa2af843ee1df897efd479', + '958487bedac2f9990387ca0f65f977a7f7c18297', + '211a60dc7931326eaaa02d3b7e2c1c20b1e6dfa3', + 'fc756ebc17295c3cb5eed18cde87835641099440', ] package: ['typescript-estree'] env: From 554716d07bd82cb8687c71efd07fbfb7d8a7ecb9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 12:44:59 +1000 Subject: [PATCH 41/47] Newer commits --- .github/workflows/ci.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58ca1f38cd62..7f3aefff918d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,18 +66,12 @@ jobs: commit: [ 'HEAD', - '4b6fb95f040c5c81743e19a56df8fa99bf3d139f', - 'd5ccec377def9ba398b097b10ceb7e351d188350', - 'b19cfc03f2cdd3b21bdec2ea1367732ef2bce937', - '40cd0de05b66bbb387db8ee6063b51959c7b6c45', - '6b71882c4caac478e612aa8ffecac7e2279380c7', - '7bee9c55b1b90a7711c8a635dfc6de102ab069fe', - '1da6d87a053746901a7eca6395a4bd15190b13c4', - '8b87de17503b15b08be40adcf3255d5d67aa2427', - '4c7e3279810318b389aa2af843ee1df897efd479', - '958487bedac2f9990387ca0f65f977a7f7c18297', - '211a60dc7931326eaaa02d3b7e2c1c20b1e6dfa3', - 'fc756ebc17295c3cb5eed18cde87835641099440', + '0e34f187c82ec725aa7dd5588c249ca3c32d999c', + '9f8a160d532386936df3b6ac78de1791bbd686bf', + '6dbec02a88156121c24a152d1e8e5e82d52fdc1d', + '9c7f43dfd86d92fb928f79f48cca0c5b05538a61', + '43cc362cef72e5fa1372f59736a9c4b55d85def0', + 'a34d5ae1ed639aa3fde7f0db0c3ae2fe24a0b513', ] package: ['typescript-estree'] env: From cd3ae665de45383b1852d252ea78a56f4c414a47 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 14:04:38 +1000 Subject: [PATCH 42/47] Newer commits --- .github/workflows/ci.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f3aefff918d..dc2a0912c87e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,12 +66,18 @@ jobs: commit: [ 'HEAD', - '0e34f187c82ec725aa7dd5588c249ca3c32d999c', - '9f8a160d532386936df3b6ac78de1791bbd686bf', - '6dbec02a88156121c24a152d1e8e5e82d52fdc1d', - '9c7f43dfd86d92fb928f79f48cca0c5b05538a61', - '43cc362cef72e5fa1372f59736a9c4b55d85def0', - 'a34d5ae1ed639aa3fde7f0db0c3ae2fe24a0b513', + '86f811440484f6a91e3d2a5ddaeb05eed8bf95cc', + '905a0b4e693e8cc13a726ad650b908fee4f75408', + 'ba42ad36467506f81a4f77d536354c4cb90c32d9', + '7f292bf2a19aa14ed69a55e646111af9533d8f1c', + '9ccf47fec5c1c87061956ac6e1446677654a4d4b', + '5a4d5e1977cc214ce3218d614a90247a9e4d2515', + 'bbb8348c257ff9d96fbbd1e371a1d97ddc81226d', + '041b0db8f4dd69a20a08ca5ec9cfb166dff46adb', + 'a8ffab2f30074b8135c978851e8bf8146dfd3239', + 'd681520a14edf78560de2b098d6d68783e2fdd8d', + '746a6feb2e7ba6987b6c72db538dd498b35cd461', + 'a6be79d535475c0062f3028afa51cabdb83d02ff', ] package: ['typescript-estree'] env: From 8eda639daea3dfbdc721fcfe45eef9f73f25db2b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 14:20:00 +1000 Subject: [PATCH 43/47] Narrow down commits more --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc2a0912c87e..c867b4bbfc60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,17 +66,17 @@ jobs: commit: [ 'HEAD', - '86f811440484f6a91e3d2a5ddaeb05eed8bf95cc', - '905a0b4e693e8cc13a726ad650b908fee4f75408', - 'ba42ad36467506f81a4f77d536354c4cb90c32d9', - '7f292bf2a19aa14ed69a55e646111af9533d8f1c', - '9ccf47fec5c1c87061956ac6e1446677654a4d4b', - '5a4d5e1977cc214ce3218d614a90247a9e4d2515', - 'bbb8348c257ff9d96fbbd1e371a1d97ddc81226d', - '041b0db8f4dd69a20a08ca5ec9cfb166dff46adb', - 'a8ffab2f30074b8135c978851e8bf8146dfd3239', - 'd681520a14edf78560de2b098d6d68783e2fdd8d', '746a6feb2e7ba6987b6c72db538dd498b35cd461', + '6e4f0a430e5b1a4d310be2ee8cc2d4d69f295b31', + 'f555ad73dbd9edbcde063fa81c12fac1de3e1269', + '137c461bd096d0c0a948fda299e56316798df8eb', + '4af97b0572ca5163813ff924d08220a65630a7be', + 'd747277edf6a9b0f2639953788f100201fe44bc4', + '88adf8014b617fb8492587941ffcf4f75986e9cc', + '3f4d16a25ed82c43d06606da3e2001efc82b58eb', + '2f229ab870c1436845d9a6b8915fd419b04c5756', + 'ff1e08f8595600625852b5b4d6c48fd2b3678cf3', + '3236ac9336b389815226bc3d65f813fc34e46e18', 'a6be79d535475c0062f3028afa51cabdb83d02ff', ] package: ['typescript-estree'] From 9093c959062761e66e4311a847e14cbfd7637e01 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 14:47:55 +1000 Subject: [PATCH 44/47] Add log to top of file --- .github/workflows/ci.yml | 7 ------- use-local-typescript-version.mjs | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c867b4bbfc60..2c87b768938e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,16 +67,9 @@ jobs: [ 'HEAD', '746a6feb2e7ba6987b6c72db538dd498b35cd461', - '6e4f0a430e5b1a4d310be2ee8cc2d4d69f295b31', - 'f555ad73dbd9edbcde063fa81c12fac1de3e1269', - '137c461bd096d0c0a948fda299e56316798df8eb', - '4af97b0572ca5163813ff924d08220a65630a7be', - 'd747277edf6a9b0f2639953788f100201fe44bc4', '88adf8014b617fb8492587941ffcf4f75986e9cc', '3f4d16a25ed82c43d06606da3e2001efc82b58eb', '2f229ab870c1436845d9a6b8915fd419b04c5756', - 'ff1e08f8595600625852b5b4d6c48fd2b3678cf3', - '3236ac9336b389815226bc3d65f813fc34e46e18', 'a6be79d535475c0062f3028afa51cabdb83d02ff', ] package: ['typescript-estree'] diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs index 720b5a1a814b..081eba86a234 100644 --- a/use-local-typescript-version.mjs +++ b/use-local-typescript-version.mjs @@ -1,4 +1,5 @@ import * as execa from 'execa'; +import * as fs from 'node:fs/promises'; const commit = process.argv[2]; @@ -29,6 +30,14 @@ for (const command of [ }); } +// Add an informative log to the top of the local file +await fs.writeFile( + [ + `console.log("Local TypeScript updated for commit: ${commit}");`, + (await fs.readFile('./typescript-local/lib/typescript.js')).toString(), + ].join('\n\n'), +); + // Link to the typescript-local version of TypeScript for (const command of [ 'yarn link typescript', From 3872d3030a38e2aac48d7ca099721d2039dfdb40 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 15:02:06 +1000 Subject: [PATCH 45/47] Write to localTypeScript --- use-local-typescript-version.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs index 081eba86a234..4427746ba31f 100644 --- a/use-local-typescript-version.mjs +++ b/use-local-typescript-version.mjs @@ -31,10 +31,12 @@ for (const command of [ } // Add an informative log to the top of the local file +const localTypeScript = './typescript-local/lib/typescript.js'; await fs.writeFile( + localTypeScript, [ `console.log("Local TypeScript updated for commit: ${commit}");`, - (await fs.readFile('./typescript-local/lib/typescript.js')).toString(), + (await fs.readFile(localTypeScript)).toString(), ].join('\n\n'), ); From 9c05c093ab5719b028561b67da3ae3a753d12b00 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 16:25:45 +1000 Subject: [PATCH 46/47] Just realized I was bisecting th ewrong way, perhaps --- .github/workflows/ci.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c87b768938e..ef01b05a00b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,11 +66,21 @@ jobs: commit: [ 'HEAD', - '746a6feb2e7ba6987b6c72db538dd498b35cd461', - '88adf8014b617fb8492587941ffcf4f75986e9cc', - '3f4d16a25ed82c43d06606da3e2001efc82b58eb', - '2f229ab870c1436845d9a6b8915fd419b04c5756', - 'a6be79d535475c0062f3028afa51cabdb83d02ff', + '0e34f187c82ec725aa7dd5588c249ca3c32d999c', + '6dbec02a88156121c24a152d1e8e5e82d52fdc1d', + '43cc362cef72e5fa1372f59736a9c4b55d85def0', + '4b6fb95f040c5c81743e19a56df8fa99bf3d139f', + '7bee9c55b1b90a7711c8a635dfc6de102ab069fe', + '1da6d87a053746901a7eca6395a4bd15190b13c4', + '8b87de17503b15b08be40adcf3255d5d67aa2427', + '4c7e3279810318b389aa2af843ee1df897efd479', + '958487bedac2f9990387ca0f65f977a7f7c18297', + '211a60dc7931326eaaa02d3b7e2c1c20b1e6dfa3', + 'fc756ebc17295c3cb5eed18cde87835641099440', + 'dcc766f2b25796bea41e7118830326e8639eb7c8', + '941b30c975e6a58fbe535bbe9319412942b028f5', + 'e2283e99b47942b863d016c65a3e430dca1549b9', + '835fff8106e0cdf2e53028cd0e2c9759b426ebb4', ] package: ['typescript-estree'] env: From cf26f7accef1f4a3ac6d16687f35647f31f799c8 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 9 Jun 2023 16:41:48 +1000 Subject: [PATCH 47/47] Thanks Jake, lkg --- use-local-typescript-version.mjs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/use-local-typescript-version.mjs b/use-local-typescript-version.mjs index 4427746ba31f..bcfdca5ac739 100644 --- a/use-local-typescript-version.mjs +++ b/use-local-typescript-version.mjs @@ -15,10 +15,8 @@ for (const command of [ // Reset the TypeScript directory to the desired commit `git reset --hard ${commit}`, // Install and build up through having lib/ - 'npm i', - 'npx hereby', - 'npx hereby local', - 'npx hereby services', + 'npm ci', + 'npx hereby lkg', 'cp -r built/local lib', // Link it globally 'yarn link', pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy