@yuu1111/quality-check 0.3.0 → 0.4.0
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.ja.md +14 -10
- package/README.md +20 -13
- package/package.json +1 -1
- package/src/config.ts +3 -0
- package/src/engines.ts +8 -0
package/README.ja.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @yuu1111/quality-check
|
|
4
4
|
|
|
5
|
-
Projectごとのscriptから個別に呼んでいたBiome
|
|
5
|
+
Projectごとのscriptから個別に呼んでいたBiome、型検査、Knip、comment-check、document-style-check、TSDoc checkerを1つのCLIへまとめる baselineの差分判定もここで行う
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -28,6 +28,7 @@ import { defineConfig } from "@yuu1111/quality-check";
|
|
|
28
28
|
export default defineConfig({
|
|
29
29
|
engines: {
|
|
30
30
|
biome: true,
|
|
31
|
+
typecheck: true,
|
|
31
32
|
knip: true,
|
|
32
33
|
"comment-check": true,
|
|
33
34
|
"document-style-check": true,
|
|
@@ -64,17 +65,18 @@ quality-check: 1 of 3 engines failed
|
|
|
64
65
|
| `config` | engineごとの起動条件 |
|
|
65
66
|
| `baseline` | baseline fileのpath `false` なら差分判定を行わない |
|
|
66
67
|
|
|
67
|
-
engineは `biome` → `knip` → `comment-check` → `document-style-check` → `tsdoc-check` の順に実行する
|
|
68
|
+
engineは `biome` → `typecheck` → `knip` → `comment-check` → `document-style-check` → `tsdoc-check` の順に実行する
|
|
68
69
|
|
|
69
70
|
`engines` は起動の委任だけを表し、起動条件は `config` のengineの下へ置く engineが受け取る条件は次のとおり
|
|
70
71
|
|
|
71
|
-
| engine | 受け取る条件 |
|
|
72
|
-
|
|
73
|
-
| `biome` | `targets`、`args` 除外pathは `biome.json` が持つ |
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
72
|
+
| engine | 起動するcommand | 受け取る条件 |
|
|
73
|
+
|--------|-----------------|--------------|
|
|
74
|
+
| `biome` | `biome check` | `targets`、`args` 除外pathは `biome.json` が持つ |
|
|
75
|
+
| `typecheck` | `tsc --noEmit` | `args` 設定は `tsconfig.json` が持つ |
|
|
76
|
+
| `knip` | `knip` | `args` 設定は `knip.ts` が持つ |
|
|
77
|
+
| `comment-check` | `comment-check --json` | `ignore`、`targets`、`args` |
|
|
78
|
+
| `document-style-check` | `document-style-check lint --json` | `ignore`、`targets`、`args` |
|
|
79
|
+
| `tsdoc-check` | `tsdoc-check --json` | `ignore`、`targets`、`args`、`error`(違反として扱うrule名) |
|
|
78
80
|
|
|
79
81
|
`args` はengineの既定引数の後ろへ足す 設定fileで表せない起動条件や、engineの引数が変わったときの逃げ道として使う
|
|
80
82
|
|
|
@@ -101,10 +103,12 @@ engineが受け取らない条件を書いた場合は渡さず、その旨を
|
|
|
101
103
|
biome: ignore skipped (biome.json holds its settings)
|
|
102
104
|
```
|
|
103
105
|
|
|
104
|
-
Biome
|
|
106
|
+
Biome、型検査、Knipの設定は `biome.json`、`tsconfig.json`、`knip.ts` が持つ このCLIは同じfileからengineの起動と結果の集約だけを行う
|
|
105
107
|
|
|
106
108
|
`comment-check` はbaseline差分を無効化する未作成のpathを渡して起動する 新規と解消済みの判定はengineごとではなく統合CLIが1つのbaseline fileで行うため、既存の `comment-baseline.json` がある場合は `--update-baseline` で移す
|
|
107
109
|
|
|
110
|
+
`typecheck` は `tsc --noEmit` を回すだけなので、tsconfigを複数持つProjectは対象のtsconfigごとに起動する必要がある
|
|
111
|
+
|
|
108
112
|
## License
|
|
109
113
|
|
|
110
114
|
MIT
|
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# @yuu1111/quality-check
|
|
4
4
|
|
|
5
|
-
Runs Biome, Knip, comment-check, document-style-check, and the
|
|
6
|
-
from one CLI instead of one script per project. The baseline diff
|
|
5
|
+
Runs Biome, the type checker, Knip, comment-check, document-style-check, and the
|
|
6
|
+
TSDoc checker from one CLI instead of one script per project. The baseline diff
|
|
7
|
+
lives here too.
|
|
7
8
|
|
|
8
9
|
## Install
|
|
9
10
|
|
|
@@ -30,6 +31,7 @@ import { defineConfig } from "@yuu1111/quality-check";
|
|
|
30
31
|
export default defineConfig({
|
|
31
32
|
engines: {
|
|
32
33
|
biome: true,
|
|
34
|
+
typecheck: true,
|
|
33
35
|
knip: true,
|
|
34
36
|
"comment-check": true,
|
|
35
37
|
"document-style-check": true,
|
|
@@ -67,19 +69,20 @@ quality-check: 1 of 3 engines failed
|
|
|
67
69
|
| `config` | Conditions of each engine |
|
|
68
70
|
| `baseline` | Baseline file path; `false` disables the diff |
|
|
69
71
|
|
|
70
|
-
Engines run in the order `biome`, `knip`, `comment-check`,
|
|
72
|
+
Engines run in the order `biome`, `typecheck`, `knip`, `comment-check`,
|
|
71
73
|
`document-style-check`, `tsdoc-check`.
|
|
72
74
|
|
|
73
75
|
`engines` only delegates the start-up, and the conditions belong under the
|
|
74
|
-
engine in `config`. Each engine
|
|
76
|
+
engine in `config`. Each engine runs:
|
|
75
77
|
|
|
76
|
-
| Engine | Conditions |
|
|
77
|
-
|
|
78
|
-
| `biome` | `targets`, `args`; `biome.json` holds the excluded paths |
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
78
|
+
| Engine | Command | Conditions |
|
|
79
|
+
|--------|---------|------------|
|
|
80
|
+
| `biome` | `biome check` | `targets`, `args`; `biome.json` holds the excluded paths |
|
|
81
|
+
| `typecheck` | `tsc --noEmit` | `args`; `tsconfig.json` holds the settings |
|
|
82
|
+
| `knip` | `knip` | `args`; `knip.ts` holds the settings |
|
|
83
|
+
| `comment-check` | `comment-check --json` | `ignore`, `targets`, `args` |
|
|
84
|
+
| `document-style-check` | `document-style-check lint --json` | `ignore`, `targets`, `args` |
|
|
85
|
+
| `tsdoc-check` | `tsdoc-check --json` | `ignore`, `targets`, `args`, `error` (rule names to fail on) |
|
|
83
86
|
|
|
84
87
|
`args` is appended after the engine defaults, for conditions the config cannot
|
|
85
88
|
express and for the case where an engine changes its arguments.
|
|
@@ -109,14 +112,18 @@ so:
|
|
|
109
112
|
biome: ignore skipped (biome.json holds its settings)
|
|
110
113
|
```
|
|
111
114
|
|
|
112
|
-
Biome and Knip keep their
|
|
113
|
-
CLI starts the engines from one file and
|
|
115
|
+
Biome, the type checker, and Knip keep their settings in `biome.json`,
|
|
116
|
+
`tsconfig.json`, and `knip.ts`. This CLI starts the engines from one file and
|
|
117
|
+
aggregates the results.
|
|
114
118
|
|
|
115
119
|
`comment-check` runs with an unwritten baseline path so that it reports every
|
|
116
120
|
finding. The new-and-resolved diff is done by this CLI from a single baseline
|
|
117
121
|
file, so an existing `comment-baseline.json` is moved over with
|
|
118
122
|
`--update-baseline`.
|
|
119
123
|
|
|
124
|
+
`typecheck` only runs `tsc --noEmit`, so a project with more than one tsconfig
|
|
125
|
+
has to start it once per target.
|
|
126
|
+
|
|
120
127
|
## License
|
|
121
128
|
|
|
122
129
|
MIT
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { pathToFileURL } from "node:url";
|
|
|
7
7
|
*/
|
|
8
8
|
export const ENGINE_NAMES = [
|
|
9
9
|
"biome",
|
|
10
|
+
"typecheck",
|
|
10
11
|
"knip",
|
|
11
12
|
"comment-check",
|
|
12
13
|
"document-style-check",
|
|
@@ -43,6 +44,7 @@ export interface TsdocCheckOptions extends EngineOptions {
|
|
|
43
44
|
*/
|
|
44
45
|
export interface EngineConfigMap {
|
|
45
46
|
biome: EngineOptions;
|
|
47
|
+
typecheck: EngineOptions;
|
|
46
48
|
knip: EngineOptions;
|
|
47
49
|
"comment-check": EngineOptions;
|
|
48
50
|
"document-style-check": EngineOptions;
|
|
@@ -95,6 +97,7 @@ function isEngineName(value: string): value is EngineName {
|
|
|
95
97
|
|
|
96
98
|
const ENGINE_OPTION_KEYS: Record<EngineName, readonly string[]> = {
|
|
97
99
|
biome: ["args", "ignore", "targets"],
|
|
100
|
+
typecheck: ["args", "ignore", "targets"],
|
|
98
101
|
knip: ["args", "ignore", "targets"],
|
|
99
102
|
"comment-check": ["args", "ignore", "targets"],
|
|
100
103
|
"document-style-check": ["args", "ignore", "targets"],
|
package/src/engines.ts
CHANGED
|
@@ -33,6 +33,7 @@ export const ENGINE_BINS: Record<EngineName, string> = {
|
|
|
33
33
|
"document-style-check": "document-style-check",
|
|
34
34
|
knip: "knip",
|
|
35
35
|
"tsdoc-check": "tsdoc-check",
|
|
36
|
+
typecheck: "tsc",
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
const WINDOWS_SHIMS = [".exe", ".cmd", ".bat", ""];
|
|
@@ -65,6 +66,10 @@ export const ENGINE_LIMITS: Record<
|
|
|
65
66
|
Partial<Record<"ignore" | "targets", string>>
|
|
66
67
|
> = {
|
|
67
68
|
biome: { ignore: "biome.json holds its settings" },
|
|
69
|
+
typecheck: {
|
|
70
|
+
ignore: "tsconfig.json holds its settings",
|
|
71
|
+
targets: "tsc checks the project named by tsconfig.json",
|
|
72
|
+
},
|
|
68
73
|
knip: {
|
|
69
74
|
ignore: "knip.ts holds its settings",
|
|
70
75
|
targets: "knip analyzes the whole project",
|
|
@@ -164,6 +169,9 @@ export function buildEngineCommand(
|
|
|
164
169
|
if (name === "biome") {
|
|
165
170
|
return [executable, "check", ...targets, ...extra];
|
|
166
171
|
}
|
|
172
|
+
if (name === "typecheck") {
|
|
173
|
+
return [executable, "--noEmit", ...extra];
|
|
174
|
+
}
|
|
167
175
|
if (name === "knip") {
|
|
168
176
|
return [executable, ...extra];
|
|
169
177
|
}
|