Skip to content

@mmd-toolkit/requirement-no-ignored-text ​

Disallow text that mermaid.js drops.

✅ The recommended configuration enables this rule.

A direction statement is written on a line of its own. When the line also holds other text, mermaid.js reads the whole line as the direction statement and drops the rest without an error.

Rule Details ​

This rule applies to requirement diagrams (requirementDiagram). It reports text on a direction line before direction or after its value, including words joined to direction and empty description blocks after the value. Text after the value that starts with %%, %, or # is not reported: the author means it as a comment, and mermaid.js drops it as meant.

A direction line prefixed with # or %, as in # direction LR, still sets the direction, and the prefix is reported. A comment line starting with %%, as in %% direction LR, sets no direction and is not reported.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/requirement-no-ignored-text: error
requirementDiagram
  direction LR 
x
requirement r { id: 1 }
mmd
%% eslint @mmd-toolkit/requirement-no-ignored-text: error
requirementDiagram
  requirement r {
    id: 1
  }
  element e {
    type: simulation
  }
  
r - satisfies -> e
direction LR

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/requirement-no-ignored-text: error
requirementDiagram
  direction LR
  requirement r {
    id: 1
  }
mmd
%% eslint @mmd-toolkit/requirement-no-ignored-text: error
requirementDiagram
  direction LR %% c
  requirement r {
    id: 1
  }

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.