Skip to content

Commit edefb82

Browse files
authored
ci: add incompatible-library lint checks (#10214)
1 parent 63a30db commit edefb82

32 files changed

+64
-4
lines changed

app/eslint.config.mts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ export default defineConfig([
6565
{
6666
files: ["**/*.{ts,tsx}"],
6767
rules: {
68-
// TODO: Re-enable this rule once we've addressed the incompatible library warnings
69-
// This rule warns about using APIs from libraries like React Hook Form and TanStack Table
70-
// that return functions which cannot be safely memoized by React Compiler
71-
"react-hooks/incompatible-library": "off",
68+
// this is made an error so that it forces us to validate it works with the react compiler
69+
"react-hooks/incompatible-library": "error",
7270
// TODO: Re-enable this rule once we've addressed the issue with setState in useEffect
7371
// This rule prevents calling setState in useEffect which can cause unstable results when components re-render
7472
"react-hooks/set-state-in-effect": "off",

app/src/components/datasetSplit/NewDatasetSplitForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export function NewDatasetSplitForm({
3434
onSubmit,
3535
isSubmitting,
3636
}: NewDatasetSplitFormProps) {
37+
"use no memo";
3738
const {
3839
control,
3940
handleSubmit,
@@ -58,6 +59,7 @@ export function NewDatasetSplitForm({
5859
justifyContent="center"
5960
width="100%"
6061
>
62+
{/* eslint-disable-next-line react-hooks/incompatible-library */}
6163
<Token color={watch("color")}>
6264
{watch("name") || "split preview"}
6365
</Token>

app/src/components/label/NewLabelForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type NewLabelFormProps = {
3030
isSubmitting: boolean;
3131
};
3232
export function NewLabelForm({ onSubmit, isSubmitting }: NewLabelFormProps) {
33+
"use no memo";
3334
const {
3435
control,
3536
handleSubmit,
@@ -53,6 +54,7 @@ export function NewLabelForm({ onSubmit, isSubmitting }: NewLabelFormProps) {
5354
justifyContent="center"
5455
width="100%"
5556
>
57+
{/* eslint-disable-next-line react-hooks/incompatible-library */}
5658
<Token color={watch("color")}>
5759
{watch("name") || "label preview"}
5860
</Token>

app/src/components/table/Table.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export function Table<DataRow extends object>({
2121
columns,
2222
data,
2323
}: TableProps<DataRow>) {
24+
"use no memo";
25+
// eslint-disable-next-line react-hooks/incompatible-library
2426
const table = useReactTable<DataRow>({
2527
columns,
2628
data,

app/src/pages/dashboards/DashboardsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function DashboardsTable({ dashboards }: { dashboards: Dashboard[] }) {
6868
],
6969
[]
7070
);
71+
// eslint-disable-next-line react-hooks/incompatible-library
7172
const table = useReactTable({
7273
columns,
7374
data: dashboards,
@@ -135,6 +136,7 @@ function DashboardsTable({ dashboards }: { dashboards: Dashboard[] }) {
135136
}
136137

137138
export function DashboardsPage() {
139+
"use no memo";
138140
const loaderData = useLoaderData<typeof dashboardsLoader>();
139141
// For now, use mock data for dashboards
140142
const dashboards = [

app/src/pages/dashboards/ProjectDashboardsTable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export function ProjectDashboardsTable({
2222
}: {
2323
query: ProjectDashboardsTable_projects$key;
2424
}) {
25+
"use no memo";
2526
const tableContainerRef = useRef<HTMLDivElement>(null);
2627
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment(
2728
graphql`
@@ -84,6 +85,7 @@ export function ProjectDashboardsTable({
8485
],
8586
[]
8687
);
88+
// eslint-disable-next-line react-hooks/incompatible-library
8789
const table = useReactTable({
8890
columns,
8991
data: projects,

app/src/pages/dataset/DatasetHistoryTable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type DatasetHistoryTableProps = {
2222
};
2323

2424
export function DatasetHistoryTable(props: DatasetHistoryTableProps) {
25+
"use no memo";
2526
//we need a reference to the scrolling element for logic down below
2627
const tableContainerRef = useRef<HTMLDivElement>(null);
2728
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment(
@@ -66,6 +67,7 @@ export function DatasetHistoryTable(props: DatasetHistoryTableProps) {
6667
},
6768
[hasNext, isLoadingNext, loadNext]
6869
);
70+
// eslint-disable-next-line react-hooks/incompatible-library
6971
const table = useReactTable({
7072
columns: [
7173
{

app/src/pages/datasets/DatasetsTable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function toGqlSort(sort: SortingState[number]): DatasetSort {
5959
}
6060

6161
export function DatasetsTable(props: DatasetsTableProps) {
62+
"use no memo";
6263
const { filter, labelFilter } = props;
6364
const [sorting, setSorting] = useState<SortingState>([]);
6465
//we need a reference to the scrolling element for logic down below
@@ -292,6 +293,7 @@ export function DatasetsTable(props: DatasetsTableProps) {
292293
}
293294
return cols;
294295
}, [filter, labelFilter, notifyError, notifySuccess, refetch, canModify]);
296+
// eslint-disable-next-line react-hooks/incompatible-library
295297
const table = useReactTable({
296298
columns,
297299
data: tableData,

app/src/pages/embedding/EventDetails.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function TextPre(props: PropsWithChildren) {
7272
* Displays the details of an event in a slide over panel
7373
*/
7474
export function EventDetails({ event }: { event: ModelEvent }) {
75+
"use no memo";
7576
const hasRetrievals =
7677
event.retrievedDocuments && event.retrievedDocuments.length > 0;
7778
const isPredictionRecord = !event.id.includes("CORPUS");
@@ -274,6 +275,7 @@ function EmbeddingDimensionsTable({
274275
[]
275276
);
276277

278+
// eslint-disable-next-line react-hooks/incompatible-library
277279
const table = useReactTable<DimensionRow>({
278280
columns,
279281
data,

app/src/pages/embedding/PointSelectionTable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function PointSelectionTable({
3030
data: ModelEvent[];
3131
onPointSelected: (pointId: string) => void;
3232
}) {
33+
"use no memo";
3334
const { primaryInferences, referenceInferences } = useInferences();
3435
const metric = usePointCloudContext((state) => state.metric);
3536
const [sorting, setSorting] = useState<SortingState>([]);
@@ -179,6 +180,7 @@ export function PointSelectionTable({
179180
return { columns, tableData };
180181
}, [data, onPointSelected, primaryInferences, referenceInferences, metric]);
181182

183+
// eslint-disable-next-line react-hooks/incompatible-library
182184
const table = useReactTable<TableDataItem>({
183185
columns,
184186
data: tableData,

0 commit comments

Comments
 (0)