Skip to content

Latest commit

Β 

History

History
64 lines (50 loc) Β· 2.07 KB

no-asterisk-prefix-in-documentation-comments.md

File metadata and controls

64 lines (50 loc) Β· 2.07 KB

no-asterisk-prefix-in-documentation-comments

πŸ“ Disallow asterisk prefixes and shared indentation in multiline comments.

πŸ’ΌπŸš« This rule is enabled in the following configs: βœ… recommended, 🎨 recommended-css, 🧩 recommended-json, πŸ’Ž recommended-soml. This rule is disabled in the β˜‘οΈ unopinionated config.

πŸ”§ This rule is automatically fixable by the --fix CLI option.

This rule disallows conventional indented asterisk prefixes and shared extra indentation inside multiline comments. In JavaScript, it only applies to documentation comments; regular block comments are ignored. In CSS, JSONC, JSON5, and SOML, it applies to all block comments. The autofix removes prefixes and shared extra indentation after the opening line, preserving relative indentation and aligning the closing delimiter. Put all content after the opening line when Markdown indentation matters. No-gap asterisk lines like * content are ignored because the asterisk may be intentional comment content. Comments where only some lines have an asterisk prefix are ignored for the same reason.

Examples

// ❌
/**
 * Add two numbers.
 * @param {number} number1 The first number.
 * @param {number} number2 The second number.
 * @returns {number} The sum of the two numbers.
 */
// βœ…
/**
Add two numbers.
@param {number} number1 The first number.
@param {number} number2 The second number.
@returns {number} The sum of the two numbers.
*/

Comments without asterisk prefixes are also checked:

// ❌
/**
 Description.
   Indented example.
 */

// βœ…
/**
Description.
  Indented example.
*/

The rule also supports CSS, JSONC, JSON5, and SOML comments:

/* ❌ */
/*
 * Description.
 */

/* βœ… */
/*
Description.
*/