New
Introducing React Bench, see how different models perform on React code

react-doctor/circular-dependency

A runtime import cycle can observe partially initialized exports

Status
Active
Category
Maintainability
Assessment
Evidence-required risk
Required evidence
source code, repository context
Default configuration
Disabled until configured
Default severity
warn
Show technical metadata
Scope
All supported frameworks
Active when
full project scans when explicitly configured
Tags
project-analysis
Priority
44 (P3)
Source
react-doctor-core
Rule set
oxlint-plugin-react-doctor 0.9.3 (prompt schema 2)
On this page

Validation prompt

Confirm the detector match and collect the required evidence before deciding whether an edit is warranted.

This opt-in project rule reports a runtime import cycle with top-level access to a binding in the cycle. It excludes type-only and lazy edges that cannot create initialization-order failures. Confirm the reported path and module initialization behavior before accepting the finding.

Evidence boundary

The diagnostic proves only that the detector’s modeled source pattern matched. It does not prove runtime impact, product intent, rendered failure, or that one remediation is correct.

Establish the environment, repository policy, exceptions, and required rendered or runtime evidence before deciding the occurrence.

Record one outcome:

  • Confirmed failure: The required evidence establishes the violation.
  • Rejected: A documented exception or false-positive predicate applies.
  • Needs evidence: Named evidence can still be collected.
  • Unavailable: Required evidence cannot be collected in this run.
  • Waived with evidence: An authorized, scoped exception applies to an established failure.
  • Observation: The review records an optional tradeoff without claiming a defect.

A waiver records its scope, authority, evidence, and review condition. It is not a pass or false positive.

Default severity is registry metadata. Use the occurrence’s JSON severity after repository configuration when ordering real findings.

Review a candidate correction

Apply this candidate correction only after the required evidence confirms the risk.

Reported pattern

// a.ts
import { beta } from "./b";
export const alpha = beta + 1;

// b.ts
import { alpha } from "./a";
export const beta = alpha + 1;

Candidate corrected pattern

// values.ts
export const seed = 1;

// a.ts
import { seed } from "./values";
export const alpha = seed + 1;

// b.ts
import { seed } from "./values";
export const beta = seed + 2;

Fix prompt

Apply this candidate correction only after the required evidence confirms the risk.

Break the cycle by moving shared values into a third module or reversing the dependency at a stable boundary. Preserve initialization order and public exports. Run a full React Doctor scan plus focused module and application tests.

Repository-wide copy prompt

Use this repository-wide prompt only after validating each occurrence. For one occurrence, use the guidance above.

Show repository-wide prompt

Fix every confirmed react-doctor/circular-dependency diagnostic in the current repository.

Required change:

  • Break the cycle by moving shared values into a third module or reversing the dependency at a stable boundary. Preserve initialization order and public exports. Run a full React Doctor scan plus focused module and application tests.

Validation before editing:

This opt-in project rule reports a runtime import cycle with top-level access to a binding in the cycle. It excludes type-only and lazy edges that cannot create initialization-order failures. Confirm the reported path and module initialization behavior before accepting the finding.

Constraints:

  • Confirm every occurrence independently.
  • Make the smallest change that addresses the root cause.
  • Preserve unrelated behavior, interfaces, content, and semantics.
  • Reuse existing project conventions and components.
  • Do not suppress the rule merely to clear the report.

Assessment:

  • Record detector evidence, applicability, missing evidence, and one outcome: Confirmed failure, Rejected, Needs evidence, Unavailable, Waived with evidence, or Observation.

Verification:

  • Run focused tests and every repository-mandated check.
  • Run React Doctor and confirm the diagnostic no longer appears from changed code.
  • Run an unfiltered scan of the affected scope before claiming no cross-category regression.
  • Report checks that were not run instead of claiming they passed.