惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
B
Blog
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
IT之家
IT之家
D
Docker
Google DeepMind News
Google DeepMind News
罗磊的独立博客
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
博客园 - 叶小钗
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
博客园 - 司徒正美
Engineering at Meta
Engineering at Meta

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your TypeScript Codebase Is Lying to You. Fallow Will Tel...
Olawale Afuy · 2026-05-05 · via DEV Community

You think your codebase is clean.

You're wrong.

Somewhere in that repo right now, there are files nobody imports. Functions nobody calls. CSS classes nobody renders. Logic that was copy-pasted three times across different modules because someone was in a hurry and nobody ever went back.

Nobody went back.

And you've been shipping on top of that mess, quietly, every sprint.

I'm not here to judge. I've seen it at every scale — scrappy startups, enterprise platforms, well-funded teams with senior engineers. The mess is universal. What isn't universal is the tool that actually shows it to you.

That tool is Fallow.


What Fallow Actually Is

Fallow is a static + runtime code intelligence CLI for TypeScript and JavaScript projects.

One command. Three reports. No excuses left.

npx fallow

Enter fullscreen mode Exit fullscreen mode

That's it. No config file needed to start. No ceremony.

It gives you:

  • Dead Code — unused files, exports, dependencies, circular imports
  • Duplication — code clones, copy-paste instances, semantic repeats
  • Health — cyclomatic complexity, cognitive complexity, test coverage risk

Think of it as a colonoscopy for your codebase. Uncomfortable to look at. Absolutely necessary.


Why Your Current Setup Is Not Enough

ESLint is not doing this job. TypeScript is not doing this job.

ESLint catches style violations and obvious anti-patterns. It does not tell you that src/utils/formatDate.ts hasn't been imported by anything in eight months.

TypeScript's compiler will let you export a function to the void forever, completely unbothered.

These tools are not designed to answer the question: "Is this code actually alive?"

Fallow is designed for exactly that.


The Three Reports, Explained Simply

#1. Dead Code Analysis

Dead code is not just unused variables. Fallow goes deeper.

It traces your entry points — what your app actually boots from — and maps every import chain outward. Anything not reachable from that graph is dead.

This includes:

  • Unused files (the whole file. Gone. Pointless.)
  • Unused exports (the function exists. Nobody calls it.)
  • Unused dependencies (you installed it. You're not using it.)
  • Circular imports (A imports B imports A. A disaster waiting to become a bug.)

The goal here is zero. Not "few." Zero.

If something is genuinely a public API that external consumers use, you annotate it:

/** @public */
export function myPublicUtil() { ... }

Enter fullscreen mode Exit fullscreen mode

Everything else that Fallow flags? Remove it or explain yourself.


#2. Duplication Analysis

Here's the threshold that matters:

  • < 5% duplication — Low. You're doing well.
  • 5–15% — Moderate. Review it.
  • > 15% — High. You have a copy-paste culture problem, not a code problem.

Fallow finds Type-1 clones (exact copies) and Type-2 clones (same logic, renamed variables). The semantic mode catches the sneaky ones — the ones where someone changed user to customer and called it "abstraction."

When you find a clone group with 3+ instances, that's not duplication anymore. That's a bug factory. Every time the logic needs to change, someone will update two of the three copies and miss the third.

Extract it. Make it a shared utility. Move on.


#3. Health Analysis

This is where Fallow earns its keep for senior engineers.

Three metrics to know:

Cyclomatic Complexity — the number of independent paths through a function. If it's above 20, your function is doing too much. Above 50? That function should be arrested.

Cognitive Complexity — how hard the function is to read, not just test. Target: ≤15. This is the one that catches deeply nested ifs-inside-loops-inside-ternaries.

CRAP Score (Change Risk Anti-Patterns) — combines complexity with test coverage. A CRAP score above 30 means you have complex, untested code. Above 100? That module is a liability.

The fix is either: write tests, or simplify the function. Usually both.


How to Actually Start (Don't Skip This Part)

Most developers install a tool, run it once, see 400 errors, close the terminal, and never open it again.

Don't do that.

Here's the sequence that works:

Step 1: Get the full picture

npx fallow

Enter fullscreen mode Exit fullscreen mode

Do not panic at the output. You're not fixing everything today. You're learning the shape of the problem.

Step 2: Initialize your config

npx fallow init

Enter fullscreen mode Exit fullscreen mode

This creates a .fallow/config.json where you declare your entry points, ignored patterns, and thresholds. Without this, Fallow doesn't know that src/index.ts is where your app starts — and it'll flag things that aren't actually dead.

Set your entry points honestly. Don't cheat by marking everything as an entry point to make the numbers look good.

Step 3: Triage by category

npx fallow dead-code --unused-files   # Low-hanging fruit. Delete them.
npx fallow dead-code --unused-deps    # Package.json bloat. Remove them.
npx fallow dead-code --unused-exports # The sneaky ones. Investigate first.
npx fallow dupes                       # Find the clone groups.
npx fallow health                      # Find the complexity hotspots.

Enter fullscreen mode Exit fullscreen mode

Don't try to fix everything at once. Pick the highest-severity items — unused files and high-instance clones — and batch them into a cleanup PR.

Step 4: Preview before you delete

npx fallow fix --dry-run

Enter fullscreen mode Exit fullscreen mode

Fallow can auto-remove dead exports and unused dependencies. Always run --dry-run first. Review what it plans to touch. Then apply it.

Step 5: Lock it into CI

Once the repo is clean, keep it clean.

npx fallow audit

Enter fullscreen mode Exit fullscreen mode

audit runs only on changed files — perfect for PR checks. Add it to your GitHub Actions pipeline with --fail-on-issues and you've made "don't introduce new dead code" a team policy, not a gentleman's agreement.


For CSS/SCSS People: Yes, Fallow Covers That Too

If you're using CSS Modules, Fallow treats every class in your .module.css file as an exported symbol.

If that class isn't referenced anywhere in your component code, it shows up as an unused export.

/* button.module.css */
.primaryBtn { ... }   /* ✅ Used */
.legacyBtn { ... }    /* ❌ Unused — Fallow flags this */

Enter fullscreen mode Exit fullscreen mode

It also resolves @use and @forward chains in SCSS, tracks Tailwind's @import, and handles partials. This is not an afterthought. The CSS analysis is first-class.


The Metrics Cheat Sheet

Keep this somewhere visible.

Metric Target Warning Action Needed
Duplication % < 5% 5–15% > 15%
Cyclomatic Complexity ≤ 20 21–50 > 50
Cognitive Complexity ≤ 15 16–30 > 30
CRAP Score < 30 30–99 ≥ 100
Complexity Density < 0.3 0.3–0.5 > 0.5

The health badge gives you an A–F grade for the whole project. A = 85+. F = you have a conversation to have with your team.


The Honest Part

Fallow will not fix your codebase.

You will.

What Fallow does is remove the excuse of not knowing. Before this, you could say "we don't know where the dead code is." That excuse is gone now. Before this, you could say "we can't measure duplication." Gone.

The tool is free to start. The refactoring takes discipline.

But the teams that do this — that actually clean the backlog, set thresholds, and gate new code in CI — those teams ship faster. Not because they have fewer lines of code, but because the lines they have are lines they understand.

That's the whole point.


What to Do Right Now

Not "this sprint." Right now.

npx fallow

Enter fullscreen mode Exit fullscreen mode

Look at the output. Pick the most embarrassing finding — the one you already suspected existed but never wanted to confirm. Fix that one thing.

Then run it again.


Have you run Fallow on your project yet? Drop your findings in the comments — the duplication % especially. No judgment. Only solidarity.


Tags: typescript javascript webdev tooling