Skip to content
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/order] Breaking change in v2.27 #2722

Open
StefanoMagrassi opened this issue Feb 20, 2023 · 7 comments
Open

[import/order] Breaking change in v2.27 #2722

StefanoMagrassi opened this issue Feb 20, 2023 · 7 comments

Comments

@StefanoMagrassi
Copy link

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

@StefanoMagrassi StefanoMagrassi changed the title [import/order] Breaking change behavior in v2.27 [import/order] Breaking change in v2.27 Feb 20, 2023
@ljharb
Copy link
Member

ljharb commented Feb 20, 2023

I agree that it was an unintentional change, and also that the one that’s right in 2.26 is the right one. (i think the change you’re referencing was #2396)

@StefanoMagrassi
Copy link
Author

(i think the change you’re referencing was #2396)

yep

@7iomka
Copy link

7iomka commented Jun 2, 2023

Any news on this?

@ljharb
Copy link
Member

ljharb commented Jun 2, 2023

No, not yet, but it'd be great to get a PR up to fix it.

@7iomka
Copy link

7iomka commented Jun 2, 2023

No, not yet, but it'd be great to get a PR up to fix it.

Just revert #2396

@ljharb
Copy link
Member

ljharb commented Jun 3, 2023

@7iomka it may not be that simple; there may be some fixes in it that we'd need to keep.

@DaveTryon
Copy link

This is still broken in 2.28. We're hitting it in microsoft/accessibility-insights-web#6846. git bisect confirms that it broke in #2396

Here's a quick unit test to use as a reference:

    // Option alphabetize: {order: 'asc'} when folders and paths start with the same substring
    test({
      code: `
        import a from "foo/foobar-file";
        import b from "foo/foobar/file";
      `,
      options: [{ alphabetize: { order: 'asc' } }],
    }),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants