Skip to content

Commit 6ee3687

Browse files
authored
Fix expiring-todo-comments (#2077)
1 parent 0c3ccb1 commit 6ee3687

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"c8": "^7.13.0",
7474
"chalk": "^5.2.0",
7575
"enquirer": "^2.3.6",
76-
"eslint": "^8.38.0",
76+
"eslint": "^8.40.0",
7777
"eslint-ava-rule-tester": "^4.0.0",
7878
"eslint-doc-generator": "^1.4.3",
7979
"eslint-plugin-eslint-plugin": "^5.0.8",
@@ -118,6 +118,7 @@
118118
"test/integration/{fixtures,fixtures-local}/**"
119119
],
120120
"rules": {
121+
"unicorn/expiring-todo-comments": "off",
121122
"unicorn/no-null": "error",
122123
"unicorn/prefer-array-flat": [
123124
"error",

rules/expiring-todo-comments.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,11 @@ const create = context => {
286286
// Since we have priority, we leave only the comments that we didn't use.
287287
const fakeContext = {
288288
...context,
289-
getSourceCode() {
290-
return {
291-
...sourceCode,
292-
getAllComments() {
293-
return options.allowWarningComments ? [] : unusedComments;
294-
},
295-
};
289+
sourceCode: {
290+
...sourceCode,
291+
getAllComments: () => options.allowWarningComments ? [] : unusedComments,
296292
},
293+
getSourceCode: () => fakeContext.sourceCode,
297294
};
298295
const rules = baseRule.create(fakeContext);
299296

0 commit comments

Comments
 (0)