Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent-type-imports: add autofix option to prefer inline type keyword #4842

Closed
jackfranklin opened this issue Apr 20, 2022 · 1 comment
Closed
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@jackfranklin
Copy link

import {FooWhichIsAType, BarWhichIsValue} from './some-file.js';

This will cause an error with consistent-type-imports, but the autofix for the rule will fix it like so:

import type {FooWhichIsAType} from './some-file.js';
import {BarWhichIsValue} from './some-file.js';

As of TypeScript 4.5, the following is also supported (https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names):

import {BarWhichIsValue, type FooWhichIsAType} from './some-file.js';

I'd like to propose a configuration flag be added to consistent-type-imports to enable the auto-fixer to be configured to prefer either approach.

I'm very happy to work on this PR, if this is something you would be happy landing? Thanks!

@jackfranklin jackfranklin added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Apr 20, 2022
@bradzacher
Copy link
Member

Duplicate of #4338

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Apr 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2022
@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants