Skip to content

@mmd-toolkit/timeline-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 holds nothing or only whitespace, mermaid.js accepts it without an error and leaves the description unchanged.

Rule Details ​

This rule applies to timelines (timeline). It reports an accDescr block that holds nothing or only whitespace. A block with only directives is reported too, although mermaid.js applies their settings.

A block with only comments is not reported: the comments show that the block is meant to do nothing. A block with a comment line and directives is not reported either.

An empty block on the line of another statement, as in accDescr {} 2020 : a, is reported too. Inside the text of a title, a section, a period, or an event, accDescr {} is part of that text and is not reported.

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/timeline-no-empty-description-block: error
timeline
  
accDescr {}
2020 : Launch
mmd
%% eslint @mmd-toolkit/timeline-no-empty-description-block: error
timeline
  
accDescr { }
2020 : Launch

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/timeline-no-empty-description-block: error
timeline
  accDescr {
    line1
    line2
  }
mmd
%% eslint @mmd-toolkit/timeline-no-empty-description-block: error
timeline
  accDescr {
    %% old description
  }
  2020 : Launch

Options ​

This rule has no options.

Version ​

This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.

Resources ​

Third-party tools for Mermaid diagram text.