eslint-plugin-kerfjs 5.0.0-beta.121 → 5.0.0-beta.123

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.
@@ -10,6 +10,8 @@ Declare application entry modules in the application UI profile to check root wi
10
10
 
11
11
  Entry paths are relative to the workspace root. The rule follows relative imports, re-exports, and literal dynamic imports from each entry. An application-scoped obligation is checked at the entry if any reachable module renders its component; a recognized helper call or required registration import in any reachable module satisfies it. Reachable leaf modules need no duplicate wiring. A module outside every declared entry keeps the per-file check. A composition entry can set `wiring.scope` to `"module"` for wiring that must be installed beside its rendering code; omitted scope means `"application"`. Computed import paths and unresolved modules stay outside the static graph, so put them in a declared entry or check them separately. `KUI-L402` still checks the helper's call site.
12
12
 
13
+ An entry-level `KUI-L401` finding is reported at the entry, but exceptions are matched against the modules that render the component. A narrow exception on a view suppresses its missing-wiring obligation; if another reachable view uses the same component without an exception, the entry still reports it. Module-scoped wiring keeps its per-file exception behavior.
14
+
13
15
  For server-rendered pages whose document loads a separate browser entry, pair the roots in one item:
14
16
 
15
17
  ```json
package/index.js CHANGED
@@ -15,7 +15,7 @@ import uiPublicBoundaries from './lib/rules/ui-public-boundaries.js';
15
15
  import uiWiring from './lib/rules/ui-wiring.js';
16
16
 
17
17
  const plugin = {
18
- meta: { name: 'eslint-plugin-kerfjs', version: '5.0.0-beta.121' },
18
+ meta: { name: 'eslint-plugin-kerfjs', version: '5.0.0-beta.123' },
19
19
  rules: {
20
20
  'no-inline-jsx-event-handlers': noInlineJsxEventHandlers,
21
21
  'no-raw-with-dynamic-arg': noRawWithDynamicArg,
@@ -351,16 +351,29 @@ export default {
351
351
  reachableCalls.add(helper);
352
352
  }
353
353
  const required = new Map(used);
354
+ const requiredSources = new Map(
355
+ [...used.keys()].map((key) => [key, new Set([filename])]),
356
+ );
354
357
  if (ownEntry)
355
358
  for (const [file, source] of ownEntry.modules)
356
- for (const key of moduleUses(source, file, contract))
359
+ for (const key of moduleUses(source, file, contract)) {
357
360
  if (!required.has(key)) required.set(key, node);
361
+ const sources = requiredSources.get(key) ?? new Set();
362
+ sources.add(file);
363
+ requiredSources.set(key, sources);
364
+ }
358
365
  for (const [key, usage] of required) {
359
366
  const entry = contract.entries.get(key);
360
367
  if (!entry?.wiring.required) continue;
361
368
  if (entry.wiring.scope === 'module' && !used.has(key)) continue;
362
369
  if (entry.wiring.scope !== 'module' && reachable.length && !ownEntry)
363
370
  continue;
371
+ const missingIsExcepted =
372
+ entry.wiring.scope === 'module'
373
+ ? isExcepted(contract, MISSING_CODE, filename)
374
+ : [...requiredSources.get(key)].every((file) =>
375
+ isExcepted(contract, MISSING_CODE, file),
376
+ );
364
377
  const actionModules =
365
378
  entry.wiring.scope !== 'module' && ownEntry
366
379
  ? ownEntry.wiringModules
@@ -368,7 +381,7 @@ export default {
368
381
  for (const action of entry.wiring.actions ?? [])
369
382
  if (
370
383
  !handlesAction(actionModules, action, contract) &&
371
- !isExcepted(contract, MISSING_CODE, filename)
384
+ !missingIsExcepted
372
385
  )
373
386
  context.report({
374
387
  node: usage,
@@ -383,7 +396,7 @@ export default {
383
396
  ? registry.sources
384
397
  : reachableImports
385
398
  ).has(helper) &&
386
- !isExcepted(contract, MISSING_CODE, filename)
399
+ !missingIsExcepted
387
400
  )
388
401
  context.report({
389
402
  node: usage,
@@ -396,7 +409,7 @@ export default {
396
409
  const provided = [helper, ...providers].some((name) =>
397
410
  ownEntry ? reachableCalls.has(name) : calls.has(name),
398
411
  );
399
- if (!provided && !isExcepted(contract, MISSING_CODE, filename))
412
+ if (!provided && !missingIsExcepted)
400
413
  context.report({
401
414
  node: usage,
402
415
  messageId: 'missing',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-kerfjs",
3
- "version": "5.0.0-beta.121",
3
+ "version": "5.0.0-beta.123",
4
4
  "description": "ESLint rules that enforce kerf's hard rules — catches AI-shaped bugs at edit time.",
5
5
  "type": "module",
6
6
  "license": "MIT",