From 69c8c84aef8e606c4da89c492897e1cafb47bb8e Mon Sep 17 00:00:00 2001 From: Alexander Brown Date: Fri, 6 Feb 2026 20:54:53 -0800 Subject: [PATCH] fix: resolve i18n no-restricted-imports lint warnings (#8704) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fix all i18n `no-restricted-imports` lint warnings and upgrade rules from `warn` to `error`. ## Changes - **What**: Migrate Vue components from `import { t/d } from '@/i18n'` to `const { t } = useI18n()`. Migrate non-component `.ts` files from `useI18n()` to `import { t/d } from '@/i18n'`. Allow `st` import from `@/i18n` in Vue components (it wraps `te`/`t` for safe fallback translation). Remove `@deprecated` tag from `i18n.ts` global exports (still used by `st` and non-component code). Upgrade both lint rules from `warn` to `error`. ## Review Focus - The `st` helper is intentionally excluded from the Vue component restriction since it provides safe fallback translation needed for custom node definitions. Fixes #8701 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8704-fix-resolve-i18n-no-restricted-imports-lint-warnings-2ff6d73d365081ae84d8eb0dfef24323) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp --- eslint.config.ts | 8 +-- src/components/graph/GraphCanvas.vue | 3 +- src/components/load3d/Load3dViewerContent.vue | 3 +- .../load3d/controls/ModelControls.vue | 3 +- .../load3d/controls/ViewerControls.vue | 4 +- .../controls/viewer/ViewerCameraControls.vue | 3 +- .../controls/viewer/ViewerModelControls.vue | 3 +- .../maskeditor/BrushSettingsPanel.vue | 3 +- .../maskeditor/ColorSelectSettingsPanel.vue | 4 +- .../maskeditor/ImageLayerSettingsPanel.vue | 3 +- .../maskeditor/PaintBucketSettingsPanel.vue | 4 +- src/components/maskeditor/ToolPanel.vue | 3 +- .../maskeditor/dialog/TopBarHeader.vue | 3 +- .../queue/QueueInlineProgressSummary.vue | 1 + .../rightSidePanel/RightSidePanel.vue | 1 + .../rightSidePanel/parameters/WidgetItem.vue | 1 + src/components/sidebar/ModeToggle.vue | 3 +- src/components/sidebar/SideToolbar.vue | 3 +- src/components/topbar/CloudBadge.vue | 4 +- src/components/topbar/LoginButton.vue | 3 +- src/i18n.ts | 1 - .../onboarding/components/CloudTemplate.vue | 5 +- .../components/PricingTable.test.ts | 11 ++++ .../subscription/components/PricingTable.vue | 5 +- .../settings/components/SettingItem.vue | 1 + .../extensions/linearMode/LinearControls.vue | 3 +- .../extensions/linearMode/LinearPreview.vue | 3 +- .../extensions/linearMode/LinearWelcome.vue | 4 +- .../extensions/linearMode/MobileMenu.vue | 4 +- .../widgets/components/WidgetRecordAudio.vue | 4 +- .../components/form/dropdown/FormDropdown.vue | 66 +++++++++++-------- src/services/customerEventsService.test.ts | 4 +- src/services/customerEventsService.ts | 3 +- src/views/LinearView.vue | 3 +- .../manager/stores/comfyManagerStore.ts | 3 +- 35 files changed, 117 insertions(+), 66 deletions(-) diff --git a/eslint.config.ts b/eslint.config.ts index 8dc7da5a5..13068d621 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -287,12 +287,12 @@ export default defineConfig([ files: ['**/*.vue'], rules: { 'no-restricted-imports': [ - 'warn', + 'error', { paths: [ { name: '@/i18n', - importNames: ['t', 'd', 'st', 'te'], + importNames: ['t', 'd', 'te'], message: "In Vue components, use `const { t } = useI18n()` instead of importing from '@/i18n'." } @@ -301,13 +301,13 @@ export default defineConfig([ ] } }, - // Non-composable .ts files must use the global t/d/st/te, not useI18n() + // Non-composable .ts files must use the global t/d/te, not useI18n() { files: ['**/*.ts'], ignores: ['**/use[A-Z]*.ts', '**/*.test.ts', 'src/i18n.ts'], rules: { 'no-restricted-imports': [ - 'warn', + 'error', { paths: [ { diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index aad7d6f24..66a9fb64f 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -111,6 +111,7 @@ import { watch, watchEffect } from 'vue' +import { useI18n } from 'vue-i18n' import LiteGraphCanvasSplitterOverlay from '@/components/LiteGraphCanvasSplitterOverlay.vue' import TopMenuSection from '@/components/TopMenuSection.vue' @@ -137,7 +138,6 @@ import { useCopy } from '@/composables/useCopy' import { useGlobalLitegraph } from '@/composables/useGlobalLitegraph' import { usePaste } from '@/composables/usePaste' import { useVueFeatureFlags } from '@/composables/useVueFeatureFlags' -import { t } from '@/i18n' import { LiteGraph } from '@/lib/litegraph/src/litegraph' import { useLitegraphSettings } from '@/platform/settings/composables/useLitegraphSettings' import { CORE_SETTINGS } from '@/platform/settings/constants/coreSettings' @@ -175,6 +175,7 @@ import { isCloud } from '@/platform/distribution/types' import { useFeatureFlags } from '@/composables/useFeatureFlags' import { useInviteUrlLoader } from '@/platform/workspace/composables/useInviteUrlLoader' +const { t } = useI18n() const emit = defineEmits<{ ready: [] }>() diff --git a/src/components/load3d/Load3dViewerContent.vue b/src/components/load3d/Load3dViewerContent.vue index c85c4505e..71d6d1eea 100644 --- a/src/components/load3d/Load3dViewerContent.vue +++ b/src/components/load3d/Load3dViewerContent.vue @@ -94,6 +94,7 @@