Skip to content

Commit 4e53b80

Browse files
committed
fix(linter): misplaced backtick in exhaustive-deps test case (#11544)
1 parent e8a04b6 commit 4e53b80

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/oxc_linter/src/rules/react/exhaustive_deps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,7 +2500,7 @@ fn test() {
25002500
const local1 = {};
25012501
console.log(local1);
25022502
}, [local1]);
2503-
}`",
2503+
}",
25042504
r"function MyComponent() {
25052505
const local1 = {};
25062506
useCallback(() => {}, [local1]);

crates/oxc_linter/src/snapshots/react_exhaustive_deps.snap

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,12 +694,14 @@ source: crates/oxc_linter/src/tester.rs
694694
╰────
695695
help: Try memoizing this variable with `useRef` or `useCallback`.
696696

697-
× Unterminated string
698-
╭─[exhaustive_deps.tsx:7:10]
697+
eslint-plugin-react-hooks(exhaustive-deps): React Hook useCallback has a dependency array that changes every render.
698+
╭─[exhaustive_deps.tsx:6:14]
699+
5console.log(local1);
699700
6 │ }, [local1]);
700-
7 }`
701-
·
701+
· ────────
702+
7 }
702703
╰────
704+
help: Try memoizing this variable with `useRef` or `useCallback`.
703705

704706
eslint-plugin-react(exhaustive-deps): React Hook useCallback has unnecessary dependency: local1
705707
╭─[exhaustive_deps.tsx:3:33]

0 commit comments

Comments
 (0)