Skip to content

Linter: When auto-fixing removes unused imports, it mistakenly deletes the entire line of import statement (including the still-used React) #23424

Description

@gezhicui

Problem Description
When using oxlint for code inspection, the following import statement was encountered:

import React, { useEffect } from 'react';

At this point, the useEffect function has not been used in the code, and oxlint reports an error:

Identifier 'useEffect' is imported but never used.
help: Consider removing this import.

When the editor enables the "auto-fix" function for saving, oxlint will automatically delete the entire line of the imported statement when saving, which means even React is also deleted.

Expected behavior

Oxlint should only remove unused import items of useEffect, and retain the React imports that still have practical uses

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