English
@mmd-toolkit/flowchart-no-duplicate-description
Disallow an accDescr statement that sets the description again.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
A diagram has one description. When another accDescr statement sets it, mermaid.js replaces the earlier description without an error, so the earlier one is lost.
Rule Details
This rule applies to flowcharts (flowchart, graph, flowchart-elk, and swimlane-beta). It reports an accDescr statement that changes a description set by an earlier statement. The line and block forms are compared together, including statements inside a subgraph, which set the description of the whole diagram.
With no text after accDescr:, the next line with text supplies the description, past empty lines, comment lines, and directives; with no such line, the description becomes empty. Empty blocks and unclosed blocks are not counted by this rule.
Repeating the current description is not reported, while going back to an earlier one is: after accDescr: a and accDescr: b, a third accDescr: a is reported. Comparisons ignore whitespace at the ends and after each line break, including indentation and empty lines in blocks, and treat LF, CRLF, and CR as LF.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-description: error
flowchart LR
accDescr: first
accDescr: secondmmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-description: error
flowchart LR
accDescr {
first
second
}
accDescr: thirdmmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-description: error
flowchart LR
subgraph S
A
accDescr: inner
end
accDescr: outerExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-description: error
flowchart LR
A
accDescr: firstmmd
%% eslint @mmd-toolkit/flowchart-no-duplicate-description: error
flowchart LR
A
accDescr: first
accDescr: firstOptions
This rule has no options.
Related Rules
- flowchart-no-duplicate-title
- flowchart-no-empty-description-block
- flowchart-no-unclosed-description-block
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.