-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtypescript.mdc
More file actions
34 lines (23 loc) · 1.58 KB
/
typescript.mdc
File metadata and controls
34 lines (23 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
description: TypeScript conventions for @contentstack/utils (src and tests)
globs:
- src/**/*.ts
- __test__/**/*.ts
alwaysApply: false
---
# TypeScript — `@contentstack/utils`
## Tooling
- **TypeScript ~4.9** (`package.json`, `tsconfig.json`).
- **Bundler output:** `tsc` emits to `dist/lib` with declarations in `dist/types`; **Rollup** produces `dist/index.es.js` (`rollup.config.js`).
- **Strict mode** is on with **`strictNullChecks: false`** — new code should still minimize unnecessary null/undefined gaps when touching APIs.
## Layout
- **Library code:** `src/**/*.ts` only (`tsconfig.json` `include`); **tests** are under `__test__/` (excluded from `tsc` program but type-checked via Jest/tsconfig paths).
- **Public exports:** Maintain **`src/index.ts`** as the single export surface unless intentionally adding secondary entry points.
## Style and lint
- Match existing naming (PascalCase types, camelCase functions, existing file layout under `Models/`, `nodes/`, `helper/`, `options/`).
- **ESLint** flat config: `eslint.config.js` — `@typescript-eslint` recommended for `__test__`; source files use `js.configs.recommended` baseline.
- **Prettier:** `npm run format` scopes `src/**/*.ts`; keep formatting consistent when editing tests too.
## JSON / assets
- **`src/assets/regions.json`:** Consumed by `src/endpoints.ts`; populated by **`npm run download-regions`** during `prebuild`. Do not assume the file is committed (see root `.gitignore`).
## Logging
- No shared logger dependency; avoid introducing `console` noise in library paths unless consistent with nearby code.