[Fix] order: do not compare first path segment for relative paths by mihkeleidast · Pull Request #2885 · import-js/eslint-plugin-import (original) (raw)

Conversation

@mihkeleidast

Should fix the regression in #2682.

The gist of the fix is that for relative paths, siblings always start with "." and parents always start with "..". When comparing them, it will always result in "." being first, which was the bug. The sorting based on subpath segments should start from the second path segment, when there is a possibility that one of them is different.

@mihkeleidast @ljharb

@mihkeleidast mihkeleidast changed the titlefix(import/order): do not compare first sibling and parent path segment fix(import/order): do not compare first path segment for relative paths

Sep 26, 2023

Pearce-Ropion

@ljharb

Can you add the exact test case from the OP of #2682?

@mihkeleidast

@ljharb added! This was a good suggestion, as that particular case needed additional handling.

@mihkeleidast

Not sure what is going on with the failing actions, do not seem related to my changes?

@ljharb

@acidoxee

Hi everyone, do you reckon this PR has a reason to be blocked? Like a lot of people, I've been sticking with v2.26.0 of this plugin since #2682 has been a thing, and I'd very much like to get back to being up-to-date and with imports in the right order 😉

@hood hood mentioned this pull request

Nov 2, 2023

@hood

Any news here? PR looks fine, any blockers I can help getting rid of?

@mihkeleidast

Any news here? PR looks fine, any blockers I can help getting rid of?

I think while my fix does work for some of the reported issues, some would still not be fixed by this, e.g. #2722

I could not fix the other issues, so gave up as it does not affect my usecases as much. But probably would help if the fix would resolve all of the different issues that have been reported.

ljharb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as existing tests pass :-)

@ljharb ljharb changed the titlefix(import/order): do not compare first path segment for relative paths [Fix] order: do not compare first path segment for relative paths

Aug 30, 2024

renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request

Sep 4, 2024

@renovate

datasource package from to
npm eslint-plugin-import 2.29.1 2.30.0

v2.30.0

Added
Fixed
Changed

@NOUIY NOUIY mentioned this pull request

Sep 25, 2024

This was referenced

Sep 26, 2024

@qdraw qdraw mentioned this pull request

Sep 28, 2024

This was referenced

Oct 3, 2024

This was referenced

Oct 4, 2024

@qdraw qdraw mentioned this pull request

Oct 25, 2024

This was referenced

Oct 28, 2024

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

Labels