Skip to content

Bug: @typescript-eslint/typescript-estree (and indeed, all @typescript-eslint/ I tested) is incompatible with typescript 4.9.5 #8244

Closed as not planned
@dgoldstein0

Description

@dgoldstein0

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

typescript-estree

Playground Link

No response

Repro Code

// tsconfig.json
{
    "compilerOptions": {
        "moduleResolution": "node",
        "module": "esnext",
        "lib": ["es2020"],
        "target": "es2020"
    }
}
// package.json
{
  "name": "test_tseslint",
  "packageManager": "yarn@3.4.1",
  "private": true,
  "dependencies": {
    "@typescript-eslint/typescript-estree": "6.18.1",
    "typescript": "4.9.5"
  }
}
// test.ts
import type { AST_NODE_TYPES } from "@typescript-eslint/typescript-estree";

install this with npm install (yarn works too) then run tsc



### ESLint Config

_No response_

### tsconfig

```jsonc
{
    "compilerOptions": {
        "moduleResolution": "node",
        "module": "esnext",
        "lib": ["es2020"],
        "target": "es2020"
    }
}

Expected Result

I expect to be able to import @typescript-eslint/typescript-estree without a module resolution error

Actual Result

$ ./node_modules/.bin/tsc
test.ts:1:37 - error TS2307: Cannot find module '@typescript-eslint/typescript-estree' or its corresponding type declarations.

1 import type { AST_NODE_TYPES } from "@typescript-eslint/typescript-estree";
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in test.ts:1


ERROR: //tools:node did not exit successfully.
If you suspect that there's a problem with the tool, try contacting the team that owns it: web-build

Additional Info

If I upgrade to the latest typescript (5.3.3 - I suspect any >= 5 can work) and set moduleResolution: bundler, then I am able to get past the module resolution error (and instead encounter #8047).

Based on --traceResolution, I originally thought part of the problem is the typeVersions which is not giving versions for typescript >=4.7

======== Resolving module '@typescript-eslint/typescript-estree' from '/home/dgoldstein/src/test_tseslint/test.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module '@typescript-eslint/typescript-estree' from 'node_modules' folder, target file type 'TypeScript'.
Found 'package.json' at '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/package.json'.
'package.json' has a 'typesVersions' field with version-specific path mappings.
'package.json' does not have a 'typesVersions' entry that matches version '4.9'.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.ts' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.tsx' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' does not have a 'main' field.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.ts' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.tsx' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.d.ts' does not exist.
Directory '/home/dgoldstein/src/test_tseslint/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/dgoldstein/src/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/dgoldstein/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript-eslint__typescript-estree'
Loading module '@typescript-eslint/typescript-estree' from 'node_modules' folder, target file type 'JavaScript'.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/package.json' exists according to earlier cached lookups.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.js' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree.jsx' does not exist.
'package.json' does not have a 'main' field.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.js' does not exist.
File '/home/dgoldstein/src/test_tseslint/node_modules/@typescript-eslint/typescript-estree/index.jsx' does not exist.
Directory '/home/dgoldstein/src/node_modules' does not exist, skipping all lookups in it.
Directory '/home/dgoldstein/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@typescript-eslint/typescript-estree' was not resolved. ========

but downgrading typescript just gives a different failed resolution trace. I think the real problem is that @typescript-eslint/ packages have started expressing their package.json in a way that only the newer forms of moduleResolution (node16, nodenext, and bundler) understand.

Versions

package version
@typescript-eslint/typescript-estree 6.18.1
TypeScript 4.9.5
node 16.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions