mirror of
https://github.com/facebook/react.git
synced 2026-02-21 19:31:52 +00:00
[test] Update ESLint e2e tests (#35233)
This commit is contained in:
committed by
GitHub
parent
1721e73e14
commit
0af4fd80ed
@@ -159,9 +159,9 @@ function InvalidGlobals() {
|
||||
return <div>Done</div>;
|
||||
}
|
||||
|
||||
// Invalid: useMemo with wrong deps - triggers preserve-manual-memoization
|
||||
// Invalid: useMemo with wrong deps
|
||||
function InvalidUseMemo({items}) {
|
||||
// eslint-disable-next-line react-hooks/preserve-manual-memoization, react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const sorted = useMemo(() => [...items].sort(), []);
|
||||
return <div>{sorted.length}</div>;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ function InvalidGlobals() {
|
||||
return <div>Done</div>;
|
||||
}
|
||||
|
||||
// Invalid: useMemo with wrong deps - triggers preserve-manual-memoization
|
||||
// Invalid: useMemo with wrong deps
|
||||
function InvalidUseMemo({items}) {
|
||||
// eslint-disable-next-line react-hooks/preserve-manual-memoization, react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const sorted = useMemo(() => [...items].sort(), []);
|
||||
return <div>{sorted.length}</div>;
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@ function InvalidGlobals() {
|
||||
return <div>Done</div>;
|
||||
}
|
||||
|
||||
// Invalid: useMemo with wrong deps - triggers preserve-manual-memoization
|
||||
// Invalid: useMemo with wrong deps
|
||||
function InvalidUseMemo({items}) {
|
||||
// eslint-disable-next-line react-hooks/preserve-manual-memoization, react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const sorted = useMemo(() => [...items].sort(), []);
|
||||
return <div>{sorted.length}</div>;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ function ComponentWithoutDeclaringPropAsDep(props) {
|
||||
console.log(props.foo);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
// eslint-disable-next-line react-hooks/void-use-memo
|
||||
useMemo(() => {
|
||||
console.log(props.foo);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -82,6 +83,7 @@ function ComponentWithoutDeclaringPropAsDep(props) {
|
||||
console.log(props.foo);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
// eslint-disable-next-line react-hooks/void-use-memo
|
||||
React.useMemo(() => {
|
||||
console.log(props.foo);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -159,9 +161,9 @@ function InvalidGlobals() {
|
||||
return <div>Done</div>;
|
||||
}
|
||||
|
||||
// Invalid: useMemo with wrong deps - triggers preserve-manual-memoization
|
||||
// Invalid: useMemo with wrong deps
|
||||
function InvalidUseMemo({items}) {
|
||||
// eslint-disable-next-line react-hooks/preserve-manual-memoization, react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const sorted = useMemo(() => [...items].sort(), []);
|
||||
return <div>{sorted.length}</div>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user