eslint-plugin-sfmc 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/docs/unicorn-compatibility.md +22 -15
- package/package.json +10 -10
- package/src/ampscript-processor.js +1 -5
- package/src/index.js +8 -4
- package/src/processor.js +1 -5
- package/src/rules/amp/argument-types.js +6 -8
- package/src/rules/amp/function-arity.js +6 -11
- package/src/rules/amp/naming-convention.js +7 -9
- package/src/rules/amp/no-loop-counter-assign.js +12 -11
- package/src/rules/amp/prefer-attribute-value.js +6 -11
- package/src/rules/amp/prefer-boolean-literal.js +6 -5
- package/src/rules/amp/require-variable-declaration.js +15 -14
- package/src/rules/hbs/_shared.js +8 -18
- package/src/rules/hbs/no-mcn-unsupported.js +3 -4
- package/src/rules/ssjs/cache-loop-length.js +8 -11
- package/src/rules/ssjs/http-property-value.js +7 -11
- package/src/rules/ssjs/no-clr-header-access.js +7 -16
- package/src/rules/ssjs/no-deprecated-function.js +9 -14
- package/src/rules/ssjs/no-invalid-property-access.js +7 -11
- package/src/rules/ssjs/no-mcn-unsupported.js +5 -4
- package/src/rules/ssjs/no-property-call.js +4 -4
- package/src/rules/ssjs/no-treatascontent-injection.js +7 -10
- package/src/rules/ssjs/no-unavailable-method.js +14 -14
- package/src/rules/ssjs/no-unknown-function.js +39 -37
- package/src/rules/ssjs/platform-function-arity.js +54 -57
- package/src/rules/ssjs/prefer-parsejson-safe-argument.js +1 -4
- package/src/rules/ssjs/require-hasownproperty.js +70 -91
- package/src/rules/ssjs/require-platform-load-order.js +3 -7
- package/src/rules/ssjs/require-platform-load.js +1 -4
- package/src/rules/ssjs/require-string-clr-content.js +5 -14
- package/src/rules/ssjs/ssjs-argument-types.js +22 -28
- package/src/rules/ssjs/ssjs-core-method-arity.js +20 -24
- package/src/rules/ssjs/ssjs-no-nonfunctional-method.js +20 -26
- package/src/ssjs-processor.js +1 -5
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 **10.
|
|
11
|
+
Requires ESLint **10.0.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). Optional composition with `eslint-plugin-unicorn@76` requires ESLint **10.4.0+**, matching Unicorn 76's upstream peer range; the base SFMC plugin and its non-Unicorn configs remain supported from ESLint 10.0.0.
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
@@ -201,9 +201,9 @@ Severities above are the same in `embedded`, `strict`, `embedded-next`, and `str
|
|
|
201
201
|
|
|
202
202
|
[`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.
|
|
203
203
|
|
|
204
|
-
For Unicorn **
|
|
204
|
+
For Unicorn **76.0.0**, the SSJS compatibility overrides disable **60** of its **315** 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 **255** remain active; this classification is not a blanket runtime-safety guarantee or new live SFMC verification.
|
|
205
205
|
|
|
206
|
-
**Unicorn is optional; the
|
|
206
|
+
**Unicorn is optional; Unicorn 76 composition is upstream-supported on ESLint 10.4.0+, while the base SFMC plugin supports ESLint 10.0.0+.** The higher integration floor comes from `eslint-plugin-unicorn@76`'s declared ESLint peer range and does not raise `eslint-plugin-sfmc`'s package-wide peer minimum. When you enable Unicorn, the matching SSJS protections are required. 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:
|
|
207
207
|
|
|
208
208
|
```js
|
|
209
209
|
import sfmc from 'eslint-plugin-sfmc';
|
|
@@ -217,19 +217,19 @@ export default [
|
|
|
217
217
|
},
|
|
218
218
|
...sfmc.configs.recommended,
|
|
219
219
|
...sfmc.configs.embedded, // AMPscript + SSJS embedded in HTML (<script runat="server">)
|
|
220
|
-
sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the
|
|
220
|
+
sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the 60 incompatible rules
|
|
221
221
|
sfmc.configs['unicorn-ssjs-embedded'], // REQUIRED: protect SSJS embedded in HTML
|
|
222
222
|
];
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
| Config | Files | What it does |
|
|
226
226
|
| --------------------------------------- | ---------------- | --------------------------------------------------------- |
|
|
227
|
-
| `sfmc.configs['unicorn-ssjs']` | `**/*.ssjs` | Turns off the
|
|
228
|
-
| `sfmc.configs['unicorn-ssjs-embedded']` | `**/*.html/*.js` | Same
|
|
227
|
+
| `sfmc.configs['unicorn-ssjs']` | `**/*.ssjs` | Turns off the 60 SFMC-incompatible unicorn rules for SSJS |
|
|
228
|
+
| `sfmc.configs['unicorn-ssjs-embedded']` | `**/*.html/*.js` | Same 60-rule override for SSJS embedded in HTML |
|
|
229
229
|
|
|
230
230
|
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.
|
|
231
231
|
|
|
232
|
-
Only **
|
|
232
|
+
Only **60** of unicorn's 315 enabled recommended rules are overridden — the other **255** 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 v76.0.0), see [docs/unicorn-compatibility.md](docs/unicorn-compatibility.md).
|
|
233
233
|
|
|
234
234
|
## Processors
|
|
235
235
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# `eslint-plugin-unicorn` compatibility with SFMC SSJS
|
|
2
2
|
|
|
3
|
-
> **Compatibility analysis for [`eslint-plugin-unicorn@
|
|
3
|
+
> **Compatibility analysis for [`eslint-plugin-unicorn@76.0.0`](https://github.com/sindresorhus/eslint-plugin-unicorn).**
|
|
4
4
|
>
|
|
5
|
-
> ⚠️ **Version warning:** This classification was done against `eslint-plugin-unicorn` **
|
|
5
|
+
> ⚠️ **Version warning:** This classification was done against `eslint-plugin-unicorn` **v76.0.0** (315 enabled 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
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 **
|
|
12
|
+
Of unicorn's **315** enabled recommended rules (v76.0.0), **255** remain active (including conditional and inert cases; not a blanket runtime-safety guarantee) and **60** should be turned off. `eslint-plugin-sfmc` ships a scope-specific override config (`unicorn-ssjs` / `unicorn-ssjs-embedded`) that turns off exactly those 60 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
|
-
|
|
18
|
+
The base `eslint-plugin-sfmc` package requires ESLint **10.0.0+** and Node.js **22+**. Optional composition with `eslint-plugin-unicorn@76` is upstream-supported only on ESLint **10.4.0+**, because Unicorn 76 declares that ESLint peer range. This integration floor does not raise the package-wide SFMC peer minimum: consumers that do not compose Unicorn remain supported from ESLint 10.0.0.
|
|
19
19
|
|
|
20
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:
|
|
21
21
|
|
|
@@ -31,7 +31,7 @@ export default [
|
|
|
31
31
|
},
|
|
32
32
|
...sfmc.configs.recommended,
|
|
33
33
|
...sfmc.configs.embedded, // AMPscript + SSJS embedded in HTML (<script runat="server">)
|
|
34
|
-
sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the
|
|
34
|
+
sfmc.configs['unicorn-ssjs'], // REQUIRED: protect standalone SSJS from the 60 incompatible rules
|
|
35
35
|
sfmc.configs['unicorn-ssjs-embedded'], // REQUIRED: protect SSJS embedded in HTML
|
|
36
36
|
];
|
|
37
37
|
```
|
|
@@ -47,7 +47,7 @@ If you don't use unicorn, omit these configs entirely — nothing else in `eslin
|
|
|
47
47
|
|
|
48
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
49
|
|
|
50
|
-
Alternatively, ESLint's `defineConfig` flattens nested configuration arrays.
|
|
50
|
+
Alternatively, ESLint's `defineConfig` flattens nested configuration arrays. The base SFMC presets are verified at exactly ESLint **10.0.0** and at **10.11.0**. The Unicorn composition shown here is tested only on an engine satisfying Unicorn 76's upstream floor (**10.4.0+**); it is not presented as supported on ESLint 10.0–10.3:
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
53
|
import { defineConfig } from 'eslint/config';
|
|
@@ -69,11 +69,11 @@ export default defineConfig(
|
|
|
69
69
|
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
-
## Section 2 — Rules to override for SSJS (
|
|
72
|
+
## Section 2 — Rules to override for SSJS (60)
|
|
73
73
|
|
|
74
|
-
These
|
|
74
|
+
These 60 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 60 are confirmed enabled in unicorn v76.0.0's recommended configuration.
|
|
75
75
|
|
|
76
|
-
### Group A — API, runtime-semantic and diagnostic protections (
|
|
76
|
+
### Group A — API, runtime-semantic and diagnostic protections (52)
|
|
77
77
|
|
|
78
78
|
| Rule | Why it breaks SSJS | SFMC evidence |
|
|
79
79
|
|---|---|---|
|
|
@@ -117,10 +117,12 @@ These 58 recommended rules introduce unavailable or unresolved APIs, conflict wi
|
|
|
117
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
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/) |
|
|
119
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/) |
|
|
120
|
+
| [`prefer-iterator-zip`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-iterator-zip.md) | Suggests `Iterator.zip()` and `for...of` for parallel-array loops; both the Iterator helper and ES6 loop syntax are unavailable | [Engine limitations](https://ssjs.guide/engine-limitations/) |
|
|
121
|
+
| [`prefer-temporal-conversion`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-temporal-conversion.md) | Rewrites `Temporal` conversions to direct methods, but the Temporal API is unavailable in the SSJS runtime | [Engine limitations](https://ssjs.guide/engine-limitations/) |
|
|
120
122
|
| [`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
123
|
| [`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
124
|
| [`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`;
|
|
125
|
+
| [`no-new-array`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md) | Autofix emits `Array.from`; v76 string-method inference newly reaches `new Array("abc".indexOf(value))` with an unknown parameter | [ECMAScript built-ins](https://ssjs.guide/ecmascript-builtins/) |
|
|
124
126
|
| [`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
127
|
| [`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
128
|
| [`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/) |
|
|
@@ -132,7 +134,7 @@ These 58 recommended rules introduce unavailable or unresolved APIs, conflict wi
|
|
|
132
134
|
|
|
133
135
|
| Rule | Why it breaks SSJS | SFMC evidence |
|
|
134
136
|
|---|---|---|
|
|
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
|
|
137
|
+
| [`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 v76 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
138
|
| [`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
139
|
| [`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/) |
|
|
138
140
|
| [`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/) |
|
|
@@ -145,11 +147,11 @@ These 58 recommended rules introduce unavailable or unresolved APIs, conflict wi
|
|
|
145
147
|
|
|
146
148
|
---
|
|
147
149
|
|
|
148
|
-
## Section 3 — Active rules, including conditional cases (
|
|
150
|
+
## Section 3 — Active rules, including conditional cases (255)
|
|
149
151
|
|
|
150
152
|
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.
|
|
151
153
|
|
|
152
|
-
<!-- BEGIN
|
|
154
|
+
<!-- BEGIN 255-OK-LIST -->
|
|
153
155
|
- [better-dom-traversing](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-dom-traversing.md)
|
|
154
156
|
- [catch-error-name](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/catch-error-name.md)
|
|
155
157
|
- [class-reference-in-static-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/class-reference-in-static-methods.md)
|
|
@@ -193,6 +195,7 @@ These recommended rules are **not** disabled by the override config. Active is a
|
|
|
193
195
|
- [no-array-method-this-argument](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md)
|
|
194
196
|
- [no-array-reduce](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reduce.md)
|
|
195
197
|
- [no-array-sort-for-min-max](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-sort-for-min-max.md)
|
|
198
|
+
- [no-async-iterator-callback](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-async-iterator-callback.md)
|
|
196
199
|
- [no-async-promise-finally](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-async-promise-finally.md)
|
|
197
200
|
- [no-await-expression-member](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md)
|
|
198
201
|
- [no-await-in-promise-methods](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-in-promise-methods.md)
|
|
@@ -277,12 +280,14 @@ These recommended rules are **not** disabled by the override config. Active is a
|
|
|
277
280
|
- [no-unreadable-for-of-expression](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-for-of-expression.md)
|
|
278
281
|
- [no-unreadable-iife](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md)
|
|
279
282
|
- [no-unreadable-object-destructuring](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-object-destructuring.md)
|
|
283
|
+
- [no-using-resource-escape](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-using-resource-escape.md)
|
|
280
284
|
- [no-unsafe-buffer-conversion](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-buffer-conversion.md)
|
|
281
285
|
- [no-unsafe-promise-all-settled-values](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-promise-all-settled-values.md)
|
|
282
286
|
- [no-unsafe-property-key](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-property-key.md)
|
|
283
287
|
- [no-unsafe-sqlite-interpolation](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-sqlite-interpolation.md)
|
|
284
288
|
- [no-unsafe-string-replacement](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unsafe-string-replacement.md)
|
|
285
|
-
- [no-unused-
|
|
289
|
+
- [no-unused-builtin-method-return](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-builtin-method-return.md)
|
|
290
|
+
- [no-unused-iterator-helper](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-iterator-helper.md)
|
|
286
291
|
- [no-useless-boolean-cast](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-boolean-cast.md)
|
|
287
292
|
- [no-useless-collection-argument](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md)
|
|
288
293
|
- [no-useless-compound-assignment](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-compound-assignment.md)
|
|
@@ -300,6 +305,7 @@ These recommended rules are **not** disabled by the override config. Active is a
|
|
|
300
305
|
- [no-useless-re-export](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-re-export.md)
|
|
301
306
|
- [no-useless-recursion](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-recursion.md)
|
|
302
307
|
- [no-useless-spread](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-spread.md)
|
|
308
|
+
- [no-useless-set-construction](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-set-construction.md)
|
|
303
309
|
- [no-useless-switch-case](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md)
|
|
304
310
|
- [no-useless-template-literals](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-template-literals.md)
|
|
305
311
|
- [no-useless-undefined](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md)
|
|
@@ -324,6 +330,7 @@ These recommended rules are **not** disabled by the override config. Active is a
|
|
|
324
330
|
- [prefer-boolean-return](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-boolean-return.md)
|
|
325
331
|
- [prefer-class-fields](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md)
|
|
326
332
|
- [prefer-classlist-toggle](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-classlist-toggle.md)
|
|
333
|
+
- [prefer-combined-guards](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-combined-guards.md)
|
|
327
334
|
- [prefer-continue](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-continue.md)
|
|
328
335
|
- [prefer-direct-iteration](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-direct-iteration.md)
|
|
329
336
|
- [prefer-dom-node-append](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-append.md)
|
|
@@ -400,7 +407,7 @@ These recommended rules are **not** disabled by the override config. Active is a
|
|
|
400
407
|
- [text-encoding-identifier-case](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md)
|
|
401
408
|
- [throw-new-error](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md)
|
|
402
409
|
- [require-array-join-separator](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md)
|
|
403
|
-
<!-- END
|
|
410
|
+
<!-- END 255-OK-LIST -->
|
|
404
411
|
|
|
405
412
|
**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
413
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-sfmc",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"mcn"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"ampscript-data": "^4.
|
|
39
|
+
"ampscript-data": "^4.2.0",
|
|
40
40
|
"ampscript-parser": "^0.3.1",
|
|
41
41
|
"eslint-plugin-mso-email": "^2.0.0",
|
|
42
42
|
"handlebars-data": "^0.4.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"ssjs-data": "^2.1.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"eslint": ">=10.
|
|
48
|
+
"eslint": ">=10.0.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
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",
|
|
@@ -66,16 +66,16 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@eslint/js": "^10.0.1",
|
|
69
|
-
"eslint": "^10.
|
|
69
|
+
"eslint": "^10.11.0",
|
|
70
70
|
"eslint-config-prettier": "^10.1.8",
|
|
71
|
-
"eslint-minimum": "npm:eslint@10.
|
|
72
|
-
"eslint-plugin-jsdoc": "^
|
|
71
|
+
"eslint-minimum": "npm:eslint@10.0.0",
|
|
72
|
+
"eslint-plugin-jsdoc": "^64.5.4",
|
|
73
73
|
"eslint-plugin-prettier": "^5.5.6",
|
|
74
|
-
"eslint-plugin-unicorn": "^
|
|
75
|
-
"globals": "^17.
|
|
74
|
+
"eslint-plugin-unicorn": "^76.0.0",
|
|
75
|
+
"globals": "^17.12.0",
|
|
76
76
|
"husky": "^9.1.7",
|
|
77
|
-
"lint-staged": "^17.
|
|
78
|
-
"prettier": "^3.9.
|
|
77
|
+
"lint-staged": "^17.5.1",
|
|
78
|
+
"prettier": "^3.9.9"
|
|
79
79
|
},
|
|
80
80
|
"lint-staged": {
|
|
81
81
|
"*.{js,mjs,cjs}": [
|
|
@@ -130,11 +130,7 @@ export function preprocess(text, filename) {
|
|
|
130
130
|
index++;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
return [text];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return blocks;
|
|
133
|
+
return blocks.length === 0 ? [text] : blocks;
|
|
138
134
|
}
|
|
139
135
|
|
|
140
136
|
export function postprocess(messages) {
|
package/src/index.js
CHANGED
|
@@ -390,8 +390,8 @@ function standaloneHandlebarsConfigs(configName) {
|
|
|
390
390
|
// ── Optional eslint-plugin-unicorn override for SSJS ──────────────────────────
|
|
391
391
|
|
|
392
392
|
/**
|
|
393
|
-
* The
|
|
394
|
-
* unicorn
|
|
393
|
+
* The 60 `eslint-plugin-unicorn` recommended rules (analysed against
|
|
394
|
+
* unicorn v76.0.0) that are incompatible with the SFMC SSJS (JINT / ES3-ES5)
|
|
395
395
|
* engine — they either fix/suggest code using a missing built-in or forbid a required
|
|
396
396
|
* SFMC workaround, or enforce ES-module / async / ES6-only syntax that the
|
|
397
397
|
* engine cannot run. Each is mapped to `'off'`.
|
|
@@ -454,6 +454,10 @@ const unicornSsjsOffRules = {
|
|
|
454
454
|
'unicorn/prefer-map-from-entries': 'off',
|
|
455
455
|
'unicorn/prefer-group-by': 'off',
|
|
456
456
|
'unicorn/prefer-iterator-helpers': 'off',
|
|
457
|
+
// Unicorn 76 suggestions introduce Iterator.zip(), unavailable in SFMC SSJS.
|
|
458
|
+
'unicorn/prefer-iterator-zip': 'off',
|
|
459
|
+
// Temporal is unavailable, so direct Temporal conversion methods are unsafe.
|
|
460
|
+
'unicorn/prefer-temporal-conversion': 'off',
|
|
457
461
|
'unicorn/prefer-structured-clone': 'off',
|
|
458
462
|
// Native match/search miss results and splice behavior are not standard JS.
|
|
459
463
|
'unicorn/prefer-regexp-test': 'off',
|
|
@@ -869,7 +873,7 @@ plugin.configs = {
|
|
|
869
873
|
// ── Required overrides when eslint-plugin-unicorn covers SSJS ────────────
|
|
870
874
|
|
|
871
875
|
/**
|
|
872
|
-
* REQUIRED when unicorn covers standalone `.ssjs` files: turns off the
|
|
876
|
+
* REQUIRED when unicorn covers standalone `.ssjs` files: turns off the 60
|
|
873
877
|
* unicorn recommended rules incompatible with SFMC SSJS. Plain rules object with NO
|
|
874
878
|
* `plugins` key — eslint-plugin-sfmc does not load unicorn. Insert this object
|
|
875
879
|
* AFTER your own unicorn config (which registers the `unicorn` plugin);
|
|
@@ -883,7 +887,7 @@ plugin.configs = {
|
|
|
883
887
|
},
|
|
884
888
|
|
|
885
889
|
/**
|
|
886
|
-
* REQUIRED when unicorn covers SSJS embedded in HTML: same
|
|
890
|
+
* REQUIRED when unicorn covers SSJS embedded in HTML: same 60-rule override
|
|
887
891
|
* for virtual `**\/*.html/*.js` files. Insert AFTER your unicorn config.
|
|
888
892
|
* Omit this config if unicorn is not enabled for embedded SSJS.
|
|
889
893
|
*/
|
package/src/processor.js
CHANGED
|
@@ -223,11 +223,7 @@ export function preprocess(text, filename) {
|
|
|
223
223
|
blocks.push(...msoPreprocess(text, filename));
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
return [text];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return blocks;
|
|
226
|
+
return blocks.length === 0 ? [text] : blocks;
|
|
231
227
|
}
|
|
232
228
|
|
|
233
229
|
export function postprocess(messages) {
|
|
@@ -35,10 +35,9 @@ function staticLiteralValue(argument) {
|
|
|
35
35
|
if (argument.type === 'NumberLiteral') {
|
|
36
36
|
return Number(argument.value);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return String(argument.value);
|
|
38
|
+
return argument.type === 'BooleanLiteral'
|
|
39
|
+
? String(argument.value).toLowerCase() === 'true'
|
|
40
|
+
: String(argument.value);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
/**
|
|
@@ -54,10 +53,9 @@ function enumValueMatches(allowed, actual) {
|
|
|
54
53
|
if (typeof allowed !== typeof actual) {
|
|
55
54
|
return false;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return allowed === actual;
|
|
56
|
+
return typeof allowed === 'string' && typeof actual === 'string'
|
|
57
|
+
? allowed.toLowerCase() === actual.toLowerCase()
|
|
58
|
+
: allowed === actual;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
/**
|
|
@@ -45,13 +45,9 @@ function checkRepeatGroups(entry, callArguments) {
|
|
|
45
45
|
: null;
|
|
46
46
|
}
|
|
47
47
|
const trailing = actual - startIndex;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (trailing / groupSize < minGroups) {
|
|
52
|
-
return incompleteGroup(entry, groupSize);
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
48
|
+
return trailing % groupSize !== 0 || trailing / groupSize < minGroups
|
|
49
|
+
? incompleteGroup(entry, groupSize)
|
|
50
|
+
: null;
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
// Two repeating groups (DataExtension Update/Upsert family): the first group's
|
|
@@ -71,10 +67,9 @@ function checkRepeatGroups(entry, callArguments) {
|
|
|
71
67
|
const group1Arguments = countArgument * g1.groupSize;
|
|
72
68
|
const group2Start = g1.startIndex + group1Arguments;
|
|
73
69
|
const group2Count = actual - group2Start;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return null;
|
|
70
|
+
return group2Count <= 0 || group2Count % g2.groupSize !== 0
|
|
71
|
+
? incompleteGroup(entry, g2.groupSize)
|
|
72
|
+
: null;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
75
|
/**
|
|
@@ -44,18 +44,16 @@ export default {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const key = name.toLowerCase();
|
|
47
|
-
if (reported.has(key)) {
|
|
47
|
+
if (reported.has(key) || pattern.test(name)) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
}
|
|
51
|
+
reported.add(key);
|
|
52
|
+
context.report({
|
|
53
|
+
node,
|
|
54
|
+
messageId: 'badName',
|
|
55
|
+
data: { name, format },
|
|
56
|
+
});
|
|
59
57
|
},
|
|
60
58
|
};
|
|
61
59
|
},
|
|
@@ -34,17 +34,18 @@ export default {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
if (statement.type
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
if (statement.type !== 'VarDeclaration') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const current = counterStack.at(-1);
|
|
41
|
+
if (current) {
|
|
42
|
+
for (const v of statement.variables) {
|
|
43
|
+
if (v.value.toLowerCase() === current.toLowerCase()) {
|
|
44
|
+
context.report({
|
|
45
|
+
node: v,
|
|
46
|
+
messageId: 'counterAssign',
|
|
47
|
+
data: { name: v.value },
|
|
48
|
+
});
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
}
|
|
@@ -47,19 +47,14 @@ function personalizationName(node) {
|
|
|
47
47
|
}
|
|
48
48
|
if (node.type === 'Identifier') {
|
|
49
49
|
const lower = node.value.toLowerCase();
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
return node.value;
|
|
50
|
+
return functionNames.has(lower) ||
|
|
51
|
+
AMPSCRIPT_KEYWORDS.has(lower) ||
|
|
52
|
+
isSystemPersonalizationString(node.value)
|
|
53
|
+
? null
|
|
54
|
+
: node.value;
|
|
57
55
|
}
|
|
58
56
|
if (node.type === 'PersonalizationString') {
|
|
59
|
-
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
return node.value;
|
|
57
|
+
return isSystemPersonalizationString(node.value) ? null : node.value;
|
|
63
58
|
}
|
|
64
59
|
return null;
|
|
65
60
|
}
|
|
@@ -18,7 +18,7 @@ const BOOLEAN_LIKE_ENUM = [true, false, 1, 0, 'true', 'false', '1', '0'];
|
|
|
18
18
|
function preferredBoolean(argument) {
|
|
19
19
|
if (argument?.type === 'NumberLiteral') {
|
|
20
20
|
const value = Number(argument.value);
|
|
21
|
-
return value === 1
|
|
21
|
+
return value === 1 || (value !== 0 && null);
|
|
22
22
|
}
|
|
23
23
|
if (argument?.type === 'StringLiteral') {
|
|
24
24
|
const value = String(argument.value).toLowerCase();
|
|
@@ -39,10 +39,11 @@ function preferredBoolean(argument) {
|
|
|
39
39
|
* @returns {boolean} Whether the enum contains exactly the complete eight-value set.
|
|
40
40
|
*/
|
|
41
41
|
export function isBooleanLikeParameter(parameter) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
return (
|
|
43
|
+
Array.isArray(parameter?.enum) &&
|
|
44
|
+
parameter.enum.length === BOOLEAN_LIKE_ENUM.length &&
|
|
45
|
+
BOOLEAN_LIKE_ENUM.every((value) => parameter.enum.includes(value))
|
|
46
|
+
);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export default {
|
|
@@ -43,21 +43,22 @@ export default {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
const lower = name.toLowerCase();
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
if (isFirstFix) {
|
|
49
|
-
fixedVariables.add(lower);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
context.report({
|
|
53
|
-
node: node.target,
|
|
54
|
-
messageId: 'undeclared',
|
|
55
|
-
data: { name },
|
|
56
|
-
fix: isFirstFix
|
|
57
|
-
? (fixer) => fixer.insertTextBefore(node, `var ${name}\n`)
|
|
58
|
-
: undefined,
|
|
59
|
-
});
|
|
46
|
+
if (declared.has(lower)) {
|
|
47
|
+
return;
|
|
60
48
|
}
|
|
49
|
+
const isFirstFix = !fixedVariables.has(lower);
|
|
50
|
+
if (isFirstFix) {
|
|
51
|
+
fixedVariables.add(lower);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
context.report({
|
|
55
|
+
node: node.target,
|
|
56
|
+
messageId: 'undeclared',
|
|
57
|
+
data: { name },
|
|
58
|
+
fix: isFirstFix
|
|
59
|
+
? (fixer) => fixer.insertTextBefore(node, `var ${name}\n`)
|
|
60
|
+
: undefined,
|
|
61
|
+
});
|
|
61
62
|
},
|
|
62
63
|
};
|
|
63
64
|
},
|
package/src/rules/hbs/_shared.js
CHANGED
|
@@ -19,13 +19,7 @@ export const BINDING_PATTERN = /\{!\$([A-Za-z0-9_.]+)\}/g;
|
|
|
19
19
|
* @returns {string | null} The simple helper name, or null.
|
|
20
20
|
*/
|
|
21
21
|
export function simpleHelperName(path) {
|
|
22
|
-
if (!path || path.type !== 'PathExpression') {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
if (path.data) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
if ((path.depth ?? 0) > 0) {
|
|
22
|
+
if (!path || path.type !== 'PathExpression' || path.data || (path.depth ?? 0) > 0) {
|
|
29
23
|
return null;
|
|
30
24
|
}
|
|
31
25
|
const parts = path.parts ?? [];
|
|
@@ -33,10 +27,7 @@ export function simpleHelperName(path) {
|
|
|
33
27
|
return null;
|
|
34
28
|
}
|
|
35
29
|
const name = parts[0];
|
|
36
|
-
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return name;
|
|
30
|
+
return !name || name === 'this' ? null : name;
|
|
40
31
|
}
|
|
41
32
|
|
|
42
33
|
/**
|
|
@@ -105,14 +96,13 @@ export function closestMatch(word, candidates) {
|
|
|
105
96
|
|
|
106
97
|
for (const candidate of candidates) {
|
|
107
98
|
const distance = levenshtein(lowerWord, candidate.toLowerCase());
|
|
108
|
-
if (distance < bestDistance) {
|
|
109
|
-
|
|
110
|
-
best = candidate;
|
|
99
|
+
if (!(distance < bestDistance)) {
|
|
100
|
+
continue;
|
|
111
101
|
}
|
|
112
|
-
}
|
|
113
102
|
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
bestDistance = distance;
|
|
104
|
+
best = candidate;
|
|
116
105
|
}
|
|
117
|
-
|
|
106
|
+
|
|
107
|
+
return best !== null && bestDistance > 0 && bestDistance <= maxDistance ? best : null;
|
|
118
108
|
}
|
|
@@ -63,10 +63,9 @@ export default {
|
|
|
63
63
|
* @returns {boolean} True when the item must be flagged.
|
|
64
64
|
*/
|
|
65
65
|
function isUnsupported(since) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return apiVersion !== null && since > apiVersion;
|
|
66
|
+
return (
|
|
67
|
+
since === null || since === undefined || (apiVersion !== null && since > apiVersion)
|
|
68
|
+
);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|