Skip to content

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

Disallow a description 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 quadrant charts (quadrantChart). 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. 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 a point on the same line is reported too.

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/quadrant-no-empty-description-block: error
quadrantChart
  
accDescr {}
A: [0.3, 0.6]
mmd
%% eslint @mmd-toolkit/quadrant-no-empty-description-block: error
quadrantChart
  
accDescr { }
A: [0.3, 0.6]

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/quadrant-no-empty-description-block: error
quadrantChart
  accDescr {
    Campaigns by reach
    and engagement
  }
  A: [0.3, 0.6]
mmd
%% eslint @mmd-toolkit/quadrant-no-empty-description-block: error
quadrantChart
  accDescr {
    %% TODO
  }
  A: [0.3, 0.6]

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.