mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(linter): support report @typescript-eslint/consistent-type-imports (#3895)
This PR only contains the part about report error, adding the fixer part will make the whole PR difficult to review at one time. There are also some commented cases. One kind of them is `decorator`, as it blocked by #3645, another kind of them is type reference, need to solve #3799 first. I added TODO flags for them.
This commit is contained in:
parent
3870ed5a24
commit
b257d53151
4 changed files with 3211 additions and 10 deletions
|
|
@ -1374,19 +1374,16 @@ impl AccessorPropertyType {
|
|||
}
|
||||
|
||||
impl<'a> ImportDeclarationSpecifier<'a> {
|
||||
pub fn name(&self) -> CompactStr {
|
||||
pub fn local(&self) -> &BindingIdentifier<'a> {
|
||||
match self {
|
||||
ImportDeclarationSpecifier::ImportSpecifier(specifier) => {
|
||||
specifier.local.name.to_compact_str()
|
||||
}
|
||||
ImportDeclarationSpecifier::ImportNamespaceSpecifier(specifier) => {
|
||||
specifier.local.name.to_compact_str()
|
||||
}
|
||||
ImportDeclarationSpecifier::ImportDefaultSpecifier(specifier) => {
|
||||
specifier.local.name.to_compact_str()
|
||||
}
|
||||
ImportDeclarationSpecifier::ImportSpecifier(specifier) => &specifier.local,
|
||||
ImportDeclarationSpecifier::ImportNamespaceSpecifier(specifier) => &specifier.local,
|
||||
ImportDeclarationSpecifier::ImportDefaultSpecifier(specifier) => &specifier.local,
|
||||
}
|
||||
}
|
||||
pub fn name(&self) -> CompactStr {
|
||||
self.local().name.to_compact_str()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ImportAttributeKey<'a> {
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ mod typescript {
|
|||
pub mod ban_types;
|
||||
pub mod consistent_indexed_object_style;
|
||||
pub mod consistent_type_definitions;
|
||||
pub mod consistent_type_imports;
|
||||
pub mod explicit_function_return_type;
|
||||
pub mod no_duplicate_enum_values;
|
||||
pub mod no_dynamic_delete;
|
||||
|
|
@ -526,6 +527,7 @@ oxc_macros::declare_all_lint_rules! {
|
|||
typescript::prefer_enum_initializers,
|
||||
typescript::ban_types,
|
||||
typescript::consistent_type_definitions,
|
||||
typescript::consistent_type_imports,
|
||||
typescript::consistent_indexed_object_style,
|
||||
typescript::no_duplicate_enum_values,
|
||||
typescript::no_empty_interface,
|
||||
|
|
|
|||
2584
crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs
Normal file
2584
crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs
Normal file
File diff suppressed because it is too large
Load diff
618
crates/oxc_linter/src/snapshots/consistent_type_imports.snap
Normal file
618
crates/oxc_linter/src/snapshots/consistent_type_imports.snap
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
---
|
||||
source: crates/oxc_linter/src/tester.rs
|
||||
---
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ let foo: Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ let foo: Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ let foo: Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ let foo: A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A as a, B as b } from 'foo';
|
||||
· ─────────────────────────────────────
|
||||
3 │ let foo: a;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ type Bar = typeof Foo; // TSTypeQuery
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ type Bar = foo.Bar; // TSQualifiedName
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ type Baz = (typeof foo.bar)['Baz']; // TSQualifiedName & TSTypeQuery
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import * as A from 'foo';
|
||||
· ─────────────────────────
|
||||
3 │ let foo: A.Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ let foo: A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, {} from 'foo';
|
||||
· ────────────────────────
|
||||
3 │ let foo: A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ const foo: A = B();
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A and C are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ const foo: A = B();
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A, C, and D are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C, D } from 'foo';
|
||||
· ─────────────────────────────────
|
||||
3 │ const foo: A = B();
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A, C, and D are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B, C, D } from 'foo';
|
||||
· ─────────────────────────────────
|
||||
3 │ B();
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ B();
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports B are only used as type.
|
||||
╭─[consistent_type_imports.tsx:4:15]
|
||||
3 │ import type { Already1 } from 'foo';
|
||||
4 │ import A, { B } from 'foo';
|
||||
· ───────────────────────────
|
||||
5 │ import { C, D, E } from 'bar';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports C and D are only used as type.
|
||||
╭─[consistent_type_imports.tsx:5:15]
|
||||
4 │ import A, { B } from 'foo';
|
||||
5 │ import { C, D, E } from 'bar';
|
||||
· ──────────────────────────────
|
||||
6 │ import type { Already2 } from 'bar';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports B are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { /* comment */ B } from 'foo';
|
||||
· ─────────────────────────────────────────
|
||||
3 │ type T = B;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports D are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
· ───────────────────────────────
|
||||
4 │ type T = A | D;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports B are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports E are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
· ───────────────────────────────
|
||||
4 │ type T = B | E;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports C are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports F are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
3 │ import { D, E, F, } from 'bar';
|
||||
· ───────────────────────────────
|
||||
4 │ type T = C | F;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { Type1, Type2 } from 'named_types';
|
||||
· ───────────────────────────────────────────
|
||||
3 │ import Type from 'default_type';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { Type1, Type2 } from 'named_types';
|
||||
3 │ import Type from 'default_type';
|
||||
· ────────────────────────────────
|
||||
4 │ import * as Types from 'namespace_type';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:4:15]
|
||||
3 │ import Type from 'default_type';
|
||||
4 │ import * as Types from 'namespace_type';
|
||||
· ────────────────────────────────────────
|
||||
5 │ import Default, { Named } from 'default_and_named_type';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:5:15]
|
||||
4 │ import * as Types from 'namespace_type';
|
||||
5 │ import Default, { Named } from 'default_and_named_type';
|
||||
· ────────────────────────────────────────────────────────
|
||||
6 │ type T = Type1 | Type2 | Type | Types.A | Default | Named;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Type1 are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { Value1, Type1 } from 'named_import';
|
||||
· ─────────────────────────────────────────────
|
||||
3 │ import Type2, { Value2 } from 'default_import';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Type2 are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { Value1, Type1 } from 'named_import';
|
||||
3 │ import Type2, { Value2 } from 'default_import';
|
||||
· ───────────────────────────────────────────────
|
||||
4 │ import Value3, { Type3 } from 'default_import2';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Type3 are only used as type.
|
||||
╭─[consistent_type_imports.tsx:4:15]
|
||||
3 │ import Type2, { Value2 } from 'default_import';
|
||||
4 │ import Value3, { Type3 } from 'default_import2';
|
||||
· ────────────────────────────────────────────────
|
||||
5 │ import Type4, { Type5, Value4 } from 'default_and_named_import';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Type4 and Type5 are only used as type.
|
||||
╭─[consistent_type_imports.tsx:5:15]
|
||||
4 │ import Value3, { Type3 } from 'default_import2';
|
||||
5 │ import Type4, { Type5, Value4 } from 'default_and_named_import';
|
||||
· ────────────────────────────────────────────────────────────────
|
||||
6 │ type T = Type1 | Type2 | Type3 | Type4 | Type5;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): `import()` type annotations are forbidden.
|
||||
╭─[consistent_type_imports.tsx:2:24]
|
||||
1 │
|
||||
2 │ let foo: import('foo');
|
||||
· ─────────────
|
||||
3 │ let bar: import('foo').Bar;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): `import()` type annotations are forbidden.
|
||||
╭─[consistent_type_imports.tsx:3:24]
|
||||
2 │ let foo: import('foo');
|
||||
3 │ let bar: import('foo').Bar;
|
||||
· ─────────────────
|
||||
4 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): `import()` type annotations are forbidden.
|
||||
╭─[consistent_type_imports.tsx:2:24]
|
||||
1 │
|
||||
2 │ let foo: import('foo');
|
||||
· ─────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type Foo from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ let foo: Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type { Foo } from 'foo';
|
||||
· ───────────────────────────────
|
||||
3 │ let foo: Foo;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Type from 'foo';
|
||||
· ───────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { Type } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import * as Type from 'foo';
|
||||
· ────────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type Type from 'foo';
|
||||
· ────────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type { Type } from 'foo';
|
||||
· ────────────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type * as Type from 'foo';
|
||||
· ─────────────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import type /*comment*/ * as AllType from 'foo';
|
||||
· ────────────────────────────────────────────────
|
||||
3 │ import type // comment
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import type /*comment*/ * as AllType from 'foo';
|
||||
3 │ ╭─▶ import type // comment
|
||||
4 │ ╰─▶ DefType from 'foo';
|
||||
5 │ import type /*comment*/ { Type } from 'foo';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:5:15]
|
||||
4 │ DefType from 'foo';
|
||||
5 │ import type /*comment*/ { Type } from 'foo';
|
||||
· ────────────────────────────────────────────
|
||||
6 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Rest are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Default, * as Rest from 'module';
|
||||
· ────────────────────────────────────────
|
||||
3 │ const a: Rest.A = '';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Default are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Default, * as Rest from 'module';
|
||||
· ────────────────────────────────────────
|
||||
3 │ const a: Default = '';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Default, * as Rest from 'module';
|
||||
· ────────────────────────────────────────
|
||||
3 │ const a: Default = '';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Default are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Default, /*comment*/ * as Rest from 'module';
|
||||
· ────────────────────────────────────────────────────
|
||||
3 │ const a: Default = '';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Default are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import Default /*comment1*/, /*comment2*/ { Data } from 'module';
|
||||
· ─────────────────────────────────────────────────────────────────
|
||||
3 │ const a: Default = '';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Use an `import` instead of an `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:24]
|
||||
1 │
|
||||
2 │ import { type A, B } from 'foo';
|
||||
· ──────
|
||||
3 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, type C } from 'foo';
|
||||
· ───────────────────────────────────
|
||||
3 │ type T = A | C;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ let foo: A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B } from 'foo';
|
||||
· ───────────────────────────
|
||||
3 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A } from 'foo';
|
||||
· ────────────────────────
|
||||
3 │ import { B } from 'foo';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { A } from 'foo';
|
||||
3 │ import { B } from 'foo';
|
||||
· ────────────────────────
|
||||
4 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A } from 'foo';
|
||||
· ────────────────────────
|
||||
3 │ import B from 'foo';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import { A } from 'foo';
|
||||
3 │ import B from 'foo';
|
||||
· ────────────────────
|
||||
4 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports B and C are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ type T = B;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ type T = B;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A, { B, C as D } from 'foo';
|
||||
· ───────────────────────────────────
|
||||
3 │ type T = B;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { /* comment */ A, B } from 'foo';
|
||||
· ─────────────────────────────────────────
|
||||
3 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { B, /* comment */ A } from 'foo';
|
||||
· ─────────────────────────────────────────
|
||||
3 │ type T = A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A and C are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, C } from 'foo';
|
||||
· ──────────────────────────────
|
||||
3 │ import type { D } from 'deez';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports A are only used as type.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A, B, type C } from 'foo';
|
||||
· ───────────────────────────────────
|
||||
3 │ import type { D } from 'deez';
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import A from 'foo';
|
||||
· ────────────────────
|
||||
3 │ export = {} as A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:15]
|
||||
1 │
|
||||
2 │ import { A } from 'foo';
|
||||
· ────────────────────────
|
||||
3 │ export = {} as A;
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:17]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ class A {
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:17]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ class A {
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:17]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ class A {
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:17]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ class A {
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): All imports in the declaration are only used as types. Use `import type`.
|
||||
╭─[consistent_type_imports.tsx:2:17]
|
||||
1 │
|
||||
2 │ import Foo from 'foo';
|
||||
· ──────────────────────
|
||||
3 │ class A {
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Foo are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import 'foo';
|
||||
3 │ import { Foo, Bar } from 'foo';
|
||||
· ───────────────────────────────
|
||||
4 │ function test(foo: Foo) {}
|
||||
╰────
|
||||
|
||||
⚠ typescript-eslint(consistent-type-imports): Imports Foo are only used as type.
|
||||
╭─[consistent_type_imports.tsx:3:15]
|
||||
2 │ import {} from 'foo';
|
||||
3 │ import { Foo, Bar } from 'foo';
|
||||
· ───────────────────────────────
|
||||
4 │ function test(foo: Foo) {}
|
||||
╰────
|
||||
Loading…
Reference in a new issue