Vue review checklist
Use this when writing or reviewing Vue code. The severities say how serious a problem is; they are guidance for a finding's severity, not a verdict.
Review Priorities (Vue-specific only)
CRITICAL — Vue Security
v-htmlwith unsanitized input: User-controlled HTML rendered without DOMPurify or equivalent allowlist sanitizer. Halt review until source is documented and sanitization is at the same call site. This is Vue'sdangerouslySetInnerHTML.:href/:srcwith unvalidated user URLs:javascript:anddata:schemes execute code. Require URL scheme validation on all dynamic attribute bindings that accept URLs.- Server-side rendering (Nuxt) secret leaks:
useRuntimeConfig().publiccontaining secrets or tokens. Client-exposed composables accessing server-only data. - API route without input validation (Nuxt Nitro): Server endpoints in
server/api/orserver/routes/accepting body/query/params without schema validation (zod/valibot). localStorage/sessionStoragefor session tokens: Accessible to any XSS. Require httpOnly cookies.
CRITICAL — Reactivity
Destructuring reactive props (Vue < 3.5): In Vue < 3.5,
const { title, count } = defineProps(...)captures snapshot copies — destructured values are not reactive. UsetoRefs()or access viaprops.xxx. **Vue 3.5+**: Reactive Props Destructure is stabilized and enabled by default — destructured variables are automatically reactive. However, you cannotwatch()a destructured prop variable directly; must wrap in a getter:watch(() => count, ...).ref()wrapping an object but accessing without.value:<script setup>auto-unwraps refs in templates, but inside<script>the.valueis mandatory.Creating reactive primitives with
reactive():reactive()only works on objects/arrays. Useref()for primitives.Replacing entire
reactive()object:state = newStatebreaks reactivity — mutate properties instead or useObject.assign(state, newState).Watcher source as a getter returning reactive data without
.value:watch(() => myRef, ...)watches the ref object (stays same), not its value. Must bewatch(() => myRef.value, ...).Watching destructured prop directly (Vue 3.5+):
watch(count, ...)on a destructured prop causes a compile-time error. Usewatch(() => count, ...).
HIGH — Composables
- Composable with side effects in module scope: Initializing state, starting timers, or subscribing outside
setup/ component lifecycle means the side effect persists across component instances. - Missing cleanup:
watch,watchEffect, event listeners, intervals, and fetch requests inside composables must clean up in the returned teardown function or viaonUnmounted. - Composable receiving reactive state but storing a snapshot: Accepting a
refparameter but reading.valueonce and storing the unwrapped value — changes to the source won't propagate. - Composable returning non-reactive data: Plain objects or primitives that should use
ref()/reactive()/computed()so consumers stay reactive. - Composable not prefixed
use: Breaks lint detection and the Vue convention — rename touseFoo.
HIGH — Template Security and Correctness
v-forwithout:key: Vue can't track identity, causing incorrect DOM reuse and state mismatches on re-render.v-forwithkey={index}: Reordering, insertion, or deletion attaches state/children to the wrong row. Use stable database IDs.v-if+v-foron the same element:v-ifevaluates per-item beforev-foriterates; the condition runs on item, not on iteration. Almost always a logic error. Use<template v-for>+ innerv-ifor a computed filtered list.v-modelbound to a computed without a setter: User input silently ignored — must provide bothgetandset, or bind to a writable ref.v-bind="$attrs"withoutinheritAttrs: false: Attributes silently applied to both the root element and the forwarded target. Must disable inheritance explicitly.
HIGH — Component Architecture
- Large Single-File Component (>300 lines template + script): Extract subcomponents or composables. Long SFCs hurt readability, testability, and tree-shaking.
- Props mutation: Modifying props directly (even reactive objects) is forbidden — Vue warns in development. Use
defineEmitsto communicate up, orv-modelfor two-way binding. - Missing prop validation: Every prop should have at minimum
type, andrequired/defaultwhere appropriate. Use the fulldefinePropstype syntax or runtime validators. - Events named in camelCase: Vue convention is kebab-case (
@update:model-value), though camelCase listeners auto-translate. Prefer kebab-case in templates for consistency. - Direct DOM manipulation via
document.querySelector/refto raw DOM: Prefer template refs (ref="el") withuseTemplateRef. Raw DOM selectors break component encapsulation.
HIGH — Vue Router
- Route guards (beforeEnter, beforeEach) returning
falsewithout navigation alternative: User is stuck — must redirect or show a reason. - Missing
scrollBehaviorwhen navigating to a non-top position: Without it, the page jumps to top unconditionally. useRoute().paramsdestructured at setup top-level: Params change on route navigation within the same component — destructuring captures one snapshot. Access viatoRefs(useRoute().params)orcomputed().- Lazy-loaded routes missing error/loading components: Chunky bundle split without fallback — show fallback UI.
HIGH — State Management (Pinia)
- Scattered complex store mutations outside actions or
$patch(): Pinia allows direct state writes, but multi-field business mutations should live in actions or grouped$patch()calls so devtools history and state flow stay understandable. - Storing non-serializable data in Pinia state: Saved state (SSR hydration, devtools, local persistence) won't survive round-trip.
mapState/mapActionsin Options API without proper typing: Type inference breaks — prefer Composition API or declare full types.- Store action without error boundary: Async store actions should handle failures and not leave state inconsistent.
HIGH — SSR (Nuxt-specific)
- Browser-only API used without
process.clientguard oronMounted:window,document,localStoragecrash the server build. useAsyncData/useFetchwithoutkey: Duplicate server requests, broken cache deduplication.<ClientOnly>wrapping content needed for SEO: Server-rendered empty wrapper — search engines see nothing.- Environment variable leaked via
useRuntimeConfig().public: Treat all.publicruntime config as exposed to the client. - Missing
definePageMetafor page-level middleware, layout, or auth: Nuxt features silently skipped if not declared.
MEDIUM — Performance
computed()with expensive operations not backed by caching: Recomputes on every dependency change — fine for fast ops, but array sorts/filters on large datasets should be memoized or moved to a watcher with manual control.- Missing
shallowReffor large immutable structures:ref()adds deep reactivity — expensive for giant arrays/objects that are replaced as a whole. v-memoon lists that rarely change: Not a universal win — adds comparison cost. Profile first.v-onceon static content that is left reactive:v-onceon content that actually changes causes stale display.v-showvsv-if:v-showalways renders (togglesdisplay),v-iftears down/rebuilds. Usev-showfor frequent toggles,v-iffor rare or expensive-to-render content.<KeepAlive>withoutmax: Unbounded cache grows indefinitely — set:max.
MEDIUM — Forms
- Form without
<form>element and@submit.prevent: Loses native submit-on-Enter, browser autofill integration, accessibility tree. - Custom validation logic instead of a vetted form library for non-trivial forms: Use VeeValidate, FormKit, or build on Vue's native validation. Manual validation is error-prone.
v-modelon a<select>without:valuebinding: Options must have explicit:valuefor non-string data.- Input debounce implemented with
watch+ manualsetTimeoutinstead ofuseDebounceFn: The composable handles teardown, pending state, and cancellation correctly.
MEDIUM — Composition
- Options API in new code (Vue 3 projects): New components should use
<script setup>Composition API unless the team has an explicit migration freeze. The ecosystem (docs, tooling, TS support, composables) has standardized on Composition API. - Mixins in Vue 3 projects: Mixins are source-of-truth collisions and opaque data flow. Replace with composables.
defineExposeexposing more than necessary: Component internals leaked to parent via template ref — expose only the intended public API.- Component over 300 lines (template + script): Extract subcomponents or composables.
- Plain ref for template references (Vue 3.5+): Prefer
useTemplateRef('name')over matching a plainrefvariable name to the templaterefattribute.useTemplateRefsupports dynamic ref IDs and provides better type safety.
Diagnostic Commands
# Required
npx eslint . --ext .vue,.ts,.js # ensure eslint-plugin-vue is configured
vue-tsc --noEmit # Vue-specific type checking
npm run typecheck --if-present # respect project's canonical command
# Useful
npx eslint . --rule 'vue/multi-word-component-names: error'
npx eslint . --rule 'vue/no-v-html: warn'
npx eslint . --rule 'vue/require-default-prop: warn'
npx prettier --check .
npm audit
If eslint-plugin-vue or vue-tsc is not in the project, recommend installing during the review.