Note: this is an in-house item already being handled by the maintainer - not open for contribution. Filed for tracking only.
Surfaced while reviewing #1114. That PR resolves PD001/PD002 declarations against the nearest enclosing workspace member, which fixes the false positives @alamb-hex reported in #966. The fix only reaches workspaces that the existing pattern expansion can enumerate, and two common glob shapes are not among them.
What is not matched
expandWorkspacePattern (src/utils/package-json.ts:107) special-cases a whole-segment * only. Measured against the compiled parser:
workspaces pattern |
members found |
["packages/*"] |
["packages/a","packages/b"] |
["packages/*/"] |
["packages/a"] |
["packages/**"] |
none |
["packages/pkg-*"] |
none |
["apps/*","!apps/legacy"] |
["apps/legacy","apps/web"] (negation ignored) |
packages/** and prefix globs like pkg-* are both common in real pnpm and Yarn monorepos. Those projects still get the full set of PD002 false positives the fix was meant to remove.
Notes
Negation being ignored fails in the safe direction: an excluded workspace is still read, so its declarations still count and no false positive is produced. Worth handling for correctness but not urgent.
This is shared code. resolveWorkspacePackageJsonPaths and readWorkspacePatterns feed workspace resolution generally, not just the PD rules, so the same gap affects anything else relying on member enumeration.
Pre-existing and not introduced by #1114. Filed separately so it does not sit on that PR.
Surfaced while reviewing #1114. That PR resolves PD001/PD002 declarations against the nearest enclosing workspace member, which fixes the false positives @alamb-hex reported in #966. The fix only reaches workspaces that the existing pattern expansion can enumerate, and two common glob shapes are not among them.
What is not matched
expandWorkspacePattern(src/utils/package-json.ts:107) special-cases a whole-segment*only. Measured against the compiled parser:workspacespattern["packages/*"]["packages/a","packages/b"]["packages/*/"]["packages/a"]["packages/**"]["packages/pkg-*"]["apps/*","!apps/legacy"]["apps/legacy","apps/web"](negation ignored)packages/**and prefix globs likepkg-*are both common in real pnpm and Yarn monorepos. Those projects still get the full set of PD002 false positives the fix was meant to remove.Notes
Negation being ignored fails in the safe direction: an excluded workspace is still read, so its declarations still count and no false positive is produced. Worth handling for correctness but not urgent.
This is shared code.
resolveWorkspacePackageJsonPathsandreadWorkspacePatternsfeed workspace resolution generally, not just the PD rules, so the same gap affects anything else relying on member enumeration.Pre-existing and not introduced by #1114. Filed separately so it does not sit on that PR.