import-js/eslint-plugin-import

[import/order] Breaking change in v2.27

Open

#2,722 opened on Feb 20, 2023

View on GitHub
 (9 comments) (10 reactions) (0 assignees)JavaScript (1,540 forks)batch import
bughelp wanted

Repository metrics

Stars
 (4,946 stars)
PR merge metrics
 (Avg merge 138d 22h) (3 merged PRs in 30d)

Description

In version 2.27.0 it was introduced a new strategy which splits the imports paths in segments and compares them independently.

However, this leads to different results for the same inputs in some cases, for example:

import {screen} from '@testing-library/react';
import {checkDropdown} from '@testing/form';

this is the "right" order as by v2.26 because:

compareString('@testing-library/react', '@testing/form') === -1

but in v2.27 it is reported as error because:

compareString('@testing-library', '@testing') === 1

I don't know if the current behavior is the right one, but it is definitely a breaking change

Contributor guide