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 = {
root: true,
extends: [
"plugin:vue/vue3-essential",
"plugin:vue/vue3-recommended",
"eslint:recommended",
"@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier",

View File

@ -21,8 +21,7 @@
"story:dev": "histoire dev --port 4000",
"story:build": "histoire build",
"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}'",
"test": "echo \"Error: no test specified\" && exit 1"
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'"
},
"keywords": [
"halo",

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
exports[`CheckBox > should render 1`] = `
"<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-->
</div>"
`;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,9 @@
"scripts": {
"dev": "vite build --watch",
"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": [],
"author": {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -311,11 +311,11 @@ onMounted(() => {
</div>
<div class="flex">
<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
v-for="(role, index) in getRoles(user)"
:key="index"
v-for="(role, roleIndex) in getRoles(user)"
:key="roleIndex"
class="hidden items-center sm:flex"
>
<VTag>