Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: [consistent-type-imports] False negatives when type name also refers to a local value #8315

Open
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@haskellcamargo

Description

@haskellcamargo

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 havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.3.3&fileType=.tsx&code=PTAEAEBcGcFoFMAeAHeBjSCBOWD2XRZQAVAC3lAFtcATAVwBsKbd5oA7AcklCQEtokADSgARnR6RSA0DPa4eWeEwBuAQ3aQAdACg%2BlZPh4BvUAAUGatPFK4GNeAQC%2BoAGZ5KoTskvXb9x04Abh0dJEMsSQBPVFAAYVx2Vz4Ac1AAXlBjHVBQHysbOwcsAC5zX0KArBCnUJBQAEFQaCjKUTtQAHc%2BKVApCmg1Sgp2IYo1aD7yPpj4HVc6dgw%2BRPKC-2KACgBKLJzQJUg6LHZQdkYGGrqwAFVoPnY0-tAGXDQ1BmbW9s%2BJ0DVQOoGHQ5uEjG5FstVgBZNQPHZ7XKHY6nAA8FnWRUcoGAAD4rkA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgeyeUuX0Ra0ipWpQC2xDtHyoMkRNGhTI4MAF8QaoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

//@ts-expect-error - The module doesn't exist, but this is not relevant.import{Placeholder}from'placeholder';exporttypeConfig={// Using it only as a typeplaceholder:Placeholder;}// A symbol with the same name as the typefunctionPlaceholder(){returnnull;}// Using the local symbol as a valueexportfunctionMain(){return<Placeholder/>;}

ESLint Config

{"rules":{"@typescript-eslint/consistent-type-imports":"error"}}

tsconfig

No response

Expected Result

It should report an error because the actual import is only used as a type. Instead no error is reported.
TSC accepts types with the same name as local values. Babel with the TypeScript preset throws an error due to having a duplicate identifier as it is unable to determine that the import will be dropped during compile-time.
There's also changes coming toTypeScript 5.4 that introduces errors when type-only imports conflict with local values.

Actual Result

No errors shown.

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: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp