ts-analyzer 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
# ts-analyzer
|
|
2
2
|
|
|
3
|
-
ts-analyzer
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
`ts-analyzer` is a comprehensive static analysis tool for checking TypeScript and JavaScript code quality, focusing on type safety, structural complexity, and identifying potential anti-patterns.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- Cyclomatic complexity and nesting depth analysis.
|
|
9
|
-
- Detection of anti-patterns like magic numbers, callback hell, and god files.
|
|
10
|
-
- Formatted output in Text, JSON, and HTML.
|
|
9
|
+
## ✨ Features
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- **TypeScript Safety Metrics**: Calculates your project's true type coverage by tracking `any` usage, explicit generics, optional properties, type assertions, and non-null assertions.
|
|
12
|
+
- **Code Complexity Analysis**: Measures Cyclomatic Complexity and Nesting Depth to ensure your code remains readable and maintainable.
|
|
13
|
+
- **Anti-Pattern & Code Smell Detection**: Highlights potential red flags such as "Magic Numbers", "Callback Hell", "God Files" (>500 lines), and overly complex functions (excessive parameters).
|
|
14
|
+
- **Flexible Reporting**: Generate beautiful HTML dashboards, parsable JSON payloads, or read insights directly in your terminal.
|
|
15
|
+
- **High Reliability**: The tool is extensively tested with a robust **~88% test coverage** powered by Vitest, ensuring calculations remain accurate.
|
|
16
|
+
|
|
17
|
+
## 🚀 Quick Start
|
|
18
|
+
|
|
19
|
+
Run it directly on any project using `npx`:
|
|
13
20
|
|
|
14
21
|
```bash
|
|
15
22
|
npx ts-analyzer
|
|
16
23
|
```
|
|
17
24
|
|
|
18
|
-
## Usage
|
|
25
|
+
## 📦 Usage
|
|
19
26
|
|
|
20
27
|
Analyze a specific directory:
|
|
21
28
|
```bash
|
|
@@ -23,22 +30,29 @@ ts-analyzer /path/to/project
|
|
|
23
30
|
```
|
|
24
31
|
|
|
25
32
|
Available options:
|
|
26
|
-
- `-f, --format <type>`: `text`, `json`, or `html
|
|
27
|
-
- `-e, --exclude <patterns>`: Comma-separated ignore patterns.
|
|
28
|
-
- `--no-safety`: Skip type-safety analysis.
|
|
29
|
-
- `--no-complexity`: Skip complexity analysis.
|
|
33
|
+
- `-f, --format <type>`: Select report format (`text`, `json`, or `html`).
|
|
34
|
+
- `-e, --exclude <patterns>`: Comma-separated ignore patterns (e.g. `node_modules,dist`).
|
|
35
|
+
- `--no-safety`: Skip type-safety analysis to speed up processing.
|
|
36
|
+
- `--no-complexity`: Skip structural complexity analysis.
|
|
37
|
+
|
|
38
|
+
## 🛠 Development
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
The repository uses modern open-source tooling, and features comprehensive test suites.
|
|
41
|
+
|
|
42
|
+
Install dependencies:
|
|
43
|
+
```bash
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
32
46
|
|
|
33
|
-
Run tests:
|
|
47
|
+
Run tests (powered by Vitest):
|
|
34
48
|
```bash
|
|
35
49
|
npm test
|
|
36
50
|
```
|
|
37
51
|
|
|
38
|
-
Generate coverage:
|
|
52
|
+
Generate coverage reports:
|
|
39
53
|
```bash
|
|
40
54
|
npm run test:coverage
|
|
41
55
|
```
|
|
42
56
|
|
|
43
|
-
## License
|
|
57
|
+
## 📝 License
|
|
44
58
|
MIT
|
package/package.json
CHANGED