eslint-plugin-docusaurus-2
v2.0.4
Published
ESLint plugin for Docusaurus sites, docs repositories, and TypeDoc-integrated documentation workflows.
Maintainers
Readme
eslint-plugin-docusaurus-2
eslint-plugin-docusaurus-2 is an ESLint plugin for Docusaurus sites, docs repositories, and TypeDoc-integrated documentation workflows.
It ships focused Docusaurus-specific rules and Flat Config presets for teams that want stricter guarantees around:
docusaurus.config.*- theme config (
navbar,footer,metadata,colorMode, announcement bars) - classic-theme global stylesheet configuration
- search integrations (Algolia DocSearch and @easyops-cn/docusaurus-search-local)
- package ownership checks for configured themes and search providers
- analytics migrations and modern telemetry config
- sidebars and docs navigation
- pages, routing, and asset usage
- plugin-pwa and docs-site integration details
- JSX translation, framework link/heading usage, Markdown/MDX hygiene, and Docusaurus 3.10 strict-MDX migration
- and more to come!
Table of contents
- Installation
- Compatibility
- Quick start
- Presets
- Additional opt-in configs
- Parser setup behavior
- Plugin settings
- Rules
- Documentation
- Roadmap direction
- Contributing
- License
- Contributors ✨
Installation
npm install --save-dev eslint-plugin-docusaurus-2 typescripteslint-plugin-docusaurus-2 is published for broad public use. Install it into a workspace that already owns its ESLint and TypeScript toolchain.
Compatibility
- ESLint:
9.xand10.x - Config system: Flat Config only
- Node.js:
>=22 - TypeScript:
>=5.9
Quick start
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended];That is enough for the plugin to provide:
- the
docusaurus-2plugin namespace - parser wiring through
@typescript-eslint/parser - a stable Flat Config preset surface
Presets
This plugin currently exports six public presets:
| Preset | Purpose |
| ----------------------------------------------------------------------------- | --------------------------------------------- |
| 🟢 docusaurus2.configs.minimal | Smallest future-ready baseline. |
| 🔵 docusaurus2.configs.config | Focused config/theme/plugin rule set. |
| 🟡 docusaurus2.configs.recommended | Default starting point for most repositories. |
| 🔴 docusaurus2.configs.strict | Stricter future tier for mature sites. |
| 🟣 docusaurus2.configs.all | Every stable rule once the catalog grows. |
| 🧪 docusaurus2.configs.experimental | Future experimental rule candidates. |
It also exports three opt-in configs that are intentionally kept outside the preset ladder:
| Config | Scope | Purpose |
| ---------------------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------- |
| 📝 docusaurus2.configs.content | *.md/*.mdx | Enable text/content-aware docs rules without touching JS/TS presets. |
| 🌐 docusaurus2.configs.i18n | JS/TS/JSX/TSX | Enable both Docusaurus translation rules. |
| 🧭 docusaurus2.configs["strict-mdx-upgrade"] | *.mdx | Enable the Docusaurus 3.10 strict-MDX syntax migration rules only. |
Additional opt-in configs
These are not part of the six preset tiers above.
Use them when you want focused translation or docs-content linting in addition to the normal JS/TS config presets.
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended, docusaurus2.configs.content];Enable both translation rules without adopting the full strict preset:
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended, docusaurus2.configs.i18n];If you only want the Docusaurus 3.10 strict-MDX migration rules, use the narrower config instead:
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs["strict-mdx-upgrade"]];Parser setup behavior
Every preset already includes:
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"]@typescript-eslint/parserecmaVersion: "latest"sourceType: "module"- plugin registration under
"docusaurus-2"
These opt-in content configs use the plugin's text-content parser instead of @typescript-eslint/parser:
docusaurus2.configs.contentdocusaurus2.configs["strict-mdx-upgrade"]
The i18n config uses the normal TypeScript parser because it inspects JSX translation components and calls.
Plugin settings
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [
{
...docusaurus2.configs.recommended,
settings: {
"docusaurus-2": {
// Suppress plugin autofixes globally while preserving reports.
// disableAllAutofixes: true,
},
},
},
];When settings["docusaurus-2"].disableAllAutofixes is true, rules still report diagnostics and suggestions, but direct autofixes are suppressed.
For stronger TypeDoc-specific linting around API doc authoring and TypeDoc conventions, pair this plugin with eslint-plugin-typedoc.
Rules
The current rule catalog focuses on Docusaurus config, validation, sidebar, and site-source CSS correctness.
The public preset surface is stable, and the rule catalog is intentionally focused while higher-value Docusaurus rule gaps are explored.
Fixlegend:🔧= autofixable💡= suggestions available—= report only
- Rules shown with no preset membership are rendered in the opt-in rules table below.
Preset keylegend:
| Rule | Fix | Preset key |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| no-conflicting-config-link-content-props | — | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-config-link-props | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-footer-html-item-props | — | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-navbar-doc-item-props | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-navbar-doc-sidebar-item-props | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-search-providers | — | 🔵 🟡 🔴 🟣 🧪 |
| no-conflicting-theme-config-color-mode-flags | 🔧 | 🔵 🔴 🟣 🧪 |
| no-conflicting-theme-config-metadata-keys | 💡 | 🔵 🔴 🟣 🧪 |
| no-deprecated-future-experimental-faster | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-deprecated-future-experimental-storage | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-deprecated-google-analytics | 💡 | 🔵 🟡 🔴 🟣 🧪 |
| no-deprecated-on-broken-markdown-links | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-duplicate-footer-column-titles | — | 🔵 🔴 🟣 🧪 |
| no-duplicate-footer-link-item-destinations | 💡 | 🔵 🔴 🟣 🧪 |
| no-duplicate-footer-link-item-labels | — | 🔵 🔴 🟣 🧪 |
| no-duplicate-head-tags | 🔧 | 🔵 🔴 🟣 🧪 |
| no-duplicate-i18n-locales | 🔧 💡 | 🔵 🔴 🟣 🧪 |
| no-duplicate-navbar-item-destinations | 💡 | 🔵 🔴 🟣 🧪 |
| no-duplicate-navbar-item-labels | — | 🔵 🔴 🟣 🧪 |
| no-duplicate-plugin-pwa-head-tags | 🔧 | 🔵 🔴 🟣 🧪 |
| no-duplicate-sidebar-doc-ids | 💡 | 🔴 🟣 🧪 |
| no-duplicate-theme-classic-custom-css | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-duplicate-theme-config-metadata-keys | 🔧 | 🔵 🔴 🟣 🧪 |
| no-empty-config-link-destinations | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-empty-config-link-labels | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-empty-footer-link-columns | 🔧 | 🔵 🔴 🟣 🧪 |
| no-empty-footer-link-items | 🔧 | 🔵 🔴 🟣 🧪 |
| no-empty-head-tags | 🔧 | 🔵 🔴 🟣 🧪 |
| no-empty-navbar-dropdown-items | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-empty-navbar-item-objects | 🔧 | 🔵 🔴 🟣 🧪 |
| no-empty-sidebar-categories | 🔧 | 🟡 🔴 🟣 🧪 |
| no-empty-theme-classic-custom-css | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-empty-theme-config-metadata | 🔧 | 🔵 🔴 🟣 🧪 |
| no-html-links | 💡 | 🟡 🔴 🟣 🧪 |
| no-ignored-site-validations | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| no-mixed-sidebar-link-kinds | 💡 | 🔴 🟣 🧪 |
| no-page-css-module-imports-in-components | — | 🔴 🟣 🧪 |
| no-redundant-social-card-metadata | 🔧 | 🔵 🔴 🟣 🧪 |
| no-search-link-without-search-provider | — | 🔵 🟡 🔴 🟣 🧪 |
| no-search-page-link-when-search-page-disabled | — | 🔵 🟡 🔴 🟣 🧪 |
| no-search-page-path-conflict | — | 🔵 🟡 🔴 🟣 🧪 |
| no-svg-social-card-image | — | 🔵 🟡 🔴 🟣 🧪 |
| no-unknown-i18n-locale-configs | — | 🔵 🟡 🔴 🟣 🧪 |
| no-untranslated-text | — | 🔴 🟣 🧪 |
| no-use-base-url-for-internal-link-components | 🔧 | 🟡 🔴 🟣 🧪 |
| no-useless-collapsed-sidebar-categories | 🔧 | 🟡 🔴 🟣 🧪 |
| prefer-config-satisfies | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| prefer-css-modules-in-site-src | — | 🔴 🟣 🧪 |
| prefer-docusaurus-heading | 💡 | 🟡 🔴 🟣 🧪 |
| prefer-head-tag-attributes-object | 🔧 | 🔵 🔴 🟣 🧪 |
| prefer-href-for-external-link-components | 🔧 | 🟡 🔴 🟣 🧪 |
| prefer-href-for-external-links | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| prefer-i18n-default-locale-first | 🔧 💡 | 🔵 🔴 🟣 🧪 |
| prefer-sidebars-config-satisfies | 🔧 | 🟡 🔴 🟣 🧪 |
| prefer-theme-config-docsearch | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| prefer-theme-config-metadata-name-for-twitter-tags | 🔧 | 🔵 🔴 🟣 🧪 |
| prefer-theme-config-metadata-property-for-og-tags | 🔧 | 🔵 🔴 🟣 🧪 |
| prefer-to-for-internal-link-components | 🔧 | 🟡 🔴 🟣 🧪 |
| prefer-to-for-internal-links | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| prefer-use-base-url-for-static-assets | 💡 | 🔴 🟣 🧪 |
| require-balanced-footer-link-columns | — | 🧪 |
| require-base-url-issue-banner-enabled | 🔧 | 🔵 🔴 🟣 🧪 |
| require-base-url-slashes | 🔧 | 🔵 🔴 🟣 🧪 |
| require-config-link-content | — | 🔵 🟡 🔴 🟣 🧪 |
| require-config-link-destination | — | 🔵 🟡 🔴 🟣 🧪 |
| require-default-export-pages | — | 🔴 🟣 🧪 |
| require-doc-sidebar-link-type | 🔧 | 🟡 🔴 🟣 🧪 |
| require-docsearch-ask-ai-assistant-id | — | 🔵 🟡 🔴 🟣 🧪 |
| require-docsearch-theme-when-configured | — | 🔵 🟡 🔴 🟣 🧪 |
| require-docusaurus-faster-package-installed | — | 🔵 🟡 🔴 🟣 🧪 |
| require-footer-link-column-items | — | 🔵 🟡 🔴 🟣 🧪 |
| require-footer-link-column-title | — | 🔵 🟡 🔴 🟣 🧪 |
| require-generated-index-link-type | 🔧 | 🟡 🔴 🟣 🧪 |
| require-head-tag-attributes-when-no-inner-html | — | 🔵 🔴 🟣 🧪 |
| require-head-tag-content-or-attributes | — | 🔵 🔴 🟣 🧪 |
| require-head-tag-tag-name | 💡 | 🔵 🔴 🟣 🧪 |
| require-i18n-default-locale-in-locales | 🔧 💡 | 🔵 🔴 🟣 🧪 |
| require-markdown-format-detect | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| require-markdown-mermaid-when-theme-mermaid-enabled | 🔧 | 🔵 🟡 🔴 🟣 🧪 |
| require-navbar-doc-item-doc-id | — | 🔵 🟡 🔴 🟣 🧪 |
| require-navbar-doc-sidebar-item-sidebar-id | — | 🔵 🟡 🔴 🟣 🧪 |
| require-navbar-docs-version-item-to | — | [🔵](https://nick2bad4u.github.io/eslint-plugin-docusaurus-2
