eslint-plugin-kerfjs 4.1.0 → 4.2.0-beta.1

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.md CHANGED
@@ -70,7 +70,7 @@ Use flat config (`eslint.config.js`), shown above. The `legacy-recommended` expo
70
70
 
71
71
  The "Hard Rule" column refers to the numbered rules in [`docs/ai/usage-guide.md`](../docs/ai/usage-guide.md) on the main kerf repo. `no-raw-with-dynamic-arg` and `ai-assistant-configs` don't map to numbered Hard Rules — the former creates an audit trail for every dynamic `raw()` call site (potential XSS); the latter checks that the bundled AI-assistant configs are installed and current. See [`docs/12-ai-assistant-configs.md`](../docs/12-ai-assistant-configs.md) on the main kerf repo for the AI-configs design.
72
72
 
73
- ## Why these five Hard-Rule rules (and not more)?
73
+ ## Why these rules, and not more
74
74
 
75
75
  Rules that need flow analysis (signal reads outside render — Rule 8), call-graph analysis (`addEventListener` inside the mount tree — Rule 4), or type information (partial-set against multi-key state — Rule 9) are already covered by the opt-in dev-warns and strict TS. Duplicating them here would mean either high false-positive rates without type info, or a `parserServices` dependency that complicates consumer setup.
76
76
 
@@ -35,6 +35,10 @@ Sanitization pipelines (`DOMPurify`, `sanitize-html`, server-rendered trusted co
35
35
  - Bare `raw(expr)` calls
36
36
  - Member-expression calls `kerf.raw(expr)` and `kerfjs.raw(expr)`
37
37
 
38
+ ## The blessed escape hatch: `trustedRaw()`
39
+
40
+ When a dynamic value is genuinely server-trusted — a CSRF token, a trusted `<script src>`, a server-issued id — use `trustedRaw()` (exported from `kerfjs`) instead of `raw()`. It is identical at runtime but is **not** named `raw`, so this rule leaves it alone. That replaces scattered `eslint-disable` comments with one intention-revealing call. `trustedRaw()` is not a sanitizer — only pass values you control, never raw user input.
41
+
38
42
  ## What this rule does NOT catch
39
43
 
40
44
  - `raw()` calls where the binding was renamed via a local alias (`const inject = raw; inject(expr)`)
@@ -41,6 +41,7 @@ These are intentionally left alone because `attr()` isn't a 1:1 swap for them:
41
41
  - Tag-qualified attribute selectors: `'button[data-action="x"]'`.
42
42
  - Compound attribute selectors: `'[data-action="x"][data-id="y"]'` — for these, concatenate two `.selector` strings (`A.selector + B.selector`) or use `attr()` only for one of the legs.
43
43
  - Selectors held in variables (not string literals) — already abstracted.
44
+ - `kerfjs/actions`: `delegateActions(root, event, table, opts?)` — its 3rd argument is a handler **table** (an object), not a selector, so it is never flagged. The blessed `action('x')` / `attr('data-action','x')` forms pass `.selector` (a member expression, not a literal), which this rule already leaves alone.
44
45
 
45
46
  ## Severity
46
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-kerfjs",
3
- "version": "4.1.0",
3
+ "version": "4.2.0-beta.1",
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",