antfu / antfu/eslint-plugin-command
[BUG] `/// keep-sorted` error with "as const satisfies ..." combination
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 371
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Appears related to https://github.com/antfu/eslint-plugin-command/issues/25 but this is when satisfies is used with as const e,g. as const satisfies Record<string, Options>
The following produces the error on keep-sorted; [keep-sorted] error: Unable to find object/array/interface to sort
interface Option {
id: number
name: string
}
type Options = Record<string, Option>
/// keep-sorted
const options = {
status: {
on: {
id: 1,
name: 'On',
},
off: {
id: 2,
name: 'Off',
},
}
} as const satisfies Record<string, Options>
Reproduction
see above
System Info
System:
OS: Linux 6.6 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
Memory: 5.66 GB / 15.35 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 24.12.0 - /home/matth/.local/share/mise/installs/node/24.12.0/bin/node
Yarn: 4.9.4 - /usr/bin/yarn
npm: 11.6.2 - /home/matth/.local/share/mise/installs/node/24.12.0/bin/npm
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
Contributions
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)
Contributor 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.
Research direction
Start with the keep-sorted command and reproduce the reported TypeScript example using as const satisfies Record<string, Options>. Trace why the command cannot identify the object or array, then verify that the example is accepted and sorted correctly without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100