1.3 KiB
1.3 KiB
Code Style and Conventions
Naming Conventions
- Interfaces: Prefix with
I(e.g.,IUserData) - Types: Prefix with
T(e.g.,TResponseType) - Files: Always lowercase (e.g.,
classes.clamavservice.ts) - Classes: PascalCase (e.g.,
ClamAvService) - Methods/Functions: camelCase (e.g.,
scanBuffer) - Avoid ENums when possible
TypeScript Patterns
- TypeScript-first approach with full type safety
- ES modules (type: "module" in package.json)
- Import dependencies in
ts/plugins.ts - Reference with full path:
plugins.myModule.myClass()
File Organization
- Source code in
ts/directory - Tests in
test/directory - Distribution in
dist_ts/directory - Use
.jsextensions in imports for ES modules
Testing Patterns
- Use @git.zone/tstest framework
- Import expect from @push.rocks/tapbundle
- Test files end with
export default tap.start() - Test naming:
*.both.ts,*.node.ts,*.browser.ts - EICAR test string for antivirus verification
General Principles
- Make RAZOR SHARP changes - every modification must be goal-oriented
- Improve elegance - changes should enhance clarity and maintainability
- Preserve necessary complexity - don't oversimplify
- Keep async patterns - maintain Promises where they add value
- Remove redundancy carefully while preserving functionality