10000 Bug: type-utils > TypeOrValueSpecifier doesn't account for org-scoped packages · Issue #6698 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: type-utils > TypeOrValueSpecifier doesn't account for org-scoped packages #6698
Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

7FC4 Relevant Package

ast-spec

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

From #4436 (comment): when checking whether a 'package' matches in TypeOrValueSpecifier.ts, we check whether the declaration file name includes specifier.package directly:

return declarationFiles.some(
declaration =>
declaration.fileName.includes(`node_modules/${specifier.package}/`) ||
declaration.fileName.includes(
`node_modules/@types/${specifier.package}/`,
),
);

This is a potential issue because package names with @ in them have a __ replacing the @. And there might be other replacements I'm not remembering - haven't looked deeply into it.

https://github.com/DefinitelyTyped/DefinitelyTyped/tree/cc222f340546ff85b7c9271f4ecbd07b9d661c94/types/11ty__eleventy-img

We should handle any name substitutions in npm packages well, and add unit tests for it in TypeOrValueSpecifier.test.ts.

Fail

n/a

Pass

n/a

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: type-utilsIssues related to the @typescript-eslint/type-utils package

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0