Skip to content

Bad automated fix for no-duplicates when using Flow. #2691

Open
@julienw

Description

@julienw

This could be related to #2475, but I'm not sure.
I got this error after upgrading, but not exactly the same one. I'm using Flow too.

I had some code like this:

import {
  withChartViewport,
  type WithChartViewport,
} from 'firefox-profiler/components/shared/chart/Viewport';
...
import type { Viewport } from 'firefox-profiler/components/shared/chart/Viewport';

After the change, the last import type was reported as an error and merged into the first one. This makes some sense, but this was merged incorrectly:

import {
  withChartViewport,
  type WithChartViewport,
  Viewport,
} from 'firefox-profiler/components/shared/chart/Viewport';

Notice that the word type is missing. Without it, Flow is erroring.
I could add it manually, the eslint wouldn't error then.

I simply have the rule configured like this:

    'import/no-duplicates': 'error',

So in short, in this case I think the error was right but the autofix wasn't.

Could be related to #2686 but I'm not sure because the error seems different.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions