eslint-plugin-kerfjs 4.1.1 → 4.2.0-beta.2
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.
|
@@ -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
|
|