Skip to content

Bug: typeMatchesSpecifier FileSpecifier checks in node modules #6819

Open
@RebeccaStevens

Description

@RebeccaStevens

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

utils

Playground Link

No response

Repro Code

typeMatchesSpecifier(
  type,
  {
    from: "file",
    name: "RegExp",
  },
  parserServices.program)

ESLint Config

No response

tsconfig

No response

Expected Result

It shouldn't find this type (as I haven't defined it).

Actual Result

I finds it in "node_modules/.pnpm/typescript@5.0.3/node_modules/typescript/lib/lib.es5.d.ts".

Additional Info

I would expect a FileSpecifier to ignore node module files by default.
typescript/lib/*.d.ts files should only match with a LibSpecifier and other files in node module to only match with a PackageSpecifier.

Maybe FileSpecifier needs an extra property like ignorePath or ignoreGlob that defaults to "node_modules".
Or alternatively, path could be made a glob that defaults to selecting files not in "node_modules".

Versions

package version
@typescript-eslint/eslint-plugin 6.0.0-alpha.106
@typescript-eslint/parser 6.0.0-alpha.106
@typescript-eslint/scope-manager 6.0.0-alpha.106
@typescript-eslint/typescript-estree 6.0.0-alpha.106
@typescript-eslint/type-utils 6.0.0-alpha.106
@typescript-eslint/utils 6.0.0-alpha.106
TypeScript 5.0.3
ESLint 8.36.0
node 18.15.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