csstools / csstools/stylelint-use-nesting

`postcss` is imported but not declared as a dependency

Open Beginner friendly
#38 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
50
Forks
12
Avg merge
20h 49m
Merged PRs (30d)
2

Description

`lib/fix-nesting-at-rule.mjs` imports `postcss`, but the published `package.json` (6.0.2) only declares:

```json
"dependencies": {
"postcss-selector-parser": "^7.1.1"
},
"peerDependencies": {
"stylelint": ">= 16.9.0"
}
```

With pnpm's default isolated `node_modules`, loading the plugin fails with `Cannot find package 'postcss'`.

I assume this has gone unnoticed because `postcss` is already in your lockfile through stylelint (dependabot keeps bumping it there, e.g. #33/#37), and npm users get it through hoisting since stylelint depends on postcss anyway. It only breaks under isolated layouts.

Fix would be declaring `postcss` as a dependency (or a peer next to `stylelint`). In the meantime we're patching it on our side:

```yaml
# pnpm-workspace.yaml
packageExtensions:
stylelint-use-nesting@*:
dependencies:
postcss: ^8.5.15
```

Happy to send a PR if you'd take one.

Contributor guide

Open the contributing guide

Research direction

Start with lib/fix-nesting-at-rule.mjs and the published package.json, checking how the plugin imports postcss and how dependencies are declared. Install the package with pnpm's isolated node_modules and load the plugin; done means it resolves postcss without a package extension or transitive dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.