Skip to content

@mmd-toolkit/quadrant-no-undef ​

Disallow a class of a point that no classDef defines.

✅ The recommended configuration enables this rule.

A point takes the styles of a class with :::, as in A:::c1: [0.3, 0.6]. When no classDef of the chart defines that class, as when its name is misspelled, mermaid.js gives no error, and the class has no effect: the point keeps the styles of its own and those of the theme.

Rule Details ​

This rule applies to quadrant charts (quadrantChart). It reports each point whose class name after ::: has no matching classDef anywhere in the chart, before or after the point. Names are case-sensitive, so C1 does not name c1. A point with its own styles is reported too, since its undefined class adds nothing.

A point's class name consists of letters, digits, and _, while classDef names may contain other characters: A:::c does not name the class c-1.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/quadrant-no-undef: error
quadrantChart
  Campaign A:::
hot
: [0.3, 0.6]
classDef hit color: #f00

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/quadrant-no-undef: error
quadrantChart
  Campaign A:::hot: [0.3, 0.6]
  classDef hot color: #f00

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.