Skip to content

Fix Tests (ubuntu-latest, 3.x, debugger): replace gulp-typescript with direct tsc in compileCore task#25998

Draft
Copilot wants to merge 7 commits into
mainfrom
copilot/migrate-eslint-10-flat-config
Draft

Fix Tests (ubuntu-latest, 3.x, debugger): replace gulp-typescript with direct tsc in compileCore task#25998
Copilot wants to merge 7 commits into
mainfrom
copilot/migrate-eslint-10-flat-config

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown

Root Cause

The compileCore gulp task used gulp-typescript v5.0.1, which has a bug when compiling TypeScript with module: "NodeNext" — it emits raw ES import statements in the .js output instead of converting them to CJS require() calls.

In Node.js v22.12+, when a .js file contains ES module syntax but there is no "type": "module" in the nearest package.json, Node.js reparses the file as ESM. In ESM mode, relative imports require explicit .js file extensions — which the compiled output lacks — causing:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '...out/client/common/platform/fs-paths'
    imported from ...out/test/testBootstrap.js

Fix

Replaced the compileCore gulp task in gulpfile.js to invoke tsc directly using the project-local TypeScript binary (node_modules/typescript/bin/tsc), identical to how the existing compileApi task already works. This produces correct CJS output with require() calls. The now-unused gulp-typescript and typescript imports were also removed.

Testing

  • npx gulp prePublishNonBundle compiles successfully
  • ✅ Compiled testBootstrap.js uses CJS require() — no ESM reparsing warning
  • node ./out/test/testBootstrap.js starts without ERR_MODULE_NOT_FOUND
  • ✅ Lint: 0 errors
  • ✅ CodeQL: 0 alerts
Original prompt

Migrate to ESLint 10 with flat config, types/node 22, and TypeScript 5.9.x. Create a PR.

Created from VS Code.

- Bump eslint ^8.57.1 → ^10.0.0
- Add @eslint/js ^10.0.0 (now a required explicit dep for flat config)
- Bump @typescript-eslint/{eslint-plugin,parser} ^6.21.0 → ^8.61.0
- Bump eslint-config-prettier ^8.3.0 → ^10.1.8
- Bump typescript ~5.2 → ~5.9
- Replace eslint-plugin-import ^2 (no ESLint 10 support) with
  eslint-plugin-import-x ^4.16.2 (drop-in fork with ESLint 10 support)

eslint.config.mjs:
- Update import to use eslint-plugin-import-x
- Remove prettier from plugins (eslint-config-prettier is not a plugin)
- Remove rules deleted in @typescript-eslint v8:
    ban-types, no-loss-of-precision, no-extra-parens, no-var-requires
- Rename no-empty-interface → no-empty-object-type (v8 replacement)
- Turn off new v8 recommended rules to avoid flagging pre-existing code:
    no-unsafe-function-type, no-wrapper-object-types,
    no-unused-expressions
- Turn off new ESLint 10 recommended rules:
    no-unassigned-vars, no-useless-assignment, preserve-caught-error

Source files: remove stale eslint-disable @typescript-eslint/ban-types
comments (rule removed in v8) from 11 files across src/client and src/test

tsconfig.json, tsconfig.extension.json, pythonExtensionApi/tsconfig.json:
- Add skipLibCheck: true to resolve type conflict between
  @types/eslint-scope (webpack transitive dep) and ESLint 10 bundled types
Copilot AI changed the title [WIP] Migrate to ESLint 10 with flat config Migrate to ESLint 10 (flat config), @typescript-eslint v8, TypeScript 5.9, @types/node 22 Jun 8, 2026
Copilot AI requested a review from rzhao271 June 8, 2026 20:10
@rzhao271

rzhao271 commented Jun 9, 2026

Copy link
Copy Markdown

@copilot Do not use skiplibcheck. Instead bump webpack.

Webpack 5.107.0 dropped @types/eslint-scope as a dependency, which
resolves the type conflict with ESLint 10's bundled TypeScript
declarations. This avoids the need for skipLibCheck: true.

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Author

@copilot Do not use skiplibcheck. Instead bump webpack.

Done. Bumped webpack ^5.105.0^5.107.0 (commit $(git -C /home/runner/work/vscode-python/vscode-python/microsoft/vscode-python rev-parse --short HEAD)). Webpack 5.107.0 dropped @types/eslint-scope as a direct dependency, which eliminates the type conflict with ESLint 10's bundled declarations. skipLibCheck: true has been removed from all three tsconfig files.

@copilot Do not use skiplibcheck. Instead bump webpack.

Done in 456b4c6. Bumped webpack ^5.105.0^5.107.0 — that version dropped @types/eslint-scope as a direct dependency, eliminating the type conflict with ESLint 10's bundled declarations. skipLibCheck: true has been removed from all three tsconfig files.

Copilot AI requested a review from rzhao271 June 9, 2026 16:18
@rzhao271

rzhao271 commented Jun 9, 2026

Copy link
Copy Markdown

@copilot Fix peer dependency issues by upgrading or deleting outdated eslint helper dependencies.

eslint-plugin-jsx-a11y, eslint-plugin-react, and eslint-plugin-react-hooks
are not imported in eslint.config.mjs. eslint-plugin-jsx-a11y@6.x has no
ESLint 10-compatible release, causing npm install to fail without
--legacy-peer-deps. Removing all three resolves the conflict and allows
clean installs.

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Author

@copilot Fix peer dependency issues by upgrading or deleting outdated eslint helper dependencies.

Done in c975d3a. Removed eslint-plugin-jsx-a11y, eslint-plugin-react, and eslint-plugin-react-hooks from package.json — none of them are imported in eslint.config.mjs, and eslint-plugin-jsx-a11y@6.x has no ESLint 10-compatible release. npm install now completes cleanly without --legacy-peer-deps.

@rzhao271

rzhao271 commented Jun 9, 2026

Copy link
Copy Markdown

@copilot Confirm where eslint-plugin-react was being used. Does the project contain React files?

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Author

@copilot Confirm where eslint-plugin-react was being used. Does the project contain React files?

The project contains no React files — no .jsx, no .tsx, and no import from 'react' anywhere in src/. The only occurrences of the word "react" in source files are:

  1. src/client/testing/common/debugLauncher.ts — a plain English comment: // Only react to OUR session terminating
  2. src/test/unittests.tsprocess.env.NODE_ENV = 'production'; // Make sure react is using production bits or we can run out of memory. (referring to VS Code's own React-based UI renderer, not any React code in this extension)

eslint-plugin-react, eslint-plugin-react-hooks, and eslint-plugin-jsx-a11y were listed as dev dependencies in package.json but were never imported or configured in eslint.config.mjs. They were dead dependencies — safe to remove.

@rzhao271

rzhao271 commented Jun 9, 2026

Copy link
Copy Markdown

@copilot Upgrade vscode/test-electron package to ^3.0.0.

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Author

@copilot Upgrade vscode/test-electron package to ^3.0.0.

Done. Upgraded @vscode/test-electron from ^2.3.8^3.0.0. All APIs used in src/test/ (runTests, downloadAndUnzipVSCode, resolveCliPathFromVSCodeExecutablePath, TestOptions) are still present in v3, so no source changes were needed.

@rzhao271 rzhao271 added the no-changelog No news entry required label Jun 9, 2026
Copilot AI changed the title Migrate to ESLint 10 (flat config), @typescript-eslint v8, TypeScript 5.9, @types/node 22 Fix Tests (ubuntu-latest, 3.x, debugger): replace gulp-typescript with direct tsc in compileCore task Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required skip-issue-check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants