mishig HF Staff Claude Sonnet 4.5 commited on
Commit
cb139d0
·
1 Parent(s): 4f26d07

fix: resolve ESLint errors - remove unused imports and variables

Browse files

- Remove unused type imports (SeriesColumn, ParquetDataRow)
- Fix unused error parameters in catch blocks
- Comment out unused columnNames variable
- Fix React Hook ordering in data-recharts.tsx (move useEffect before early return)
- Remove unused useRouter and useSearchParams imports
- Fix groupRowBySuffix return type to ensure timestamp is always a number

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

.claude/settings.local.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh pr create:*)",
5
+ "Bash(git add:*)",
6
+ "Bash(git commit -m \"$\\(cat <<''EOF''\nchore: simplify Dockerfile by removing unnecessary dependencies\n\nRemove apt packages that aren''t needed for running Next.js:\n- Graphics libraries \\(libgl1, libegl\\) - not needed for web apps\n- Build tools \\(build-essential, cmake\\) - app is pre-built\n- ffmpeg - videos are served client-side, no server processing\n- git, wget - files copied directly in build\n\nThe bun base image has everything needed to run the Next.js app.\n\nCo-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
7
+ "Bash(git push:*)",
8
+ "Bash(gh api:*)",
9
+ "WebFetch(domain:raw.githubusercontent.com)",
10
+ "Bash(curl:*)",
11
+ "Bash(git checkout:*)",
12
+ "Bash(git commit:*)",
13
+ "Bash(bun run type-check:*)",
14
+ "Bash(npx tsc:*)",
15
+ "Bash(/Users/mishig/.bun/bin/bun run build:*)",
16
+ "Bash(gh run view:*)"
17
+ ]
18
+ }
19
+ }
src/app/[org]/[dataset]/[episode]/fetch-data.ts CHANGED
@@ -14,8 +14,6 @@ import type {
14
  VideoInfo,
15
  AdjacentEpisodeVideos,
16
  ChartDataGroup,
17
- SeriesColumn,
18
- ParquetDataRow,
19
  } from "@/types";
20
 
21
  const SERIES_NAME_DELIMITER = " | ";
@@ -218,7 +216,7 @@ async function getEpisodeDataV2(
218
  // Load data first
219
  try {
220
  allData = await readParquetAsObjects(arrayBuffer, []);
221
- } catch (error) {
222
  // Could not read parquet data
223
  }
224
 
@@ -287,7 +285,7 @@ async function getEpisodeDataV2(
287
  }
288
  }
289
  }
290
- } catch (error) {
291
  // No tasks metadata file for this v2.x dataset
292
  }
293
  }
@@ -646,7 +644,7 @@ async function loadEpisodeDataV3(
646
  }
647
  }
648
  }
649
- } catch (error) {
650
  // Could not load tasks metadata - dataset might not have language tasks
651
  }
652
  }
@@ -663,15 +661,15 @@ function processEpisodeDataForCharts(
663
  info: DatasetMetadata,
664
  episodeMetadata?: EpisodeMetadataV3,
665
  ): { chartDataGroups: ChartDataGroup[]; ignoredColumns: string[] } {
666
-
667
- // Get numeric column features
668
- const columnNames = Object.entries(info.features)
669
- .filter(
670
- ([, value]) =>
671
- ["float32", "int32"].includes(value.dtype) &&
672
- value.shape.length === 1,
673
- )
674
- .map(([key, value]) => ({ key, value }));
675
 
676
  // Convert parquet data to chart format
677
  let seriesNames: string[] = [];
@@ -916,12 +914,16 @@ function processEpisodeDataForCharts(
916
  });
917
 
918
  // Utility function to group row keys by suffix (same as V2.1)
919
- function groupRowBySuffix(row: Record<string, number>): Record<string, any> {
920
- const result: Record<string, any> = {};
 
 
 
 
921
  const suffixGroups: Record<string, Record<string, number>> = {};
922
  for (const [key, value] of Object.entries(row)) {
923
  if (key === "timestamp") {
924
- result["timestamp"] = value;
925
  continue;
926
  }
927
  const parts = key.split(SERIES_NAME_DELIMITER);
@@ -1061,7 +1063,7 @@ async function loadEpisodeMetadataV3Simple(
1061
  // Not in this file, try the next one
1062
  fileIndex++;
1063
  }
1064
- } catch (error) {
1065
  // File doesn't exist - episode not found
1066
  throw new Error(`Episode ${episodeId} not found in metadata (searched up to file-${fileIndex.toString().padStart(3, "0")}.parquet)`);
1067
  }
 
14
  VideoInfo,
15
  AdjacentEpisodeVideos,
16
  ChartDataGroup,
 
 
17
  } from "@/types";
18
 
19
  const SERIES_NAME_DELIMITER = " | ";
 
216
  // Load data first
217
  try {
218
  allData = await readParquetAsObjects(arrayBuffer, []);
219
+ } catch {
220
  // Could not read parquet data
221
  }
222
 
 
285
  }
286
  }
287
  }
288
+ } catch {
289
  // No tasks metadata file for this v2.x dataset
290
  }
291
  }
 
644
  }
645
  }
646
  }
647
+ } catch {
648
  // Could not load tasks metadata - dataset might not have language tasks
649
  }
650
  }
 
661
  info: DatasetMetadata,
662
  episodeMetadata?: EpisodeMetadataV3,
663
  ): { chartDataGroups: ChartDataGroup[]; ignoredColumns: string[] } {
664
+
665
+ // Get numeric column features (not currently used but kept for reference)
666
+ // const columnNames = Object.entries(info.features)
667
+ // .filter(
668
+ // ([, value]) =>
669
+ // ["float32", "int32"].includes(value.dtype) &&
670
+ // value.shape.length === 1,
671
+ // )
672
+ // .map(([key, value]) => ({ key, value }));
673
 
674
  // Convert parquet data to chart format
675
  let seriesNames: string[] = [];
 
914
  });
915
 
916
  // Utility function to group row keys by suffix (same as V2.1)
917
+ function groupRowBySuffix(
918
+ row: Record<string, number>,
919
+ ): { timestamp: number; [key: string]: number | Record<string, number> } {
920
+ const result: { timestamp: number; [key: string]: number | Record<string, number> } = {
921
+ timestamp: 0,
922
+ };
923
  const suffixGroups: Record<string, Record<string, number>> = {};
924
  for (const [key, value] of Object.entries(row)) {
925
  if (key === "timestamp") {
926
+ result.timestamp = value;
927
  continue;
928
  }
929
  const parts = key.split(SERIES_NAME_DELIMITER);
 
1063
  // Not in this file, try the next one
1064
  fileIndex++;
1065
  }
1066
+ } catch {
1067
  // File doesn't exist - episode not found
1068
  throw new Error(`Episode ${episodeId} not found in metadata (searched up to file-${fileIndex.toString().padStart(3, "0")}.parquet)`);
1069
  }
src/app/explore/explore-grid.tsx CHANGED
@@ -2,8 +2,6 @@
2
 
3
  import React, { useEffect, useRef } from "react";
4
  import Link from "next/link";
5
-
6
- import { useRouter, useSearchParams } from "next/navigation";
7
  import { postParentMessageWithParams } from "@/utils/postParentMessage";
8
 
9
  type ExploreGridProps = {
 
2
 
3
  import React, { useEffect, useRef } from "react";
4
  import Link from "next/link";
 
 
5
  import { postParentMessageWithParams } from "@/utils/postParentMessage";
6
 
7
  type ExploreGridProps = {
src/components/data-recharts.tsx CHANGED
@@ -28,14 +28,14 @@ export const DataRecharts = React.memo(
28
  // Shared hoveredTime for all graphs
29
  const [hoveredTime, setHoveredTime] = useState<number | null>(null);
30
 
31
- if (!Array.isArray(data) || data.length === 0) return null;
32
-
33
  useEffect(() => {
34
  if (typeof onChartsReady === "function") {
35
  onChartsReady();
36
  }
37
  }, [onChartsReady]);
38
 
 
 
39
  return (
40
  <div className="grid md:grid-cols-2 grid-cols-1 gap-4">
41
  {data.map((group, idx) => (
 
28
  // Shared hoveredTime for all graphs
29
  const [hoveredTime, setHoveredTime] = useState<number | null>(null);
30
 
 
 
31
  useEffect(() => {
32
  if (typeof onChartsReady === "function") {
33
  onChartsReady();
34
  }
35
  }, [onChartsReady]);
36
 
37
+ if (!Array.isArray(data) || data.length === 0) return null;
38
+
39
  return (
40
  <div className="grid md:grid-cols-2 grid-cols-1 gap-4">
41
  {data.map((group, idx) => (