@angular-eslint/eslint-plugin-template 17.3.1-alpha.0 → 17.3.1-alpha.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.
@@ -65,7 +65,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
65
65
  },
66
66
  end: {
67
67
  line: loc.end.line,
68
- column: loc.end.column + 1,
68
+ column: loc.end.column + (isValuelessStructuralDirective(attr) ? 0 : 1),
69
69
  },
70
70
  };
71
71
  default:
@@ -265,6 +265,24 @@ function getMessageName(expected) {
265
265
  return fullName;
266
266
  }
267
267
  }
268
+ function isValuelessStructuralDirective(attr) {
269
+ if (attr.orderType !== "STRUCTURAL_DIRECTIVE" /* OrderType.StructuralDirective */ || !attr.keySpan) {
270
+ return false;
271
+ }
272
+ const attrSpan = attr.sourceSpan;
273
+ const keySpan = attr.keySpan;
274
+ /**
275
+ * A valueless structural directive will have the same span as its key.
276
+ * TextAttribute[value=''] is not always a reliable selector, because
277
+ * a *structuralDirective with `let var = something` will have value = ''
278
+ */
279
+ return (attrSpan.start.offset === keySpan.start.offset &&
280
+ attrSpan.start.line === keySpan.start.line &&
281
+ attrSpan.start.col === keySpan.start.col &&
282
+ attrSpan.end.offset === keySpan.end.offset &&
283
+ attrSpan.end.line === keySpan.end.line &&
284
+ attrSpan.end.col === keySpan.end.col);
285
+ }
268
286
  function getStartPos(expected) {
269
287
  switch (expected.orderType) {
270
288
  case "STRUCTURAL_DIRECTIVE" /* OrderType.StructuralDirective */:
@@ -276,7 +294,8 @@ function getStartPos(expected) {
276
294
  function getEndPos(expected) {
277
295
  switch (expected.orderType) {
278
296
  case "STRUCTURAL_DIRECTIVE" /* OrderType.StructuralDirective */:
279
- return expected.sourceSpan.end.offset + 1;
297
+ return (expected.sourceSpan.end.offset +
298
+ (isValuelessStructuralDirective(expected) ? 0 : 1));
280
299
  default:
281
300
  return expected.sourceSpan.end.offset;
282
301
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin-template",
3
- "version": "17.3.1-alpha.0",
3
+ "version": "17.3.1-alpha.2",
4
4
  "description": "ESLint plugin for Angular Templates",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -17,8 +17,8 @@
17
17
  "LICENSE"
18
18
  ],
19
19
  "dependencies": {
20
- "@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.0",
21
- "@angular-eslint/utils": "17.3.1-alpha.0",
20
+ "@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.2",
21
+ "@angular-eslint/utils": "17.3.1-alpha.2",
22
22
  "@typescript-eslint/type-utils": "7.2.0",
23
23
  "@typescript-eslint/utils": "7.2.0",
24
24
  "aria-query": "5.3.0",