From e7d93a3ba5c5050857b372804e62964318000814 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 17 Mar 2024 11:40:19 -0400 Subject: [PATCH 1/3] chore: fix ast-spec type import snapshot errors --- .../snapshots/3-Babel-AST.shot | 1 + .../snapshots/5-AST-Alignment-AST.shot | 13 +++++++------ .../type-import-type/snapshots/3-Babel-AST.shot | 2 ++ .../snapshots/5-AST-Alignment-AST.shot | 14 ++++++++------ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/3-Babel-AST.shot index 6f7e2955b89e..b4505bb0e2bb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/3-Babel-AST.shot @@ -44,6 +44,7 @@ Program { end: { column: 20, line: 3 }, }, }, + options: null, qualifier: Identifier { type: "Identifier", name: "B", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot index 7a44f8974008..aa00744ad655 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot @@ -47,24 +47,25 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete - type: 'Literal', - raw: '\\'\\'', - value: '', -+ argument: Literal { -+ type: 'Literal', -+ raw: '\\'\\'', -+ value: '', - +- - range: [91, 93], - loc: { - start: { column: 18, line: 3 }, - end: { column: 20, line: 3 }, - }, - }, -- ++ argument: Literal { ++ type: 'Literal', ++ raw: '\\'\\'', ++ value: '', + range: [91, 93], loc: { start: { column: 18, line: 3 }, end: { column: 20, line: 3 }, }, }, ++ options: null, qualifier: Identifier { type: 'Identifier', - decorators: Array [], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/3-Babel-AST.shot index 0fac83d7f207..237c1b3dcc9e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/3-Babel-AST.shot @@ -31,6 +31,7 @@ Program { end: { column: 26, line: 3 }, }, }, + options: null, range: [89, 100], loc: { @@ -77,6 +78,7 @@ Program { end: { column: 19, line: 4 }, }, }, + options: null, qualifier: Identifier { type: "Identifier", name: "X", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot index 62d99f330fd3..c6c274e6ae8e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot @@ -33,18 +33,18 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS - type: 'Literal', - raw: '\\'A\\'', - value: 'A', -+ argument: Literal { -+ type: 'Literal', -+ raw: '\\'A\\'', -+ value: 'A', - +- - range: [96, 99], - loc: { - start: { column: 23, line: 3 }, - end: { column: 26, line: 3 }, - }, - }, -- ++ argument: Literal { ++ type: 'Literal', ++ raw: '\\'A\\'', ++ value: 'A', + range: [96, 99], loc: { start: { column: 23, line: 3 }, @@ -53,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, - qualifier: null, - typeArguments: null, ++ options: null, range: [89, 100], loc: { @@ -115,6 +116,7 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS end: { column: 19, line: 4 }, }, }, ++ options: null, qualifier: Identifier { type: 'Identifier', - decorators: Array [], From 4dc18dc90b5d918b1e0f744caf5910397b58410a Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 17 Mar 2024 11:42:49 -0400 Subject: [PATCH 2/3] Also update babel packages to latest --- package.json | 10 +++++----- packages/website/package.json | 2 +- yarn.lock | 31 ++++++++++++++++++++----------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 487cdbbcdeff..1938335b416b 100644 --- a/package.json +++ b/package.json @@ -55,11 +55,11 @@ "devDependencies": { "@actions/core": "^1.10.0", "@actions/github": "^6.0.0", - "@babel/code-frame": "^7.22.13", - "@babel/core": "^7.23.3", - "@babel/eslint-parser": "^7.23.3", - "@babel/parser": "^7.23.3", - "@babel/types": "^7.23.3", + "@babel/code-frame": "^7.23.5", + "@babel/core": "^7.24.0", + "@babel/eslint-parser": "^7.23.10", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "@eslint/eslintrc": "^2.1.4", "@eslint/js": "^8.56.0", "@nx/eslint": "18.0.7", diff --git a/packages/website/package.json b/packages/website/package.json index cf9743f9f888..b9bba8f9f109 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -16,7 +16,7 @@ "typecheck": "tsc -b ./tsconfig.json" }, "dependencies": { - "@babel/runtime": "^7.22.6", + "@babel/runtime": "^7.24.0", "@docusaurus/core": "^3.1.1", "@docusaurus/plugin-client-redirects": "^3.1.1", "@docusaurus/plugin-pwa": "^3.1.1", diff --git a/yarn.lock b/yarn.lock index 23881e421bd9..8109cb78ac2f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -249,7 +249,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:*, @babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": +"@babel/code-frame@npm:*, @babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.8.3": version: 7.23.5 resolution: "@babel/code-frame@npm:7.23.5" dependencies: @@ -266,7 +266,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:*, @babel/core@npm:^7.11.1, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.19.6, @babel/core@npm:^7.23.2, @babel/core@npm:^7.23.3": +"@babel/core@npm:*, @babel/core@npm:^7.11.1, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.19.6, @babel/core@npm:^7.23.2, @babel/core@npm:^7.23.3, @babel/core@npm:^7.24.0": version: 7.24.0 resolution: "@babel/core@npm:7.24.0" dependencies: @@ -289,7 +289,7 @@ __metadata: languageName: node linkType: hard -"@babel/eslint-parser@npm:*, @babel/eslint-parser@npm:^7.23.3": +"@babel/eslint-parser@npm:*, @babel/eslint-parser@npm:^7.23.10": version: 7.23.10 resolution: "@babel/eslint-parser@npm:7.23.10" dependencies: @@ -575,7 +575,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:*, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.23.3, @babel/parser@npm:^7.24.0": +"@babel/parser@npm:*, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.7, @babel/parser@npm:^7.24.0": version: 7.24.0 resolution: "@babel/parser@npm:7.24.0" bin: @@ -1717,6 +1717,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/runtime@npm:7.24.0" + dependencies: + regenerator-runtime: ^0.14.0 + checksum: 7a6a5d40fbdd68491ec183ba2e631c07415119960083b4fd76564cce3751e9acd2f12ab89575e38496fa389fa06d458732776e69ee1858e366cc3fbdb049f847 + languageName: node + linkType: hard + "@babel/template@npm:^7.22.15, @babel/template@npm:^7.24.0, @babel/template@npm:^7.3.3": version: 7.24.0 resolution: "@babel/template@npm:7.24.0" @@ -1746,7 +1755,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.3, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.24.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.24.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.24.0 resolution: "@babel/types@npm:7.24.0" dependencies: @@ -5715,11 +5724,11 @@ __metadata: dependencies: "@actions/core": ^1.10.0 "@actions/github": ^6.0.0 - "@babel/code-frame": ^7.22.13 - "@babel/core": ^7.23.3 - "@babel/eslint-parser": ^7.23.3 - "@babel/parser": ^7.23.3 - "@babel/types": ^7.23.3 + "@babel/code-frame": ^7.23.5 + "@babel/core": ^7.24.0 + "@babel/eslint-parser": ^7.23.10 + "@babel/parser": ^7.24.0 + "@babel/types": ^7.24.0 "@eslint/eslintrc": ^2.1.4 "@eslint/js": ^8.56.0 "@nx/eslint": 18.0.7 @@ -19987,7 +19996,7 @@ __metadata: version: 0.0.0-use.local resolution: "website@workspace:packages/website" dependencies: - "@babel/runtime": ^7.22.6 + "@babel/runtime": ^7.24.0 "@docusaurus/core": ^3.1.1 "@docusaurus/module-type-aliases": ^3.1.0 "@docusaurus/plugin-client-redirects": ^3.1.1 From dc9a14ed3e9653f1153b8a6162505807a498164c Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 17 Mar 2024 11:57:09 -0400 Subject: [PATCH 3/3] chore: rename use-unknown-in-catch-callback-variable.md to .mdx --- ... => use-unknown-in-catch-callback-variable.mdx} | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename packages/eslint-plugin/docs/rules/{use-unknown-in-catch-callback-variable.md => use-unknown-in-catch-callback-variable.mdx} (95%) diff --git a/packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.md b/packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.mdx similarity index 95% rename from packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.md rename to packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.mdx index 31b5e8703601..8192950add5f 100644 --- a/packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.md +++ b/packages/eslint-plugin/docs/rules/use-unknown-in-catch-callback-variable.mdx @@ -2,15 +2,17 @@ description: 'Enforce typing arguments in `.catch()` callbacks as `unknown`.' --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + > 🛑 This file is source code, not the primary documentation location! 🛑 > > See **https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable** for documentation. This rule enforces that you always use the `unknown` type for the parameter of a `Promise.prototype.catch()` callback. - - -### ❌ Incorrect + + ```ts Promise.reject(new Error('I will reject!')).catch(err => { @@ -26,7 +28,8 @@ Promise.reject(new Error('I will reject!')).catch((err: Error) => { }); ``` -### ✅ Correct + + ```ts Promise.reject(new Error('I will reject!')).catch((err: unknown) => { @@ -34,7 +37,8 @@ Promise.reject(new Error('I will reject!')).catch((err: unknown) => { }); ``` - + + The reason for this rule is to enable programmers to impose constraints on `Promise` error handling analogously to what TypeScript provides for ordinary exception handling.