1.2 KiB
1.2 KiB
Coding Standards for npmextra
Naming Conventions
- Interfaces: Prefix with
I
(e.g.,IAppDataOptions
,ITestOptions
) - Types: Prefix with
T
(e.g.,TKeyValueStore
) - Filenames: Always lowercase (e.g.,
npmextra.classes.appdata.ts
) - Module structure:
npmextra.<type>.<name>.ts
pattern
Import/Export Patterns
- Use ES module syntax (
import
/export
) - Import all dependencies through
npmextra.plugins.ts
- Reference with full path:
plugins.moduleName.className()
- Export all public APIs through
index.ts
TypeScript Patterns
- Use generic types for flexibility (
<T = any>
) - Leverage TypeScript utility types from
@tsclass/tsclass
- Use async/await for asynchronous operations
- Use Promises with smartpromise utilities
Testing Standards
- Import expect from
@git.zone/tstest/tapbundle
- Test files end with
export default tap.start()
- Use descriptive test names with
tap.test()
- Test file naming:
test.*.ts
pattern
Code Quality
- Make focused, goal-oriented changes
- Preserve necessary complexity
- Remove redundancy carefully
- Keep async patterns where they add value
- No comments unless explicitly requested