Skip to main content

no-broad-all-resets-outside-isolation-subtrees

Disallow broad all: initial, all: revert, and all: unset resets outside explicitly isolated local subtrees.

Targeted pattern scopeโ€‹

This rule looks for declarations on the all property whose value contains one of these broad reset keywords:

  • initial
  • revert
  • unset

It then checks whether the selector is anchored by a local wrapper class, local id, or dedicated non-root data attribute.

What this rule reportsโ€‹

This rule reports broad all resets on selectors like h1 or .theme-doc-markdown that are not isolated behind a local subtree wrapper.

Why this rule existsโ€‹

all resets are blunt tools.

On broad Docusaurus selectors they can wipe out far more of the framework styling contract than the author intended, including typography, spacing, and component defaults outside the immediate customization target.

Local isolation wrappers make that reset boundary obvious and much easier to review.

โŒ Incorrectโ€‹

.theme-doc-markdown {
all: revert;
}
h1 {
all: unset;
}

โœ… Correctโ€‹

.sandbox {
all: revert;
}

Behavior and migration notesโ€‹

  • This rule accepts local wrapper classes, local ids, and dedicated data attributes as explicit isolation anchors.
  • Stable global Docusaurus wrappers do not count as isolation anchors here.
  • It only checks all: initial, all: revert, and all: unset.
  • It intentionally does not overlap with no-revert-layer-outside-isolation-subtrees, which handles revert-layer separately.
  • It is report-only because deciding where to introduce a local isolation wrapper is architectural work.

Additional examplesโ€‹

โœ… Correct โ€” dedicated data attribute isolationโ€‹

[data-docusaurus-layer-isolation] {
all: unset;
}

โŒ Incorrect โ€” broad global heading resetโ€‹

h1 {
all: initial;
}

Stylelint config exampleโ€‹

import { docusaurusPluginConfigs } from "stylelint-plugin-docusaurus";

export default {
...docusaurusPluginConfigs["docusaurus-all"],
rules: {
...docusaurusPluginConfigs["docusaurus-all"].rules,
"docusaurus/no-broad-all-resets-outside-isolation-subtrees": true,
},
};

When not to use itโ€‹

Disable this rule if your project intentionally applies broad all resets to site-wide Docusaurus wrappers and you accept the resulting reset scope.

Package documentationโ€‹

Docusaurus package documentation:

Rule catalog ID: R025

Further readingโ€‹