English
@mmd-toolkit/state-no-empty-description-block
Disallow an accDescr block that holds no description.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
An accDescr block is written to give the diagram a description. When it contains nothing or only whitespace, mermaid.js accepts it without an error, but it has no effect.
Rule Details
This rule applies to state diagrams (stateDiagram and stateDiagram-v2). It reports a closed accDescr block containing nothing or only whitespace. Directives do not count as text, so a block containing only directives is reported, although mermaid.js applies their settings.
A block containing a comment line is not reported, including when it also contains directives, because comments can mark a description left to be filled in later.
Empty blocks are also reported after a statement or the header on the same line. An empty block before a body's { on a later line belongs to no statement and is reported by state-no-ignored-text instead.
The formatter prints an empty block as accDescr {}. The example with whitespace inside the braces is shown as written.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/state-no-empty-description-block: error
stateDiagram-v2
A --> B
accDescr {}mmd
%% eslint @mmd-toolkit/state-no-empty-description-block: error
stateDiagram-v2
A --> B
accDescr {
}Examples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/state-no-empty-description-block: error
stateDiagram-v2
A --> B
accDescr {
first line
second line
}mmd
%% eslint @mmd-toolkit/state-no-empty-description-block: error
stateDiagram-v2
A --> B
accDescr {
%% c
}Options
This rule has no options.
Related Rules
- flowchart-no-empty-description-block
- state-no-unclosed-description-block
- state-no-duplicate-description
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.