Skip to content

linter: typescript/consistent-type-imports rule is not working #23971

Description

@Spielboerg

What version of Oxlint are you using?

1.71.0

What command did you run?

oxlint -c ./oxlint.config.ts

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

import { defineConfig } from 'oxlint'

export default defineConfig({
  rules: {
    'no-console': 'error', // Just to see that Oxlint actually runs
    'typescript/consistent-type-imports': 'error',  // Default `fixStyle`: 'separate-type-imports'
  },
})

What happened?

The rule typescript/consistent-type-imports doesn't work at all.

Reproduction:

// Test.tsx

import { type ComponentProps } from 'react'

const Test = (props: ComponentProps<'div'>) => {
  console.log('Test component')

  return <div {...props}>Test</div>
}

export { Test }

Run oxlint ./Test.tsx -c ./oxlint.config.ts

Linter output:

  × eslint(no-console): Unexpected console statement.
   ╭─[file:///<redacted path>/Test.tsx:4:3]
 3 │ const Test = (props: ComponentProps<'div'>) => {
 4 │   console.log('Test component')
   ·   ───────────
 5 │ 
   ╰────
  help: Delete this console statement.

Found 0 warnings and 1 error.
Finished in 32ms on 1 file with 97 rules using 10 threads.

Additional expected output (or auto-fixed when run with --fix):
(I don't know what the error would look like, so this is a made-up error message)

import { type ComponentProps } from 'react'
         ^^^^

Add the `type` keyword after `import`:

import type { ComponentProps } from 'react'

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions