forked from stevermeister/windsurfrules-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypescript.windsurfrules
116 lines (100 loc) · 2.79 KB
/
typescript.windsurfrules
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# TypeScript Project - Project Guidelines
## Project Overview
...Your project short description...
Pure TypeScript project following TypeScript best practices and modern JavaScript patterns.
## Development Guidelines
### Project Structure
- Use proper module organization:
- `src/` for source files
- `types/` for type definitions
- `tests/` for test files
- `dist/` for compiled output
- Follow proper file naming conventions:
- Use `.ts` extension
- Use `.d.ts` for type definitions
- Use `.spec.ts` for tests
### TypeScript Configuration
- Use strict TypeScript settings:
- `strict: true`
- `noImplicitAny: true`
- `strictNullChecks: true`
- `strictFunctionTypes: true`
- `noImplicitThis: true`
- `useUnknownInCatchVariables: true`
- Configure proper module resolution
- Set appropriate target version
- Configure proper source maps
### Coding Standards
- Use proper type definitions:
- Prefer interfaces for object types
- Use type aliases for union types
- Implement proper generics
- Use proper utility types
- Follow functional programming principles:
- Use immutable data structures
- Implement proper error handling
- Use proper async patterns
- Use modern TypeScript features:
- Template literal types
- Conditional types
- Mapped types
- Index types
### Code Quality Tools
- Pre-commit hooks:
- ESLint with TypeScript rules
- Prettier for formatting
- TypeScript compilation check
- Unit test execution
- Additional checks:
- Circular dependency check
- Dead code elimination
- Import organization
- Type coverage check
### Development Environment
#### Requirements
- Node.js version: 20.x
- TypeScript: 5.x
- Package manager: npm/yarn/pnpm
- Build tool: tsc/esbuild/swc
#### Testing Requirements
- Jest with ts-jest
- Test files must be named `*.spec.ts`
- Coverage threshold: 85%
- Implement proper type testing
- Use proper mocking patterns
#### Dependencies
Core dependencies:
- TypeScript 5.x
- ESLint
- Prettier
- Jest
- ts-node for development
#### Production Requirements
- Configure proper build process
- Implement proper tree-shaking
- Configure proper source maps
- Set up proper error tracking
- Implement proper logging
### Type Guidelines
- Use proper type declarations:
- Avoid `any` type
- Use proper union types
- Implement proper generics
- Use proper utility types
- Follow type naming conventions:
- PascalCase for types
- Prefix interfaces with 'I'
- Use proper type composition
### Error Handling
- Use proper error types
- Implement proper error handling
- Use proper async/await patterns
- Implement proper type guards
- Use proper assertion functions
### Required Configuration Files
- tsconfig.json
- .eslintrc.js
- .prettierrc
- jest.config.js
- package.json
Reference `tsconfig.example.json` for required compiler options.