Skip to content

@mmd-toolkit/agentflow-no-duplicate-direction ​

Disallow a direction statement that replaces the direction of its flow.

✅ The recommended configuration enables this rule.

💡 This rule is manually fixable by editor suggestions.

A direction statement sets the direction of its flow. A later one in the same flow replaces it without an error, and the earlier direction is lost.

Rule Details ​

This rule applies to agentflow diagrams (agentflow-beta). It reports a direction statement that changes the direction set by an earlier statement for the same flow. Statements count for the flow whose body they stand in directly.

Declarations with the same id are one flow, so their directions are compared too. Two unnamed flows are different flows, and their directions are not compared.

Repeating the current direction is not reported, and TD and TB both mean top to bottom.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/agentflow-no-duplicate-direction: error
agentflow-beta TB
  flow F
    direction LR
    A
    
direction BT
end

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/agentflow-no-duplicate-direction: error
agentflow-beta TB
  flow F
    direction LR
    A
  end

Options ​

This rule has no options.

Further Reading ​

Version ​

This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.

Resources ​

Third-party tools for Mermaid diagram text.