tz-clean 2.0.0 โ 2.0.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/.dependency-cruiser.cjs +94 -94
- package/.github/workflows/ci.yml +42 -42
- package/.husky/commit-msg +1 -1
- package/.husky/pre-commit +1 -1
- package/.husky/pre-push +3 -3
- package/.prettierrc +9 -9
- package/README-DEV.md +123 -123
- package/README-USER.md +56 -56
- 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 +52 -52
- package/index.js +262 -261
- package/knip.json +5 -5
- package/package.json +67 -67
- package/report-template.html +357 -357
- package/tsconfig.json +16 -16
- package/.tz-clean-report.html +0 -413
package/README-USER.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
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
|
-
You can install this package globally using npm to use it across all your projects:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install -g tz-clean
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
_(Note: If published under a scoped name, the command might be `npm install -g @your-username/tz-clean`)_
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
Navigate to any project directory where you want to clean your code and simply run:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
tz-clean
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Skipping Specific Tools
|
|
29
|
-
|
|
30
|
-
You can selectively disable any of the integrated tools by passing the corresponding flag:
|
|
31
|
-
|
|
32
|
-
- `--no-prettier`: Disables auto-formatting with Prettier.
|
|
33
|
-
- `--no-eslint`: Disables linting and auto-fixing with ESLint.
|
|
34
|
-
- `--no-typecheck`: Disables TypeScript validation.
|
|
35
|
-
|
|
36
|
-
**Example:**
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
tz-clean --no-prettier --no-typecheck
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### What it does:
|
|
43
|
-
|
|
44
|
-
The tool will sequentially run the following tasks on your project (unless disabled):
|
|
45
|
-
|
|
46
|
-
1. **Prettier**: Formats your code to ensure consistent styling.
|
|
47
|
-
2. **ESLint**: Lints your code and automatically fixes fixable issues.
|
|
48
|
-
3. **TypeScript Validation**: Runs `tsc --noEmit` to check for type errors.
|
|
49
|
-
|
|
50
|
-
### Viewing the Report
|
|
51
|
-
|
|
52
|
-
After analysis, you will be prompted to choose how you want to view the results:
|
|
53
|
-
|
|
54
|
-
1. **Terminal Summary**: A quick overview printed directly in your terminal, including a list of auto-fixed files and detailed error logs.
|
|
55
|
-
2. **UI Dashboard (Browser)**: Generates a beautiful HTML report and automatically opens it in your default web browser.
|
|
56
|
-
3. **UI Dashboard (Hosted)**: Spawns a local server on port `8080` to host the HTML report, 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
|
+
You can install this package globally using npm to use it across all your projects:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g tz-clean
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
_(Note: If published under a scoped name, the command might be `npm install -g @your-username/tz-clean`)_
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Navigate to any project directory where you want to clean your code and simply run:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
tz-clean
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Skipping Specific Tools
|
|
29
|
+
|
|
30
|
+
You can selectively disable any of the integrated tools by passing the corresponding flag:
|
|
31
|
+
|
|
32
|
+
- `--no-prettier`: Disables auto-formatting with Prettier.
|
|
33
|
+
- `--no-eslint`: Disables linting and auto-fixing with ESLint.
|
|
34
|
+
- `--no-typecheck`: Disables TypeScript validation.
|
|
35
|
+
|
|
36
|
+
**Example:**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
tz-clean --no-prettier --no-typecheck
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### What it does:
|
|
43
|
+
|
|
44
|
+
The tool will sequentially run the following tasks on your project (unless disabled):
|
|
45
|
+
|
|
46
|
+
1. **Prettier**: Formats your code to ensure consistent styling.
|
|
47
|
+
2. **ESLint**: Lints your code and automatically fixes fixable issues.
|
|
48
|
+
3. **TypeScript Validation**: Runs `tsc --noEmit` to check for type errors.
|
|
49
|
+
|
|
50
|
+
### Viewing the Report
|
|
51
|
+
|
|
52
|
+
After analysis, you will be prompted to choose how you want to view the results:
|
|
53
|
+
|
|
54
|
+
1. **Terminal Summary**: A quick overview printed directly in your terminal, including a list of auto-fixed files and detailed error logs.
|
|
55
|
+
2. **UI Dashboard (Browser)**: Generates a beautiful HTML report and automatically opens it in your default web browser.
|
|
56
|
+
3. **UI Dashboard (Hosted)**: Spawns a local server on port `8080` to host the HTML report, 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,52 +1,52 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import jsdoc from 'eslint-plugin-jsdoc';
|
|
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
|
-
js.configs.recommended,
|
|
11
|
-
...tseslint.configs.recommended,
|
|
12
|
-
sonarjs.configs.recommended,
|
|
13
|
-
jsdoc.configs['flat/recommended'],
|
|
14
|
-
perfectionist.configs['recommended-natural'],
|
|
15
|
-
{
|
|
16
|
-
languageOptions: {
|
|
17
|
-
ecmaVersion: 2022,
|
|
18
|
-
globals: {
|
|
19
|
-
...globals.browser,
|
|
20
|
-
...globals.node,
|
|
21
|
-
...globals.jquery,
|
|
22
|
-
console: 'readonly',
|
|
23
|
-
document: 'readonly',
|
|
24
|
-
module: 'readonly',
|
|
25
|
-
window: 'readonly',
|
|
26
|
-
},
|
|
27
|
-
sourceType: 'module',
|
|
28
|
-
},
|
|
29
|
-
plugins: {
|
|
30
|
-
'project-structure': projectStructure,
|
|
31
|
-
},
|
|
32
|
-
rules: {
|
|
33
|
-
'@typescript-eslint/naming-convention': [
|
|
34
|
-
'error',
|
|
35
|
-
{ format: ['camelCase'], selector: 'default' },
|
|
36
|
-
{ format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow', selector: 'variable' },
|
|
37
|
-
{ format: ['camelCase'], leadingUnderscore: 'allow', selector: 'parameter' },
|
|
38
|
-
{ format: ['PascalCase'], selector: 'typeLike' },
|
|
39
|
-
{ format: null, selector: 'objectLiteralProperty' },
|
|
40
|
-
],
|
|
41
|
-
complexity: ['warn', { max: 15 }],
|
|
42
|
-
'jsdoc/require-jsdoc': 'warn',
|
|
43
|
-
'jsdoc/require-param': 'warn',
|
|
44
|
-
'jsdoc/require-returns': 'warn',
|
|
45
|
-
'no-redeclare': 'off',
|
|
46
|
-
'no-undef': 'off',
|
|
47
|
-
'no-unused-vars': ['error', { args: 'none', vars: 'local' }],
|
|
48
|
-
'no-useless-assignment': 'off',
|
|
49
|
-
'no-useless-escape': 'off',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
];
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
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
|
+
js.configs.recommended,
|
|
11
|
+
...tseslint.configs.recommended,
|
|
12
|
+
sonarjs.configs.recommended,
|
|
13
|
+
jsdoc.configs['flat/recommended'],
|
|
14
|
+
perfectionist.configs['recommended-natural'],
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
ecmaVersion: 2022,
|
|
18
|
+
globals: {
|
|
19
|
+
...globals.browser,
|
|
20
|
+
...globals.node,
|
|
21
|
+
...globals.jquery,
|
|
22
|
+
console: 'readonly',
|
|
23
|
+
document: 'readonly',
|
|
24
|
+
module: 'readonly',
|
|
25
|
+
window: 'readonly',
|
|
26
|
+
},
|
|
27
|
+
sourceType: 'module',
|
|
28
|
+
},
|
|
29
|
+
plugins: {
|
|
30
|
+
'project-structure': projectStructure,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
'@typescript-eslint/naming-convention': [
|
|
34
|
+
'error',
|
|
35
|
+
{ format: ['camelCase'], selector: 'default' },
|
|
36
|
+
{ format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow', selector: 'variable' },
|
|
37
|
+
{ format: ['camelCase'], leadingUnderscore: 'allow', selector: 'parameter' },
|
|
38
|
+
{ format: ['PascalCase'], selector: 'typeLike' },
|
|
39
|
+
{ format: null, selector: 'objectLiteralProperty' },
|
|
40
|
+
],
|
|
41
|
+
complexity: ['warn', { max: 15 }],
|
|
42
|
+
'jsdoc/require-jsdoc': 'warn',
|
|
43
|
+
'jsdoc/require-param': 'warn',
|
|
44
|
+
'jsdoc/require-returns': 'warn',
|
|
45
|
+
'no-redeclare': 'off',
|
|
46
|
+
'no-undef': 'off',
|
|
47
|
+
'no-unused-vars': ['error', { args: 'none', vars: 'local' }],
|
|
48
|
+
'no-useless-assignment': 'off',
|
|
49
|
+
'no-useless-escape': 'off',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|