From faea3ff8b4d750974c41262b44db314f20d0c99c Mon Sep 17 00:00:00 2001 From: Ruslan Baigunussov Date: Wed, 28 Jun 2023 04:00:40 +0300 Subject: [PATCH 1/5] feat: use graphemer instead of grapheme-splitter (#7069) --- packages/eslint-plugin/package.json | 3 +-- packages/eslint-plugin/src/util/getStringLength.ts | 6 +++--- yarn.lock | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 9443b529a33e..e7a605cbf5a7 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -49,7 +49,7 @@ "@typescript-eslint/type-utils": "5.60.1", "@typescript-eslint/utils": "5.60.1", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", "semver": "^7.3.7", @@ -63,7 +63,6 @@ "@types/prettier": "*", "chalk": "^5.0.1", "cross-fetch": "^3.1.5", - "grapheme-splitter": "^1.0.4", "json-schema": "*", "markdown-table": "^3.0.2", "marked": "^4.0.15", diff --git a/packages/eslint-plugin/src/util/getStringLength.ts b/packages/eslint-plugin/src/util/getStringLength.ts index 65a22551949a..6bec9f4e1adc 100644 --- a/packages/eslint-plugin/src/util/getStringLength.ts +++ b/packages/eslint-plugin/src/util/getStringLength.ts @@ -1,6 +1,6 @@ -import GraphemeSplitter from 'grapheme-splitter'; +import Graphemer from 'graphemer'; -let splitter: GraphemeSplitter; +let splitter: Graphemer; function isASCII(value: string): boolean { return /^[\u0020-\u007f]*$/u.test(value); @@ -11,7 +11,7 @@ export function getStringLength(value: string): number { return value.length; } - splitter ??= new GraphemeSplitter(); + splitter ??= new Graphemer(); return splitter.countGraphemes(value); } diff --git a/yarn.lock b/yarn.lock index cde29eb04f36..4b2848083d41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8343,6 +8343,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + gray-matter@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798" From 997783ff108ca18af709667ef3fdfa7134a8eefe Mon Sep 17 00:00:00 2001 From: Nils Haberkamp Date: Wed, 28 Jun 2023 18:26:58 +0200 Subject: [PATCH 2/5] feat(eslint-plugin): [ban-types] ban types in extends and implements (#7129) * test(eslint-plugin): add test for banning types when using intersections * feat(eslint-plugin): ban certain types to be extended from --- packages/eslint-plugin/src/rules/ban-types.ts | 6 ++ .../tests/rules/ban-types.test.ts | 75 +++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 9e7d9f69f4ba..21a1d1c1403d 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -260,6 +260,12 @@ export default util.createRule({ checkBannedTypes(node); } }, + TSInterfaceHeritage(node): void { + checkBannedTypes(node); + }, + TSClassImplements(node): void { + checkBannedTypes(node); + }, }; }, }); diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index 831d17a59a16..5f22d9e40814 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -657,6 +657,81 @@ let baz: object = {}; }, ], }, + { + code: 'type Baz = 1 & Foo;', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Foo: { message: '' }, + }, + }, + ], + }, + { + code: 'interface Foo extends Bar {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'interface Foo extends Bar, Baz {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'class Foo implements Bar {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'class Foo implements Bar, Baz {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: 'Bla' }, + }, + }, + ], + }, ...objectReduceKey( TYPE_KEYWORDS, (acc: TSESLint.InvalidTestCase[], key) => { From 97abdbc40df62f90a6a0c81d4931d223e0549a1c Mon Sep 17 00:00:00 2001 From: "typescript-eslint[bot]" <53356952+typescript-eslint[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 10:51:54 -0700 Subject: [PATCH 3/5] chore: update sponsors (#7132) Co-authored-by: typescript-eslint[bot] --- packages/website/data/sponsors.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index c4a4515bcc2e..3178ef235c04 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -200,7 +200,7 @@ "image": "https://images.opencollective.com/thepadding/55e79ad/logo.png", "name": "THE PADDING", "totalDonations": 12000, - "website": "https://paddn.com/%e9%a6%99%e6%b8%af%e7%b6%b2%e9%a0%81%e8%a8%ad%e8%a8%88%e5%85%ac%e5%8f%b8/" + "website": "https://paddn.com/" }, { "id": "Corellium", From 4bf2d7360eaf74c9ef87b196ff4c459b8f50800b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 30 Jun 2023 16:21:40 -0700 Subject: [PATCH 4/5] feat: support TypeScript 5.1 (#7088) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: support TypeScript 5.1 * Re-apply patch-package typescript * jsx: preserve in ast-spec * Added component-dashed fixture * Rename to avoid global naming conflict * chore: only run website tests on non-forks * chore: only run website tests on non-forks * Updated ast-spec snapshots * Let's try --runInBand * How about some logging * --verbose * Skip parse.moduleResolver.+ tests in Node 14 * map of undefined * more logging on process version * Remove jest.config.js shenanigans * Remove --frozen-lockfile for now * Mention ts version in jest.config.js * Split placeholder-error in twain * Try a .skip * Revert "Try a .skip" This reverts commit 0b4eb193e7886fcbb4d6106265dc3ddc540c1c1e. * Heck, let's try Node 20 * Revert "Heck, let's try Node 20" This reverts commit c6f949bbafd25da94bced061abd8e175989fa1d6. * skipLibCheck and strict * Undid some changes, for 5.1.3 again * Used new resolution courtesy of Jake * Corrected TypeScript patching and resolution * Fix packages/website/tsconfig.json module * 5.1.6 * Recreated patch-package typescript --------- Co-authored-by: “JamesHenry” --- .github/workflows/ci.yml | 2 + .prettierignore | 4 + docs/users/Dependency_Versions.mdx | 2 +- package.json | 5 +- .../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 +++++++ .../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 ++++++++++++++++++ .../tests/fixtures-with-differences-ast.shot | 1 + .../fixtures-with-differences-tokens.shot | 2 + packages/ast-spec/tsconfig.build.json | 1 + packages/eslint-plugin-tslint/package.json | 1 - .../fixtures/jsx/namespaced-attribute.tsx | 13 + .../jsx/namespaced-attribute.tsx.shot | 203 ++++++ packages/typescript-estree/jest.config.js | 5 +- packages/typescript-estree/package.json | 2 +- 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 + .../fixtures/simpleProject/tsconfig.json | 7 +- ...duleResolver.default-program-error.test.ts | 8 + ...leResolver.default-program-success.test.ts | 8 + ...olver.placeholder-error-not-found.test.ts} | 19 +- ...ver.placeholder-error-not-resolved.test.ts | 33 + ...moduleResolver.placeholder-success.test.ts | 6 + packages/website/tsconfig.json | 2 +- ...ipt+5.0.2.patch => typescript+5.1.6.patch} | 22 +- yarn.lock | 10 +- 39 files changed, 4469 insertions(+), 41 deletions(-) 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 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 packages/typescript-estree/tests/lib/{parse.moduleResolver.placeholder-error.test.ts => parse.moduleResolver.placeholder-error-not-found.test.ts} (71%) create mode 100644 packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error-not-resolved.test.ts rename patches/{typescript+5.0.2.patch => typescript+5.1.6.patch} (83%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e62a6055620..19d8514324ef 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_owner == 'typescript-eslint' permissions: contents: read # to fetch code (actions/checkout) 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/users/Dependency_Versions.mdx b/docs/users/Dependency_Versions.mdx index a00e56d0bbf3..406ec999eebc 100644 --- a/docs/users/Dependency_Versions.mdx +++ b/docs/users/Dependency_Versions.mdx @@ -16,7 +16,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 98817b16e6cd..113c4ccfe5a0 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": "5.1.6" }, "resolutions": { - "typescript": "~5.0.2", + "typescript": "5.1.6", "@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-dashed/fixture.tsx b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx new file mode 100644 index 000000000000..ae10e30c0b1a --- /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 componentDashed = ; 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..89265a3c778b --- /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: "componentDashed", + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, 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: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + + range: [115, 130], + loc: { + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + selfClosing: true, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [96, 133], + loc: { + start: { column: 6, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + ], + kind: "const", + + range: [90, 134], + loc: { + start: { column: 0, line: 7 }, + end: { column: 44, line: 7 }, + }, + }, + ], + sourceType: "script", + + 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 new file mode 100644 index 000000000000..c416578b7093 --- /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: "componentDashed", + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [112, 113], + loc: { + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [114, 115], + loc: { + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo-bar", + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [122, 123], + loc: { + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz-bam", + + range: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [131, 132], + loc: { + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [132, 133], + loc: { + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [133, 134], + loc: { + 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 new file mode 100644 index 000000000000..0425d143c1b1 --- /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: "componentDashed", + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, 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: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + + range: [115, 130], + loc: { + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + selfClosing: true, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [96, 133], + loc: { + start: { column: 6, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + ], + kind: "const", + + range: [90, 134], + loc: { + start: { column: 0, line: 7 }, + end: { column: 44, line: 7 }, + }, + }, + ], + sourceType: "script", + + 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 new file mode 100644 index 000000000000..fba5e9f5f99f --- /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: "componentDashed", + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [112, 113], + loc: { + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [114, 115], + loc: { + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "foo-bar", + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [122, 123], + loc: { + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "baz-bam", + + range: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [131, 132], + loc: { + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [132, 133], + loc: { + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [133, 134], + loc: { + 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 new file mode 100644 index 000000000000..9283b97b78d3 --- /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: 'componentDashed', + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, 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: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + namespace: JSXIdentifier { + type: 'JSXIdentifier', + name: 'foo-bar', + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + + range: [115, 130], + loc: { + start: { column: 25, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + selfClosing: true, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [114, 133], + loc: { + start: { column: 24, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + + range: [96, 133], + loc: { + start: { column: 6, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + ], + kind: 'const', + + range: [90, 134], + loc: { + start: { column: 0, line: 7 }, + end: { column: 44, line: 7 }, + }, + }, + ], + sourceType: 'script', + + 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 new file mode 100644 index 000000000000..dcc68e747bcc --- /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: 'componentDashed', + + range: [96, 111], + loc: { + start: { column: 6, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [112, 113], + loc: { + start: { column: 22, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [114, 115], + loc: { + start: { column: 24, line: 7 }, + end: { column: 25, line: 7 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'foo-bar', + + range: [115, 122], + loc: { + start: { column: 25, line: 7 }, + end: { column: 32, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [122, 123], + loc: { + start: { column: 32, line: 7 }, + end: { column: 33, line: 7 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'baz-bam', + + range: [123, 130], + loc: { + start: { column: 33, line: 7 }, + end: { column: 40, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [131, 132], + loc: { + start: { column: 41, line: 7 }, + end: { column: 42, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [132, 133], + loc: { + start: { column: 42, line: 7 }, + end: { column: 43, line: 7 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [133, 134], + loc: { + start: { column: 43, line: 7 }, + end: { column: 44, line: 7 }, + }, + }, + ]" +`; 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-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 5ee1a88d62e2..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,8 @@ 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", "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", 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 diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 5ef1961afb3e..d98d2a12edf9 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.60.1" } } 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/jest.config.js b/packages/typescript-estree/jest.config.js index 43f847a6fbfe..bc89e516afa2 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -1,6 +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'), diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 33cb8cf726ec..d74436f29586 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 --verbose", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { 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/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json index 0967ef424bce..d4629f1f2798 100644 --- a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json @@ -1 +1,6 @@ -{} +{ + "compilerOptions": { + "skipLibCheck": true, + "strict": true + } +} 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-not-found.test.ts similarity index 71% 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 699c88f0f235..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,26 +3,23 @@ import { resolve } from 'path'; import * as parser from '../../src'; import { createAndPrepareParseConfig } from '../../tools/test-utils'; +console.log( + 'Start of file: parse.moduleResolver.placeholder-error-not-found.test.ts', +); + beforeEach(() => { jest.clearAllMocks(); }); describe('parseAndGenerateServices', () => { + console.log( + '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.", + ); + }); + }); + }); +}); 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(); diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json index 297113e1b17d..180442ef93a5 100644 --- a/packages/website/tsconfig.json +++ b/packages/website/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "CommonJS", + "module": "NodeNext", "moduleResolution": "NodeNext", "allowJs": true, "esModuleInterop": true, diff --git a/patches/typescript+5.0.2.patch b/patches/typescript+5.1.6.patch similarity index 83% rename from patches/typescript+5.0.2.patch rename to patches/typescript+5.1.6.patch index 4f4c95641d28..6f8abfb6f42b 100644 --- a/patches/typescript+5.0.2.patch +++ b/patches/typescript+5.1.6.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 ff7896e..17a56d3 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, +@@ -4570,7 +4570,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 { +@@ -5096,7 +5102,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; diff --git a/yarn.lock b/yarn.lock index 4b2848083d41..71aafa4d5ca5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4209,7 +4209,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== @@ -14528,10 +14528,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@5.1.6, "typescript@>=3 < 6", typescript@next, typescript@~4.8.4: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== ua-parser-js@^0.7.30: version "0.7.31" From 2f46341a14ca6f05334301315bc54dd20129c408 Mon Sep 17 00:00:00 2001 From: "typescript-eslint[bot]" Date: Mon, 3 Jul 2023 17:17:37 +0000 Subject: [PATCH 5/5] chore: publish v5.61.0 --- CHANGELOG.md | 15 +++++++++++++++ lerna.json | 2 +- packages/ast-spec/CHANGELOG.md | 13 +++++++++++++ packages/ast-spec/package.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 10 ++++++++++ packages/eslint-plugin-internal/package.json | 8 ++++---- packages/eslint-plugin-tslint/CHANGELOG.md | 13 +++++++++++++ packages/eslint-plugin-tslint/package.json | 6 +++--- packages/eslint-plugin/CHANGELOG.md | 14 ++++++++++++++ packages/eslint-plugin/package.json | 8 ++++---- packages/experimental-utils/CHANGELOG.md | 10 ++++++++++ packages/experimental-utils/package.json | 4 ++-- packages/parser/CHANGELOG.md | 10 ++++++++++ packages/parser/package.json | 8 ++++---- packages/scope-manager/CHANGELOG.md | 13 +++++++++++++ packages/scope-manager/package.json | 8 ++++---- packages/type-utils/CHANGELOG.md | 10 ++++++++++ packages/type-utils/package.json | 8 ++++---- packages/types/CHANGELOG.md | 10 ++++++++++ packages/types/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 13 +++++++++++++ packages/typescript-estree/package.json | 6 +++--- packages/utils/CHANGELOG.md | 10 ++++++++++ packages/utils/package.json | 10 +++++----- packages/visitor-keys/CHANGELOG.md | 10 ++++++++++ packages/visitor-keys/package.json | 4 ++-- packages/website-eslint/CHANGELOG.md | 10 ++++++++++ packages/website-eslint/package.json | 16 ++++++++-------- packages/website/CHANGELOG.md | 13 +++++++++++++ packages/website/package.json | 8 ++++---- 30 files changed, 224 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a91011dc5cd8..84a0db9e7122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,21 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* **eslint-plugin:** [ban-types] ban types in extends and implements ([#7129](https://github.com/typescript-eslint/typescript-eslint/issues/7129)) ([997783f](https://github.com/typescript-eslint/typescript-eslint/commit/997783ff108ca18af709667ef3fdfa7134a8eefe)) +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) +* use graphemer instead of grapheme-splitter ([#7069](https://github.com/typescript-eslint/typescript-eslint/issues/7069)) ([faea3ff](https://github.com/typescript-eslint/typescript-eslint/commit/faea3ff8b4d750974c41262b44db314f20d0c99c)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/typescript-eslint diff --git a/lerna.json b/lerna.json index e6a48b8a8566..7b2154c88bcf 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "5.60.1", + "version": "5.61.0", "npmClient": "yarn", "stream": true, "command": { diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index d96ea1163087..bd095f9ba6be 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/ast-spec diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index de10c92a6536..a119885892d2 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.60.1", + "version": "5.61.0", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 45ad46436a96..a00facaa19d9 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index a903d087ae4e..8bfc70c6bcfa 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "5.60.1", + "version": "5.61.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,9 +14,9 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.60.1", - "@typescript-eslint/type-utils": "5.60.1", - "@typescript-eslint/utils": "5.60.1", + "@typescript-eslint/scope-manager": "5.61.0", + "@typescript-eslint/type-utils": "5.61.0", + "@typescript-eslint/utils": "5.61.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index fcc0e44c59e3..929225f47fc8 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index d98d2a12edf9..ac1a59d8a31d 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "5.60.1", + "version": "5.61.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.60.1" + "@typescript-eslint/utils": "5.61.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0", @@ -46,6 +46,6 @@ "typescript": "*" }, "devDependencies": { - "@typescript-eslint/parser": "5.60.1" + "@typescript-eslint/parser": "5.61.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index a945de556255..62aea3a99f69 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* **eslint-plugin:** [ban-types] ban types in extends and implements ([#7129](https://github.com/typescript-eslint/typescript-eslint/issues/7129)) ([997783f](https://github.com/typescript-eslint/typescript-eslint/commit/997783ff108ca18af709667ef3fdfa7134a8eefe)) +* use graphemer instead of grapheme-splitter ([#7069](https://github.com/typescript-eslint/typescript-eslint/issues/7069)) ([faea3ff](https://github.com/typescript-eslint/typescript-eslint/commit/faea3ff8b4d750974c41262b44db314f20d0c99c)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/eslint-plugin diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e7a605cbf5a7..43c0c16f5fc3 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.60.1", + "version": "5.61.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -45,9 +45,9 @@ }, "dependencies": { "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.60.1", - "@typescript-eslint/type-utils": "5.60.1", - "@typescript-eslint/utils": "5.60.1", + "@typescript-eslint/scope-manager": "5.61.0", + "@typescript-eslint/type-utils": "5.61.0", + "@typescript-eslint/utils": "5.61.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.0", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index d838f359a648..5ceb3e6e54b7 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 0d0c71ac1a76..14585845e8a2 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "5.60.1", + "version": "5.61.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.60.1" + "@typescript-eslint/utils": "5.61.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index ff82c7926ecc..917a2c1ef45b 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/parser + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 0b1a28ebaa93..9b2202b3ca84 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "5.60.1", + "version": "5.61.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -45,9 +45,9 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.60.1", - "@typescript-eslint/types": "5.60.1", - "@typescript-eslint/typescript-estree": "5.60.1", + "@typescript-eslint/scope-manager": "5.61.0", + "@typescript-eslint/types": "5.61.0", + "@typescript-eslint/typescript-estree": "5.61.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index a9034ee4bbc6..c5d2e7ac603b 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index d372820e4856..4e12bdf55cb2 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.60.1", + "version": "5.61.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -38,12 +38,12 @@ "typecheck": "nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "5.60.1", - "@typescript-eslint/visitor-keys": "5.60.1" + "@typescript-eslint/types": "5.61.0", + "@typescript-eslint/visitor-keys": "5.61.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.60.1", + "@typescript-eslint/typescript-estree": "5.61.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index 1f3b9a003027..f3b880234180 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/type-utils diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 0eb7fabf0f1d..f371908c4551 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.60.1", + "version": "5.61.0", "description": "Type utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -39,13 +39,13 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "5.60.1", - "@typescript-eslint/utils": "5.60.1", + "@typescript-eslint/typescript-estree": "5.61.0", + "@typescript-eslint/utils": "5.61.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.60.1", + "@typescript-eslint/parser": "5.61.0", "typescript": "*" }, "peerDependencies": { diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index fe6ea262e784..77ff49f22c87 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/types + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/types diff --git a/packages/types/package.json b/packages/types/package.json index 30b4dadb60c3..75e4c7d15523 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "5.60.1", + "version": "5.61.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 2fb5107d8a8e..3c2b62545521 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index d74436f29586..fa94bfd5135e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.60.1", + "version": "5.61.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -42,8 +42,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.60.1", - "@typescript-eslint/visitor-keys": "5.60.1", + "@typescript-eslint/types": "5.61.0", + "@typescript-eslint/visitor-keys": "5.61.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 38be45080bde..a9743a05b3f4 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/utils diff --git a/packages/utils/package.json b/packages/utils/package.json index 6374e7997eb6..bed1f5ffaa32 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "5.60.1", + "version": "5.61.0", "description": "Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -42,9 +42,9 @@ "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.60.1", - "@typescript-eslint/types": "5.60.1", - "@typescript-eslint/typescript-estree": "5.60.1", + "@typescript-eslint/scope-manager": "5.61.0", + "@typescript-eslint/types": "5.61.0", + "@typescript-eslint/typescript-estree": "5.61.0", "eslint-scope": "^5.1.1", "semver": "^7.3.7" }, @@ -52,7 +52,7 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.60.1", + "@typescript-eslint/parser": "5.61.0", "typescript": "*" }, "funding": { diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index ca1b9bff1550..5766ea04c91e 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 2626ce4549ea..653d9fc9e05f 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.60.1", + "version": "5.61.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -39,7 +39,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.60.1", + "@typescript-eslint/types": "5.61.0", "eslint-visitor-keys": "^3.3.0" }, "devDependencies": { diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index b9a478531076..9a83ec6c2042 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index ac6647fbd3b6..833aabc70a09 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.60.1", + "version": "5.61.0", "private": true, "description": "ESLint which works in browsers.", "engines": { @@ -16,8 +16,8 @@ "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore" }, "dependencies": { - "@typescript-eslint/types": "5.60.1", - "@typescript-eslint/utils": "5.60.1" + "@typescript-eslint/types": "5.61.0", + "@typescript-eslint/utils": "5.61.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^23.0.0", @@ -25,11 +25,11 @@ "@rollup/plugin-node-resolve": "^15.0.0", "@rollup/plugin-terser": "^0.4.0", "@rollup/pluginutils": "^5.0.0", - "@typescript-eslint/eslint-plugin": "5.60.1", - "@typescript-eslint/parser": "5.60.1", - "@typescript-eslint/scope-manager": "5.60.1", - "@typescript-eslint/typescript-estree": "5.60.1", - "@typescript-eslint/visitor-keys": "5.60.1", + "@typescript-eslint/eslint-plugin": "5.61.0", + "@typescript-eslint/parser": "5.61.0", + "@typescript-eslint/scope-manager": "5.61.0", + "@typescript-eslint/typescript-estree": "5.61.0", + "@typescript-eslint/visitor-keys": "5.61.0", "eslint": "*", "esquery": "*", "rollup": "^2.75.4", diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index c75eb88b564b..54ef13d50acc 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + ## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package website diff --git a/packages/website/package.json b/packages/website/package.json index d75c66c0b9e3..8fac14064c4d 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "website", - "version": "5.60.1", + "version": "5.61.0", "private": true, "scripts": { "build": "docusaurus build", @@ -21,8 +21,8 @@ "@docusaurus/remark-plugin-npm2yarn": "~2.4.0", "@docusaurus/theme-common": "~2.4.0", "@mdx-js/react": "1.6.22", - "@typescript-eslint/parser": "5.60.1", - "@typescript-eslint/website-eslint": "5.60.1", + "@typescript-eslint/parser": "5.61.0", + "@typescript-eslint/website-eslint": "5.61.0", "clsx": "^1.1.1", "eslint": "*", "json-schema": "^0.4.0", @@ -49,7 +49,7 @@ "@types/react": "^18.0.9", "@types/react-helmet": "^6.1.5", "@types/react-router-dom": "^5.3.3", - "@typescript-eslint/eslint-plugin": "5.60.1", + "@typescript-eslint/eslint-plugin": "5.61.0", "copy-webpack-plugin": "^11.0.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.29.4", 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