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] Regression in 2.27.5 #2775

Closed
DaveTryon opened this issue May 2, 2023 · 3 comments
Closed

[import/order] Regression in 2.27.5 #2775

DaveTryon opened this issue May 2, 2023 · 3 comments

Comments

@DaveTryon
Copy link

The order rule in release 2.27.5 behaves differently than it did in 2.26.0. Specifically, if a file name has a sibling directory that starts with the same name, the files used to be listed before the directory. The order rule now wants to sort the files after the directory. As a reference, Prettier's behavior is consistent with 2.26.0.

To repro, add the following test case in tests/src/rules/order.js:

    // Option alphabetize: {order: 'asc'} and check for files that overlap a folder name
    test({
      code: `
        import a from "foo/bar-blah";
        import b from "foo/bar-other";
        import c from "foo/bar/blah";
      `,
      options: [{ alphabetize: { order: 'asc' } }],
    }),

2.26.0 sets the order to a, b, c. 2.27.5 wants the order to be c, a, b. The regression was introduced with #2396.

@DaveTryon DaveTryon changed the title regression in order rule in 2.27.5 [import/order] Regression in 2.27.5 May 2, 2023
@VincentMolinie
Copy link

I got the same issue 👍

// 2.27.5
import { isArray } from '@ember/array';
import { inject as service } from '@ember/service';
import { dasherize } from '@ember/string';
import JSONSerializer from '@ember-data/serializer/json';
import JSONAPISerializer from '@ember-data/serializer/json-api';

// 2.26.0
import JSONSerializer from '@ember-data/serializer/json';
import JSONAPISerializer from '@ember-data/serializer/json-api';
import { isArray } from '@ember/array';
import { inject as service } from '@ember/service';
import { dasherize } from '@ember/string';

@Mrtenz
Copy link

Mrtenz commented Jun 28, 2023

Running into this as well with relative imports:

// 2.27.5
import date from './date';
import { rootRealmGlobal } from '../globalObject';

// 2.26.0
import { rootRealmGlobal } from '../globalObject';
import date from './date';

@ljharb
Copy link
Member

ljharb commented Jun 28, 2023

I think this issue is a duplicate of #2682 (comment).

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
Mrtenz added a commit to MetaMask/snaps that referenced this issue Jun 30, 2023
* Add test-snaps site

* Move files around and fix some breaking changes

* Add license and update changelog

* Remove SCSS in favour of CSS

* Fix some issues with snaps

* Deploy test-snaps to GitHub Pages on release

* Fix secrets name

* Update icon

* Use publish_dir in action

* Use icon without padding

* Fix Rollup watch command

* Fix BIP-44 snap invalid coin type

* Fix copy issues

* Fix workflow file

* Remove unused workflow file

* Add basic README

* Update LavaMoat policies

* Pin eslint-plugin-import to 2.26.0 as workaround for regression

import-js/eslint-plugin-import#2775

* Revert "Pin eslint-plugin-import to 2.26.0 as workaround for regression"

This reverts commit 457d6fa.

* Swap out Gatsby for plain Webpack

* Build test-snaps in CI

* Revert some changes to yarn.lock

* Update LavaMoat policies

* Fix lint issues

* Update snap shasums

* Fix verify-tsconfig script

* Fix workflow name

* Fix `@metamask/providers` version

* Revert change to .yarnrc.yml

* Fix `@metamask/providers` version again
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