Repository: eslint/eslint
File: lib/rules/multiline-comment-style.js (JavaScript)

Code before:

                                        if (/^\s*\//u.test(lineText) && offset.length === 0) {
                                            offset += " ";
                                        }
                                        break;
                                    }

                                    return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`);
                                }
                            });
                        }
                    }
                }
            },
            "separate-lines"(commentGroup) {
                const [firstComment] = commentGroup;

                const isJSDoc = isJSDocComment(commentGroup);

                if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) {
                    return;
                }

                let commentLines = getCommentLines(commentGroup);

                if (checkJSDoc && isJSDoc) {
                    commentLines = commentLines.slice(1, commentLines.length - 1);
                }

                const tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: true });

                if (tokenAfter && firstComment.loc.end.line === tokenAfter.loc.start.line) {
                    return;
                }

                context.report({
                    loc: {
                        start: firstComment.loc.start,
                        end: { line: firstComment.loc.start.line, column: firstComment.loc.start.column + 2 }
                    },
                    messageId: "expectedLines",
                    fix(fixer) {
                        return fixer.replaceText(firstComment, convertToSeparateLines(firstComment, commentLines));
                    }
                });
            },
            "bare-block"(commentGroup) {
                if (isJSDocComment(commentGroup)) {
                    return;
                }


Review comment (suggestion):
```suggestion
                if (isJSDoc) {
```

Looks unnecessary to check the option again at this point.

Code after:
                                        return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], expectedLinePrefix);
                                    }

                                    const [, commentTextPrefix = ""] = lineText.match(/^(\s*)/u) || [];
                                    const commentTextStartIndex = lineStartIndex + commentTextPrefix.length;
                                    let offset;

                                    for (const [idx, line] of lines.entries()) {
                                        if (!/\S+/u.test(line)) {
                                            continue;
                                        }

                                        const lineTextToAlignWith = sourceCode.lines[firstComment.loc.start.line - 1 + idx];
                                        const [, prefix = "", initialOffset = ""] = lineTextToAlignWith.match(/^(\s*(?:\/?\*)?(\s*))/u) || [];

                                        offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`;

                                        if (/^\s*\//u.test(lineText) && offset.length === 0) {
                                            offset += " ";
                                        }
                                        break;
                                    }

                                    return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`);
                                }
                            });
                        }
                    }
                }
            },
            "separate-lines"(commentGroup) {
                const [firstComment] = commentGroup;

                const isJSDoc = isJSDocComment(commentGroup);

                if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) {
                    return;
                }

                let commentLines = getCommentLines(commentGroup);

                if (isJSDoc) {
                    commentLines = commentLines.slice(1, commentLines.length - 1);
                }

                const tokenAfter = sourceCode.getTokenAfter(firstComment, { includeComments: true });

                if (tokenAfter && firstComment.loc.end.line === tokenAfter.loc.start.line) {
                    return;
                }