Skip to main content

Module output_dead_code

Module output_dead_code 

Source
Expand description

Typed envelope wrappers for the simple 1:1 dead-code findings (UnusedFile, PrivateTypeLeak, UnresolvedImport, CircularDependency, BoundaryViolation). Each wrapper flattens the bare finding via #[serde(flatten)] and carries a typed actions array populated at construction time, replacing the per-finding post-pass injection that previously grafted actions[] and introduced onto the schema. The introduced field is set by the audit pass via JSON map insertion and is None when serialized directly from Rust. The schemars::JsonSchema derive is gated per-struct on the schema feature. Typed envelope wrappers for the simple 1:1 dead-code findings whose actions are entirely determined by the wrapper type (no per-instance discriminants beyond what the bare finding already exposes).

Each wrapper flattens the bare finding via #[serde(flatten)] so the wire shape matches the previous actions-grafted output byte-for-byte. actions is populated at construction time via each wrapper’s with_actions constructor and replaces the per-finding inject_actions post-pass in crates/cli/src/report/json.rs. introduced carries the optional audit breadcrumb that crates/cli/src/audit.rs::annotate_issue_array inserts into the JSON object via map.insert; the wrapper-level field stays None when serialized directly from Rust and is set by the audit pass only when the issue was introduced relative to the merge-base.

All nine wrappers ship with IssueAction arrays today; they pay the serde_json dependency cost because IssueAction transitively references AddToConfigValue::RuleObject(serde_json::Map<...>). The variants the wrappers actually emit (Fix, SuppressLine, SuppressFile, AddToConfig) are small, but reusing the existing enum keeps the wire-shape contract identical to the legacy post-pass.

introduced is typed as Option<AuditIntroduced> (transparent newtype over bool) so the regenerated schema renders the field via $ref: #/definitions/AuditIntroduced, matching the reference the prior post-pass augmentation graft used. The audit pass continues to inject a bare bool via map.insert("introduced", ...); serde reads it back into AuditIntroduced transparently. The field stays absent at the wire when None (skip_serializing_if).

Structs§

BoundaryCallViolationFinding
Wire-shape envelope for a BoundaryCallViolation finding. Carries actions for refactoring the forbidden call out of the zone or suppressing it with the shared boundary-violation token.
BoundaryCoverageViolationFinding
Wire-shape envelope for a BoundaryCoverageViolation finding. Carries actions for assigning the file to a zone or explicitly allowing it to stay unmatched.
BoundaryViolationFinding
Wire-shape envelope for a BoundaryViolation finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (refactor-boundary primary plus suppress-line secondary).
CircularDependencyFinding
Wire-shape envelope for a CircularDependency finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (refactor-cycle primary plus suppress-line secondary).
DuplicateExportFinding
Wire-shape envelope for a DuplicateExport finding. Carries up to three actions in position-locked order: an add-to-config ignoreExports snippet (only when locations[] carries at least one path) followed by the remove-duplicate fix and the multi-location suppress.
DuplicatePropShapeFinding
Wire-shape envelope for a DuplicatePropShape finding. There is no safe auto-fix: extracting a shared Props type or a base component for a group of same-shaped components is a design decision. The actions are manual guidance (extract the shared shape) plus a line-level suppress at the component definition and a file-level suppress escape hatch (mirroring the route-collision multi-file model). The rule defaults to off (opt-in health signal), so this finding is dormant by default.
DynamicSegmentNameConflictFinding
Wire-shape envelope for a DynamicSegmentNameConflict finding. The conflict is a Next.js dev / runtime error (next build does NOT catch it), so the primary action is manual guidance (rename the dynamic segments to a single consistent slug name), with a file-level suppress as escape hatch.
EmptyCatalogGroupFinding
Wire-shape envelope for an EmptyCatalogGroup finding. Carries a straightforward remove-empty-catalog-group primary plus a YAML-comment suppress.
InvalidClientExportFinding
Wire-shape envelope for an InvalidClientExport finding. There is no safe auto-fix: the export itself may be a legitimate client-component value export that happens to collide with a Next.js server-only name, so removing it could break the component. Actions are a manual move-to-server-module fix (the real remediation) plus a line-level suppress.
MisconfiguredDependencyOverrideFinding
Wire-shape envelope for a MisconfiguredDependencyOverride finding. Carries a fix-dependency-override primary plus the conditional add-to-config ignoreDependencyOverrides suppress (skipped when both target_package and raw_key are empty, since the rule matcher keys on a non-empty package name).
MisplacedDirectiveFinding
Wire-shape envelope for a MisplacedDirective finding. There is no safe auto-fix: moving a directive to the leading prologue is a small but judgement-bearing edit (the author may have intended the file to be a server module after all). Actions are a manual hoist-directive fix (the real remediation) plus a line-level suppress.
MixedClientServerBarrelFinding
Wire-shape envelope for a MixedClientServerBarrel finding. There is no safe auto-fix: splitting a barrel into separate client and server modules is a human decision (the barrel may intentionally aggregate both surfaces). Actions are a manual split-mixed-barrel fix (the real remediation) plus a line-level suppress.
PolicyViolationFinding
Wire-shape envelope for a PolicyViolation finding. Carries actions for replacing the banned call or import, or suppressing it with a scoped policy-violation:<pack>/<rule-id> token.
PrivateTypeLeakFinding
Wire-shape envelope for a PrivateTypeLeak finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (export-type primary plus suppress-line secondary).
PropDrillingChainFinding
Wire-shape envelope for a PropDrillingChain finding. There is no safe auto-fix: collapsing a drilling chain (colocate the consumer, lift to a context, or compose the component) is a design decision. The only action is a line-level suppress at the source hop’s prop declaration. The rule defaults to off (opt-in health signal), so this finding is dormant by default.
ReExportCycleFinding
Wire-shape envelope for a ReExportCycle finding. Mirrors CircularDependencyFinding: flattens the bare finding and carries a typed actions array (refactor-re-export-cycle informational primary plus suppress-file secondary; cycles are file-scoped so a single file-level suppression on the alphabetically-first member breaks the cycle, and no // fallow-ignore-next-line form makes sense because the diagnostic is anchored at line 1 col 0 of each member).
RouteCollisionFinding
Wire-shape envelope for a RouteCollision finding. A route collision is a guaranteed next build failure, so the PRIMARY action is manual guidance (move or merge one of the colliding files), NOT a suppress: suppressing a build error never makes the build pass. A file-level suppress is offered as an escape hatch only.
TestOnlyDependencyFinding
Wire-shape envelope for a TestOnlyDependency finding. Carries a move-to-dev primary (different prose than TypeOnlyDependencyFinding) plus the standard ignoreDependencies config suppress.
ThinWrapperFinding
Wire-shape envelope for a ThinWrapper finding. There is no safe auto-fix: inlining a thin wrapper at its call sites (or deleting it) is a design decision. The only action is a line-level suppress at the wrapper’s definition. The rule defaults to off (opt-in health signal), so this finding is dormant by default.
TypeOnlyDependencyFinding
Wire-shape envelope for a TypeOnlyDependency finding. Carries a move-to-dev primary plus the standard ignoreDependencies config suppress.
UnlistedDependencyFinding
Wire-shape envelope for an UnlistedDependency finding. Carries an install-dependency primary (non-auto-fixable) plus the standard ignoreDependencies config suppress.
UnprovidedInjectFinding
Wire-shape envelope for an UnprovidedInject finding. There is no safe auto-fix: the fix is binary but judgement-bearing (add a provide for the key, or delete the dead inject). Actions are manual remediation guidance plus a line-level suppress.
UnrenderedComponentFinding
Wire-shape envelope for an UnrenderedComponent finding. There is no safe auto-fix: the fix is binary but judgement-bearing (render the component somewhere, or delete the dead component). Actions are manual remediation guidance plus a line-level suppress.
UnresolvedCatalogReferenceFinding
Wire-shape envelope for an UnresolvedCatalogReference finding. The primary action at position 0 discriminates on available_in_catalogs: add-catalog-entry when the array is empty (no other catalog declares the package), or update-catalog-reference when at least one alternative exists. When exactly one alternative exists, the action also carries suggested_target so deterministic agents can land the edit without picking from a list.
UnresolvedImportFinding
Wire-shape envelope for an UnresolvedImport finding. Mirrors UnusedFileFinding: flattens the bare finding and carries a typed actions array (resolve-import primary plus config and inline suppression actions).
UnusedCatalogEntryFinding
Wire-shape envelope for an UnusedCatalogEntry finding. Per-instance auto_fixable flips to false when hardcoded_consumers is non-empty: the entry cannot be removed safely while a workspace package still pins the same package via a hardcoded version range.
UnusedClassMemberFinding
Wire-shape envelope for an UnusedMember finding consumed under the unused_class_members key. Same Rust struct as UnusedEnumMemberFinding; the fix action and suppress comment carry the class-member kebab-case identifier instead.
UnusedComponentEmitFinding
Wire-shape envelope for an UnusedComponentEmit finding. There is no safe auto-fix: removing a declared emit is judgement-bearing (the event may be part of a deliberately-stable public component API). Actions are manual remediation guidance plus a line-level suppress at the emit declaration.
UnusedComponentInputFinding
Wire-shape envelope for an UnusedComponentInput finding. There is no safe auto-fix: removing a declared input is judgement-bearing (the input may be part of a deliberately-stable public component API). The only action is a line-level suppress at the input declaration.
UnusedComponentOutputFinding
Wire-shape envelope for an UnusedComponentOutput finding. There is no safe auto-fix: removing a declared output is judgement-bearing (the event may be part of a deliberately-stable public component API). The only action is a line-level suppress at the output declaration.
UnusedComponentPropFinding
Wire-shape envelope for an UnusedComponentProp finding. There is no safe auto-fix: removing a declared prop is judgement-bearing (the prop may be part of a deliberately-stable public component API). Actions are manual remediation guidance plus a line-level suppress at the prop declaration.
UnusedDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_dependencies key (production deps). Flattens the bare finding; the typed actions array carries either a remove-dependency or move-dependency primary depending on inner.used_in_workspaces.
UnusedDependencyOverrideFinding
Wire-shape envelope for an UnusedDependencyOverride finding. Carries a remove-dependency-override primary plus an add-to-config ignoreDependencyOverrides suppress scoped to the target package and declaration source.
UnusedDevDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_dev_dependencies key. Same bare struct as UnusedDependencyFinding; the fix description points at devDependencies and the suppress comment uses unused-dev-dependency.
UnusedEnumMemberFinding
Wire-shape envelope for an UnusedMember finding consumed under the unused_enum_members key.
UnusedExportFinding
Wire-shape envelope for an UnusedExport finding consumed under the unused_exports key. Same Rust struct as UnusedTypeFinding, with a different fix description so consumers can tell value-export from type-export removal at the action level.
UnusedFileFinding
Wire-shape envelope for an UnusedFile finding. The bare finding flattens in via #[serde(flatten)], with a typed actions array populated at construction time and the audit-pass introduced flag attached as an optional sibling.
UnusedLoadDataKeyFinding
Wire-shape envelope for an UnusedLoadDataKey finding. There is no safe auto-fix: a load() fetch can have side effects, so deleting the key is a human call. Actions are manual remediation guidance plus a line-level suppress.
UnusedOptionalDependencyFinding
Wire-shape envelope for an UnusedDependency finding consumed under the unused_optional_dependencies key. Same bare struct as UnusedDependencyFinding; the fix description points at optionalDependencies. Reuses the unused-dependency suppress IssueKind because there is no dedicated variant for optional deps.
UnusedServerActionFinding
Wire-shape envelope for an UnusedServerAction finding. There is no safe auto-fix: the fix is binary but judgement-bearing (wire the action up to a consumer, or delete it). Actions are manual remediation guidance plus a line-level suppress.
UnusedStoreMemberFinding
Wire-shape envelope for an UnusedMember finding consumed under the unused_store_members key (a Pinia state / getters / actions key, or a setup-store returned key, declared but never accessed by any consumer project-wide). Same Rust struct as UnusedClassMemberFinding. Emits only a line-level suppress action: there is no safe auto-fix because a store member can be accessed reflectively (a Pinia plugin, store.$onAction, or dynamic dispatch) in ways syntactic analysis cannot see, so removal is a behavioral change the user must own.
UnusedSvelteEventFinding
Wire-shape envelope for an UnusedSvelteEvent finding. There is no safe auto-fix: removing a dispatched event is judgement-bearing (the event may be part of a deliberately-stable public component API, or a listener may be added later). Actions are manual remediation guidance plus a line-level suppress at the dispatch call.
UnusedTypeFinding
Wire-shape envelope for an UnusedExport finding consumed under the unused_types key. Wraps the same bare UnusedExport struct as UnusedExportFinding but emits a fix action targeted at type-only declarations, with the same is_re_export-aware note swap.

Constants§

NAMESPACE_BARREL_HINT
Shared note for the duplicate-exports fix action. Mirrors the const used by the human report (see crates/cli/src/report/shared.rs); kept here so the wire-format builder reads from the same source of truth.