English
@mmd-toolkit/usecase-no-duplicate-metadata
Disallow a metadata value that replaces the value of the same key set before it.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
Metadata updates such as User@{ type: hollow } set properties of actors, use cases, system boundaries, or relationships. When another update gives the same key a different value for the same element, mermaid.js uses it without an error and loses the earlier value.
Rule Details
This rule applies to use case diagrams (usecase-beta). It reports a type, business, icon, or animation property that replaces a different nonempty value from an earlier update of the same element. Updates are compared in source order, including repeated keys in one update and updates before a declaration. New keys, repeated values, and values after an empty value are not reported.
Ids and values are compared without surrounding quotes. Names that mermaid.js turns into one id are still separate here: "Place order" and Place_order are not compared. Values are otherwise compared as written, so character references and HTML attribute quotes can differ for this rule although mermaid.js reads them alike.
Metadata in systemBoundary headings is compared in source order: a heading can replace an earlier heading or update and be reported. An update after a heading is not reported, because the documentation of mermaid.js gives it as the way to change the metadata of a heading.
Metadata written in an actor or use case declaration, as actor A@{ type: hollow }, is not compared: the documentation of mermaid.js changes it with an update, written anywhere, and mermaid.js gives an error for two declarations with different metadata. animate is not compared because animate: false does not stop animation after animation: slow.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/usecase-no-duplicate-metadata: error
usecase-beta
actor User
User@{ type: hollow }
User@{ type: awesome }Examples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/usecase-no-duplicate-metadata: error
usecase-beta
actor User
User@{ type: hollow }Options
This rule has no options.
Further Reading
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.