eslint-plugin-sfmc 5.3.0 → 5.4.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.
@@ -12,7 +12,7 @@
12
12
 
13
13
  Each Marketing Cloud Next helper has a fixed set of positional parameters defined in the catalog. Calling a helper with too few required arguments, or with more arguments than it accepts, fails at render time. This rule validates every helper invocation against the helper's `params` definition.
14
14
 
15
- Only **positional** arguments are checked. Helpers with a variadic trailing parameter (for example `concat`, `and`, `set`) have no upper bound. Hash (named) arguments are not counted as positional arguments. A bare `{{foo}}` mustache with no arguments is a data binding, not an invocation, and is skipped.
15
+ Only **positional** arguments are checked. Helpers with a variadic trailing parameter (for example `concat`, `and`, `set`) have no upper bound. Hash (named) arguments such as `charset="UTF-16"` are not counted as positional arguments, and helpers that accept named arguments (for example `md5`, `regExMatch`, `query`, `claimRow`) likewise have no upper bound. A bare `{{foo}}` mustache with no arguments is a data binding, not an invocation, and is skipped.
16
16
 
17
17
  Handlebars only exists when targeting MCN, so this rule is enabled only in the `-next` configs.
18
18
 
@@ -45,6 +45,12 @@ This rule has no configuration options.
45
45
 
46
46
  {{! concat is variadic — any number of arguments is fine }}
47
47
  {{concat firstName " " lastName}}
48
+
49
+ {{! named arguments are not counted: md5 takes one positional argument }}
50
+ {{md5 emailAddress charset="UTF-16"}}
51
+
52
+ {{! query takes named arguments only }}
53
+ {{#each (query object="Account" type="CRM")}}{{this.Name}}{{/each}}
48
54
  ```
49
55
 
50
56
  ## When to Disable
@@ -27,14 +27,14 @@ Unknown helpers and bindings — ones that are not part of Marketing Cloud Next
27
27
 
28
28
  | Option | Type | Default | Description |
29
29
  |--------|------|---------|-------------|
30
- | `apiVersion` | `number` | — | The targeted Marketing Cloud Next API version (e.g. `65` = Winter '26, `67` = Summer '26). |
30
+ | `apiVersion` | `number` | — | The targeted Marketing Cloud Next API version (e.g. `65` = Winter '26, `67` = Summer '26, `68` = Winter '27). |
31
31
 
32
32
  **What `apiVersion` does** (shared with the AMPscript and SSJS MCN rules):
33
33
 
34
34
  - **Leave it unset** to check against _any_ MCN release: a helper or binding is flagged only if it is never supported in Marketing Cloud Next. Anything that works in some MCN release is allowed.
35
35
  - **Set it to your target release** (for example `65`) to also flag helpers and bindings that were added in a _later_ MCN release than the one you run. An item is allowed only when it is available in your target release or an earlier one.
36
36
 
37
- Every Handlebars helper and binding is available in some MCN release, so with no `apiVersion` set nothing is flagged. Setting `apiVersion` to an earlier release flags the helpers and bindings added after it — for example, `apiVersion: 65` flags the helpers introduced in release 67.
37
+ Every Handlebars helper and binding is available in some MCN release, so with no `apiVersion` set nothing is flagged. Setting `apiVersion` to an earlier release flags the helpers and bindings added after it — for example, `apiVersion: 65` flags the helpers introduced in releases 67 and 68, and `apiVersion: 67` flags those introduced in release 68 (for example `md5`, `guid` or `claimRow`).
38
38
 
39
39
  ## Examples
40
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-sfmc",
3
- "version": "5.3.0",
3
+ "version": "5.4.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",
@@ -39,7 +39,7 @@
39
39
  "ampscript-data": "^4.2.0",
40
40
  "ampscript-parser": "^0.4.0",
41
41
  "eslint-plugin-mso-email": "^2.1.0",
42
- "handlebars-data": "^0.4.0",
42
+ "handlebars-data": "^0.5.0",
43
43
  "mso-conditional-parser": "^2.0.1",
44
44
  "sfmc-handlebars-parser": "^0.1.1",
45
45
  "ssjs-data": "^2.1.2"
@@ -49,6 +49,8 @@
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",
52
+ "verify:own-dependencies-latest": "node scripts/verify-own-dependencies-latest.mjs",
53
+ "preversion": "npm run verify:own-dependencies-latest",
52
54
  "test:release": "node --test tests/release-safeguards.test.js",
53
55
  "validate:release-docs": "node scripts/validate-release-documentation.js",
54
56
  "test:autofix-manual": "node --test tests/autofix-manual.test.mjs",
@@ -18,7 +18,8 @@ import { simpleHelperName, isInvocation, BINDING_PATTERN } from './_shared.js';
18
18
  *
19
19
  * The MCN Handlebars catalog currently has no null-`mcnSince` items, so with no
20
20
  * `apiVersion` set nothing is flagged; e.g. `apiVersion: 65` flags the helpers
21
- * introduced in 67, and `apiVersion: 40` flags every helper and binding.
21
+ * introduced in 67 and 68, `apiVersion: 67` flags those introduced in 68, and
22
+ * `apiVersion: 40` flags every helper and binding.
22
23
  */
23
24
  export default {
24
25
  meta: {
@@ -43,7 +44,7 @@ export default {
43
44
  apiVersion: {
44
45
  type: 'number',
45
46
  description:
46
- 'The targeted Marketing Cloud Next API version (e.g. 65 = Winter \u{2019}26, 67 = Summer \u{2019}26). Helpers and bindings newer than this are flagged.',
47
+ 'The targeted Marketing Cloud Next API version (e.g. 65 = Winter \u{2019}26, 67 = Summer \u{2019}26, 68 = Winter \u{2019}27). Helpers and bindings newer than this are flagged.',
47
48
  },
48
49
  },
49
50
  additionalProperties: false,