eslint-plugin-command
eslint-plugin-command copied to clipboard
/// keep-sorted by keys, for ObjectExpression
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
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
PR welcome :)
Hi,@antfu @GauBen. I am willing to submit a PR ! Wondering if anyone is currently doing this work?