fix: avoid using outdated @types/eslint-scope#20869
Conversation
`@types/eslint-scope`
🦋 Changeset detectedLatest commit: 44a5213 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (07d7024). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@07d7024
yarn add -D webpack@https://pkg.pr.new/webpack@07d7024
pnpm add -D webpack@https://pkg.pr.new/webpack@07d7024 |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes. Additional details and impacted files@@ Coverage Diff @@
## main #20869 +/- ##
==========================================
- Coverage 80.69% 80.63% -0.07%
==========================================
Files 528 526 -2
Lines 53747 53692 -55
Branches 14189 14175 -14
==========================================
- Hits 43372 43294 -78
- Misses 10375 10398 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the published-type dependency on @types/eslint-scope by inlining the needed eslint-scope typings into webpack’s own type surface, and updates internal JSDoc typedef imports accordingly.
Changes:
- Move
@types/eslint-scopefromdependenciestodevDependenciesand stop referencing it from the publishedtypes.d.ts. - Add local
Scope/Reference/Variabletype definitions and re-point internal JSDoc typedef imports to webpack-owned types. - Update several tooling/dependency versions (
assemblyscript,loader-runner,terser-webpack-plugin,terser) and regenerateyarn.lock.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Regenerated lockfile reflecting dependency/version updates. |
| types.d.ts | Removes eslint-scope type import; adds webpack-owned scope/reference/variable typings and renames the webpack node option type alias. |
| package.json | Moves @types/eslint-scope to devDeps; bumps several dependency versions. |
| lib/util/concatenate.js | Switches JSDoc typedef imports from eslint-scope to JavascriptModulesPlugin-provided types. |
| lib/optimize/ConcatenatedModule.js | Switches JSDoc typedef imports from eslint-scope to JavascriptModulesPlugin-provided types. |
| lib/javascript/JavascriptModulesPlugin.js | Introduces local JSDoc typedefs for Scope / Reference / Variable (temporary replacement for @types/eslint-scope). |
| .changeset/sour-hornets-admire.md | Adds a patch changeset documenting removal of @types/eslint-scope from runtime dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Scope} Scope */ | ||
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Reference} Reference */ | ||
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Variable} Variable */ |
There was a problem hiding this comment.
These JSDoc typedef imports point at ../javascript/JavascriptModulesPlugin, but that module also requires ../util/concatenate at runtime. Even though this is type-only, it creates a circular type dependency and couples a low-level util to a high-level plugin. Consider moving Scope/Reference/Variable typedefs into a small dedicated module (that doesn’t import concatenate) and importing from there instead.
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Scope} Scope */ | |
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Reference} Reference */ | |
| /** @typedef {import("../javascript/JavascriptModulesPlugin").Variable} Variable */ | |
| /** | |
| * @typedef {object} Reference | |
| * @property {*} [identifier] | |
| * @property {*} [from] | |
| * @property {*} [resolved] | |
| */ | |
| /** | |
| * @typedef {object} Scope | |
| * @property {Scope[]} childScopes | |
| * @property {Variable[]} variables | |
| */ | |
| /** | |
| * @typedef {object} Variable | |
| * @property {Reference[]} references | |
| * @property {Node[]} identifiers | |
| * @property {Scope} scope | |
| */ |
Merging this PR will degrade performance by 53.08%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "many-modules-commonjs", scenario '{"name":"mode-production","mode":"production"}' |
7.5 MB | 10.1 MB | -25.55% |
| ⚡ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
436 KB | 218.4 KB | +99.68% |
| ⚡ | Memory | benchmark "asset-modules-source", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
366.9 KB | 159.7 KB | ×2.3 |
| ❌ | Memory | benchmark "json-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
212.9 KB | 453.7 KB | -53.08% |
| ⚡ | Memory | benchmark "devtool-eval-source-map", scenario '{"name":"mode-production","mode":"production"}' |
7.8 MB | 6.3 MB | +25.32% |
Comparing chore-remove-outdated-eslint-scope (44a5213) with main (235a160)
@types/eslint-scopeSummary
fix, ideally we need to update
eslint-scopeto handle more scopes - static blocks and etc new features, anyway current outdated version blocks updating deps for some developers, let's move types into webpack and continue to think how update without breaking changeWhat kind of change does this PR introduce?
fix
Did you add tests for your changes?
Existing
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing
Use of AI
No