Skip to content

[New] order: add orderByFullPathString option #3196

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tw3
Copy link

@tw3 tw3 commented Jun 27, 2025

No description provided.

Copy link

codecov bot commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (01c9eb0) to head (5700f01).

Files with missing lines Patch % Lines
src/rules/order.js 0.00% 5 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (01c9eb0) and HEAD (5700f01). Click for more details.

HEAD has 18 uploads less than BASE
Flag BASE (01c9eb0) HEAD (5700f01)
24 6
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #3196       +/-   ##
==========================================
- Coverage   82.25%   0.00%   -82.26%     
==========================================
  Files          94      94               
  Lines        4283    4262       -21     
  Branches     1478    1427       -51     
==========================================
- Hits         3523       0     -3523     
- Misses        760    4262     +3502     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Looks like there's some uncovered lines, so we'll need some more test cases.

@ljharb ljharb changed the title feat(order): add orderBySplitPaths option [New] order: add orderByFullPathString option Jul 1, 2025
@@ -385,6 +385,8 @@ Valid properties and their values include:

- **`caseInsensitive`**: use `true` to ignore case and `false` to consider case when sorting

- **`orderByFullPathString`**: use `false` to split by paths and sort by each one and `true` to sort by the full un-split path string
Copy link
Member

Choose a reason for hiding this comment

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

is there a better way to phrase this?

like, perhaps one way sorts the way certain operating systems and IDEs do, and the other sorts the way other ones do? (with an example list of each)

@@ -385,6 +385,9 @@ Valid properties and their values include:

- **`caseInsensitive`**: use `true` to ignore case and `false` to consider case when sorting

- **`orderByFullPathString`**: use `true` to sort by the full un-split path string and `false` to split by paths and sort by each one
- enabling this flag may better align with the sort algorithm used by certain operating systems and IDE's, e.g. the Organize Imports action in JetBrains IDE's
Copy link
Member

Choose a reason for hiding this comment

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

sorry to ask for more work, but i'd love some research on lists for both of the options :-)

Copy link
Author

@tw3 tw3 Jul 1, 2025

Choose a reason for hiding this comment

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

personally I'm only aware of the impact to Organize Imports in WebStorm b/c that is what has affected me and my team

not sure how i would find other impacted examples

i know that other people have taken note of this difference: #2722

apparently this has had an effect on Microsoft's accessibility-insights-web tool

microsoft/accessibility-insights-web#6846

should i add that to the markup?

Copy link
Member

Choose a reason for hiding this comment

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

That'd be great!

How does your local OS sort these things?

Copy link
Author

@tw3 tw3 Jul 1, 2025

Choose a reason for hiding this comment

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

Here's a video demo of the Organize Imports behavior in WebStorm IDE:

org-imports-demo-video.mp4

Ideally Jetbrains would make the sort algorithm for Organize Imports configurable from their end, but unfortunately that isn't currently possible.

So without a change in this plugin my team will either need to:

  • Stay on version 2.26 of this plugin, or
  • Always sort according to Eslint and no longer use the action in WebStorm, or
  • Choose a different/simpler import plugin that "vibes" with WebStorm

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that makes sense :-)

I meant, in Mac and Windows, say, if you name a bunch of empty files as the specifier names, how does it sort them?

Copy link
Author

@tw3 tw3 Jul 1, 2025

Choose a reason for hiding this comment

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

This is what I see on Windows

image

This does indeed list files according to the new split-by-path-then-order algorithm

Or were you looking for something different?

Copy link
Member

Choose a reason for hiding this comment

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

Nope, that's perfect! I believe Mac works the same way.

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

Successfully merging this pull request may close these issues.

2 participants