-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[import/no-duplicates] (prefer-inline) Autofix merges imports incorrectly #2792
Comments
Another broken Case 1: Merging type followed by non-type generates uncompilable code: input import type { TypeOne } from './other';
import { functionOne } from './other'; output import type { TypeOne , functionOne } from './other'; expected import { type TypeOne, functionOne } from './other'; Case 2: Merging non-type followed by type generates correct code but with unusual output spacing: input import { functionOne } from './other';
import type { TypeOne } from './other'; output import { functionOne ,type TypeOne } from './other' expected import { functionOne, type TypeOne } from './other' |
Another one: input import type React from 'react';
import { useId, useState } from 'react'; output import type React, { useId , useState } from 'react'; expected import type React from 'react';
import { useId, useState } from 'react'; |
Another case: Merging input import type Highcharts from 'highcharts'
import { type SankeyNodeObject } from 'highcharts' output import type Highcharts, { type SankeyNodeObject } from 'highcharts'; expected import { type default as Highcharts, type SankeyNodeObject } from 'highcharts'; Caution: Although following code looks similar to expected output, it will generate different compiled code from input when import type { default as Highcharts, SankeyNodeObject } from 'highcharts'; |
Ran into this today. Original code: import type { Knex } from 'knex';
import knex from 'knex'; Produces these warnings:
Auto-fixes to: import knex, type { Knex } from 'knex'; Then when running eslint again:
And also produces the following TypeScript error:
|
I'd +1 to @frantic1048's expectation rather than @dylang's, as per the rule name |
Config:
Case 1:
input
output
expected
Case 2:
input
output
expected
The text was updated successfully, but these errors were encountered: