Skip to content

Commit

Permalink
apply prettier suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gnowland committed May 29, 2022
1 parent 98df102 commit 08edbed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 6 additions & 4 deletions packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export default {
: undefined;

const avoidObjects =
context.options &&
context.options[0] &&
context.options[0].avoidObjects;
context.options && context.options[0] && context.options[0].avoidObjects;

const enableDangerousAutofixThisMayCauseInfiniteLoops =
(context.options &&
Expand Down Expand Up @@ -632,7 +630,11 @@ export default {
return;
}
// If we see an object then add a special warning if the avoidObjects option is true.
if (declaredDependencyNode.type === 'Identifier' && options && options.avoidObjects) {
if (
declaredDependencyNode.type === 'Identifier' &&
options &&
options.avoidObjects
) {
reportProblem({
node: declaredDependencyNode,
message:
Expand Down
9 changes: 6 additions & 3 deletions packages/eslint-plugin-react-hooks/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export const configs = {
plugins: ['react-hooks'],
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': ['warn', {
'avoidObjects': true,
}],
'react-hooks/exhaustive-deps': [
'warn',
{
avoidObjects: true,
},
],
},
},
};
Expand Down

0 comments on commit 08edbed

Please sign in to comment.