Skip to content

Commit

Permalink
rules: check-custom-hook-dependencies has better regex to match less
Browse files Browse the repository at this point in the history
The original one was inspired by the documentation and makes little sense.
  • Loading branch information
denis-sokolov committed Jul 8, 2021
1 parent fea1bfb commit 014ba7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const recommended = {
"react-hooks/exhaustive-deps": "error",
"@theorem/check-custom-hook-dependencies": [
"error",
{ additionalHooks: "(use.+(Callback|Effect|Memo))" },
{ additionalHooks: "^use.+(Callback|Effect|Memo)$" },
],
},
settings: { react: { version: "detect" } },
Expand Down
2 changes: 1 addition & 1 deletion src/rules/check-custom-hook-dependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ import rule from "./check-custom-hook-dependencies";
"function F(){ const a = useState(); useMyEffect(() => { console.log(a); }, []); }",
].forEach((code, i) =>
invalid(`check-custom-hook-dependencies invalid ${i}`, rule, code, {
ruleOptions: [{ additionalHooks: "(useMyEffect)" }],
ruleOptions: [{ additionalHooks: "^useMyEffect$" }],
})
);

0 comments on commit 014ba7b

Please sign in to comment.