require-theme-classic-custom-css-files-exist
Require statically configured Docusaurus classic-theme customCss paths to exist.
Targeted pattern scopeโ
This rule focuses on docusaurus.config.* files.
It validates statically known classic-theme customCss entries from:
- classic preset
theme.customCss - direct
@docusaurus/theme-classicoptions
What this rule reportsโ
This rule reports customCss entries when the configured stylesheet path resolves to a file that does not exist.
Why this rule existsโ
customCss is meant to load real theme stylesheets.
A missing file path leaves the classic theme config looking complete while pointing at a stylesheet that cannot actually be loaded.
โ Incorrectโ
export default {
presets: [[
"@docusaurus/preset-classic",
{
theme: { customCss: "./src/css/missing.css" },
},
]],
};
โ Correctโ
export default {
presets: [[
"@docusaurus/preset-classic",
{
theme: { customCss: "./src/css/custom.css" },
},
]],
};
Behavior and migration notesโ
This rule is report-only.
It does not try to invent replacement stylesheet paths or remove missing entries automatically.
Additional examplesโ
โ Incorrect โ one missing entry inside a customCss arrayโ
export default {
themes: [[
"@docusaurus/theme-classic",
{
customCss: [
require.resolve("./src/css/custom.css"),
"./src/css/missing.css",
],
},
]],
};
โ Correct โ only existing stylesheet pathsโ
export default {
themes: [[
"@docusaurus/theme-classic",
{
customCss: [require.resolve("./src/css/custom.css")],
},
]],
};
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 if your project intentionally keeps unresolved placeholder stylesheet paths in config and you do not want linting to report them yet.
Rule catalog ID: R098