eslint-plugin-sfmc 5.4.2 → 5.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-sfmc",
3
- "version": "5.4.2",
3
+ "version": "5.4.4",
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",
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-mso-email": "^2.1.0",
42
42
  "handlebars-data": "^0.8.2",
43
43
  "mso-conditional-parser": "^2.0.1",
44
- "sfmc-handlebars-parser": "^0.1.1",
44
+ "sfmc-handlebars-parser": "^0.2.1",
45
45
  "ssjs-data": "^2.1.3"
46
46
  },
47
47
  "peerDependencies": {
@@ -154,8 +154,15 @@ export function parseForESLint(code) {
154
154
  const rawMessage = (ex && ex.message) || 'Handlebars syntax error.';
155
155
  const messageLines = rawMessage.split('\n').filter((line) => line.trim().length > 0);
156
156
  const error = new SyntaxError(messageLines.at(-1) || rawMessage);
157
- error.lineNumber = loc ? Math.max(1, loc.first_line) : 1;
158
- error.column = loc ? Math.max(1, loc.first_column + 1) : 1;
157
+ // Jison-class errors carry `hash.loc`; exception-class errors (a block
158
+ // closed with the wrong name) carry `lineNumber` and a 0-based `column`.
159
+ if (loc) {
160
+ error.lineNumber = Math.max(1, loc.first_line);
161
+ error.column = Math.max(1, loc.first_column + 1);
162
+ } else {
163
+ error.lineNumber = Math.max(1, ex?.lineNumber ?? 1);
164
+ error.column = Math.max(1, (ex?.column ?? 0) + 1);
165
+ }
159
166
  throw error;
160
167
  }
161
168