From 00c4bd9884e4979e29f35f4daaad76aadc41adb3 Mon Sep 17 00:00:00 2001 From: auvred Date: Wed, 29 Nov 2023 11:57:50 +0000 Subject: [PATCH 1/2] docs(eslint-plugin): [no-throw-literal] fix typo in example --- packages/eslint-plugin/docs/rules/no-throw-literal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-throw-literal.md b/packages/eslint-plugin/docs/rules/no-throw-literal.md index f4d189067b96..b85280f381c1 100644 --- a/packages/eslint-plugin/docs/rules/no-throw-literal.md +++ b/packages/eslint-plugin/docs/rules/no-throw-literal.md @@ -77,7 +77,7 @@ function err() { throw err(); const foo = { - bar: new Error(); + bar: new Error(), } throw foo.bar; From ccfe4eda40736e543268fbe456554dc27887e4a0 Mon Sep 17 00:00:00 2001 From: auvred Date: Wed, 29 Nov 2023 12:05:55 +0000 Subject: [PATCH 2/2] chore: format + rm eslint comments --- .../eslint-plugin/docs/rules/no-throw-literal.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/no-throw-literal.md b/packages/eslint-plugin/docs/rules/no-throw-literal.md index b85280f381c1..7f5f9c8fe619 100644 --- a/packages/eslint-plugin/docs/rules/no-throw-literal.md +++ b/packages/eslint-plugin/docs/rules/no-throw-literal.md @@ -20,8 +20,6 @@ This rule is aimed at maintaining consistency when throwing exception by disallo ### ❌ Incorrect ```ts -/*eslint @typescript-eslint/no-throw-literal: "error"*/ - throw 'error'; throw 0; @@ -53,19 +51,17 @@ throw foo.bar; ### ✅ Correct ```ts -/*eslint @typescript-eslint/no-throw-literal: "error"*/ - throw new Error(); -throw new Error("error"); +throw new Error('error'); -const e = new Error("error"); +const e = new Error('error'); throw e; try { - throw new Error("error"); + throw new Error('error'); } catch (e) { - throw e; + throw e; } const err = new Error(); @@ -78,12 +74,12 @@ throw err(); const foo = { bar: new Error(), -} +}; throw foo.bar; class CustomError extends Error { // ... -}; +} throw new CustomError(); ```