Add `postcss` to the properties that are exposed to plugins
Author: romainmenkeCreated Sep 3, 2026Updated Sep 7, 2026
Labelsstatus: needs discussion
What is the problem you're trying to solve?
See: https://github.com/csstools/stylelint-use-nesting/issues/38
- package managers like
pnpmisolate dependencies. postcssis quite sensitive to multiple versions of itself running and will slow down considerably if AST manipulations cross version boundaries
Unfortunately there is no way to communicate to node and package managers that a plugin wants to import the exact postcss module that is already imported by Stylelint.
So any time there is a version mismatch or a user has a package manager with stricter dependency isolation users will run into issues.
What solution would you like to see?
Mirror the PostCSS API for plugins.
This also exposes postcss through the helpers argument: https://github.com/postcss/postcss/blob/6d23bc362203118478bc8051b81f2910907ebe6e/lib/postcss.d.ts#L193
return {
postcssPlugin: 'postcss-foo',
Once(root, helpers): void {
helpers.postcss.rule({ selector: 'foo' });This allows plugin authors for Stylelint to use postcss to construct new AST nodes without having to directly import postcss themselves.
Source: stylelint/stylelint