Skip to content

Commit 9a6ad28

Browse files
Boshenclaude
andcommitted
fix: resolve all lint warnings
- Update tsconfig to ES2023 for toSorted() support - Replace sort() with toSorted() for immutable array sorting - Replace unsafe `as number` casts with Number() conversion - Remove unnecessary `as any` casts where types are inferred - Use Record<string, any> instead of bare `as any` Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ef1a566 commit 9a6ad28

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

apps/dashboard/src/components/minification/CompressionRatioChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function CompressionRatioChart({ data }: CompressionRatioChartProps) {
5151
<LabelList
5252
dataKey="value"
5353
position="top"
54-
formatter={(label) => `${label as number}%`}
54+
formatter={(label) => `${Number(label)}%`}
5555
style={{ fontSize: "10px", fill: "#94a3b8" }}
5656
/>
5757
</Bar>

apps/dashboard/src/components/minification/MinificationTimeChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function MinificationTimeChart({ data }: MinificationTimeChartProps) {
4848
<LabelList
4949
dataKey="value"
5050
position="top"
51-
formatter={(label) => `${label as number}ms`}
51+
formatter={(label) => `${Number(label)}ms`}
5252
style={{ fontSize: "12px", fill: "#94a3b8" }}
5353
/>
5454
</Bar>

apps/dashboard/src/components/rolldown/BuildTimeChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ const buildTimeData = rolldownStats
1818
name: `v${stat.version}`,
1919
value: stat.buildTime,
2020
version: stat.version,
21-
publicationDate: (stat as any).publicationDate,
21+
publicationDate: stat.publicationDate,
2222
}))
23-
.sort((a, b) => semver.compare(a.version, b.version));
23+
.toSorted((a, b) => semver.compare(a.version, b.version));
2424

2525
export function BuildTimeChart() {
2626
return (
@@ -55,7 +55,7 @@ export function BuildTimeChart() {
5555
<LabelList
5656
dataKey="value"
5757
position="top"
58-
formatter={(label) => `${label as number}ms`}
58+
formatter={(label) => `${Number(label)}ms`}
5959
style={{ fontSize: "11px", fill: "#94a3b8" }}
6060
/>
6161
</Bar>

apps/dashboard/src/components/rolldown/BundleSizeChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import * as semver from "semver";
1515
import rolldownStats from "../../../../../data/rolldown-version-stats.json";
1616

17-
const sortedRolldownStats = [...rolldownStats].sort((a, b) => semver.compare(a.version, b.version));
17+
const sortedRolldownStats = [...rolldownStats].toSorted((a, b) => semver.compare(a.version, b.version));
1818

1919
const bundleSizeDiffData = sortedRolldownStats.map((stat, index) => {
2020
if (index === 0) {
@@ -25,7 +25,7 @@ const bundleSizeDiffData = sortedRolldownStats.map((stat, index) => {
2525
currentSize: stat.totalSize,
2626
isBaseline: true,
2727
version: stat.version,
28-
publicationDate: (stat as any).publicationDate,
28+
publicationDate: stat.publicationDate,
2929
};
3030
}
3131

@@ -40,7 +40,7 @@ const bundleSizeDiffData = sortedRolldownStats.map((stat, index) => {
4040
currentSize: currentSize,
4141
isBaseline: false,
4242
version: stat.version,
43-
publicationDate: (stat as any).publicationDate,
43+
publicationDate: stat.publicationDate,
4444
};
4545
});
4646

apps/dashboard/tsconfig.app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
33
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4-
"target": "ES2022",
4+
"target": "ES2023",
55
"useDefineForClassFields": true,
6-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
6+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
77
"module": "ESNext",
88
"skipLibCheck": true,
99

packages/utils/src/minification-data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export const popularMinifiers = ["terser", "esbuild", "@swc/core", "uglify-js",
44

55
export const libraries = Object.entries(minificationData)
66
.map(([name, data]: [string, any]) => ({ name, size: data.size }))
7-
.sort((a, b) => b.size - a.size)
7+
.toSorted((a, b) => b.size - a.size)
88
.map((item) => item.name);
99

1010
export const getLibraryData = (library: string, metric: "time" | "compression") => {
11-
const libraryData = (minificationData as any)[library];
11+
const libraryData = (minificationData as Record<string, any>)[library];
1212
const data: any[] = [];
1313

1414
popularMinifiers.forEach((minifier) => {
@@ -57,7 +57,7 @@ export const getLibraryData = (library: string, metric: "time" | "compression")
5757
});
5858

5959
// Sort data: time from smallest to largest (fastest to slowest), compression from largest to smallest (best to worst)
60-
return data.sort((a, b) =>
60+
return data.toSorted((a, b) =>
6161
metric === "time" ? a.value - b.value : a.minzippedBytes - b.minzippedBytes,
6262
);
6363
};

tools/override-rolldown.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async function fetchStableVersions() {
3030
res.on("end", () => {
3131
try {
3232
const packageInfo = JSON.parse(data);
33-
let versions = Object.keys(packageInfo.versions).sort((a, b) => {
33+
let versions = Object.keys(packageInfo.versions).toSorted((a, b) => {
3434
// Sort by publication date (most recent last)
3535
const dateA = new Date(packageInfo.time[a]);
3636
const dateB = new Date(packageInfo.time[b]);

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2020",
3+
"target": "ES2023",
44
"useDefineForClassFields": true,
5-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
5+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
66
"module": "ESNext",
77
"skipLibCheck": true,
88

0 commit comments

Comments
 (0)