Adding a type-aware linter and knip to a grown codebase: 2,319 violations down to zero

How we added type-aware oxlint and knip to Forkly after hundreds of commits without a linter: what we fixed, what we switched off on purpose, and why.

The short answer

The first run of type-aware oxlint on Forkly found 2,319 violations. We fixed the real ones in code, kept a few on purpose with a reason on the line, and switched off four rules with their counts written down, so the linter could fail CI from day one. knip followed: unused dependencies fail the build, and unused files and exports are listed as a to-do.

On this page
  1. What did the first run find?
  2. How did we decide what to fix?
  3. Why not baseline the 2,319 and fix them later?
  4. What does knip add?
  5. Where do these checks run?
  6. What we’d tell anyone adding a linter late

Forkly, our restaurant ordering platform, grew to hundreds of commits with a strict TypeScript setup but no linter in its checks. In November 2026 we added two: a type-aware linter (oxlint) and knip, which finds unused dependencies, files and exports.

The hard part of adding a linter late isn’t installing it. It’s the first run, which reports thousands of problems at once. This post covers how we got from that number to a linter that fails CI, without pretending the problems weren’t there.

What did the first run find?

2,319 violations. Most of them came from a handful of rules:

Rule Count
no-unnecessary-type-assertion 1,973
no-misused-promises 170 (161 of them on JSX attributes)
no-unused-vars 47
require-array-sort-compare 32
no-base-to-string 16
eqeqeq 13
no-floating-promises 12
no-redundant-type-constituents 11
43 other rules the rest

How did we decide what to fix?

Every violation went into one of three groups.

Fixed in code. Unused imports and variables removed. Floating promises explicitly marked as fire-and-forget with void, so the intent is visible. Number sorts given a compare function, since JavaScript’s default sort compares numbers as strings ([10, 9, 1].sort() gives [1, 10, 9]). Regexes cleaned of useless escapes. Comma expressions written out as separate statements.

Kept, with the reason on the line. A few lines break a rule on purpose: a regex that matches control characters, sorts whose expected result really is code-unit order, test mocks that return promises where the rule expects none. Each gets a disable comment for the next line only, with the reason next to it. A blanket disable for a whole file would hide new problems too.

Rules switched off or narrowed, with their counts written in the commit.

  • no-unnecessary-type-assertion (1,973). The code writes items[i]! after checking the index, and the TypeScript config doesn’t use noUncheckedIndexedAccess, so the types call those assertions unnecessary. They’re intentional and harmless, so the rule is off until that setting is turned on.
  • no-redundant-type-constituents (11): types like 'a' | string, written on purpose as editor hints.
  • no-base-to-string (16): String(...) on values that are known to be strings at runtime.
  • no-misused-promises on JSX attributes: async event handlers in React, a common and safe pattern.

The rest of the rules stay on. The linter exits with an error on any new violation.

Why not baseline the 2,319 and fix them later?

A baseline file (“ignore these existing violations”) is tempting, but it keeps every old problem in place and makes the linter’s output something people learn to ignore. Sorting every violation into fixed, kept-with-a-reason or rule-off took one pass, and afterwards the linter’s output means one thing: something new is wrong.

What does knip add?

A linter looks inside files. knip looks at the project as a whole: dependencies that are installed but never imported, imports of packages that aren’t listed, files nothing imports, and exports nobody uses.

We set it up in two levels:

  • Fail: an unused dependency, a dependency used but not listed, an unknown binary. These are cheap to fix and dangerous to leave, since an unlisted dependency works only by accident. The first run found two packages a seed script imported without listing them.
  • List, don’t fail: unused files, exports and types. The first run listed 358 unused exports and 67 unused exported types. They’re printed on every run as a to-do, and they come down release by release.

To prove knip actually fails, we planted an unused dependency (left-pad) and checked that it exited with an error.

Where do these checks run?

Both run in the fast checks every pull request goes through before tests, and the same script runs locally. Formatting and linting of staged files also run in a pre-commit hook, so most problems never reach a pull request.

What we’d tell anyone adding a linter late

  • Expect a big first number, and look at it by rule. A few rules usually make up most of it.
  • Fix real problems in code; keep deliberate exceptions on the line with a reason; switch off a rule only with its count and the reason written down.
  • Make the linter fail CI from the first day. A linter that only warns gets ignored.
  • Plant a violation to prove each new check can actually fail.

Keep reading

Tell us what you want to build.

A product, a website, a search problem or a system that should work better. We reply with a plain answer and the first step.

A few sentences are enough (at least 20 characters).

We use your details only to answer your inquiry. See our privacy policy.