require-theme-mermaid-when-markdown-mermaid-enabled
Require @docusaurus/theme-mermaid when markdown.mermaid is enabled.
Targeted pattern scopeโ
This rule focuses on docusaurus.config.* files.
It reports config that enables:
markdown.mermaid: true
without also enabling:
@docusaurus/theme-mermaid
What this rule reportsโ
This rule reports Mermaid markdown support that is enabled in config without the corresponding Mermaid theme being configured.
Why this rule existsโ
The Docusaurus Mermaid docs require both pieces together:
- add
@docusaurus/theme-mermaid - set
markdown.mermaidtotrue
Enabling only the markdown flag leaves the site config in a misleading half-configured state.
Mermaid relationship diagramโ
โ Incorrectโ
export default {
markdown: {
mermaid: true,
},
};
โ Correctโ
export default {
themes: ["@docusaurus/theme-mermaid"],
markdown: {
mermaid: true,
},
};
Behavior and migration notesโ
This rule provides a suggestion when it can safely add @docusaurus/theme-mermaid to an existing literal themes array or create a new top-level themes property.
Additional examplesโ
โ Incorrect โ markdown enabled with unrelated themes onlyโ
export default {
themes: ["@easyops-cn/docusaurus-search-local"],
markdown: {
mermaid: true,
},
};
โ Correct โ Mermaid theme appendedโ
export default {
themes: [
"@easyops-cn/docusaurus-search-local",
"@docusaurus/theme-mermaid",
],
markdown: {
mermaid: true,
},
};
ESLint flat config exampleโ
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended];
When not to use itโ
Do not use this rule only if you intentionally stage Mermaid setup across multiple commits and do not want linting to require both sides of the config yet.
Rule catalog ID: R092