English
@mmd-toolkit/venn-no-duplicate-style
Disallow a style that replaces an earlier value of the same target.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
mermaid.js merges style statements for the same target and keeps the last value of each property. A later value replaces an earlier one without an error, whether both appear in one statement or separate statements.
Rule Details
This rule applies to Venn diagrams (venn-beta). It reports a fill, color, stroke, stroke-width, or fill-opacity property that changes the same target's latest value, within or across statements. New properties and repeated values are not reported. Other properties are checked by venn-no-invalid-style-key.
Targets are compared by their lists of names without regard to order, so style B, A and style A, B have the same target. Values are compared as written without surrounding quotes; spaces inside quotes count. Unquoted 2px and 2 px differ for this rule even though mermaid.js joins their parts into the same value.
mermaid.js converts character references and HTML attribute quotes in names and values. These conversions can make its matching differ from this rule's comparisons.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/venn-no-duplicate-style: error
venn-beta
set A
style A fill: red, fill: bluemmd
%% eslint @mmd-toolkit/venn-no-duplicate-style: error
venn-beta
set A
style A fill: red, stroke: black
style A fill: blueExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/venn-no-duplicate-style: error
venn-beta
set A
style A fill: red, stroke: black
style A color: whiteOptions
This rule has no options.
Related Rules
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.