Skip to content

Commit 757aab6

Browse files
authored
Update eslint dependencies (#3608)
* update eslint deps * Add new rules * No alternative for keyCode * Use `RefObject` * Fix types
1 parent a9ffdb1 commit 757aab6

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export default [
267267
'react/forbid-elements': 0,
268268
'react/forbid-foreign-prop-types': 0,
269269
'react/forbid-prop-types': 0,
270+
'react/forward-ref-uses-ref': 1,
270271
'react/function-component-definition': [
271272
1,
272273
{
@@ -439,6 +440,7 @@ export default [
439440
'@typescript-eslint/no-base-to-string': 0,
440441
'@typescript-eslint/no-confusing-non-null-assertion': 0,
441442
'@typescript-eslint/no-confusing-void-expression': [1, { ignoreArrowShorthand: true }],
443+
'@typescript-eslint/no-deprecated': 1,
442444
'@typescript-eslint/no-duplicate-enum-values': 1,
443445
'@typescript-eslint/no-duplicate-type-constituents': 1,
444446
'@typescript-eslint/no-dynamic-delete': 0,

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@
7575
"@testing-library/react": "^16.0.0",
7676
"@testing-library/user-event": "^14.5.2",
7777
"@types/node": "^22.0.0",
78-
"@types/react": "^18.3.3",
78+
"@types/react": "^18.3.9",
7979
"@types/react-dom": "^18.3.0",
80-
"@typescript-eslint/eslint-plugin": "^8.1.0",
81-
"@typescript-eslint/parser": "^8.1.0",
80+
"@typescript-eslint/eslint-plugin": "^8.7.0",
81+
"@typescript-eslint/parser": "^8.7.0",
8282
"@vitejs/plugin-react": "^4.3.1",
8383
"@vitest/browser": "^2.1.1",
8484
"@vitest/coverage-v8": "^2.1.1",
8585
"@vitest/eslint-plugin": "^1.1.4",
8686
"@wyw-in-js/rollup": "^0.5.0",
8787
"@wyw-in-js/vite": "^0.5.0",
8888
"babel-plugin-optimize-clsx": "^2.6.2",
89-
"eslint": "^9.9.0",
89+
"eslint": "^9.11.1",
9090
"eslint-plugin-jest-dom": "^5.0.1",
91-
"eslint-plugin-react": "^7.35.0",
91+
"eslint-plugin-react": "^7.36.1",
9292
"eslint-plugin-react-hooks": "^4.6.2",
9393
"eslint-plugin-sonarjs": "^2.0.2",
9494
"eslint-plugin-testing-library": "^6.3.0",

src/DataGrid.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ function DataGrid<R, SR, K extends Key>(
591591
const isRowEvent = isTreeGrid && event.target === focusSinkRef.current;
592592
if (!isCellEvent && !isRowEvent) return;
593593

594+
// eslint-disable-next-line @typescript-eslint/no-deprecated
594595
const { keyCode } = event;
595596

596597
if (

src/DragHandle.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,19 @@ const cellDragHandleFrozenClassname = css`
3232

3333
const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
3434

35+
// TODO: replace with RefObject once we drop support for React 18
36+
interface LatestDraggedOverRowIdxRef {
37+
readonly current: number | undefined;
38+
}
39+
3540
interface Props<R, SR> extends Pick<DataGridProps<R, SR>, 'rows' | 'onRowsChange'> {
3641
gridRowStart: number;
3742
column: CalculatedColumn<R, SR>;
3843
columnWidth: number | string;
3944
maxColIdx: number;
4045
isLastRow: boolean;
4146
selectedPosition: SelectCellState;
42-
latestDraggedOverRowIdx: React.MutableRefObject<number | undefined>;
47+
latestDraggedOverRowIdx: LatestDraggedOverRowIdxRef;
4348
isCellEditable: (position: Position) => boolean;
4449
onClick: () => void;
4550
onFill: (event: FillEvent<R>) => R;

src/TreeDataGrid.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ function TreeDataGrid<R, SR, K extends Key>(
323323
}
324324

325325
// Prevent copy/paste on group rows
326+
// eslint-disable-next-line @typescript-eslint/no-deprecated
326327
if (isCtrlKeyHeldDown(event) && (event.keyCode === 67 || event.keyCode === 86)) {
327328
event.preventGridDefault();
328329
}

src/utils/keyboardUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function isCtrlKeyHeldDown(e: React.KeyboardEvent): boolean {
5454

5555
export function isDefaultCellInput(event: React.KeyboardEvent<HTMLDivElement>): boolean {
5656
const vKey = 86;
57+
// eslint-disable-next-line @typescript-eslint/no-deprecated
5758
if (isCtrlKeyHeldDown(event) && event.keyCode !== vKey) return false;
5859
return !nonInputKeys.has(event.key);
5960
}

0 commit comments

Comments
 (0)