Skip to content

@mmd-toolkit/venn-no-ignored-text ​

Disallow a character that the comment after it removes.

✅ The recommended configuration enables this rule.

A %% comment can remove the character just before it when no space separates them. In set A:%% size to fill in, the colon disappears with the comment, and mermaid.js reads set A with the default size 10 without an error.

Rule Details ​

This rule applies to Venn diagrams (venn-beta). It reports each character removed by the comment immediately after it, whether after a statement, on its own line, or after the header. This happens only where mermaid.js starts reading a new word or sign: set AB%% c keeps AB and is not reported. set A%% c loses A and is not reported, because mermaid.js gives an error for it.

Removed whitespace is not reported because it changes nothing. A %% inside a label or quoted name is text, not a comment, and nothing before it is reported.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/venn-no-ignored-text: error
venn-beta
  set A
:
%% size to fill in

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/venn-no-ignored-text: error
venn-beta
  set A : 20 %% size

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.