Skip to main content

require-theme-config-color-mode-object

Require themeConfig.colorMode to be explicitly configured when theme color mode behavior is part of the authored site contract.

Targeted pattern scopeโ€‹

This rule targets docusaurus.config.* files and inspects themeConfig.colorMode.

What this rule reportsโ€‹

This rule reports when themeConfig is present but does not define a colorMode object.

Why this rule existsโ€‹

Color mode behavior affects first-load UX, switching behavior, and user preference handling. Requiring explicit configuration makes that behavior visible in review.

โŒ Incorrectโ€‹

export default {
themeConfig: {},
};

โœ… Correctโ€‹

export default {
themeConfig: {
colorMode: { defaultMode: "dark" },
},
};

Behavior and migration notesโ€‹

This rule reports and provides suggestions to insert a minimal colorMode object with either defaultMode: "light" or defaultMode: "dark".

When not to use itโ€‹

Do not use this rule if your project intentionally leaves color-mode behavior implicit.

Rule catalog ID: R082

Further readingโ€‹