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 by keys, for ObjectExpression #21

Open
3 tasks done
GauBen opened this issue Jun 18, 2024 · 1 comment
Open
3 tasks done

/// keep-sorted by keys, for ObjectExpression #21

GauBen opened this issue Jun 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@GauBen
Copy link
Contributor

GauBen commented Jun 18, 2024

Clear and concise description of the problem

Hey there, still me!

I'd like to sort an object by keys, but it is only supported for arrays as of now:

// @keep-sorted {"keys":["label"]}
export default <Record<Enum, { icon: string; label: string }>>{
  ANALYTICS: { icon: 'chart-mixed', label: 'Analytics' },
  EVENT_MANAGEMENT: { icon: 'calendar-days', label: 'Calendar' },
  CLOUD_STORAGE: { icon: 'sensor-cloud', label: 'Cloud' },
  HEALTH: { icon: 'house-medical', label: 'Health' },
};
[keep-sorted] error: Only arrays can be sorted by keys, but got ObjectExpression

Suggested solution

Alternative

No response

Additional context

Thanks for your help!

(Can you guess which command I use the most? Is it OCD? 👀)

Validations

@GauBen GauBen added the enhancement New feature or request label Jun 18, 2024
@antfu
Copy link
Owner

antfu commented Jun 18, 2024

PR welcome :)

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