Skip to content

Commit 2fb64f0

Browse files
committed
chore: fix vue prettier rules (max-attributes-per-line), reformat all codes
1 parent f225b4e commit 2fb64f0

File tree

17 files changed

+227
-90
lines changed

17 files changed

+227
-90
lines changed

.prettierrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"insertPragma": false,
1313
"requirePragma": false,
1414
"proseWrap": "never",
15+
"singleAttributePerLine": true,
1516
"htmlWhitespaceSensitivity": "strict",
16-
"endOfLine": "lf"
17+
"endOfLine": "lf",
18+
"printWidth": 80
1719
}

docs/src/.vitepress/config.mts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { withI18n } from 'vitepress-i18n'
55
import type { VitePressSidebarOptions } from 'vitepress-sidebar/types'
66
import type { VitePressI18nOptions } from 'vitepress-i18n/types'
77

8-
const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
8+
const capitalizeFirst = (str: string): string =>
9+
str.charAt(0).toUpperCase() + str.slice(1)
910
const supportLocales = ['en', 'ko', 'zhHans']
1011
const defaultLocale: string = supportLocales[0]
1112

@@ -96,5 +97,8 @@ const vitePressConfigs: UserConfig = {
9697
}
9798

9899
export default defineConfig(
99-
withSidebar(withI18n(vitePressConfigs, vitePressI18nConfigs), vitePressSidebarConfigs)
100+
withSidebar(
101+
withI18n(vitePressConfigs, vitePressI18nConfigs),
102+
vitePressSidebarConfigs
103+
)
100104
)

docs/src/en/installation-and-build/npm-scripts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ order: 3
3232

3333
Used only for contributing to project documentation. Must be run from the `docs` directory location.
3434

35-
| Script Name | Description |
36-
| ----------- | ------------------------------------------------------------------ |
37-
| `dev` | Start the local document server. (For development) |
38-
| `build` | Build a local document server. Used only for GitHub page builders. |
39-
| `serve` | Start the local document server. |
35+
| Script Name | Description |
36+
| --- | --- |
37+
| `dev` | Start the local document server. (For development) |
38+
| `build` | Build a local document server. Used only for GitHub page builders. |
39+
| `serve` | Start the local document server. |

docs/src/ko/installation-and-build/npm-scripts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ order: 3
3232

3333
프로젝트 문서에 기여하는 경우에만 사용됩니다. `docs` 디렉토리 위치에서 실행해야 합니다.
3434

35-
| Script Name | Description |
36-
| ----------- | ------------------------------------------------------------------ |
37-
| `dev` | Start the local document server. (For development) |
38-
| `build` | Build a local document server. Used only for GitHub page builders. |
39-
| `serve` | Start the local document server. |
35+
| Script Name | Description |
36+
| --- | --- |
37+
| `dev` | Start the local document server. (For development) |
38+
| `build` | Build a local document server. Used only for GitHub page builders. |
39+
| `serve` | Start the local document server. |

docs/src/zhHans/installation-and-build/npm-scripts.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ order: 3
99
1010
## 一般情况
1111

12-
| 脚本名称 | 说明 |
13-
| ----------------- | ---------------------------------------------------------- |
14-
| `dev` | 启动电子作为开发环境 |
15-
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
16-
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
17-
| `build:pre` | 通常在编译时运行的命令。此脚本无需单独运行。 |
18-
| `build` | 为当前操作系统打包。 |
19-
| `build:all` | 为整个操作系统构建指定软件包(需要跨平台构建配置) |
20-
| `build:dir` | `electron-builder`目录构建 |
21-
| `build:mac` | 为macOS构建预配置软件包 |
22-
| `build:linux` | 为Linux构建预配置软件包 |
23-
| `build:win` | 为Windows构建预配置软件包 |
24-
| `lint` | ESLint代码检查。它不会修改代码。 |
25-
| `lint:fix` | ESLint代码检查。使用自动修复功能修复代码。 |
26-
| `format` | 更漂亮的代码检查。它不会修改代码。 |
27-
| `format:fix` | 更漂亮的代码检查。使用自动修复功能修复代码。 |
28-
| `test` | 根据测试规范文件构建测试包并运行测试。 |
29-
| `test:linux` | 根据测试规范文件构建测试包并运行测试。(仅适用于linux ci) |
12+
| 脚本名称 | 说明 |
13+
| --- | --- |
14+
| `dev` | 启动电子作为开发环境 |
15+
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
16+
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
17+
| `build:pre` | 通常在编译时运行的命令。此脚本无需单独运行。 |
18+
| `build` | 为当前操作系统打包。 |
19+
| `build:all` | 为整个操作系统构建指定软件包(需要跨平台构建配置) |
20+
| `build:dir` | `electron-builder`目录构建 |
21+
| `build:mac` | 为macOS构建预配置软件包 |
22+
| `build:linux` | 为Linux构建预配置软件包 |
23+
| `build:win` | 为Windows构建预配置软件包 |
24+
| `lint` | ESLint代码检查。它不会修改代码。 |
25+
| `lint:fix` | ESLint代码检查。使用自动修复功能修复代码。 |
26+
| `format` | 更漂亮的代码检查。它不会修改代码。 |
27+
| `format:fix` | 更漂亮的代码检查。使用自动修复功能修复代码。 |
28+
| `test` | 根据测试规范文件构建测试包并运行测试。 |
29+
| `test:linux` | 根据测试规范文件构建测试包并运行测试。(仅适用于linux ci) |
3030

3131
## 文档
3232

eslint.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ export default pluginTypeScriptESLint.config(
6060
'vue/v-on-event-hyphenation': 'off',
6161
'vue/no-v-text-v-html-on-component': 'off',
6262
'vue/attribute-hyphenation': 'off',
63+
'vue/max-attributes-per-line': [
64+
'error',
65+
{
66+
singleline: {
67+
max: 1
68+
},
69+
multiline: {
70+
max: 1
71+
}
72+
}
73+
],
6374
'@typescript-eslint/no-explicit-any': 'off'
6475
}
6576
}

src/main/IPCs.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,29 @@ export default class IPCs {
1212
})
1313

1414
// Open url via web browser
15-
ipcMain.on('msgOpenExternalLink', async (event: IpcMainEvent, url: string) => {
16-
await shell.openExternal(url)
17-
})
15+
ipcMain.on(
16+
'msgOpenExternalLink',
17+
async (event: IpcMainEvent, url: string) => {
18+
await shell.openExternal(url)
19+
}
20+
)
1821

1922
// Open file
20-
ipcMain.handle('msgOpenFile', async (event: IpcMainEvent, filter: string) => {
21-
const filters = []
22-
if (filter === 'text') {
23-
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
24-
} else if (filter === 'zip') {
25-
filters.push({ name: 'Zip', extensions: ['zip'] })
23+
ipcMain.handle(
24+
'msgOpenFile',
25+
async (event: IpcMainEvent, filter: string) => {
26+
const filters = []
27+
if (filter === 'text') {
28+
filters.push({ name: 'Text', extensions: ['txt', 'json'] })
29+
} else if (filter === 'zip') {
30+
filters.push({ name: 'Zip', extensions: ['zip'] })
31+
}
32+
const dialogResult = await dialog.showOpenDialog({
33+
properties: ['openFile'],
34+
filters
35+
})
36+
return dialogResult
2637
}
27-
const dialogResult = await dialog.showOpenDialog({
28-
properties: ['openFile'],
29-
filters
30-
})
31-
return dialogResult
32-
})
38+
)
3339
}
3440
}

src/main/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ app.on('window-all-closed', () => {
3838

3939
app.on(
4040
'render-process-gone',
41-
(event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => {
41+
(
42+
event: Event,
43+
webContents: WebContents,
44+
details: RenderProcessGoneDetails
45+
) => {
4246
errorWindow = createErrorWindow(errorWindow, mainWindow, details)
4347
}
4448
)

src/main/tray.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ function calculateWindowPosition(b) {
9797
const screenBounds = screen.getPrimaryDisplay().size
9898
const trayBounds = tray.getBounds()
9999
const bottom = trayBounds.y > screenBounds.height / 2
100-
const x = Math.floor(trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2)
100+
const x = Math.floor(
101+
trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2
102+
)
101103
const y = bottom
102104
? Math.floor(trayBounds.y - b.height - margin.y + trayBounds.height / 2)
103105
: Math.floor(trayBounds.y + margin.y + trayBounds.height / 2)

src/preload/index.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'
22

33
// Whitelist of valid channels used for IPC communication (Send message from Renderer to Main)
4-
const mainAvailChannels: string[] = ['msgRequestGetVersion', 'msgOpenExternalLink', 'msgOpenFile']
4+
const mainAvailChannels: string[] = [
5+
'msgRequestGetVersion',
6+
'msgOpenExternalLink',
7+
'msgOpenFile'
8+
]
59
const rendererAvailChannels: string[] = []
610

711
contextBridge.exposeInMainWorld('mainApi', {
@@ -15,21 +19,30 @@ contextBridge.exposeInMainWorld('mainApi', {
1519
throw new Error(`Unknown ipc channel name: ${channel}`)
1620
}
1721
},
18-
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
22+
on: (
23+
channel: string,
24+
listener: (event: IpcRendererEvent, ...args: any[]) => void
25+
): void => {
1926
if (rendererAvailChannels.includes(channel)) {
2027
ipcRenderer.on(channel, listener)
2128
} else {
2229
throw new Error(`Unknown ipc channel name: ${channel}`)
2330
}
2431
},
25-
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
32+
once: (
33+
channel: string,
34+
listener: (event: IpcRendererEvent, ...args: any[]) => void
35+
): void => {
2636
if (rendererAvailChannels.includes(channel)) {
2737
ipcRenderer.once(channel, listener)
2838
} else {
2939
throw new Error(`Unknown ipc channel name: ${channel}`)
3040
}
3141
},
32-
off: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => {
42+
off: (
43+
channel: string,
44+
listener: (event: IpcRendererEvent, ...args: any[]) => void
45+
): void => {
3346
if (rendererAvailChannels.includes(channel)) {
3447
ipcRenderer.off(channel, listener)
3548
} else {

0 commit comments

Comments
 (0)