Error in user YAML: (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 2 column 8
---
description: Enforce strict typing when coding to ensure reliable TypeScript usage
globs: *.ts
alwaysApply: false
---
blefnk/rules 1.0.0
- Applies both to TypeScript and JavaScript
- Encourages strict, clear typing, and modern JS
- Prefer ESM over CommonJS.
- Avoid
any; useunknown, generics, or precise types. - Remove and unused variables and expressions.
- Use
as constfor exact object types. - Prefer
??over||for nullish coalescing. - Handle promises with
awaitor.then(). - Throw
Errorinstances, not strings or objects. - Avoid non-null assertions (
!) and redundant?.!. - Never use
eval()or dynamic code execution. - Use
importinstead ofrequire(). - Add comments for
@ts-<directive>usage. - Favor functional programming; limit OOP to custom errors.
- Ensure both operands of
+are the same type. - Use namespaces only for declaration merging; avoid
module. - Mark immutable component props as
readonly. - Use optional chaining (
?.) to prevent runtime errors. - Avoid redundant type annotations (e.g.,
function Example() { return true; }). - Prefer
[]over generic array constructors. - Prevent duplicate values in enums and union types.