requireCapitalizedComments

Requires the first alphabetical character of a comment to be uppercase, unless it is part of a multi-line textblock.

This rule automatically ignores jscs, jshint, eslint and istanbul specific comments.

Types: Boolean or Object

Values:

  • true
  • Object:
    • allExcept: array of quoted exceptions
    • inlined: Ignore comments in the middle of the code line

Example

"requireCapitalizedComments": true
Valid:
// Valid
//Valid

/*
  Valid
 */

/**
 * Valid
 */

// A textblock is a set of lines
// that starts with a capitalized letter
// and has one or more non-capitalized lines
// afterwards

// A textblock may also have multiple lines.
// Those lines can be uppercase as well to support
// sentence breaks in textblocks

// 123 or any non-alphabetical starting character
// @are also valid anywhere

// jscs: enable
Invalid:
// invalid
//invalid
/** invalid */
/**
 * invalid
 */
"requireCapitalizedComments": { "allExcept": ["pragma"] }
Valid:
function sayHello() {
    /* pragma something */

    // I can now say hello in lots of statements, if I like.
    return "Hello";
}
Valid:
function sayHello() {
    /* istanbul ignore next */

    // I'd like to ignore this statement in coverage reports.
    return "Hello";
}
Invalid:
function sayHello() {
    /* otherPragma something */

    // i can now say hello in lots of statements, if I like.
    return "Hello";
}
"requireCapitalizedComments": { "inlined": true }
Valid:
function sayHello( world /*internal*/ ) {
}
Rule source
Test source