Skip to content

Commit 38f6b1d

Browse files
Merge pull request #5962 from Hacker0x01/dependabot/npm_and_yarn/eslint-plugin-react-hooks-7.0.1
chore(deps-dev): bump eslint-plugin-react-hooks from 5.2.0 to 7.0.1
2 parents d760ec6 + 88248d6 commit 38f6b1d

File tree

6 files changed

+142
-17
lines changed

6 files changed

+142
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"eslint-plugin-import": "^2.31.0",
7171
"eslint-plugin-jest": "^29.0.1",
7272
"eslint-plugin-react": "^7.37.4",
73-
"eslint-plugin-react-hooks": "^5.1.0",
73+
"eslint-plugin-react-hooks": "^7.0.1",
7474
"eslint-plugin-unused-imports": "^4.1.4",
7575
"husky": "9.1.7",
7676
"jest": "^30.0.5",

src/click_outside_wrapper.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ const useDetectClickOutside = (
1717
) => {
1818
const ref = useRef<HTMLDivElement | null>(null);
1919
const onClickOutsideRef = useRef(onClickOutside);
20-
onClickOutsideRef.current = onClickOutside;
20+
useEffect(() => {
21+
onClickOutsideRef.current = onClickOutside;
22+
}, [onClickOutside]);
2123
const handleClickOutside = useCallback(
2224
(event: MouseEvent) => {
2325
const target =

src/popper_component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const PopperComponent: React.FC<PopperComponentProps> = (props) => {
5050
const classes = clsx("react-datepicker-popper", className);
5151
popper = (
5252
<TabLoop enableTabLoop={enableTabLoop}>
53+
{/* eslint-disable react-hooks/refs -- Floating UI values are designed to be used during render */}
5354
<div
5455
ref={popperProps.refs.setFloating}
5556
style={popperProps.floatingStyles}
@@ -71,6 +72,7 @@ export const PopperComponent: React.FC<PopperComponentProps> = (props) => {
7172
/>
7273
)}
7374
</div>
75+
{/* eslint-enable react-hooks/refs */}
7476
</TabLoop>
7577
);
7678
}
@@ -91,6 +93,7 @@ export const PopperComponent: React.FC<PopperComponentProps> = (props) => {
9193

9294
return (
9395
<>
96+
{/* eslint-disable-next-line react-hooks/refs -- Floating UI refs are designed to be used during render */}
9497
<div ref={popperProps.refs.setReference} className={wrapperClasses}>
9598
{targetComponent}
9699
</div>

src/test/helper_components/shadow_root.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,31 @@ import React, {
55
useRef,
66
useState,
77
} from "react";
8-
import { createPortal } from "react-dom";
8+
import { createPortal, flushSync } from "react-dom";
99

1010
const ShadowRoot: FC<PropsWithChildren> = ({ children }) => {
11+
const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);
12+
1113
const containerRef = useRef<HTMLDivElement>(null);
12-
const shadowRootRef = useRef<ShadowRoot>(null);
13-
const [isInitialized, setIsInitialized] = useState(false);
14+
const isInitializedRef = useRef(false);
1415

1516
useLayoutEffect(() => {
1617
const container = containerRef.current;
17-
if (isInitialized || !container) {
18+
if (isInitializedRef.current || !container) {
1819
return;
1920
}
2021

21-
shadowRootRef.current =
22+
const root =
2223
container.shadowRoot ?? container.attachShadow({ mode: "open" });
23-
setIsInitialized(true);
24-
}, [isInitialized]);
24+
isInitializedRef.current = true;
25+
// Use flushSync to synchronously update state within effect, avoiding cascading renders
26+
// while ensuring the shadow root is available immediately for tests
27+
flushSync(() => setShadowRoot(root));
28+
}, []);
2529

2630
return (
2731
<div ref={containerRef}>
28-
{isInitialized &&
29-
shadowRootRef.current &&
30-
createPortal(children, shadowRootRef.current)}
32+
{shadowRoot && createPortal(children, shadowRoot)}
3133
</div>
3234
);
3335
};

src/with_floating.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function withFloating<T extends FloatingProps>(
5656
middleware: [
5757
flip({ padding: 15 }),
5858
offset(10),
59+
// eslint-disable-next-line react-hooks/refs -- Floating UI requires refs to be passed during render
5960
arrow({ element: arrowRef }),
6061
...(props.popperModifiers ?? []),
6162
],

yarn.lock

Lines changed: 122 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ __metadata:
7777
languageName: node
7878
linkType: hard
7979

80+
"@babel/core@npm:^7.24.4":
81+
version: 7.28.5
82+
resolution: "@babel/core@npm:7.28.5"
83+
dependencies:
84+
"@babel/code-frame": "npm:^7.27.1"
85+
"@babel/generator": "npm:^7.28.5"
86+
"@babel/helper-compilation-targets": "npm:^7.27.2"
87+
"@babel/helper-module-transforms": "npm:^7.28.3"
88+
"@babel/helpers": "npm:^7.28.4"
89+
"@babel/parser": "npm:^7.28.5"
90+
"@babel/template": "npm:^7.27.2"
91+
"@babel/traverse": "npm:^7.28.5"
92+
"@babel/types": "npm:^7.28.5"
93+
"@jridgewell/remapping": "npm:^2.3.5"
94+
convert-source-map: "npm:^2.0.0"
95+
debug: "npm:^4.1.0"
96+
gensync: "npm:^1.0.0-beta.2"
97+
json5: "npm:^2.2.3"
98+
semver: "npm:^6.3.1"
99+
checksum: 10c0/535f82238027621da6bdffbdbe896ebad3558b311d6f8abc680637a9859b96edbf929ab010757055381570b29cf66c4a295b5618318d27a4273c0e2033925e72
100+
languageName: node
101+
linkType: hard
102+
80103
"@babel/eslint-parser@npm:^7.26.5":
81104
version: 7.28.4
82105
resolution: "@babel/eslint-parser@npm:7.28.4"
@@ -130,6 +153,19 @@ __metadata:
130153
languageName: node
131154
linkType: hard
132155

156+
"@babel/generator@npm:^7.28.5":
157+
version: 7.28.5
158+
resolution: "@babel/generator@npm:7.28.5"
159+
dependencies:
160+
"@babel/parser": "npm:^7.28.5"
161+
"@babel/types": "npm:^7.28.5"
162+
"@jridgewell/gen-mapping": "npm:^0.3.12"
163+
"@jridgewell/trace-mapping": "npm:^0.3.28"
164+
jsesc: "npm:^3.0.2"
165+
checksum: 10c0/9f219fe1d5431b6919f1a5c60db8d5d34fe546c0d8f5a8511b32f847569234ffc8032beb9e7404649a143f54e15224ecb53a3d11b6bb85c3203e573d91fca752
166+
languageName: node
167+
linkType: hard
168+
133169
"@babel/helper-annotate-as-pure@npm:^7.25.9":
134170
version: 7.25.9
135171
resolution: "@babel/helper-annotate-as-pure@npm:7.25.9"
@@ -454,6 +490,13 @@ __metadata:
454490
languageName: node
455491
linkType: hard
456492

493+
"@babel/helper-validator-identifier@npm:^7.28.5":
494+
version: 7.28.5
495+
resolution: "@babel/helper-validator-identifier@npm:7.28.5"
496+
checksum: 10c0/42aaebed91f739a41f3d80b72752d1f95fd7c72394e8e4bd7cdd88817e0774d80a432451bcba17c2c642c257c483bf1d409dd4548883429ea9493a3bc4ab0847
497+
languageName: node
498+
linkType: hard
499+
457500
"@babel/helper-validator-option@npm:^7.27.1":
458501
version: 7.27.1
459502
resolution: "@babel/helper-validator-option@npm:7.27.1"
@@ -493,6 +536,17 @@ __metadata:
493536
languageName: node
494537
linkType: hard
495538

539+
"@babel/parser@npm:^7.24.4, @babel/parser@npm:^7.28.5":
540+
version: 7.28.5
541+
resolution: "@babel/parser@npm:7.28.5"
542+
dependencies:
543+
"@babel/types": "npm:^7.28.5"
544+
bin:
545+
parser: ./bin/babel-parser.js
546+
checksum: 10c0/5bbe48bf2c79594ac02b490a41ffde7ef5aa22a9a88ad6bcc78432a6ba8a9d638d531d868bd1f104633f1f6bba9905746e15185b8276a3756c42b765d131b1ef
547+
languageName: node
548+
linkType: hard
549+
496550
"@babel/parser@npm:^7.27.1, @babel/parser@npm:^7.27.2":
497551
version: 7.27.2
498552
resolution: "@babel/parser@npm:7.27.2"
@@ -1718,6 +1772,21 @@ __metadata:
17181772
languageName: node
17191773
linkType: hard
17201774

1775+
"@babel/traverse@npm:^7.28.5":
1776+
version: 7.28.5
1777+
resolution: "@babel/traverse@npm:7.28.5"
1778+
dependencies:
1779+
"@babel/code-frame": "npm:^7.27.1"
1780+
"@babel/generator": "npm:^7.28.5"
1781+
"@babel/helper-globals": "npm:^7.28.0"
1782+
"@babel/parser": "npm:^7.28.5"
1783+
"@babel/template": "npm:^7.27.2"
1784+
"@babel/types": "npm:^7.28.5"
1785+
debug: "npm:^4.3.1"
1786+
checksum: 10c0/f6c4a595993ae2b73f2d4cd9c062f2e232174d293edd4abe1d715bd6281da8d99e47c65857e8d0917d9384c65972f4acdebc6749a7c40a8fcc38b3c7fb3e706f
1787+
languageName: node
1788+
linkType: hard
1789+
17211790
"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.25.9, @babel/types@npm:^7.26.3, @babel/types@npm:^7.4.4":
17221791
version: 7.26.3
17231792
resolution: "@babel/types@npm:7.26.3"
@@ -1768,6 +1837,16 @@ __metadata:
17681837
languageName: node
17691838
linkType: hard
17701839

1840+
"@babel/types@npm:^7.28.5":
1841+
version: 7.28.5
1842+
resolution: "@babel/types@npm:7.28.5"
1843+
dependencies:
1844+
"@babel/helper-string-parser": "npm:^7.27.1"
1845+
"@babel/helper-validator-identifier": "npm:^7.28.5"
1846+
checksum: 10c0/a5a483d2100befbf125793640dec26b90b95fd233a94c19573325898a5ce1e52cdfa96e495c7dcc31b5eca5b66ce3e6d4a0f5a4a62daec271455959f208ab08a
1847+
languageName: node
1848+
linkType: hard
1849+
17711850
"@bcoe/v8-coverage@npm:^0.2.3":
17721851
version: 0.2.3
17731852
resolution: "@bcoe/v8-coverage@npm:0.2.3"
@@ -5899,12 +5978,18 @@ __metadata:
58995978
languageName: node
59005979
linkType: hard
59015980

5902-
"eslint-plugin-react-hooks@npm:^5.1.0":
5903-
version: 5.2.0
5904-
resolution: "eslint-plugin-react-hooks@npm:5.2.0"
5981+
"eslint-plugin-react-hooks@npm:^7.0.1":
5982+
version: 7.0.1
5983+
resolution: "eslint-plugin-react-hooks@npm:7.0.1"
5984+
dependencies:
5985+
"@babel/core": "npm:^7.24.4"
5986+
"@babel/parser": "npm:^7.24.4"
5987+
hermes-parser: "npm:^0.25.1"
5988+
zod: "npm:^3.25.0 || ^4.0.0"
5989+
zod-validation-error: "npm:^3.5.0 || ^4.0.0"
59055990
peerDependencies:
59065991
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
5907-
checksum: 10c0/1c8d50fa5984c6dea32470651807d2922cc3934cf3425e78f84a24c2dfd972e7f019bee84aefb27e0cf2c13fea0ac1d4473267727408feeb1c56333ca1489385
5992+
checksum: 10c0/1e711d1a9d1fa9cfc51fa1572500656577201199c70c795c6a27adfc1df39e5c598f69aab6aa91117753d23cc1f11388579a2bed14921cf9a4efe60ae8618496
59085993
languageName: node
59095994
linkType: hard
59105995

@@ -6811,6 +6896,22 @@ __metadata:
68116896
languageName: node
68126897
linkType: hard
68136898

6899+
"hermes-estree@npm:0.25.1":
6900+
version: 0.25.1
6901+
resolution: "hermes-estree@npm:0.25.1"
6902+
checksum: 10c0/48be3b2fa37a0cbc77a112a89096fa212f25d06de92781b163d67853d210a8a5c3784fac23d7d48335058f7ed283115c87b4332c2a2abaaccc76d0ead1a282ac
6903+
languageName: node
6904+
linkType: hard
6905+
6906+
"hermes-parser@npm:^0.25.1":
6907+
version: 0.25.1
6908+
resolution: "hermes-parser@npm:0.25.1"
6909+
dependencies:
6910+
hermes-estree: "npm:0.25.1"
6911+
checksum: 10c0/3abaa4c6f1bcc25273f267297a89a4904963ea29af19b8e4f6eabe04f1c2c7e9abd7bfc4730ddb1d58f2ea04b6fee74053d8bddb5656ec6ebf6c79cc8d14202c
6912+
languageName: node
6913+
linkType: hard
6914+
68146915
"hookified@npm:^1.11.0":
68156916
version: 1.12.0
68166917
resolution: "hookified@npm:1.12.0"
@@ -9726,7 +9827,7 @@ __metadata:
97269827
eslint-plugin-import: "npm:^2.31.0"
97279828
eslint-plugin-jest: "npm:^29.0.1"
97289829
eslint-plugin-react: "npm:^7.37.4"
9729-
eslint-plugin-react-hooks: "npm:^5.1.0"
9830+
eslint-plugin-react-hooks: "npm:^7.0.1"
97309831
eslint-plugin-unused-imports: "npm:^4.1.4"
97319832
husky: "npm:9.1.7"
97329833
jest: "npm:^30.0.5"
@@ -11976,3 +12077,19 @@ __metadata:
1197612077
checksum: 10c0/dceb44c28578b31641e13695d200d34ec4ab3966a5729814d5445b194933c096b7ced71494ce53a0e8820685d1d010df8b2422e5bf2cdea7e469d97ffbea306f
1197712078
languageName: node
1197812079
linkType: hard
12080+
12081+
"zod-validation-error@npm:^3.5.0 || ^4.0.0":
12082+
version: 4.0.2
12083+
resolution: "zod-validation-error@npm:4.0.2"
12084+
peerDependencies:
12085+
zod: ^3.25.0 || ^4.0.0
12086+
checksum: 10c0/0ccfec48c46de1be440b719cd02044d4abb89ed0e14c13e637cd55bf29102f67ccdba373f25def0fc7130e5f15025be4d557a7edcc95d5a3811599aade689e1b
12087+
languageName: node
12088+
linkType: hard
12089+
12090+
"zod@npm:^3.25.0 || ^4.0.0":
12091+
version: 4.1.12
12092+
resolution: "zod@npm:4.1.12"
12093+
checksum: 10c0/b64c1feb19e99d77075261eaf613e0b2be4dfcd3551eff65ad8b4f2a079b61e379854d066f7d447491fcf193f45babd8095551a9d47973d30b46b6d8e2c46774
12094+
languageName: node
12095+
linkType: hard

0 commit comments

Comments
 (0)