@yuu1111/quality-check 0.10.0 → 0.11.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 +5 -2
- package/README.md +5 -3
- package/package.json +6 -1
- package/src/config.ts +18 -10
package/README.ja.md
CHANGED
|
@@ -10,7 +10,10 @@ Projectごとのscriptから個別に呼んでいたBiome、型検査、Knip、c
|
|
|
10
10
|
bun add -D @yuu1111/quality-check
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
このCLIは `comment-check`、`document-style-check`、`tsdoc-check` を、configの型がengineの公開するrule名を取り込むためpeer dependencyとして持つ
|
|
14
|
+
package managerはこのCLIと一緒に導入し、engineのbinaryは利用Projectの `node_modules/.bin` から実行時に解決する
|
|
15
|
+
|
|
16
|
+
`@yuu1111/code-style-check` を宣言するProjectではKnipが未使用依存として報告するため `knip.ts` の `ignoreDependencies` で理由付きに宣言する
|
|
14
17
|
|
|
15
18
|
## Usage
|
|
16
19
|
|
|
@@ -103,7 +106,7 @@ biome: ignore skipped (biome.json holds its settings)
|
|
|
103
106
|
```
|
|
104
107
|
|
|
105
108
|
`enable` は `comment-check` と `document-style-check` と `tsdoc-check` の `--enable <rule>` になり、他のengineでは拒否される
|
|
106
|
-
|
|
109
|
+
値は導入済みengineが `rule-ids` で公開するrule名で型付けするため、engineが知らない名前は起動時の失敗ではなく型errorになる
|
|
107
110
|
|
|
108
111
|
`comment-check` はbaseline差分を無効化する未作成のpathを渡して起動する
|
|
109
112
|
新規と解消済みの判定はengineごとではなく統合CLIが1つのbaseline fileで行うため、既存の `comment-baseline.json` がある場合は `--update-baseline` で移す
|
package/README.md
CHANGED
|
@@ -11,8 +11,10 @@ The baseline diff lives here too.
|
|
|
11
11
|
bun add -D @yuu1111/quality-check
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
A
|
|
14
|
+
`comment-check`, `document-style-check`, and `tsdoc-check` are peer dependencies of this CLI, because the config types embed the rule names those engines publish.
|
|
15
|
+
A package manager installs them with this CLI, and each engine binary is resolved at run time from the project's `node_modules/.bin`.
|
|
16
|
+
|
|
17
|
+
A project that declares `@yuu1111/code-style-check` sees Knip report it as an unused dependency, so it names it in `ignoreDependencies` with the reason.
|
|
16
18
|
|
|
17
19
|
## Usage
|
|
18
20
|
|
|
@@ -106,7 +108,7 @@ biome: ignore skipped (biome.json holds its settings)
|
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
`enable` becomes `--enable <rule>` on `comment-check`, `document-style-check`, and `tsdoc-check`, and the other engines reject the field.
|
|
109
|
-
|
|
111
|
+
Each value is typed with the rule names the installed engine publishes from its `rule-ids` entry, so a name that engine does not know is a type error rather than a start-up failure.
|
|
110
112
|
|
|
111
113
|
`comment-check` runs with an unwritten baseline path so that it reports every finding.
|
|
112
114
|
The new-and-resolved diff is done by this CLI from a single baseline file, so an existing `comment-baseline.json` is moved over with `--update-baseline`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuu1111/quality-check",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Integrated quality check runner",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
"quality",
|
|
30
30
|
"lint"
|
|
31
31
|
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@yuu1111/comment-check": ">=2.3.0",
|
|
34
|
+
"@yuu1111/document-style-check": ">=0.5.0",
|
|
35
|
+
"@yuu1111/tsdoc-check": ">=2.2.0"
|
|
36
|
+
},
|
|
32
37
|
"devDependencies": {
|
|
33
38
|
"@yuu1111/shared": "workspace:*"
|
|
34
39
|
}
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
|
+
import type { OptInRuleId as CommentCheckRuleName } from "@yuu1111/comment-check/rule-ids";
|
|
5
|
+
import type { OptInRuleId as DocumentStyleCheckRuleName } from "@yuu1111/document-style-check/rule-ids";
|
|
6
|
+
import type {
|
|
7
|
+
OptInRuleId as TsdocCheckRuleName,
|
|
8
|
+
TsdocRule,
|
|
9
|
+
} from "@yuu1111/tsdoc-check/rule-ids";
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* 統合CLIが起動できるengineの名前 並び順が実行順になる
|
|
@@ -36,26 +42,26 @@ export interface EngineOptions {
|
|
|
36
42
|
* comment-checkへ渡す起動条件
|
|
37
43
|
*/
|
|
38
44
|
export interface CommentCheckOptions extends EngineOptions {
|
|
39
|
-
/** 既定で無効のopt-in ruleのうち有効にするrule名 */
|
|
40
|
-
enable?:
|
|
45
|
+
/** 既定で無効のopt-in ruleのうち有効にするrule名 comment-checkが公開するunionで縛る */
|
|
46
|
+
enable?: CommentCheckRuleName[];
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
/**
|
|
44
50
|
* document-style-checkへ渡す起動条件
|
|
45
51
|
*/
|
|
46
52
|
export interface DocumentStyleCheckOptions extends EngineOptions {
|
|
47
|
-
/** 既定で無効のopt-in ruleのうち有効にするrule名 */
|
|
48
|
-
enable?:
|
|
53
|
+
/** 既定で無効のopt-in ruleのうち有効にするrule名 document-style-checkが公開するunionで縛る */
|
|
54
|
+
enable?: DocumentStyleCheckRuleName[];
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* TSDoc検査へ渡す起動条件
|
|
53
59
|
*/
|
|
54
60
|
export interface TsdocCheckOptions extends EngineOptions {
|
|
55
|
-
/** 既定で無効のopt-in ruleのうち有効にするrule名 */
|
|
56
|
-
enable?:
|
|
57
|
-
/** 違反として扱うrule名 */
|
|
58
|
-
error?:
|
|
61
|
+
/** 既定で無効のopt-in ruleのうち有効にするrule名 tsdoc-checkが公開するunionで縛る */
|
|
62
|
+
enable?: TsdocCheckRuleName[];
|
|
63
|
+
/** 違反として扱うrule名 tsdoc-checkが公開するunionで縛る */
|
|
64
|
+
error?: TsdocRule[];
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
|
@@ -284,7 +290,7 @@ function parseEngineConfig(
|
|
|
284
290
|
if (!isJsonObject(value)) {
|
|
285
291
|
throw new Error(`${source}: config must be an object`);
|
|
286
292
|
}
|
|
287
|
-
const config: Partial<
|
|
293
|
+
const config: Partial<Record<EngineName, ParsedEngineOptions>> = {};
|
|
288
294
|
for (const [name, options] of Object.entries(value)) {
|
|
289
295
|
if (!isEngineName(name)) {
|
|
290
296
|
throw new Error(`${source}: unknown engine in config: ${name}`);
|
|
@@ -294,7 +300,9 @@ function parseEngineConfig(
|
|
|
294
300
|
}
|
|
295
301
|
config[name] = parseEngineOptions(options, source, name);
|
|
296
302
|
}
|
|
297
|
-
|
|
303
|
+
|
|
304
|
+
// rule名はengineが公開するunionで縛る 実行時の入力は文字列として届くため検証済みの値をここで型へ寄せる
|
|
305
|
+
return config as Partial<EngineConfigMap>;
|
|
298
306
|
}
|
|
299
307
|
|
|
300
308
|
/**
|