A comment after a statement can make the next line continue that statement. mermaid.js includes the following line break in the comment, which can change the diagram without an error or make the text invalid.
This rule applies to class diagrams (classDiagram and classDiagram-v2). It reports a comment after other text on the same line when more text follows it. A comment on the last line of the text is not reported, because mermaid.js reads it as intended.
Comments are also reported when the next line cannot continue the statement or the comment follows the header. mmd-toolkit accepts and formats these texts, but mermaid.js gives an error for them; this is the known divergence comment-takes-line-break.
Comments followed by whitespace-only lines are reported even when those lines keep the statements apart, because that depends on invisible whitespace.
@mmd-toolkit/class-no-inline-comment
Disallow a comment after other text on its line.
The
recommendedconfiguration does not enable this rule.🔧 This rule is automatically fixable by the
--fixCLI option.A comment after a statement can make the next line continue that statement. mermaid.js includes the following line break in the comment, which can change the diagram without an error or make the text invalid.
Rule Details
This rule applies to class diagrams (
classDiagramandclassDiagram-v2). It reports a comment after other text on the same line when more text follows it. A comment on the last line of the text is not reported, because mermaid.js reads it as intended.Comments are also reported when the next line cannot continue the statement or the comment follows the header. mmd-toolkit accepts and formats these texts, but mermaid.js gives an error for them; this is the known divergence
comment-takes-line-break.Comments followed by whitespace-only lines are reported even when those lines keep the statements apart, because that depends on invisible whitespace.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
This rule has no options.
Version
This rule was introduced in
@mmd-toolkit/eslint-pluginv0.1.0.Resources