Skip to content

Commit

Permalink
Fix expiring-todo-comments (#2077)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker authored May 6, 2023
1 parent 0c3ccb1 commit 6ee3687
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -118,6 +118,7 @@
"test/integration/{fixtures,fixtures-local}/**"
],
"rules": {
"unicorn/expiring-todo-comments": "off",
"unicorn/no-null": "error",
"unicorn/prefer-array-flat": [
"error",
Expand Down
11 changes: 4 additions & 7 deletions rules/expiring-todo-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,11 @@ const create = context => {
// Since we have priority, we leave only the comments that we didn't use.
const fakeContext = {
...context,
getSourceCode() {
return {
...sourceCode,
getAllComments() {
return options.allowWarningComments ? [] : unusedComments;
},
};
sourceCode: {
...sourceCode,
getAllComments: () => options.allowWarningComments ? [] : unusedComments,
},
getSourceCode: () => fakeContext.sourceCode,
};
const rules = baseRule.create(fakeContext);

Expand Down

0 comments on commit 6ee3687

Please sign in to comment.