eslint-plugin-sfmc 4.16.2 → 5.1.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.md CHANGED
@@ -8,7 +8,7 @@ Unified ESLint plugin for **Salesforce Marketing Cloud** — linting rules for b
8
8
  npm install eslint-plugin-sfmc --save-dev
9
9
  ```
10
10
 
11
- Requires ESLint 9+ (flat config).
11
+ Requires ESLint **10.4.0+** (flat config) and Node.js **22+**. The ESLint minimum is a breaking requirement change; all 12 public configuration shapes remain unchanged (six objects and six multi-config arrays).
12
12
 
13
13
  ## Quick Start
14
14
 
@@ -57,6 +57,18 @@ Add the following to your `.vscode/settings.json`:
57
57
 
58
58
  > **Why `eslint.validate` and not `eslint.probe`?** `eslint.probe` silently skips files for language IDs that the ESLint extension does not natively recognise. `eslint.validate` forces the extension to process those files regardless of language ID.
59
59
 
60
+ ## Diagnostic documentation links
61
+
62
+ SFMC rule metadata links to the owning plugin version's documentation under `blob/v<package-version>/docs/rules/`. These links also work with custom plugin namespaces. Local development uses the package version deterministically; links for a prospective release may not resolve until that version and its documentation are tagged and published. ESLint parser failures (`ruleId: null`) have no rule metadata link. Core and third-party rules retain their own documentation metadata.
63
+
64
+ ### 5.1.0 release notes
65
+
66
+ - All 52 exported SFMC rules now expose version-pinned documentation metadata; the plugin metadata version comes from its own package rather than a hardcoded constant.
67
+ - Added the missing [SSJS switch fallthrough reference](docs/rules/ssjs/no-switch-fallthrough.md). Existing rule IDs, configurations, severities, and fixes are unchanged.
68
+ - Release checks verify the producer's tagged documentation and metadata in the packed npm artifact.
69
+
70
+ Version **5.1.0** adds these links without changing rule IDs or configuration shapes. It also adopts `ssjs-data@^2.1.0`: eight additional static/prototype methods receive unavailable-method guidance without a polyfill suggestion. The catalog's ninth addition, bare `structuredClone()`, remains outside this member-call rule's coverage. The evidence comes from tested Engagement CloudPages, not email or every execution context. No verified polyfill is bundled for these additions.
71
+
60
72
  ## Configs
61
73
 
62
74
  ### Marketing Cloud Engagement (default)
@@ -145,9 +157,12 @@ export default [...sfmc.configs['recommended-next'], ...sfmc.configs['embedded-n
145
157
  | [`sfmc/ssjs-no-nonfunctional-method`](docs/rules/ssjs/no-nonfunctional-method.md) | `warn` | Flag Core Library methods that never take effect at runtime |
146
158
  | [`sfmc/ssjs-prefer-parsejson-safe-arg`](docs/rules/ssjs/prefer-parsejson-safe-arg.md) | `warn` | Require string coercion on `ParseJSON` argument |
147
159
  | [`sfmc/ssjs-no-switch-default`](docs/rules/ssjs/no-switch-default.md) | `warn` | Disallow `default` clause in `switch` statements |
160
+ | [`sfmc/ssjs-no-switch-fallthrough`](docs/rules/ssjs/no-switch-fallthrough.md) | `warn` | Flag stacked labels and unterminated clauses that rely on switch fall-through |
148
161
  | [`sfmc/ssjs-no-treatascontent-injection`](docs/rules/ssjs/no-treatascontent-injection.md) | `warn` | Flag dynamic string concatenation in `TreatAsContent` calls |
149
162
  | [`sfmc/ssjs-core-method-arity`](docs/rules/ssjs/core-method-arity.md) | `warn` | Enforce correct argument counts for Core Library object methods |
150
163
  | [`sfmc/ssjs-arg-types`](docs/rules/ssjs/arg-types.md) | `warn` | Check that literal arguments match expected parameter types |
164
+ | [`sfmc/ssjs-http-property-value`](docs/rules/ssjs/http-property-value.md) | `error` | Validate literal HTTP request property values |
165
+ | [`sfmc/ssjs-no-invalid-property-access`](docs/rules/ssjs/no-invalid-property-access.md) | `error` | Flag reads of write-only properties and writes to read-only properties |
151
166
 
152
167
  ## Handlebars Rules (`hbs-*`)
153
168
 
@@ -182,31 +197,37 @@ Severities above are the same in `embedded`, `strict`, `embedded-next`, and `str
182
197
 
183
198
  ## Using `eslint-plugin-unicorn` with SFMC
184
199
 
185
- [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn) is a high-quality, widely used plugin that we **strongly recommend** — but it is built for modern JavaScript, not SFMC's **SSJS** runtime. SFMC SSJS runs on a JINT-based ES3/ES5-era engine that lacks many built-ins (`Array#includes`, `String#startsWith`, `Set`, `Map`, `Object.fromEntries`, `Math.trunc`, spread `...`, ES modules, `async`/`await`, …).
200
+ [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn) is a high-quality, widely used plugin that we **strongly recommend** — but it is built for modern JavaScript, not SFMC's **SSJS** runtime. SFMC SSJS runs on a JINT-based ES3/ES5-era engine that lacks many built-ins (`Array#includes`, `String#startsWith`, `Set`, `Map`, `Math.trunc`, spread `...`, ES modules, `async`/`await`, …). CloudPage probes found zero-argument string `slice()` throwing after a working `"Hello".substring()` call. Native `Object.fromEntries`, `toReversed`, `toSorted`, `toSpliced`, `replaceAll`, `matchAll` and `structuredClone` were unavailable: `typeof` returned `undefined` and direct calls threw, both without Core and with Core 1.1.1 or 1.1.5.
186
201
 
187
- If you enable unicorn's `recommended` set on SSJS, about **46** of its 308 recommended rules would either **autofix your code to a missing built-in** (breaking it at runtime) or **forbid a required SFMC workaround**. `eslint-plugin-sfmc` offers an **optional** override config that turns off exactly those 46 rules for SSJS.
202
+ For Unicorn **74.0.0**, the SSJS compatibility overrides disable **58** of its **308** enabled recommended rules: API/syntax incompatibilities, recorded runtime-semantic hazards, and diagnostic-only pressure toward unsafe changes. Some paths are conditionally inert under strict ES5 parsing. The other **250** remain active; this classification is not a blanket runtime-safety guarantee or new live SFMC verification.
188
203
 
189
- **Important — this is optional and only needed if you use unicorn.** `eslint-plugin-sfmc` does **not** depend on or load unicorn. The override configs are plain rules objects with **no** `plugins` key, so they only resolve when your own unicorn config (which registers the `unicorn` plugin) is loaded **earlier** in the flat-config array. Spread the sfmc override **after** it:
204
+ **Unicorn is optional; the matching SSJS protections are required when you enable it.** Include `unicorn-ssjs` when Unicorn covers standalone SSJS and `unicorn-ssjs-embedded` when it covers embedded SSJS. The example below covers both scopes, so both overrides are required. `eslint-plugin-sfmc` does **not** depend on or load unicorn. The override configs are plain rules objects with **no** `plugins` key, so they only resolve when your own unicorn config (which registers the `unicorn` plugin) is loaded **earlier** in the flat-config array. Insert each sfmc override **object** directly **after** it; only the `recommended` and `embedded` arrays are spread:
190
205
 
191
206
  ```js
192
207
  import sfmc from 'eslint-plugin-sfmc';
193
208
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
194
209
 
195
210
  export default [
196
- eslintPluginUnicorn.configs.recommended, // you opt in — registers the `unicorn` plugin
211
+ {
212
+ ...eslintPluginUnicorn.configs.recommended,
213
+ files: ['**/*.{js,mjs,cjs,ssjs}'],
214
+ languageOptions: { ...eslintPluginUnicorn.configs.recommended.languageOptions, globals: {} },
215
+ },
197
216
  ...sfmc.configs.recommended,
198
217
  ...sfmc.configs.embedded, // AMPscript + SSJS embedded in HTML (<script runat="server">)
199
- ...sfmc.configs['unicorn-ssjs'], // OPTIONAL: off the 46 SFMC-incompatible unicorn rules for SSJS
200
- ...sfmc.configs['unicorn-ssjs-embedded'], // OPTIONAL: same override for SSJS embedded in HTML (<script runat="server">)
218
+ sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the 58 incompatible rules
219
+ sfmc.configs['unicorn-ssjs-embedded'], // REQUIRED: protect SSJS embedded in HTML
201
220
  ];
202
221
  ```
203
222
 
204
223
  | Config | Files | What it does |
205
224
  | --------------------------------------- | ---------------- | --------------------------------------------------------- |
206
- | `sfmc.configs['unicorn-ssjs']` | `**/*.ssjs` | Turns off the 46 SFMC-incompatible unicorn rules for SSJS |
207
- | `sfmc.configs['unicorn-ssjs-embedded']` | `**/*.html/*.js` | Same 46-rule override for SSJS embedded in HTML |
225
+ | `sfmc.configs['unicorn-ssjs']` | `**/*.ssjs` | Turns off the 58 SFMC-incompatible unicorn rules for SSJS |
226
+ | `sfmc.configs['unicorn-ssjs-embedded']` | `**/*.html/*.js` | Same 58-rule override for SSJS embedded in HTML |
227
+
228
+ Scope the complete Unicorn preset to JavaScript/SSJS, not custom AMPscript, Handlebars or MSO ASTs. Clearing its builtin map prevents modern globals leaking into SSJS; other matching configs can still supply globals. The SFMC presets do not enable general `no-undef` checking, and extracted HTML server blocks are linted independently.
208
229
 
209
- Only **46** of unicorn's 308 recommended rules are overridden — the other **262** stay active. If you don't use unicorn, omit these configs entirely. For the full rule-by-rule breakdown (with rationale and SFMC evidence links, pinned to unicorn v73.0.0), see [docs/unicorn-compatibility.md](docs/unicorn-compatibility.md).
230
+ Only **58** of unicorn's 308 recommended rules are overridden — the other **250** stay active. If you don't use unicorn, omit these configs entirely. For the full rule-by-rule breakdown (with rationale and SFMC evidence links, pinned to unicorn v74.0.0), see [docs/unicorn-compatibility.md](docs/unicorn-compatibility.md).
210
231
 
211
232
  ## Processors
212
233
 
@@ -0,0 +1,26 @@
1
+ # `sfmc/ssjs-no-switch-fallthrough`
2
+
3
+ Flag switch clauses that appear to depend on execution continuing into the next clause.
4
+
5
+ ## Why
6
+
7
+ Marketing Cloud Engagement's SSJS engine does not implement JavaScript switch fall-through. Stacked labels therefore do not share the following body, and an unterminated case does not execute the next case's statements. Code that assumes either behavior can silently skip work.
8
+
9
+ ## What this rule reports
10
+
11
+ - An empty case or default clause before another clause: for example, two adjacent case labels with a single shared body.
12
+ - A non-final clause whose last statement is not a break, return, throw, or continue: for example, an assignment followed immediately by the next case label.
13
+
14
+ The final clause is not reported because there is no subsequent clause to enter. A non-final clause ending directly in a terminating statement is accepted. This is a structural check, not control-flow analysis: a clause ending in an if statement can still be reported even when all its branches return.
15
+
16
+ ## How to fix
17
+
18
+ Use an if/else chain when multiple values should perform the same work. Alternatively, give each case its own explicit body and terminator rather than stacking labels or expecting execution to cascade. A final clause needs no fall-through correction.
19
+
20
+ Adding break makes intent explicit, but does not repair code that actually needs the next case's work. Move that shared work into an explicit shared path instead. Also consider the separate function-scoped switch/break engine hazard described by [no-switch-default](no-switch-default.md); an if/else chain avoids both issues.
21
+
22
+ ## Configuration and applicability
23
+
24
+ This rule has no options or automatic fix. It is enabled at warning severity in the Engagement recommended and embedded configurations, and error severity in strict configurations. It applies to standalone and HTML-embedded SSJS. Next configurations disable this rule and report SSJS as unsupported instead.
25
+
26
+ To suppress an intentional empty or unterminated clause, configure `sfmc/ssjs-no-switch-fallthrough` as `off`, or use a narrowly scoped ESLint disable-next-line comment naming this rule and explaining why the clause does not depend on fall-through. Replace `sfmc` with your configured plugin namespace if using an alias.
@@ -2,11 +2,11 @@
2
2
 
3
3
  > Flag Array methods that are unavailable or broken in SFMC SSJS and suggest inserting a polyfill.
4
4
 
5
- | | |
6
- |---|---|
7
- | **Type** | `problem` |
8
- | **Default severity** | `warn` in `recommended` and `strict` |
9
- | **Fixable** | **Suggestion** only (lightbulb / `Ctrl+.` in VS Code) |
5
+ | | |
6
+ | -------------------- | ----------------------------------------------------- |
7
+ | **Type** | `problem` |
8
+ | **Default severity** | `warn` in `recommended` and `strict` |
9
+ | **Fixable** | **Suggestion** only (lightbulb / `Ctrl+.` in VS Code) |
10
10
 
11
11
  ## Why This Rule Exists
12
12
 
@@ -26,32 +26,46 @@ the language-server quick-fix so both tools place polyfills consistently.
26
26
 
27
27
  ## Covered methods
28
28
 
29
- | Method | Category | Notes |
30
- |--------|----------|-------|
31
- | `Array.prototype.copyWithin` | unavailable | |
32
- | `Array.prototype.entries` | unavailable | Returns a minimal iterator; `for...of` is also unsupported |
33
- | `Array.prototype.fill` | unavailable | |
34
- | `Array.prototype.filter` | unavailable | |
35
- | `Array.prototype.find` | unavailable | |
36
- | `Array.prototype.findIndex` | unavailable | |
37
- | `Array.prototype.forEach` | unavailable | |
38
- | `Array.prototype.includes` | unavailable | |
39
- | `Array.prototype.indexOf` | unavailable | Only flagged on array literals; string `.indexOf()` still works |
40
- | `Array.prototype.lastIndexOf` | broken | Natively always returns `-1` |
41
- | `Array.prototype.map` | unavailable | |
42
- | `Array.prototype.reduce` | unavailable | |
43
- | `Array.prototype.reduceRight` | unavailable | |
44
- | `Array.prototype.some` | unavailable | |
45
- | `Array.prototype.splice` | broken | Natively ignores `startIndex` and `deleteCount` |
46
- | `Array.isArray` | unavailable | |
47
- | `Array.of` | unavailable | |
29
+ | Method | Category | Notes |
30
+ | ----------------------------- | ----------- | --------------------------------------------------------------- |
31
+ | `Array.prototype.copyWithin` | unavailable | |
32
+ | `Array.prototype.entries` | unavailable | Returns a minimal iterator; `for...of` is also unsupported |
33
+ | `Array.prototype.fill` | unavailable | |
34
+ | `Array.prototype.filter` | unavailable | |
35
+ | `Array.prototype.find` | unavailable | |
36
+ | `Array.prototype.findIndex` | unavailable | |
37
+ | `Array.prototype.forEach` | unavailable | |
38
+ | `Array.prototype.includes` | unavailable | |
39
+ | `Array.prototype.indexOf` | unavailable | Only flagged on array literals; string `.indexOf()` still works |
40
+ | `Array.prototype.lastIndexOf` | broken | Natively always returns `-1` |
41
+ | `Array.prototype.map` | unavailable | |
42
+ | `Array.prototype.reduce` | unavailable | |
43
+ | `Array.prototype.reduceRight` | unavailable | |
44
+ | `Array.prototype.some` | unavailable | |
45
+ | `Array.prototype.splice` | broken | Natively ignores `startIndex` and `deleteCount` |
46
+ | `Array.isArray` | unavailable | |
47
+ | `Array.of` | unavailable | |
48
+
49
+ ## Catalog entries without bundled polyfills
50
+
51
+ The rule also reads `KNOWN_UNSUPPORTED` from `ssjs-data`. These reports carry the
52
+ catalog's guidance but no automatic fix or polyfill insertion suggestion. Absence
53
+ of a bundled verified polyfill does not mean a polyfill is impossible.
54
+
55
+ With `ssjs-data` 2.1.0, this includes `Object.fromEntries`, `Object.groupBy`,
56
+ `Array.prototype.toReversed`, `toSorted`, `toSpliced`, `findLastIndex`, and
57
+ `String.prototype.replaceAll` and `matchAll`. Their absence was checked in
58
+ Engagement CloudPages before Core loading and with Core 1.1.1 and 1.1.5; email and
59
+ other contexts were not tested. The catalog also records global `structuredClone`,
60
+ but this rule examines member calls, not bare global calls, so it does not report
61
+ `structuredClone()`.
48
62
 
49
63
  ## Settings
50
64
 
51
- | Setting | Values | Default |
52
- |---------|--------|---------|
53
- | severity | `"error"` \| `"warn"` \| `"off"` | `"warn"` |
54
- | `ignore` | Array of method names to suppress | `[]` |
65
+ | Setting | Values | Default |
66
+ | -------- | --------------------------------- | -------- |
67
+ | severity | `"error"` \| `"warn"` \| `"off"` | `"warn"` |
68
+ | `ignore` | Array of method names to suppress | `[]` |
55
69
 
56
70
  Use `ignore` when polyfills are loaded externally via a Content Block or Code Resource
57
71
  that runs before your script.
@@ -69,9 +83,11 @@ rules: {
69
83
 
70
84
  ```js
71
85
  var nums = [1, 2, 3];
72
- var doubled = nums.map(function (n) { return n * 2; }); // unavailable
86
+ var doubled = nums.map(function (n) {
87
+ return n * 2;
88
+ }); // unavailable
73
89
 
74
- var pos = nums.lastIndexOf(2); // broken — always returns -1 natively
90
+ var pos = nums.lastIndexOf(2); // broken — always returns -1 natively
75
91
 
76
92
  var found = Array.isArray(nums); // unavailable
77
93
  ```
@@ -80,9 +96,13 @@ var found = Array.isArray(nums); // unavailable
80
96
 
81
97
  ```js
82
98
  // Polyfill defined in the same file — rule is suppressed
83
- Array.prototype.map = function (callback) { /* ... */ };
99
+ Array.prototype.map = function (callback) {
100
+ /* ... */
101
+ };
84
102
 
85
- var doubled = nums.map(function (n) { return n * 2; }); // ok
103
+ var doubled = nums.map(function (n) {
104
+ return n * 2;
105
+ }); // ok
86
106
 
87
107
  // Native methods that work correctly are never flagged
88
108
  nums.push(4);
@@ -102,14 +122,18 @@ rules: {
102
122
 
103
123
  ```js
104
124
  // No warning — 'map' and 'filter' are in the ignore list
105
- var doubled = nums.map(function (n) { return n * 2; });
106
- var evens = nums.filter(function (n) { return n % 2 === 0; });
125
+ var doubled = nums.map(function (n) {
126
+ return n * 2;
127
+ });
128
+ var evens = nums.filter(function (n) {
129
+ return n % 2 === 0;
130
+ });
107
131
  ```
108
132
 
109
133
  ## Suggestion (lightbulb)
110
134
 
111
- When a violation is reported, a suggestion is available to insert the individual
112
- polyfill at the **end of the file**. Apply it via:
135
+ When a bundled verified polyfill exists, a suggestion is available to insert it
136
+ at the **top of the file**, after a leading global directive if present. Apply it via:
113
137
 
114
138
  - Click the **lightbulb** or press `Ctrl+.` in VS Code (requires the ESLint extension)
115
139
  - `eslint --fix` does **not** apply suggestions
@@ -1,35 +1,43 @@
1
1
  # `eslint-plugin-unicorn` compatibility with SFMC SSJS
2
2
 
3
- > **Compatibility analysis for [`eslint-plugin-unicorn@73.0.0`](https://github.com/sindresorhus/eslint-plugin-unicorn).**
3
+ > **Compatibility analysis for [`eslint-plugin-unicorn@74.0.0`](https://github.com/sindresorhus/eslint-plugin-unicorn).**
4
4
  >
5
- > ⚠️ **Version warning:** This classification was done against `eslint-plugin-unicorn` **v73.0.0** (308 recommended rules). Newer versions of unicorn may add, rename, or change rules that are **not** yet classified here. Re-audit this page whenever you upgrade unicorn — a rule added in a later version could autofix SSJS into runtime-breaking code without being in the override list below.
5
+ > ⚠️ **Version warning:** This classification was done against `eslint-plugin-unicorn` **v74.0.0** (308 recommended rules). Newer versions of unicorn may add, rename, or change rules that are **not** yet classified here. Re-audit this page whenever you upgrade unicorn — a rule added in a later version could autofix SSJS into runtime-breaking code without being in the override list below.
6
6
 
7
- `eslint-plugin-unicorn` is an excellent, actively maintained plugin that we **strongly recommend** — but it targets modern JavaScript engines, not the Salesforce Marketing Cloud **SSJS** runtime. SFMC SSJS runs on a JINT-based ES3/ES5-era engine that is missing many built-ins (`Array#includes`, `String#startsWith`, `Set`, `Map`, `Object.fromEntries`, `Math.trunc`, spread `...`, ES modules, `async`/`await`, …). See the SFMC evidence pages:
7
+ `eslint-plugin-unicorn` is an excellent, actively maintained plugin that we **strongly recommend** — but it targets modern JavaScript engines, not the Salesforce Marketing Cloud **SSJS** runtime. SFMC SSJS runs on a JINT-based ES3/ES5-era engine that is missing many built-ins (`Array#includes`, `String#startsWith`, `Set`, `Map`, `Math.trunc`, spread `...`, ES modules, `async`/`await`, …). CloudPage probes also found native `Object.fromEntries`, `matchAll` and `structuredClone` unavailable, both without Core and with Core 1.1.1 or 1.1.5. See the SFMC evidence pages:
8
8
 
9
9
  - **ECMAScript built-ins support** — <https://ssjs.guide/ecmascript-builtins/>
10
10
  - **Engine limitations** — <https://ssjs.guide/engine-limitations/>
11
11
 
12
- Of unicorn's **308** recommended rules (v73.0.0), **262** are safe to keep on for SSJS and **46** should be turned off. `eslint-plugin-sfmc` ships an **optional** override config (`unicorn-ssjs` / `unicorn-ssjs-embedded`) that turns off exactly those 46 for SSJS files. `eslint-plugin-sfmc` does **not** depend on or load unicorn — the override only takes effect when you have loaded unicorn yourself. See [Section 1](#section-1--how-to-apply).
12
+ Of unicorn's **308** recommended rules (v74.0.0), **250** remain active (including conditional and inert cases; not a blanket runtime-safety guarantee) and **58** should be turned off. `eslint-plugin-sfmc` ships a scope-specific override config (`unicorn-ssjs` / `unicorn-ssjs-embedded`) that turns off exactly those 58 for SSJS files. `eslint-plugin-sfmc` does **not** depend on or load unicorn — the override only takes effect when you have loaded unicorn yourself. See [Section 1](#section-1--how-to-apply).
13
13
 
14
14
  ---
15
15
 
16
16
  ## Section 1 — How to apply
17
17
 
18
- The override is **optional** and **SSJS-scoped**. `eslint-plugin-sfmc` never loads unicorn; the override is a plain rules object that only resolves when you have loaded your own unicorn config **earlier** in the flat-config array (that config registers the `unicorn` plugin). Spread the sfmc override **after** it:
18
+ Requires ESLint **10.4.0+** and Node.js **22+**. Raising the ESLint peer minimum is a breaking requirement change, independent of preserving all 12 public preset shapes.
19
+
20
+ Unicorn itself is **optional**. When you enable it for standalone SSJS, `unicorn-ssjs` is **required**; when you enable it for embedded SSJS, `unicorn-ssjs-embedded` is **required**. The example below covers both scopes, so it requires both overrides. `eslint-plugin-sfmc` never loads unicorn; the override is a plain rules object that only resolves when you have loaded your own unicorn config **earlier** in the flat-config array (that config registers the `unicorn` plugin). Insert each sfmc override **object** directly **after** it; only the `recommended` and `embedded` arrays are spread:
19
21
 
20
22
  ```js
21
23
  import sfmc from 'eslint-plugin-sfmc';
22
24
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
23
25
 
24
26
  export default [
25
- eslintPluginUnicorn.configs.recommended, // you opt in — registers the `unicorn` plugin
27
+ {
28
+ ...eslintPluginUnicorn.configs.recommended,
29
+ files: ['**/*.{js,mjs,cjs,ssjs}'],
30
+ languageOptions: { ...eslintPluginUnicorn.configs.recommended.languageOptions, globals: {} },
31
+ },
26
32
  ...sfmc.configs.recommended,
27
33
  ...sfmc.configs.embedded, // AMPscript + SSJS embedded in HTML (<script runat="server">)
28
- ...sfmc.configs['unicorn-ssjs'], // OPTIONAL: off the 46 SFMC-incompatible unicorn rules for SSJS
29
- ...sfmc.configs['unicorn-ssjs-embedded'], // OPTIONAL: same override for SSJS embedded in HTML (<script runat="server">)
34
+ sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the 58 incompatible rules
35
+ sfmc.configs['unicorn-ssjs-embedded'], // REQUIRED: protect SSJS embedded in HTML
30
36
  ];
31
37
  ```
32
38
 
39
+ Keep the full recommended rule set, but scope it to JavaScript and SSJS (including extracted HTML JavaScript). AMPscript, Handlebars and MSO use custom ASTs that JavaScript-only Unicorn visitors cannot traverse safely. Replace Unicorn's builtin globals within this copied preset with an empty map so the language/runtime configs own globals; this does not remove globals from other matching config entries. The SFMC presets do not enable general `no-undef` checking, and separate HTML server blocks are linted independently.
40
+
33
41
  | Config | Applies to |
34
42
  |---|---|
35
43
  | `unicorn-ssjs` | `**/*.ssjs` |
@@ -37,45 +45,68 @@ export default [
37
45
 
38
46
  If you don't use unicorn, omit these configs entirely — nothing else in `eslint-plugin-sfmc` references them.
39
47
 
48
+ All 12 public shapes remain unchanged: six objects (`ampscript`, `ssjs`, `ampscript-next`, `ssjs-next`, `unicorn-ssjs`, `unicorn-ssjs-embedded`) and six arrays (`recommended`, `embedded`, `strict`, `recommended-next`, `embedded-next`, `strict-next`). Raw arrays require spreading the multi-config presets as above, not the single override objects.
49
+
50
+ Alternatively, ESLint's `defineConfig` flattens nested configuration arrays. This no-spread-array form is verified at exactly ESLint **10.4.0** and at **10.8.0**; it is documented for the declared **10.4.0+** range, not as a claim about older ESLint versions:
51
+
52
+ ```js
53
+ import { defineConfig } from 'eslint/config';
54
+ import sfmc from 'eslint-plugin-sfmc';
55
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
56
+
57
+ export default defineConfig(
58
+ {
59
+ ...eslintPluginUnicorn.configs.recommended,
60
+ files: ['**/*.{js,mjs,cjs,ssjs}'],
61
+ languageOptions: { ...eslintPluginUnicorn.configs.recommended.languageOptions, globals: {} },
62
+ },
63
+ sfmc.configs.recommended,
64
+ sfmc.configs.embedded,
65
+ sfmc.configs['unicorn-ssjs'],
66
+ sfmc.configs['unicorn-ssjs-embedded'],
67
+ );
68
+ ```
69
+
40
70
  ---
41
71
 
42
- ## Section 2 — Rules to override for SSJS (46)
72
+ ## Section 2 — Rules to override for SSJS (58)
43
73
 
44
- These 46 recommended rules either **autofix code to a missing built-in**, **forbid a documented SFMC workaround**, or **enforce ES-module / async / ES6-only syntax** the engine cannot run. The override config sets each to `'off'` for SSJS. All 46 are confirmed `recommended` in unicorn v73.0.0.
74
+ These 58 recommended rules introduce unavailable or unresolved APIs, conflict with recorded runtime semantics, pressure users toward unsafe changes through diagnostics, or introduce unsupported syntax. Some paths are conditionally inert under strict ES5 parsing. The override config sets each to `'off'` for SSJS. All 58 are confirmed `recommended` in unicorn v74.0.0.
45
75
 
46
- ### Group A — autofix to a missing built-in / forbid a SFMC workaround (41)
76
+ ### Group A — API, runtime-semantic and diagnostic protections (50)
47
77
 
48
78
  | Rule | Why it breaks SSJS | SFMC evidence |
49
79
  |---|---|---|
50
80
  | [`prefer-includes`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md) | Pushes `Array/String#includes()` — missing in SSJS | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
51
81
  | [`prefer-string-starts-ends-with`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md) | Pushes `String#startsWith/endsWith` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
52
82
  | [`prefer-string-trim-start-end`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-trim-start-end.md) | Pushes `trimStart/trimEnd` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
53
- | [`prefer-string-slice`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md) | Forbids `substring`, the SFMC-safe choice | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
54
- | [`prefer-string-replace-all`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md) | Pushes `String#replaceAll` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
83
+ | [`prefer-string-slice`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md) | Zero-argument autofix changes working `"Hello".substring()` into throwing `"Hello".slice()` in CloudPage probes; explicit-index slice remains a separate supported contract | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
84
+ | [`prefer-string-replace-all`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md) | Regex-replace and split/join autofixes emit native `replaceAll`, unavailable in CloudPage probes | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
55
85
  | [`prefer-string-repeat`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-repeat.md) | Pushes `String#repeat` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
56
86
  | [`prefer-string-pad-start-end`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-pad-start-end.md) | Pushes `padStart/padEnd` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
57
- | [`prefer-string-match-all`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-match-all.md) | Pushes `String#matchAll` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
87
+ | [`prefer-string-match-all`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-match-all.md) | Pushes native `String#matchAll`, unavailable in CloudPage probes: `typeof` was `undefined` and direct calls threw without Core and with Core 1.1.1 or 1.1.5 | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
58
88
  | [`prefer-string-raw`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-raw.md) | Pushes `String.raw` tag — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
59
- | [`prefer-code-point`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md) | Pushes `codePointAt/fromCodePoint` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
89
+ | [`prefer-code-point`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-code-point.md) | Editor suggestions introduce `codePointAt/fromCodePoint`; not automatic fixes, and method availability is still required | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
60
90
  | [`prefer-array-find`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-find.md) | Pushes `Array#find/findLast` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
61
91
  | [`prefer-array-some`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md) | Pushes `Array#some` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
62
- | [`prefer-array-index-of`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md) | Pushes `findIndex/findLastIndex` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
92
+ | [`prefer-array-index-of`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md) | Replaces find-index patterns with `indexOf`/`lastIndexOf` (not the reverse); generated branches require supported native methods or an actually supplied polyfill | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
63
93
  | [`prefer-array-flat`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md) | Pushes `Array#flat` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
64
94
  | [`prefer-array-flat-map`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md) | Pushes `Array#flatMap` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
65
95
  | [`prefer-array-last-methods`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-last-methods.md) | Pushes `.at()/findLast` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
66
- | [`prefer-array-from-async`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-from-async.md) | Pushes `Array.fromAsync` — missing + async unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
67
- | [`no-array-reverse`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md) | Autofixes to `Array#toReversed()` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
96
+ | [`prefer-array-from-async`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-from-async.md) | Pushes `Array.fromAsync` without established target-runtime support; conservative output protection, with async syntax independently unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
97
+ | [`no-array-reverse`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md) | Suggests native `Array#toReversed()`, unavailable in CloudPage probes | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
98
+ | [`no-array-sort`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort.md) | Editor suggestion emits native `toSorted()`, unavailable in CloudPage probes; ES5 parsing does not prevent suggestions | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
99
+ | [`no-array-splice`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-splice.md) | Eligible fresh-local-array suggestion reassigns using native `toSpliced()`, unavailable in CloudPage probes; escaping aliases and used return values suppress this suggestion | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
68
100
  | [`prefer-at`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md) | Pushes `.at()` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
69
101
  | [`prefer-negative-index`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md) | Pushes `.at()` — missing; forbids the `.length - i` workaround | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
70
102
  | [`prefer-spread`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md) | Pushes spread `...` — ES6 syntax, throws on ES3 | [Engine limitations](https://ssjs.guide/engine-limitations/) |
71
- | [`prefer-date-now`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-date-now.md) | Pushes `Date.now()` — missing static | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
72
- | [`prefer-object-from-entries`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md) | Pushes `Object.fromEntries` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
103
+ | [`prefer-date-now`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-date-now.md) | Replaces numeric timestamp expressions with `Date.now()`, which returns a Date object in recorded SSJS rather than the expected number | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
104
+ | [`prefer-object-from-entries`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md) | Reduce/configured-function autofixes emit native `Object.fromEntries`, unavailable in CloudPage probes | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
73
105
  | [`prefer-reflect-apply`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-reflect-apply.md) | Pushes `Reflect.apply` — `Reflect` missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
74
106
  | [`prefer-number-properties`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md) | Pushes `Number.parseInt/parseFloat/isNaN/isFinite` statics — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
75
107
  | [`prefer-number-is-safe-integer`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-is-safe-integer.md) | Pushes `Number.isSafeInteger` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
76
108
  | [`prefer-number-coercion`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-coercion.md) | Number-static patterns unsafe on the ES3 engine | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
77
- | [`prefer-global-number-constants`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-number-constants.md) | Pushes `Number.NaN/Number.POSITIVE_INFINITY` etc. — missing statics | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
78
- | [`prefer-native-coercion-functions`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md) | Native coercion refs that are missing/unsafe | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
109
+ | [`prefer-native-coercion-functions`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md) | Replacing a wrapper with native coercion changes zero-argument behavior: recorded SSJS `String()` differs from a wrapper called without its parameter | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
79
110
  | [`prefer-math-trunc`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-trunc.md) | Pushes `Math.trunc` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
80
111
  | [`prefer-modern-math-apis`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md) | Pushes `Math.log10/log2/hypot` — missing; forbids `Math.log(x)/Math.LN10` and `Math.sqrt(a*a+b*b)` workarounds | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
81
112
  | [`no-instanceof-builtins`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-builtins.md) | Autofixes `instanceof Array` to `Array.isArray` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
@@ -83,31 +114,42 @@ These 46 recommended rules either **autofix code to a missing built-in**, **forb
83
114
  | [`prefer-set-has`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md) | Pushes `Set` — ES6, unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
84
115
  | [`prefer-set-size`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-size.md) | Pushes `Set` — ES6, unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
85
116
  | [`prefer-set-methods`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-methods.md) | Pushes `Set` methods — ES2024, unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
86
- | [`prefer-map-from-entries`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-map-from-entries.md) | Pushes `Map` + `Object.fromEntries` — unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
87
- | [`prefer-group-by`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-group-by.md) | Pushes `Object.groupBy/Map.groupBy` — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
117
+ | [`prefer-map-from-entries`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-map-from-entries.md) | Pushes unsupported `Map`; native `Object.fromEntries` is also unavailable in CloudPage probes | [Engine limitations](https://ssjs.guide/engine-limitations/) |
118
+ | [`prefer-group-by`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-group-by.md) | Pushes `Object.groupBy` without established target-runtime support; conservative output protection, with `Map.groupBy` independently requiring unsupported `Map` | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
88
119
  | [`prefer-iterator-helpers`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-helpers.md) | Pushes the iterator-helper protocol — unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
89
- | [`prefer-structured-clone`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md) | Pushes `structuredClone` global — missing | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
90
- | [`require-array-join-separator`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md) | Safe alone, but grouped here to avoid pushing modern array idioms under the strict set | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
120
+ | [`prefer-structured-clone`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md) | Pushes native `structuredClone`, unavailable in CloudPage probes: `typeof` was `undefined` and direct calls threw without Core and with Core 1.1.1 or 1.1.5 | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
121
+ | [`prefer-includes-over-repeated-comparisons`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes-over-repeated-comparisons.md) | Diagnostic-only pressure toward unavailable `.includes()`; no fix or editor suggestion | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
122
+ | [`prefer-object-define-properties`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-define-properties.md) | Autofix combines singular calls into unavailable plural `Object.defineProperties`; singular support does not establish plural support or descriptor equivalence | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
123
+ | [`no-new-array`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md) | Autofix emits `Array.from`; v74 string-method inference newly reaches `new Array("abc".indexOf(value))` with an unknown parameter | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
124
+ | [`no-unnecessary-array-splice-count`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md) | Autofix omits `deleteCount`; recorded native one-argument SSJS `splice` throws | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
125
+ | [`prefer-regexp-test`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md) | Recorded no-match `match()` returns truthy `[]`, and missed `search()` returns `0`; conversion to `.test()` changes truthiness and affected inequality predicates | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
126
+ | [`no-unnecessary-splice`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-splice.md) | One-argument splice throws, unlike `.length = 0`; replacement branches also change recorded insertion/overwrite semantics. The used-return `shift()` branch is diagnostic-only, not an autofix | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
127
+ | [`no-redundant-comparison`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-redundant-comparison.md) | With the numeric equality gate `x === y && x > Number.MIN_VALUE && y > 0`, an editor suggestion removes `y > 0`; recorded negative `MIN_VALUE` invalidates the host-derived implication | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
128
+ | [`no-impossible-length-comparison`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-impossible-length-comparison.md) | Diagnostic-only length comparison reasoning assumes the host's positive `Number.MIN_VALUE`, contrary to the recorded negative SSJS value | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
129
+ | [`no-useless-coercion`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-coercion.md) | Autofix removes required coercion from `Number(Number.MIN_VALUE > 0 ? 1 : 'x')`; host evaluation selects a number, while recorded SSJS selects a string | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
91
130
 
92
- ### Group B — forbid ES6+ syntax / ES-module / async constructs (5)
131
+ ### Group B — introduce or require ES6+ syntax / ES-module / async constructs (8)
93
132
 
94
133
  | Rule | Why it breaks SSJS | SFMC evidence |
95
134
  |---|---|---|
135
+ | [`no-for-loop`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md) | Autofix introduces `for...of` and `const`. The v74 visitor is inert under strict ES5 parsing because it needs block scopes; the same ES5 source becomes reachable with ES2015 parsing | [Engine limitations](https://ssjs.guide/engine-limitations/) |
136
+ | [`prefer-default-parameters`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md) | Editor suggestion replaces parameter reassignment with ES6 default-parameter syntax; reachable under ES5 input parsing | [Engine limitations](https://ssjs.guide/engine-limitations/) |
137
+ | [`require-array-sort-compare`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-sort-compare.md) | Both numeric and string comparator suggestions introduce arrow functions even under ES5 parsing | [Engine limitations](https://ssjs.guide/engine-limitations/) |
96
138
  | [`prefer-optional-catch-binding`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-optional-catch-binding.md) | Pushes `catch {}` (ES2019) — may not parse on ES3 | [Engine limitations](https://ssjs.guide/engine-limitations/) |
97
139
  | [`prefer-module`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-module.md) | Pushes ES modules — unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
98
140
  | [`prefer-node-protocol`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md) | Pushes `node:` imports — no module system | [Engine limitations](https://ssjs.guide/engine-limitations/) |
99
141
  | [`prefer-top-level-await`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-top-level-await.md) | Pushes top-level `await` — async unsupported | [Engine limitations](https://ssjs.guide/engine-limitations/) |
100
142
  | [`prefer-export-from`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-export-from.md) | Pushes `export … from` — ES modules | [Engine limitations](https://ssjs.guide/engine-limitations/) |
101
143
 
102
- > **Note:** [`prefer-regexp-test`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md) stays **active** — `RegExp#test` exists in SFMC SSJS, so it is intentionally **not** in the override list.
144
+ > **Regex caution:** Availability of `RegExp#test` does not establish equivalence with `.match()` or `.search()`. Recorded SSJS no-match arrays, zero-result search behavior and conflicting global-regex state evidence must be checked against the actual transformation predicate.
103
145
 
104
146
  ---
105
147
 
106
- ## Section 3 — Rules OK as-is (262)
148
+ ## Section 3 — Active rules, including conditional cases (250)
107
149
 
108
- These recommended rules are **not** disabled by the override config. They are either genuinely SFMC-safe (readability / best-practice rules that work on the ES3/ES5 engine) or **inert** on SSJS — many target the DOM, Node.js, Promises, TypeScript, or ES modules and therefore never fire on server-side SFMC code. Each links to its official unicorn documentation.
150
+ These recommended rules are **not** disabled by the override config. Active is a policy classification, not proof that every transformation is safe in SFMC. Modern-syntax-gated paths may be inert under strict ES5 parsing; DOM, Node.js, TypeScript and custom/polyfilled-object paths require their own environment contracts. Each links to its official Unicorn documentation. See the evidence qualifications below before accepting generated changes.
109
151
 
110
- <!-- BEGIN 262-OK-LIST -->
152
+ <!-- BEGIN 250-OK-LIST -->
111
153
  - [better-dom-traversing](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-dom-traversing.md)
112
154
  - [catch-error-name](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md)
113
155
  - [class-reference-in-static-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/class-reference-in-static-methods.md)
@@ -151,8 +193,6 @@ These recommended rules are **not** disabled by the override config. They are ei
151
193
  - [no-array-method-this-argument](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md)
152
194
  - [no-array-reduce](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reduce.md)
153
195
  - [no-array-sort-for-min-max](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort-for-min-max.md)
154
- - [no-array-sort](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort.md)
155
- - [no-array-splice](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-splice.md)
156
196
  - [no-async-promise-finally](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-async-promise-finally.md)
157
197
  - [no-await-expression-member](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md)
158
198
  - [no-await-in-promise-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-in-promise-methods.md)
@@ -177,10 +217,8 @@ These recommended rules are **not** disabled by the override config. They are ei
177
217
  - [no-empty-file](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-empty-file.md)
178
218
  - [no-error-property-assignment](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-error-property-assignment.md)
179
219
  - [no-exports-in-scripts](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-exports-in-scripts.md)
180
- - [no-for-loop](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md)
181
220
  - [no-global-object-property-assignment](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-global-object-property-assignment.md)
182
221
  - [no-immediate-mutation](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-immediate-mutation.md)
183
- - [no-impossible-length-comparison](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-impossible-length-comparison.md)
184
222
  - [no-incorrect-query-selector](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-incorrect-query-selector.md)
185
223
  - [no-incorrect-template-string-interpolation](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-incorrect-template-string-interpolation.md)
186
224
  - [no-invalid-argument-count](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-invalid-argument-count.md)
@@ -202,7 +240,6 @@ These recommended rules are **not** disabled by the override config. They are ei
202
240
  - [no-negated-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md)
203
241
  - [no-negation-in-equality-check](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negation-in-equality-check.md)
204
242
  - [no-nested-ternary](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-nested-ternary.md)
205
- - [no-new-array](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md)
206
243
  - [no-new-buffer](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md)
207
244
  - [no-non-function-verb-prefix](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-non-function-verb-prefix.md)
208
245
  - [no-nonstandard-builtin-properties](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-nonstandard-builtin-properties.md)
@@ -211,7 +248,6 @@ These recommended rules are **not** disabled by the override config. They are ei
211
248
  - [no-object-methods-with-collections](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-object-methods-with-collections.md)
212
249
  - [no-optional-chaining-on-undeclared-variable](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-optional-chaining-on-undeclared-variable.md)
213
250
  - [no-process-exit](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md)
214
- - [no-redundant-comparison](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-redundant-comparison.md)
215
251
  - [no-return-array-push](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-return-array-push.md)
216
252
  - [no-selector-as-dom-name](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-selector-as-dom-name.md)
217
253
  - [no-shorthand-property-overrides](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-shorthand-property-overrides.md)
@@ -229,7 +265,6 @@ These recommended rules are **not** disabled by the override config. They are ei
229
265
  - [no-undeclared-class-members](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-undeclared-class-members.md)
230
266
  - [no-unnecessary-array-flat-depth](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-depth.md)
231
267
  - [no-unnecessary-array-flat-map](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-flat-map.md)
232
- - [no-unnecessary-array-splice-count](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-array-splice-count.md)
233
268
  - [no-unnecessary-await](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-await.md)
234
269
  - [no-unnecessary-boolean-comparison](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-boolean-comparison.md)
235
270
  - [no-unnecessary-fetch-options](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-fetch-options.md)
@@ -237,7 +272,6 @@ These recommended rules are **not** disabled by the override config. They are ei
237
272
  - [no-unnecessary-nested-ternary](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-nested-ternary.md)
238
273
  - [no-unnecessary-polyfills](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-polyfills.md)
239
274
  - [no-unnecessary-slice-end](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-slice-end.md)
240
- - [no-unnecessary-splice](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-splice.md)
241
275
  - [no-unnecessary-string-trim](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-string-trim.md)
242
276
  - [no-unreadable-array-destructuring](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-array-destructuring.md)
243
277
  - [no-unreadable-for-of-expression](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-for-of-expression.md)
@@ -250,7 +284,6 @@ These recommended rules are **not** disabled by the override config. They are ei
250
284
  - [no-unsafe-string-replacement](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-string-replacement.md)
251
285
  - [no-unused-array-method-return](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-array-method-return.md)
252
286
  - [no-useless-boolean-cast](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-boolean-cast.md)
253
- - [no-useless-coercion](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-coercion.md)
254
287
  - [no-useless-collection-argument](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md)
255
288
  - [no-useless-compound-assignment](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-compound-assignment.md)
256
289
  - [no-useless-concat](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-concat.md)
@@ -292,7 +325,6 @@ These recommended rules are **not** disabled by the override config. They are ei
292
325
  - [prefer-class-fields](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md)
293
326
  - [prefer-classlist-toggle](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-classlist-toggle.md)
294
327
  - [prefer-continue](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-continue.md)
295
- - [prefer-default-parameters](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md)
296
328
  - [prefer-direct-iteration](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-direct-iteration.md)
297
329
  - [prefer-dom-node-append](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md)
298
330
  - [prefer-dom-node-html-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-html-methods.md)
@@ -304,12 +336,12 @@ These recommended rules are **not** disabled by the override config. They are ei
304
336
  - [prefer-event-target](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-event-target.md)
305
337
  - [prefer-flat-math-min-max](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-flat-math-min-max.md)
306
338
  - [prefer-get-or-insert-computed](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-get-or-insert-computed.md)
339
+ - [prefer-global-number-constants](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-number-constants.md)
307
340
  - [prefer-global-this](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-global-this.md)
308
341
  - [prefer-has-check](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-has-check.md)
309
342
  - [prefer-hoisting-branch-code](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-hoisting-branch-code.md)
310
343
  - [prefer-https](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-https.md)
311
344
  - [prefer-identifier-import-export-specifiers](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-identifier-import-export-specifiers.md)
312
- - [prefer-includes-over-repeated-comparisons](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes-over-repeated-comparisons.md)
313
345
  - [prefer-iterable-in-constructor](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterable-in-constructor.md)
314
346
  - [prefer-iterator-to-array-at-end](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-to-array-at-end.md)
315
347
  - [prefer-iterator-to-array](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-to-array.md)
@@ -321,7 +353,6 @@ These recommended rules are **not** disabled by the override config. They are ei
321
353
  - [prefer-math-min-max](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-math-min-max.md)
322
354
  - [prefer-minimal-ternary](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-minimal-ternary.md)
323
355
  - [prefer-modern-dom-apis](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-dom-apis.md)
324
- - [prefer-object-define-properties](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-define-properties.md)
325
356
  - [prefer-object-destructuring-defaults](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-destructuring-defaults.md)
326
357
  - [prefer-object-iterable-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-iterable-methods.md)
327
358
  - [prefer-observer-apis](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-observer-apis.md)
@@ -332,7 +363,6 @@ These recommended rules are **not** disabled by the override config. They are ei
332
363
  - [prefer-prototype-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-prototype-methods.md)
333
364
  - [prefer-query-selector](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md)
334
365
  - [prefer-queue-microtask](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-queue-microtask.md)
335
- - [prefer-regexp-test](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md)
336
366
  - [prefer-response-static-json](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-response-static-json.md)
337
367
  - [prefer-scoped-selector](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-scoped-selector.md)
338
368
  - [prefer-simple-condition-first](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-simple-condition-first.md)
@@ -357,7 +387,6 @@ These recommended rules are **not** disabled by the override config. They are ei
357
387
  - [prefer-url-search-parameters](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-url-search-parameters.md)
358
388
  - [prefer-while-loop-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-while-loop-condition.md)
359
389
  - [relative-url-style](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/relative-url-style.md)
360
- - [require-array-sort-compare](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-sort-compare.md)
361
390
  - [require-css-escape](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-css-escape.md)
362
391
  - [require-module-attributes](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-attributes.md)
363
392
  - [require-module-specifiers](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-specifiers.md)
@@ -370,5 +399,10 @@ These recommended rules are **not** disabled by the override config. They are ei
370
399
  - [template-indent](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md)
371
400
  - [text-encoding-identifier-case](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md)
372
401
  - [throw-new-error](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md)
373
- <!-- END 262-OK-LIST -->
402
+ - [require-array-join-separator](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md)
403
+ <!-- END 250-OK-LIST -->
404
+
405
+ **Reactivated, with bounded evidence:** `require-array-join-separator` adds an explicit comma separator, which recorded SSJS supports. `prefer-global-number-constants` replaces Number properties with globals: positive-infinity and NaN fixes have focused coverage, including shadowing guards. Its negative-infinity property branch is diagnostic-only; recorded sign differences mean accepting that diagnostic remains conditional, not a blanket constant-equivalence clearance.
406
+
407
+ The HTML processor has `supportsAutofix: false`: diagnostics remain, while fixes and editor suggestions are stripped. Standalone upstream tests establish the generated outputs; suppression tests cover both public overrides and ordinary `.js`/`.mjs` non-leakage.
374
408
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-sfmc",
3
- "version": "4.16.2",
3
+ "version": "5.1.0",
4
4
  "description": "ESLint plugin for Salesforce Marketing Cloud Engagement+Next - AMPscript, Server-Side JavaScript (SSJS) and Handlebars",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -42,13 +42,15 @@
42
42
  "handlebars-data": "^0.4.0",
43
43
  "mso-conditional-parser": "^2.0.1",
44
44
  "sfmc-handlebars-parser": "^0.1.1",
45
- "ssjs-data": "^2.0.0"
45
+ "ssjs-data": "^2.1.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "eslint": ">=9.0.0"
48
+ "eslint": ">=10.4.0"
49
49
  },
50
50
  "scripts": {
51
- "test": "node --test tests/rules.test.js && node --test tests/deprecated-catalog.test.js && node --test tests/fixtures.test.mjs && node --test tests/autofix-manual.test.mjs",
51
+ "test": "node --test tests/release-safeguards.test.js tests/metadata.test.js && node --test tests/rules.test.js && node --test tests/deprecated-catalog.test.js && node --test tests/fixtures.test.mjs && node --test tests/autofix-manual.test.mjs && node --test tests/unicorn-protection.test.js tests/unicorn-hazards.test.js tests/unicorn-configs.test.js && node --test tests/unicorn-minimum.test.js",
52
+ "test:release": "node --test tests/release-safeguards.test.js",
53
+ "validate:release-docs": "node scripts/validate-release-documentation.js",
52
54
  "test:autofix-manual": "node --test tests/autofix-manual.test.mjs",
53
55
  "test:fixtures": "node --test tests/fixtures.test.mjs",
54
56
  "test:fixtures:update": "node --test tests/fixtures.test.mjs -- --update-snapshots",
@@ -66,9 +68,10 @@
66
68
  "@eslint/js": "^10.0.1",
67
69
  "eslint": "^10.8.0",
68
70
  "eslint-config-prettier": "^10.1.8",
71
+ "eslint-minimum": "npm:eslint@10.4.0",
69
72
  "eslint-plugin-jsdoc": "^63.3.3",
70
73
  "eslint-plugin-prettier": "^5.5.6",
71
- "eslint-plugin-unicorn": "^73.0.0",
74
+ "eslint-plugin-unicorn": "^74.0.0",
72
75
  "globals": "^17.9.0",
73
76
  "husky": "^9.1.7",
74
77
  "lint-staged": "^17.3.0",
package/src/index.js CHANGED
@@ -9,6 +9,7 @@
9
9
  * - vscode-sfmc-language (IntelliSense, diagnostics)
10
10
  */
11
11
 
12
+ import { createRequire } from 'node:module';
12
13
  import * as ampscriptParser from './ampscript-parser.js';
13
14
  import * as handlebarsParser from './handlebars-parser.js';
14
15
 
@@ -94,10 +95,12 @@ import { SSJS_GLOBALS_MAP } from 'ssjs-data';
94
95
 
95
96
  // ── Plugin definition ─────────────────────────────────────────────────────────
96
97
 
98
+ const { version } = createRequire(import.meta.url)('../package.json');
99
+
97
100
  const plugin = {
98
101
  meta: {
99
102
  name: 'eslint-plugin-sfmc',
100
- version: '0.1.0',
103
+ version,
101
104
  },
102
105
 
103
106
  rules: {
@@ -167,6 +170,21 @@ const plugin = {
167
170
  },
168
171
  };
169
172
 
173
+ // Derive paths from public IDs, not source filenames or the configured namespace.
174
+ for (const [ruleId, rule] of Object.entries(plugin.rules)) {
175
+ const documentationPath = ruleId.replace('-', '/');
176
+ plugin.rules[ruleId] = {
177
+ ...rule,
178
+ meta: {
179
+ ...rule.meta,
180
+ docs: {
181
+ ...rule.meta.docs,
182
+ url: `https://github.com/JoernBerkefeld/eslint-plugin-sfmc/blob/v${version}/docs/rules/${documentationPath}.md`,
183
+ },
184
+ },
185
+ };
186
+ }
187
+
170
188
  // ── MCN SSJS rule set (all SSJS rules off except ssjs-no-unknown-function) ────
171
189
 
172
190
  /**
@@ -368,9 +386,9 @@ function standaloneHandlebarsConfigs(configName) {
368
386
  // ── Optional eslint-plugin-unicorn override for SSJS ──────────────────────────
369
387
 
370
388
  /**
371
- * The 46 `eslint-plugin-unicorn` recommended rules (analysed against
372
- * unicorn v73.0.0) that are incompatible with the SFMC SSJS (JINT / ES3-ES5)
373
- * engine — they either autofix code to a missing built-in or forbid a required
389
+ * The 58 `eslint-plugin-unicorn` recommended rules (analysed against
390
+ * unicorn v74.0.0) that are incompatible with the SFMC SSJS (JINT / ES3-ES5)
391
+ * engine — they either fix/suggest code using a missing built-in or forbid a required
374
392
  * SFMC workaround, or enforce ES-module / async / ES6-only syntax that the
375
393
  * engine cannot run. Each is mapped to `'off'`.
376
394
  *
@@ -385,7 +403,10 @@ const unicornSsjsOffRules = {
385
403
  'unicorn/prefer-includes': 'off',
386
404
  'unicorn/prefer-string-starts-ends-with': 'off',
387
405
  'unicorn/prefer-string-trim-start-end': 'off',
406
+ // CloudPage probes: working "Hello".substring()
407
+ // becomes throwing slice(); explicit-index string slice is a separate contract.
388
408
  'unicorn/prefer-string-slice': 'off',
409
+ // Same measured contexts: replaceAll is undefined and its direct call throws.
389
410
  'unicorn/prefer-string-replace-all': 'off',
390
411
  'unicorn/prefer-string-repeat': 'off',
391
412
  'unicorn/prefer-string-pad-start-end': 'off',
@@ -399,17 +420,25 @@ const unicornSsjsOffRules = {
399
420
  'unicorn/prefer-array-flat-map': 'off',
400
421
  'unicorn/prefer-array-last-methods': 'off',
401
422
  'unicorn/prefer-array-from-async': 'off',
423
+ // CloudPage probes: toReversed/toSorted/toSpliced are undefined; direct calls
424
+ // throw. Editor suggestions can introduce these methods under ES5 parsing.
402
425
  'unicorn/no-array-reverse': 'off',
426
+ 'unicorn/no-array-sort': 'off',
427
+ 'unicorn/no-array-splice': 'off',
403
428
  'unicorn/prefer-at': 'off',
404
429
  'unicorn/prefer-negative-index': 'off',
405
430
  'unicorn/prefer-spread': 'off',
406
431
  'unicorn/prefer-date-now': 'off',
432
+ // CloudPage probes: Object.fromEntries is undefined and pair-array calls throw.
407
433
  'unicorn/prefer-object-from-entries': 'off',
408
434
  'unicorn/prefer-reflect-apply': 'off',
409
435
  'unicorn/prefer-number-properties': 'off',
410
436
  'unicorn/prefer-number-is-safe-integer': 'off',
411
437
  'unicorn/prefer-number-coercion': 'off',
412
- 'unicorn/prefer-global-number-constants': 'off',
438
+ // Host constant inference differs from recorded SFMC numeric constants.
439
+ 'unicorn/no-redundant-comparison': 'off',
440
+ 'unicorn/no-impossible-length-comparison': 'off',
441
+ 'unicorn/no-useless-coercion': 'off',
413
442
  'unicorn/prefer-native-coercion-functions': 'off',
414
443
  'unicorn/prefer-math-trunc': 'off',
415
444
  'unicorn/prefer-modern-math-apis': 'off',
@@ -422,8 +451,19 @@ const unicornSsjsOffRules = {
422
451
  'unicorn/prefer-group-by': 'off',
423
452
  'unicorn/prefer-iterator-helpers': 'off',
424
453
  'unicorn/prefer-structured-clone': 'off',
425
- 'unicorn/require-array-join-separator': 'off',
454
+ // Native match/search miss results and splice behavior are not standard JS.
455
+ 'unicorn/prefer-regexp-test': 'off',
456
+ 'unicorn/no-unnecessary-splice': 'off',
457
+ 'unicorn/prefer-includes-over-repeated-comparisons': 'off',
458
+ 'unicorn/prefer-object-define-properties': 'off',
459
+ 'unicorn/no-new-array': 'off',
460
+ 'unicorn/no-unnecessary-array-splice-count': 'off',
426
461
  // Group B — forbid ES6+ syntax / ES-module / async constructs
462
+ // Inert with strict ES5 parsing, but introduces for-of when block scopes are enabled.
463
+ 'unicorn/no-for-loop': 'off',
464
+ 'unicorn/prefer-default-parameters': 'off',
465
+ // Both comparator suggestions use arrow functions, even when parsing ES5.
466
+ 'unicorn/require-array-sort-compare': 'off',
427
467
  'unicorn/prefer-optional-catch-binding': 'off',
428
468
  'unicorn/prefer-module': 'off',
429
469
  'unicorn/prefer-node-protocol': 'off',
@@ -822,15 +862,15 @@ plugin.configs = {
822
862
  ...msoRuleConfigs(),
823
863
  ],
824
864
 
825
- // ── Optional eslint-plugin-unicorn override configs ───────────────────────
865
+ // ── Required overrides when eslint-plugin-unicorn covers SSJS ────────────
826
866
 
827
867
  /**
828
- * OPTIONAL: turns off the 46 unicorn recommended rules incompatible with
829
- * SFMC SSJS, for standalone `.ssjs` files. Plain rules object with NO
830
- * `plugins` key — eslint-plugin-sfmc does not load unicorn. Spread this
868
+ * REQUIRED when unicorn covers standalone `.ssjs` files: turns off the 58
869
+ * unicorn recommended rules incompatible with SFMC SSJS. Plain rules object with NO
870
+ * `plugins` key — eslint-plugin-sfmc does not load unicorn. Insert this object
831
871
  * AFTER your own unicorn config (which registers the `unicorn` plugin);
832
- * otherwise ESLint cannot resolve the `unicorn/*` keys. If you don't use
833
- * unicorn, omit this config entirely.
872
+ * otherwise ESLint cannot resolve the `unicorn/*` keys. Omit this config
873
+ * if unicorn is not enabled for standalone SSJS.
834
874
  */
835
875
  'unicorn-ssjs': {
836
876
  name: 'sfmc/unicorn-ssjs',
@@ -839,8 +879,9 @@ plugin.configs = {
839
879
  },
840
880
 
841
881
  /**
842
- * OPTIONAL: same 46-rule override for SSJS embedded in HTML
843
- * (virtual `**\/*.html/*.js` files). Spread AFTER your unicorn config.
882
+ * REQUIRED when unicorn covers SSJS embedded in HTML: same 58-rule override
883
+ * for virtual `**\/*.html/*.js` files. Insert AFTER your unicorn config.
884
+ * Omit this config if unicorn is not enabled for embedded SSJS.
844
885
  */
845
886
  'unicorn-ssjs-embedded': {
846
887
  name: 'sfmc/unicorn-ssjs-embedded',
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * 1. POLYFILLABLE_METHODS — a shipped ES3-safe polyfill exists. The report
10
10
  * carries a suggestion that inserts the polyfill at the top of the file.
11
- * 2. KNOWN_UNSUPPORTED — no polyfill is feasible. The report has no fix; the
11
+ * 2. KNOWN_UNSUPPORTED — no verified polyfill is bundled. The report has no fix; the
12
12
  * message carries the ssjs-data `suggestion` (e.g. use Platform.Function.X).
13
13
  *
14
14
  * - category 'unavailable': method does not exist; calling it throws a runtime error.
@@ -250,7 +250,7 @@ export default {
250
250
  const ownerDisplay = entry.owner.replace(/\.prototype$/, '');
251
251
 
252
252
  if (noPolyfill) {
253
- // No polyfill is feasible — report with the ssjs-data suggestion
253
+ // No verified polyfill is bundled — report with the ssjs-data suggestion
254
254
  // and no auto-insert fix.
255
255
  context.report({
256
256
  node,