Keep-sorted Feature Enhancement (Map and Array)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- eslint, typescript
- Domain
- tooling
Research direction
Start by tracing the existing @keep-sorted handling and its current sorting behavior. Reproduce the examples for string arrays, Map entries, and dotted keys, then determine how the requested ordering should interact with existing object sorting. Done means these cases are consistently sorted and covered by the project's relevant tests.
Written by the indexing model from the issue text.
Description
Clear and concise description of the problem
Add sorting for items in Map and Array.
Suggested solution
Support for Strings in Arrays
If there is support for objects in arrays, I believe it is also necessary to support strings in arrays.
Before implementation
// @keep-sorted
const arr = [
`b`,
`a`,
`c`,
]
After implementation
// @keep-sorted
const arr = [
`a`,
`b`,
`c`,
]
Currently, I can only use it like this
// @keep-sorted
const arr = objToArr({
b: true,
a: true,
c: true,
})
Support for Map
Before
// @keep-sorted
const map = new Map([
[`c`, `cc`],
[`a`, `aa`],
])
After
// @keep-sorted
const map = new Map([
[`a`, `aa`],
[`c`, `cc`],
])
Adjust Sorting Rules
Expect the order a before a.b, rather than after, using ASCII ascending order.
Current Sorting
// @keep-sorted
const obj = {
'a.1': true,
'a': true,
'b': true,
'c': true,
}
Expected Sorting
// @keep-sorted
const obj = {
'a': true,
'a.1': true,
'a.2': true,
'b': true,
'c': true,
}
If it conflicts with the currently implemented sorting method, could sorting be supported as a parameter?
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
- Dominant language
- TypeScript
- Stars
- 372
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from antfu/eslint-plugin-command
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
antfu/eslint-plugin-command#45 · 2 comments · 2 reactions ·
-
help wanted
Difficulty 3/5 1-2 days Newbie friendliness 35/100
antfu/eslint-plugin-command#26 · 3 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
antfu/eslint-plugin-command#23 · 3 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
antfu/eslint-plugin-command#17 · 2 comments ·
All issues in antfu/eslint-plugin-command
Similar issues
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
ranxianglei/billion-context#7860 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
agent-oc-find-bugs api complexity → simple payment-methods recurring contributions reviewed stripe
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opencollective/opencollective#9177 ·