tz-clean 2.3.2 → 2.3.3
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/.dependency-cruiser.cjs +93 -94
- package/.github/workflows/ci.yml +42 -42
- package/.prettierrc +9 -9
- package/README-DEV.md +123 -123
- package/README-USER.md +105 -105
- package/README.md +16 -16
- package/__tests__/cli.test.js +8 -8
- package/commitlint.config.js +1 -1
- package/cspell.json +33 -33
- package/eslint.config.mjs +72 -66
- package/index.js +357 -428
- package/knip.json +5 -5
- package/package.json +67 -67
- package/report-template.html +357 -357
- package/tsconfig.json +16 -16
package/README-USER.md
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
# User Guide: tz-clean 📖
|
|
2
|
-
|
|
3
|
-
This guide provides instructions on how to install and use the `tz-clean` CLI tool in your projects.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- **Node.js** installed on your machine.
|
|
8
|
-
- A `tsconfig.json` file must exist in the root of the project where you run this tool (required for the typechecking step).
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
Install globally using npm to use it across all your projects:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install -g tz-clean
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
To update to the latest version:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install -g tz-clean@latest
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
Navigate to any project directory and run:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
tz-clean
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Skipping Specific Tools
|
|
33
|
-
|
|
34
|
-
Disable any of the integrated tools with the corresponding flag:
|
|
35
|
-
|
|
36
|
-
| Flag
|
|
37
|
-
|
|
38
|
-
| `--no-prettier`
|
|
39
|
-
| `--no-eslint`
|
|
40
|
-
| `--no-typecheck` | Disables TypeScript validation
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
tz-clean --no-prettier --no-typecheck
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Including Specific Paths
|
|
47
|
-
|
|
48
|
-
Use `--include` to run the tools only on specific files or directories (comma-separated):
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Analyze only the src folder
|
|
52
|
-
tz-clean --include src
|
|
53
|
-
|
|
54
|
-
# Analyze multiple folders
|
|
55
|
-
tz-clean --include src,app,lib
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Excluding Specific Paths
|
|
59
|
-
|
|
60
|
-
Use `--exclude` to skip files or directories (comma-separated):
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
# Exclude a single folder
|
|
64
|
-
tz-clean --exclude js/libs
|
|
65
|
-
|
|
66
|
-
# Exclude multiple folders
|
|
67
|
-
tz-clean --exclude js/libs,dist,vendor
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Combining Options
|
|
71
|
-
|
|
72
|
-
All flags can be combined freely:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# Analyze only src, skip typecheck
|
|
76
|
-
tz-clean --include src --no-typecheck
|
|
77
|
-
|
|
78
|
-
# Exclude generated files, skip prettier
|
|
79
|
-
tz-clean --exclude dist,vendor --no-prettier
|
|
80
|
-
|
|
81
|
-
# Include specific folder and exclude a subfolder within it
|
|
82
|
-
tz-clean --include src --exclude src/generated
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### What It Does
|
|
86
|
-
|
|
87
|
-
The tool runs the following tasks sequentially (unless disabled):
|
|
88
|
-
|
|
89
|
-
1. **Prettier** — Formats your code for consistent styling.
|
|
90
|
-
2. **ESLint** — Lints and auto-fixes fixable issues.
|
|
91
|
-
3. **TypeScript Validation** — Runs `tsc --noEmit` to check for type errors.
|
|
92
|
-
|
|
93
|
-
Files in the following locations are always skipped automatically:
|
|
94
|
-
|
|
95
|
-
- `node_modules/`
|
|
96
|
-
- `dist/`, `build/`, `vendor/`, `libs/`
|
|
97
|
-
- Any file matching `*.min.js` or `*.min.cjs`
|
|
98
|
-
|
|
99
|
-
### Viewing the Report
|
|
100
|
-
|
|
101
|
-
After analysis, you will be prompted to choose how to view the results:
|
|
102
|
-
|
|
103
|
-
1. **Terminal Summary** — A quick overview printed in your terminal, including auto-fixed files and detailed error logs.
|
|
104
|
-
2. **UI Dashboard (Browser)** — Generates an HTML report and opens it automatically in your default browser.
|
|
105
|
-
3. **UI Dashboard (Hosted)** — Starts a local server on port `8080` and opens `http://localhost:8080` in your browser.
|
|
1
|
+
# User Guide: tz-clean 📖
|
|
2
|
+
|
|
3
|
+
This guide provides instructions on how to install and use the `tz-clean` CLI tool in your projects.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- **Node.js** installed on your machine.
|
|
8
|
+
- A `tsconfig.json` file must exist in the root of the project where you run this tool (required for the typechecking step).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Install globally using npm to use it across all your projects:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g tz-clean
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To update to the latest version:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g tz-clean@latest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Navigate to any project directory and run:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
tz-clean
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Skipping Specific Tools
|
|
33
|
+
|
|
34
|
+
Disable any of the integrated tools with the corresponding flag:
|
|
35
|
+
|
|
36
|
+
| Flag | Description |
|
|
37
|
+
| ---------------- | -------------------------------------------- |
|
|
38
|
+
| `--no-prettier` | Disables auto-formatting with Prettier |
|
|
39
|
+
| `--no-eslint` | Disables linting and auto-fixing with ESLint |
|
|
40
|
+
| `--no-typecheck` | Disables TypeScript validation |
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
tz-clean --no-prettier --no-typecheck
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Including Specific Paths
|
|
47
|
+
|
|
48
|
+
Use `--include` to run the tools only on specific files or directories (comma-separated):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Analyze only the src folder
|
|
52
|
+
tz-clean --include src
|
|
53
|
+
|
|
54
|
+
# Analyze multiple folders
|
|
55
|
+
tz-clean --include src,app,lib
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Excluding Specific Paths
|
|
59
|
+
|
|
60
|
+
Use `--exclude` to skip files or directories (comma-separated):
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Exclude a single folder
|
|
64
|
+
tz-clean --exclude js/libs
|
|
65
|
+
|
|
66
|
+
# Exclude multiple folders
|
|
67
|
+
tz-clean --exclude js/libs,dist,vendor
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Combining Options
|
|
71
|
+
|
|
72
|
+
All flags can be combined freely:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Analyze only src, skip typecheck
|
|
76
|
+
tz-clean --include src --no-typecheck
|
|
77
|
+
|
|
78
|
+
# Exclude generated files, skip prettier
|
|
79
|
+
tz-clean --exclude dist,vendor --no-prettier
|
|
80
|
+
|
|
81
|
+
# Include specific folder and exclude a subfolder within it
|
|
82
|
+
tz-clean --include src --exclude src/generated
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### What It Does
|
|
86
|
+
|
|
87
|
+
The tool runs the following tasks sequentially (unless disabled):
|
|
88
|
+
|
|
89
|
+
1. **Prettier** — Formats your code for consistent styling.
|
|
90
|
+
2. **ESLint** — Lints and auto-fixes fixable issues.
|
|
91
|
+
3. **TypeScript Validation** — Runs `tsc --noEmit` to check for type errors.
|
|
92
|
+
|
|
93
|
+
Files in the following locations are always skipped automatically:
|
|
94
|
+
|
|
95
|
+
- `node_modules/`
|
|
96
|
+
- `dist/`, `build/`, `vendor/`, `libs/`
|
|
97
|
+
- Any file matching `*.min.js` or `*.min.cjs`
|
|
98
|
+
|
|
99
|
+
### Viewing the Report
|
|
100
|
+
|
|
101
|
+
After analysis, you will be prompted to choose how to view the results:
|
|
102
|
+
|
|
103
|
+
1. **Terminal Summary** — A quick overview printed in your terminal, including auto-fixed files and detailed error logs.
|
|
104
|
+
2. **UI Dashboard (Browser)** — Generates an HTML report and opens it automatically in your default browser.
|
|
105
|
+
3. **UI Dashboard (Hosted)** — Starts a local server on port `8080` and opens `http://localhost:8080` in your browser.
|
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# tz-clean 🧹
|
|
2
|
-
|
|
3
|
-
A global command-line utility to enforce consistent code quality across your projects. It automatically formats your code with **Prettier**, lints and fixes it with **ESLint**, and performs typechecking with **TypeScript**.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Prettier**: Formats all supported files in the target directory.
|
|
8
|
-
- **ESLint**: Lints and automatically fixes errors using the bundled configuration.
|
|
9
|
-
- **TypeScript**: Performs a type check (`tsc --noEmit`) to ensure type safety.
|
|
10
|
-
|
|
11
|
-
## Documentation
|
|
12
|
-
|
|
13
|
-
For more detailed information, please refer to the specific guides:
|
|
14
|
-
|
|
15
|
-
- 📖 **[User Guide](./README-USER.md)**: Installation, prerequisites, and usage instructions for end-users.
|
|
16
|
-
- 🛠️ **[Developer Guide](./README-DEV.md)**: Instructions for contributing, local testing, and publishing.
|
|
1
|
+
# tz-clean 🧹
|
|
2
|
+
|
|
3
|
+
A global command-line utility to enforce consistent code quality across your projects. It automatically formats your code with **Prettier**, lints and fixes it with **ESLint**, and performs typechecking with **TypeScript**.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Prettier**: Formats all supported files in the target directory.
|
|
8
|
+
- **ESLint**: Lints and automatically fixes errors using the bundled configuration.
|
|
9
|
+
- **TypeScript**: Performs a type check (`tsc --noEmit`) to ensure type safety.
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
For more detailed information, please refer to the specific guides:
|
|
14
|
+
|
|
15
|
+
- 📖 **[User Guide](./README-USER.md)**: Installation, prerequisites, and usage instructions for end-users.
|
|
16
|
+
- 🛠️ **[Developer Guide](./README-DEV.md)**: Instructions for contributing, local testing, and publishing.
|
package/__tests__/cli.test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
describe('tz-clean CLI environment', () => {
|
|
4
|
-
it('should have Vitest configured correctly', () => {
|
|
5
|
-
const tools = ['Prettier', 'ESLint'];
|
|
6
|
-
expect(tools.includes('ESLint')).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
});
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
describe('tz-clean CLI environment', () => {
|
|
4
|
+
it('should have Vitest configured correctly', () => {
|
|
5
|
+
const tools = ['Prettier', 'ESLint'];
|
|
6
|
+
expect(tools.includes('ESLint')).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
});
|
package/commitlint.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { extends: ['@commitlint/config-conventional'] };
|
|
1
|
+
export default { extends: ['@commitlint/config-conventional'] };
|
package/cspell.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2",
|
|
3
|
-
"language": "en",
|
|
4
|
-
"words": [
|
|
5
|
-
"terzogenito",
|
|
6
|
-
"vitest",
|
|
7
|
-
"depcruise",
|
|
8
|
-
"typecheck",
|
|
9
|
-
"jsdoc",
|
|
10
|
-
"eslint",
|
|
11
|
-
"prettier",
|
|
12
|
-
"husky",
|
|
13
|
-
"sonarjs",
|
|
14
|
-
"tseslint",
|
|
15
|
-
"commitlint",
|
|
16
|
-
"cjs",
|
|
17
|
-
"mjs",
|
|
18
|
-
"prompts",
|
|
19
|
-
"ecma",
|
|
20
|
-
"typeof",
|
|
21
|
-
"argv"
|
|
22
|
-
],
|
|
23
|
-
"ignorePaths": [
|
|
24
|
-
"node_modules",
|
|
25
|
-
".git",
|
|
26
|
-
"package-lock.json",
|
|
27
|
-
"coverage",
|
|
28
|
-
".tz-clean-report.html",
|
|
29
|
-
".husky",
|
|
30
|
-
"dist",
|
|
31
|
-
"**/*.md"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2",
|
|
3
|
+
"language": "en",
|
|
4
|
+
"words": [
|
|
5
|
+
"terzogenito",
|
|
6
|
+
"vitest",
|
|
7
|
+
"depcruise",
|
|
8
|
+
"typecheck",
|
|
9
|
+
"jsdoc",
|
|
10
|
+
"eslint",
|
|
11
|
+
"prettier",
|
|
12
|
+
"husky",
|
|
13
|
+
"sonarjs",
|
|
14
|
+
"tseslint",
|
|
15
|
+
"commitlint",
|
|
16
|
+
"cjs",
|
|
17
|
+
"mjs",
|
|
18
|
+
"prompts",
|
|
19
|
+
"ecma",
|
|
20
|
+
"typeof",
|
|
21
|
+
"argv"
|
|
22
|
+
],
|
|
23
|
+
"ignorePaths": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
".git",
|
|
26
|
+
"package-lock.json",
|
|
27
|
+
"coverage",
|
|
28
|
+
".tz-clean-report.html",
|
|
29
|
+
".husky",
|
|
30
|
+
"dist",
|
|
31
|
+
"**/*.md"
|
|
32
|
+
]
|
|
33
|
+
}
|
package/eslint.config.mjs
CHANGED
|
@@ -1,66 +1,72 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import noComments from 'eslint-plugin-no-comments';
|
|
3
|
-
import perfectionist from 'eslint-plugin-perfectionist';
|
|
4
|
-
import projectStructure from 'eslint-plugin-project-structure';
|
|
5
|
-
import sonarjs from 'eslint-plugin-sonarjs';
|
|
6
|
-
import globals from 'globals';
|
|
7
|
-
import tseslint from 'typescript-eslint';
|
|
8
|
-
|
|
9
|
-
export default [
|
|
10
|
-
{
|
|
11
|
-
ignores: [
|
|
12
|
-
'**/node_modules/**',
|
|
13
|
-
'**/*.min.js',
|
|
14
|
-
'**/*.min.cjs',
|
|
15
|
-
'**/*.bundle.js',
|
|
16
|
-
'**/dist/**',
|
|
17
|
-
'**/build/**',
|
|
18
|
-
'**/vendor/**',
|
|
19
|
-
'**/libs/**',
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
js.configs.recommended,
|
|
23
|
-
...tseslint.configs.recommended,
|
|
24
|
-
sonarjs.configs.recommended,
|
|
25
|
-
perfectionist.configs['recommended-natural'],
|
|
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
|
-
'no-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import noComments from 'eslint-plugin-no-comments';
|
|
3
|
+
import perfectionist from 'eslint-plugin-perfectionist';
|
|
4
|
+
import projectStructure from 'eslint-plugin-project-structure';
|
|
5
|
+
import sonarjs from 'eslint-plugin-sonarjs';
|
|
6
|
+
import globals from 'globals';
|
|
7
|
+
import tseslint from 'typescript-eslint';
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
{
|
|
11
|
+
ignores: [
|
|
12
|
+
'**/node_modules/**',
|
|
13
|
+
'**/*.min.js',
|
|
14
|
+
'**/*.min.cjs',
|
|
15
|
+
'**/*.bundle.js',
|
|
16
|
+
'**/dist/**',
|
|
17
|
+
'**/build/**',
|
|
18
|
+
'**/vendor/**',
|
|
19
|
+
'**/libs/**',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
js.configs.recommended,
|
|
23
|
+
...tseslint.configs.recommended,
|
|
24
|
+
sonarjs.configs.recommended,
|
|
25
|
+
perfectionist.configs['recommended-natural'],
|
|
26
|
+
{
|
|
27
|
+
files: ['index.js'],
|
|
28
|
+
rules: {
|
|
29
|
+
'no-comments/disallowComments': 'off',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
languageOptions: {
|
|
34
|
+
ecmaVersion: 2022,
|
|
35
|
+
globals: {
|
|
36
|
+
...globals.browser,
|
|
37
|
+
...globals.node,
|
|
38
|
+
...globals.jquery,
|
|
39
|
+
console: 'readonly',
|
|
40
|
+
document: 'readonly',
|
|
41
|
+
module: 'readonly',
|
|
42
|
+
window: 'readonly',
|
|
43
|
+
},
|
|
44
|
+
sourceType: 'module',
|
|
45
|
+
},
|
|
46
|
+
linterOptions: {
|
|
47
|
+
reportUnusedDisableDirectives: 'error',
|
|
48
|
+
},
|
|
49
|
+
plugins: {
|
|
50
|
+
'no-comments': noComments,
|
|
51
|
+
'project-structure': projectStructure,
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
'@typescript-eslint/naming-convention': [
|
|
55
|
+
'error',
|
|
56
|
+
{ format: ['camelCase'], selector: 'default' },
|
|
57
|
+
{ format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow', selector: 'variable' },
|
|
58
|
+
{ format: ['camelCase'], leadingUnderscore: 'allow', selector: 'parameter' },
|
|
59
|
+
{ format: ['PascalCase'], selector: 'typeLike' },
|
|
60
|
+
{ format: null, selector: 'objectLiteralProperty' },
|
|
61
|
+
],
|
|
62
|
+
complexity: ['warn', { max: 15 }],
|
|
63
|
+
'no-comments/disallowComments': 'warn',
|
|
64
|
+
'no-multiple-empty-lines': ['warn', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
65
|
+
'no-redeclare': 'off',
|
|
66
|
+
'no-undef': 'off',
|
|
67
|
+
'no-unused-vars': ['error', { args: 'none', vars: 'local' }],
|
|
68
|
+
'no-useless-assignment': 'off',
|
|
69
|
+
'no-useless-escape': 'off',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|