validate-theme-config-color-mode-default-mode
Require themeConfig.colorMode.defaultMode to be present and to use canonical "light" or "dark" values when colorMode config is authored statically.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects themeConfig.colorMode.defaultMode.
What this rule reportsโ
This rule reports when defaultMode is:
- missing from a statically authored
colorModeobject, - a statically invalid value, or
- a valid value with non-canonical casing/whitespace.
Why this rule existsโ
Color mode defaults affect first-load UX and should be explicit and predictable in authored config.
โ Incorrectโ
export default {
themeConfig: {
colorMode: {},
},
};
export default {
themeConfig: {
colorMode: { defaultMode: "Dark" },
},
};
โ Correctโ
export default {
themeConfig: {
colorMode: { defaultMode: "dark" },
},
};
Behavior and migration notesโ
This rule autofixes valid-but-noncanonical static string values such as "Dark" to "dark".
When defaultMode is missing or statically invalid, it reports and provides suggestions to set it to "light" or "dark".
When not to use itโ
Do not use this rule if your project intentionally leaves defaultMode implicit or resolves it outside static config.
Rule catalog ID: R078