Skip to content

Bug(type-utils): Node.js' Buffer cannot be matched with a { type: package } TypeOrValueSpecifier #10089

Open
@abrahamguo

Description

@abrahamguo

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.

Issue Description

  • Inside TypeOrValueSpecifier => typeDeclaredInDeclarationFile:
  • when declaration.path is /.../typescript-eslint/node_modules/@types/node/buffer.d.ts
  • program.sourceFileToPackageName.get(declaration.path) returns undefined
  • thus, causing the specifier { from: 'package', name: 'Buffer', package: '...anything...' } to not match

It looks like this broke in #6870.

Reproduction Repository Link

https://github.com/abrahamguo/repro/tree/buffer

Repro Steps

  1. clone the repo
  2. npm i
  3. npx eslint index.ts

Versions

package version
@typescript-eslint/eslint-plugin 8.8.0
@typescript-eslint/parser 8.8.0
@typescript-eslint/scope-manager 8.8.0
@typescript-eslint/typescript-estree 8.8.0
@typescript-eslint/type-utils 8.8.0
@typescript-eslint/utils 8.8.0
TypeScript 5.6.2
ESLint 9.11.1
node 22.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions