File tree Expand file tree Collapse file tree 1 file changed +29
-29
lines changed
packages/eslint-plugin-react-hooks/__tests__ Expand file tree Collapse file tree 1 file changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -1387,7 +1387,7 @@ const tests = {
13871387 code : normalizeIndent `
13881388 function useFoo(){
13891389 const foo = "hi!";
1390- return useMemo(() => foo, [foo]);
1390+ return useMemo(() => foo, [foo]);
13911391 }
13921392 ` ,
13931393 } ,
@@ -5797,20 +5797,20 @@ const tests = {
57975797 ] ,
57985798 } ,
57995799 {
5800- code : normalizeIndent `
5801- function MyComponent(props) {
5802- let handleNext = () => {
5803- console.log('hello');
5804- };
5805- if (props.foo) {
5806- handleNext = () => {
5807- console.log('hello');
5808- };
5809- }
5810- useEffect(() => {
5811- return Store.subscribe(handleNext);
5812- }, [handleNext]);
5813- }
5800+ code : normalizeIndent `
5801+ function MyComponent(props) {
5802+ let handleNext = () => {
5803+ console.log('hello');
5804+ };
5805+ if (props.foo) {
5806+ handleNext = () => {
5807+ console.log('hello');
5808+ };
5809+ }
5810+ useEffect(() => {
5811+ return Store.subscribe(handleNext);
5812+ }, [handleNext]);
5813+ }
58145814 ` ,
58155815 errors : [
58165816 {
@@ -5826,20 +5826,20 @@ const tests = {
58265826 {
58275827 desc :
58285828 "Wrap the construction of 'handleNext' in its own useCallback() Hook." ,
5829- output : normalizeIndent `
5830- function MyComponent(props) {
5831- let handleNext = useCallback(() => {
5832- console.log('hello');
5833- });
5834- if (props.foo) {
5835- handleNext = () => {
5836- console.log('hello');
5837- };
5838- }
5839- useEffect(() => {
5840- return Store.subscribe(handleNext);
5841- }, [handleNext]);
5842- }
5829+ output : normalizeIndent `
5830+ function MyComponent(props) {
5831+ let handleNext = useCallback(() => {
5832+ console.log('hello');
5833+ });
5834+ if (props.foo) {
5835+ handleNext = () => {
5836+ console.log('hello');
5837+ };
5838+ }
5839+ useEffect(() => {
5840+ return Store.subscribe(handleNext);
5841+ }, [handleNext]);
5842+ }
58435843 ` ,
58445844 } ,
58455845 ] ,
You can’t perform that action at this time.
0 commit comments