vize:croquis/cf/circular-dep
Components import each other in a cycle.
| Default severity | Automatic fix | Options |
|---|---|---|
| Not emitted | 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
This is a published diagnostic contract without a current producer. The Bad/Good scenario below explains the risk and repair; no flag currently makes this code trigger.
This illustrates a concrete eager-initialization cycle. A recursive Vue component or every circular import is not automatically erroneous. No current producer emits this contract 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 App from './App.vue';
createApp(App).mount('#app');
index.html
<!doctype html>
<html lang="en"><head><meta charset="UTF-8"><title>Contract scenario</title></head>
<body><div id="app"></div><script type="module" src="/main.ts"></script></body></html>
App.vue
<script setup lang="ts">
import { aLabel } from './a';
</script>
<template>
<p>{{ aLabel }}</p>
</template>
labels.ts
export const aPrefix = 'A';
export const bPrefix = 'B';
Bad
a.ts imports b.ts, which imports a.ts back. Both eagerly initialize a constant from the other module’s still-uninitialized constant, creating a temporal-dead-zone failure.
a.ts
import { bLabel } from './b';
export const aLabel = 'A' + bLabel;
b.ts
import { aLabel } from './a';
export const bLabel = 'B' + aLabel;
Good
Both modules read initialized prefixes from the independent labels.ts module, removing the cycle and the eager cross-read.
a.ts
import { bPrefix } from './labels';
export const aLabel = 'A' + bPrefix;
b.ts
import { aPrefix } from './labels';
export const bLabel = 'B' + aPrefix;
Configuration (Vite+)
This code is not currently emitted by the CLI, so there is no CLI rule configuration to enable here.