ESLint is completely broken: TypeScript 7 removed the programmatic Compiler API

Đang mở
#601 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@bitcoinbrisbane đang làm issue này rồi.

Từ ngày 9/9/2026.

  • #603 của @bitcoinbrisbane — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start by checking the TypeScript and typescript-eslint dependency declarations, then inspect the yarn lint, lint:fix, lint:warn, and dev:lint entry points. Verify the chosen compatibility approach by running those lint commands and confirm that the TypeScript 7 and Node version notes in CLAUDE.md are no longer misleading.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug dev-ops tech debt

Symptom

Every ESLint invocation crashes on load, before linting a single file:

$ npx eslint src/bus/ingest.ts
Oops! Something went wrong! :(
ESLint: 10.1.0
TypeError: Cannot read properties of undefined (reading 'Cjs')
    at Object.<anonymous> (node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js:59:18)

It fails identically on untouched files, so it is not caused by any particular source file. yarn lint, yarn lint:fix, yarn lint:warn and yarn dev:lint are all dead.

Root cause

TypeScript 7.0 removed the public programmatic Compiler API, and typescript-eslint is built on it.

The root export of the typescript package is now just a version stub:

> const ts = require("typescript");
> Object.keys(ts)
[ 'version', 'versionMajorMinor' ]     // two exports, that's all
> typeof ts.Extension, typeof ts.ScriptKind, typeof ts.createProgram
'undefined' 'undefined' 'undefined'
// node_modules/typescript/package.json
"exports": {
  ".": "./lib/version.cjs",
  "./unstable/sync":  "./dist/api/sync/api.js",
  "./unstable/ast":   "./dist/ast/index.js",
  ...
}

The compiler API moved behind typescript/unstable/* subpaths as part of the Go port. So this line, evaluated at module load, throws:

// @typescript-eslint/typescript-estree/dist/create-program/shared.js:59
exports.DEFAULT_EXTRA_FILE_EXTENSIONS = new Set([
    ts.Extension.Cjs,   // <- ts.Extension is undefined
    ...
]);

Anything doing a bare require("typescript") and expecting the classic API breaks the same way — ts-jest and ts-morph are commonly reported alongside ESLint.

Version state

Installed Note
typescript 7.0.2 bumped from ^5.7.2 in 1c51aa8 ("Upgrade frontend to TypeScript 7 with Jest compatibility")
eslint 10.1.0
typescript-eslint 8.57.2 latest is 8.70.0

[email protected] (latest) declares "typescript": ">=4.8.4 <6.1.0". No published version supports TypeScript 7 — upgrading typescript-eslint does not fix this.

Upstream typescript-eslint#12518 ("TypeScript 7.0.2 Support") is closed as not planned. The stable programmatic API is expected in TypeScript 7.1 (npm dist-tag currently shows next: 7.1.0-dev.*); see also #10940 for the tsgo type-information work.

Blast radius

Broken:

  • yarn lint, yarn lint:fix, yarn lint:warn, yarn dev:lint

Not affected — worth stating so nobody chases the wrong thing:

  • CI — the workflow has three jobs (Build, Test, E2E) and no lint job, so this is not currently red in CI.
  • Tests — jest transforms via babel-jest + @babel/preset-typescript, which never touches the TS compiler API.
  • Build — tsc -b && vite build; the tsc CLI is the native binary and works fine.
  • yarn dev — plain vite, no lint step.

So the practical cost is that nothing has been lint-verified since the TS 7 bump, and contributors get a crash instead of a lint result.

Options

A. Pin typescript to ^6.0.3 (latest stable 6.x, inside typescript-eslint's supported range). Restores linting immediately. Costs the TS 7 compile speed, though @typescript/native-preview can be added alongside to keep a fast tsgo --noEmit for CI. This is the workaround the ecosystem is currently recommending.

B. Stay on TS 7 and accept lint is unavailable until TS 7.1 ships the stable API and typescript-eslint adopts it. Given #12518 is closed as not planned, that is an open-ended wait. If we take this, we should delete or clearly mark the four lint scripts so they stop looking like they work.

C. Replace ESLint with oxlint or Biome, both of which have their own TypeScript parsers and no dependency on the TS compiler API. Largest change; would need a rule-parity pass against the existing config, and neither does type-aware linting.

Recommendation: A, unless TS 7 was adopted specifically for build speed — in which case A plus @typescript/native-preview keeps both. Worth deciding deliberately since the TS 7 bump was intentional.

Also worth fixing while we're here

CLAUDE.md still lists "TypeScript 5 - Type safety" in the tech stack, and the Node pin section says 22.13.0 while the local toolchain is on 22.22.1. Both are drift from the TS 7 bump.

Ngôn ngữ chính
TypeScript
Star
2
Fork
5
Merge trung bình
21 giờ 38 phút
Pull request đã merge (30 ngày)
105

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của block52/ui

Tất cả issue của block52/ui

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.