1 # enforce a particular style for multiline comments (multiline-comment-style)
3 Many style guides require a particular style for comments that span multiple lines. For example, some style guides prefer the use of a single block comment for multiline comments, whereas other style guides prefer consecutive line comments.
7 This rule aims to enforce a particular style for multiline comments.
11 This rule has a string option, which can have one of the following values:
13 * `"starred-block"` (default): Disallows consecutive line comments in favor of block comments. Additionally, requires block comments to have an aligned `*` character before each line.
14 * `"bare-block"`: Disallows consecutive line comments in favor of block comments, and disallows block comments from having a `"*"` character before each line.
15 * `"separate-lines"`: Disallows block comments in favor of consecutive line comments
17 The rule always ignores directive comments such as `/* eslint-disable */`. Additionally, unless the mode is `"starred-block"`, the rule ignores JSDoc comments.
19 Examples of **incorrect** code for this rule with the default `"starred-block"` option:
23 /* eslint multiline-comment-style: ["error", "starred-block"] */
34 * is missing a newline after /*
39 * is missing a newline at the end */
42 * the star in this line should have a space before it
46 * the star on the following line should have a space before it
51 Examples of **correct** code for this rule with the default `"starred-block"` option:
54 /* eslint multiline-comment-style: ["error", "starred-block"] */
62 // single-line comment
65 Examples of **incorrect** code for this rule with the `"bare-block"` option:
68 /* eslint multiline-comment-style: ["error", "bare-block"] */
81 Examples of **correct** code for this rule with the `"bare-block"` option:
84 /* eslint multiline-comment-style: ["error", "bare-block"] */
91 Examples of **incorrect** code for this rule with the `"separate-lines"` option:
95 /* eslint multiline-comment-style: ["error", "separate-lines"] */
109 Examples of **correct** code for this rule with the `"separate-lines"` option:
112 /* eslint multiline-comment-style: ["error", "separate-lines"] */
121 ## When Not To Use It
123 If you don't want to enforce a particular style for multiline comments, you can disable the rule.