javascript-practices
JS/TS conventions for syntax, modules, and types. Use when writing or reviewing JavaScript/TypeScript code.
javascript
practices
SKILL.mddata/javascript-practices
GitHubJavaScript/TypeScript Practices
How TypeScript is written in pkg/@eserstack/*: modules, runtime access, types,
tests and React UI.
Always
- Always import as a namespace (
import * as path from "@std/path"), in code, tests, JSDoc@exampleblocks and READMEs alike; the only exception isruntimefrom@eserstack/standards/cross-runtime - Named exports on the declaration; no default exports except where laroux loads
a module's
default - Relative imports carry the
.tsextension; a package's entry ismod.ts; noexport * - File system, env and process access goes through
runtime, neverDeno.*orprocess.envin library code - Only booleans use implicit checks; defaults use
??, never|| validate-code-conventions(indeno task cli ok) enforces the import and||rules on new code; existing violations sit in.eser/baselines/code-conventions.json, which only ever shrinksnullfor absent values you define;instanceoffor object typesreturn awaitin async functions; every promise is awaited or owned- Tests are co-located
*.test.ts, run withdeno task cli test deno fmtanddeno lintenforce formatting and the basics; run them instead of hand-checking
References
| File | Read when |
|---|---|
| modules.md | Adding imports or exports, creating a module or mod.ts |
| syntax-and-types.md | Runtime APIs, paths, checks, conversions, async functions |
| testing.md | Writing or running TypeScript tests |
| react.md | Building React components, styles or UI states |