Skip to content

@mmd-toolkit/xychart-no-empty-description-block ​

Disallow a description block that holds no description.

✅ The recommended configuration enables this rule.

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 XY charts (xychart and xychart-beta). It reports a closed accDescr block that holds nothing or only whitespace, including line breaks. A block with only directives is reported too, although mermaid.js applies their settings. The keyword is read in any case.

A block with only comments is not reported: the comments show that the block is meant to do nothing.

An empty block before or after another statement on the same line is reported too. An unclosed block, even an empty one, is reported by xychart-no-unclosed-description-block.

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/xychart-no-empty-description-block: error
xychart
  
accDescr {}
line [1, 2]
mmd
%% eslint @mmd-toolkit/xychart-no-empty-description-block: error
xychart
  
accDescr { }
line [1, 2]

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/xychart-no-empty-description-block: error
xychart
  accDescr {
    Monthly sales
    by region
  }
  title "Sales"
  line [1, 2]
mmd
%% eslint @mmd-toolkit/xychart-no-empty-description-block: error
xychart
  accDescr {
    %% TODO
  }
  line [1, 2]

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.