TypeScript · TS0017

Report comments without a recognized exemption

Report script, JSX, and Vue template comments that do not match a known directive or configured exemption. Opt-in: no Preset turns it on.
TS0017vite-doctor/typescriptstrictwarnUnsafe fix

This opt-in rule is in no preset, strict included. Turn it on with "rules": { "typescript/strict/no-comments": "warn" } in doctor.config.json. See the TypeScript guide for what it keeps, its options, how to adopt it with --since, and how --unsafe-fix deletes comments once you have classified them.

Run this rule

pnpm vite-doctor . --rules typescript/strict/no-comments

Why it matters

A comment that repeats the code goes stale when the code changes, and agents read stale comments as facts. The Rule recognizes common compiler, linter, formatter, and coverage directives, bundler annotations such as #__PURE__ and @vite-ignore, triple-slash references, /*!, @license and @preserve comments, source map comments, SAFETY notes, semantic JSDoc, and, by default, JSDoc on exported declarations and their members. Use allow for comments that other project tools consume.

Check whether a project tool reads the comment before removing it; if it does, add a pattern to allow it. Move non-obvious decisions to the project's decision log and file issues for workarounds before removing their comments. When removing a script or JSX comment, preserve its line breaks and use a space if the comment separates tokens.

Example

Name the code instead of describing it

Before

// Retry three times before giving up.
for (let attempt = 0; attempt < 3; attempt++) await send()

After

const maxSendAttempts = 3
for (let attempt = 0; attempt < maxSendAttempts; attempt++) await send()
Copyright © 2026