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

Proposal for new rule - consistent style for type-only imports #2200

@nojvek

Description

@nojvek

Proposal

{"rules": {"@typescript-eslint/prefer-import-type": ["error"]  }}
// your repro code caseimport{FooBar}from'foo-bar';constfoo:FooBar={foo:1,bar:2};

Expected Result
FooBar is only being used as a type, import as 'import type {FooBar}'

Actual Result

Additional Info

Since typescript now supportsimport type {X} for type only imports that don't get emitted in js, nor do get counted as cyclic imports, it would be nice to have typescript-eslint automatically flag and fiximport {T} toimport type {T}

If you're willing to accept the suggestion, I'm happy to create a PR and land this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp