English
@mmd-toolkit/usecase-no-unclosed-description-block
Disallow an accDescr { block that a } written for a later statement closes.
The recommended configuration does not enable this rule.
An accDescr { block runs to the first } after its opening brace. If its own } is missing, mermaid.js can close it at a later statement's } without an error. The intervening statements become description text and disappear from the diagram.
Rule Details
This rule applies to use case diagrams (usecase-beta). It reports an accDescr block containing a { on a later line than its opening brace, unless the closing } stands alone on its line. A closing brace is alone when only whitespace precedes it on that line. A block without any closing } is not reported, because mermaid.js gives an error for it.
A { in a comment line is not counted, and a } in a comment line does not close the block. A same-line form such as accDescr { a { b } is not reported. A later metadata closing brace on a line of its own is not reported either, even when it closes the description by mistake.
An intentional description such as accDescr { followed by a {b } is reported because the rule cannot distinguish its brace from metadata.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/usecase-no-unclosed-description-block: error
usecase-beta
accDescr { first
A --> B
actor C@{ type: hollow }
DExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/usecase-no-unclosed-description-block: error
usecase-beta
accDescr {
first line
second line
}
A --> B
actor C@{ type: hollow }
Dmmd
%% eslint @mmd-toolkit/usecase-no-unclosed-description-block: error
usecase-beta
accDescr {
uses { here
and there
}
AOptions
This rule has no options.
Related Rules
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.