@yuu1111/knip-config 1.0.3 → 1.0.4

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 CHANGED
@@ -34,7 +34,8 @@ export default {
34
34
  ### base
35
35
 
36
36
  - `ignoreExportsUsedInFile` は自分のfile内だけで参照されるexportを報告から外す
37
- - `ignoreFiles` は `quality-check` が実行時に読み込む `quality.config.ts` を報告から外す
37
+ - `entry` は `quality-check` が実行時に読み込む `quality.config.ts` をentry pointとして扱う 未使用fileとして報告せず、このfileがimportするexportも利用中とみなす
38
+ - `ignoreIssues` は `quality.config.ts` 自身のexportを報告から外す 利用側の入口は `quality-check` のAPIであり、このfileのexportではない
38
39
 
39
40
  ### application
40
41
 
@@ -48,6 +49,15 @@ export default {
48
49
 
49
50
  動的なentry point、CLI binary、生成物は共有presetがProject構成から推測できないため利用Project側に残す
50
51
 
52
+ `base` が足す `entry` は、利用Projectが `entry` を書くと置き換わる 自分のentryを足すときは `quality.config.ts` も並べる
53
+
54
+ ```ts
55
+ export default {
56
+ ...application,
57
+ entry: ["src/main.ts", "quality.config.ts"]
58
+ }
59
+ ```
60
+
51
61
  別Projectを同居させているrepositoryは `ignore` でそのProjectを報告から外し、親のsourceとして読ませない
52
62
 
53
63
  ```ts
@@ -58,3 +68,5 @@ export default {
58
68
  ignore: ["another-project/**"]
59
69
  }
60
70
  ```
71
+
72
+ `workspaces` を持つrepositoryで `entry` をtop levelに書くとKnipがconfiguration hintを出す 報告ではないため終了codeは変わらない
package/README.md CHANGED
@@ -35,6 +35,8 @@ export default {
35
35
  ### base
36
36
 
37
37
  - `ignoreExportsUsedInFile` keeps exports that are only referenced inside their own file out of the report
38
+ - `entry` treats `quality.config.ts`, which `quality-check` loads at run time, as an entry point: it is not reported as an unused file and the exports it imports count as used
39
+ - `ignoreIssues` keeps the exports of `quality.config.ts` itself out of the report, because the entry point of a consuming project is the API of `quality-check` and not the exports of this file
38
40
 
39
41
  ### application
40
42
 
@@ -49,6 +51,16 @@ export default {
49
51
  Dynamic entry points, CLI binaries, and generated files stay in the consuming
50
52
  project because a shared preset cannot infer them from the project layout.
51
53
 
54
+ The `entry` that `base` adds is replaced when a project writes its own `entry`,
55
+ so an added entry lists `quality.config.ts` as well:
56
+
57
+ ```ts
58
+ export default {
59
+ ...application,
60
+ entry: ["src/main.ts", "quality.config.ts"]
61
+ }
62
+ ```
63
+
52
64
  A repository that also holds another project keeps that project out of the
53
65
  report with `ignore`, so its files are not read as source of the parent:
54
66
 
@@ -60,3 +72,7 @@ export default {
60
72
  ignore: ["another-project/**"]
61
73
  }
62
74
  ```
75
+
76
+ Knip prints a configuration hint when a repository with `workspaces` writes
77
+ `entry` at the top level. A hint is not a report, so the exit code does not
78
+ change.
package/base.ts CHANGED
@@ -4,8 +4,10 @@ import type { KnipConfig } from "knip";
4
4
  * 各presetが共通で継承するbase設定を提供する
5
5
  */
6
6
  export const base = {
7
+ // quality-checkが実行時に読み込むentrypointとして扱い、未使用fileとして報告しない
8
+ entry: ["quality.config.ts"],
7
9
  // 同一file内で参照しているexportは内部利用とみなす
8
10
  ignoreExportsUsedInFile: true,
9
- // quality-checkが実行時に読み込むため、Projectのsourceとして報告しない
10
- ignoreFiles: ["quality.config.ts"],
11
+ // config file自身のexportは利用側の入口ではないため報告しない
12
+ ignoreIssues: { "quality.config.ts": ["exports"] },
11
13
  } satisfies KnipConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuu1111/knip-config",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Shared Knip configuration",
5
5
  "license": "MIT",
6
6
  "repository": {