Code rules: max depth 2, braces always, no scattered console, no sync fs at runtime, no hand-written validation regex, constants out of logic (org-wide, ratcheted)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- eslint, javascript, typescript
- Domain
- build-system, tooling
Research direction
Start by reading the @krizaka/config preset and rule registry at docs/standards/rules.json, then inspect the existing ratchet files and rule tests. The change spans shared configuration and every active TypeScript/JavaScript repository, so map the current rules and counts before estimating implementation. Done means the preset is released, rules are registered, active repos are green or ratcheted, and the Yororis lexicon files and lint step are removed from krizaka-com.
Written by the indexing model from the issue text.
Description
Why
Founder review, 2026-10-29, on krizaka-com scripts/lexicon.mjs check(): « for dans for dans for, avec des readFileSync, on bloque le process ; ce code n'est pas très sexy ». Two separate problems:
- Nesting. Three loops deep plus a condition, building an array by
push. It is hard to read and hard to test. The rules we have (Sonar S3776 at cognitive complexity 15, S2004) did not catch it: it scores under 15. - Synchronous I/O.
readFileSyncandexistsSyncin a loop. In a one-shot CLI script it blocks nothing: there is no concurrent work, and sync is even faster there. In code that serves requests, though (Next routes and server components, API handlers, workers, anything underapp/,src/or a package'ssrc/), it stalls the event loop for every user. The rule targets that case.
The rule (org-wide: every TypeScript/JavaScript repo, through @krizaka/config, conformance-checked)
- ESLint
max-depth: 2for loops and conditions inside one function, plusmax-nested-callbacks: 3. Above that, extract a named function, or write a pipeline (flatMap/filter/map) that returns the result instead of pushing into an outer array. - ast-grep
no-sync-fs-in-runtime. It refusesfs.*Sync(...)(readFileSync,writeFileSync,existsSync,readdirSync,statSync…) in runtime code:app/**,src/**,packages/*/src/**,apps/*/src/**, workers. Usefs/promiseswithPromise.allfor independent reads. It is allowed inscripts/**,tools/**,*.config.*and tests, where sync is correct. - Ratchet. Both rules start at today's counts (
lint-ratchet.json/sg-ratchet.json) and only go down. They go into the@krizaka/configpreset and the rule registry (docs/standards/rules.json), with rule tests (valid and invalid cases).
Founder additions (2026-10-29, same review)
- Braces always.
if,for,whileandelsealways take{}, even for one line. It reads better and avoids the classic mistake when a line is added later. ESLintcurly: ["error", "all"], auto-fixed by--fix. - No scattered
console.*. Logs go through the shared logger of@krizaka/*(levels, structure, redaction), neverconsole.log/console.errordirectly. ESLintno-consolein runtime code. CLI scripts print through one small output helper per script, notconsolecalls scattered through the code. - No hand-written patterns for common facts. Example from the review:
if (!/^\d{4}-\d{2}-\d{2}$/.test(date ?? "")). Dates, emails, URLs, slugs, phone numbers, postal codes and amounts are validated by the shared@krizaka/tshelpers (date through date-fns behind our facade; e.g.isIsoDate). A missing helper is added to the lib first (rule « Krizaka libs first »). ast-grepno-hand-written-validation-regexrefuses a regex literal tested against those shapes, with rule tests. - Text and constants out of the logic. Word lists, labels, thresholds and limits live in data: messages for words, a settings/constants module for numbers, the DB when the admin edits them. They never sit inline in a function. One common structure in every repo: each domain's defaults are declared once in a shared module (
@krizaka/*or the repo'sconfig/), and the host app can override them through a typedoverride(settings in the DB when the admin configures them). It is not one global grab-bag file: each domain owns its constants, in the same shape everywhere. This builds on the existingno-unjustified-numeric-exportrule.
Also
scripts/lexicon.mjs is the Yororis lexicon check. Yororis left the organisation (#413), so the script, scripts/lexicon-reviewed.json, the lexicon step of npm run lint and the AGENTS.md paragraph are dead code to remove in krizaka-com, not to rewrite.
Done when
- The preset is released, the rules are in the registry, and every active TS/JS repo is green or ratcheted at its count (« a rule reaches every repo »).
- krizaka-com: the Yororis lexicon is removed.
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- Avg merge
- 2h 49m
- Merged PRs (30d)
- 212
Getting set up
- No Dockerfile or Docker Compose file
- Has a 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 krizaka/.github
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
priority:P1 product:krizaka type:docs
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
standard(done): a feature is done on every surface of its product — web, admin, mobile, Mac and CLI — or says why notPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
Maintainers usually reply within 1 day
-
public
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
krizaka/.github#427 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
react/react-native#59693 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
C-untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
swoole/swoole-cli#1092 ·