Skip to content

No Commented Code

Suggestion
small-rules/no-commented-code

Disallow commented-out code

Diagnostic Messages

commentedCode
Commented-out code creates confusion about intent and clutters the codebase. Version control preserves history, making dead code comments unnecessary. Delete the commented code entirely. If needed later, retrieve it from git history.

Configuration

This rule accepts one options object after the severity.

maxLinesOptional

Maximum number of lines of commented code allowed without reporting. Default 0 means any commented code triggers an error.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-commented-code": [
"error",
{
"maxLines": 0
}
]
}
}

Examples

Remove commented-out code
// const value = 1;
Allow one commented code line
// if (something) {}