Skip to content

[consistent-type-imports] prefer inline type import syntax #4338

Closed
@akphi

Description

@akphi

Description

I would like to propose an extension to the existing consistent-type-imports rule. This is linked to the work done in #4237

I think it would be beneficial for people who are interested in adopting the new inline type import syntax introduced in Typescript 4.5. We can introduce a flag, for example preferInlineTypeImports?: boolean.

Like @bradzacher mentioned, it's tricky to do a fixer, so we don't need it for now, but at least a way to warn people about violation would be great.

Fail

import type { c } from './c';
import { a } from './a'; 
import type { b } from './a';

Pass

import type { c } from './c';
import { a, type b } from './a';

Let me know what you think about this. If you give me a green light, I think if I can try working on this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions