Bad automated fix for `no-duplicates` when using Flow.
#2,691 opened on Jan 23, 2023
Repository metrics
- Stars
- (4,946 stars)
- PR merge metrics
- (Avg merge 138d 22h) (3 merged PRs in 30d)
Description
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.