BetaViberTest is in active development — expect breaking changes.
Overview
DocsRulesDead Code & Unused Exports
#006mediumCode Quality

Dead Code & Unused Exports

Detects exported functions, types, and variables that are never imported anywhere.

Rule ID:dead-code

Examples#

BadExported but never imported anywhere
// lib/helpers.ts
export function formatDate(d: Date) { /* used */ }
export function formatTime(d: Date) { /* used */ }
export function formatDateTime(d: Date) { /* NEVER imported */ }
export function formatRelative(d: Date) { /* NEVER imported */ }
export type DateFormat = 'short' | 'long'; // NEVER imported
GoodOnly export what is used
// lib/helpers.ts
export function formatDate(d: Date) { /* used */ }
export function formatTime(d: Date) { /* used */ }

// Removed formatDateTime, formatRelative, DateFormat
// — they were dead code, never imported anywhere

What It Detects#

mediumNamed export never imported anywhere in the project
"{exportName}" is exported but never imported anywhere

Fix: Remove this export if it's no longer needed, or verify it's used externally.

Exclusions#

The following are automatically excluded from this rule:

  • Entry point files (index, main, app, layout, page, route)
  • Test files
  • Barrel re-exports
  • .d.ts files
  • Storybook stories

Configuration#

This rule is enabled by default. To disable it:

.vibertestrc.jsonjson
{
  "rules": {
    "dead-code": {
      "enabled": false
    }
  }
}