docs(rules): update TypeScript and Angular rules for TS 7 and trim duplicates
TypeScript 7.0 ships the native compiler as tsc and drops options deprecated in 6.0. Angular 22 still requires TypeScript >=6.0.0 <6.1.0, so both rule sets now warn against moving Angular projects to TS 7, and the Angular index asks to check the Angular version first. TypeScript runtime safety adds error handling (Error objects only, cause chaining, unknown in catch, one error model per layer, no swallowed errors) plus exact decimals for money, ISO 8601 UTC dates, and Intl formatting. Angular adds per-route SSR render modes, a global ErrorHandler with provideBrowserGlobalErrorListeners, and translatable text with locale-aware formatting. Generic guidance that the TypeScript, refactoring, and UI/UX rules already cover is removed from the Angular rules, which shrink by about 7.5 percent despite the additions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
368cf5ee4a
commit
b6c33780c3
9 files changed
+43
-114
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
Apply these rules when changing package dependencies, module structure, imports, or public exports.
|
||||
|
||||
* Follow the project's existing module system and `tsconfig` consistently. For new configuration, use `module`/`moduleResolution` `nodenext` for code that Node runs directly (with explicit file extensions in relative imports) and `bundler` for bundled applications; `node`/`node10` resolution is deprecated since TypeScript 6.0.
|
||||
* Follow the project's existing module system and `tsconfig` consistently. For new configuration, use `module`/`moduleResolution` `nodenext` for code that Node runs directly (with explicit file extensions in relative imports) and `bundler` for bundled applications; `node`/`node10` resolution is deprecated since TypeScript 6.0. TypeScript 7.0 ships the native compiler as `tsc` and stops supporting options deprecated in 6.0, such as `target` `ES5`, `module` `AMD` or `System`, and `moduleResolution` `classic`; check that frameworks support TypeScript 7 before upgrading, because Angular 22, for example, requires TypeScript 6.0.
|
||||
* Enable `verbatimModuleSyntax` in new configuration and use `import type` for type-only imports.
|
||||
* When code runs through Node's built-in type stripping (on by default since Node 22.18 and 23.6, stable since 24.12), enable `erasableSyntaxOnly` (TypeScript 5.8+): enums, namespaces with runtime code, parameter properties, and `import =` aliases fail there.
|
||||
* Avoid mixing ESM and CommonJS without a compatibility need. `require()` of ES modules works by default from Node 20.19 and 22.12; on older runtimes, CommonJS cannot `require` an ES module.
|
||||
|
||||
@@ -11,3 +11,5 @@ Apply these rules when handling API payloads, user input, browser data, or other
|
||||
* For cookie-based authentication, preserve secure cookie attributes and the application's CSRF protections. Handle session tokens as the shared web security rule defines: prefer `HttpOnly` cookies or a backend-for-frontend, keep tokens the app must hold in memory, and never store refresh tokens in `localStorage` or `sessionStorage`.
|
||||
* Never expose secrets or sensitive data in output, logs, or errors. Client-side validation and route guards do not replace server-side authentication, authorization, or validation.
|
||||
* Bound input size, nesting, parsing work, and response size before processing untrusted JSON or other structured data.
|
||||
* Throw only `Error` objects, never strings or plain objects, and chain the original error with `{ cause }` when wrapping it. Keep `useUnknownInCatchVariables` (part of `strict`) and narrow caught values before use. Use one error model per layer, exceptions or result types, and never swallow errors silently.
|
||||
* Do not use binary floating point for money or other exact decimals; use integer minor units or a decimal library. Exchange dates as ISO 8601 in UTC, and format numbers, dates, and currencies for users with `Intl`.
|
||||
Reference in new issue
Block a user