Type and script rules
Follow each rule for purpose, severity, scope, configuration, and Bad/Good examples. The complete catalogue keeps all examples and current support boundaries on one page.
Configure lint.vize.rules and run vp run lint with the Vite+ helper. Check each page for type-aware, filename, or additional-configuration prerequisites.
| Rule | Examples | Purpose |
|---|---|---|
script/component-options-name-casing |
Bad · Good | Enforce PascalCase for the component name option |
script/custom-event-name-casing |
Bad · Good | Enforce camelCase for emitted custom event names |
script/define-emits-declaration |
Bad · Good | Enforce the type-based defineEmits<{}>() form over the runtime/array form |
script/define-macros-order |
Bad · Good | Enforce a consistent order of the Vue compiler macros in <script setup> |
script/define-props-declaration |
Bad · Good | Enforce type-based defineProps<{ ... }>() over the runtime/object form |
script/define-props-destructuring |
Bad · Good | Enforce consistent style for defineProps destructuring in <script setup> |
script/no-arrow-functions-in-watch |
Bad · Good | Disallow arrow functions as Options API watch handlers |
script/no-async-in-computed |
Bad · Good | Disallow async functions in computed properties |
script/no-boolean-default |
Bad · Good | Disallow a default on a Boolean prop |
script/no-deep-destructure-in-props |
Bad · Good | Disallow deeply nested destructuring in defineProps |
script/no-deprecated-data-object-declaration |
Bad · Good | Disallow an object literal as the component data option (Vue 3 requires a function) |
script/no-deprecated-destroyed-lifecycle |
Bad · Good | Disallow deprecated destroyed and beforeDestroy lifecycle hooks |
script/no-deprecated-dollar-listeners-api |
Bad · Good | Disallow the $listeners instance property removed in Vue 3 (merged into $attrs) |
script/no-deprecated-dollar-scopedslots-api |
Bad · Good | Disallow the $scopedSlots instance property removed in Vue 3 (use $slots) |
script/no-deprecated-events-api |
Bad · Good | Disallow the removed Vue 2 events API ($on / $off / $once) |
script/no-deprecated-props-default-this |
Bad · Good | Disallow this inside a prop default/validator function (removed in Vue 3) |
script/no-dupe-keys |
Bad · Good | Disallow duplicate keys across Options API props/data/computed/methods/setup/inject |
script/no-duplicate-attr-inheritance |
Bad · Good | Flag a component that applies its fallthrough attributes twice |
script/no-export-in-script-setup |
Bad · Good | Disallow export statements inside <script setup> |
script/no-get-current-instance |
Bad · Good | Disallow getCurrentInstance() in Vapor mode (returns null) |
script/no-import-compiler-macros |
Bad · Good | Disallow importing Vue compiler macros that are auto-imported |
script/no-internal-imports |
Bad · Good | Disallow importing from Vue internal modules |
script/no-multiple-slot-args |
Bad · Good | Disallow passing more than one argument to a scoped-slot function call |
script/no-next-tick |
Bad · Good | Disallow nextTick() usage in Vapor-oriented components |
script/no-options-api |
Bad · Good | Disallow Options API patterns in Vapor mode |
script/no-potential-component-option-typo |
Bad · Good | Flag likely typos in Options API component option names |
script/no-reactive-destructure |
Bad · Good | Disallow destructuring reactive objects which loses reactivity |
script/no-ref-as-operand |
Bad · Good | Require ref-bound variables to be accessed via .value when used as an operand |
script/no-required-prop-with-default |
Bad · Good | Disallow a prop that is both required: true and has a default |
script/no-reserved-identifiers |
Bad · Good | Disallow using Vue compiler reserved identifiers |
script/no-reserved-keys |
Bad · Good | Disallow Vue-reserved names as Options API props/data/computed/methods/setup/inject keys |
script/no-reserved-props |
Bad · Good | Disallow reserved names in a component's props declaration |
script/no-restricted-globals |
Bad · Good | Disallow references to runtime-environment globals that must go through a typed wrapper |
script/no-restricted-members |
Bad · Good | Disallow project-configured object.property member accesses |
script/no-side-effects-in-computed-properties |
Bad · Good | Disallow side effects in Options API computed getters |
script/no-top-level-ref-in-script |
Bad · Good | Disallow top-level ref/reactive to prevent Cross-Request State Pollution |
script/no-unstable-nested-components |
Bad · Good | Disallow component definitions inside setup or render functions |
script/no-unused-emit-declarations |
Bad · Good | Flag declared events that are never emitted |
script/no-use-computed-property-like-method |
Bad · Good | Disallow calling an Options API computed property like a method |
script/no-with-defaults |
Bad · Good | Discourage withDefaults in favor of destructuring defaults (Vue 3.5+) |
script/prefer-computed |
Bad · Good | Prefer computed() for derived reactive state |
script/prefer-define-options |
Bad · Good | Prefer defineOptions() over a plain <script> that only sets name/inheritAttrs |
script/prefer-import-from-vue |
Bad · Good | Prefer importing from 'vue' instead of internal packages |
script/prefer-ref-over-reactive |
Bad · Good | Recommend using ref() over reactive() for state management |
script/prefer-use-attrs |
Bad · Good | Recommend using useAttrs() over context.attrs |
script/prefer-use-id |
Bad · Good | Recommend using useId() for generating unique IDs (Vue 3.5+) |
script/prefer-use-slots |
Bad · Good | Recommend using useSlots() over context.slots |
script/prefer-use-template-ref |
Bad · Good | Recommend useTemplateRef over ref for template references (Vue 3.5+) |
script/require-default-prop |
Bad · Good | Require a default value for every optional, non-Boolean prop |
script/require-explicit-emits |
Bad · Good | Require emitted events to be declared in defineEmits or the emits option |
script/require-explicit-slots |
Bad · Good | Require slots consumed via useSlots() to be explicitly typed with defineSlots<...>() |
script/require-function-return-type |
Bad · Good | Require return type annotations on functions |
script/require-prop-type-constructor |
Bad · Good | Require prop type values to be constructors rather than string literals |
script/require-prop-types |
Bad · Good | Require every prop to declare a type |
script/require-symbol-provide |
Bad · Good | Recommend using Symbol as injection key for provide/inject |
script/require-typed-object-prop |
Bad · Good | Require an explicit type on a prop whose runtime type is Object or Array |
script/require-typed-ref |
Bad · Good | Require an explicit type argument on a ref() initialized with no value, null, or undefined |
script/require-valid-default-prop |
Bad · Good | Require a prop's default value to be valid for its declared type |
script/return-in-computed-property |
Bad · Good | Require a return value in every computed getter |
script/return-in-emits-validator |
Bad · Good | Require a return value in every Options API emits validator |
script/valid-define-emits |
Bad · Good | Enforce valid defineEmits() usage (no type+runtime args, no local references, single call) |
script/valid-define-options |
Bad · Good | Enforce valid defineOptions() usage (single object arg, no props/emits/expose/slots) |
script/valid-define-props |
Bad · Good | Enforce valid defineProps() usage (single call, not both type and runtime args, no local references) |
script/valid-next-tick |
Bad · Good | Require the result of a nextTick() call to be awaited, chained, or given a callback |
type/no-floating-promises |
Bad · Good | Disallow floating (unhandled) Promises |
type/no-reactivity-loss |
Bad · Good | Disallow plain snapshots of reactive values across assignments and calls |
type/no-unsafe-template-binding |
Bad · Good | Disallow template bindings that resolve to unsafe types |
type/require-typed-emits |
Bad · Good | Require type definition for defineEmits |
type/require-typed-props |
Bad · Good | Require type definition for defineProps |
type/strict-boolean-expressions |
Bad · Good | Require safe boolean expressions in script and template conditions |
All rules · Rule Options · ESLint migration map · Project checks