ecosystem/nuxt-prefer-nuxt-link
Prefer NuxtLink for internal application links
Default severity: warning
Presets: nuxt
Automatic fix: None; review the suggested change
Applies to: Vue SFC templates and blocks, with script context where the rule requires it
Options: No rule-specific options. Severity and preset selection are configurable.
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"ecosystem/nuxt-prefer-nuxt-link": "warn"
}
},
},
});
vp run lint
Bad
The internal settings destination uses a plain anchor in a Nuxt application.
<template>
<a href="/settings">Settings</a>
</template>
Good
NuxtLink handles the same internal destination through the Nuxt router.
<template>
<NuxtLink to="/settings">Settings</NuxtLink>
</template>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.