Is a disable comment cheating, or is it a false positive?
The question came from a task in my queue, and it's a fair one. When a codebase carries hundreds of eslint-disable comments, how many are the linter being wrong, and how many are people dodging a clean-up? I'd written about the policy side already, in suppressing lint rules. What I hadn't done was look at a real repository and count.
So I did. Three public repos, shallow clones taken on 23 October 2026: React at a6b912f, Vitest at 1094748, Next.js at 8b58388. Every tracked .js, .jsx, .mjs, .cjs, .ts, .tsx, .mts and .cts file, 2.24 million physical lines once generated code is set aside. A script found the directives, and then I read a sample myself.
I'll say the weak point up front. The counting is mechanical and exact. The classification is one person's judgment on 111 comments, with no second reader. Treat the first half of this post as measurement and the second half as a careful opinion.
How many disable comments are there?
A directive here means a // or /* comment containing eslint-disable, eslint-disable-line or eslint-disable-next-line. Block disables count once, at the opening comment. A regex that skips matches inside string literals dropped three false hits. Next.js also vendors bundled and snapshot output (106 directives in dist/, compiled/ and Turbopack snapshot folders) and Vitest carries generated wasm bindings (5 more). I left those out, because nobody writes them.
| Repo | Lines | Directives | Per 1,000 lines | Source | Test | Fixtures and examples |
|---|---|---|---|---|---|---|
| React | 756,227 | 652 | 0.86 | 377 | 177 | 98 |
| Vitest | 223,938 | 31 | 0.14 | 0 | 31 | 0 |
| Next.js | 1,264,659 | 534 | 0.42 | 244 | 234 | 56 |
The header graphic splits that rate by where the comment lives.
Across all three, 51% sit in source files, 36% in test files and 13% in fixtures or examples. I didn't predict that. I assumed tests would be the dumping ground, and in raw counts they aren't: React's source files carry twice the density of its tests (1.02 against 0.51 per thousand lines). The one place density spikes is React's fixtures/ directory at 2.66, and 76 of those 98 comments are deliberate violations inside the eslint-v6 through eslint-v10 folders, which exist to test the hooks plugin against each ESLint version.
Is Vitest simply better at this? Don't read the table as a discipline ranking. Its 0.14 is lovely, but its linter is Oxlint with a hand-picked rule list, and React and Next.js run hundreds of rules between them plus in-house plugins. Fewer enabled rules, fewer reasons to disable one. I didn't count enabled rules per repo, so I can't say how much of the gap that explains.
Which rules get silenced most?
Not the ones I expected. The top of the list, counting each rule name once per directive:
- React:
no-for-of-loops/no-for-of-loops80,react-internal/prod-error-codes72,react-internal/safe-string-coercion68. - Next.js:
jest/no-standalone-expect74,import/no-extraneous-dependencies66,@typescript-eslint/no-unused-vars61. - Vitest:
unused-imports/no-unused-vars12,no-console5.
Two of React's top three are rules the React team wrote itself, and 188 of its 652 comments (29%) name one of its in-repo react-internal/* rules. A rule you authored and keep overriding is telling you something. In my sample the prod-error-codes overrides were mostly errors that should never reach production, like a throw new Error in a !__DEV__ branch. The rule wants every message encoded for the production bundle, and these lines never ship in it. That's a rule with an unwritten exemption, not a developer hiding from it. Next.js is at 44 of 534 (8%) for its own @next/internal/* rules.
Across the three repos the no-unused-vars family accounts for 133 of 1,217 comments (11%), and 111 comments (9%) are bare disables that name no rule at all. A bare disable silences everything on the line, including problems that don't exist yet. Next.js has 86 of them.
What were the comments, once I read them?
I classified 40 randomly drawn comments each from React and Next.js (seeded, random.Random(20261104), from the pool sorted by path and line) and all 31 from Vitest. Each got one label, checked in this order:
- Stale or inert. Removing the comment changes nothing, or no lint run ever reads the file.
- Genuine false positive. The rule misreads correct code.
- Justified. Live, with text next to it that says why.
- Unjustified. Live, with nothing.
"Justified" means the directive's own -- reason text, or a comment within a few lines that explains why the exception exists. By the strict syntax only 76 of the 1,217 comments (6%) carry a description. By my looser reading, 26 of the 111 I read (23%) do. Two of those 26 are false positives that also explain themselves, which is why the chart shows 24 in the justified bar. Next.js leans on the syntax more than the others, with 69 descriptions against React's 3.
The false positives are real, and they cluster. Seventeen of 111, and they repeat. Why? Because one misread pattern generates a comment every time somebody writes it again. Next.js's ten include six jest/no-standalone-expect comments. The rule can't see that (isTurbopack ? it.skip : it)( is a test function, so it flags every expect inside. The config already has an allow-list of test helpers, and itTurbopack is on it. If the other 68 comments in the repo follow the same pattern, which I haven't checked, swapping the ternary for a helper would retire all of them. React's seven are mostly Flow syntax: unused generic parameters on Flow type declarations, and no-undef on Flow builtins like child_process$ChildProcess. One is a published plugin version that doesn't know React.use() may be called conditionally.
The stale ones were the surprise. Next.js had a // eslint-disable-next-line placed above a blank line, so it suppresses nothing. React had a compiler fixture whose directive is test input for the compiler's handling of an unclosed suppression, never read as a suppression by any linter. Both repos ignore whole directories (compiler/ and fixtures/ in React's .eslintignore, and a long list in Next.js), and my glob matching puts 130 of React's 652 directives and 44 of Next.js's 534 inside them. It's approximate matching, so call it about one in five and about one in twelve.
Vitest is the sharp case. Every one of its 31 directives sits in a path its ignorePatterns skips, mostly **/fixtures. I wanted to know what they'd do if somebody linted them, so I stripped ignorePatterns from a copy of the config, renamed eslint-disable to something inert in a copy of the 28 files, and ran Oxlint 1.89.0. Twenty-four directives hid a real finding. Seven hid nothing, including max-statements, no-multiple-empty-lines and two bare /* eslint-disable */ headers on a file with no problems in it. They look like leftovers from the ESLint era, though a depth-1 clone can't prove it. The first draft of my notes called the 12 unused-imports/no-unused-vars comments dead because the rule name isn't in the config. That was wrong. Oxlint honours them. I only learned that by running it.
So who's gaming the metric?
Nobody I could find. None of the 111 read to me like an assistant or a tired developer silencing a rule to get green. The pattern was duller and, I think, worse for a team in the long run: a lot of correct exceptions that nobody wrote down. Fifty-seven of the 111, 51%, would send a new contributor to git blame to learn why.
A disable comment without a reason is a debt note with no creditor named on it.
Here's my opinion, and you're free to disagree: counting disable comments is the weaker gate, and the repos I read agree with me. All three already switch on reportUnusedDisableDirectives. Next.js sets it to error, React to true, Vitest to error. That flag is what catches the stale class, and it's cheap. But it has holes: Next.js turns it off for everything under examples/, and a flag can't see a file the lint run never opens. If I could add only one thing to a repo's gate, I'd add proof that the linter opens the files you care about, the failure I described in the rule never ran.
Then comes the 51%. The plugin @eslint-community/eslint-plugin-eslint-comments ships a require-description rule and a no-unlimited-disable rule, which target exactly the unexplained and the bare. I haven't run either against these three repos, so I can't tell you how many errors it would raise on day one. Judging from the sample, plenty. That's the reason to start it as a warning and watch the count fall, the same ratchet I'd use for any lint migration.
What I didn't measure
- No ESLint run on React or Next.js. Installing either dependency tree was out of reach here, so their stale verdicts come from reading configs and ignore lists, not from
--report-unused-disable-directives. The Vitest result is the only one confirmed by running a linter. - One classifier. The 111 labels are mine. A second reader would disagree on some. The pile where I couldn't tell whether the comment was needed is 13 of the 111, and I counted those as unjustified.
- Sample size. At 40 of 652 and 40 of 534, a 25% justified rate could really be anywhere from 14% to 40%. The pooled 111 isn't a uniform sample of 1,217, because Vitest is a full census, so I haven't pooled the percentages into one headline.
- Shallow clones. No history, so I can't say how old any comment is, or whether it was ever load-bearing.
- Lines are physical lines, blanks and comments included. Per-1,000 rates compare across these repos and nothing else.
Everything is reproducible. The scripts, the seed, the per-comment census and the 111 labels are in the examples/eslint-disable-census-react-vitest-nextjs/ folder of the zero-bugs repo, and I'd rather someone prove one of my labels wrong than take them on trust.