Skip to content

Commit 6799f65

Browse files
committed
style: fix lint errors
1 parent ab8c22b commit 6799f65

File tree

9 files changed

+8
-11
lines changed

9 files changed

+8
-11
lines changed

src/auth/is-auth-session-expired.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ export function isAuthSessionExpired(authSession: AuthSession) {
88

99
const accessTokenPart2 = accessToken.split('.')[1]
1010
const buf = Buffer.from(accessTokenPart2, 'base64')
11-
const exp = <number>JSON.parse(buf.toString()).exp
11+
const exp = JSON.parse(buf.toString()).exp as number
1212
return exp * 1000 < Date.now()
1313
}

src/cmd/blog-export/download.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Progress } from 'got'
99
import path from 'path'
1010
import { promisify } from 'util'
1111
import { WorkspaceCfg } from '@/ctx/cfg/workspace'
12-
// eslint-disable-next-line @typescript-eslint/naming-convention
1312
import AdmZip from 'adm-zip'
1413
import { setCtx } from '@/ctx/global-ctx'
1514
import { fsUtil } from '@/infra/fs/fsUtil'
@@ -46,7 +45,7 @@ export async function downloadBlogExport(treeItem?: BlogExportRecordTreeItem) {
4645
treeItem.reportDownloadingProgress({ percentage, transferred, total: total ?? transferred })
4746
blogExportProvider?.refreshItem(treeItem)
4847
})
49-
.on('error', e => {
48+
.on('error', (e: { toString: () => string }) => {
5049
treeItem.reportDownloadingProgress(null)
5150
void onError('下载博客备份失败' + ', ' + e.toString())
5251
})

src/cmd/ing/pub-ing-with-input.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class InteractiveState {
7777
}
7878

7979
private async showConfirm() {
80-
// eslint-disable-next-line no-constant-condition
8180
while (true) {
8281
const items = [
8382
['确定', () => Promise.resolve(true)],

src/cmd/post-cat/input-post-cat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export async function inputPostCat(parentTitle: string, cat?: PostCat) {
4444
const title = await setupTitle(parentTitle, cat?.title ?? '')
4545
const isVisible = await setupVisible(title)
4646
const description = await setupDescription(title, cat?.description ?? '')
47-
return <PostCatAddDto>{
47+
return {
4848
title,
4949
visible: isVisible,
5050
description,
51-
}
51+
} as PostCatAddDto
5252
} catch (_) {
5353
// input canceled, do nothing
5454
}

src/cmd/post-cat/update-post-cat-treeview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function updatePostCatTreeView(arg?: PostCat | PostCatTreeItem) {
3535
await postCategoryDataProvider.refreshAsync()
3636
p.report({ increment: 100 })
3737
} catch (e) {
38-
void Alert.err(`更新博文失败: ${<string>e}`)
38+
void Alert.err(`更新博文失败: ${e as string}`)
3939
p.report({ increment: 100 })
4040
}
4141
})

src/cmd/post-list/del-post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function delSelectedPost(arg: unknown) {
8484
postIds: selectedPost.map(({ id }) => id),
8585
})
8686
} catch (e) {
87-
void Alert.err(`删除博文失败: ${<string>e}`)
87+
void Alert.err(`删除博文失败: ${e as string}`)
8888
}
8989

9090
progress.report({ increment: 100 })

src/cmd/post-list/post-pull.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export async function postPull(input: InputType, showConfirm = true, mute = fals
6161
uriPath = fileUri.path
6262
const fsPath = fileUri.fsPath
6363
const fileName = path.basename(fsPath)
64-
// eslint-disable-next-line @typescript-eslint/naming-convention
6564
const fileExists = await fsUtil.exists(fsPath)
6665

6766
if (fileExists) {

src/cmd/post-list/upload-post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export async function uploadPost(input?: Post | PostTreeItem | PostEditDto, conf
172172
await PostListView.refresh()
173173
} catch (e) {
174174
progress.report({ increment: 100 })
175-
void Alert.err(`上传失败: ${<string>e}`)
175+
void Alert.err(`上传失败: ${e as string}`)
176176
}
177177

178178
return isSaved

src/infra/alert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class Alert {
2626
* @param file the file path, could be a string or {@link Uri} object
2727
* @param trimExt
2828
*/
29-
fileNotLinkedToPost(file: string | Uri, { trimExt = true } = {}) {
29+
static fileNotLinkedToPost(file: string | Uri, { trimExt = true } = {}) {
3030
file = file instanceof Uri ? file.fsPath : file
3131
file = trimExt ? path.basename(file, path.extname(file)) : file
3232
void Alert.warn(`本地文件 ${file} 未关联博客园博文`)

0 commit comments

Comments
 (0)