-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Regression in nested group order after v2.26 #2909
Comments
Per #2854 (comment), it seems the issue here is wanting to use groups to enforce line breaks AND wanting the order to matter within groups, whereas by default the point of groups is to define multiple import types that must be grouped together but within which group their type is irrelevant (and optionally to add a new line after each group) It seems there are few different configuration needs here:
The second one has changed a few times with recent releases and the documentation is slightly confusing since it says both "The enforced order is the same as the order of each element in a group" and "They can be mingled together", which are arguably in opposition and causing different understandings? @jraoult I think what you're after would essentially be @ljharb is it worth adding an extra configuration option to support these different use cases? I don't mind having a go at that, although I can't guarantee a quick turnaround! |
@yndajas, I appreciate you taking the time to look at that, and it seems like your proposal could work. I want to stress that I was happy with how it was pre-2.27. I'm reporting the regression in the following minor version jumps. The ordering inside the nested group changed from 2.27 and it should either be a major version jump or it is a regression and should be restored to the behaviour pre-2.27. I realise I'm probably nitpicking too much around semver semantic here but maybe it is easier to roll back to previous behaviour than introducing a new configuration? |
In terms of restoring semantic versioning principles, perhaps it would be a case of reverting the default (and clarifying the expected default in the docs), but I think combining that with a config extension might be useful to support both interpretations of the docs so it doesn't feel like a regression in the opposite direction 😅 |
I think that it's important to restore whatever default behavior in v2.26 wasn't broken, and I'm fine with adding options to keep the otherwise-reverted functionality. |
I confirm this behaviour is totally unexpected on my side too. My suggested import order post import ItemA from "./ItemA";
import ItemC from "../../ItemC";
import ItemB from "../ItemB"; |
Is that |
Pre- import ItemC from "../../ItemC";
import ItemB from "../ItemB";
import ItemA from "./ItemA"; Config excerpt: // ...
"import/order": [
"error",
{
"groups": [
["builtin", "external"],
[
"internal",
"parent",
"sibling",
"index",
"object",
"type",
"unknown"
]
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
// ... I also see discussion about this topic here: #2396 (comment) Which led to this PR (which is yet to be merged): #2885 And other related issues: #2682 |
@hood wow there are so many threads on this! It's difficult to synthesise all this and work out what's the original behaviour and what needs adding as a feature to avoid breaking the breaking changes 😅 seems like the documentation has confused others too |
The PR I linked fixed the issue at least partially. It'd be a good starting point to get that merged first, and then proceed to focus on restoring the remaining wrong behaviours IMHO. At its current state the plugin is not behaving in a predictable manner, and it's not backwards compatible, forcing pretty much everyone using relative imports on 2.26.0. I can help if needed. |
There is also another PR addressing this: #2721 |
This is a follow-up to #2854 (comment). I'm stuck in 2.26 because of a regression introduced in 2.27. Multiple reverts and updates try to fix the regression, but I still have a few spots where the regression shows up:
This is my configuration:
and typically, this used to pass in 2.26:
but fails after 2.26 with message:
../util/combineNullables.js import should occur after import of ./fraction.js
The text was updated successfully, but these errors were encountered: