@angular-eslint/eslint-plugin-template 22.3.1-alpha.2 → 22.3.1-alpha.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-self-closing-tags.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-self-closing-tags.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC;AACjD,eAAO,MAAM,SAAS,6BAA6B,CAAC;;;;AAEpD,wBA+JG;AAuCH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
1
+ {"version":3,"file":"prefer-self-closing-tags.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-self-closing-tags.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC;AACjD,eAAO,MAAM,SAAS,6BAA6B,CAAC;;;;AAEpD,wBA+JG;AAoDH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
@@ -34,7 +34,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
34
34
  }
35
35
  else {
36
36
  // Ignore native elements.
37
- if ('name' in node && (0, get_dom_elements_1.getDomElements)().has(node.name.toLowerCase())) {
37
+ if ('name' in node && isNativeElement(node.name)) {
38
38
  return;
39
39
  }
40
40
  processElementOrTemplateNode(node);
@@ -135,6 +135,16 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
135
135
  }
136
136
  },
137
137
  });
138
+ function isNativeElement(name) {
139
+ const lowerCaseName = name.toLowerCase();
140
+ // The Angular compiler namespaces the children of `<svg>` and `<math>`
141
+ // (e.g. `:svg:use` and `:math:mi`). These are foreign elements that are
142
+ // native to the browser, and self-closing some of them (such as `<title />`)
143
+ // produces a template that Angular cannot parse.
144
+ return (lowerCaseName.startsWith(':svg:') ||
145
+ lowerCaseName.startsWith(':math:') ||
146
+ (0, get_dom_elements_1.getDomElements)().has(lowerCaseName));
147
+ }
138
148
  function isContentNode(node) {
139
149
  return 'name' in node && node.name.toLowerCase() === 'ng-content';
140
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"literal-primitive.d.ts","sourceRoot":"","sources":["../../src/utils/literal-primitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEpC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,gBAAgB,CAEtE;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,GAAG,GACR,IAAI,IAAI,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAE7D;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,KAAK,GACX,MAAM,CAIR"}
1
+ {"version":3,"file":"literal-primitive.d.ts","sourceRoot":"","sources":["../../src/utils/literal-primitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEpC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,gBAAgB,CAStE;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,GAAG,GACR,IAAI,IAAI,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAE7D;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,KAAK,GACX,MAAM,CAIR"}
@@ -5,7 +5,12 @@ exports.isStringLiteralPrimitive = isStringLiteralPrimitive;
5
5
  exports.getLiteralPrimitiveStringValue = getLiteralPrimitiveStringValue;
6
6
  const bundled_angular_compiler_1 = require("@angular-eslint/bundled-angular-compiler");
7
7
  function isLiteralPrimitive(node) {
8
- return node instanceof bundled_angular_compiler_1.LiteralPrimitive;
8
+ // The template parser stamps `type` from `constructor.name`. `instanceof`
9
+ // fails when more than one copy of `@angular-eslint/bundled-angular-compiler`
10
+ // is installed (version mismatches, Yarn `hoistingLimits`, etc.).
11
+ return (!!node &&
12
+ (node.type === 'LiteralPrimitive' ||
13
+ node instanceof bundled_angular_compiler_1.LiteralPrimitive));
9
14
  }
10
15
  function isStringLiteralPrimitive(node) {
11
16
  return isLiteralPrimitive(node) && typeof node.value === 'string';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin-template",
3
- "version": "22.3.1-alpha.2",
3
+ "version": "22.3.1-alpha.3",
4
4
  "description": "ESLint plugin for Angular Templates",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -19,17 +19,17 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "dependencies": {
22
- "@angular-eslint/bundled-angular-compiler": "22.3.1-alpha.2",
23
- "@angular-eslint/utils": "22.3.1-alpha.2",
22
+ "@angular-eslint/bundled-angular-compiler": "22.3.1-alpha.3",
23
+ "@angular-eslint/utils": "22.3.1-alpha.3",
24
24
  "aria-query": "5.3.2",
25
25
  "axobject-query": "4.1.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@angular-eslint/test-utils": "22.3.1-alpha.2",
28
+ "@angular-eslint/test-utils": "22.3.1-alpha.3",
29
29
  "@types/aria-query": "5.0.4"
30
30
  },
31
31
  "peerDependencies": {
32
- "@angular-eslint/template-parser": "22.3.1-alpha.2",
32
+ "@angular-eslint/template-parser": "22.3.1-alpha.3",
33
33
  "@typescript-eslint/types": "^8.0.0",
34
34
  "@typescript-eslint/utils": "^8.0.0",
35
35
  "eslint": "^9.0.0 || ^10.0.0",