chore: fix vue prettier rules (max-attributes-per-line), reformat all codes

This commit is contained in:
leejooy96 committed 2025-06-20 18:15:47 +09:00
1 parent f225b4e54a
commit 2fb64f03ec
17 files changed
+181 -44

No files matched your search

+3 -1
View File
@@ -12,6 +12,8 @@
"insertPragma": false, "insertPragma": false,
"requirePragma": false, "requirePragma": false,
"proseWrap": "never", "proseWrap": "never",
"singleAttributePerLine": true,
"htmlWhitespaceSensitivity": "strict", "htmlWhitespaceSensitivity": "strict",
"endOfLine": "lf" "endOfLine": "lf",
"printWidth": 80
} }
+6 -2
View File
@@ -5,7 +5,8 @@ import { withI18n } from 'vitepress-i18n'
import type { VitePressSidebarOptions } from 'vitepress-sidebar/types' import type { VitePressSidebarOptions } from 'vitepress-sidebar/types'
import type { VitePressI18nOptions } from 'vitepress-i18n/types' import type { VitePressI18nOptions } from 'vitepress-i18n/types'
const capitalizeFirst = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1) const capitalizeFirst = (str: string): string =>
str.charAt(0).toUpperCase() + str.slice(1)
const supportLocales = ['en', 'ko', 'zhHans'] const supportLocales = ['en', 'ko', 'zhHans']
const defaultLocale: string = supportLocales[0] const defaultLocale: string = supportLocales[0]
@@ -96,5 +97,8 @@ const vitePressConfigs: UserConfig = {
} }
export default defineConfig( export default defineConfig(
withSidebar(withI18n(vitePressConfigs, vitePressI18nConfigs), vitePressSidebarConfigs) withSidebar(
withI18n(vitePressConfigs, vitePressI18nConfigs),
vitePressSidebarConfigs
)
) )
@@ -33,7 +33,7 @@ order: 3
Used only for contributing to project documentation. Must be run from the `docs` directory location. Used only for contributing to project documentation. Must be run from the `docs` directory location.
| Script Name | Description | | Script Name | Description |
| ----------- | ------------------------------------------------------------------ | | --- | --- |
| `dev` | Start the local document server. (For development) | | `dev` | Start the local document server. (For development) |
| `build` | Build a local document server. Used only for GitHub page builders. | | `build` | Build a local document server. Used only for GitHub page builders. |
| `serve` | Start the local document server. | | `serve` | Start the local document server. |
@@ -33,7 +33,7 @@ order: 3
프로젝트 문서에 기여하는 경우에만 사용됩니다. `docs` 디렉토리 위치에서 실행해야 합니다. 프로젝트 문서에 기여하는 경우에만 사용됩니다. `docs` 디렉토리 위치에서 실행해야 합니다.
| Script Name | Description | | Script Name | Description |
| ----------- | ------------------------------------------------------------------ | | --- | --- |
| `dev` | Start the local document server. (For development) | | `dev` | Start the local document server. (For development) |
| `build` | Build a local document server. Used only for GitHub page builders. | | `build` | Build a local document server. Used only for GitHub page builders. |
| `serve` | Start the local document server. | | `serve` | Start the local document server. |
@@ -10,7 +10,7 @@ order: 3
## 一般情况 ## 一般情况
| 脚本名称 | 说明 | | 脚本名称 | 说明 |
| ----------------- | ---------------------------------------------------------- | | --- | --- |
| `dev` | 启动电子作为开发环境 | | `dev` | 启动电子作为开发环境 |
| `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) | | `dev:debug` | 将 Electron 作为开发环境启动(使用 vite debug) |
| `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) | | `dev:debug:force` | 以Electron作为开发环境启动(使用vite调试+清理vite缓存) |
+11
View File
@@ -60,6 +60,17 @@ export default pluginTypeScriptESLint.config(
'vue/v-on-event-hyphenation': 'off', 'vue/v-on-event-hyphenation': 'off',
'vue/no-v-text-v-html-on-component': 'off', 'vue/no-v-text-v-html-on-component': 'off',
'vue/attribute-hyphenation': 'off', 'vue/attribute-hyphenation': 'off',
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 1
},
multiline: {
max: 1
}
}
],
'@typescript-eslint/no-explicit-any': 'off' '@typescript-eslint/no-explicit-any': 'off'
} }
} }
+10 -4
View File
@@ -12,12 +12,17 @@ export default class IPCs {
}) })
// Open url via web browser // Open url via web browser
ipcMain.on('msgOpenExternalLink', async (event: IpcMainEvent, url: string) => { ipcMain.on(
'msgOpenExternalLink',
async (event: IpcMainEvent, url: string) => {
await shell.openExternal(url) await shell.openExternal(url)
}) }
)
// Open file // Open file
ipcMain.handle('msgOpenFile', async (event: IpcMainEvent, filter: string) => { ipcMain.handle(
'msgOpenFile',
async (event: IpcMainEvent, filter: string) => {
const filters = [] const filters = []
if (filter === 'text') { if (filter === 'text') {
filters.push({ name: 'Text', extensions: ['txt', 'json'] }) filters.push({ name: 'Text', extensions: ['txt', 'json'] })
@@ -29,6 +34,7 @@ export default class IPCs {
filters filters
}) })
return dialogResult return dialogResult
}) }
)
} }
} }
+5 -1
View File
@@ -38,7 +38,11 @@ app.on('window-all-closed', () => {
app.on( app.on(
'render-process-gone', 'render-process-gone',
(event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => { (
event: Event,
webContents: WebContents,
details: RenderProcessGoneDetails
) => {
errorWindow = createErrorWindow(errorWindow, mainWindow, details) errorWindow = createErrorWindow(errorWindow, mainWindow, details)
} }
) )
+3 -1
View File
@@ -97,7 +97,9 @@ function calculateWindowPosition(b) {
const screenBounds = screen.getPrimaryDisplay().size const screenBounds = screen.getPrimaryDisplay().size
const trayBounds = tray.getBounds() const trayBounds = tray.getBounds()
const bottom = trayBounds.y > screenBounds.height / 2 const bottom = trayBounds.y > screenBounds.height / 2
const x = Math.floor(trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2) const x = Math.floor(
trayBounds.x - b.width / 2 - margin.x + trayBounds.width / 2
)
const y = bottom const y = bottom
? Math.floor(trayBounds.y - b.height - margin.y + trayBounds.height / 2) ? Math.floor(trayBounds.y - b.height - margin.y + trayBounds.height / 2)
: Math.floor(trayBounds.y + margin.y + trayBounds.height / 2) : Math.floor(trayBounds.y + margin.y + trayBounds.height / 2)
+17 -4
View File
@@ -1,7 +1,11 @@
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron' import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'
// Whitelist of valid channels used for IPC communication (Send message from Renderer to Main) // Whitelist of valid channels used for IPC communication (Send message from Renderer to Main)
const mainAvailChannels: string[] = ['msgRequestGetVersion', 'msgOpenExternalLink', 'msgOpenFile'] const mainAvailChannels: string[] = [
'msgRequestGetVersion',
'msgOpenExternalLink',
'msgOpenFile'
]
const rendererAvailChannels: string[] = [] const rendererAvailChannels: string[] = []
contextBridge.exposeInMainWorld('mainApi', { contextBridge.exposeInMainWorld('mainApi', {
@@ -15,21 +19,30 @@ contextBridge.exposeInMainWorld('mainApi', {
throw new Error(`Unknown ipc channel name: ${channel}`) throw new Error(`Unknown ipc channel name: ${channel}`)
} }
}, },
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => { on: (
channel: string,
listener: (event: IpcRendererEvent, ...args: any[]) => void
): void => {
if (rendererAvailChannels.includes(channel)) { if (rendererAvailChannels.includes(channel)) {
ipcRenderer.on(channel, listener) ipcRenderer.on(channel, listener)
} else { } else {
throw new Error(`Unknown ipc channel name: ${channel}`) throw new Error(`Unknown ipc channel name: ${channel}`)
} }
}, },
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => { once: (
channel: string,
listener: (event: IpcRendererEvent, ...args: any[]) => void
): void => {
if (rendererAvailChannels.includes(channel)) { if (rendererAvailChannels.includes(channel)) {
ipcRenderer.once(channel, listener) ipcRenderer.once(channel, listener)
} else { } else {
throw new Error(`Unknown ipc channel name: ${channel}`) throw new Error(`Unknown ipc channel name: ${channel}`)
} }
}, },
off: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void => { off: (
channel: string,
listener: (event: IpcRendererEvent, ...args: any[]) => void
): void => {
if (rendererAvailChannels.includes(channel)) { if (rendererAvailChannels.includes(channel)) {
ipcRenderer.off(channel, listener) ipcRenderer.off(channel, listener)
} else { } else {
@@ -18,7 +18,10 @@ const isCurrentRoute = (path: string): boolean => {
} }
</script> </script>
<template> <template>
<v-app-bar color="primary" density="compact"> <v-app-bar
color="primary"
density="compact"
>
<v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title> <v-app-bar-title>{{ t(titleKey) }}</v-app-bar-title>
<template #append> <template #append>
<v-btn <v-btn
+4 -1
View File
@@ -6,5 +6,8 @@
<body> <body>
<div id="app"></div> <div id="app"></div>
</body> </body>
<script type="module" src="./main"></script> <script
type="module"
src="./main"
></script>
</html> </html>
+13 -1
View File
@@ -1,5 +1,17 @@
import { createVuetify } from 'vuetify' import { createVuetify } from 'vuetify'
import { ko, en, zhHans, zhHant, de, es, ja, fr, ru, pt, nl } from 'vuetify/locale' import {
ko,
en,
zhHans,
zhHant,
de,
es,
ja,
fr,
ru,
pt,
nl
} from 'vuetify/locale'
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg' import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'
import 'vuetify/styles' import 'vuetify/styles'
+78 -19
View File
@@ -4,7 +4,13 @@ import { useTheme } from 'vuetify'
import { openExternal, openFile } from '@/renderer/utils' import { openExternal, openFile } from '@/renderer/utils'
import { useCounterStore } from '@/renderer/store/counter' import { useCounterStore } from '@/renderer/store/counter'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { mdiBrightness6, mdiFileDocument, mdiFolderOpen, mdiGithub, mdiPlusCircle } from '@mdi/js' import {
mdiBrightness6,
mdiFileDocument,
mdiFolderOpen,
mdiGithub,
mdiPlusCircle
} from '@mdi/js'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
const { t, locale, availableLocales } = useI18n() const { t, locale, availableLocales } = useI18n()
@@ -58,9 +64,15 @@ const handleOpenFile = async () => {
<template> <template>
<v-container> <v-container>
<v-row no-gutters class="text-center align-center"> <v-row
<v-col cols="12" md="5"> no-gutters
<img class="text-center align-center"
>
<v-col
cols="12"
md="5"
>
<v-img
data-testid="main-logo" data-testid="main-logo"
alt="logo" alt="logo"
draggable="false" draggable="false"
@@ -68,56 +80,103 @@ const handleOpenFile = async () => {
src="/images/vutron-logo.webp" src="/images/vutron-logo.webp"
/> />
</v-col> </v-col>
<v-col cols="12" md="7"> <v-col
<h2 class="my-4">{{ t('desc.welcome-title') }}</h2> cols="12"
md="7"
>
<h2 class="my-4">
{{ t('desc.welcome-title') }}
</h2>
<p>{{ t('desc.welcome-desc') }}</p> <p>{{ t('desc.welcome-desc') }}</p>
<p class="my-4"> <p class="my-4">
App Version: <strong>{{ appVersion }}</strong> App Version: <strong>{{ appVersion }}</strong>
</p> </p>
<p v-if="selectedFile">{{ <p v-if="selectedFile">
{{
t('desc.selected-file', { t('desc.selected-file', {
filePath: selectedFile filePath: selectedFile
}) })
}}</p> }}
</p>
<v-row class="my-4"> <v-row class="my-4">
<v-col> <v-col>
<v-btn icon color="primary" @click="handleChangeTheme"> <v-btn
icon
color="primary"
@click="handleChangeTheme"
>
<v-icon :icon="mdiBrightness6" /> <v-icon :icon="mdiBrightness6" />
<v-tooltip activator="parent" location="bottom"> <v-tooltip
activator="parent"
location="bottom"
>
{{ t('menu.change-theme') }} {{ t('menu.change-theme') }}
</v-tooltip> </v-tooltip>
</v-btn> </v-btn>
</v-col> </v-col>
<v-col> <v-col>
<v-badge data-testid="counter-badge" color="blue" :content="count"> <v-badge
<v-btn data-testid="btn-counter" icon color="primary" @click="handleCountIncrease"> data-testid="counter-badge"
color="blue"
:content="count"
>
<v-btn
data-testid="btn-counter"
icon
color="primary"
@click="handleCountIncrease"
>
<v-icon :icon="mdiPlusCircle" /> <v-icon :icon="mdiPlusCircle" />
<v-tooltip activator="parent" location="bottom"> <v-tooltip
activator="parent"
location="bottom"
>
{{ t('menu.increase-count') }} {{ t('menu.increase-count') }}
</v-tooltip> </v-tooltip>
</v-btn> </v-btn>
</v-badge> </v-badge>
</v-col> </v-col>
<v-col> <v-col>
<v-btn icon color="primary" @click="handleOpenDocument"> <v-btn
icon
color="primary"
@click="handleOpenDocument"
>
<v-icon :icon="mdiFileDocument" /> <v-icon :icon="mdiFileDocument" />
<v-tooltip activator="parent" location="bottom"> <v-tooltip
activator="parent"
location="bottom"
>
{{ t('menu.documentation') }} {{ t('menu.documentation') }}
</v-tooltip> </v-tooltip>
</v-btn> </v-btn>
</v-col> </v-col>
<v-col> <v-col>
<v-btn icon color="primary" @click="handleOpenGitHub"> <v-btn
icon
color="primary"
@click="handleOpenGitHub"
>
<v-icon :icon="mdiGithub" /> <v-icon :icon="mdiGithub" />
<v-tooltip activator="parent" location="bottom"> <v-tooltip
activator="parent"
location="bottom"
>
{{ t('menu.github') }} {{ t('menu.github') }}
</v-tooltip> </v-tooltip>
</v-btn> </v-btn>
</v-col> </v-col>
<v-col> <v-col>
<v-btn icon color="primary" @click="handleOpenFile"> <v-btn
icon
color="primary"
@click="handleOpenFile"
>
<v-icon :icon="mdiFolderOpen" /> <v-icon :icon="mdiFolderOpen" />
<v-tooltip activator="parent" location="bottom"> <v-tooltip
activator="parent"
location="bottom"
>
{{ t('menu.open-file') }} {{ t('menu.open-file') }}
</v-tooltip> </v-tooltip>
</v-btn> </v-btn>
+15 -3
View File
@@ -7,11 +7,23 @@ const { t } = useI18n()
<template> <template>
<v-container> <v-container>
<v-row no-gutters class="text-center"> <v-row
no-gutters
class="text-center"
>
<v-col cols="12"> <v-col cols="12">
<v-icon :icon="mdiEmoticonCoolOutline" size="250" color="#009f57" /> <v-icon
:icon="mdiEmoticonCoolOutline"
size="250"
color="#009f57"
/>
</v-col>
<v-col
cols="12"
class="my-4"
>
{{ t('desc.second-desc') }}
</v-col> </v-col>
<v-col cols="12" class="my-4">{{ t('desc.second-desc') }}</v-col>
</v-row> </v-row>
</v-container> </v-container>
</template> </template>
+4 -2
View File
@@ -39,7 +39,8 @@ export const beforeAll = async () => {
page.on('console', console.log) page.on('console', console.log)
page.on('pageerror', console.log) page.on('pageerror', console.log)
const evaluateResult = await appElectron.evaluate(async ({ app, BrowserWindow }) => { const evaluateResult = await appElectron.evaluate(
async ({ app, BrowserWindow }) => {
const currentWindow = BrowserWindow.getFocusedWindow() const currentWindow = BrowserWindow.getFocusedWindow()
// Fix window position for testing // Fix window position for testing
@@ -50,7 +51,8 @@ export const beforeAll = async () => {
packaged: app.isPackaged, packaged: app.isPackaged,
dataPath: app.getPath('userData') dataPath: app.getPath('userData')
} }
}) }
)
base.expect(evaluateResult.packaged, 'app is not packaged').toBe(false) base.expect(evaluateResult.packaged, 'app is not packaged').toBe(false)
} }
+5 -1
View File
@@ -29,7 +29,11 @@ export default defineConfig(({ mode }) => {
{ {
entry: 'src/main/index.ts', entry: 'src/main/index.ts',
onstart({ startup }) { onstart({ startup }) {
const debugArgs = ['.', '--inspect=9228', '--remote-debugging-port=9229'] const debugArgs = [
'.',
'--inspect=9228',
'--remote-debugging-port=9229'
]
startup(debugArgs) startup(debugArgs)
}, },
vite: { vite: {