Skip to content

Remove unused devtool dependencies; fix undeclared phantom deps - #761

Merged
dwertheimer merged 2 commits into
mainfrom
security/remove-unused-devtool-deps
Jul 30, 2026
Merged

Remove unused devtool dependencies; fix undeclared phantom deps#761
dwertheimer merged 2 commits into
mainfrom
security/remove-unused-devtool-deps

Conversation

@dwertheimer

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #759. Audited all 115 top-level dependencies for real usage across our own code, npm scripts, and tool config (ESLint plugin/extends shorthand, PostCSS plugin wiring, Jest environment shorthand, peer-dep requirements) and removed everything confirmed dead.

Removed

PostCSS familyautoprefixer, postcss, postcss-calc, postcss-color-function, postcss-custom-properties, postcss-preset-env. None of these are passed into the actual PostCSS pipeline in scripts/rollup.generic.js, which only wires up rollup-plugin-postcss + postcss-prefix-selector directly. A "devDependencies_to_remove" key already sitting in package.json had flagged 4 of these as known-dead but the removal was never finished — completed that here and dropped the placeholder key.

rollup-plugin-styles — zero usage anywhere, and it's the actual package causing the ERESOLVE peer conflict that's forced --legacy-peer-deps on every install. Plain npm install now succeeds with no flag needed.

rollup-plugin-terser — superseded by @rollup/plugin-terser, which is what scripts/rollup.js actually imports.

eslint-plugin-prettier — commented out in .eslintrc since Jan 2025 ("Remove prettier/prettier rule in eslint") after running Prettier through ESLint produced too much formatting noise. Formatting is handled separately by the standalone prettier CLI via npm run format/fix; eslint-config-prettier (disables ESLint's conflicting stylistic rules) stays — only the ESLint-integration package goes.

react-circular-progressbar, vinyl, vinyl-fs, node-domexception — no references anywhere. node-domexception isn't even a transitive dependency of anything else in the tree.

jest-config, jest-resolve, @jest/test-sequencer — Jest's own internal packages, already pulled in transitively by @jest/core at the identical pinned version (^29.7.0). No custom resolver/sequencer config references them.

testing-library (bare, 0.0.2) — not the real Testing Library org package. Looks like a typo from the same commit that added the real @testing-library/* packages.

babel (bare, ^6.23.0) — ancient deprecated Babel 6 meta-package. The project fully uses scoped @babel/* v7 packages now.

babel-plugin-syntax-hermes-parser — zero parents in the dependency tree, not referenced by babel.config.js or @babel/preset-flow. flow check doesn't invoke Babel plugins at all, so this has zero effect on typechecking regardless of whether it's installed — verified via an identical 8059-error count before/after removal (compared with git stash).

Also fixed: 3 undeclared phantom dependencies

Found during the audit — chalk, @codedungeon/messenger, and lodash.debounce are require()'d directly in scripts/rollup.js / scripts/rollup.generic.js but were never declared in package.json. They only worked because something else in the tree happened to install them transitively; pinned to their currently-resolved versions so an unrelated dependency bump can't silently break the build scripts.

Verification

  • Plain npm install succeeds with no ERESOLVE error (previously required --legacy-peer-deps)
  • Full test suite passes: 198 suites, 4553 tests (npm test)
  • flow check error count unchanged: 8059 before and after (confirmed via git stash comparison)
  • eslint . output unchanged: pre-existing 207069 problems, confirmed identical via git stash comparison (unrelated repo-wide lint debt, not introduced by this change)
  • Built a plain plugin end-to-end via the real npc CLI (np.Templating)
  • Built a React-webview plugin end-to-end (jgclark.Dashboard), exercising the postcss/rollup-plugin-postcss path specifically
  • node index.js --help (CLI smoke test) still works

🤖 Generated with Claude Code

dwertheimer and others added 2 commits July 30, 2026 09:29
Audited all 115 top-level dependencies for real usage across our own
code, npm scripts, and tool config (eslint plugin/extends shorthand,
postcss plugin wiring, jest environment shorthand, peer-dep
requirements). Removed everything confirmed dead:

- autoprefixer, postcss, postcss-calc, postcss-color-function,
  postcss-custom-properties, postcss-preset-env - never passed into
  the actual PostCSS pipeline in scripts/rollup.generic.js, which only
  wires up rollup-plugin-postcss + postcss-prefix-selector directly.
  (A "devDependencies_to_remove" key already flagged 4 of these as
  known-dead but never finished the removal - completing that here
  and dropping the placeholder key.)
- rollup-plugin-styles - zero usage, and the actual package causing
  the ERESOLVE peer conflict that forced --legacy-peer-deps on every
  install. Plain `npm install` now succeeds without that flag.
- rollup-plugin-terser - superseded by @rollup/plugin-terser, which is
  what scripts/rollup.js actually imports.
- eslint-plugin-prettier - commented out in .eslintrc since Jan 2025
  ("Remove prettier/prettier rule in eslint") after running Prettier
  through ESLint produced too much formatting noise. Formatting is
  handled by the standalone `prettier` CLI via `npm run format`/`fix`;
  eslint-config-prettier (which just disables conflicting ESLint
  stylistic rules) stays, only the ESLint-integration package goes.
- react-circular-progressbar, vinyl, vinyl-fs, node-domexception - no
  references anywhere; node-domexception isn't even a transitive
  dependency of anything else in the tree.
- jest-config, jest-resolve, @jest/test-sequencer - Jest's own
  internal packages, already pulled in transitively by @jest/core at
  the identical pinned version; no custom resolver/sequencer config
  references them.
- testing-library (bare, 0.0.2) - not the real Testing Library org
  package, looks like a typo from the same commit that added the real
  @testing-library/* packages.
- babel (bare, ^6.23.0) - ancient deprecated Babel 6 meta-package;
  the project fully uses scoped @babel/* v7 packages now.
- babel-plugin-syntax-hermes-parser - zero parents in the tree, not
  referenced by babel.config.js or @babel/preset-flow. `flow check`
  doesn't invoke Babel plugins at all, so this has zero effect on
  typechecking regardless (verified: identical 8059-error count
  before/after removal).

Also declared three phantom dependencies found during the audit -
chalk, @codedungeon/messenger, and lodash.debounce are require()'d
directly in scripts/rollup.js and scripts/rollup.generic.js but were
never in package.json. They only worked because something else
happened to install them transitively; pinned to their currently
resolved versions so they don't silently break on an unrelated bump.

Verified: plain `npm install` succeeds with no ERESOLVE (previously
needed --legacy-peer-deps); full test suite passes (198 suites, 4553
tests); flow check error count unchanged (8059, confirmed via stash
comparison); eslint runs clean (pre-existing 207069 problems, also
confirmed identical via stash comparison, unrelated to this change);
built both a plain plugin (np.Templating) and a React-webview plugin
(jgclark.Dashboard, exercising the postcss/rollup-plugin-postcss path)
end-to-end via the real npc CLI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
That flag existed to work around the ERESOLVE conflict between
rollup-plugin-styles's peer range (rollup ^2.63.0) and our actual
rollup version (^4.28.0). With rollup-plugin-styles removed, plain
npm ci/npm install resolve cleanly on their own - verified via a
fresh npm ci in this branch (no errors, same 2019 packages installed,
full test suite and a real plugin build still pass).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dwertheimer
dwertheimer merged commit d4f1389 into main Jul 30, 2026
4 checks passed
@dwertheimer
dwertheimer deleted the security/remove-unused-devtool-deps branch July 30, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant