Vize

ecosystem/void-link-require-href

要求 Void Vue Link 组件具有 href。

默认严重程度 预设 自动修复 选项
error ecosystem 不支持 无

适用范围:Vue SFC 模板和代码块,包括规则所需的脚本上下文。

错误示例

从 @void/vue 导入的 Link 省略了 href 目标。

<script setup>
import { Link } from "@void/vue";
</script>

<template>
  <Link>Settings</Link>
</template>

正确示例

同一导入的 Link 通过 href 接收设置目标。

<script setup>
import { Link } from "@void/vue";
</script>

<template>
  <Link href="/settings">Settings</Link>
</template>

配置(Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "ecosystem/void-link-require-href": "error"
    }
  },
});

然后运行 vp run lint。

相关页面