vue/require-component-registration
Require explicit import or registration for components
Default severity: warning
Presets: opinionated
Automatic fix: None; review the suggested change
Applies to: Vue SFC templates and blocks, with script context where the rule requires it
Options: See typed options and defaults.
List explicit component names supplied by application plugins or Musea previewSetup. PascalCase and kebab-case spellings are accepted; regular expressions are not interpreted. Options do not enable the rule. Later layers replace the list; an empty list clears inherited names.
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"vue/require-component-registration": "warn"
},
"ruleOptions": {
"vue/require-component-registration": {
"globals": [
"MyButton",
"MyIcon"
]
}
}
},
},
});
vp run lint
Bad
MissingWidget is neither registered nor included in the configured global-component allowlist.
<template>
<MissingWidget />
</template>
Good
MyButton is listed in the example's globals option. That option exempts a known global component; it does not register or import it.
<template>
<MyButton />
</template>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.