eslint-plugin-sfmc 4.16.2 → 5.0.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
 
@@ -182,31 +182,37 @@ Severities above are the same in `embedded`, `strict`, `embedded-next`, and `str
182
182
 
183
183
  ## Using `eslint-plugin-unicorn` with SFMC
184
184
 
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`, …).
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`, `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
186
 
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.
187
+ 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
188
 
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:
189
+ **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
190
 
191
191
  ```js
192
192
  import sfmc from 'eslint-plugin-sfmc';
193
193
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
194
194
 
195
195
  export default [
196
- eslintPluginUnicorn.configs.recommended, // you opt in — registers the `unicorn` plugin
196
+ {
197
+ ...eslintPluginUnicorn.configs.recommended,
198
+ files: ['**/*.{js,mjs,cjs,ssjs}'],
199
+ languageOptions: { ...eslintPluginUnicorn.configs.recommended.languageOptions, globals: {} },
200
+ },
197
201
  ...sfmc.configs.recommended,
198
202
  ...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">)
203
+ sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the 58 incompatible rules
204
+ sfmc.configs['unicorn-ssjs-embedded'], // REQUIRED: protect SSJS embedded in HTML
201
205
  ];
202
206
  ```
203
207
 
204
208
  | Config | Files | What it does |
205
209
  | --------------------------------------- | ---------------- | --------------------------------------------------------- |
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 |
210
+ | `sfmc.configs['unicorn-ssjs']` | `**/*.ssjs` | Turns off the 58 SFMC-incompatible unicorn rules for SSJS |
211
+ | `sfmc.configs['unicorn-ssjs-embedded']` | `**/*.html/*.js` | Same 58-rule override for SSJS embedded in HTML |
208
212
 
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).
213
+ 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.
214
+
215
+ 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
216
 
211
217
  ## Processors
212
218
 
@@ -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.0.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",
@@ -45,10 +45,10 @@
45
45
  "ssjs-data": "^2.0.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/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
52
  "test:autofix-manual": "node --test tests/autofix-manual.test.mjs",
53
53
  "test:fixtures": "node --test tests/fixtures.test.mjs",
54
54
  "test:fixtures:update": "node --test tests/fixtures.test.mjs -- --update-snapshots",
@@ -66,9 +66,10 @@
66
66
  "@eslint/js": "^10.0.1",
67
67
  "eslint": "^10.8.0",
68
68
  "eslint-config-prettier": "^10.1.8",
69
+ "eslint-minimum": "npm:eslint@10.4.0",
69
70
  "eslint-plugin-jsdoc": "^63.3.3",
70
71
  "eslint-plugin-prettier": "^5.5.6",
71
- "eslint-plugin-unicorn": "^73.0.0",
72
+ "eslint-plugin-unicorn": "^74.0.0",
72
73
  "globals": "^17.9.0",
73
74
  "husky": "^9.1.7",
74
75
  "lint-staged": "^17.3.0",
package/src/index.js CHANGED
@@ -368,9 +368,9 @@ function standaloneHandlebarsConfigs(configName) {
368
368
  // ── Optional eslint-plugin-unicorn override for SSJS ──────────────────────────
369
369
 
370
370
  /**
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
371
+ * The 58 `eslint-plugin-unicorn` recommended rules (analysed against
372
+ * unicorn v74.0.0) that are incompatible with the SFMC SSJS (JINT / ES3-ES5)
373
+ * engine — they either fix/suggest code using a missing built-in or forbid a required
374
374
  * SFMC workaround, or enforce ES-module / async / ES6-only syntax that the
375
375
  * engine cannot run. Each is mapped to `'off'`.
376
376
  *
@@ -385,7 +385,10 @@ const unicornSsjsOffRules = {
385
385
  'unicorn/prefer-includes': 'off',
386
386
  'unicorn/prefer-string-starts-ends-with': 'off',
387
387
  'unicorn/prefer-string-trim-start-end': 'off',
388
+ // CloudPage probes: working "Hello".substring()
389
+ // becomes throwing slice(); explicit-index string slice is a separate contract.
388
390
  'unicorn/prefer-string-slice': 'off',
391
+ // Same measured contexts: replaceAll is undefined and its direct call throws.
389
392
  'unicorn/prefer-string-replace-all': 'off',
390
393
  'unicorn/prefer-string-repeat': 'off',
391
394
  'unicorn/prefer-string-pad-start-end': 'off',
@@ -399,17 +402,25 @@ const unicornSsjsOffRules = {
399
402
  'unicorn/prefer-array-flat-map': 'off',
400
403
  'unicorn/prefer-array-last-methods': 'off',
401
404
  'unicorn/prefer-array-from-async': 'off',
405
+ // CloudPage probes: toReversed/toSorted/toSpliced are undefined; direct calls
406
+ // throw. Editor suggestions can introduce these methods under ES5 parsing.
402
407
  'unicorn/no-array-reverse': 'off',
408
+ 'unicorn/no-array-sort': 'off',
409
+ 'unicorn/no-array-splice': 'off',
403
410
  'unicorn/prefer-at': 'off',
404
411
  'unicorn/prefer-negative-index': 'off',
405
412
  'unicorn/prefer-spread': 'off',
406
413
  'unicorn/prefer-date-now': 'off',
414
+ // CloudPage probes: Object.fromEntries is undefined and pair-array calls throw.
407
415
  'unicorn/prefer-object-from-entries': 'off',
408
416
  'unicorn/prefer-reflect-apply': 'off',
409
417
  'unicorn/prefer-number-properties': 'off',
410
418
  'unicorn/prefer-number-is-safe-integer': 'off',
411
419
  'unicorn/prefer-number-coercion': 'off',
412
- 'unicorn/prefer-global-number-constants': 'off',
420
+ // Host constant inference differs from recorded SFMC numeric constants.
421
+ 'unicorn/no-redundant-comparison': 'off',
422
+ 'unicorn/no-impossible-length-comparison': 'off',
423
+ 'unicorn/no-useless-coercion': 'off',
413
424
  'unicorn/prefer-native-coercion-functions': 'off',
414
425
  'unicorn/prefer-math-trunc': 'off',
415
426
  'unicorn/prefer-modern-math-apis': 'off',
@@ -422,8 +433,19 @@ const unicornSsjsOffRules = {
422
433
  'unicorn/prefer-group-by': 'off',
423
434
  'unicorn/prefer-iterator-helpers': 'off',
424
435
  'unicorn/prefer-structured-clone': 'off',
425
- 'unicorn/require-array-join-separator': 'off',
436
+ // Native match/search miss results and splice behavior are not standard JS.
437
+ 'unicorn/prefer-regexp-test': 'off',
438
+ 'unicorn/no-unnecessary-splice': 'off',
439
+ 'unicorn/prefer-includes-over-repeated-comparisons': 'off',
440
+ 'unicorn/prefer-object-define-properties': 'off',
441
+ 'unicorn/no-new-array': 'off',
442
+ 'unicorn/no-unnecessary-array-splice-count': 'off',
426
443
  // Group B — forbid ES6+ syntax / ES-module / async constructs
444
+ // Inert with strict ES5 parsing, but introduces for-of when block scopes are enabled.
445
+ 'unicorn/no-for-loop': 'off',
446
+ 'unicorn/prefer-default-parameters': 'off',
447
+ // Both comparator suggestions use arrow functions, even when parsing ES5.
448
+ 'unicorn/require-array-sort-compare': 'off',
427
449
  'unicorn/prefer-optional-catch-binding': 'off',
428
450
  'unicorn/prefer-module': 'off',
429
451
  'unicorn/prefer-node-protocol': 'off',
@@ -822,15 +844,15 @@ plugin.configs = {
822
844
  ...msoRuleConfigs(),
823
845
  ],
824
846
 
825
- // ── Optional eslint-plugin-unicorn override configs ───────────────────────
847
+ // ── Required overrides when eslint-plugin-unicorn covers SSJS ────────────
826
848
 
827
849
  /**
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
850
+ * REQUIRED when unicorn covers standalone `.ssjs` files: turns off the 58
851
+ * unicorn recommended rules incompatible with SFMC SSJS. Plain rules object with NO
852
+ * `plugins` key — eslint-plugin-sfmc does not load unicorn. Insert this object
831
853
  * 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.
854
+ * otherwise ESLint cannot resolve the `unicorn/*` keys. Omit this config
855
+ * if unicorn is not enabled for standalone SSJS.
834
856
  */
835
857
  'unicorn-ssjs': {
836
858
  name: 'sfmc/unicorn-ssjs',
@@ -839,8 +861,9 @@ plugin.configs = {
839
861
  },
840
862
 
841
863
  /**
842
- * OPTIONAL: same 46-rule override for SSJS embedded in HTML
843
- * (virtual `**\/*.html/*.js` files). Spread AFTER your unicorn config.
864
+ * REQUIRED when unicorn covers SSJS embedded in HTML: same 58-rule override
865
+ * for virtual `**\/*.html/*.js` files. Insert AFTER your unicorn config.
866
+ * Omit this config if unicorn is not enabled for embedded SSJS.
844
867
  */
845
868
  'unicorn-ssjs-embedded': {
846
869
  name: 'sfmc/unicorn-ssjs-embedded',