@@ -122,6 +122,83 @@ declare_oxc_lint!(
122122 /// ```ts
123123 /// import type { Foo } from 'Foo';
124124 /// ```
125+ ///
126+ /// ### Options
127+ ///
128+ /// ```json
129+ /// {
130+ /// "typescript/consistent-type-imports": [
131+ /// "error",
132+ /// {
133+ /// "prefer": "type-imports",
134+ /// "fixStyle": "separate-type-imports",
135+ /// "disallowTypeAnnotations": true
136+ /// }
137+ /// ]
138+ /// }
139+ /// ```
140+ ///
141+ /// - `prefer`: Control whether to enforce type imports or value imports
142+ /// - `"type-imports"` (default): Will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators
143+ /// - `"no-type-imports"`: Will enforce that you always use `import Foo from '...'`
144+ ///
145+ /// - `fixStyle`: Determines how type imports are added when auto-fixing
146+ /// - `"separate-type-imports"` (default): Will add the type keyword after the import keyword `import type { A } from '...'`
147+ /// - `"inline-type-imports"`: Will inline the type keyword `import { type A } from '...'` (only available in TypeScript 4.5+)
148+ ///
149+ /// - `disallowTypeAnnotations`: Disallow using `import()` in type annotations
150+ /// - `true` (default): Disallows using `import()` in type annotations like `type T = import('foo')`
151+ /// - `false`: Allows `import()` type annotations
152+ ///
153+ /// #### Examples with `"prefer": "type-imports"` (default)
154+ ///
155+ /// Examples of **incorrect** code:
156+ /// ```ts
157+ /// import { Foo } from 'foo';
158+ /// let foo: Foo;
159+ /// ```
160+ ///
161+ /// Examples of **correct** code:
162+ /// ```ts
163+ /// import type { Foo } from 'foo';
164+ /// let foo: Foo;
165+ /// ```
166+ ///
167+ /// #### Examples with `"prefer": "no-type-imports"`
168+ ///
169+ /// Examples of **incorrect** code:
170+ /// ```ts
171+ /// import type { Foo } from 'foo';
172+ /// let foo: Foo;
173+ /// ```
174+ ///
175+ /// Examples of **correct** code:
176+ /// ```ts
177+ /// import { Foo } from 'foo';
178+ /// let foo: Foo;
179+ /// ```
180+ ///
181+ /// #### Examples with `"fixStyle": "inline-type-imports"`
182+ ///
183+ /// When fixing type imports, this option will use inline `type` modifiers:
184+ /// ```ts
185+ /// // Before fixing
186+ /// import { A, B } from 'foo';
187+ /// type T = A;
188+ /// const b = B;
189+ ///
190+ /// // After fixing
191+ /// import { type A, B } from 'foo';
192+ /// type T = A;
193+ /// const b = B;
194+ /// ```
195+ ///
196+ /// #### Examples with `"disallowTypeAnnotations": false`
197+ ///
198+ /// When set to `false`, allows `import()` type annotations:
199+ /// ```ts
200+ /// type T = import('foo').Bar;
201+ /// ```
125202 ConsistentTypeImports ,
126203 typescript,
127204 style,
0 commit comments