chore: use vue/vue3-recommended eslint plugin

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/3445/head
Ryan Wang 2022-08-30 17:30:43 +08:00
parent 1772c2b1fc
commit 18828c035b
30 changed files with 64 additions and 35 deletions

View File

@ -4,7 +4,7 @@ require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = { module.exports = {
root: true, root: true,
extends: [ extends: [
"plugin:vue/vue3-essential", "plugin:vue/vue3-recommended",
"eslint:recommended", "eslint:recommended",
"@vue/eslint-config-typescript/recommended", "@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier", "@vue/eslint-config-prettier",

View File

@ -21,8 +21,7 @@
"story:dev": "histoire dev --port 4000", "story:dev": "histoire dev --port 4000",
"story:build": "histoire build", "story:build": "histoire build",
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts", "lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'", "prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'"
"test": "echo \"Error: no test specified\" && exit 1"
}, },
"keywords": [ "keywords": [
"halo", "halo",

View File

@ -27,6 +27,8 @@ const props = withDefaults(
}>(), }>(),
{ {
type: "default", type: "default",
title: "",
description: "",
closable: true, closable: true,
} }
); );

View File

@ -48,7 +48,7 @@ const props = withDefaults(
block?: boolean; block?: boolean;
disabled?: boolean; disabled?: boolean;
loading?: boolean; loading?: boolean;
route?: RouteLocationRaw; route?: RouteLocationRaw | undefined;
}>(), }>(),
{ {
type: "default", type: "default",
@ -57,6 +57,7 @@ const props = withDefaults(
block: false, block: false,
disabled: false, disabled: false,
loading: false, loading: false,
route: undefined,
} }
); );

View File

@ -2,12 +2,15 @@
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
checked?: boolean; checked?: boolean;
value?: string | number | boolean; value?: string | number | boolean | undefined;
label?: string; label?: string | undefined;
name?: string; name?: string | undefined;
}>(), }>(),
{ {
checked: false, checked: false,
value: undefined,
label: undefined,
name: undefined,
} }
); );

View File

@ -4,7 +4,7 @@ import { VCheckbox } from "./index";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
modelValue?: string[]; modelValue?: string[];
options?: Array<Record<string, string>>; options: Array<Record<string, string>>;
valueKey?: string; valueKey?: string;
labelKey?: string; labelKey?: string;
name?: string; name?: string;
@ -13,6 +13,7 @@ const props = withDefaults(
modelValue: () => [], modelValue: () => [],
valueKey: "value", valueKey: "value",
labelKey: "label", labelKey: "label",
name: undefined,
} }
); );

View File

@ -2,7 +2,7 @@
exports[`CheckBox > should render 1`] = ` exports[`CheckBox > should render 1`] = `
"<div class=\\"checkbox-wrapper\\"> "<div class=\\"checkbox-wrapper\\">
<div class=\\"checkbox-inner\\"><input id=\\"checkbox\\" type=\\"checkbox\\" value=\\"false\\"></div> <div class=\\"checkbox-inner\\"><input id=\\"checkbox\\" type=\\"checkbox\\"></div>
<!--v-if--> <!--v-if-->
</div>" </div>"
`; `;

View File

@ -8,7 +8,7 @@ function initState() {
} }
</script> </script>
<template> <template>
<Story :initState="initState" title="Codemirror"> <Story :init-state="initState" title="Codemirror">
<template #default="{ state }"> <template #default="{ state }">
<VCodemirror v-model="state.value" height="500px" language="yaml" /> <VCodemirror v-model="state.value" height="500px" language="yaml" />
</template> </template>

View File

@ -32,6 +32,12 @@ const props = withDefaults(
confirmType: "primary", confirmType: "primary",
cancelText: "取消", cancelText: "取消",
visible: false, visible: false,
onConfirm: () => {
return;
},
onCancel: () => {
return;
},
} }
); );

View File

@ -19,8 +19,8 @@ provide(DialogProviderProvideKey, options);
:confirm-text="options.confirmText" :confirm-text="options.confirmText"
:confirm-type="options.confirmType" :confirm-type="options.confirmType"
:description="options.description" :description="options.description"
:onCancel="options.onCancel" :on-cancel="options.onCancel"
:onConfirm="options.onConfirm" :on-confirm="options.onConfirm"
:title="options.title" :title="options.title"
:type="options.type" :type="options.type"
></VDialog> ></VDialog>

View File

@ -10,8 +10,10 @@ const props = withDefaults(
placeholder?: string; placeholder?: string;
}>(), }>(),
{ {
modelValue: undefined,
size: "md", size: "md",
disabled: false, disabled: false,
placeholder: undefined,
} }
); );

View File

@ -10,6 +10,7 @@ const VRoutesMenu = defineComponent({
props: { props: {
menus: { menus: {
type: Object as PropType<MenuGroupType[]>, type: Object as PropType<MenuGroupType[]>,
required: true,
}, },
}, },
emits: ["select"], emits: ["select"],

View File

@ -12,8 +12,10 @@ const props = withDefaults(
}>(), }>(),
{ {
visible: false, visible: false,
title: undefined,
width: 500, width: 500,
fullscreen: false, fullscreen: false,
bodyClass: undefined,
} }
); );

View File

@ -51,7 +51,7 @@ watch(
:key="key" :key="key"
v-slot="{ currentPage, next, prev, pageCount }" v-slot="{ currentPage, next, prev, pageCount }"
:page="page" :page="page"
:pageSize="size" :page-size="size"
:total="total" :total="total"
@page-change="onPageChange" @page-change="onPageChange"
@page-size-change="onPageChange" @page-size-change="onPageChange"

View File

@ -10,8 +10,11 @@ withDefaults(
name?: string; name?: string;
}>(), }>(),
{ {
modelValue: undefined,
options: undefined,
valueKey: "value", valueKey: "value",
labelKey: "label", labelKey: "label",
name: undefined,
} }
); );

View File

@ -10,8 +10,10 @@ const props = withDefaults(
placeholder?: string; placeholder?: string;
}>(), }>(),
{ {
modelValue: undefined,
size: "md", size: "md",
disabled: false, disabled: false,
placeholder: undefined,
} }
); );

View File

@ -12,6 +12,8 @@ const props = withDefaults(
labelKey?: string; labelKey?: string;
}>(), }>(),
{ {
activeId: undefined,
items: undefined,
type: "default", type: "default",
direction: "row", direction: "row",
idKey: "id", idKey: "id",

View File

@ -13,6 +13,7 @@ const props = withDefaults(
labelKey?: string; labelKey?: string;
}>(), }>(),
{ {
activeId: undefined,
type: "default", type: "default",
direction: "row", direction: "row",
idKey: "id", idKey: "id",
@ -54,7 +55,7 @@ const handleChange = (id: string | number) => {
<div :class="classes" class="tabs-wrapper"> <div :class="classes" class="tabs-wrapper">
<div class="tabs-bar-wrapper"> <div class="tabs-bar-wrapper">
<VTabbar <VTabbar
:activeId="activeId" :active-id="activeId"
:direction="direction" :direction="direction"
:items="tabItems" :items="tabItems"
:type="type" :type="type"

View File

@ -7,7 +7,9 @@ withDefaults(
rows?: number; rows?: number;
}>(), }>(),
{ {
modelValue: undefined,
disabled: false, disabled: false,
placeholder: undefined,
rows: 3, rows: 3,
} }
); );

View File

@ -8,7 +8,9 @@
"scripts": { "scripts": {
"dev": "vite build --watch", "dev": "vite build --watch",
"build": "vite build", "build": "vite build",
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false" "typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'"
}, },
"keywords": [], "keywords": [],
"author": { "author": {

View File

@ -93,7 +93,7 @@ const onVisibleChange = (visible: boolean) => {
label-idle="Drop files here..." label-idle="Drop files here..."
name="test" name="test"
server="/api" server="/api"
v-bind:allow-multiple="true" :allow-multiple="true"
/> />
</div> </div>
</VModal> </VModal>

View File

@ -706,8 +706,8 @@ function handlePhaseFilterItemChange(filterItem: FilterItem) {
class="inline-flex flex-wrap gap-1 text-xs text-gray-500" class="inline-flex flex-wrap gap-1 text-xs text-gray-500"
> >
分类<span 分类<span
v-for="(category, index) in post.categories" v-for="(category, categoryIndex) in post.categories"
:key="index" :key="categoryIndex"
class="cursor-pointer hover:text-gray-900" class="cursor-pointer hover:text-gray-900"
> >
{{ category.spec.displayName }} {{ category.spec.displayName }}
@ -720,11 +720,11 @@ function handlePhaseFilterItemChange(filterItem: FilterItem) {
</div> </div>
<div class="flex"> <div class="flex">
<div <div
class="inline-flex flex-col flex-col-reverse items-end gap-4 sm:flex-row sm:items-center sm:gap-6" class="inline-flex flex-col items-end gap-4 sm:flex-row sm:items-center sm:gap-6"
> >
<RouterLink <RouterLink
v-for="(contributor, index) in post.contributors" v-for="(contributor, contributorIndex) in post.contributors"
:key="index" :key="contributorIndex"
:to="{ :to="{
name: 'UserDetail', name: 'UserDetail',
params: { name: contributor.name }, params: { name: contributor.name },

View File

@ -27,7 +27,7 @@ const onVisibleChange = (visible: boolean) => {
</script> </script>
<template> <template>
<VModal <VModal
:bodyClass="['!p-0']" :body-class="['!p-0']"
:visible="visible" :visible="visible"
fullscreen fullscreen
title="文章预览" title="文章预览"

View File

@ -3,7 +3,7 @@ import { VButton, VCard, VTextarea } from "@halo-dev/components";
</script> </script>
<template> <template>
<VCard <VCard
:bodyClass="['h-full', 'overflow-y-auto']" :body-class="['h-full', 'overflow-y-auto']"
class="h-full" class="h-full"
title="日志发表" title="日志发表"
> >

View File

@ -42,7 +42,7 @@ const router = useRouter();
</script> </script>
<template> <template>
<VCard <VCard
:bodyClass="['h-full', 'overflow-y-auto', '!p-0']" :body-class="['h-full', 'overflow-y-auto', '!p-0']"
class="h-full" class="h-full"
title="快捷访问" title="快捷访问"
> >

View File

@ -6,7 +6,7 @@ const { users } = useUserFetch();
</script> </script>
<template> <template>
<VCard <VCard
:bodyClass="['h-full', '!p-0', 'overflow-y-auto']" :body-class="['h-full', '!p-0', 'overflow-y-auto']"
class="h-full" class="h-full"
title="最近登录" title="最近登录"
> >

View File

@ -21,7 +21,7 @@ onMounted(handleFetchPosts);
</script> </script>
<template> <template>
<VCard <VCard
:bodyClass="['h-full', '!p-0', 'overflow-y-auto']" :body-class="['h-full', '!p-0', 'overflow-y-auto']"
class="h-full" class="h-full"
title="最近发布" title="最近发布"
> >

View File

@ -119,7 +119,7 @@ defineExpose({
:menu="selectedMenuToUpdate" :menu="selectedMenuToUpdate"
@close="handleFetchMenus" @close="handleFetchMenus"
/> />
<VCard :bodyClass="['!p-0']" title="菜单"> <VCard :body-class="['!p-0']" title="菜单">
<VEmpty <VEmpty
v-if="!menus.length && !loading" v-if="!menus.length && !loading"
message="你可以尝试刷新或者新建菜单" message="你可以尝试刷新或者新建菜单"

View File

@ -156,13 +156,13 @@ const handleResetForm = () => {
</dt> </dt>
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0"> <dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">
<ul class="space-y-2"> <ul class="space-y-2">
<li v-for="(role, index) in group.roles" :key="index"> <li v-for="(roleTemplate, index) in group.roles" :key="index">
<label <label
class="inline-flex w-full cursor-pointer flex-row items-center gap-4 rounded-base border p-5 hover:border-primary" class="inline-flex w-full cursor-pointer flex-row items-center gap-4 rounded-base border p-5 hover:border-primary"
> >
<input <input
v-model="selectedRoleTemplates" v-model="selectedRoleTemplates"
:value="role.metadata.name" :value="roleTemplate.metadata.name"
class="h-4 w-4 rounded border-gray-300 text-indigo-600" class="h-4 w-4 rounded border-gray-300 text-indigo-600"
type="checkbox" type="checkbox"
@change="handleRoleTemplateSelect" @change="handleRoleTemplateSelect"
@ -170,14 +170,14 @@ const handleResetForm = () => {
<div class="flex flex-1 flex-col gap-y-3"> <div class="flex flex-1 flex-col gap-y-3">
<span class="font-medium text-gray-900"> <span class="font-medium text-gray-900">
{{ {{
role.metadata.annotations?.[ roleTemplate.metadata.annotations?.[
rbacAnnotations.DISPLAY_NAME rbacAnnotations.DISPLAY_NAME
] ]
}} }}
</span> </span>
<span <span
v-if=" v-if="
role.metadata.annotations?.[ roleTemplate.metadata.annotations?.[
rbacAnnotations.DEPENDENCIES rbacAnnotations.DEPENDENCIES
] ]
" "
@ -186,7 +186,7 @@ const handleResetForm = () => {
依赖于 依赖于
{{ {{
JSON.parse( JSON.parse(
role.metadata.annotations?.[ roleTemplate.metadata.annotations?.[
rbacAnnotations.DEPENDENCIES rbacAnnotations.DEPENDENCIES
] ]
).join(", ") ).join(", ")

View File

@ -311,11 +311,11 @@ onMounted(() => {
</div> </div>
<div class="flex"> <div class="flex">
<div <div
class="inline-flex flex-col flex-col-reverse items-end gap-4 sm:flex-row sm:items-center sm:gap-6" class="inline-flex flex-col items-end gap-4 sm:flex-row sm:items-center sm:gap-6"
> >
<div <div
v-for="(role, index) in getRoles(user)" v-for="(role, roleIndex) in getRoles(user)"
:key="index" :key="roleIndex"
class="hidden items-center sm:flex" class="hidden items-center sm:flex"
> >
<VTag> <VTag>