Skip to content

@mmd-toolkit/er-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 entity relationship diagrams (erDiagram). 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 after another statement on its line or after the header is reported too. Inside the text of accTitle:, accDescr {} is part of that text and is not reported. After a direction, er-no-ignored-text reports it.

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/er-no-empty-description-block: error
erDiagram
  A
  
accDescr {}
mmd
%% eslint @mmd-toolkit/er-no-empty-description-block: error
erDiagram
  A
  
accDescr { }

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/er-no-empty-description-block: error
erDiagram
  accDescr {
    line1
    line2
  }
  A
mmd
%% eslint @mmd-toolkit/er-no-empty-description-block: error
erDiagram
  A
  accDescr {
    %% c
  }

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.