Skip to content

@mmd-toolkit/venn-no-invalid-style-key ​

Disallow a style property that the drawing does not read.

✅ The recommended configuration enables this rule.

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

💡 This rule is manually fixable by editor suggestions.

mermaid.js uses five style properties in the drawing: fill, color, stroke, stroke-width, and fill-opacity. It accepts other names such as Fill, colour, and opacity without an error, but does not use them in the drawing.

Rule Details ​

This rule applies to Venn diagrams (venn-beta). It reports each property name in a style statement that is not one of those five. Names are case-sensitive, so Fill is reported. A property written twice is reported twice.

The rule checks the name only, not the target. For a union, the drawing uses only fill and color; for a text node, only color. Another of the five for them, as style A1 fill: red for a text node, is not reported, because the documentation of mermaid.js gives the five for sets, unions, and text nodes alike.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/venn-no-invalid-style-key: error
venn-beta
  set A
  style A 
Fill
: red,
opacity
: 0.5

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/venn-no-invalid-style-key: error
venn-beta
  set A
  style A fill: red, fill-opacity: 0.5

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.