@wcstack/lint 4.4.0 → 4.6.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 +12 -2
- package/README.md +12 -2
- package/dist/cli.cjs +67 -8
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -21,7 +21,7 @@ npm i -D @wcstack/lint
|
|
|
21
21
|
npx wcs-validate --errors-only src/**/*.html
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
`.manifest.json` で終わるファイルは sidecar manifest として、それ以外は `data-wcs` バインディングを含む HTML
|
|
24
|
+
`.manifest.json` で終わるファイルは sidecar manifest として、それ以外は `data-wcs` バインディングを含む HTML として検査されます。ただし framework のコンポーネントと script のファイル(`.js`・`.ts`・`.jsx`・`.tsx`・`.vue`・`.svelte`)は読みません(4.6 から。以前は HTML として読み、問題なしと報告していました)。
|
|
25
25
|
|
|
26
26
|
`<wcs-state src="...">` で参照される外部 state(`.json` / `.js` / `.ts`)は HTML ファイルからの相対パスで解決され、パス検証の対象になります。URL・絶対パスは読み込まず、読めないファイルはスキップされ、解決できないパスは warning のままです。なお外部 state が**解決できた**ページには通常の検証面が全て適用されるため、error severity の検出(例: 配列でない値への `for:`)が「これまでパス未解決で沈黙していたビルド」を新たに落とすことがあります。4.4 から、`.js` / `.ts` の state にはスクリプトの規則(`wcs/nested-assign`・`wcs/array-mutation`・`wcs/on-handler-this`・`wcs/updated-callback-unbound` など)もかかります: ファイルの中の指摘はそのファイルで報告し(`state.js:12:5 error wcs/nested-assign …`)、何ページから読まれても 1 回だけ数え、IDE はページの `src` の値の上に出します。4.3 までは、外部 state ではパスだけを検査していました。
|
|
27
27
|
|
|
@@ -54,6 +54,16 @@ app.manifest.json:1:3 error wcs/manifest-broken Broken manifest JSON: ...
|
|
|
54
54
|
| `1` | error severity の診断が 1 件以上。`--strict` 時は error または warning が 1 件以上 |
|
|
55
55
|
| `2` | usage エラー、またはファイル読み取り失敗 |
|
|
56
56
|
|
|
57
|
+
件数の後に、件数が何も語らないファイルを 2 つの注が挙げます(4.6 から。`--errors-only` でも出し、exit code は変えません):
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
0 error(s), 0 warning(s), 0 info
|
|
61
|
+
not read: src/App.tsx — wcs-validate reads HTML pages (data-wcs, <wcs-*> tags), not a framework's components or script files
|
|
62
|
+
nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack script in them
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`<wcs-*>` の要素を使う framework のアプリ(React・Vue)にはどちらも無く、ページはルートの要素を持つだけで、コンポーネントは読まれません。exit code `0` は、そのようなアプリを検査したという意味ではありません。代わりに見るべきことは [framework 統合の手引き](../../docs/framework-adapter-integration.ja.md) にあります。
|
|
66
|
+
|
|
57
67
|
## state の契約を宣言する(`stateSchema`)
|
|
58
68
|
|
|
59
69
|
契約が無いと、validator が解決できないパスは **warning**(`wcs/binding-path-missing`)に留まります: インラインスクリプトが静的に読めなくても `count` は実行時には存在するかもしれないからです。`[]` で始まるリストの行のフィールドは、行を足す・置き換える代入式の行リテラルから読みます。外から届くリスト(`<wcs-fetch>` や `<wcs-storage>` が埋めるまで `null`)にはそのリテラルが無いので、プロパティの直前の JSDoc `@type` で形を宣言してください(`/** @type {{ id: number, name: string }[] | null} */ catalog: null`)。同じスクリプトの `@typedef` で行の型に名前を付け、`@type {Product[] | null}` と書いてもかまいません。HTML と同じ(または上の)ディレクトリに `application` sidecar を置くと、同じ typo が **error** になります:
|
|
@@ -84,7 +94,7 @@ app.manifest.json:1:3 error wcs/manifest-broken Broken manifest JSON: ...
|
|
|
84
94
|
|
|
85
95
|
## 生成 → 検証 → 修正ループでの利用
|
|
86
96
|
|
|
87
|
-
安定した diagnostic code・`source:line:col` range・exit code 契約により、CI のゲートにも AI コード生成フローにもそのまま組み込めます: HTML を生成 → `npx @wcstack/lint --errors-only` → 診断を読んで修正 → exit code `0`
|
|
97
|
+
安定した diagnostic code・`source:line:col` range・exit code 契約により、CI のゲートにも AI コード生成フローにもそのまま組み込めます: HTML を生成 → `npx @wcstack/lint --errors-only` → 診断を読んで修正 → exit code `0` になるまで再実行。このゲートが覆うのは `data-wcs` のページです: 出力が `not read:` や `nothing to check:` で終わるときは、そのファイルは検査されていません。
|
|
88
98
|
|
|
89
99
|
## VS Code 拡張との関係
|
|
90
100
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm i -D @wcstack/lint
|
|
|
21
21
|
npx wcs-validate --errors-only src/**/*.html
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Files ending in `.manifest.json` are validated as sidecar manifests; everything else is validated as HTML with `data-wcs` bindings.
|
|
24
|
+
Files ending in `.manifest.json` are validated as sidecar manifests; everything else is validated as HTML with `data-wcs` bindings, except a framework's components and script files (`.js`, `.ts`, `.jsx`, `.tsx`, `.vue`, `.svelte`), which are not read (since 4.6; before, they were read as HTML and reported clean).
|
|
25
25
|
|
|
26
26
|
External state referenced via `<wcs-state src="...">` (`.json` / `.js` / `.ts`) is resolved relative to the HTML file and included in path validation. URLs and absolute paths are never read, unreadable files are skipped, and unresolved paths stay warnings. Note that once external state *does* resolve, the full validation surface applies to those pages — error-severity findings (e.g. `for:` bound to a non-array) can fail a build that was previously silent because the paths could not be checked. Since 4.4 that includes the script rules (`wcs/nested-assign`, `wcs/array-mutation`, `wcs/on-handler-this`, `wcs/updated-callback-unbound` and the rest) on a `.js` / `.ts` state: a finding in the file is reported in the file (`state.js:12:5 error wcs/nested-assign …`), once however many pages load it, and the IDE shows it on the page's `src` value. Up to 4.3 only the paths of an external state were checked.
|
|
27
27
|
|
|
@@ -54,6 +54,16 @@ app.manifest.json:1:3 error wcs/manifest-broken Broken manifest JSON: ...
|
|
|
54
54
|
| `1` | At least one error-severity diagnostic; with `--strict`, at least one error or warning |
|
|
55
55
|
| `2` | Usage error or unreadable file |
|
|
56
56
|
|
|
57
|
+
After the counts, two notes name the files the counts say nothing about (since 4.6; printed with `--errors-only` too, and they do not change the exit code):
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
0 error(s), 0 warning(s), 0 info
|
|
61
|
+
not read: src/App.tsx — wcs-validate reads HTML pages (data-wcs, <wcs-*> tags), not a framework's components or script files
|
|
62
|
+
nothing to check: index.html — no data-wcs binding, <wcs-*> tag or wcstack script in them
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A framework app (React, Vue) that uses the `<wcs-*>` elements has neither: its page holds the root element and its components are not read. Exit code `0` does not mean such an app was checked; [the framework integration guide](../../docs/framework-adapter-integration.md) lists what to look for instead.
|
|
66
|
+
|
|
57
67
|
## Declaring a state contract (`stateSchema`)
|
|
58
68
|
|
|
59
69
|
Without a contract, a path the validator cannot resolve is only a **warning** (`wcs/binding-path-missing`): `count` may well exist at runtime even when the inline script cannot be read statically. Note that a list starting as `[]` does not need a contract just to name its row fields — the analyzer reads them from the row literals in the assignments that add or replace rows (`this.items = this.items.concat({ id, kind: "general" })`, `.toSpliced(i, n, { … })`, `.with(i, { … })`, `[...this.items, { … }]`); only a row passed as a variable (`concat(row)`) is invisible to it. A list that arrives from outside — `null` until `<wcs-fetch>` or `<wcs-storage>` fills it — has no such literal: declare its shape with a JSDoc `@type` before the property (`/** @type {{ id: number, name: string }[] | null} */ catalog: null`), or name the row type with a `@typedef` in the same script and write `@type {Product[] | null}`. Put an `application` sidecar next to (or above) the HTML and the same typo becomes an **error**:
|
|
@@ -84,7 +94,7 @@ Without a contract, a path the validator cannot resolve is only a **warning** (`
|
|
|
84
94
|
|
|
85
95
|
## Use in generate–validate–fix loops
|
|
86
96
|
|
|
87
|
-
Stable diagnostic codes, `source:line:col` ranges, and the exit-code contract make this CLI a drop-in gate for CI and for AI code-generation flows: generate HTML → `npx @wcstack/lint --errors-only` → read the diagnostics, fix, and re-run until exit code `0`.
|
|
97
|
+
Stable diagnostic codes, `source:line:col` ranges, and the exit-code contract make this CLI a drop-in gate for CI and for AI code-generation flows: generate HTML → `npx @wcstack/lint --errors-only` → read the diagnostics, fix, and re-run until exit code `0`. The gate covers `data-wcs` pages: when the output ends with `not read:` or `nothing to check:`, those files were not checked.
|
|
88
98
|
|
|
89
99
|
## Relationship to the VS Code extension
|
|
90
100
|
|
package/dist/cli.cjs
CHANGED
|
@@ -207,6 +207,11 @@ var WcsDiagnosticCode = {
|
|
|
207
207
|
// 未知メンバーへのバインド(プロパティ / command. / eventToken. キー)。4.0 のランタイムは #38 / #1203 /
|
|
208
208
|
// #1204 で拒み、root では初期化が、行では束縛が失敗する(3.x の「黙って無視」ではない)。error。
|
|
209
209
|
TagMemberUnknown: "wcs/tag-member-unknown",
|
|
210
|
+
// `semantics: "handle"` の出力(`<wcs-camera>` の `streamReady` = 生の MediaStream)を、値としてパスに
|
|
211
|
+
// 束ねた。プロトコルは「値の置き場ではなく ref / callback で受ける」と定める(protocol/wc-bindable.ts)。
|
|
212
|
+
// ランタイムは書くので動くが、スナップショット・DevTools・SSR に載らないオブジェクトが state に入る
|
|
213
|
+
// (docs/seam-apps.md、state-field-report)。warning。5.0 でランタイムが拒むかは誤りの目録の議題。
|
|
214
|
+
HandleBoundAsValue: "wcs/handle-bound-as-value",
|
|
210
215
|
// タグのメンバー名が "on" で始まる(`once` 等)のに先頭ドット無しで束縛した: ランタイムはイベント束縛にして
|
|
211
216
|
// "ce" イベントを待ち、値は届かない。明示のプロパティ形 `.once:` を提案する(@wcstack/state 3.1・要件 B5 / 3.x 計画 D36)
|
|
212
217
|
OnPrefixedMember: "wcs/on-prefixed-member",
|
|
@@ -3420,7 +3425,7 @@ function readBase(expr, scan, aliases, paths) {
|
|
|
3420
3425
|
if (alias === null) return null;
|
|
3421
3426
|
if (alias[1] !== "this") {
|
|
3422
3427
|
const shape = aliases.get(alias[1]);
|
|
3423
|
-
return shape
|
|
3428
|
+
return { shape: shape ?? OPAQUE, rest: alias[1].length };
|
|
3424
3429
|
}
|
|
3425
3430
|
const segments = [];
|
|
3426
3431
|
let i = 4;
|
|
@@ -3445,6 +3450,7 @@ function readBase(expr, scan, aliases, paths) {
|
|
|
3445
3450
|
break;
|
|
3446
3451
|
}
|
|
3447
3452
|
const path = segments.join(".");
|
|
3453
|
+
if (path === "" && /^\s*\??\.\s*\$[$\w]*\s*\(/.test(scan.slice(4))) return { shape: OPAQUE, rest: 4 };
|
|
3448
3454
|
if (path === "" || path.startsWith("$")) return null;
|
|
3449
3455
|
return {
|
|
3450
3456
|
shape: { isList: hasPath(paths, `${path}.*`), mirrors: [{ from: path, to: "" }], fields: [] },
|
|
@@ -3455,12 +3461,25 @@ function applyChain(expr, scan, start, initial) {
|
|
|
3455
3461
|
let shape = initial;
|
|
3456
3462
|
let i = start;
|
|
3457
3463
|
while (scan.slice(i).trim() !== "") {
|
|
3464
|
+
if (shape.opaque && /^\s*\(/.test(scan.slice(i))) {
|
|
3465
|
+
const open2 = scan.indexOf("(", i);
|
|
3466
|
+
i = open2 + extractDelimitedContent(expr, scan, open2, "(", ")").length + 2;
|
|
3467
|
+
continue;
|
|
3468
|
+
}
|
|
3458
3469
|
const call = /^\s*\??\.\s*([$\w]+)\s*\(/.exec(scan.slice(i));
|
|
3459
3470
|
if (call === null) return null;
|
|
3460
3471
|
const open = i + call[0].length - 1;
|
|
3461
3472
|
const args = extractDelimitedContent(expr, scan, open, "(", ")");
|
|
3462
3473
|
i = open + args.length + 2;
|
|
3463
3474
|
const method = call[1];
|
|
3475
|
+
if (shape.opaque) {
|
|
3476
|
+
if (method === "map") {
|
|
3477
|
+
const mapped = mapRows(args, shape);
|
|
3478
|
+
if (mapped === null) return null;
|
|
3479
|
+
shape = mapped;
|
|
3480
|
+
}
|
|
3481
|
+
continue;
|
|
3482
|
+
}
|
|
3464
3483
|
if (ROW_PRESERVING_METHODS.has(method)) {
|
|
3465
3484
|
if (!shape.isList) return null;
|
|
3466
3485
|
} else if (ROW_PICKING_METHODS.has(method)) {
|
|
@@ -3475,8 +3494,9 @@ function applyChain(expr, scan, start, initial) {
|
|
|
3475
3494
|
return null;
|
|
3476
3495
|
}
|
|
3477
3496
|
}
|
|
3478
|
-
return shape;
|
|
3497
|
+
return shape.opaque ? null : shape;
|
|
3479
3498
|
}
|
|
3499
|
+
var OPAQUE = { isList: true, mirrors: [], fields: [], opaque: true };
|
|
3480
3500
|
function pickRow(shape) {
|
|
3481
3501
|
return {
|
|
3482
3502
|
isList: false,
|
|
@@ -3487,7 +3507,7 @@ function pickRow(shape) {
|
|
|
3487
3507
|
function mapRows(args, shape) {
|
|
3488
3508
|
const [callback] = splitTopLevelElements(args);
|
|
3489
3509
|
if (callback === void 0) return null;
|
|
3490
|
-
const head = /^(?:async\s+)?(?:function\b[^(]*\(\s*([$\w]+)[^)]*\)|\(\s*([$\w]+)[^)]*\)|([$\w]+))\s*(=>)?\s*/.exec(callback);
|
|
3510
|
+
const head = /^(?:async\s+)?(?:function\b[^(]*\(\s*([$\w]+)?[^)]*\)|\(\s*([$\w]+)?[^)]*\)|([$\w]+))\s*(=>)?\s*/.exec(callback);
|
|
3491
3511
|
if (head === null) return null;
|
|
3492
3512
|
const param = head[1] ?? head[2] ?? head[3];
|
|
3493
3513
|
const body = callback.slice(head[0].length);
|
|
@@ -10975,6 +10995,7 @@ var ja = {
|
|
|
10975
10995
|
nativeCommandUnknown: (method, tag, allowed) => `"${method}" \u306F\u30CD\u30A4\u30C6\u30A3\u30D6\u306E <${tag}> \u306B command \u3067\u547C\u3079\u308B\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\uFF08\u547C\u3079\u308B\u306E\u306F ${allowed}\u3002\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u521D\u671F\u5316\u3067 wcs/token-misconfigured \u3092\u6295\u3052\u307E\u3059\uFF09`,
|
|
10976
10996
|
spreadNoBindable: (tag) => `'...'\uFF08spread\uFF09\u306F <${tag}> \u306B\u6709\u52B9\u306A wcBindable \u5BA3\u8A00\u304C\u5FC5\u8981\u3067\u3059 \u2014 \u3053\u306E\u30BF\u30B0\u306F\u5BA3\u8A00\u3092\u6301\u305F\u306A\u3044\u305F\u3081\u3001\u30E9\u30F3\u30BF\u30A4\u30E0\u306F\u30A8\u30E9\u30FC\u3092\u9001\u51FA\u3057\u307E\u3059`,
|
|
10977
10997
|
tagEventTokenKeyUnknown: (name, tag, declared) => `eventToken \u306E\u30AD\u30FC "${name}" \u306F <${tag}> \u306E wcBindable \u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u751F DOM \u30A4\u30D9\u30F3\u30C8\u540D\u306F\u767A\u706B\u3057\u307E\u305B\u3093 \u2014 \u30D7\u30ED\u30D1\u30C6\u30A3\u540D\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u5BA3\u8A00\u6E08\u307F: ${declared}\uFF09`,
|
|
10998
|
+
handleBoundAsValue: (name, tag) => `<${tag}> \u306E "${name}" \u306F\u751F\u304D\u305F\u30EA\u30BD\u30FC\u30B9\uFF08\u30CF\u30F3\u30C9\u30EB\uFF09\u3067\u3001\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002state \u306E\u30D1\u30B9\u306B\u675F\u306D\u308B\u3068\u3001\u30B9\u30CA\u30C3\u30D7\u30B7\u30E7\u30C3\u30C8\u3084 SSR \u306B\u8F09\u3089\u306A\u3044\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C state \u306B\u5165\u308A\u307E\u3059 \u2014 eventToken.${name}: \u3067\u53D7\u3051\u3001\u30B3\u30DE\u30F3\u30C9\u306E\u5F15\u6570\u3068\u3057\u3066\u6B21\u306E\u8981\u7D20\u3078\u76F4\u63A5\u6E21\u3057\u3066\u304F\u3060\u3055\u3044`,
|
|
10978
10999
|
ariaAttrUnknown: (name) => `"${name}" \u306F WAI-ARIA \u306E\u5C5E\u6027\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002setAttribute \u306F\u305D\u306E\u307E\u307E\u66F8\u304D\u8FBC\u307F\u307E\u3059\u304C\u3001\u652F\u63F4\u6280\u8853\u306B\u306F\u9ED9\u3063\u3066\u7121\u8996\u3055\u308C\u307E\u3059`,
|
|
10979
11000
|
didYouMean: (c) => `\u3002\u3082\u3057\u304B\u3057\u3066: "${c}"`,
|
|
10980
11001
|
none: () => `\u306A\u3057`,
|
|
@@ -11183,6 +11204,7 @@ var en = {
|
|
|
11183
11204
|
nativeCommandUnknown: (method, tag, allowed) => `"${method}" is not a command of a native <${tag}> (its commands: ${allowed}; the runtime throws wcs/token-misconfigured at initialization)`,
|
|
11184
11205
|
spreadNoBindable: (tag) => `'...' (spread) requires <${tag}> to expose a valid wcBindable declaration \u2014 this tag declares none, so the runtime raises an error`,
|
|
11185
11206
|
tagEventTokenKeyUnknown: (name, tag, declared) => `eventToken key "${name}" is not a wcBindable property of <${tag}>. Raw DOM event names never fire \u2014 use the property name (declared: ${declared})`,
|
|
11207
|
+
handleBoundAsValue: (name, tag) => `"${name}" of <${tag}> is a live resource (a handle), not a value. Bound to a state path, it puts an object no snapshot or SSR can carry into the state \u2014 receive it with eventToken.${name}: and hand it to the next element as a command argument`,
|
|
11186
11208
|
ariaAttrUnknown: (name) => `"${name}" is not a WAI-ARIA attribute. setAttribute writes it anyway, and assistive technology silently ignores it`,
|
|
11187
11209
|
didYouMean: (c) => `. Did you mean "${c}"?`,
|
|
11188
11210
|
none: () => `none`,
|
|
@@ -13299,6 +13321,9 @@ var BUILTIN_TAGS = {
|
|
|
13299
13321
|
"start",
|
|
13300
13322
|
"stop",
|
|
13301
13323
|
"switchCamera"
|
|
13324
|
+
],
|
|
13325
|
+
"handles": [
|
|
13326
|
+
"streamReady"
|
|
13302
13327
|
]
|
|
13303
13328
|
},
|
|
13304
13329
|
"wcs-recorder": {
|
|
@@ -14026,10 +14051,12 @@ var BUILTIN_TAGS = {
|
|
|
14026
14051
|
"hasWcBindable": true,
|
|
14027
14052
|
"observedAttributes": [
|
|
14028
14053
|
"key",
|
|
14054
|
+
"storage-key",
|
|
14029
14055
|
"type"
|
|
14030
14056
|
],
|
|
14031
14057
|
"inputs": {
|
|
14032
14058
|
"key": null,
|
|
14059
|
+
"storageKey": null,
|
|
14033
14060
|
"type": null,
|
|
14034
14061
|
"value": null,
|
|
14035
14062
|
"manual": null,
|
|
@@ -14540,6 +14567,18 @@ function validateBindingAgainstContract(tagName, contract, parsed, property, sta
|
|
|
14540
14567
|
});
|
|
14541
14568
|
return;
|
|
14542
14569
|
}
|
|
14570
|
+
if (contract.handles?.includes(property)) {
|
|
14571
|
+
diagnostics.push({
|
|
14572
|
+
code: WcsDiagnosticCode.HandleBoundAsValue,
|
|
14573
|
+
start,
|
|
14574
|
+
end,
|
|
14575
|
+
severity: "warning",
|
|
14576
|
+
tag: tagName,
|
|
14577
|
+
member: property,
|
|
14578
|
+
message: msgs.handleBoundAsValue(property, tagName)
|
|
14579
|
+
});
|
|
14580
|
+
return;
|
|
14581
|
+
}
|
|
14543
14582
|
if (tagName.startsWith("wcs-") && property === "trigger" && "trigger" in contract.inputs && parsed.path) {
|
|
14544
14583
|
const cand = findDataSlot(getPaths(), parsed.path);
|
|
14545
14584
|
if (cand?.rawInitial === "true") {
|
|
@@ -17588,6 +17627,13 @@ function escapePtr(key) {
|
|
|
17588
17627
|
}
|
|
17589
17628
|
|
|
17590
17629
|
// src/core/cli/runValidation.ts
|
|
17630
|
+
function inputKindOf(path) {
|
|
17631
|
+
if (path.endsWith(".manifest.json")) return "manifest";
|
|
17632
|
+
return /\.(?:[cm]?[jt]sx?|vue|svelte)$/i.test(path) ? "other" : "html";
|
|
17633
|
+
}
|
|
17634
|
+
function hasAnythingToCheck(text3, bindAttribute, stateTagName) {
|
|
17635
|
+
return text3.includes(bindAttribute) || /<wcs-/i.test(text3) || text3.includes(`<${stateTagName}`) || /@wcstack\/|\bwcstack(?:@[\w.-]+)?\/auto\b/.test(text3);
|
|
17636
|
+
}
|
|
17591
17637
|
var severityLabel = { error: "error", warning: "warning", info: "info" };
|
|
17592
17638
|
function runValidation(inputs, options = {}) {
|
|
17593
17639
|
const diagnosticsBySource = /* @__PURE__ */ new Map();
|
|
@@ -17609,8 +17655,12 @@ function runValidation(inputs, options = {}) {
|
|
|
17609
17655
|
}
|
|
17610
17656
|
}
|
|
17611
17657
|
const inFiles = /* @__PURE__ */ new Map();
|
|
17658
|
+
const nothingToCheck = [];
|
|
17612
17659
|
for (const input of inputs) {
|
|
17613
17660
|
if (input.kind !== "html") continue;
|
|
17661
|
+
if (!hasAnythingToCheck(input.text, options.bindAttribute ?? "data-wcs", options.stateTagName ?? "wcs-state")) {
|
|
17662
|
+
nothingToCheck.push(input.source);
|
|
17663
|
+
}
|
|
17614
17664
|
let applicationSchema = explicitSchema;
|
|
17615
17665
|
if (!haveExplicitApplication && input.fileReader !== void 0) {
|
|
17616
17666
|
const discovered = discoverApplicationManifest(input.fileReader);
|
|
@@ -17662,20 +17712,28 @@ function runValidation(inputs, options = {}) {
|
|
|
17662
17712
|
lines.push(`${source}:${pos.line}:${pos.column} ${severityLabel[d.severity]} ${d.code} ${d.message}`);
|
|
17663
17713
|
}
|
|
17664
17714
|
}
|
|
17715
|
+
const notRead = inputs.filter((i) => i.kind === "other").map((i) => i.source);
|
|
17716
|
+
const notes = [];
|
|
17717
|
+
if (notRead.length > 0) {
|
|
17718
|
+
notes.push(`not read: ${notRead.join(", ")} \u2014 wcs-validate reads HTML pages (data-wcs, <wcs-*> tags), not a framework's components or script files`);
|
|
17719
|
+
}
|
|
17720
|
+
if (nothingToCheck.length > 0) {
|
|
17721
|
+
notes.push(`nothing to check: ${nothingToCheck.join(", ")} \u2014 no data-wcs binding, <wcs-*> tag or wcstack script in them`);
|
|
17722
|
+
}
|
|
17665
17723
|
return {
|
|
17666
17724
|
lines,
|
|
17667
17725
|
errorCount,
|
|
17668
17726
|
warningCount,
|
|
17669
17727
|
infoCount,
|
|
17670
17728
|
exitCode: errorCount > 0 || options.strict === true && warningCount > 0 ? 1 : 0,
|
|
17671
|
-
diagnosticsBySource
|
|
17729
|
+
diagnosticsBySource,
|
|
17730
|
+
notRead,
|
|
17731
|
+
nothingToCheck,
|
|
17732
|
+
notes
|
|
17672
17733
|
};
|
|
17673
17734
|
}
|
|
17674
17735
|
|
|
17675
17736
|
// src/cli.ts
|
|
17676
|
-
function classify(path) {
|
|
17677
|
-
return path.endsWith(".manifest.json") ? "manifest" : "html";
|
|
17678
|
-
}
|
|
17679
17737
|
function parseArgs(argv) {
|
|
17680
17738
|
const options = {};
|
|
17681
17739
|
const files = [];
|
|
@@ -17716,7 +17774,7 @@ function main(argv) {
|
|
|
17716
17774
|
`);
|
|
17717
17775
|
return 2;
|
|
17718
17776
|
}
|
|
17719
|
-
const kind =
|
|
17777
|
+
const kind = inputKindOf(path);
|
|
17720
17778
|
inputs.push({ source: path, text: text3, kind, fileReader: kind === "html" ? createFileReader(path) : void 0 });
|
|
17721
17779
|
}
|
|
17722
17780
|
const result = runValidation(inputs, { ...options, locale: locale2 });
|
|
@@ -17728,6 +17786,7 @@ function main(argv) {
|
|
|
17728
17786
|
${result.errorCount} error(s), ${result.warningCount} warning(s), ${result.infoCount} info${options.strict ? " (strict)" : ""}
|
|
17729
17787
|
`
|
|
17730
17788
|
);
|
|
17789
|
+
for (const note of result.notes) process.stdout.write(note + "\n");
|
|
17731
17790
|
return result.exitCode;
|
|
17732
17791
|
}
|
|
17733
17792
|
if (typeof require !== "undefined" && typeof module !== "undefined" && require.main === module) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/lint",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Static-contract validator CLI (wcs-validate) for wcstack data-wcs bindings and wcstack.manifest.json sidecars. Thin npm wrapper around the wcstack-intellisense validator core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|