Skip to content

Commit d8b5e4b

Browse files
committed
fix: lint
1 parent 6cfeb3c commit d8b5e4b

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/ui/chart.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* 支持 line、bar、pie、scatter、area、radar、gauge 图表类型
66
*/
77

8-
import { useMemo, useRef, useEffect } from 'react';
98
import * as echarts from 'echarts';
109
import type { ECharts, EChartsOption } from 'echarts';
10+
import { useMemo, useRef, useEffect } from 'react';
1111

1212
import { useTheme } from '../context/theme';
1313
import type {
@@ -65,12 +65,14 @@ function resolveValue<T>(
6565

6666
const arrayData = processor.getData(component, arrayPath!, surfaceId);
6767
if (Array.isArray(arrayData)) {
68-
return arrayData.map(item => {
69-
if (item && typeof item === 'object' && fieldName! in item) {
70-
return (item as Record<string, unknown>)[fieldName!];
71-
}
72-
return undefined;
73-
}).filter(v => v !== undefined) as T;
68+
return arrayData
69+
.map((item) => {
70+
if (item && typeof item === 'object' && fieldName! in item) {
71+
return (item as Record<string, unknown>)[fieldName!];
72+
}
73+
return undefined;
74+
})
75+
.filter((v) => v !== undefined) as T;
7476
}
7577
return undefined;
7678
}
@@ -183,7 +185,9 @@ export function Chart({
183185
if (chartType !== 'radar') return undefined;
184186

185187
// 从 xAxis.data 获取 indicator
186-
const indicatorData = xAxis?.data ? resolveValue(xAxis.data, component, processor, surfaceId) : undefined;
188+
const indicatorData = xAxis?.data
189+
? resolveValue(xAxis.data, component, processor, surfaceId)
190+
: undefined;
187191
if (!indicatorData || !Array.isArray(indicatorData)) return { indicator: [] };
188192

189193
return {
@@ -293,4 +297,3 @@ export function Chart({
293297
</div>
294298
);
295299
}
296-

test.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"帮我创建一个登录表单"
2+
"展示一个销售数据的折线图"
3+
"创建一个商品卡片"
4+
"做一个仪表盘"
5+
"展示所有组件"

0 commit comments

Comments
 (0)