Skip to content

Commit

Permalink
Clearer wording
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Mar 6, 2019
1 parent 0623288 commit 8ff6aaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,12 @@ const tests = {
}
`,
errors: [
"React Hook useMemo doesn't serve any purpose without a dependency array as a second argument.",
"React Hook useCallback doesn't serve any purpose without a dependency array as a second argument.",
"React Hook useMemo doesn't serve any purpose without a dependency array. " +
'To enable this optimization, pass an array of values used by the inner ' +
'function as the second argument to useMemo.',
"React Hook useCallback doesn't serve any purpose without a dependency array. " +
'To enable this optimization, pass an array of values used by the inner ' +
'function as the second argument to useCallback.',
],
},
{
Expand Down
6 changes: 4 additions & 2 deletions packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ export default {
reactiveHookName === 'useCallback'
) {
context.report({
node: node,
node: node.parent.callee,
message:
`React Hook ${reactiveHookName} doesn't serve any purpose ` +
`without a dependency array as a second argument.`,
`without a dependency array. To enable ` +
`this optimization, pass an array of values used by the ` +
`inner function as the second argument to ${reactiveHookName}.`,
});
}
return;
Expand Down

0 comments on commit 8ff6aaf

Please sign in to comment.