Skip to content

@mmd-toolkit/block-no-invalid-direction ​

Disallow a direction of a block arrow that is not one of the direction words.

✅ The recommended configuration enables this rule.

🔧 This rule is automatically fixable by the --fix CLI option.

A block arrow points in the directions written after it, as in A<["Next"]>(right). mermaid.js accepts whitespace inside the parentheses or before a comma, as in ( left ), without an error. That whitespace remains part of the direction, so the arrow does not point that way.

Rule Details ​

This rule applies to block diagrams (block-beta and block). It reports a direction that is not exactly right, left, up, down, x, or y, in standalone block arrows and in edges.

Whitespace after a comma is ignored, so (x, down) is not reported. Whitespace before a comma is kept, so the first direction in (left ,right) is reported and the arrow points right only.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/block-no-invalid-direction: error
block
  A<["Next"]>(
left
)

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/block-no-invalid-direction: error
block
  A<["Next"]>(left)
mmd
%% eslint @mmd-toolkit/block-no-invalid-direction: error
block
  A<["Next"]>(x, down)

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.