English
@mmd-toolkit/block-no-duplicate-columns
Disallow a columns statement that changes the count of its block.
✅ The recommended configuration enables this rule.
💡 This rule is manually fixable by editor suggestions.
columns sets the number of columns of the diagram or a composite block. mermaid.js accepts another columns without an error and uses the last count for the whole block, including blocks written before it. An earlier count does not keep its part of the diagram in that layout.
Rule Details
This rule applies to block diagrams (block-beta and block). It reports a columns statement that changes the count set by the previous columns of the same block. The diagram and each composite block have separate counts; after end, statements belong to the enclosing block again.
Counts are compared as numbers, so columns 02 after columns 2 is not reported. auto differs from every number, including 0. After columns 2 and columns 3, another columns 2 is reported because it replaces 3.
Examples of incorrect code for this rule:
mmd
%% eslint @mmd-toolkit/block-no-duplicate-columns: error
block
columns 2
A B
columns 3
CExamples of correct code for this rule:
mmd
%% eslint @mmd-toolkit/block-no-duplicate-columns: error
block
columns 2
block: G
columns 3
A
end
BOptions
This rule has no options.
Related Rules
Version
This rule was introduced in @mmd-toolkit/eslint-plugin v0.1.0.