Skip to content

Commit

Permalink
add test case for #18819
Browse files Browse the repository at this point in the history
  • Loading branch information
coolkev committed May 4, 2020
1 parent 40380f2 commit d48edf0
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,38 @@ const tests = {
},
],
},
{
code: normalizeIndent`
function MyComponent({ history }) {
useEffect(() => {
return [
history?.foo
];
}, [history?.foo]);
}
`,
errors: [
{
message:
"React Hook useEffect has a missing dependency: 'history?.foo'. " +
'Either include it or remove the dependency array.',
suggestions: [
{
desc: 'Update the dependencies array to be: [history?.foo]',
output: normalizeIndent`
function MyComponent({ history }) {
useEffect(() => {
return [
history?.foo
];
}, [history?.foo]);
}
`,
},
],
},
],
},
{
code: normalizeIndent`
function MyComponent() {
Expand Down

0 comments on commit d48edf0

Please sign in to comment.