Reference¶
Lookup pages: what each rule, flag, config key and type is, with no tutorial on the way. Each page links to the guide that shows it in use.
| Page | What it lists |
|---|---|
| Rules | Every built-in rule, with its examples drawn before and after --fix |
| Command line | Every flag, the exit codes, the error codes and the output formats |
| Config file | The config keys, rule settings and rule options |
| Document model | The parsed file every rule reads: diagrams, style directives and stats |
| Plugin API | The plugin contract, findings, edits and the testing helpers |
| Library API | Every export of the package, for use from code |
| Changelog | What changed in each release, and what is not yet released |
Rules at a glance¶
| Rule | Category | Autofix | Reports |
|---|---|---|---|
parse-diagram-unparseable |
parse | no | A diagram mermaid's parser rejects |
parse-fence-unterminated |
parse | yes | A mermaid fence that is never closed |
complexity-node-count-hard-limit |
complexity | no | More nodes than the preset's hard limit |
complexity-node-count-cognitive-limit |
complexity | no | More nodes than a reader can follow, above the cognitive limit |
complexity-node-count-acceptable-exceeded |
complexity | no | More nodes than the preset's readable threshold |
complexity-visual-score-critical |
complexity | no | A visual complexity score above the preset's complex threshold |
complexity-visual-score-acceptable-exceeded |
complexity | no | A visual complexity score above the preset's readable threshold |
complexity-subgraph-nesting-too-deep |
complexity | no | Subgraphs nested three or more levels deep |
contrast-text-below-aa |
contrast | yes | Label text below 4.5:1 against its fill |
contrast-border-below-ui-minimum |
contrast | no | A border below 3:1 against its fill |
contrast-directive-unauditable |
contrast | no | A style directive whose contrast cannot be audited |
Requirements and compatibility¶
| Need | What is supported |
|---|---|
| Runtime | Bun, or Node >=20, the engines field of package.json |
| Mermaid | The mermaid package pinned at 11.17.2, because sequence diagram colours change between releases, and @mermaid-js/parser, both installed with this package |
| TypeScript local rules | Bun, through bunx --bun @jpeakai/mermaidjs-lint, or Node 22.18 or newer (23.6 or newer on Node 23) |
npm ls mermaid in your project prints the mermaid version a run uses.
A host such as GitHub draws diagrams with its own mermaid version.
A diagram type newer than the host's mermaid may parse here and still fail to draw there.
Each diagram type is read by one of two parsers, and the parser_used field of its stats says which:
| Parser | Diagram types |
|---|---|
Langium, from @mermaid-js/parser |
architecture, info, pie, gitGraph, packet, radar, treemap, treeView and wardley |
| Mermaid core, under a DOM shim | Every other type mermaid registers, such as flowchart, sequenceDiagram, classDiagram, stateDiagram and erDiagram |
The types are named as mermaid's own detection names them.
Mermaid detects some only by their -beta keyword, such as radar-beta, treeView-beta and wardley-beta.
A Langium type that its grammar rejects is tried again under mermaid core before it is reported.
Versioning¶
The package follows semantic versioning.
While it is at 0.x, a minor release may break the public surface, and a patch release does not.
The public surface is:
- The rule ids, and the category each rule belongs to.
- The
--jsonoutput shape. - The exit codes and error codes.
- The plugin contract, versioned by
meta.apiVersion. A contract change that breaks a plugin raises it, and a plugin built for the old version fails to load with both numbers. - The types and functions the package exports.
Finding message text is not part of it, so match on the rule id, not the message.
Changelog¶
CHANGELOG.md lists the user-visible changes in each release.
These pages are published with each release, so they describe the latest release on npm.
A change on main that is not yet released is listed under Unreleased in the changelog. mermaidjs-lint --version prints the version you run, and releases up to 0.1.1 lack the flag.