Skip to content
← All rules
CommentsComment correctness

comments/no-misleading-comments

Concrete comment claims should remain consistent with the current behavior visible next to them.

accuracymaintenancebehavior
TypeScript
// Cache for one minute.
const ttlMs = 3_600_000;
Finding

Disallow claims contradicted by visible code.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/comments

Register the plugin

In scruple.config.ts, register the factory under the comments namespace used by the rule ID.

import { comments } from "@scruple/comments";

plugins: {
  "comments": comments(),
},

Enable the rule

"comments/no-misleading-comments": "warn"
Package
@scruple/comments
Default threshold
0.85
Minimum confidence
0.7

Released under the MIT License.