English
Rules
The rules of @mmd-toolkit/eslint-plugin, an ESLint language plugin for Mermaid diagram text built on @mmd-toolkit/parser, with one document for each rule.
The recommended configuration enables the rules marked ✅ in the list below: their reports are nearly always mistakes to fix.
Rule ids
A rule id starts with @mmd-toolkit, the namespace of the plugin. A common rule, one for every diagram type, has the id @mmd-toolkit/<name>; a rule of a diagram type has the id @mmd-toolkit/<diagram>-<name>. The rules of flowchart apply to flowchart-v2, flowchart-elk, and swimlane.
✅ The recommended configuration enables the rule.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
Common rules
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| no-duplicate-init-key | Disallow a key written twice in one object of the JSON of an init directive. | ✅ | 💡 | |
| no-invalid-init-directive | Disallow a directive meant to configure the diagram that is not written validly, so that mermaid.js ignores it. | ✅ | 🔧 | |
| no-unclosed-directive | Disallow a directive without its closing }%% that takes the lines after it. | ✅ |
flowchart
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| flowchart-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| flowchart-no-duplicate-direction | Disallow a direction statement that replaces the direction of its subgraph. | ✅ | 💡 | |
| flowchart-no-duplicate-title | Disallow an accTitle statement that sets the title again. | ✅ | 💡 | |
| flowchart-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| flowchart-no-ignored-text | Disallow text on a direction line that mermaid.js drops. | ✅ | ||
| flowchart-no-redefined-subgraph | Disallow a subgraph declaration whose title differs from the title kept for its id. | ✅ | ||
| flowchart-no-redefined-vertex | Disallow writing a vertex again, differently or in a subgraph that does not get it. | ✅ | ||
| flowchart-no-spaced-stroke | Disallow whitespace before the : of a stroke style. | 🔧 | ||
| flowchart-no-unclosed-description-block | Disallow an accDescr { block without its closing }. | 💡 | ||
| flowchart-no-undef | Disallow a style, class, or click statement that names an id that the diagram does not define. | ✅ |
sequence
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| sequence-no-create-destroy | Disallow create before destroy. | ✅ | ||
| sequence-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| sequence-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | 💡 | |
| sequence-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| sequence-no-ignored-text | Disallow a line that mermaid.js reads as nothing. | ✅ | 🔧 | |
| sequence-no-invalid-json | Disallow a links or properties statement whose text is not a JSON object. | ✅ | 🔧 | |
| sequence-no-link-without-separator | Disallow a link statement without the @ between its label and its URL. | ✅ | 🔧 | |
| sequence-no-unclosed-description-block | Disallow an accDescr { block without its closing }. | 💡 |
class
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| class-no-bare-class-name | Disallow a class name alone on its line, which changes nothing. | ✅ | ||
| class-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | ||
| class-no-duplicate-title | Disallow an accTitle statement that sets the title again. | ✅ | ||
| class-no-ignored-text | Disallow text that mermaid.js drops. | ✅ | ||
| class-no-inline-comment | Disallow a comment after other text on its line. | 🔧 | ||
| class-no-redefined-class | Disallow writing the label of a class again, differently. | ✅ | ||
| class-no-unclosed-backquote | Disallow a backquoted class name without its closing backquote. | ✅ | ||
| class-no-undef | Disallow a statement that refers to a class that the diagram does not define. | ✅ |
state
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| state-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| state-no-duplicate-title | Disallow an accTitle statement that sets the title again. | ✅ | 💡 | |
| state-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| state-no-ignored-text | Disallow text that mermaid.js drops. | ✅ | 🔧 | |
| state-no-unclosed-description-block | Disallow an accDescr { block without its closing }. | 💡 | ||
| state-no-undef | Disallow a style, class, click, or note statement that names no state. | ✅ |
er
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| er-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| er-no-duplicate-title | Disallow an accTitle statement that sets the title again. | ✅ | 💡 | |
| er-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| er-no-ignored-text | Disallow text that mermaid.js drops. | |||
| er-no-redefined-entity | Disallow an entity statement that gives an entity a second alias. | ✅ | ||
| er-no-unclosed-description-block | Disallow an accDescr { block that a } written for something else closes. | |||
| er-no-undef | Disallow a style or class statement that names no entity and no subgraph. | ✅ |
journey
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| journey-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| journey-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | 💡 | |
| journey-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| journey-no-empty-person | Disallow a person of a task that has no name. | ✅ | 💡 | |
| journey-no-ignored-text | Disallow text in the data of a task that mermaid.js drops. | ✅ | 💡 | |
| journey-no-invalid-score | Disallow a task score that is not a number from 1 to 5. | ✅ | 💡 |
gantt
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| gantt-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| gantt-no-duplicate-id | Disallow a task id that an earlier task already has. | ✅ | ||
| gantt-no-duplicate-setting | Disallow a setting statement that sets its setting again. | ✅ | 💡 | |
| gantt-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | 💡 | |
| gantt-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| gantt-no-invalid-tag | Disallow a tag in the data of a task that mermaid.js does not read as a tag. | ✅ | 🔧 | |
| gantt-no-undef | Disallow a task id in click, after, or until that is the id of no task. | ✅ | ||
| gantt-no-unknown-exclude | Disallow a word in excludes that is neither weekends nor the name of a day. | ✅ | 🔧 |
pie
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| pie-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| pie-no-duplicate-label | Disallow a section whose label an earlier section has, with another value. | ✅ | ||
| pie-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| pie-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 |
quadrant
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| quadrant-no-duplicate-description | Disallow a statement that sets the description of the chart again. | ✅ | 💡 | |
| quadrant-no-duplicate-style | Disallow a style that a point or a class gives again. | ✅ | 💡 | |
| quadrant-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | 💡 | |
| quadrant-no-empty-description-block | Disallow a description block that holds no description. | ✅ | 💡 | |
| quadrant-no-invalid-color | Disallow a hexadecimal colour without # in the style of a point or a class. | ✅ | 🔧 | |
| quadrant-no-invalid-coordinate | Disallow a coordinate of a point that is not a number from 0 to 1. | ✅ | 🔧 | |
| quadrant-no-redefined-axis | Disallow an axis statement that replaces a text of the axis. | ✅ | ||
| quadrant-no-redefined-class | Disallow a classDef statement that replaces the styles of its class. | ✅ | 💡 | |
| quadrant-no-redefined-quadrant | Disallow a quadrant statement that replaces the text of its quadrant. | ✅ | 💡 | |
| quadrant-no-undef | Disallow a class of a point that no classDef defines. | ✅ |
requirement
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| requirement-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| requirement-no-duplicate-field | Disallow a field that the body of a requirement or an element already has. | ✅ | 💡 | |
| requirement-no-duplicate-name | Disallow a requirement or an element that reuses the name of an earlier one. | ✅ | ||
| requirement-no-duplicate-title | Disallow an accTitle statement that sets the title again. | ✅ | 💡 | |
| requirement-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| requirement-no-ignored-text | Disallow text that mermaid.js drops. | ✅ | ||
| requirement-no-unclosed-description-block | Disallow an accDescr { block that a } written for something else closes. | |||
| requirement-no-undef | Disallow a name in style, class, :::, or a relationship that names no requirement and no element. | ✅ |
usecase
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| usecase-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| usecase-no-duplicate-direction | Disallow a direction statement that replaces the direction set before it. | ✅ | 💡 | |
| usecase-no-duplicate-metadata | Disallow a metadata value that replaces the value of the same key set before it. | ✅ | 💡 | |
| usecase-no-duplicate-title | Disallow an accTitle that replaces the title set before it. | ✅ | 💡 | |
| usecase-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| usecase-no-redefined-class | Disallow a classDef that drops or changes the styles of the class defined before it. | ✅ | 💡 | |
| usecase-no-unclosed-description-block | Disallow an accDescr { block that a } written for a later statement closes. |
gitgraph
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| gitgraph-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| gitgraph-no-duplicate-option | Disallow an option that replaces the value of the same option before it in one statement. | ✅ | 💡 | |
| gitgraph-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| gitgraph-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| gitgraph-no-redefined-commit | Disallow a commit with the id of a commit or a merge written before it. | ✅ |
c4
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| c4-no-duplicate-description | Disallow a description statement that replaces a different diagram description. | ✅ | ||
| c4-no-duplicate-style | Disallow a style update that replaces a value that an earlier update gave. | ✅ | ||
| c4-no-duplicate-title | Disallow a title statement that replaces a different title set by another title statement. | ✅ | ||
| c4-no-invalid-attribute-key | Disallow incorrect casing of the color and offset keys in C4 style updates. | ✅ | ||
| c4-no-redefined-element | Disallow a declaration of an element or a boundary that replaces an earlier label, kind, or type. | ✅ | ||
| c4-no-undef | Disallow a style update whose target does not exist when the update is read. | ✅ | ||
| c4-no-useless-argument | Disallow nonempty arguments beyond the parameters that a C4 call reads. | ✅ |
mindmap
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| mindmap-no-duplicate-decoration | Disallow a second icon or a second class line for one node. | ✅ | 💡 | |
| mindmap-no-mismatched-shape | Disallow a shape whose closer does not match its opener. | ✅ | 💡 |
timeline
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| timeline-no-duplicate-description | Disallow an accDescr statement that sets the description again. | ✅ | 💡 | |
| timeline-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | 💡 | |
| timeline-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 |
sankey
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| sankey-no-empty-node | Disallow a source or a target of whitespace only, which makes a node without a name. | ✅ | ||
| sankey-no-invalid-value | Disallow a link value that mermaid.js does not read as written. | ✅ | 🔧 | 💡 |
xychart
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| xychart-no-duplicate-description | Disallow a statement that sets the description of the chart again. | ✅ | ||
| xychart-no-duplicate-title | Disallow a title or accTitle statement that sets its title again. | ✅ | ||
| xychart-no-empty-description-block | Disallow a description block that holds no description. | ✅ | ||
| xychart-no-extra-value | Disallow a value of a plot beyond the categories of the x axis. | ✅ | ||
| xychart-no-invalid-orientation | Disallow an orientation that mermaid.js does not read as horizontal. | ✅ | 🔧 | |
| xychart-no-redefined-axis | Disallow an axis statement that replaces the title or the data of the axis. | ✅ | ||
| xychart-no-unclosed-description-block | Disallow a description block that is not closed by }. | ✅ | 💡 |
block
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| block-no-duplicate-block | Disallow declaring a block again. | ✅ | ||
| block-no-duplicate-columns | Disallow a columns statement that changes the count of its block. | ✅ | 💡 | |
| block-no-edge-chain | Disallow an edge statement with more than one link. | ✅ | 🔧 | |
| block-no-edge-in-composite-head | Disallow a link in the head of a composite block. | ✅ | 💡 | |
| block-no-invalid-direction | Disallow a direction of a block arrow that is not one of the direction words. | ✅ | 🔧 | |
| block-no-mismatched-edge | Disallow an edge with a label whose two arrows do not match. | ✅ | 💡 | |
| block-no-mismatched-shape | Disallow a shape whose closing does not match its opening. | ✅ | 💡 | |
| block-no-redefined-style | Disallow a style statement that loses a style of an earlier one. | ✅ | 💡 | |
| block-no-spaced-class-id | Disallow whitespace around a comma in the ids of a class statement. | ✅ | 🔧 | |
| block-no-undef | Disallow a class statement for an id that no block has. | ✅ | ||
| block-no-useless-width | Disallow a width on the first block of an edge. | ✅ | 💡 |
packet
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| packet-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| packet-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| packet-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 |
kanban
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| kanban-no-duplicate-section | Disallow a repeated section id that lists its items more than once. | ✅ |
architecture
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| architecture-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| architecture-no-duplicate-title | Disallow an accTitle that replaces the title set before it. | ✅ | 💡 | |
| architecture-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| architecture-no-reversed-marker | Disallow an arrowhead of an edge written pointing the other way. | ✅ | 💡 | |
| architecture-no-ungrouped-modifier | Disallow the {group} modifier on an end of an edge that is in no group. | ✅ | 💡 |
radar
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| radar-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| radar-no-duplicate-entry | Disallow an entry of a curve that gives another value for an axis that an earlier entry of the curve has. | ✅ | ||
| radar-no-duplicate-option | Disallow an option that replaces the value of the same option before it. | ✅ | 💡 | |
| radar-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| radar-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| radar-no-mismatched-entry-count | Disallow a curve of values without axes whose count differs from the count of the axes. | ✅ | ||
| radar-no-reversed-range | Disallow a min above the max of a diagram. | ✅ | 💡 | |
| radar-no-unclosed-description-block | Disallow an accDescr { block that a } written for a later statement closes. | |||
| radar-no-undef | Disallow an entry of a curve that names no axis. | ✅ |
eventmodeling
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| eventmodeling-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| eventmodeling-no-duplicate-title | Disallow an accTitle that replaces the accessible title set before it. | ✅ | 💡 | |
| eventmodeling-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| eventmodeling-no-redefined-data | Disallow a data block that no frame can show, because an earlier block has its name. | ✅ | ||
| eventmodeling-no-unclosed-description-block | Disallow an accDescr { block that a } written for a later statement closes. | |||
| eventmodeling-no-undef | Disallow a source or a data reference that names nothing. | ✅ |
treemap
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| treemap-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| treemap-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| treemap-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| treemap-no-invalid-value | Disallow a value of a leaf that mermaid.js reads as another number. | ✅ | 🔧 | 💡 |
venn
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| venn-no-duplicate-style | Disallow a style that replaces an earlier value of the same target. | ✅ | 💡 | |
| venn-no-duplicate-subset | Disallow a set or a union that is declared again. | ✅ | ||
| venn-no-duplicate-title | Disallow a title that replaces a different title. | ✅ | 💡 | |
| venn-no-ignored-text | Disallow a character that the comment after it removes. | ✅ | ||
| venn-no-invalid-style-key | Disallow a style property that the drawing does not read. | ✅ | 🔧 | 💡 |
| venn-no-undef | Disallow a text node or a style for an area that no set or union declares. | ✅ |
wardley
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| wardley-no-duplicate-annotations | Disallow an annotations after the first that gives the box of the annotations another position. | ✅ | 💡 | |
| wardley-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| wardley-no-duplicate-evolution | Disallow an evolution that replaces the stages set before it. | ✅ | 💡 | |
| wardley-no-duplicate-evolve | Disallow an evolve that replaces the target of an earlier evolve of the same node. | ✅ | 💡 | |
| wardley-no-duplicate-pipeline | Disallow a pipeline that replaces the children of an earlier pipeline of the same parent. | ✅ | ||
| wardley-no-duplicate-size | Disallow a size that replaces the size set before it. | ✅ | 💡 | |
| wardley-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| wardley-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| wardley-no-ignored-link-label | Disallow a label after ; that the label in the arrow of the link replaces. | ✅ | 💡 | |
| wardley-no-redefined-node | Disallow a node declared again with other values. | ✅ | ||
| wardley-no-undef | Disallow a link or an evolve that names no node. | ✅ |
cynefin
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| cynefin-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| cynefin-no-duplicate-title | Disallow a title or an accTitle that replaces the title set before it. | ✅ | 💡 | |
| cynefin-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| cynefin-no-redefined-domain | Disallow a domain written again without an item that it had before. | ✅ | 💡 |
treeview
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| treeview-no-duplicate-annotation | Disallow an annotation that replaces an annotation of the same kind on one node. | ✅ | 💡 | |
| treeview-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| treeview-no-duplicate-title | Disallow an accTitle that replaces the accessible title set before it. | ✅ | 💡 | |
| treeview-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| treeview-no-unclosed-description-block | Disallow an accDescr { block that no } closes. | ✅ |
agentflow
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| agentflow-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| agentflow-no-duplicate-direction | Disallow a direction statement that replaces the direction of its flow. | ✅ | 💡 | |
| agentflow-no-duplicate-title | Disallow an accTitle that replaces the title set before it. | ✅ | 💡 | |
| agentflow-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 | |
| agentflow-no-ignored-text | Disallow text that mermaid.js drops from a direction line. | ✅ | ||
| agentflow-no-redefined-connector | Disallow a connector declaration that replaces the title or the vertex written for its id before, or that a later flow does not get. | ✅ | ||
| agentflow-no-redefined-flow | Disallow a flow declaration that replaces the title written for its id before. | ✅ | ||
| agentflow-no-redefined-vertex | Disallow a vertex that replaces the label or the shape written for its id before, or that a later flow does not get. | ✅ | ||
| agentflow-no-spaced-stroke | Disallow whitespace before the : of a stroke style. | 🔧 | ||
| agentflow-no-unclosed-description-block | Disallow an accDescr { block that is not closed by }. | 💡 | ||
| agentflow-no-undef | Disallow a style, class, or click statement for an id that nothing declares. | ✅ |
railroad
| Rule | Description | ✅ | 🔧 | 💡 |
|---|---|---|---|---|
| railroad-no-duplicate-description | Disallow an accDescr that replaces the description set before it. | ✅ | 💡 | |
| railroad-no-duplicate-title | Disallow an accTitle that replaces the title set before it. | ✅ | 💡 | |
| railroad-no-empty-description-block | Disallow an accDescr block that holds no description. | ✅ | 💡 |