-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update eslint deps #3615
Update eslint deps #3615
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3615 +/- ##
==========================================
+ Coverage 89.88% 91.10% +1.22%
==========================================
Files 48 48
Lines 3440 3440
Branches 654 679 +25
==========================================
+ Hits 3092 3134 +42
+ Misses 348 306 -42
|
"@faker-js/faker": "^9.0.0", | ||
"@ianvs/prettier-plugin-sort-imports": "^4.0.2", | ||
"@linaria/core": "^6.0.0", | ||
"@microsoft/api-extractor": "^7.23.0", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@tanstack/react-router": "^1.57.13", | ||
"@tanstack/router-plugin": "^1.57.13", | ||
"@tanstack/react-router": "^1.70.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the eslint-plugin. Not sure why is it failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the plugin needs to export Plugin
, manually tweaking the declaration files fixes it.
Composite projects require declaration files to be emitted, and TS can't emit a declaration file without access to the Plugin
type from the @tanstack/eslint-plugin-router
.
Should open an issue.
@@ -1245,7 +1248,7 @@ function DataGrid<R, SR, K extends Key>( | |||
<ScrollToCell | |||
scrollToPosition={scrollToPosition} | |||
setScrollToCellPosition={setScrollToPosition} | |||
gridElement={gridRef.current!} | |||
gridRef={gridRef} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-plugin
did not catch this. Maybe because it is conditional 🤔
@@ -36,6 +36,7 @@ export function useViewportColumns<R, SR>({ | |||
|
|||
const updateStartIdx = (colIdx: number, colSpan: number | undefined) => { | |||
if (colSpan !== undefined && colIdx + colSpan > colOverscanStartIdx) { | |||
// eslint-disable-next-line react-compiler/react-compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should open an issue
@@ -1061,7 +1065,6 @@ function DataGrid<R, SR, K extends Key>( | |||
// Reset the positions if the current values are no longer valid. This can happen if a column or row is removed | |||
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) { | |||
setSelectedPosition({ idx: -1, rowIdx: minRowIdx - 1, mode: 'SELECT' }); | |||
setDraggedOverRowIdx(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? We do set it to undefined after the drag operation
https://github.com/adazzle/react-data-grid/blob/main/src/DragHandle.tsx#L103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that the rows update while we're dragging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I added it back for now. I will look into alternatives
src/DataGrid.tsx
Outdated
} | ||
|
||
function closeEditor(shouldFocusCell: boolean) { | ||
shouldFocusCellRef.current = shouldFocusCell; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just use a state instead of dancing around the limitations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can completely remove the ref and use flushSync
. It works but it seems like the checkbox checked state is incorrect when cell is clicked. Maybe a bug in React
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a state now
@@ -1061,7 +1065,6 @@ function DataGrid<R, SR, K extends Key>( | |||
// Reset the positions if the current values are no longer valid. This can happen if a column or row is removed | |||
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) { | |||
setSelectedPosition({ idx: -1, rowIdx: minRowIdx - 1, mode: 'SELECT' }); | |||
setDraggedOverRowIdx(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that the rows update while we're dragging?
@@ -36,6 +36,7 @@ export function useViewportColumns<R, SR>({ | |||
|
|||
const updateStartIdx = (colIdx: number, colSpan: number | undefined) => { | |||
if (colSpan !== undefined && colIdx + colSpan > colOverscanStartIdx) { | |||
// eslint-disable-next-line react-compiler/react-compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should open an issue
"@faker-js/faker": "^9.0.0", | ||
"@ianvs/prettier-plugin-sort-imports": "^4.0.2", | ||
"@linaria/core": "^6.0.0", | ||
"@microsoft/api-extractor": "^7.23.0", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@tanstack/react-router": "^1.57.13", | ||
"@tanstack/router-plugin": "^1.57.13", | ||
"@tanstack/react-router": "^1.70.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the plugin needs to export Plugin
, manually tweaking the declaration files fixes it.
Composite projects require declaration files to be emitted, and TS can't emit a declaration file without access to the Plugin
type from the @tanstack/eslint-plugin-router
.
Should open an issue.
@@ -1061,7 +1065,6 @@ function DataGrid<R, SR, K extends Key>( | |||
// Reset the positions if the current values are no longer valid. This can happen if a column or row is removed | |||
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) { | |||
setSelectedPosition({ idx: -1, rowIdx: minRowIdx - 1, mode: 'SELECT' }); | |||
setDraggedOverRowIdx(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I added it back for now. I will look into alternatives
@@ -1182,6 +1183,7 @@ function DataGrid<R, SR, K extends Key>( | |||
); | |||
})} | |||
<RowSelectionChangeProvider value={selectRowLatest}> | |||
{/* eslint-disable-next-line react-compiler/react-compiler */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know which line it is complaining about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the setDraggedOverRowIdx
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried removing it and it was still showing the same warning
const prevSelectedPosition = useRef(selectedPosition); | ||
const latestDraggedOverRowIdx = useRef(draggedOverRowIdx); | ||
const lastSelectedRowIdx = useRef(-1); | ||
const focusSinkRef = useRef<HTMLDivElement>(null); | ||
const shouldFocusCellRef = useRef(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed a few refs
@@ -1061,6 +1061,7 @@ function DataGrid<R, SR, K extends Key>( | |||
// Reset the positions if the current values are no longer valid. This can happen if a column or row is removed | |||
if (selectedPosition.idx > maxColIdx || selectedPosition.rowIdx > maxRowIdx) { | |||
setSelectedPosition({ idx: -1, rowIdx: minRowIdx - 1, mode: 'SELECT' }); | |||
// eslint-disable-next-line react-compiler/react-compiler | |||
setDraggedOverRowIdx(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmh, setting ref during render?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, need a workaround. We need ref to access the latest value. I will investigate
@@ -1182,6 +1183,7 @@ function DataGrid<R, SR, K extends Key>( | |||
); | |||
})} | |||
<RowSelectionChangeProvider value={selectRowLatest}> | |||
{/* eslint-disable-next-line react-compiler/react-compiler */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the setDraggedOverRowIdx
call?
New plugin
eslint-plugin-react-hooks-extra
. https://eslint-react.xyz/react-compiler/react-compiler
. https://react.dev/learn/react-compiler#installing-eslint-plugin-react-compiler