You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(claude): add sorting + open-PR rules to CLAUDE.md
Fleet-wide propagation from meander (b0f0cb2 + db95184). Adds:
- "Sorting" subsection under Code Style: codifies the rule that
config lists, object keys, import specifiers, top-level function
placement, and set-like array literals all sort alphanumerically
(literal byte order). Position-bearing arrays opt out.
- "Open PRs" bullet under SHARED STANDARDS: when commits are added
to an open PR, the title + description must be rewritten to match.
Patch C (sort .claude/settings.json deny/allow) is N/A here —
this repo's settings.json has no permissions block.
Copy file name to clipboardExpand all lines: CLAUDE.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,6 +153,7 @@ See `docs/references/error-messages.md` for worked examples and anti-patterns.
153
153
## 📚 SHARED STANDARDS
154
154
155
155
- Commits: [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)`<type>(<scope>): <description>` — NO AI attribution
156
+
-**Open PRs:** when adding commits to an OPEN PR, ALWAYS update the PR title and description to match the new scope. A title like `chore: foo` after you've added security-fix and docs commits to it is now a lie. Use `gh pr edit <num> --title "..." --body "..."` (or `--body-file`) and rewrite the body so it reflects every commit on the branch, grouped by theme. The reviewer should be able to read the PR description and know what's in it without scrolling commits.
156
157
- Scripts: Prefer `pnpm run foo --flag` over `foo:bar` scripts
157
158
- Dependencies: After `package.json` edits, run `pnpm install`
158
159
- Backward Compatibility: 🚨 FORBIDDEN to maintain — actively remove when encountered
-**Exports**: Named only. `export default` FORBIDDEN (breaks dual CJS/ESM). Enforced by oxlint `no-default-export` + build + CI validation.
219
220
-**Function order**: Files with 3+ exports require alphabetical ordering — private first (alphabetical), then exported (alphabetical). Constants/types before functions.
220
221
222
+
### Sorting
223
+
224
+
Sort lists alphanumerically (literal byte order, ASCII before letters). Apply this to:
225
+
226
+
-**Config lists** — `permissions.allow` / `permissions.deny` in `.claude/settings.json`, `external-tools.json` checksum keys, allowlists in workflow YAML.
227
+
-**Object key entries** — sort keys in plain JSON config + return-shape literals + internal-state objects. (Exception: `__proto__: null` always comes first, ahead of any data keys.)
228
+
-**Import specifiers** — sort named imports inside a single statement: `import { encrypt, randomDataKey, wrapKey } from './crypto.mts'`. Imports that say `import type` follow the same rule. Statement *order* is the project's existing convention (`node:` → external → local → types) — that's separate from specifier order *within* a statement.
229
+
-**Method / function source placement** — within a module, sort top-level functions alphabetically. Convention: private functions (lowercase / un-exported) sort first, exported functions second. The first-line `export` keyword is the divider.
230
+
-**Array literals** — when the array is a config list, allowlist, or set-like collection. Position-bearing arrays (e.g. argv, anything where index matters semantically) keep their meaningful order.
231
+
232
+
When in doubt, sort. The cost of a sorted list that didn't need to be is approximately zero; the cost of an unsorted list that did need to be is a merge conflict.
233
+
221
234
### Package Exports
222
235
223
236
All modules exported via `package.json` exports field. When adding modules, update exports or run `scripts/generate-package-exports.mjs`.
0 commit comments