BetaViberTest is in active development — expect breaking changes.
Overview
DocsRulesOversized Files
#001mediumArchitecture & Structure

Oversized Files

Detects files exceeding recommended line count.

Rule ID:oversized-files

Examples#

BadDashboard.tsx — 650 lines, does everything
// Dashboard.tsx — 650 lines
export function Dashboard() {
  const [users, setUsers] = useState([]);
  const [analytics, setAnalytics] = useState(null);
  const [notifications, setNotifications] = useState([]);
  const [settings, setSettings] = useState({});
  const [isLoading, setIsLoading] = useState(true);

  useEffect(() => { /* fetch users */ }, []);
  useEffect(() => { /* fetch analytics */ }, []);
  useEffect(() => { /* fetch notifications */ }, []);
  useEffect(() => { /* fetch settings */ }, []);

  function handleUserUpdate() { /* 40 lines */ }
  function handleAnalyticsRefresh() { /* 30 lines */ }
  function renderUserTable() { /* 80 lines */ }
  function renderAnalyticsChart() { /* 60 lines */ }
  function renderNotificationPanel() { /* 50 lines */ }
  // ... 300 more lines of mixed concerns
}
GoodSplit into focused modules
// hooks/use-dashboard-data.ts
export function useDashboardData() {
  const users = useUsers();
  const analytics = useAnalytics();
  return { users, analytics };
}

// components/UserTable.tsx — ~80 lines
export function UserTable({ users, onUpdate }: UserTableProps) {
  return <table>...</table>;
}

// components/AnalyticsChart.tsx — ~60 lines
export function AnalyticsChart({ data }: AnalyticsChartProps) {
  return <Chart data={data} />;
}

// Dashboard.tsx — ~40 lines, composition only
export function Dashboard() {
  const { users, analytics } = useDashboardData();
  return (
    <Layout>
      <UserTable users={users} onUpdate={handleUpdate} />
      <AnalyticsChart data={analytics} />
    </Layout>
  );
}

What It Detects#

mediumFile exceeds maxFileLines threshold
File has {lines} lines (max: {maxLines})

Fix: Extract hooks, sub-components, utils, and types into separate modules. Apply the Single Responsibility Principle.

lowFile exceeds 80% of maxFileLines
File has {lines} lines (warning threshold: {threshold})

Fix: This file is getting large. Consider splitting before it becomes unmanageable.

Configurable Thresholds#

OptionDefaultDescription
maxFileLines500Maximum lines per file before flagging

Configuration#

This rule is enabled by default. To disable it:

.vibertestrc.jsonjson
{
  "rules": {
    "oversized-files": {
      "enabled": false
    }
  }
}