Skip to content

eslint/rules/comments ​

Comments: TODO / FIXME, commented-out code, ts-ignore and the style of comments. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only.

11 rules, 3 on. Source: lint/eslint/rules/comments.mjs.

RuleSettingFilesWhat it checksWhy
capitalized-commentsoffJS + TSEnforce or disallow capitalization of the first letter of a comment—
no-inline-commentsoffJS + TSDisallow inline comments after codeOff: non-standard, end-of-line comments are fine.
no-warning-commentswarnJS + TSDisallow specified warning terms in commentsWarn: a TODO may stay while a ticket tracks it.
sonarjs/no-commented-codeoffJS + TSSections of code should not be commented outOff: not in the Sonar way profile of SonarQube.
sonarjs/no-sonar-commentsoffJS + TSTrack uses of "NOSONAR" commentsOff: not in the Sonar way profile of SonarQube.
sonarjs/fixme-tagoffJS + TSTrack uses of "FIXME" tagsOff: duplicate of no-warning-comments.
sonarjs/todo-tagoffJS + TSTrack uses of "TODO" tagsOff: duplicate of no-warning-comments.
sonarjs/file-headeroffJS + TSTrack lack of copyright and license headersOff: not in the Sonar way profile of SonarQube.
@typescript-eslint/ban-ts-commenterrorTSDisallow @ts-<directive> comments or require descriptions after directives—
@typescript-eslint/ban-tslint-commenterrorTSDisallow // tslint:<rule-flag> comments—
@typescript-eslint/prefer-ts-expect-erroroffTSEnforce using @ts-expect-error over @ts-ignoreDeprecated: replaced by ban-ts-comment.

Generated from the JSDoc of the sources.