@yuu1111/quality-check 0.7.0 → 0.8.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 +15 -7
- package/README.md +19 -9
- package/bin/cli.js +4 -0
- package/dist/cli.js +17 -2
- package/package.json +4 -3
- package/src/config.ts +3 -0
- package/src/engines.ts +6 -0
package/README.ja.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @yuu1111/quality-check
|
|
4
4
|
|
|
5
|
-
Projectごとのscriptから個別に呼んでいたBiome、型検査、Knip、comment-check、document-style-check、TSDoc checkerを1つのCLIへまとめる baselineの差分判定もここで行う
|
|
5
|
+
Projectごとのscriptから個別に呼んでいたBiome、型検査、Knip、code-style-check、comment-check、document-style-check、TSDoc checkerを1つのCLIへまとめる baselineの差分判定もここで行う
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -30,14 +30,22 @@ export default defineConfig({
|
|
|
30
30
|
biome: true,
|
|
31
31
|
typecheck: true,
|
|
32
32
|
knip: true,
|
|
33
|
+
"code-style-check": true,
|
|
33
34
|
"comment-check": true,
|
|
34
35
|
"document-style-check": true,
|
|
35
36
|
"tsdoc-check": true,
|
|
36
37
|
},
|
|
37
38
|
config: {
|
|
38
|
-
"comment-check": {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
"comment-check": {
|
|
40
|
+
enable: ["japanese-period"],
|
|
41
|
+
ignore: ["another-project"],
|
|
42
|
+
},
|
|
43
|
+
"document-style-check": {
|
|
44
|
+
enable: ["japanese-period"],
|
|
45
|
+
},
|
|
46
|
+
"tsdoc-check": {
|
|
47
|
+
error: ["missing-doc"],
|
|
48
|
+
},
|
|
41
49
|
},
|
|
42
50
|
});
|
|
43
51
|
```
|
|
@@ -66,15 +74,16 @@ quality-check: 1 of 3 engines failed
|
|
|
66
74
|
| `config` | engineごとの起動条件 |
|
|
67
75
|
| `baseline` | baseline fileのpath `false` なら差分判定を行わない |
|
|
68
76
|
|
|
69
|
-
engineは `biome` → `typecheck` → `knip` → `comment-check` → `document-style-check` → `tsdoc-check` の順に実行する
|
|
77
|
+
engineは `biome` → `typecheck` → `knip` → `code-style-check` → `comment-check` → `document-style-check` → `tsdoc-check` の順に実行する
|
|
70
78
|
|
|
71
|
-
`engines` は起動の委任だけを表し、起動条件は `config` のengineの下へ置く engineが受け取る条件は次のとおり
|
|
79
|
+
`engines` は起動の委任だけを表し、起動条件は `config` のengineの下へ置く engineごとの条件は複数行のobjectとして書き、ruleやoptionを足しても他のengineの行が動かないようにする engineが受け取る条件は次のとおり
|
|
72
80
|
|
|
73
81
|
| engine | 起動するcommand | 受け取る条件 |
|
|
74
82
|
|--------|-----------------|--------------|
|
|
75
83
|
| `biome` | `biome check` | `targets`、`args` 除外pathは `biome.json` が持つ |
|
|
76
84
|
| `typecheck` | `tsc --noEmit` | `args`、`projects` 設定は `tsconfig.json` が持つ |
|
|
77
85
|
| `knip` | `knip` | `args` 設定は `knip.ts` が持つ |
|
|
86
|
+
| `code-style-check` | `code-style-check --json` | `ignore`、`targets`、`args` |
|
|
78
87
|
| `comment-check` | `comment-check --json` | `ignore`、`targets`、`args`、`enable`(有効にするrule名) |
|
|
79
88
|
| `document-style-check` | `document-style-check lint --json` | `ignore`、`targets`、`args`、`enable`(有効にするrule名) |
|
|
80
89
|
| `tsdoc-check` | `tsdoc-check --json` | `ignore`、`targets`、`args`、`error`(違反として扱うrule名) |
|
|
@@ -117,4 +126,3 @@ engineのbinaryは利用Projectの `node_modules/.bin` から実行時に解決
|
|
|
117
126
|
`enable` は `comment-check` と `document-style-check` のopt-in ruleだけを受け取り、それぞれのcommandの `--enable <rule>` になる 他のengineへ書くとunknown optionとして拒否し、既定のrule集合は変えない このCLIはengineを同梱しないため、opt-in ruleを有効にするProjectは対応するengine packageも同じ変更で更新する
|
|
118
127
|
|
|
119
128
|
`typecheck` は `projects` に並べたtsconfigごとに `tsc --noEmit -p <path>` を起動する 省略時はカレントの `tsconfig.json` を1回だけ読み、`args` はすべての起動へ足す
|
|
120
|
-
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# @yuu1111/quality-check
|
|
4
4
|
|
|
5
|
-
Runs Biome, the type checker, Knip,
|
|
6
|
-
TSDoc checker from one CLI instead of one script per project.
|
|
7
|
-
lives here too.
|
|
5
|
+
Runs Biome, the type checker, Knip, code-style-check, comment-check,
|
|
6
|
+
document-style-check, and the TSDoc checker from one CLI instead of one script per project.
|
|
7
|
+
The baseline diff lives here too.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -33,14 +33,22 @@ export default defineConfig({
|
|
|
33
33
|
biome: true,
|
|
34
34
|
typecheck: true,
|
|
35
35
|
knip: true,
|
|
36
|
+
"code-style-check": true,
|
|
36
37
|
"comment-check": true,
|
|
37
38
|
"document-style-check": true,
|
|
38
39
|
"tsdoc-check": true,
|
|
39
40
|
},
|
|
40
41
|
config: {
|
|
41
|
-
"comment-check": {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
"comment-check": {
|
|
43
|
+
enable: ["japanese-period"],
|
|
44
|
+
ignore: ["another-project"],
|
|
45
|
+
},
|
|
46
|
+
"document-style-check": {
|
|
47
|
+
enable: ["japanese-period"],
|
|
48
|
+
},
|
|
49
|
+
"tsdoc-check": {
|
|
50
|
+
error: ["missing-doc"],
|
|
51
|
+
},
|
|
44
52
|
},
|
|
45
53
|
});
|
|
46
54
|
```
|
|
@@ -70,17 +78,19 @@ quality-check: 1 of 3 engines failed
|
|
|
70
78
|
| `config` | Conditions of each engine |
|
|
71
79
|
| `baseline` | Baseline file path; `false` disables the diff |
|
|
72
80
|
|
|
73
|
-
Engines run in the order `biome`, `typecheck`, `knip`, `
|
|
74
|
-
`document-style-check`, `tsdoc-check`.
|
|
81
|
+
Engines run in the order `biome`, `typecheck`, `knip`, `code-style-check`,
|
|
82
|
+
`comment-check`, `document-style-check`, `tsdoc-check`.
|
|
75
83
|
|
|
76
84
|
`engines` only delegates the start-up, and the conditions belong under the
|
|
77
|
-
engine in `config`.
|
|
85
|
+
engine in `config`. Write an engine's conditions as a multi-line object, so a
|
|
86
|
+
new rule or option changes one engine's block alone. Each engine runs:
|
|
78
87
|
|
|
79
88
|
| Engine | Command | Conditions |
|
|
80
89
|
|--------|---------|------------|
|
|
81
90
|
| `biome` | `biome check` | `targets`, `args`; `biome.json` holds the excluded paths |
|
|
82
91
|
| `typecheck` | `tsc --noEmit` | `args`, `projects`; `tsconfig.json` holds the settings |
|
|
83
92
|
| `knip` | `knip` | `args`; `knip.ts` holds the settings |
|
|
93
|
+
| `code-style-check` | `code-style-check --json` | `ignore`, `targets`, `args` |
|
|
84
94
|
| `comment-check` | `comment-check --json` | `ignore`, `targets`, `args`, `enable` (rule names to turn on) |
|
|
85
95
|
| `document-style-check` | `document-style-check lint --json` | `ignore`, `targets`, `args`, `enable` (rule names to turn on) |
|
|
86
96
|
| `tsdoc-check` | `tsdoc-check --json` | `ignore`, `targets`, `args`, `error` (rule names to fail on) |
|
package/bin/cli.js
ADDED
package/dist/cli.js
CHANGED
|
@@ -198,6 +198,7 @@ var ENGINE_NAMES = [
|
|
|
198
198
|
"biome",
|
|
199
199
|
"typecheck",
|
|
200
200
|
"knip",
|
|
201
|
+
"code-style-check",
|
|
201
202
|
"comment-check",
|
|
202
203
|
"document-style-check",
|
|
203
204
|
"tsdoc-check"
|
|
@@ -219,6 +220,7 @@ var ENGINE_OPTION_KEYS = {
|
|
|
219
220
|
biome: ["args", "ignore", "targets"],
|
|
220
221
|
typecheck: ["args", "ignore", "projects", "targets"],
|
|
221
222
|
knip: ["args", "ignore", "targets"],
|
|
223
|
+
"code-style-check": ["args", "ignore", "targets"],
|
|
222
224
|
"comment-check": ["args", "enable", "ignore", "targets"],
|
|
223
225
|
"document-style-check": ["args", "enable", "ignore", "targets"],
|
|
224
226
|
"tsdoc-check": ["args", "error", "ignore", "targets"]
|
|
@@ -375,6 +377,7 @@ import { existsSync as existsSync3 } from "fs";
|
|
|
375
377
|
import { dirname, join } from "path";
|
|
376
378
|
var ENGINE_BINS = {
|
|
377
379
|
biome: "biome",
|
|
380
|
+
"code-style-check": "code-style-check",
|
|
378
381
|
"comment-check": "comment-check",
|
|
379
382
|
"document-style-check": "document-style-check",
|
|
380
383
|
knip: "knip",
|
|
@@ -393,6 +396,7 @@ var ENGINE_LIMITS = {
|
|
|
393
396
|
ignore: "knip.ts holds its settings",
|
|
394
397
|
targets: "knip analyzes the whole project"
|
|
395
398
|
},
|
|
399
|
+
"code-style-check": {},
|
|
396
400
|
"comment-check": {},
|
|
397
401
|
"document-style-check": {},
|
|
398
402
|
"tsdoc-check": {}
|
|
@@ -412,7 +416,7 @@ function skippedEngineOptions(name, options) {
|
|
|
412
416
|
return skipped;
|
|
413
417
|
}
|
|
414
418
|
function isFindingEngine(name) {
|
|
415
|
-
return name === "comment-check" || name === "document-style-check" || name === "tsdoc-check";
|
|
419
|
+
return name === "code-style-check" || name === "comment-check" || name === "document-style-check" || name === "tsdoc-check";
|
|
416
420
|
}
|
|
417
421
|
function resolveExecutable(name, cwd) {
|
|
418
422
|
const shims = process.platform === "win32" ? WINDOWS_SHIMS : POSIX_SHIMS;
|
|
@@ -507,6 +511,9 @@ function buildEngineCommand(name, executable, context) {
|
|
|
507
511
|
...extra
|
|
508
512
|
];
|
|
509
513
|
}
|
|
514
|
+
if (name === "code-style-check") {
|
|
515
|
+
return [executable, "--json", ...targets, ...ignoreArguments, ...extra];
|
|
516
|
+
}
|
|
510
517
|
return [
|
|
511
518
|
executable,
|
|
512
519
|
"--json",
|
|
@@ -858,4 +865,12 @@ async function main(argv) {
|
|
|
858
865
|
}
|
|
859
866
|
return results.some((result) => result.status !== "passed") ? 1 : 0;
|
|
860
867
|
}
|
|
861
|
-
|
|
868
|
+
function run() {
|
|
869
|
+
runCli(main);
|
|
870
|
+
}
|
|
871
|
+
if (import.meta.main) {
|
|
872
|
+
run();
|
|
873
|
+
}
|
|
874
|
+
export {
|
|
875
|
+
run
|
|
876
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuu1111/quality-check",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Integrated quality check runner",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/yuu1111/configs.git",
|
|
8
|
-
"directory": "packages/quality-check"
|
|
8
|
+
"directory": "packages/engine/quality-check"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"bin": {
|
|
12
|
-
"quality-check": "
|
|
12
|
+
"quality-check": "bin/cli.js"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": "./src/config.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"README.ja.md",
|
|
20
|
+
"bin",
|
|
20
21
|
"src/config.ts",
|
|
21
22
|
"src/engines.ts",
|
|
22
23
|
"dist"
|
package/src/config.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const ENGINE_NAMES = [
|
|
|
9
9
|
"biome",
|
|
10
10
|
"typecheck",
|
|
11
11
|
"knip",
|
|
12
|
+
"code-style-check",
|
|
12
13
|
"comment-check",
|
|
13
14
|
"document-style-check",
|
|
14
15
|
"tsdoc-check",
|
|
@@ -70,6 +71,7 @@ export interface EngineConfigMap {
|
|
|
70
71
|
biome: EngineOptions;
|
|
71
72
|
typecheck: TypecheckOptions;
|
|
72
73
|
knip: EngineOptions;
|
|
74
|
+
"code-style-check": EngineOptions;
|
|
73
75
|
"comment-check": CommentCheckOptions;
|
|
74
76
|
"document-style-check": DocumentStyleCheckOptions;
|
|
75
77
|
"tsdoc-check": TsdocCheckOptions;
|
|
@@ -123,6 +125,7 @@ const ENGINE_OPTION_KEYS: Record<EngineName, readonly string[]> = {
|
|
|
123
125
|
biome: ["args", "ignore", "targets"],
|
|
124
126
|
typecheck: ["args", "ignore", "projects", "targets"],
|
|
125
127
|
knip: ["args", "ignore", "targets"],
|
|
128
|
+
"code-style-check": ["args", "ignore", "targets"],
|
|
126
129
|
"comment-check": ["args", "enable", "ignore", "targets"],
|
|
127
130
|
"document-style-check": ["args", "enable", "ignore", "targets"],
|
|
128
131
|
"tsdoc-check": ["args", "error", "ignore", "targets"],
|
package/src/engines.ts
CHANGED
|
@@ -29,6 +29,7 @@ export type EngineRunner = (
|
|
|
29
29
|
*/
|
|
30
30
|
export const ENGINE_BINS: Record<EngineName, string> = {
|
|
31
31
|
biome: "biome",
|
|
32
|
+
"code-style-check": "code-style-check",
|
|
32
33
|
"comment-check": "comment-check",
|
|
33
34
|
"document-style-check": "document-style-check",
|
|
34
35
|
knip: "knip",
|
|
@@ -76,6 +77,7 @@ export const ENGINE_LIMITS: Record<
|
|
|
76
77
|
ignore: "knip.ts holds its settings",
|
|
77
78
|
targets: "knip analyzes the whole project",
|
|
78
79
|
},
|
|
80
|
+
"code-style-check": {},
|
|
79
81
|
"comment-check": {},
|
|
80
82
|
"document-style-check": {},
|
|
81
83
|
"tsdoc-check": {},
|
|
@@ -107,6 +109,7 @@ export function skippedEngineOptions(
|
|
|
107
109
|
*/
|
|
108
110
|
export function isFindingEngine(name: EngineName): boolean {
|
|
109
111
|
return (
|
|
112
|
+
name === "code-style-check" ||
|
|
110
113
|
name === "comment-check" ||
|
|
111
114
|
name === "document-style-check" ||
|
|
112
115
|
name === "tsdoc-check"
|
|
@@ -249,6 +252,9 @@ export function buildEngineCommand(
|
|
|
249
252
|
...extra,
|
|
250
253
|
];
|
|
251
254
|
}
|
|
255
|
+
if (name === "code-style-check") {
|
|
256
|
+
return [executable, "--json", ...targets, ...ignoreArguments, ...extra];
|
|
257
|
+
}
|
|
252
258
|
return [
|
|
253
259
|
executable,
|
|
254
260
|
"--json",
|