English
@mmd-toolkit/flowchart-no-ignored-text
Disallow text on a direction line that mermaid.js drops.
✅ The recommended configuration enables this rule.
A direction statement is written on a line of its own. When other text shares the line, mermaid.js reads the whole line as the direction statement and drops the rest without an error.
Rule Details
This rule applies to flowcharts (flowchart, graph, flowchart-elk, and swimlane-beta). It reports text before direction or after its direction value on the same line. This includes statements separated by ; and a line that contains the direction inside a label, such as A[Set direction LR]-->B.
Text after the direction value containing only ; and whitespace is not reported. Nor is text where only ; and whitespace precede %%, because the author means it as a comment. Other text before %%, such as x in direction TB; x %% c, is reported.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-ignored-text: error
flowchart LR
subgraph S
A-->B; direction TB
endmmd
%% eslint @mmd-toolkit/flowchart-no-ignored-text: error
flowchart LR
A-->B direction TBmmd
%% eslint @mmd-toolkit/flowchart-no-ignored-text: error
flowchart LR
subgraph S
direction TB; A-->B
endExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/flowchart-no-ignored-text: error
flowchart LR
subgraph S
A --> B
direction TB
endmmd
%% eslint @mmd-toolkit/flowchart-no-ignored-text: error
flowchart LR
subgraph S
direction TB %% vertical
A --> B
endOptions
This rule has no options.
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.