eslint-plugin-kerfjs 5.0.0-beta.119 → 5.0.0-beta.120

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,14 @@ 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
+ For server-rendered pages whose document loads a separate browser entry, pair the roots in one item:
14
+
15
+ ```json
16
+ { "wiring": { "entries": [{ "render": ["src/routes/admin/index.tsx"], "client": ["src/client/app/admin.ts"] }] } }
17
+ ```
18
+
19
+ The rule checks an application-scoped obligation raised by any module reachable from `render` against helper calls and registration imports reachable from any `client` root in the same item. It reports a missing obligation at the first client entry. Each pair is isolated; another pair's client wiring does not satisfy it. String entries keep their existing single-graph behavior. List every server page that loads that browser entry in `render`; the HTML document's script URL is not an import edge the rule can discover. `wiring.scope: "module"` obligations remain local to the rendering module.
20
+
13
21
  For a page-lifetime root helper, declare the actual app entry in the workspace `.kerf-ui-profile.json`. For example, if `src/client/app.tsx` imports `init.ts`, `init.ts` calls `wireShellSearch(root)`, and that imported helper calls `wireSearchFields(root)`, use:
14
22
 
15
23
  ```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.119' },
18
+ meta: { name: 'eslint-plugin-kerfjs', version: '5.0.0-beta.120' },
19
19
  rules: {
20
20
  'no-inline-jsx-event-handlers': noInlineJsxEventHandlers,
21
21
  'no-raw-with-dynamic-arg': noRawWithDynamicArg,
@@ -254,11 +254,21 @@ function handlesAction(modules, action, contract) {
254
254
  function applicationEntries(contract, filename, source) {
255
255
  const root = resolve(contract.cwd);
256
256
  const entries = [];
257
- for (const path of contract.profile.wiring?.entries ?? []) {
258
- const file = resolve(root, path);
259
- if (relative(root, file).startsWith('..')) continue;
260
- const modules = entryModules(file, filename, source);
261
- if (modules.size) entries.push({ file, modules });
257
+ for (const entry of contract.profile.wiring?.entries ?? []) {
258
+ const client = typeof entry === 'string' ? [entry] : entry.client;
259
+ const render = typeof entry === 'string' ? [] : entry.render;
260
+ const roots = [...render, ...client].map((path) => resolve(root, path));
261
+ if (roots.some((file) => relative(root, file).startsWith('..'))) continue;
262
+ const modules = new Map();
263
+ const wiringModules = new Map();
264
+ for (const file of roots)
265
+ for (const [module, text] of entryModules(file, filename, source)) {
266
+ modules.set(module, text);
267
+ if (client.some((path) => resolve(root, path) === file))
268
+ wiringModules.set(module, text);
269
+ }
270
+ if (modules.size && wiringModules.size)
271
+ entries.push({ file: resolve(root, client[0]), modules, wiringModules });
262
272
  }
263
273
  return entries;
264
274
  }
@@ -333,7 +343,7 @@ export default {
333
343
  const reachableCalls = new Set(calls.keys());
334
344
  const reachableImports = new Set(registry.sources);
335
345
  if (ownEntry)
336
- for (const [file, source] of ownEntry.modules)
346
+ for (const [file, source] of ownEntry.wiringModules)
337
347
  if (file !== filename) {
338
348
  for (const imported of moduleImportSources(source))
339
349
  reachableImports.add(imported);
@@ -353,7 +363,7 @@ export default {
353
363
  continue;
354
364
  const actionModules =
355
365
  entry.wiring.scope !== 'module' && ownEntry
356
- ? ownEntry.modules
366
+ ? ownEntry.wiringModules
357
367
  : new Map([[filename, context.sourceCode.text]]);
358
368
  for (const action of entry.wiring.actions ?? [])
359
369
  if (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-kerfjs",
3
- "version": "5.0.0-beta.119",
3
+ "version": "5.0.0-beta.120",
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",