Skip to content

Commit 2014532

Browse files
committed
type-aware linting
1 parent 3f03c65 commit 2014532

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

apps/dashboard/src/App.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const bundleSizeDiffData = rolldownStats.map((stat, index) => {
2727
isBaseline: true
2828
}
2929
}
30-
30+
3131
const prevSize = rolldownStats[index - 1].totalSize
3232
const currentSize = stat.totalSize
3333
const diff = currentSize - prevSize
34-
34+
3535
return {
3636
name: `v${stat.version}`,
3737
value: diff,
@@ -48,15 +48,15 @@ function App() {
4848
const bundleSizeDiffTooltipFormatter = (value: any, name: string, props: any) => {
4949
const data = props.payload
5050
if (!data) return [value, name]
51-
51+
5252
if (data.isBaseline) {
5353
return [`${formatNumberWithCommas(data.currentSize)} bytes (baseline)`, 'Bundle Size']
5454
}
55-
55+
5656
const sign = value >= 0 ? '+' : ''
5757
const changeText = `${sign}${formatNumberWithCommas(value)} bytes`
5858
const fromTo = `(${formatNumberWithCommas(data.previousSize)}${formatNumberWithCommas(data.currentSize)})`
59-
59+
6060
return [`${changeText} ${fromTo}`, 'Size Change']
6161
}
6262

@@ -86,7 +86,9 @@ function App() {
8686
<button
8787
key={metric.id}
8888
className={`nav-button ${selectedMetric === metric.id ? 'active' : ''}`}
89-
onClick={() => setSelectedMetric(metric.id)}
89+
onClick={() => {
90+
setSelectedMetric(metric.id)
91+
}}
9092
>
9193
<Icon size={20} />
9294
{metric.name}
@@ -102,18 +104,18 @@ function App() {
102104
{selectedMetric === 'bundleSize' ? (
103105
<BarChart data={currentMetric.data}>
104106
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
105-
<XAxis
106-
dataKey="name"
107+
<XAxis
108+
dataKey="name"
107109
tick={{ fill: '#374151', fontSize: 12 }}
108110
axisLine={{ stroke: '#d1d5db' }}
109111
tickLine={{ stroke: '#d1d5db' }}
110112
/>
111-
<YAxis
113+
<YAxis
112114
tick={{ fill: '#374151', fontSize: 12 }}
113115
axisLine={{ stroke: '#d1d5db' }}
114116
tickLine={{ stroke: '#d1d5db' }}
115117
/>
116-
<Tooltip
118+
<Tooltip
117119
formatter={bundleSizeDiffTooltipFormatter}
118120
contentStyle={{
119121
backgroundColor: 'white',
@@ -123,12 +125,12 @@ function App() {
123125
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)'
124126
}}
125127
/>
126-
<Legend
128+
<Legend
127129
wrapperStyle={{ color: '#374151' }}
128130
/>
129131
<Bar dataKey="value" name="Bundle Size Change (bytes)">
130132
{currentMetric.data.map((entry: any, index: number) => (
131-
<Cell
133+
<Cell
132134
key={`cell-${index}`}
133135
fill={entry.isBaseline ? '#6b7280' : (entry.value >= 0 ? '#dc2626' : '#16a34a')}
134136
/>
@@ -138,18 +140,18 @@ function App() {
138140
) : (
139141
<BarChart data={currentMetric.data}>
140142
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
141-
<XAxis
142-
dataKey="name"
143+
<XAxis
144+
dataKey="name"
143145
tick={{ fill: '#374151', fontSize: 12 }}
144146
axisLine={{ stroke: '#d1d5db' }}
145147
tickLine={{ stroke: '#d1d5db' }}
146148
/>
147-
<YAxis
149+
<YAxis
148150
tick={{ fill: '#374151', fontSize: 12 }}
149151
axisLine={{ stroke: '#d1d5db' }}
150152
tickLine={{ stroke: '#d1d5db' }}
151153
/>
152-
<Tooltip
154+
<Tooltip
153155
contentStyle={{
154156
backgroundColor: 'white',
155157
border: '1px solid #d1d5db',
@@ -158,11 +160,11 @@ function App() {
158160
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)'
159161
}}
160162
/>
161-
<Legend
163+
<Legend
162164
wrapperStyle={{ color: '#374151' }}
163165
/>
164-
<Bar
165-
dataKey="value"
166+
<Bar
167+
dataKey="value"
166168
fill="url(#buildTimeGradient)"
167169
name="Build Time (ms)"
168170
/>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "pnpm --filter dashboard dev",
88
"build": "pnpm -r build",
9-
"lint": "vp lint",
9+
"lint": "vp lint --type-aware",
1010
"test": "pnpm -r test",
1111
"clean": "pnpm -r clean",
1212
"build-deploy": "pnpm lint && pnpm build",

0 commit comments

Comments
 (0)