chore(frontend): introduce prettier + eslint and prune unused code
- Add Prettier 3 with prettier-plugin-organize-imports (sorts/removes unused imports) - Add ESLint 10 flat config with typescript-eslint + eslint-plugin-vue + eslint-config-prettier - Add root scripts: format, format:check, lint, lint:fix - Reformat 257 files across admin-web, ops-web, desktop-client, packages - Remove unused locals/exports flagged by --noUnusedLocals/--noUnusedParameters - Fix duplicate localTabLabel key, surrogate-pair regex u-flag, NBSP literal in regex - Skip server/ (Go) and apps/browser-extension/ (deprecated per ADR) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,45 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import type { PublishPlatformOption } from "@/lib/publish-platforms";
|
||||
import type { PublishPlatformOption } from '@/lib/publish-platforms'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
modelValue: string[];
|
||||
platforms: PublishPlatformOption[];
|
||||
disabled?: boolean;
|
||||
multiple?: boolean;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
multiple: true,
|
||||
});
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string[]
|
||||
platforms: PublishPlatformOption[]
|
||||
disabled?: boolean
|
||||
multiple?: boolean
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
multiple: true,
|
||||
},
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: string[]];
|
||||
}>();
|
||||
'update:modelValue': [value: string[]]
|
||||
}>()
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
|
||||
const selectedValues = computed(() => props.modelValue ?? []);
|
||||
const selectedValues = computed(() => props.modelValue ?? [])
|
||||
|
||||
function isSelected(platformId: string): boolean {
|
||||
return selectedValues.value.includes(platformId);
|
||||
return selectedValues.value.includes(platformId)
|
||||
}
|
||||
|
||||
function togglePlatform(platformId: string): void {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
if (props.multiple) {
|
||||
const next = isSelected(platformId)
|
||||
? selectedValues.value.filter((item) => item !== platformId)
|
||||
: [...selectedValues.value, platformId];
|
||||
emit("update:modelValue", next);
|
||||
return;
|
||||
: [...selectedValues.value, platformId]
|
||||
emit('update:modelValue', next)
|
||||
return
|
||||
}
|
||||
|
||||
emit("update:modelValue", isSelected(platformId) ? [] : [platformId]);
|
||||
emit('update:modelValue', isSelected(platformId) ? [] : [platformId])
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -72,18 +75,22 @@ function togglePlatform(platformId: string): void {
|
||||
<strong>{{ platform.name }}</strong>
|
||||
</span>
|
||||
|
||||
<span
|
||||
<span
|
||||
class="publish-platform-selector__status"
|
||||
:class="{ 'publish-platform-selector__status--bound': platform.bound }"
|
||||
>
|
||||
{{ platform.bound ? (platform.accountLabel ?? t("custom.task.platformConnected")) : t("custom.task.platformUnauthorized") }}
|
||||
{{
|
||||
platform.bound
|
||||
? (platform.accountLabel ?? t('custom.task.platformConnected'))
|
||||
: t('custom.task.platformUnauthorized')
|
||||
}}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="publish-platform-selector__empty">
|
||||
<strong>{{ t("custom.task.platformEmptyTitle") }}</strong>
|
||||
<p>{{ t("custom.task.platformEmptyHint") }}</p>
|
||||
<strong>{{ t('custom.task.platformEmptyTitle') }}</strong>
|
||||
<p>{{ t('custom.task.platformEmptyHint') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user