TypeScript · maintainability
no-comment-cruft
eslint:no-comment-cruft Flag commented-out code, section-banner comments, and leading file-header comment preambles.
- Default
- error
- Fix
- none
- Languages
- typescript
Why
Decorative, narrated, or dead-code comments obscure the constraints and rationale that comments should preserve.
Fix
Delete dead code and narration; express boundaries with named code and retain only comments that explain constraints or intent.
Before / after
Executed by this rule’s unit tests.
Before
A region comment decorates a code boundary
const x = 1;
// region helpers
const y = 2; After
A comment explains why retry is required
// retry because the upstream API is flaky
const x = retry(); Limits
- The rule skips generated files and conservatively preserves prose, issue references, licenses, examples, and tool directives.
Message IDs
commentWallcommentedOutCodefileHeaderPreambleplaceholderImplementationredundantNarrationsectionBanneruntrackedTodo