@angular-eslint/eslint-plugin-template 20.5.1-alpha.7 → 20.5.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.
@@ -21,7 +21,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
21
21
  create(context) {
22
22
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
23
23
  return {
24
- 'Element[name=/^(img|area|object|input)$/]'(node) {
24
+ 'Element[name=/^(img|area|object|input)$/i]'(node) {
25
25
  const isValid = isValidNode(node);
26
26
  if (!isValid) {
27
27
  const loc = parserServices.convertElementSourceSpanToLoc(context, node);
@@ -38,13 +38,14 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
38
38
  },
39
39
  });
40
40
  function isValidNode(node) {
41
- if (node.name === 'img') {
41
+ const tagName = node.name.toLowerCase();
42
+ if (tagName === 'img') {
42
43
  return isValidImgNode(node);
43
44
  }
44
- else if (node.name === 'object') {
45
+ else if (tagName === 'object') {
45
46
  return isValidObjectNode(node);
46
47
  }
47
- else if (node.name === 'area') {
48
+ else if (tagName === 'area') {
48
49
  return isValidAreaNode(node);
49
50
  }
50
51
  else {
@@ -232,7 +232,8 @@ function toTemplateReferenceVariableOrderType(reference) {
232
232
  }
233
233
  function isImplicitTemplate(node) {
234
234
  return (isTmplAstTemplate(node) &&
235
- (node.tagName === null || !/^(:svg:)?ng-template$/.test(node.tagName)));
235
+ (node.tagName === null ||
236
+ !/^(:svg:)?ng-template$/.test(node.tagName.toLowerCase())));
236
237
  }
237
238
  function extractTemplateAttrs(node) {
238
239
  if (isTmplAstTemplate(node)) {
@@ -42,7 +42,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
42
42
  create(context, [{ ignoreWithDirectives }]) {
43
43
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
44
44
  return {
45
- [`Element[name=button]`](element) {
45
+ [`Element[name=/^(button)$/i]`](element) {
46
46
  if (!isTypeAttributePresentInElement(element)) {
47
47
  if (!isIgnored(ignoreWithDirectives, element)) {
48
48
  context.report({
@@ -41,7 +41,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
41
41
  create(context, [{ ignoreWithDirectives }]) {
42
42
  return {
43
43
  Element(node) {
44
- if (!(0, get_dom_elements_1.getDomElements)().has(node.name)) {
44
+ if (!(0, get_dom_elements_1.getDomElements)().has(node.name.toLowerCase())) {
45
45
  return;
46
46
  }
47
47
  if (isIgnored(ignoreWithDirectives, node) ||
@@ -44,7 +44,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
44
44
  create(context, [{ allowList }]) {
45
45
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
46
46
  return {
47
- 'Element[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/][children.length=0]'(node) {
47
+ 'Element[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/i][children.length=0]'(node) {
48
48
  if ((0, is_hidden_from_screen_reader_1.isHiddenFromScreenReader)(node))
49
49
  return;
50
50
  const { attributes, inputs, name: element, sourceSpan } = node;
@@ -39,7 +39,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
39
39
  create(context, [{ allowList }]) {
40
40
  return {
41
41
  Element(node) {
42
- const elementType = node.name;
42
+ const elementType = node.name.toLowerCase();
43
43
  if (!(0, get_dom_elements_1.getDomElements)().has(elementType)) {
44
44
  return;
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"label-has-associated-control.d.ts","sourceRoot":"","sources":["../../src/rules/label-has-associated-control.ts"],"names":[],"mappings":"AAQA,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC/C,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;QACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;KAC7B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACrD,eAAO,MAAM,SAAS,iCAAiC,CAAC;;AAkBxD,wBAoHG"}
1
+ {"version":3,"file":"label-has-associated-control.d.ts","sourceRoot":"","sources":["../../src/rules/label-has-associated-control.ts"],"names":[],"mappings":"AAQA,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC/C,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;QACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;KAC7B;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACrD,eAAO,MAAM,SAAS,iCAAiC,CAAC;;AAkBxD,wBAqHG"}
@@ -80,17 +80,18 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
80
80
  let labelItems = [];
81
81
  return {
82
82
  [`Element`](node) {
83
- if (allControlComponents.has(node.name)) {
83
+ const tagName = node.name.toLowerCase();
84
+ if (allControlComponents.has(tagName)) {
84
85
  inputItems.push(node);
85
86
  }
86
- const element = allLabelComponents.find(({ selector }) => selector === node.name);
87
+ const element = allLabelComponents.find(({ selector }) => selector === tagName);
87
88
  if (element) {
88
89
  labelItems.push(node);
89
90
  }
90
91
  },
91
92
  onCodePathEnd() {
92
93
  for (const node of labelItems) {
93
- const element = allLabelComponents.find(({ selector }) => selector === node.name);
94
+ const element = allLabelComponents.find(({ selector }) => selector === node.name.toLowerCase());
94
95
  if (!element)
95
96
  continue;
96
97
  const attributesInputs = new Map([...node.attributes, ...node.inputs].map(({ name, value }) => [
@@ -21,7 +21,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
21
21
  create(context) {
22
22
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
23
23
  return {
24
- 'Element[name=/^(blink|marquee)$/]'({ name: element, sourceSpan, }) {
24
+ 'Element[name=/^(blink|marquee)$/i]'({ name: element, sourceSpan, }) {
25
25
  const loc = parserServices.convertNodeSourceSpanToLoc(sourceSpan);
26
26
  context.report({
27
27
  loc,
@@ -21,7 +21,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
21
21
  create(context) {
22
22
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
23
23
  return {
24
- 'Element[name=/^(p|a)$/]'(node) {
24
+ 'Element[name=/^(p|a)$/i]'(node) {
25
25
  const hasInvalidNesting = hasAncestorOfSameType(node);
26
26
  if (hasInvalidNesting) {
27
27
  const loc = parserServices.convertElementSourceSpanToLoc(context, node);
@@ -40,7 +40,8 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
40
40
  function hasAncestorOfSameType(node) {
41
41
  let parent = node.parent;
42
42
  while (parent) {
43
- if (parent instanceof bundled_angular_compiler_1.TmplAstElement && parent.name === node.name) {
43
+ if (parent instanceof bundled_angular_compiler_1.TmplAstElement &&
44
+ parent.name.toLowerCase() === node.name.toLowerCase()) {
44
45
  return true;
45
46
  }
46
47
  parent = parent.parent;
@@ -1 +1 @@
1
- {"version":3,"file":"no-positive-tabindex.d.ts","sourceRoot":"","sources":["../../src/rules/no-positive-tabindex.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,4BAA4B,CAAC;AAC7E,eAAO,MAAM,SAAS,yBAAyB,CAAC;;AAEhD,wBA2CG"}
1
+ {"version":3,"file":"no-positive-tabindex.d.ts","sourceRoot":"","sources":["../../src/rules/no-positive-tabindex.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,4BAA4B,CAAC;AAC7E,eAAO,MAAM,SAAS,yBAAyB,CAAC;;AAEhD,wBAkDG"}
@@ -23,7 +23,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
23
23
  defaultOptions: [],
24
24
  create(context) {
25
25
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
26
- const elementNamePattern = (0, to_pattern_1.toPattern)([...(0, get_dom_elements_1.getDomElements)()]);
26
+ const domElements = [...(0, get_dom_elements_1.getDomElements)()];
27
+ const uppercaseDomElements = domElements.map((element) => element.toUpperCase());
28
+ const elementNamePattern = (0, to_pattern_1.toPattern)([
29
+ ...domElements,
30
+ ...uppercaseDomElements,
31
+ ]);
27
32
  return {
28
33
  [`Element[name=${elementNamePattern}] > BoundAttribute[name="tabindex"][value.ast.value>0], TextAttribute[name="tabindex"][value>0]`]({ valueSpan, }) {
29
34
  const loc = parserServices.convertNodeSourceSpanToLoc(valueSpan);
@@ -22,7 +22,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
22
22
  create(context) {
23
23
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
24
24
  return {
25
- 'Element[name=img]'(element) {
25
+ 'Element[name=/^img$/i]'(element) {
26
26
  const ngSrcAttribute = hasNgSrcAttribute(element);
27
27
  const srcAttribute = hasNormalSrcAttribute(element);
28
28
  if (!srcAttribute ||
@@ -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)) {
37
+ if ('name' in node && (0, get_dom_elements_1.getDomElements)().has(node.name.toLowerCase())) {
38
38
  return;
39
39
  }
40
40
  processElementOrTemplateNode(node);
@@ -136,7 +136,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
136
136
  },
137
137
  });
138
138
  function isContentNode(node) {
139
- return 'name' in node && node.name === 'ng-content';
139
+ return 'name' in node && node.name.toLowerCase() === 'ng-content';
140
140
  }
141
141
  function findStartOfNgContentInnerHTML(html) {
142
142
  let quote;
@@ -1 +1 @@
1
- {"version":3,"file":"role-has-required-aria.d.ts","sourceRoot":"","sources":["../../src/rules/role-has-required-aria.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AACrE,eAAO,MAAM,SAAS,2BAA2B,CAAC;;AAElD,wBA2EG"}
1
+ {"version":3,"file":"role-has-required-aria.d.ts","sourceRoot":"","sources":["../../src/rules/role-has-required-aria.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAAG,mBAAmB,CAAC;AACrE,eAAO,MAAM,SAAS,2BAA2B,CAAC;;AAElD,wBAkFG"}
@@ -25,7 +25,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
25
25
  defaultOptions: [],
26
26
  create(context) {
27
27
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
28
- const elementNamePattern = (0, to_pattern_1.toPattern)([...(0, get_dom_elements_1.getDomElements)()]);
28
+ const domElements = [...(0, get_dom_elements_1.getDomElements)()];
29
+ const uppercaseDomElements = domElements.map((element) => element.toUpperCase());
30
+ const elementNamePattern = (0, to_pattern_1.toPattern)([
31
+ ...domElements,
32
+ ...uppercaseDomElements,
33
+ ]);
29
34
  return {
30
35
  [`Element[name=${elementNamePattern}] > TextAttribute[name='role']`](node) {
31
36
  const { value: role, sourceSpan } = node;
@@ -1 +1 @@
1
- {"version":3,"file":"table-scope.d.ts","sourceRoot":"","sources":["../../src/rules/table-scope.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AACtC,eAAO,MAAM,SAAS,gBAAgB,CAAC;;AAEvC,wBAuCG"}
1
+ {"version":3,"file":"table-scope.d.ts","sourceRoot":"","sources":["../../src/rules/table-scope.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AACtC,eAAO,MAAM,SAAS,gBAAgB,CAAC;;AAEvC,wBA8CG"}
@@ -22,7 +22,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
22
22
  defaultOptions: [],
23
23
  create(context) {
24
24
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
25
- const domElementsPattern = (0, to_pattern_1.toPattern)([...(0, get_dom_elements_1.getDomElements)()].filter((domElement) => domElement !== 'th'));
25
+ const domElements = [...(0, get_dom_elements_1.getDomElements)()].filter((domElement) => domElement !== 'th');
26
+ const uppercaseDomElements = domElements.map((element) => element.toUpperCase());
27
+ const domElementsPattern = (0, to_pattern_1.toPattern)([
28
+ ...domElements,
29
+ ...uppercaseDomElements,
30
+ ]);
26
31
  return {
27
32
  [`Element[name=${domElementsPattern}] > :matches(BoundAttribute, TextAttribute)[name='scope']`]({ sourceSpan, }) {
28
33
  const loc = parserServices.convertNodeSourceSpanToLoc(sourceSpan);
@@ -1 +1 @@
1
- {"version":3,"file":"valid-aria.d.ts","sourceRoot":"","sources":["../../src/rules/valid-aria.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,gBAAgB,GAChB,0BAA0B,CAAC;AAC/B,eAAO,MAAM,SAAS,eAAe,CAAC;;AAEtC,wBAuEG"}
1
+ {"version":3,"file":"valid-aria.d.ts","sourceRoot":"","sources":["../../src/rules/valid-aria.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,gBAAgB,GAChB,0BAA0B,CAAC;AAC/B,eAAO,MAAM,SAAS,eAAe,CAAC;;AAEtC,wBA8EG"}
@@ -26,7 +26,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
26
26
  defaultOptions: [],
27
27
  create(context) {
28
28
  const parserServices = (0, utils_1.getTemplateParserServices)(context);
29
- const elementNamePattern = (0, to_pattern_1.toPattern)([...(0, get_dom_elements_1.getDomElements)()]);
29
+ const domElements = [...(0, get_dom_elements_1.getDomElements)()];
30
+ const uppercaseDomElements = domElements.map((element) => element.toUpperCase());
31
+ const elementNamePattern = (0, to_pattern_1.toPattern)([
32
+ ...domElements,
33
+ ...uppercaseDomElements,
34
+ ]);
30
35
  return {
31
36
  [`Element[name=${elementNamePattern}] > :matches(BoundAttribute, TextAttribute)[name=/^aria-.+/]`](node) {
32
37
  const { name: attribute, sourceSpan } = node;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/is-interactive-element/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAwC/E;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAE5E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAElE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/is-interactive-element/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AA2C/E;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAK5E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAElE"}
@@ -10,7 +10,8 @@ const get_interactive_element_role_schemas_1 = require("./get-interactive-elemen
10
10
  const get_non_interactive_element_role_schemas_1 = require("./get-non-interactive-element-role-schemas");
11
11
  function checkIsInteractiveElement(node) {
12
12
  function elementSchemaMatcher({ attributes, name }) {
13
- return node.name === name && (0, attributes_comparator_1.attributesComparator)(attributes ?? [], node);
13
+ return (node.name.toLowerCase() === name &&
14
+ (0, attributes_comparator_1.attributesComparator)(attributes ?? [], node));
14
15
  }
15
16
  // Check in elementRoles for inherent interactive role associations for
16
17
  // this element.
@@ -37,7 +38,8 @@ function checkIsNonInteractiveRole(node) {
37
38
  * it's intention is to be interacted with on the DOM.
38
39
  */
39
40
  function isInherentlyInteractiveElement(node) {
40
- return (0, get_dom_elements_1.getDomElements)().has(node.name) && checkIsInteractiveElement(node);
41
+ return ((0, get_dom_elements_1.getDomElements)().has(node.name.toLowerCase()) &&
42
+ checkIsInteractiveElement(node));
41
43
  }
42
44
  function isNonInteractiveRole(node) {
43
45
  return checkIsNonInteractiveRole(node);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin-template",
3
- "version": "20.5.1-alpha.7",
3
+ "version": "20.5.1",
4
4
  "description": "ESLint plugin for Angular Templates",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,19 +20,19 @@
20
20
  "dependencies": {
21
21
  "aria-query": "5.3.2",
22
22
  "axobject-query": "4.1.0",
23
- "@angular-eslint/utils": "20.5.1-alpha.7",
24
- "@angular-eslint/bundled-angular-compiler": "20.5.1-alpha.7"
23
+ "@angular-eslint/bundled-angular-compiler": "20.5.1",
24
+ "@angular-eslint/utils": "20.5.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/aria-query": "5.0.4",
28
- "@angular-eslint/test-utils": "20.5.1-alpha.7"
28
+ "@angular-eslint/test-utils": "20.5.1"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@typescript-eslint/types": "^7.11.0 || ^8.0.0",
32
32
  "@typescript-eslint/utils": "^7.11.0 || ^8.0.0",
33
33
  "eslint": "^8.57.0 || ^9.0.0",
34
34
  "typescript": "*",
35
- "@angular-eslint/template-parser": "20.5.1-alpha.7"
35
+ "@angular-eslint/template-parser": "20.5.1"
36
36
  },
37
37
  "gitHead": "e2006e5e9c99e5a943d1a999e0efa5247d29ec24"
38
38
  }