require-base-url-slashes
Require Docusaurus baseUrl to use a rooted slash-wrapped path (for example "/docs/").
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects the top-level baseUrl field.
What this rule reportsโ
This rule reports baseUrl values that are not a normalized rooted path with both:
- a leading slash, and
- a trailing slash.
Examples of reported values include:
"docs""docs/""/docs"- whitespace-only strings
Why this rule existsโ
Docusaurus routing and static-asset resolution rely on a consistent baseUrl convention. Requiring a rooted slash-wrapped value avoids path edge cases and keeps URL joins predictable.
โ Incorrectโ
export default {
baseUrl: "docs",
};
export default {
baseUrl: "/docs",
};
โ Correctโ
export default {
baseUrl: "/docs/",
};
export default {
baseUrl: "/",
};
Behavior and migration notesโ
This rule can autofix direct string and no-expression template-literal values.
For identifier-based values, it reports without autofixing to avoid rewriting other declarations implicitly.
When not to use itโ
Do not use this rule if your repository intentionally uses dynamic baseUrl construction that cannot be statically represented as a slash-wrapped path.
Rule catalog ID: R049