@angular-eslint/eslint-plugin-template 16.0.4-alpha.22 → 16.0.4-alpha.27

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.
@@ -146,9 +146,13 @@ function byLocation(one, other) {
146
146
  }
147
147
  function byOrder(order, alphabetical) {
148
148
  return function (one, other) {
149
+ var _a, _b, _c, _d;
149
150
  const orderComparison = getOrderIndex(one, order) - getOrderIndex(other, order);
150
151
  if (alphabetical && orderComparison === 0) {
151
- return one.name > other.name ? 1 : -1;
152
+ return ((_b = (_a = one.keySpan) === null || _a === void 0 ? void 0 : _a.details) !== null && _b !== void 0 ? _b : one.name) >
153
+ ((_d = (_c = other.keySpan) === null || _c === void 0 ? void 0 : _c.details) !== null && _d !== void 0 ? _d : other.name)
154
+ ? 1
155
+ : -1;
152
156
  }
153
157
  return orderComparison;
154
158
  };
@@ -175,9 +179,27 @@ function toTemplateReferenceVariableOrderType(reference) {
175
179
  return Object.assign(Object.assign({}, reference), { orderType: "TEMPLATE_REFERENCE" /* OrderType.TemplateReferenceVariable */ });
176
180
  }
177
181
  function extractTemplateAttrs(node) {
178
- return isTmplAstTemplate(node.parent)
179
- ? node.parent.templateAttrs.map(toStructuralDirectiveOrderType)
180
- : [];
182
+ if (!isTmplAstTemplate(node.parent)) {
183
+ return [];
184
+ }
185
+ /*
186
+ * There may be multiple "attributes" for a structural directive even though
187
+ * there is only a single HTML attribute:
188
+ * e.g. `<ng-container *ngFor="let foo of bar"></ng-container>`
189
+ * will parsed as two attributes (`ngFor` and `ngForOf`)
190
+ */
191
+ const attrs = node.parent.templateAttrs.map(toStructuralDirectiveOrderType);
192
+ // Pick up on any subsequent `let` bindings, e.g. `index as i`
193
+ let sourceEnd = attrs[attrs.length - 1].sourceSpan.end;
194
+ node.parent.variables.forEach((v) => {
195
+ if (v.sourceSpan.start.offset <= sourceEnd.offset &&
196
+ sourceEnd.offset < v.sourceSpan.end.offset) {
197
+ sourceEnd = v.sourceSpan.end;
198
+ }
199
+ });
200
+ return [
201
+ Object.assign(Object.assign({}, attrs[0]), { sourceSpan: new bundled_angular_compiler_1.ParseSourceSpan(attrs[0].sourceSpan.start, sourceEnd) }),
202
+ ];
181
203
  }
182
204
  function normalizeInputsOutputs(inputs, outputs) {
183
205
  const extractedInputs = inputs
@@ -200,19 +222,21 @@ function isOnSameLocation(input, output) {
200
222
  input.sourceSpan.end === output.sourceSpan.end);
201
223
  }
202
224
  function getMessageName(expected) {
225
+ var _a, _b;
226
+ const fullName = (_b = (_a = expected.keySpan) === null || _a === void 0 ? void 0 : _a.details) !== null && _b !== void 0 ? _b : expected.name;
203
227
  switch (expected.orderType) {
204
228
  case "STRUCTURAL_DIRECTIVE" /* OrderType.StructuralDirective */:
205
- return `*${expected.name}`;
229
+ return `*${fullName}`;
206
230
  case "TEMPLATE_REFERENCE" /* OrderType.TemplateReferenceVariable */:
207
- return `#${expected.name}`;
231
+ return `#${fullName}`;
208
232
  case "INPUT_BINDING" /* OrderType.InputBinding */:
209
- return `[${expected.name}]`;
233
+ return `[${fullName}]`;
210
234
  case "OUTPUT_BINDING" /* OrderType.OutputBinding */:
211
- return `(${expected.name})`;
235
+ return `(${fullName})`;
212
236
  case "TWO_WAY_BINDING" /* OrderType.TwoWayBinding */:
213
- return `[(${expected.name})]`;
237
+ return `[(${fullName})]`;
214
238
  default:
215
- return expected.name;
239
+ return fullName;
216
240
  }
217
241
  }
218
242
  function getStartPos(expected) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin-template",
3
- "version": "16.0.4-alpha.22+53163f2",
3
+ "version": "16.0.4-alpha.27+90c0e91",
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": "16.0.4-alpha.22+53163f2",
21
- "@angular-eslint/utils": "16.0.4-alpha.22+53163f2",
20
+ "@angular-eslint/bundled-angular-compiler": "16.0.4-alpha.27+90c0e91",
21
+ "@angular-eslint/utils": "16.0.4-alpha.27+90c0e91",
22
22
  "@typescript-eslint/type-utils": "5.59.9",
23
23
  "@typescript-eslint/utils": "5.59.9",
24
24
  "aria-query": "5.1.3",
@@ -31,5 +31,5 @@
31
31
  "eslint": "^7.20.0 || ^8.0.0",
32
32
  "typescript": "*"
33
33
  },
34
- "gitHead": "53163f26e67bfd911a42b320e4ea592e278cfba1"
34
+ "gitHead": "90c0e916654297b29cabf8289b1811ed307018ab"
35
35
  }