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

keep-sorted for subset of object keys #23

Open
3 tasks done
TomerAberbach opened this issue Jul 13, 2024 · 3 comments
Open
3 tasks done

keep-sorted for subset of object keys #23

TomerAberbach opened this issue Jul 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@TomerAberbach
Copy link

TomerAberbach commented Jul 13, 2024

Clear and concise description of the problem

For example, suppose you have:

const object = {
  // Group of entries
  b: true,
  c: true,
  a: true,

  // Other group of entries
  z: true,
  x: true,
  y: true,
}

It would be nice if I could add keep-sorted above a group of entries to sort them separately. Right now adding the comment above one of the groups results in:

[keep-sorted] error: Unable to find object/array/interface to sort  command/command

Suggested solution

Allow keep-sorted above a group of entries

Alternative

No response

Additional context

No response

Validations

@TomerAberbach TomerAberbach added the enhancement New feature or request label Jul 13, 2024
@TomerAberbach TomerAberbach changed the title keep-sorted for subset of object keys keep-sorted for subset of object keys Jul 13, 2024
@TomerAberbach
Copy link
Author

I'd be willing to venture into the code and make a PR if you like the idea!

@antfu
Copy link
Owner

antfu commented Jul 15, 2024

I am not sure about the complexity. But if you don't mind the effort, feel free to send a PR so we can discuss it. I do like the start and end marker like you proposed in #24

@TomerAberbach
Copy link
Author

Sounds good. Not 100% sure yet when I'll have time to try it out, but hoping to make an attempt at the start/end marker approach soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants