@smarterdrafter/eslint-plugin-angular 1.0.0 → 1.0.1

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": "@smarterdrafter/eslint-plugin-angular",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Smarter Drafter shared ESLint rules for Angular templates",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -37,6 +37,17 @@ module.exports = {
37
37
  const start = node.sourceSpan.start.offset;
38
38
  const end = node.sourceSpan.end.offset;
39
39
 
40
+ // Microsyntax-derived bindings (e.g. `*ngFor="...; trackBy: fn"`,
41
+ // `*queryInput="...; type: 'category'"`) surface as BoundAttribute
42
+ // nodes too, but their source span points into the microsyntax body,
43
+ // not at a real `[name]="..."` attribute — there is no bracketed
44
+ // form to rewrite to, and substituting `name="value"` produces
45
+ // invalid template syntax. Bail out unless we're looking at a real
46
+ // property binding (which always starts with `[`).
47
+ if (sourceCode.text[start] !== '[') {
48
+ return;
49
+ }
50
+
40
51
  const canFix = !/["<>&]/.test(stringValue);
41
52
 
42
53
  context.report({