Repository navigation
Upgrade Webpack to 5.111.0 and TypeScript to 6.0.3 - #22901
Conversation
Update webpack to 5.111.0 and refresh its dependency resolution.
Use Node16 module resolution, explicit Node ambient types, and stable source roots without changing strict compiler checks. Refresh all three native-module lockfiles. Co-authored-by: Copilot <[email protected]>
Derive Copilot RPC types through the public SDK API instead of private export paths. Normalize shared DDS buffers and cover both buffer variants in tests. Tighten empty props, wrapper, and callback types and remove unused catch bindings without changing error handling. Co-authored-by: Copilot <[email protected]>
Dexie 3 uses a declaration syntax rejected by TypeScript 6. Use the maintained release instead of skipping library checks. Verified database schema migration tests and the complete application test suite. Co-authored-by: Copilot <[email protected]>
Migrate bundled and Node projects to supported module resolution with explicit source roots, preserving all existing strict compiler checks. Update ts-node, TypeScript ESLint, React lint support, and Lodash declarations. Preserve prior enabled lint rules, migrate custom rule AST handling, and restore custom-rule test discovery with regression coverage. Keep renamed suites covered by ESLint and Prettier. Document the compiler upgrade verification workflow. Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The desktop-notifications root directory change relocates its package output, causing current macOS and Windows CI builds to fail.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: None
What changed in this PR
Upgrades GitHub Desktop’s TypeScript, Webpack, ESLint, and Dexie toolchains while adapting compiler configuration, typings, custom rules, and tests.
Changes:
- Updates compiler/build dependencies and module-resolution modes.
- Migrates custom ESLint rules and Copilot SDK types to public APIs.
- Adds SharedArrayBuffer DDS coverage and refreshes runtime dependencies.
| File | Description |
|---|---|
.eslintrc.yml |
Migrates renamed TypeScript ESLint rules. |
package.json |
Updates build, lint, and compiler dependencies. |
yarn.lock |
Refreshes the root dependency graph. |
tsconfig.json |
Uses bundler resolution and an explicit root. |
docs/contributing/upgrading-dependencies.md |
Documents TypeScript upgrade practices. |
script/tsconfig.json |
Uses NodeNext resolution for scripts. |
script/test-setup.ts |
Removes an unused catch binding. |
script/run.ts |
Removes an unused catch binding. |
script/pr-api.ts |
Removes unused catch bindings. |
script/draft-release/index.ts |
Removes an unused catch binding. |
eslint-rules/tsconfig.json |
Enables strict checking for rules and tests. |
eslint-rules/README.md |
Documents updated rule tooling. |
eslint-rules/no-loosely-typed-webcontents-ipc.js |
Supports the current optional-chain AST. |
eslint-rules/react-no-unbound-dispatcher-props.js |
Updates rule typings. |
eslint-rules/react-proper-lifecycle-methods.js |
Updates lifecycle-rule AST handling. |
eslint-rules/react-readonly-props-and-state.js |
Updates rule typings. |
eslint-rules/tests/config-test.mjs |
Tests empty-interface rule behavior. |
eslint-rules/tests/insecure-random-test.mjs |
Migrates the rule test to ESM. |
eslint-rules/tests/no-loosely-typed-webcontents-ipc-test.mjs |
Adds optional IPC coverage. |
eslint-rules/tests/react-no-unbound-dispatcher-props-test.mjs |
Migrates the rule test to ESM. |
eslint-rules/tests/react-proper-lifecycle-methods-test.mjs |
Migrates lifecycle tests to ESM. |
eslint-rules/tests/react-readonly-props-and-state-test.mjs |
Migrates readonly tests to ESM. |
vendor/desktop-notifications/package.json |
Upgrades TypeScript. |
vendor/desktop-notifications/tsconfig.json |
Updates native-module compiler settings. |
vendor/desktop-notifications/yarn.lock |
Locks TypeScript 6.0.3. |
vendor/desktop-trampoline/package.json |
Upgrades TypeScript. |
vendor/desktop-trampoline/tsconfig.json |
Updates native-module compiler settings. |
vendor/desktop-trampoline/yarn.lock |
Locks TypeScript 6.0.3. |
vendor/windows-argv-parser/package.json |
Upgrades TypeScript. |
vendor/windows-argv-parser/tsconfig.json |
Updates native-module compiler settings. |
vendor/windows-argv-parser/yarn.lock |
Locks TypeScript 6.0.3. |
app/package.json |
Upgrades Dexie. |
app/yarn.lock |
Refreshes the Dexie dependency. |
app/src/highlighter/tsconfig.json |
Uses bundler resolution for the worker. |
app/src/crash/crash-app.tsx |
Replaces an empty props interface. |
app/src/lib/api.ts |
Modernizes object types and catch clauses. |
app/src/lib/directory-exists.ts |
Removes an unused catch binding. |
app/src/lib/get-main-guid.ts |
Removes an unused catch binding. |
app/src/lib/git/description.ts |
Removes an unused catch binding. |
app/src/lib/git/reflog.ts |
Replaces a boxed string type. |
app/src/lib/git/status.ts |
Removes an unused catch binding. |
app/src/lib/git/var.ts |
Removes an unused catch binding. |
app/src/lib/globals.d.ts |
Narrows an exit-listener signature. |
app/src/lib/http.ts |
Uses primitive object types. |
app/src/lib/local-storage.ts |
Removes unused catch bindings. |
app/src/lib/markdown-filters/emoji-filter.ts |
Removes an unused catch binding. |
app/src/lib/source-map-support.ts |
Removes unused catch bindings. |
app/src/lib/ssh/ssh.ts |
Removes an unused catch binding. |
app/src/lib/stores/app-store.ts |
Uses public Copilot types. |
app/src/lib/stores/copilot-store.ts |
Uses public SDK billing and model types. |
app/src/lib/copilot/types.ts |
Derives types from the public RPC API. |
app/src/lib/copilot/conflict-resolution-model.ts |
Uses the shared public model type. |
app/src/main-process/app-window.ts |
Removes an unused catch binding. |
app/src/main-process/exception-reporting.ts |
Removes an unused catch binding. |
app/src/main-process/log.ts |
Removes an unused catch binding. |
app/src/main-process/main.ts |
Removes an unused catch binding. |
app/src/ui/diff/image-diffs/dds-converter.ts |
Normalizes shared image buffers. |
app/src/ui/lib/app-proxy.ts |
Removes an unused catch binding. |
app/src/ui/lib/avatar.tsx |
Removes an unused catch binding. |
app/src/ui/lib/copilot-model-picker.tsx |
Uses shared Copilot types. |
app/src/ui/lib/install-cli.ts |
Removes an unused catch binding. |
app/src/ui/lib/throttled-scheduler.ts |
Narrows the callback type. |
app/src/ui/index.tsx |
Removes an unused catch binding. |
app/src/ui/preferences/copilot-settings-dialog.tsx |
Uses shared Copilot types. |
app/src/ui/preferences/copilot-user-settings.tsx |
Uses shared Copilot types. |
app/src/ui/preferences/copilot.tsx |
Uses shared Copilot types. |
app/test/unit/copilot-conflict-resolution-model-test.ts |
Uses shared Copilot types. |
app/test/unit/dds-converter-test.ts |
Covers ordinary and shared buffers. |
app/test/unit/stores/copilot-store-test.ts |
Uses shared Copilot types. |
app/test/unit/ui/copilot-preferences-test.tsx |
Uses shared Copilot types. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Restore lib as the notifications source root so fresh builds emit the published dist entry points. Add compiler-output contract tests for all native TypeScript packages so stale artifacts cannot mask layout regressions, and document this validation requirement. Co-authored-by: Copilot <[email protected]>
Filter other platforms' optional Koffi packages from the renderer bundle and resolve the target eagerly so a missing native package fails the build. This prevents cross-compilation installs from emitting multiple different binaries as koffi.node. Add multi-platform Webpack regression builds that verify the emitted binary contents, a missing-target check, and packaging documentation. Validate macOS x64 and arm64 production compilation with both native packages installed. Co-authored-by: Copilot <[email protected]>
| "compilerOptions": { | ||
| "module": "esnext", | ||
| "moduleResolution": "node", | ||
| "moduleResolution": "bundler", |
There was a problem hiding this comment.
Our old value was deprecated and wouldn't be supported on TS7
| Awaited< | ||
| ReturnType<CopilotClient['rpc']['account']['getQuota']> | ||
| >['quotaSnapshots'][string] | ||
| > |
There was a problem hiding this comment.
This approach is required due to the new moduleResolution: 'bundler' 🤷♂️
| "desktop-notifications": "file:../vendor/desktop-notifications", | ||
| "desktop-trampoline": "file:../vendor/desktop-trampoline", | ||
| "dexie": "^3.2.3", | ||
| "dexie": "^4.4.6", |
There was a problem hiding this comment.
Two options:
- Override types of Dexie v3 to make it compatible with TS6
- Upgrade to Dexie v4
Chose to upgrade, test manually, and since I didn't notice any regressions… 🤞
| getKoffiWebpackConfig( | ||
| path.resolve(__dirname, 'node_modules'), | ||
| process.platform, | ||
| getDistArchitecture() | ||
| ), |
There was a problem hiding this comment.
According to Copilot (and I have verified to the extent of my knowledge): this is something that comes from Copilot SDK, and it's required due to the Webpack upgrade because of webpack/webpack#20497
niik
left a comment
There was a problem hiding this comment.
Fantastic work @sergiou87, a type safer future awaits
|
|
||
| const lines = result.stdout.split('\n') | ||
| const names = new Set<string>() | ||
| const excludedNames = new Set<String>() |
Description
Upgrade Webpack from 5.104.1 to 5.111.0 and TypeScript from 5.8.2 to 6.0.3, the latest stable versions verified when this work was done. The TypeScript upgrade covers the application, build scripts, syntax-highlighting worker, custom ESLint rules, and all three TypeScript-based native modules.
The migration preserves existing compiler strictness and enabled lint checks rather than suppressing diagnostics to make the upgrade pass.
This should serve as a step before migrating to TypeScript 7 (whenever we get proper ESLint support for it, or if we decide to go with the "TS6 bridge" approach).
Dependency and build changes
Compilertype. No Webpack configuration changes were needed.desktop-trampoline,desktop-notifications, andwindows-argv-parser, updating all corresponding lockfiles.ts-nodeto 10.9.2 and@types/lodashto 4.17.25.experimental-utilsdependency withutils.eslint-plugin-reactto 7.37.5 for compatibility with the new parser.Compiler and application changes
bundlerfor Webpack-compiled code,nodenextfor build scripts, andnode16for native modules and custom ESLint rules.ArrayBufferbefore parsing and rendering. Add tests for both ordinary and shared buffers.Functiontypes with primitive/object types and concrete callback signatures. Represent the crash window's empty props withRecord<string, never>and remove its old empty-interface suppression.Lint rules, tests, and documentation
*.test.jsto*-test.mjsso the repository's Node.js test runner discovers them. Keep those tests included in ESLint and Prettier checks.Decisions and trade-offs
Preserve checks instead of hiding errors
No new
skipLibCheck, deprecation-suppression options, or type-error suppressions were added. Existing strict compiler options remain unchanged; custom ESLint rules now also explicitly use strict mode. Their pre-existingskipLibChecksetting is unchanged.The old and new effective lint configurations were compared to retain previously enabled checks:
no-empty-object-typeusesallowInterfaces: neverandallowObjectTypes: always. This preserves the oldno-empty-interfacechecks without newly banning{}types that were permitted whileban-typeswas disabled.no-extra-non-null-assertionremains explicitly enabled, and ESLint's coreno-loss-of-precisionreplaces the removed TypeScript extension rule.no-var-requiresmaps to disabledno-require-imports, preserving the existing CommonJS policy. Forcing asynchronous imports would change startup behavior and Electron renderer callbacks that must load modules synchronously.Match module resolution to the execution environment
Using one resolution mode everywhere would not accurately model both Webpack bundles and Node-executed scripts. The separate modes respect package exports while retaining the native modules' CommonJS format. Explicit roots avoid changes caused by compiler root-directory defaults.
Respecting SDK exports exposed the private type imports. Deriving types from the public RPC methods preserves the exact metadata Desktop consumes without copying interfaces or loosening them with casts. These derived types still intentionally follow the SDK's RPC API as it evolves.
Keep the tooling migration bounded
ESLint stays on the compatible 8.57.1 release rather than combining this upgrade with an ESLint major-version/flat-config migration. The React plugin update resolves parser-related false positives without disabling React prop validation. The larger lockfile diff includes the upgraded tools' transitive dependencies and Webpack's upstream minifier dependency changes.
Dexie is the notable runtime dependency upgrade. Updating the maintained library was preferred over disabling declaration checking or carrying a local dependency patch. Existing database migration tests and the complete application test suite pass, but this major-version change warrants particular review.
The DDS conversion keeps the ordinary
ArrayBufferpath allocation-free. Shared buffers incur a copy so parsing and rendering use an ordinary-buffer snapshot; both paths have regression tests.Validation
Validated locally on macOS:
yarn lint:fix,yarn lint, and whitespace checks.The environment sets
safe.bareRepository=explicit, which initially prevented four Git fixture tests from passing. The successful full-suite runs usedsafe.bareRepository=allonly in the test process environment; persistent Git settings were not changed.Packaged-app/E2E runs and Windows-native binary execution were not performed locally. CI and cross-platform validation remain to be reviewed before marking this draft ready.
Also deployed 3.6.7-test2 (proving it's able to make production builds for both platforms) and smoke-tested those builds (Copilot included, given we're changing how one of its dependencies -koffi- is bundled).
Screenshots
Not applicable: no intentional visual changes.
Commit structure
92685500a9- Upgrade Webpack to 5.111.0.1e288ac10f- Upgrade native-module TypeScript builds to 6.0.3.ed42bf6280- Prepare application types and lint usage.3541f7246c- Upgrade Dexie for TypeScript 6 declaration compatibility.913cbcb40a- Upgrade compiler/lint tooling, custom-rule tests, and documentation.Release notes
Notes: no-notes