From 961a07618327a90f48e9187acbc9a9b7cabc3151 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 6 May 2023 09:32:00 +0800 Subject: [PATCH 1/4] Update eslint to v8.40.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f73e358753..e809494aff 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "c8": "^7.13.0", "chalk": "^5.2.0", "enquirer": "^2.3.6", - "eslint": "^8.38.0", + "eslint": "^8.40.0", "eslint-ava-rule-tester": "^4.0.0", "eslint-doc-generator": "^1.4.3", "eslint-plugin-eslint-plugin": "^5.0.8", From f54afb874fe8f8d0c176a1901932a27820ab587d Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 6 May 2023 09:48:50 +0800 Subject: [PATCH 2/4] Fix rule --- rules/expiring-todo-comments.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rules/expiring-todo-comments.js b/rules/expiring-todo-comments.js index 72b44e4360..36cf0c5c4d 100644 --- a/rules/expiring-todo-comments.js +++ b/rules/expiring-todo-comments.js @@ -284,15 +284,15 @@ const create = context => { // This is highly dependable on ESLint's `no-warning-comments` implementation. // What we do is patch the parts we know the rule will use, `getAllComments`. // Since we have priority, we leave only the comments that we didn't use. + const fakeSourceCode = { + ...sourceCode, + getAllComments: () => options.allowWarningComments ? [] : unusedComments, + }; const fakeContext = { ...context, + sourceCode: fakeSourceCode, getSourceCode() { - return { - ...sourceCode, - getAllComments() { - return options.allowWarningComments ? [] : unusedComments; - }, - }; + return fakeSourceCode; }, }; const rules = baseRule.create(fakeContext); From e6cbdd3d269f79af03733a6738d9201931effe84 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 6 May 2023 09:54:05 +0800 Subject: [PATCH 3/4] Minor tweak --- rules/expiring-todo-comments.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/rules/expiring-todo-comments.js b/rules/expiring-todo-comments.js index 36cf0c5c4d..657eb63adc 100644 --- a/rules/expiring-todo-comments.js +++ b/rules/expiring-todo-comments.js @@ -284,16 +284,13 @@ const create = context => { // This is highly dependable on ESLint's `no-warning-comments` implementation. // What we do is patch the parts we know the rule will use, `getAllComments`. // Since we have priority, we leave only the comments that we didn't use. - const fakeSourceCode = { - ...sourceCode, - getAllComments: () => options.allowWarningComments ? [] : unusedComments, - }; const fakeContext = { ...context, - sourceCode: fakeSourceCode, - getSourceCode() { - return fakeSourceCode; + sourceCode: { + ...sourceCode, + getAllComments: () => options.allowWarningComments ? [] : unusedComments, }, + getSourceCode: () => fakeContext.sourceCode, }; const rules = baseRule.create(fakeContext); From a1eda987900b662963cc48dad3f285b5b1d157c8 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 6 May 2023 10:00:36 +0800 Subject: [PATCH 4/4] Turn off `expiring-todo-comments` --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e809494aff..50933c5ef0 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,7 @@ "test/integration/{fixtures,fixtures-local}/**" ], "rules": { + "unicorn/expiring-todo-comments": "off", "unicorn/no-null": "error", "unicorn/prefer-array-flat": [ "error",