Skip to content

@mmd-toolkit/block-no-mismatched-shape ​

Disallow a shape whose closing does not match its opening.

✅ The recommended configuration enables this rule.

💡 This rule is manually fixable by editor suggestions.

A block's opening and closing together specify its shape, as in A["x"] and A(("x")). mermaid.js accepts a mismatched pair, such as A["x"), without an error. It keeps the label but draws a plain rectangle instead of the intended shape.

Rule Details ​

This rule applies to block diagrams (block-beta and block). It reports a shape whose opening is known to mermaid.js but whose opening and closing do not form a recognized pair, in standalone blocks and in edges.

Missing or extra brackets, as in A(("x") and A["x"]], are reported. The asymmetric pairs A>"x"], A[/"x"\], and A[\"x"/] are not reported because they specify shapes. Composite heads are not checked because they are drawn as composite blocks regardless of the pair.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/block-no-mismatched-shape: error
block
  A
["Start")

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/block-no-mismatched-shape: error
block
  A["Start"]

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.