Vize

vize:croquis/cf/setup-context-violation

Keep component-owned reactive state inside per-instance setup.

Default severity Automatic fix Options
context-dependent None; review related files and apply the repair No per-code options; supported CLI findings accept severity overrides

Applies to: Analyzed component graph and the supported facts described below

The experimental Rust CrossFileAnalyzer has a producer for this code. The CLI pass does not emit this individual code; configuring its ID does not enable that Rust pass. These scenarios describe the analyzer's supported graph/facts, not a Vite+ promise.

Scope and limitations

This experimental analyzer scenario places ref(0) at normal script module scope rather than per-instance setup. Vue permits this reactive state; the example requires each component instance to own its own count. The CLI does not emit this individual code.

Shared project files

Use these unchanged files in both Bad and Good. Install the imported packages in the project: Vue, plus vue-router or Pinia where shown. Follow any version-specific support note. The entry root makes the component relationship explicit.

main.ts

import { createApp } from "vue";
import Root from "./App.vue";
createApp(Root).mount("#app");

index.html

<div id="app"></div>
<script type="module" src="/main.ts"></script>

Bad

ref(0) is created at normal script module scope, outside the per-instance setup context represented by this analyzer scenario.

App.vue

<script lang="ts">
import { ref } from "vue";
const count = ref(0);
export default {};
</script>
<template><p>Count</p></template>

Good

Move the binding into script setup, where each component instance owns its count and the template can read it.

App.vue

<script setup lang="ts">
import { ref } from "vue";
const count = ref(0);
</script>
<template><p>{{ count }}</p></template>

Configuration (Vite+)

This code is not currently emitted by the CLI, so there is no CLI rule configuration to enable here.

Public explanation

Producer

Cross-file index