Skip to content

@mmd-toolkit/er-no-duplicate-title ​

Disallow an accTitle statement that sets the title again.

✅ The recommended configuration enables this rule.

💡 This rule is manually fixable by editor suggestions.

A diagram has one accessible title. When another accTitle statement sets it, mermaid.js uses the later title without an error, and the earlier one is lost.

Rule Details ​

This rule applies to entity relationship diagrams (erDiagram). It reports an accTitle statement that replaces the current title with a different one. A statement that repeats the current title is not reported. Titles are compared without the whitespace at their ends.

An accTitle: with no text on its line also sets the title and is counted: it takes the next line that holds text, past empty lines, comment lines, and directives. At the end of the text, mermaid.js gives an error. A statement inside a subgraph sets the title of the whole diagram and is counted too.

After accTitle: a and accTitle: b, a third accTitle: a is reported because it replaces b.

Examples of incorrect code for this rule:

mmd
%% eslint @mmd-toolkit/er-no-duplicate-title: error
erDiagram
  accTitle: first
  
accTitle: second
A

Examples of correct code for this rule:

mmd
%% eslint @mmd-toolkit/er-no-duplicate-title: error
erDiagram
  accTitle: first
  accDescr: second
  A
mmd
%% eslint @mmd-toolkit/er-no-duplicate-title: error
erDiagram
  accTitle: first
  accTitle: first
  A

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.