validate-theme-config-color-mode-switch-flags
Require static themeConfig.colorMode switch flags to use boolean values.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects boolean color mode flags such as:
disableSwitchrespectPrefersColorScheme
What this rule reportsโ
This rule reports static non-boolean values for those flags, including string forms like "true" and "false".
Why this rule existsโ
Boolean flags are clearer and less error-prone than stringly-typed values in plain JavaScript config.
โ Incorrectโ
export default {
themeConfig: {
colorMode: { disableSwitch: "true" },
},
};
โ Correctโ
export default {
themeConfig: {
colorMode: { disableSwitch: true },
},
};
Behavior and migration notesโ
This rule autofixes direct string booleans to real boolean literals.
For other invalid static values, it reports and provides suggestions to set the flag to true or false.
When not to use itโ
Do not use this rule if your project intentionally injects non-boolean flag values for later transformation.
Rule catalog ID: R079