Skip to content

Commit ed2c240

Browse files
authored
Clean up lint warnings (#3612)
* fix relative imports * fix max-depth * ignore exhaustive-deps * ignore no-noninteractive-element-interactions
1 parent 58401df commit ed2c240

File tree

38 files changed

+51
-10
lines changed

38 files changed

+51
-10
lines changed

packages/@react-aria/dnd/src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export function readFromDataTransfer(dataTransfer: DataTransfer) {
216216
// only implemented in Chrome.
217217
if (typeof item.webkitGetAsEntry === 'function') {
218218
let entry: FileSystemEntry = item.webkitGetAsEntry();
219+
// eslint-disable-next-line max-depth
219220
if (!entry) {
220221
// For some reason, Firefox includes an item with type image/png when copy
221222
// and pasting any file or directory (no matter the type), but returns `null` for both
@@ -225,6 +226,7 @@ export function readFromDataTransfer(dataTransfer: DataTransfer) {
225226
continue;
226227
}
227228

229+
// eslint-disable-next-line max-depth
228230
if (entry.isFile) {
229231
items.push(createFileItem(item.getAsFile()));
230232
} else if (entry.isDirectory) {

packages/@react-aria/dnd/stories/VirtualizedListBox.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ export function VirtualizedListBoxExample(props) {
4949
for (let item of e.items) {
5050
if (item.kind === 'text') {
5151
let type: string;
52-
if (props.accept) {
53-
if (item.types.has(props.accept)) {
54-
type = props.accept;
55-
}
52+
if (props.accept && item.types.has(props.accept)) {
53+
type = props.accept;
5654
} else if (item.types.has('folder')) {
5755
type = 'folder';
5856
} else if (item.types.has('item')) {

packages/@react-aria/focus/src/FocusScope.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ function useRestoreFocus(scopeRef: RefObject<Element[]>, restoreFocus: boolean,
499499
document.removeEventListener('focusin', onFocus, false);
500500
scope.forEach(element => element.removeEventListener('focusin', onFocus, false));
501501
};
502+
// eslint-disable-next-line react-hooks/exhaustive-deps
502503
}, [scopeRef, contain]);
503504

504505
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
@@ -578,6 +579,7 @@ function useRestoreFocus(scopeRef: RefObject<Element[]>, restoreFocus: boolean,
578579
restoreFocus
579580
&& nodeToRestore
580581
&& (
582+
// eslint-disable-next-line react-hooks/exhaustive-deps
581583
isElementInScope(document.activeElement, scopeRef.current)
582584
|| (document.activeElement === document.body && shouldRestoreFocus(scopeRef))
583585
)

packages/@react-aria/focus/stories/FocusScope.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function NestedDialog({onClose, isPortaled, contain}: {onClose: VoidFunction, is
6161
<MaybePortal isPortaled={isPortaled}>
6262
<FocusScope contain={contain} restoreFocus autoFocus>
6363
{!showNew && (
64+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
6465
<div role="dialog" onKeyDown={onKeyDown}>
6566
<input />
6667
<input />
@@ -76,6 +77,7 @@ function NestedDialog({onClose, isPortaled, contain}: {onClose: VoidFunction, is
7677
</div>
7778
)}
7879
{showNew && (
80+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
7981
<div role="dialog" onKeyDown={onKeyDown}>
8082
<input />
8183
<input autoFocus />

packages/@react-aria/interactions/src/useFocusVisible.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,6 @@ export function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyA
233233
return () => {
234234
changeHandlers.delete(handler);
235235
};
236+
// eslint-disable-next-line react-hooks/exhaustive-deps
236237
}, deps);
237238
}

packages/@react-aria/interactions/src/useHover.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export function useHover(props: HoverProps): HoverResult {
197197
if (isDisabled) {
198198
triggerHoverEnd({currentTarget: state.target}, state.pointerType);
199199
}
200+
// eslint-disable-next-line react-hooks/exhaustive-deps
200201
}, [isDisabled]);
201202

202203
return {

packages/@react-aria/interactions/src/usePress.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ export function usePress(props: PressHookProps): PressResult {
655655
useEffect(() => {
656656
return () => {
657657
if (!allowTextSelectionOnPress) {
658+
// eslint-disable-next-line react-hooks/exhaustive-deps
658659
restoreTextSelection(ref.current.target);
659660
}
660661
};

packages/@react-aria/overlays/src/useOverlayPosition.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
129129
maxHeight
130130
})
131131
);
132+
// eslint-disable-next-line react-hooks/exhaustive-deps
132133
}, deps);
133134

134135
// Update position when anything changes
136+
// eslint-disable-next-line react-hooks/exhaustive-deps
135137
useLayoutEffect(updatePosition, deps);
136138

137139
// Update position on window resize

packages/@react-aria/selection/src/useSelectableItem.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export function useSelectableItem(options: SelectableItemOptions): SelectableIte
144144
focusSafely(ref.current);
145145
}
146146
}
147+
// eslint-disable-next-line react-hooks/exhaustive-deps
147148
}, [ref, key, manager.focusedKey, manager.childFocusStrategy, manager.isFocused, shouldUseVirtualFocus]);
148149

149150
// Set tabIndex to 0 if the element is focused, or -1 otherwise so that only the last focused

packages/@react-aria/spinbutton/src/useSpinButton.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export function useSpinButton(
150150
initialStepDelay
151151
);
152152
},
153+
// eslint-disable-next-line react-hooks/exhaustive-deps
153154
[onIncrement, maxValue, value]
154155
);
155156

@@ -167,6 +168,7 @@ export function useSpinButton(
167168
initialStepDelay
168169
);
169170
},
171+
// eslint-disable-next-line react-hooks/exhaustive-deps
170172
[onDecrement, minValue, value]
171173
);
172174

0 commit comments

Comments
 (0)