typescript-and-lint-rules
Enforces Pocket Arcade's strict TypeScript 6 tsconfigs, ESLint 9 flat config, Prettier and size limits. Use when writing or splitting .ts/.tsx or fixing a tsc or lint error. Not for gate wiring (quality-gates), names (naming-conventions) or import zones (architecture-and-boundaries).
- License 许可
- MIT
- 最近更新
- 2026-11-05
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- typescript-and-lint-rules
- description
- Enforces Pocket Arcade's strict TypeScript 6 tsconfigs, ESLint 9 flat config, Prettier and size limits. Use when writing or splitting .ts/.tsx or fixing a tsc or lint error. Not for gate wiring (quality-gates), names (naming-conventions) or import zones (architecture-and-boundaries).
02 资源文件 161
- 资产文件assets/shared.json1.2 KB
- 资产文件assets/ts-lint-baseline.json24.3 KB
- 其他examples/buy-button.tsx954 B
- 脚本examples/parse-level-param.test.ts833 B
- 脚本examples/parse-level-param.ts1.2 KB
- 脚本examples/score-level.test.ts1.2 KB
- 脚本examples/score-level.ts2.3 KB
- 参考文档examples/splitting-a-long-function.md4.3 KB
- 脚本examples/use-report-error.ts474 B
- 脚本examples/with-timeout.test.ts1.1 KB
- 脚本examples/with-timeout.ts875 B
- 参考文档references/code-policies.md10.0 KB
- 参考文档references/eslint-config-guide.md16.1 KB
- 参考文档references/forbidden-patterns.md14.4 KB
- 参考文档references/limits-and-splitting.md5.5 KB
- 参考文档references/tsconfig-set.md12.4 KB
- 脚本scripts/check-configs.mjs22.8 KB
- 脚本scripts/check-lib.mjs44.4 KB
- 脚本scripts/check-source.mjs13.4 KB
- 脚本scripts/lib/source-scan.mjs16.0 KB
- 脚本scripts/lib/workspaces.mjs1.3 KB
- 脚本scripts/selftest.mjs730 B
- 其他templates/.prettierignore528 B
- 参考文档templates/.prettierrc.json203 B
- 脚本templates/app-env.d.ts392 B
- 脚本templates/eslint.config.mjs35.1 KB
- 脚本templates/result.ts581 B
- 参考文档templates/tsconfig.app.json331 B
- 参考文档templates/tsconfig.base.json878 B
- 参考文档templates/tsconfig.game-kit.json198 B
- 参考文档templates/tsconfig.root.json332 B
- 参考文档templates/tsconfig.shell.json209 B
- 参考文档templates/tsconfig.tooling.json206 B
- 脚本tests/fixtures/check-configs/bad-eslint-att-open/eslint.config.mjs35.0 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-att-open/EXPECT.txt59 B
- 脚本tests/fixtures/check-configs/bad-eslint-att-unbanned/eslint.config.mjs35.0 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-att-unbanned/EXPECT.txt35 B
- 脚本tests/fixtures/check-configs/bad-eslint-gaps/eslint.config.mjs35.6 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-gaps/EXPECT.txt597 B
- 脚本tests/fixtures/check-configs/bad-eslint-gaps/research/tools/check-toy.mjs74 B
- 脚本tests/fixtures/check-configs/bad-eslint-messages/eslint.config.mjs35.0 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-messages/EXPECT.txt247 B
- 参考文档tests/fixtures/check-configs/bad-eslint-stray/.eslintrc.json18 B
- 脚本tests/fixtures/check-configs/bad-eslint-stray/eslint.config.mjs35.3 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-stray/EXPECT.txt183 B
- 脚本tests/fixtures/check-configs/bad-eslint-stray/packages/shell/eslint.config.mjs19 B
- 脚本tests/fixtures/check-configs/bad-eslint-weakened/eslint.config.mjs35.5 KB
- 参考文档tests/fixtures/check-configs/bad-eslint-weakened/EXPECT.txt275 B
- 参考文档tests/fixtures/check-configs/bad-package/EXPECT.txt281 B
- 参考文档tests/fixtures/check-configs/bad-package/package.json880 B
- 其他tests/fixtures/check-configs/bad-prettier-ignore/.prettierignore511 B
- 参考文档tests/fixtures/check-configs/bad-prettier-ignore/.prettierrc.json203 B
- 参考文档tests/fixtures/check-configs/bad-prettier-ignore/EXPECT.txt336 B
- 参考文档tests/fixtures/check-configs/bad-prettier-ignore/exports/board.html44 B
- 参考文档tests/fixtures/check-configs/bad-prettier-ignore/notes.md8 B
- 参考文档tests/fixtures/check-configs/bad-prettier/.prettierrc.json204 B
- 参考文档tests/fixtures/check-configs/bad-prettier/EXPECT.txt139 B
- 脚本tests/fixtures/check-configs/bad-prettier/prettier.config.js21 B
- 其他tests/fixtures/check-configs/bad-tsconfig-app-navigation/.prettierignore521 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/.prettierrc.json203 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/apps/tile-drop/package.json114 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/apps/tile-drop/tsconfig.json246 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-app-navigation/eslint.config.mjs35.0 KB
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/EXPECT.txt124 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/handbook/README.md75 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/package.json879 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/game-kit/tsconfig.json198 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/shell/package.json142 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/shell/src/app-env.d.ts392 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/shell/tsconfig.json209 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/tooling/package.json110 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/packages/tooling/tsconfig.json206 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/tsconfig.base.json878 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-app-navigation/tsconfig.json332 B
- 其他tests/fixtures/check-configs/bad-tsconfig-missing/.prettierignore500 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/.prettierrc.json203 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/apps/tile-drop/package.json114 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/apps/tile-drop/tsconfig.json307 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-missing/eslint.config.mjs35.4 KB
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/EXPECT.txt94 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/package.json879 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/packages/game-kit/tsconfig.json198 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/packages/shell/package.json142 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-missing/packages/shell/src/app-env.d.ts46 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/packages/shell/tsconfig.json209 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/packages/tooling/package.json110 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/tsconfig.base.json878 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-missing/tsconfig.json332 B
- 其他tests/fixtures/check-configs/bad-tsconfig-weakened/.prettierignore500 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/.prettierrc.json203 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/apps/tile-drop/package.json114 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/apps/tile-drop/tsconfig.json299 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-weakened/eslint.config.mjs35.4 KB
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/EXPECT.txt462 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/package.json879 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/game-kit/tsconfig.json198 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/shell/package.json142 B
- 脚本tests/fixtures/check-configs/bad-tsconfig-weakened/packages/shell/src/app-env.d.ts392 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/shell/tsconfig.json278 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/tooling/package.json110 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/packages/tooling/tsconfig.json206 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/tsconfig.base.json887 B
- 参考文档tests/fixtures/check-configs/bad-tsconfig-weakened/tsconfig.json384 B
- 其他tests/fixtures/check-configs/good/.prettierignore521 B
- 参考文档tests/fixtures/check-configs/good/.prettierrc.json203 B
- 参考文档tests/fixtures/check-configs/good/apps/tile-drop/package.json114 B
- 参考文档tests/fixtures/check-configs/good/apps/tile-drop/tsconfig.json307 B
- 脚本tests/fixtures/check-configs/good/eslint.config.mjs35.0 KB
- 参考文档tests/fixtures/check-configs/good/handbook/README.md75 B
- 参考文档tests/fixtures/check-configs/good/package.json879 B
- 参考文档tests/fixtures/check-configs/good/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-configs/good/packages/game-kit/tsconfig.json198 B
- 参考文档tests/fixtures/check-configs/good/packages/shell/package.json142 B
- 脚本tests/fixtures/check-configs/good/packages/shell/src/app-env.d.ts392 B
- 参考文档tests/fixtures/check-configs/good/packages/shell/tsconfig.json209 B
- 参考文档tests/fixtures/check-configs/good/packages/tooling/package.json110 B
- 参考文档tests/fixtures/check-configs/good/packages/tooling/tsconfig.json206 B
- 参考文档tests/fixtures/check-configs/good/shell-slice.json68 B
- 参考文档tests/fixtures/check-configs/good/tsconfig.base.json878 B
- 参考文档tests/fixtures/check-configs/good/tsconfig.json332 B
- 参考文档tests/fixtures/check-source/bad-async-and-errors/apps/tile-drop/package.json114 B
- 参考文档tests/fixtures/check-source/bad-async-and-errors/EXPECT.txt412 B
- 参考文档tests/fixtures/check-source/bad-async-and-errors/package.json100 B
- 参考文档tests/fixtures/check-source/bad-async-and-errors/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-source/bad-async-and-errors/packages/shell/package.json142 B
- 其他tests/fixtures/check-source/bad-async-and-errors/packages/shell/src/screens/premium/restore-button.tsx582 B
- 脚本tests/fixtures/check-source/bad-async-and-errors/packages/shell/src/services/save/flush-save.ts246 B
- 参考文档tests/fixtures/check-source/bad-imports/apps/tile-drop/package.json114 B
- 脚本tests/fixtures/check-source/bad-imports/apps/tile-drop/src/board/draw-board.ts357 B
- 参考文档tests/fixtures/check-source/bad-imports/EXPECT.txt263 B
- 参考文档tests/fixtures/check-source/bad-imports/package.json100 B
- 参考文档tests/fixtures/check-source/bad-imports/packages/game-kit/package.json111 B
- 参考文档tests/fixtures/check-source/bad-imports/packages/shell/package.json142 B
- 参考文档tests/fixtures/check-source/bad-silenced/EXPECT.txt237 B
- 脚本tests/fixtures/check-source/bad-silenced/packages/shell/src/ui/level-label.ts335 B
- 参考文档tests/fixtures/check-source/bad-syntax/EXPECT.txt425 B
- 脚本tests/fixtures/check-source/bad-syntax/packages/shell/src/stores/theme-mode.ts476 B
- 脚本tests/fixtures/check-source/bad-too-big/apps/tile-drop/src/levels/level-table.ts1.7 KB
- 脚本tests/fixtures/check-source/bad-too-big/apps/tile-drop/src/rules/sum-values.ts1.5 KB
- 参考文档tests/fixtures/check-source/bad-too-big/EXPECT.txt374 B
- 脚本tests/fixtures/check-source/good/apps/tile-drop/app.config.ts194 B
- 参考文档tests/fixtures/check-source/good/apps/tile-drop/package.json114 B
- 脚本tests/fixtures/check-source/good/apps/tile-drop/src/rules/apply-move.test.ts1.3 KB
- 脚本tests/fixtures/check-source/good/apps/tile-drop/src/rules/apply-move.ts1.4 KB
- 脚本tests/fixtures/check-source/good/apps/tile-drop/src/rules/many-cases.test.ts5.2 KB
- 脚本tests/fixtures/check-source/good/apps/tile-drop/src/rules/score-level.ts2.1 KB
- 参考文档tests/fixtures/check-source/good/package.json100 B
- 参考文档tests/fixtures/check-source/good/packages/game-kit/package.json111 B
- 脚本tests/fixtures/check-source/good/packages/game-kit/src/contract/result.ts581 B
- 参考文档tests/fixtures/check-source/good/packages/shell/package.json142 B
- 脚本tests/fixtures/check-source/good/packages/shell/plugins/with-app-variant-marker.ts645 B
- 脚本tests/fixtures/check-source/good/packages/shell/src/app-env.d.ts392 B
- 其他tests/fixtures/check-source/good/packages/shell/src/screens/premium/buy-button.tsx783 B
- 脚本tests/fixtures/check-source/good/packages/shell/src/services/async/with-timeout.test.ts975 B
- 脚本tests/fixtures/check-source/good/packages/shell/src/services/async/with-timeout.ts876 B
- 脚本tests/fixtures/check-source/good/packages/shell/src/services/error-log/use-report-error.ts475 B
- 脚本tests/fixtures/check-source/good/packages/shell/src/services/purchase/read-revocation.ts541 B
- 脚本tests/fixtures/check-source/good/packages/tooling/src/report/print-report.ts233 B
03 SKILL.md 正文
TypeScript and lint rules
Every .ts/.tsx file in the monorepo compiles under one strict tsconfig set and passes one ESLint config with no warnings, no inline disables and hard size limits. No human reviews this code line by line, so style is enforced by machines or it does not exist. This skill holds the configs, the limits, the forbidden patterns, and two checkers that prove the repo still follows them.
Rules that must hold
- Never silence a gate. No
eslint-disable,@ts-ignoreor@ts-nocheck;@ts-expect-erroronly where a third-party type is wrong, with a reason of 10+ characters. Why: the most likely failure of an unsupervised agent is silencing a check, and inline config is switched off anyway. - One strict
tsconfig.base.jsonfor every workspace. A workspacetsconfig.jsonsets onlytypes,lib,includeandexclude. Why: one set of compiler guarantees for all ~26 apps. - Two worlds never mix. App code (types
jest, no Node) never imports a Node-world file, not even withimport type; Node code (tooling,packages/shell/src/config,packages/shell/plugins,app.config.ts) is never bundled into an app. Why: a type-only import pulls the file into the app program, whereprocessandnode:fsdo not type-check. - One ESLint config, errors only.
eslint.config.mjsat the root is the only config; every rule is an error, lint runs with--max-warnings 0, only through the npm scripts. An exception is a files-scoped block that rebuilds the rule from the shared lists, with a reason comment and aGate-Change:trailer. Why: CLI flags and fresh short lists silently weaken the gate (a later flat-config block replaces options, it does not merge). - Stay inside the limits. 250 code lines per file (400 in tests), 40 per
.tsfunction, 80 per.tsxcomponent, cyclomatic complexity 10 (modified), cognitive 15, nesting 3, 3 parameters (function types too), 3 nested callbacks (4 in tests), JSX depth 5, one component and one class per file. Why: small units are read whole in one read and fail in one place. - When a limit trips, split by responsibility. Extract named pure functions, a lookup table, an options object or a sub-component with its own test. Never join lines, never
part-2.ts, never move logic into JSON; large static data does go in.json. Why: the limit detects a symptom; gaming it keeps the problem. - Erasable TypeScript only. No
enum(use anas constarray and a union), nonamespace, no constructor parameter properties,typeinstead ofinterface(except merging in*.d.ts), noany, no non-null!in app code. Why: Node type stripping anderasableSyntaxOnly; unions work with exhaustive switches. - Named exports, explicit extensions, no
../.export defaultonly inapps/*/app.config.ts, config plugins and__mocks__. Import./x.tswithin a folder and@e07/<package>/<path-under-src>.tsacross folders. Why: greppable names; Node type stripping and theexportsmap need extensions. - Expected failures are values. Return
Result<TValue, TError>with akindunion (orT | null); thrownew Error(message, { cause })only for programmer errors. Everycatchmaps, records throughErrorLogPortwith a fallback, or rethrows withcause; no empty catch. Why: the type system forces callers to handle every case, and the local error log is the only trace. - No floating promises; handlers stay synchronous. Await, return, or end with
.catch(reportError);void promisedoes not count. AhandleXfunction or inlineon*prop is neverasync. Why: React Native's Strict API typesonPressas returningunknown, so an async handler's rejection vanishes. - Immutable data, pure deterministic rules.
readonlyeverywhere,as consttables, new objects instead of mutation; rules, levels and game-kit take time and seeds as values and use only integer-safe math. Why: replays, solvers and daily seeds must match on every device. - Prettier formats, pinned versions build. Prettier 3.9.9 is the only formatter; ESLint 9.39.5, TypeScript 6.0.3 and the plugins stay on the verified pins. A limit, pin or baseline change is an owner decision: stop and ask.
- Comments say why. Line 1 is
// <repo-relative path>; exported game-kit APIs, ports, stores and hooks get a one-sentence TSDoc contract; noTODO/FIXME/HACK, no commented-out code.
Workflow
- Pick the task: set up or change configs (step 2), write code (step 3), fix a
tscor lint error (step 4), or add an exception (step 5). Then always finish with step 6. - Configs. Read references/tsconfig-set.md and references/eslint-config-guide.md. Copy each template to its destination (table below), install the pinned versions from the guide's install command, then run
node ${CLAUDE_SKILL_DIR}/scripts/check-configs.mjs .. - Code. Before writing error handling, async code, a service or a new module, read the matching section of references/code-policies.md. Imitate examples/parse-level-param.ts (Result), examples/with-timeout.ts (timeouts as values) and examples/buy-button.tsx (synchronous handler). Keep every unit inside the limits from the start.
- Errors. Find the rule in references/forbidden-patterns.md and write the replacement it names. For a limit, read references/limits-and-splitting.md and follow examples/splitting-a-long-function.md. Never edit the config to make an error go away.
- Exception. Only for a tool or library contract. Follow "Adding an exception, step by step" in references/eslint-config-guide.md: a file-exact block, rebuilt from the shared lists, a reason comment,
--print-configproof, thequality-gates.jsonguardrail still green, and aGate-Change:trailer. A limit or baseline change: stop and ask the owner. - Check (validation loop). From the repo root, when
node_modulesexist:npm run typecheck,npm run lint,npm run format:check(before the scripts exist:npx tsc --noEmit -p <each project>,npx eslint . --max-warnings 0,npx prettier --check .). Always:node ${CLAUDE_SKILL_DIR}/scripts/check-source.mjs .andnode ${CLAUDE_SKILL_DIR}/scripts/check-configs.mjs .. Fix everyFAILline (each names the file, the rule and the fix) and rerun until all printRESULT: PASS.
Template destinations (the templates are the verified files; the monorepo-bootstrap skill writes the same bytes, because every template below is synced from one canonical copy in the skill library: never edit a copy here, edit the canonical file and run node skills/_library/sync-shared.mjs). The only thing to fill: the pre-existing top-level folders and files that are not monorepo code (knowledge folders, design exports, notes) go into PRE_EXISTING in eslint.config.mjs ('handbook/**') and replace __PRE_EXISTING__ in .prettierignore (handbook/); delete the placeholder line when there are none.
| Template | Destination in the app repo |
|---|---|
templates/tsconfig.base.json |
tsconfig.base.json |
templates/tsconfig.root.json |
tsconfig.json |
templates/tsconfig.game-kit.json |
packages/game-kit/tsconfig.json |
templates/tsconfig.shell.json |
packages/shell/tsconfig.json |
templates/tsconfig.tooling.json |
packages/tooling/tsconfig.json |
templates/tsconfig.app.json |
apps/<game-id>/tsconfig.json (every app) |
templates/eslint.config.mjs |
eslint.config.mjs |
templates/.prettierrc.json, templates/.prettierignore |
.prettierrc.json, .prettierignore |
templates/app-env.d.ts |
packages/shell/src/app-env.d.ts |
templates/result.ts |
packages/game-kit/src/contract/result.ts |
Definition of done
- [ ]
npm run typecheckpasses for every project (ornpx tsc --noEmit -pon the root and eachpackages/*,apps/*). - [ ]
npm run lintpasses with--max-warnings 0, andnpm run format:checkpasses. - [ ] No new
eslint-disable,@ts-ignoreor@ts-nocheck; any@ts-expect-errornames a third-party cause. - [ ] No file over 250 code lines (400 for tests), no function over 40 lines (80 for a component); every split was made by responsibility.
- [ ] Every new exported API in game-kit, ports, stores and hooks has a one-sentence TSDoc summary; no TODOs; no commented-out code.
- [ ] Every expected failure is a
Result(ornull) with akindunion; everycatchmaps, records or rethrows withcause; no floating promise, noasynchandler. - [ ] Any config exception is a named, commented, file-exact block committed with a
Gate-Change:trailer. - [ ]
node ${CLAUDE_SKILL_DIR}/scripts/check-configs.mjs .printsRESULT: PASS(the configs match the canonical set). - [ ]
node ${CLAUDE_SKILL_DIR}/scripts/check-source.mjs .printsRESULT: PASS
Anti-patterns
- Adding
eslint-disableor@ts-ignore"just this once". Inline config is inert and reported; the error is still there. Fix the code, or make a file-exact exception block for a real tool contract. - Raising a limit or turning a rule off in a later block.
check-configs.mjsreportseslint-limit-changedandeslint-rule-off. Split the code instead; limit changes are the owner's call. - Writing a fresh short list in an exception block.
'no-restricted-imports': ['error', { paths: [x] }]drops every other ban for those files. Rebuild fromRUNTIME_PATHSwithwithout(...)andrestrictedImports(...). - Compressing code to get under a limit. Joined lines, removed blank lines and nested ternaries make it worse and trip
no-nested-ternary. Extract named functions or a lookup table. import typefrom a Node-world file into app code. It still dragsprocessandnode:fsinto the app program. Put shared types in a neutral file.onPress={async () => ...}because it type-checks. The Strict API hides the rejection. Keep the handler synchronous and end the task with.catch(reportError).- Throwing for a corrupt save or bad outside input. Callers forget to catch. Return a
Resultwith akindunion (a movelistMovesdoes not list is the exception: the engine contract throws aRangeError). - Rewording a lint message or reformatting an option list in the config. The
quality-gates.jsonguardrail compares resolved values, including theRESTRICTED_PROPERTIESmessages, verbatim; copy the template exactly. - Declaring "the checkers pass" without running ESLint and tsc. The scripts mirror the rules most often broken;
npm run lintandnpm run typecheckare still the full gate.
Files in this skill
| File | What it is | Read/run when |
|---|---|---|
| references/tsconfig-set.md | Two worlds, the six tsconfig files, every compiler option, app-env.d.ts, Node-world rules |
Workflow step 2; a missing global or wrong program |
| references/eslint-config-guide.md | Versions and install, the blocks, file groups, shared lists, exemptions, adding an exception, message codes, Prettier | Workflow steps 2 and 5; an unclear lint message |
| references/limits-and-splitting.md | The limits table with rationale, how lines are counted, the move for each tripped limit | Workflow step 4 for a limit; before a large module |
| references/forbidden-patterns.md | Every rejected pattern, why, which rule, and what to write instead | Workflow step 4 |
| references/code-policies.md | Comments, error handling, async, immutability, dependency injection, imports | Workflow step 3 |
templates/tsconfig.base.json |
The shared strict compiler options (all templates/ files are synced from the library) |
Workflow step 2 |
templates/tsconfig.root.json |
Root program: tests and Node-side config (jest, node) |
Workflow step 2 |
templates/tsconfig.game-kit.json |
game-kit program (jest, lib: ESNext) |
Workflow step 2 |
templates/tsconfig.shell.json |
Shell program, without the Node-world src/config |
Workflow step 2 |
templates/tsconfig.tooling.json |
Tooling program (node, jest) |
Workflow step 2 |
templates/tsconfig.app.json |
Program of every game app, with app-env.d.ts and the Shell's route types react-navigation.d.ts (TS2769 "parameter of type never" without it) |
Workflow step 2; a new app |
templates/eslint.config.mjs |
The complete, verified ESLint 9 flat config | Workflow steps 2 and 5 |
templates/.prettierrc.json |
Prettier options | Workflow step 2 |
templates/.prettierignore |
Prettier ignore list (generated folders, snapshots, skills/, .claude/, the __PRE_EXISTING__ entries) |
Workflow step 2 |
templates/app-env.d.ts |
process and EXPO_PUBLIC_* declarations for app programs |
Workflow step 2; a new runtime env variable |
templates/result.ts |
The shared Result type with ok/err |
Workflow step 2 (game-kit setup) |
| examples/parse-level-param.ts | A parser of outside input returning Result instead of throwing (rules throw instead: the engine contract) |
Workflow step 3 |
| examples/parse-level-param.test.ts | Its test: success and each expected failure | Workflow step 3 |
| examples/with-timeout.ts | A timeout as an expected failure | Workflow step 3 (async adapters) |
| examples/with-timeout.test.ts | Fake-timer tests for it (the // allow-fake-timers: marker names why a logic test may use them) |
Workflow step 3 |
| examples/use-report-error.ts | The rejection handler hook for fire-and-forget work | Workflow step 3 (handlers) |
| examples/buy-button.tsx | A synchronous handler that starts async work | Workflow step 3 (handlers) |
| examples/splitting-a-long-function.md | A 44-line, complexity-12 function, its four lint errors, and the split | Workflow step 4 for a limit |
| examples/score-level.ts | The split result: options object, lookup tables, named steps | Workflow step 4 |
| examples/score-level.test.ts | Tests for each extracted piece | Workflow step 4 |
scripts/check-configs.mjs |
Checks tsconfigs, the ESLint config (with the guardrail-compared messages), Prettier and its ignore list, pre-existing top-level folders, pins and lint scripts against the baseline | Workflow steps 2, 5 and 6 |
scripts/check-source.mjs |
Checks every .ts/.tsx for silenced gates, limits, non-erasable syntax, exports, imports, handlers, errors |
Workflow step 6 |
scripts/lib/source-scan.mjs |
Dependency-free lexer: comments, strings, imports, functions, parameter lists (synced from the library, shared with naming-conventions and architecture-and-boundaries) | Only when changing a checker |
scripts/lib/workspaces.mjs |
Reads the workspace package names, for import-extension checks (synced from the library) | Only when changing a checker |
scripts/selftest.mjs |
Proves both checkers pass good fixtures and catch every planted bug | After changing a checker, the baseline or a template |
scripts/check-lib.mjs |
Shared script helper, synced from the library (do not edit here) | Never by hand |
assets/ts-lint-baseline.json |
The canonical compiler options, workspace worlds, required ESLint settings, limit values, pins | When a verified setting changes (owner decision) |
assets/shared.json |
Declares the shared files this skill copies in | When adding a shared file |
tests/fixtures/ |
Good and planted-bad inputs for the self-test (check-configs/good mirrors the templates) |
When adding a rule to a checker |
Related skills
naming-conventions- file, identifier, testID and key names (the naming rules inside this ESLint config).architecture-and-boundaries- which package may import which, app zones, ports and file placement.quality-gates- the npm scripts, hooks and the config guardrail that run these checks.react-components-and-hooks- the UI lint rules (primitives, memo, styles) in more depth.unit-and-component-tests- writing the tests that go with split-out functions.
04 同仓库更多 Skills
unit-and-component-tests
Sets up Jest and writes Pocket Arcade test code - three projects, RNTL 14 async via renderWithShell, root SDK mocks, fakes, fast-check, coverage, Stryker. Use when a test needs the Shell wrapper, a mock or a fake, or Jest fails. Not for the red-green loop (tdd-workflow) or goldens (golden-tests).
demo-skill
Builds a demo. Use when testing the pitfall checker.
demo-skill
Builds a demo. Use when testing the pitfall checker.
troubleshooting-playbook
Diagnoses and fixes Pocket Arcade failures with a catalogue of 300+ known ones (symptom, cause, fix). Use when something errors, crashes, hangs or renders wrong, or an error or log needs explaining. Not for gate setup (quality-gates) or running builds (ios-simulator-build, ios-release-testflight).
toybox-visual-parity
Proves a built Pocket Arcade screen matches its Toybox design screenshot (light/dark, en/fa) and drives the fixes: capture, element gates, sheets, sign-off. Use when any screen is built or changed, or for visual parity, design match, screenshot compare. Not for building screens (toybox-screens).
toybox-screens
Builds Pocket Arcade screens S1-S15 to their Toybox specs: layout, spacing, the exact screen-map testIDs, copy keys, every state, banner slots, reference images. Use when building or changing a screen, overlay or dialog. Not for components (toybox-components) or pixel compare (toybox-visual-parity).