@razmans/ts-score-check
v1.0.7
Published
TypeScript score check
Maintainers
Readme
TypeScript Score Check
A CLI tool to score TypeScript code for best practices and simplicity.
Features
- Scores TypeScript files for adherence to best practices.
- Metrics evaluated:
- Avoid use of
any - Explicit return types for functions
- Use of access modifiers
- Code complexity
- Nesting depth
- Prefer
constoverlet - Avoid type assertions
- Use of
readonlyfor properties - Avoid use of
var - Use of optional chaining
- Avoid use of
- Human-readable and JSON output
- Suggestions for improving code quality
Usage
Command Line Interface
# Analyze a single file
npx @razmans/ts-score-check ./src/test.ts
# Analyze an entire directory
npx @razmans/ts-score-check ./srcOutput
For each file, you get:
- File path
- Score (0-100)
- Metrics breakdown (percentage for each metric)
- Suggestions for improvement
How Scoring Works
- Each metric is weighted (see
functions/helper.ts). - The score is a weighted sum of all metrics, normalized to 100.
- Suggestions are generated for metrics that are not perfect.
Project Structure
index.ts— CLI entry pointfunctions/— Scoring logic and helperstest/— Example TypeScript files for testing
Requirements
License
MIT
