Skip to content

Commit 060a81a

Browse files
author
sxc
committed
fix: 修复所有 lint 错误以通过代码检查
1 parent 88ffbf3 commit 060a81a

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

apps/synapse/src/adapter/vxe-table/config/renderers.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function registerRenderers(vxeUI: VxeUIExport) {
136136
const { text, status, badge = false } = statusInfo;
137137

138138
if (badge) {
139-
let badgeStatus: 'success' | 'error' | 'default' = 'default';
139+
let badgeStatus: 'default' | 'error' | 'success' = 'default';
140140
if (status === 'success') {
141141
badgeStatus = 'success';
142142
} else if (status === 'error') {
@@ -168,13 +168,24 @@ export function registerRenderers(vxeUI: VxeUIExport) {
168168
);
169169
}
170170

171-
let tagColor: 'success' | 'error' | 'warning' | 'default' = 'default';
172-
if (status === 'success') {
173-
tagColor = 'success';
174-
} else if (status === 'error') {
175-
tagColor = 'error';
176-
} else if (status === 'warning') {
177-
tagColor = 'warning';
171+
let tagColor: 'default' | 'error' | 'success' | 'warning' = 'default';
172+
switch (status) {
173+
case 'error': {
174+
tagColor = 'error';
175+
176+
break;
177+
}
178+
case 'success': {
179+
tagColor = 'success';
180+
181+
break;
182+
}
183+
case 'warning': {
184+
tagColor = 'warning';
185+
186+
break;
187+
}
188+
// No default
178189
}
179190

180191
return h(

apps/synapse/src/adapter/vxe-table/grid.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function createGrid<T = any>(options: GridOptions<T>): GridInstance<T> {
176176
expandAll: options.treeConfig.expandAll || false,
177177
transform: (options.treeConfig as any).transform ?? true,
178178
};
179-
}
179+
}
180180

181181
// 创建状态开关函数(在初始化 grid 之前创建,避免循环依赖)
182182
const createStatusSwitch = (row: T, field = 'status') => {
@@ -199,7 +199,9 @@ export function createGrid<T = any>(options: GridOptions<T>): GridInstance<T> {
199199
if (gridApiRef.value) {
200200
gridApiRef.value.setLoading(true);
201201
}
202-
const result = await (options.api.enable as (id: any) => Promise<any>)((row as any).id);
202+
const result = await (
203+
options.api.enable as (id: any) => Promise<any>
204+
)((row as any).id);
203205
if (result.code === 200) {
204206
message.success(result.msg || $t('common.success'));
205207
if (gridApiRef.value) {
@@ -209,7 +211,6 @@ export function createGrid<T = any>(options: GridOptions<T>): GridInstance<T> {
209211
message.error(result.msg || $t('common.error'));
210212
}
211213
} catch (error) {
212-
// eslint-disable-next-line no-console
213214
console.error(error);
214215
message.error($t('common.error'));
215216
} finally {
@@ -238,7 +239,9 @@ export function createGrid<T = any>(options: GridOptions<T>): GridInstance<T> {
238239
if (gridApiRef.value) {
239240
gridApiRef.value.setLoading(true);
240241
}
241-
const result = await (options.api.remove as (ids: any[]) => Promise<any>)([(row as any).id]);
242+
const result = await (
243+
options.api.remove as (ids: any[]) => Promise<any>
244+
)([(row as any).id]);
242245
if (result.code === 200) {
243246
message.success($t('common.deleteSuccess'));
244247
if (gridApiRef.value) {
@@ -450,7 +453,6 @@ export function createGrid<T = any>(options: GridOptions<T>): GridInstance<T> {
450453

451454
return pageData;
452455
} catch (error) {
453-
// eslint-disable-next-line no-console
454456
console.error('数据加载错误', error);
455457
message.error($t('common.queryFailed'));
456458
// 返回空数据结构,避免表格错误

packages/effects/request/src/common/pagination.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ export type PageHttpResponse<T = any> = HttpResponse<PageResponse<T>>;
158158
* // 结果: { name?: string; age?: number; pageNo: number; pageSize: number; ... }
159159
* ```
160160
*/
161-
export type PaginatedRequest<T extends Record<string, any> = Record<string, any>> = PageRequest &
162-
T;
161+
export type PaginatedRequest<
162+
T extends Record<string, any> = Record<string, any>,
163+
> = PageRequest & T;
163164

164165
/**
165166
* 分页查询参数类型工具(兼容别名)
@@ -175,5 +176,6 @@ export type PaginatedRequest<T extends Record<string, any> = Record<string, any>
175176
* // 可以使用 pageNo 或 currentPage 或 page
176177
* ```
177178
*/
178-
export type PaginatedRequestAlias<T extends Record<string, any> = Record<string, any>> =
179-
PageRequestAlias & T;
179+
export type PaginatedRequestAlias<
180+
T extends Record<string, any> = Record<string, any>,
181+
> = PageRequestAlias & T;

0 commit comments

Comments
 (0)