Skip to content

Commit c073772

Browse files
committed
Merge branch 'update-eslint-plugin-react-hooks' into update-eslint-plugin-react-hooks-followup
2 parents be90742 + 4cd669d commit c073772

File tree

29 files changed

+408
-1850
lines changed

29 files changed

+408
-1850
lines changed

examples/rac-spectrum-tailwind/src/components/StarRatingGroup.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { any } from "prop-types";
2-
import { useState } from "react";
1+
import React, { useState } from "react";
32
import {
43
Group,
54
Label,
@@ -31,9 +30,9 @@ export function StarRatingGroup({
3130
let [hoveredRating, setHoveredRating] =
3231
useState<string | undefined>(undefined);
3332

34-
let onPointerOver = (e: any) => {
35-
if (e.target.dataset?.rating) {
36-
setHoveredRating(e.target.dataset.rating);
33+
let onPointerOver = (e: React.PointerEvent<HTMLDivElement>) => {
34+
if ((e.target as HTMLElement).dataset?.rating) {
35+
setHoveredRating((e.target as HTMLElement).dataset.rating);
3736
}
3837
};
3938

package.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@
6969
"packages/*/*"
7070
],
7171
"devDependencies": {
72-
"@actions/core": "^1.1.0",
72+
"@actions/core": "^1.10.0",
7373
"@actions/github": "^1.1.0",
7474
"@babel/cli": "^7.24.1",
7575
"@babel/core": "^7.24.3",
7676
"@babel/eslint-parser": "^7.27.1",
7777
"@babel/node": "^7.23.9",
7878
"@babel/plugin-proposal-decorators": "^7.24.1",
79-
"@babel/plugin-syntax-decorators": "7.24.1",
80-
"@babel/plugin-syntax-import-assertions": "^7.24.1",
8179
"@babel/plugin-transform-runtime": "^7.24.3",
8280
"@babel/preset-env": "^7.24.3",
8381
"@babel/preset-react": "^7.24.1",
@@ -110,8 +108,6 @@
110108
"@spectrum-css/component-builder": "workspace:^",
111109
"@spectrum-css/vars": "^2.3.0",
112110
"@storybook/addon-a11y": "patch:@storybook/addon-a11y@npm%3A8.6.14#~/.yarn/patches/@storybook-addon-a11y-npm-8.6.14-2119c57a0f.patch",
113-
"@storybook/addon-actions": "^8.6.14",
114-
"@storybook/addon-controls": "^8.6.14",
115111
"@storybook/addon-essentials": "^8.6.14",
116112
"@storybook/addon-interactions": "^8.6.14",
117113
"@storybook/addon-jest": "^8.6.14",
@@ -136,7 +132,6 @@
136132
"@types/react-dom": "^19.0.0",
137133
"@yarnpkg/types": "^4.0.0",
138134
"autoprefixer": "^9.6.0",
139-
"axe-core": "^4.6.3",
140135
"axe-playwright": "^1.1.11",
141136
"babel-plugin-macros": "^3.0.1",
142137
"babel-plugin-react-remove-properties": "^0.3.0",
@@ -146,9 +141,8 @@
146141
"clsx": "^2.0.0",
147142
"color-space": "^1.16.0",
148143
"concurrently": "^6.0.2",
149-
"core-js": "^3.0.0",
150144
"cross-env": "^7.0.2",
151-
"cross-spawn": "^7.0.3",
145+
"cross-spawn": "^7.0.5",
152146
"delta-e": "^0.0.8",
153147
"diff": "^5.1.0",
154148
"eslint": "^9.12.0",
@@ -161,7 +155,6 @@
161155
"eslint-plugin-rulesdir": "^0.2.2",
162156
"fast-check": "^2.19.0",
163157
"fast-glob": "^3.1.0",
164-
"fs-extra": "^11.0.0",
165158
"glob": "^11.0.3",
166159
"globals": "^15.11.0",
167160
"identity-obj-proxy": "^3.0.0",
@@ -172,7 +165,6 @@
172165
"jest-junit": "^15.0.0",
173166
"jest-matchmedia-mock": "^1.1.0",
174167
"lerna": "^3.13.2",
175-
"lfcdn": "^0.4.2",
176168
"lucide-react": "^0.517.0",
177169
"md5": "^2.2.1",
178170
"motion": "^12.23.6",
@@ -184,9 +176,6 @@
184176
"postcss": "^8.4.24",
185177
"postcss-custom-properties": "^13.2.0",
186178
"postcss-import": "^15.1.0",
187-
"prettier": "^3.6.2",
188-
"prop-types": "^15.6.0",
189-
"raf": "^3.4.0",
190179
"react": "^19.1.0",
191180
"react-dom": "^19.1.0",
192181
"react-frame-component": "^5.0.0",
@@ -207,7 +196,6 @@
207196
"typescript-eslint": "^8.38.0",
208197
"verdaccio": "^6.0.0",
209198
"walk-object": "^4.0.0",
210-
"wsrun": "^5.0.0",
211199
"xml": "^1.0.1"
212200
},
213201
"resolutions": {

packages/@react-aria/autocomplete/src/useAutocomplete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export function useAutocomplete<T>(props: AriaAutocompleteOptions<T>, state: Aut
311311
// Trigger click action on item when Enter key was pressed.
312312
if (focusedNodeId != null) {
313313
let item = document.getElementById(focusedNodeId);
314-
item?.click();
314+
item?.dispatchEvent(new PointerEvent('click', e.nativeEvent));
315315
}
316316
break;
317317
}

packages/@react-aria/disclosure/src/useDisclosure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function useDisclosure(props: AriaDisclosureProps, state: DisclosureState
155155
role: 'group',
156156
'aria-labelledby': triggerId,
157157
'aria-hidden': !state.isExpanded,
158-
hidden: (isSSR || isDisabled) ? (isDisabled || !state.isExpanded) : undefined
158+
hidden: !state.isExpanded || undefined
159159
}
160160
};
161161
}

packages/@react-aria/disclosure/test/useDisclosure.test.ts

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ describe('useDisclosure', () => {
9090
expect(result.current.state.isExpanded).toBe(false);
9191
});
9292

93+
it('should keep panel hidden when toggling disabled state', () => {
94+
let {result, rerender} = renderHook(({isDisabled}: {isDisabled: boolean}) => {
95+
let state = useDisclosureState({});
96+
return useDisclosure({isDisabled}, state, ref);
97+
}, {initialProps: {isDisabled: false}});
98+
99+
act(() => {
100+
rerender({isDisabled: true});
101+
});
102+
103+
expect(result.current.panelProps.hidden).toBe(true);
104+
105+
act(() => {
106+
rerender({isDisabled: false});
107+
});
108+
109+
expect(result.current.panelProps.hidden).toBe(true);
110+
});
111+
93112
it('should set correct IDs for accessibility', () => {
94113
let {result} = renderHook(() => {
95114
let state = useDisclosureState({});
@@ -111,27 +130,27 @@ describe('useDisclosure', () => {
111130
writable: true,
112131
configurable: true
113132
});
114-
133+
115134
const ref = {current: document.createElement('div')};
116-
135+
117136
const {result} = renderHook(() => {
118137
const state = useDisclosureState({});
119138
const disclosure = useDisclosure({}, state, ref);
120139
return {state, disclosure};
121140
});
122-
141+
123142
expect(result.current.state.isExpanded).toBe(false);
124143
expect(ref.current.getAttribute('hidden')).toBe('until-found');
125-
144+
126145
// Simulate the 'beforematch' event
127146
act(() => {
128147
const event = new Event('beforematch', {bubbles: true});
129148
ref.current.dispatchEvent(event);
130149
});
131-
150+
132151
expect(result.current.state.isExpanded).toBe(true);
133152
expect(ref.current.hasAttribute('hidden')).toBe(false);
134-
153+
135154
Object.defineProperty(document.body, 'onbeforematch', {
136155
value: originalOnBeforeMatch,
137156
writable: true,
@@ -148,31 +167,31 @@ describe('useDisclosure', () => {
148167
writable: true,
149168
configurable: true
150169
});
151-
170+
152171
const ref = {current: document.createElement('div')};
153-
172+
154173
const onExpandedChange = jest.fn();
155-
174+
156175
const {result} = renderHook(() => {
157176
const state = useDisclosureState({isExpanded: false, onExpandedChange});
158177
const disclosure = useDisclosure({isExpanded: false}, state, ref);
159178
return {state, disclosure};
160179
});
161-
180+
162181
expect(result.current.state.isExpanded).toBe(false);
163182
expect(ref.current.getAttribute('hidden')).toBe('until-found');
164-
183+
165184
// Simulate the 'beforematch' event
166185
act(() => {
167186
const event = new Event('beforematch', {bubbles: true});
168187
ref.current.dispatchEvent(event);
169188
});
170-
189+
171190
expect(result.current.state.isExpanded).toBe(false);
172191
expect(ref.current.getAttribute('hidden')).toBe('until-found');
173192
expect(onExpandedChange).toHaveBeenCalledTimes(1);
174193
expect(onExpandedChange).toHaveBeenCalledWith(true);
175-
194+
176195
Object.defineProperty(document.body, 'onbeforematch', {
177196
value: originalOnBeforeMatch,
178197
writable: true,

packages/@react-spectrum/s2/src/ActionButtonGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface ActionButtonGroupProps extends AriaLabelingProps, UnsafeStyles,
3636
isQuiet?: boolean,
3737
/** Whether the buttons should divide the container width equally. */
3838
isJustified?: boolean,
39-
/** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */
39+
/** The static color style to apply. Useful when the ActionButtonGroup appears over a color background. */
4040
staticColor?: 'white' | 'black' | 'auto',
4141
/**
4242
* The axis the group should align with.

packages/@react-spectrum/s2/src/Field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ export const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps,
197197
// Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)
198198
if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {
199199
e.preventDefault();
200-
e.currentTarget.querySelector('input')?.focus();
200+
(e.currentTarget.querySelector('input, textarea') as HTMLElement)?.focus();
201201
}
202202
}}
203203
onPointerUp={e => {
204204
if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {
205205
e.preventDefault();
206-
e.currentTarget.querySelector('input')?.focus();
206+
(e.currentTarget.querySelector('input, textarea') as HTMLElement)?.focus();
207207
}
208208
}}
209209
style={props.UNSAFE_style}

packages/@spectrum-icons/build-tools/generateIcons.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import fs from 'fs-extra';
13+
import fs from 'fs';
1414
import path from 'path';
1515

1616
function writeToFile(filepath, data) {
1717
let buffer = Buffer.from(data);
18-
fs.writeFile(filepath, buffer);
18+
fs.writeFileSync(filepath, buffer);
1919
}
2020

2121
/**
@@ -26,7 +26,7 @@ function writeToFile(filepath, data) {
2626
* @param template Template for output file, should take a name from the regex.
2727
*/
2828
export function generateIcons(iconDir, outputDir, nameRegex, template) {
29-
fs.ensureDirSync(outputDir);
29+
fs.mkdirSync(outputDir, {recursive: true});
3030
fs.readdir(iconDir, (err, items) => {
3131
let ignoreList = ['index.js', 'util.js'];
3232
// get all icon files

packages/@spectrum-icons/build-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"private": true,
1212
"dependencies": {
1313
"@svgr/core": "^8.1.0",
14-
"fs-extra": "^11.0.0"
14+
"prettier": "^3.6.2"
1515
},
1616
"publishConfig": {
1717
"access": "public"

packages/@spectrum-icons/express/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"@swc/helpers": "^0.5.0"
2828
},
2929
"devDependencies": {
30-
"@spectrum-icons/build-tools": "3.0.0-alpha.1",
31-
"fs-extra": "^11.0.0"
30+
"@spectrum-icons/build-tools": "3.0.0-alpha.1"
3231
},
3332
"peerDependencies": {
3433
"@react-spectrum/provider": "^3.0.0",

0 commit comments

Comments
 (0)