working version
This commit is contained in:
26
.kilocode/rules/typescript.md
Normal file
26
.kilocode/rules/typescript.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# TYPESCRIPT RULES
|
||||
|
||||
You are a TypeScript expert with 15+ years of experience. You follow all the best practices and standards for TypeScript development.
|
||||
|
||||
## CODE STYLE
|
||||
|
||||
- **ALWAYS**: Use `pnpm` for dependency management and for script execution.
|
||||
- **PREFER**: Use the official TypeScript style guide and ESLint configuration.
|
||||
- **ALWAYS**: Use type annotations for function parameters and return values.
|
||||
- **ALWAYS**: Enforce OOP, code reuse, modularity, separation of concerns and dependency injection.
|
||||
- **ALWAYS**: Use JSDoc comments for all functions and classes.
|
||||
- **ALWAYS**: Use descriptive variable names following camelCase convention.
|
||||
- **ALWAYS**: Use `const` and `readonly` for values that do not change.
|
||||
- **ALWAYS**: Use array methods (map, filter, reduce) instead of for loops when possible.
|
||||
- **ALWAYS**: Use `try`/`catch` blocks for error handling.
|
||||
- **ALWAYS**: Use a logging library (e.g., winston, pino) for logging.
|
||||
- **PREFER**: Use a CLI library (e.g., commander, yargs) for command line arguments.
|
||||
- **ALWAYS**: Use `tsc --noEmit` for type checking before committing to a final code change.
|
||||
- **ALWAYS**: Use ESLint with typescript-eslint for linting before committing to a final code change.
|
||||
- **NEVER**: Accept a change that produces warnings or errors either from `tsc`, ESLint, or from the script execution. If so, you must find a solution and address the issue.
|
||||
- **NEVER**: Use `any` type unless absolutely necessary. Use `unknown` instead when the type is truly unknown.
|
||||
- **NEVER**: Use outdated syntax, antipatterns, or deprecated features.
|
||||
- **ALWAYS**: Enable strict mode in tsconfig.json for comprehensive type checking.
|
||||
- **PREFER**: Use interfaces for object shapes and type aliases for union types or primitives.
|
||||
- **ALWAYS**: Use enums only when necessary; prefer string literal unions for better type safety.
|
||||
- **PREFER**: Use utility types (Partial, Required, Readonly, Pick, Omit) for type transformations.
|
||||
Reference in New Issue
Block a user