fix(desktop-ui): resolve linting and typecheck errors (#7271)

Fixes linting configuration and type errors in apps/desktop-ui.

## Changes
- Updated `eslint.config.ts` to use absolute path for `.oxlintrc.json`
resolution.
- Fixed `import-x` errors in `InstallFooter.vue`, `refUtil.ts`, and
`DesktopDialogView.vue`.
- Fixed i18n raw text error in `NotSupportedView.vue` via
eslint-disable.
- Fixed type inference issue in `i18n.ts` allowing dynamic locale
switching.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7271-fix-desktop-ui-resolve-linting-and-typecheck-errors-2c46d73d3650817cbb66cc7b1dc670a8)
by [Unito](https://www.unito.io)
This commit is contained in:
Benjamin Lu
2025-12-09 22:27:11 -08:00
committed by GitHub
parent eb04178e33
commit 59429cbe56
9 changed files with 23 additions and 9 deletions

View File

@@ -87,6 +87,8 @@
} }
}, },
"scripts": { "scripts": {
"lint": "nx run @comfyorg/desktop-ui:lint",
"typecheck": "nx run @comfyorg/desktop-ui:typecheck",
"storybook": "storybook dev -p 6007", "storybook": "storybook dev -p 6007",
"build-storybook": "storybook build -o dist/storybook" "build-storybook": "storybook build -o dist/storybook"
}, },

View File

@@ -40,7 +40,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PassThrough } from '@primevue/core' import type { PassThrough } from '@primevue/core'
import Button from 'primevue/button' import Button from 'primevue/button'
import Step, { type StepPassThroughOptions } from 'primevue/step' import Step from 'primevue/step'
import type { StepPassThroughOptions } from 'primevue/step'
import StepList from 'primevue/steplist' import StepList from 'primevue/steplist'
defineProps<{ defineProps<{

View File

@@ -155,12 +155,14 @@ export async function loadLocale(locale: string): Promise<void> {
} }
// Only include English in the initial bundle // Only include English in the initial bundle
const messages = { const enMessages = buildLocale(en, enNodes, enCommands, enSettings)
en: buildLocale(en, enNodes, enCommands, enSettings)
}
// Type for locale messages - inferred from the English locale structure // Type for locale messages - inferred from the English locale structure
type LocaleMessages = typeof messages.en type LocaleMessages = typeof enMessages
const messages: Record<string, LocaleMessages> = {
en: enMessages
}
export const i18n = createI18n({ export const i18n = createI18n({
// Must set `false`, as Vue I18n Legacy API is for Vue 2 // Must set `false`, as Vue I18n Legacy API is for Vue 2

View File

@@ -1,5 +1,6 @@
import { useTimeout } from '@vueuse/core' import { useTimeout } from '@vueuse/core'
import { type Ref, computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import type { Ref } from 'vue'
/** /**
* Vue boolean ref (writable computed) with one difference: when set to `true` it stays that way for at least {@link minDuration}. * Vue boolean ref (writable computed) with one difference: when set to `true` it stays that way for at least {@link minDuration}.

View File

@@ -29,7 +29,8 @@ import { normalizeI18nKey } from '@comfyorg/shared-frontend-utils/formatUtil'
import Button from 'primevue/button' import Button from 'primevue/button'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { type DialogAction, getDialog } from '@/constants/desktopDialogs' import { getDialog } from '@/constants/desktopDialogs'
import type { DialogAction } from '@/constants/desktopDialogs'
import { t } from '@/i18n' import { t } from '@/i18n'
import { electronAPI } from '@/utils/envUtil' import { electronAPI } from '@/utils/envUtil'

View File

@@ -5,7 +5,7 @@
<img <img
class="sad-girl" class="sad-girl"
src="/assets/images/sad_girl.png" src="/assets/images/sad_girl.png"
alt="Sad girl illustration" :alt="$t('notSupported.illustrationAlt')"
/> />
<div class="no-drag sad-text flex items-center"> <div class="no-drag sad-text flex items-center">

View File

@@ -15,6 +15,7 @@ import {
parser as tseslintParser parser as tseslintParser
} from 'typescript-eslint' } from 'typescript-eslint'
import vueParser from 'vue-eslint-parser' import vueParser from 'vue-eslint-parser'
import path from 'node:path'
const extraFileExtensions = ['.vue'] const extraFileExtensions = ['.vue']
@@ -292,6 +293,9 @@ export default defineConfig([
'no-console': 'off' 'no-console': 'off'
} }
}, },
// Turn off ESLint rules that are already handled by oxlint // Turn off ESLint rules that are already handled by oxlint
...oxlint.buildFromOxlintConfigFile('./.oxlintrc.json') ...oxlint.buildFromOxlintConfigFile(
path.resolve(import.meta.dirname, '.oxlintrc.json')
)
]) ])

View File

@@ -34,6 +34,7 @@
"lint:unstaged:fix": "git diff --name-only HEAD | grep -E '\\.(js|ts|vue|mts)$' | xargs -r eslint --cache --fix", "lint:unstaged:fix": "git diff --name-only HEAD | grep -E '\\.(js|ts|vue|mts)$' | xargs -r eslint --cache --fix",
"lint:unstaged": "git diff --name-only HEAD | grep -E '\\.(js|ts|vue|mts)$' | xargs -r eslint --cache", "lint:unstaged": "git diff --name-only HEAD | grep -E '\\.(js|ts|vue|mts)$' | xargs -r eslint --cache",
"lint": "oxlint src --type-aware && eslint src --cache", "lint": "oxlint src --type-aware && eslint src --cache",
"lint:desktop": "nx run @comfyorg/desktop-ui:lint",
"locale": "lobe-i18n locale", "locale": "lobe-i18n locale",
"oxlint": "oxlint src --type-aware", "oxlint": "oxlint src --type-aware",
"preinstall": "pnpm dlx only-allow pnpm", "preinstall": "pnpm dlx only-allow pnpm",
@@ -46,6 +47,7 @@
"test:browser:local": "cross-env PLAYWRIGHT_LOCAL=1 pnpm test:browser", "test:browser:local": "cross-env PLAYWRIGHT_LOCAL=1 pnpm test:browser",
"test:unit": "nx run test", "test:unit": "nx run test",
"typecheck": "vue-tsc --noEmit", "typecheck": "vue-tsc --noEmit",
"typecheck:desktop": "nx run @comfyorg/desktop-ui:typecheck",
"zipdist": "node scripts/zipdist.js", "zipdist": "node scripts/zipdist.js",
"clean": "nx reset" "clean": "nx reset"
}, },

View File

@@ -475,6 +475,7 @@
"notSupported": { "notSupported": {
"title": "Your device is not supported", "title": "Your device is not supported",
"message": "Only following devices are supported:", "message": "Only following devices are supported:",
"illustrationAlt": "Sad girl illustration",
"learnMore": "Learn More", "learnMore": "Learn More",
"reportIssue": "Report Issue", "reportIssue": "Report Issue",
"supportedDevices": { "supportedDevices": {