@angular-eslint/eslint-plugin-template 12.3.2-alpha.4 → 12.4.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/CHANGELOG.md +12 -0
- package/dist/index.js +1 -1
- package/dist/rules/i18n.d.ts +4 -3
- package/dist/utils/attributes-comparator.d.ts +1 -1
- package/dist/utils/constants.d.ts +8 -1
- package/dist/utils/get-attribute-value.d.ts +11 -3
- package/dist/utils/get-original-attribute-name.d.ts +13 -0
- package/dist/utils/is-hidden-from-screen-reader.d.ts +6 -3
- package/dist/utils/{is-presentational-role.d.ts → is-presentation-role.d.ts} +0 -0
- package/package.json +3 -3
- package/dist/utils/get-literal-value.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [12.4.1](https://github.com/angular-eslint/angular-eslint/compare/v12.4.0...v12.4.1) (2021-09-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @angular-eslint/eslint-plugin-template
|
|
9
|
+
|
|
10
|
+
# [12.4.0](https://github.com/angular-eslint/angular-eslint/compare/v12.3.1...v12.4.0) (2021-09-09)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **eslint-plugin-template:** [i18n] fixes some incorrect reports ([#665](https://github.com/angular-eslint/angular-eslint/issues/665)) ([a011b9d](https://github.com/angular-eslint/angular-eslint/commit/a011b9d6711482f0713e30208d46b38ce266741d))
|
|
15
|
+
- **eslint-plugin-template:** [no-call-expression]: `FunctionCall`s not being reported ([#601](https://github.com/angular-eslint/angular-eslint/issues/601)) ([5552b13](https://github.com/angular-eslint/angular-eslint/commit/5552b13a87ff0a04ea92a12f54decfbb0c4f984e))
|
|
16
|
+
- **eslint-plugin-template:** include more checks for `isHiddenFromScreenReader` ([#545](https://github.com/angular-eslint/angular-eslint/issues/545)) ([db2bc05](https://github.com/angular-eslint/angular-eslint/commit/db2bc057458bf7080b7848934dd6a30582dced27))
|
|
17
|
+
|
|
6
18
|
## [12.3.1](https://github.com/angular-eslint/angular-eslint/compare/v12.3.0...v12.3.1) (2021-07-15)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @angular-eslint/eslint-plugin-template
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=require("typescript"),t=require("@typescript-eslint/experimental-utils"),n=require("@angular/compiler"),r=require("aria-query");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e);function s(e,t){const n=(e=e.replace(/\r\n/g,"\n")).indexOf(t);return[n,n+t.length]}const i=new Map;var c={"extract-inline-html":{preprocess:function(e,t){const n=[e];if(!function(e,t){return!![".component.ts",".page.ts",".dialog.ts",".modal.ts",".popover.ts",".bottomsheet.ts",".snackbar.ts"].some(e=>t.endsWith(e))||!(!e.includes("Component")||!e.includes("@angular/core"))}(e,t))return n;try{const r=o.default.createSourceFile(t,e,o.default.ScriptTarget.Latest,!0),a=r.statements.filter(e=>o.default.isClassDeclaration(e));if(!a||!a.length)return n;const c=[];for(const e of a)if(e.decorators)for(const t of e.decorators)o.default.isCallExpression(t.expression)&&o.default.isIdentifier(t.expression.expression)&&"Component"===t.expression.expression.text&&c.push(t);if(!c||!c.length)return n;const l=[e];let u=0;for(const t of c){if(!o.default.isDecorator(t)||!o.default.isCallExpression(t.expression)||1!==t.expression.arguments.length)continue;const n=t.expression.arguments[0];if(!o.default.isObjectLiteralExpression(n))continue;const a=n.properties.find(e=>e&&e.name&&"template"===e.name.getText());if(n.properties.find(e=>e&&e.name&&"templateUrl"===e.name.getText())||!a)continue;if(!o.default.isPropertyAssignment(a)||!o.default.isStringLiteralLike(a.initializer))continue;const c=a.initializer.text,p=s(e,c),m=`inline-template-${++u}.component.html`;i.set(m,{range:p,lineAndCharacter:{start:r.getLineAndCharacterOfPosition(p[0]),end:r.getLineAndCharacterOfPosition(p[1])}}),l.push({text:c,filename:m})}return l}catch(e){return console.log(e),console.error("preprocess: ERROR could not parse @Component() metadata",t),n}},postprocess:function(e,t){const n=e[0];if(1===e.length)return n;const r=e.slice(1);return[...n,...[].concat(...r.map((e,t)=>{const n=`inline-template-${++t}.component.html`,r=i.get(n);return r?e.map(e=>{if(e.line=e.line+r.lineAndCharacter.start.line,e.endLine=e.endLine+r.lineAndCharacter.start.line,e.fix){const t=r.range[0];e.fix.range=[t+e.fix.range[0],t+e.fix.range[1]]}return e}):[]}))]},supportsAutofix:!0}};const l=t.ESLintUtils.RuleCreator(e=>"https://github.com/angular-eslint/angular-eslint");function u(e){return p(e),e.parserServices}function p(e){var t,n;if(null==(t=e.parserServices)||!t.convertNodeSourceSpanToLoc||null==(n=e.parserServices)||!n.convertElementSourceSpanToLoc)throw new Error("You have used a rule which requires '@angular-eslint/template-parser' to be used as the 'parser' in your ESLint config.")}const m=Symbol("PROPERTY");function d(e,t){const r=e.attributes.find(e=>e.name===t);if(r)return r.value;const a=e.inputs.find(e=>e.name===t);return a&&a.value instanceof n.ASTWithSource?a.value.ast instanceof n.LiteralPrimitive?a.value.ast.value:m:null}var g=l({name:"accessibility-alt-text",meta:{type:"suggestion",docs:{description:"Enforces alternate text for elements which require the alt, aria-label, aria-labelledby attributes.",category:"Best Practices",recommended:!1},schema:[],messages:{accessibilityAltText:"<{{element}}/> element must have a text alternative."}},defaultOptions:[],create(e){const t=u(e);return{"Element[name=/^(img|area|object|input)$/]"(n){if(!function(e){return"img"===e.name?function(e){return e.attributes.some(({name:e})=>S(e))||e.inputs.some(({name:e})=>S(e))}(e):"object"===e.name?function(e){let t=!1,n=!1;for(const r of e.attributes)t="title"===r.name,n=y(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r="title"===t.name,a=y(t.name);return!(!r&&!a)||e.children.length>0&&!!e.children[0].value}(e):"area"===e.name?f(e):function(e){return"image"!==d(e,"type")||f(e)}(e)}(n)){const r=t.convertElementSourceSpanToLoc(e,n);e.report({loc:r,messageId:"accessibilityAltText",data:{element:n.name}})}}}}});function f(e){let t=!1,n=!1;for(const r of e.attributes)t=S(r.name),n=y(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r=S(t.name),a=y(t.name);return r||a}function y(e){return"aria-label"===e||"aria-labelledby"===e}function S(e){return"alt"===e}function T(e){if("string"==typeof e){if("true"===e)return!0;if("false"===e)return!1}return e}function b(e){if("INPUT"===e.name.toUpperCase()){const t=d(e,"type");if("string"==typeof t&&"HIDDEN"===t.toUpperCase())return!0}const t=T(d(e,"aria-hidden"));return""===t||t===m||!0===t}const x=new Set(["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"]);var h=l({name:"accessibility-elements-content",meta:{type:"suggestion",docs:{description:"Ensures that the heading, anchor and button elements have content in it",category:"Best Practices",recommended:!1},schema:[],messages:{accessibilityElementsContent:"<{{element}}> should have content"}},defaultOptions:[],create(e){const t=u(e);return{"Element[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/][children.length=0]"(n){if(b(n))return;const{attributes:r,inputs:a,name:o,sourceSpan:s}=n;if([...r,...a].map(({name:e})=>e).some(e=>x.has(e)))return;const i=t.convertNodeSourceSpanToLoc(s);e.report({loc:i,messageId:"accessibilityElementsContent",data:{element:o}})}}}});function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function E(e,t){return function e({children:r}){return r.some(r=>r instanceof n.TmplAstElement&&(r.name===t||e(r)))}(e)}const A={items:{type:"string"},type:"array",uniqueItems:!0},w=["button","input","meter","output","progress","select","textarea"],I=["for","htmlFor"],C=["label"];var P=l({name:"accessibility-label-for",meta:{deprecated:!0,replacedBy:["accessibility-label-has-associated-control"],type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",category:"Best Practices",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:v({description:`\nDefault value:\n${JSON.stringify(w)}\n`.trim()},A),labelAttributes:v({description:`\nDefault value:\n${JSON.stringify(I)}\n `.trim()},A),labelComponents:v({description:`\nDefault value:\n${JSON.stringify(C)}\n`.trim()},A)},type:"object"}],messages:{accessibilityLabelFor:"A label element/component must be associated with a form element"}},defaultOptions:[{controlComponents:w,labelAttributes:I,labelComponents:C}],create(e,[t]){const n=u(e),{controlComponents:r,labelAttributes:a,labelComponents:o}=function({controlComponents:e,labelAttributes:t,labelComponents:n}){return{controlComponents:new Set([...w,...null!=e?e:[]]),labelAttributes:new Set([...I,...null!=t?t:[]]),labelComponents:new Set([...C,...null!=n?n:[]])}}(t);var s;return{[`Element[name=${s=[...o],RegExp(`^(${s.join("|")})$`)}]`](t){const o=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if([...a].some(e=>o.has(e))||function(e,t){return Boolean([...e].some(e=>E(t,e)))}(r,t))return;const s=n.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:s,messageId:"accessibilityLabelFor"})}}}});const N="accessibility-label-has-associated-control",O=["input","meter","output","progress","select","textarea"],B=[{inputs:["for","htmlFor"],selector:"label"}];var D=l({name:N,meta:{type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",category:"Best Practices",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{items:{type:"string"},type:"array",uniqueItems:!0},labelComponents:{items:{additionalProperties:!1,properties:{inputs:{items:{type:"string"},type:"array",uniqueItems:!0},selector:{type:"string"}},required:["selector"],type:"object"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityLabelHasAssociatedControl:"A label component must be associated with a form element"}},defaultOptions:[{controlComponents:O,labelComponents:B}],create(e,[{controlComponents:t,labelComponents:n}]){const r=u(e),a=new Set([...O,...null!=t?t:[]]),o=[...B,...null!=n?n:[]],s=o.map(({selector:e})=>e);return{[`Element[name=${RegExp(`^(${s.join("|")})$`)}]`](t){var n;const s=o.find(({selector:e})=>e===t.name);if(!s)return;const i=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if((null==(n=s.inputs)?void 0:n.some(e=>i.has(e)))||function(e,t){return Boolean([...e].some(e=>E(t,e)))}(a,t))return;const c=r.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:c,messageId:"accessibilityLabelHasAssociatedControl"})}}}});let L=null;function k(){var e;return null!=(e=L)?e:L=new Set(r.dom.keys())}function _(e){return RegExp(`^(${e.join("|")})$`)}var F=l({name:"accessibility-table-scope",meta:{type:"suggestion",docs:{description:"Ensures that the `scope` attribute is only used on the `<th>` element",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{accessibilityTableScope:"The `scope` attribute should only be on the `<th>` element"}},defaultOptions:[],create(e){const t=u(e);return{[`Element[name=${_([...k()].filter(e=>"th"!==e))}] > :matches(BoundAttribute, TextAttribute)[name='scope']`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"accessibilityTableScope",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),K=l({name:"accessibility-valid-aria",meta:{type:"suggestion",docs:{description:"Ensures that correct ARIA attributes and respective values are used",category:"Best Practices",recommended:!1,suggestion:!0},schema:[],messages:{accessibilityValidAria:"The `{{attribute}}` is an invalid ARIA attribute",accessibilityValidAriaValue:"The `{{attribute}}` has an invalid value. Check the valid values at https://raw.githack.com/w3c/aria/stable/#roles",suggestRemoveInvalidAria:"Remove attribute `{{attribute}}`"}},defaultOptions:[],create(e){const t=u(e);return{[`Element[name=${_([...k()])}] > :matches(BoundAttribute, TextAttribute)[name=/^aria-.+/]`](a){const{name:o,sourceSpan:s}=a,i=r.aria.get(o),c=t.convertNodeSourceSpanToLoc(s);if(!i)return void e.report({loc:c,messageId:"accessibilityValidAria",data:{attribute:o},suggest:[{messageId:"suggestRemoveInvalidAria",data:{attribute:o},fix:e=>e.removeRange([s.start.offset-1,s.end.offset])}]});const l=function(e){return e instanceof n.TmplAstBoundAttribute&&e.value instanceof n.ASTWithSource?e.value.ast:e}(a);(function(e){return!function(e){return e instanceof n.LiteralArray||e instanceof n.LiteralMap}(e)&&!function(e){return e instanceof n.LiteralPrimitive||e instanceof n.TmplAstTextAttribute}(e)})(l)||function({allowundefined:e,type:t,values:n},r){if(e&&j(r))return!0;switch(t){case"boolean":return R(r);case"tristate":return R(r)||j(r);case"id":case"idlist":return!0;case"integer":return a=r,!Number.isNaN(a)&&parseInt(Number(a))==a&&!Number.isNaN(parseInt(a,10));case"number":return function(e){return!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(e)}(r);case"string":return function(e){return"string"==typeof e}(r);case"token":case"tokenlist":{const e=R(r)?JSON.parse(r):r;return Boolean(null==n?void 0:n.includes(e))}}var a}(i,l.value)||e.report({loc:c,messageId:"accessibilityValidAriaValue",data:{attribute:o}})}}}});function R(e){return"boolean"==typeof e||"false"===e||"true"===e}function j(e){return null==e}const M=/\[(.*)\]/;var q=l({name:"banana-in-box",meta:{type:"suggestion",docs:{description:"Ensures that the two-way data binding syntax is correct",category:"Best Practices",recommended:"error"},fixable:"code",schema:[],messages:{bananaInBox:"Invalid binding syntax. Use [(expr)] instead"}},defaultOptions:[],create(e){const t=u(e),n=e.getSourceCode();return{BoundEvent({name:r,sourceSpan:a}){const o=r.match(M);if(!o)return;const s=t.convertNodeSourceSpanToLoc(a);e.report({messageId:"bananaInBox",loc:s,fix:e=>{const[,t]=o,a=`[(${t})]`,i=n.getIndexFromLoc(s.start);return e.replaceTextRange([i,i+r.length+2],a)}})}}}});const $=new Set(["presentation","none",m]);let J=null,X=null,U=null;var W=l({name:"click-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the click event is accompanied with at least one key event keyup, keydown or keypress.",category:"Best Practices",recommended:!1},schema:[],messages:{clickEventsHaveKeyEvents:"click must be accompanied by either keyup, keydown or keypress event for accessibility."}},defaultOptions:[],create:e=>({Element(t){if(!k().has(t.name))return;if(function(e){const t=d(e,"role");return null!==t&&$.has(t)}(t)||b(t)||function(e){return k().has(e.name)&&function(e){function t({attributes:t,name:n}){return e.name===n&&function(e=[],t){const n=[...t.attributes,...t.inputs];return e.every(e=>n.some(n=>"a"===t.name&&"routerLink"===n.name||e.name===n.name&&(!e.value||e.value===T(d(t,e.name)))))}(t,e)}return!!function(){if(null===X){const e=[...r.roles.keys()],t=[...r.elementRoles],n=new Set(e.filter(e=>{const t=r.roles.get(e);return t&&!t.abstract&&"progressbar"!==e&&t.superClass.some(e=>e.includes("widget"))}).concat("toolbar"));X=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return X}().some(t)||!function(){if(null===U){const e=[...r.roles.keys()],t=[...r.elementRoles],n=new Set(e.filter(e=>{const t=r.roles.get(e);return t&&!t.abstract&&"toolbar"!==e&&!t.superClass.some(e=>e.includes("widget"))}).concat("progressbar"));U=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return U}().some(t)&&function(){if(null===J){const{AXObjects:e,elementAXObjects:t}=require("axobject-query"),n=new Set(Array.from(e.keys()).filter(t=>"widget"===e.get(t).type));J=[...t].reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return J}().some(t)}(e)}(t))return;let n=!1,a=!1;for(const e of t.outputs)n="click"===e.name,a=e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress");if(!n||a)return;const o=u(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:o,messageId:"clickEventsHaveKeyEvents"})}})}),Y=l({name:"conditional-complexity",meta:{type:"suggestion",docs:{description:"The conditional complexity should not exceed a rational limit",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{minimum:1,type:"number",description:"\nDefault is: `5`".trim()}},additionalProperties:!1}],messages:{"conditionalСomplexity":"The conditional complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){p(e);const r=e.getSourceCode();return{BoundAttribute(a){if(!a.value.source)return;const o=z(H((V||(V=new n.Parser(new n.Lexer))).parseBinding(a.value.source,"",0).ast));if(o<=t)return;const{sourceSpan:{start:s,end:i}}=a.value;e.report({loc:{start:r.getLocFromIndex(s),end:r.getLocFromIndex(i)},messageId:"conditionalСomplexity",data:{maxComplexity:t,totalComplexity:o}})},Interpolation({expressions:n}){for(const a of n){const n=z(a);if(n<=t)continue;const{sourceSpan:{start:o,end:s}}=a;e.report({loc:{start:r.getLocFromIndex(o),end:r.getLocFromIndex(s)},messageId:"conditionalСomplexity",data:{maxComplexity:t,totalComplexity:n}})}}}}});function H(e){return e instanceof n.BindingPipe?e.exp:e}let V=null;function z(e){const t=H(e);if(!(t instanceof n.Binary||t instanceof n.Conditional))return 0;let r=1;return t instanceof n.Binary&&(t.left instanceof n.Binary&&(r+=z(t.left)),t.right instanceof n.Binary&&(r+=z(t.right))),t instanceof n.Conditional&&(r+=z(t.condition)+z(t.trueExp)+z(t.falseExp)),r}var Q=l({name:"cyclomatic-complexity",meta:{type:"suggestion",docs:{description:"Checks cyclomatic complexity against a specified limit. It is a quantitative measure of the number of linearly independent paths through a program's source code",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{type:"number",minimum:1,description:"\nDefault is: `5`".trim()}},additionalProperties:!1}],messages:{cyclomaticComplexity:"The cyclomatic complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){let n=0;const r=u(e);return{'BoundAttribute[name=/^(ngForOf|ngIf|ngSwitchCase)$/], TextAttribute[name="ngSwitchDefault"]'({sourceSpan:a}){if(n+=1,n<=t)return;const o=r.convertNodeSourceSpanToLoc(a);e.report({messageId:"cyclomaticComplexity",loc:o,data:{maxComplexity:t,totalComplexity:n}})}}}}),G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(e){var t={exports:{}};return e(t,t.exports),t.exports}var ee=Z(function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,(n=t.AST_NODE_TYPES||(t.AST_NODE_TYPES={})).ArrayExpression="ArrayExpression",n.ArrayPattern="ArrayPattern",n.ArrowFunctionExpression="ArrowFunctionExpression",n.AssignmentExpression="AssignmentExpression",n.AssignmentPattern="AssignmentPattern",n.AwaitExpression="AwaitExpression",n.BinaryExpression="BinaryExpression",n.BlockStatement="BlockStatement",n.BreakStatement="BreakStatement",n.CallExpression="CallExpression",n.CatchClause="CatchClause",n.ChainExpression="ChainExpression",n.ClassBody="ClassBody",n.ClassDeclaration="ClassDeclaration",n.ClassExpression="ClassExpression",n.ClassProperty="ClassProperty",n.ConditionalExpression="ConditionalExpression",n.ContinueStatement="ContinueStatement",n.DebuggerStatement="DebuggerStatement",n.Decorator="Decorator",n.DoWhileStatement="DoWhileStatement",n.EmptyStatement="EmptyStatement",n.ExportAllDeclaration="ExportAllDeclaration",n.ExportDefaultDeclaration="ExportDefaultDeclaration",n.ExportNamedDeclaration="ExportNamedDeclaration",n.ExportSpecifier="ExportSpecifier",n.ExpressionStatement="ExpressionStatement",n.ForInStatement="ForInStatement",n.ForOfStatement="ForOfStatement",n.ForStatement="ForStatement",n.FunctionDeclaration="FunctionDeclaration",n.FunctionExpression="FunctionExpression",n.Identifier="Identifier",n.IfStatement="IfStatement",n.ImportDeclaration="ImportDeclaration",n.ImportDefaultSpecifier="ImportDefaultSpecifier",n.ImportExpression="ImportExpression",n.ImportNamespaceSpecifier="ImportNamespaceSpecifier",n.ImportSpecifier="ImportSpecifier",n.JSXAttribute="JSXAttribute",n.JSXClosingElement="JSXClosingElement",n.JSXClosingFragment="JSXClosingFragment",n.JSXElement="JSXElement",n.JSXEmptyExpression="JSXEmptyExpression",n.JSXExpressionContainer="JSXExpressionContainer",n.JSXFragment="JSXFragment",n.JSXIdentifier="JSXIdentifier",n.JSXMemberExpression="JSXMemberExpression",n.JSXNamespacedName="JSXNamespacedName",n.JSXOpeningElement="JSXOpeningElement",n.JSXOpeningFragment="JSXOpeningFragment",n.JSXSpreadAttribute="JSXSpreadAttribute",n.JSXSpreadChild="JSXSpreadChild",n.JSXText="JSXText",n.LabeledStatement="LabeledStatement",n.Literal="Literal",n.LogicalExpression="LogicalExpression",n.MemberExpression="MemberExpression",n.MetaProperty="MetaProperty",n.MethodDefinition="MethodDefinition",n.NewExpression="NewExpression",n.ObjectExpression="ObjectExpression",n.ObjectPattern="ObjectPattern",n.Program="Program",n.Property="Property",n.RestElement="RestElement",n.ReturnStatement="ReturnStatement",n.SequenceExpression="SequenceExpression",n.SpreadElement="SpreadElement",n.Super="Super",n.SwitchCase="SwitchCase",n.SwitchStatement="SwitchStatement",n.TaggedTemplateExpression="TaggedTemplateExpression",n.TemplateElement="TemplateElement",n.TemplateLiteral="TemplateLiteral",n.ThisExpression="ThisExpression",n.ThrowStatement="ThrowStatement",n.TryStatement="TryStatement",n.UnaryExpression="UnaryExpression",n.UpdateExpression="UpdateExpression",n.VariableDeclaration="VariableDeclaration",n.VariableDeclarator="VariableDeclarator",n.WhileStatement="WhileStatement",n.WithStatement="WithStatement",n.YieldExpression="YieldExpression",n.TSAbstractClassProperty="TSAbstractClassProperty",n.TSAbstractKeyword="TSAbstractKeyword",n.TSAbstractMethodDefinition="TSAbstractMethodDefinition",n.TSAnyKeyword="TSAnyKeyword",n.TSArrayType="TSArrayType",n.TSAsExpression="TSAsExpression",n.TSAsyncKeyword="TSAsyncKeyword",n.TSBigIntKeyword="TSBigIntKeyword",n.TSBooleanKeyword="TSBooleanKeyword",n.TSCallSignatureDeclaration="TSCallSignatureDeclaration",n.TSClassImplements="TSClassImplements",n.TSConditionalType="TSConditionalType",n.TSConstructorType="TSConstructorType",n.TSConstructSignatureDeclaration="TSConstructSignatureDeclaration",n.TSDeclareFunction="TSDeclareFunction",n.TSDeclareKeyword="TSDeclareKeyword",n.TSEmptyBodyFunctionExpression="TSEmptyBodyFunctionExpression",n.TSEnumDeclaration="TSEnumDeclaration",n.TSEnumMember="TSEnumMember",n.TSExportAssignment="TSExportAssignment",n.TSExportKeyword="TSExportKeyword",n.TSExternalModuleReference="TSExternalModuleReference",n.TSFunctionType="TSFunctionType",n.TSImportEqualsDeclaration="TSImportEqualsDeclaration",n.TSImportType="TSImportType",n.TSIndexedAccessType="TSIndexedAccessType",n.TSIndexSignature="TSIndexSignature",n.TSInferType="TSInferType",n.TSInterfaceBody="TSInterfaceBody",n.TSInterfaceDeclaration="TSInterfaceDeclaration",n.TSInterfaceHeritage="TSInterfaceHeritage",n.TSIntersectionType="TSIntersectionType",n.TSIntrinsicKeyword="TSIntrinsicKeyword",n.TSLiteralType="TSLiteralType",n.TSMappedType="TSMappedType",n.TSMethodSignature="TSMethodSignature",n.TSModuleBlock="TSModuleBlock",n.TSModuleDeclaration="TSModuleDeclaration",n.TSNamedTupleMember="TSNamedTupleMember",n.TSNamespaceExportDeclaration="TSNamespaceExportDeclaration",n.TSNeverKeyword="TSNeverKeyword",n.TSNonNullExpression="TSNonNullExpression",n.TSNullKeyword="TSNullKeyword",n.TSNumberKeyword="TSNumberKeyword",n.TSObjectKeyword="TSObjectKeyword",n.TSOptionalType="TSOptionalType",n.TSParameterProperty="TSParameterProperty",n.TSParenthesizedType="TSParenthesizedType",n.TSPrivateKeyword="TSPrivateKeyword",n.TSPropertySignature="TSPropertySignature",n.TSProtectedKeyword="TSProtectedKeyword",n.TSPublicKeyword="TSPublicKeyword",n.TSQualifiedName="TSQualifiedName",n.TSReadonlyKeyword="TSReadonlyKeyword",n.TSRestType="TSRestType",n.TSStaticKeyword="TSStaticKeyword",n.TSStringKeyword="TSStringKeyword",n.TSSymbolKeyword="TSSymbolKeyword",n.TSTemplateLiteralType="TSTemplateLiteralType",n.TSThisType="TSThisType",n.TSTupleType="TSTupleType",n.TSTypeAliasDeclaration="TSTypeAliasDeclaration",n.TSTypeAnnotation="TSTypeAnnotation",n.TSTypeAssertion="TSTypeAssertion",n.TSTypeLiteral="TSTypeLiteral",n.TSTypeOperator="TSTypeOperator",n.TSTypeParameter="TSTypeParameter",n.TSTypeParameterDeclaration="TSTypeParameterDeclaration",n.TSTypeParameterInstantiation="TSTypeParameterInstantiation",n.TSTypePredicate="TSTypePredicate",n.TSTypeQuery="TSTypeQuery",n.TSTypeReference="TSTypeReference",n.TSUndefinedKeyword="TSUndefinedKeyword",n.TSUnionType="TSUnionType",n.TSUnknownKeyword="TSUnknownKeyword",n.TSVoidKeyword="TSVoidKeyword",(r=t.AST_TOKEN_TYPES||(t.AST_TOKEN_TYPES={})).Boolean="Boolean",r.Identifier="Identifier",r.JSXIdentifier="JSXIdentifier",r.JSXText="JSXText",r.Keyword="Keyword",r.Null="Null",r.Numeric="Numeric",r.Punctuator="Punctuator",r.RegularExpression="RegularExpression",r.String="String",r.Template="Template",r.Block="Block",r.Line="Line"});Object.defineProperty(exports,"__esModule",{value:!0});var te={__proto__:null};Object.defineProperty(exports,"__esModule",{value:!0});var ne={__proto__:null},re=Z(function(e,t){var n=G&&G.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=G&&G.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=G&&G.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&n(t,e,a);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TSESTree=void 0,t.TSESTree=a(ee)}),ae=Z(function(e,t){var n=G&&G.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=G&&G.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,Object.defineProperty(t,"AST_NODE_TYPES",{enumerable:!0,get:function(){return ee.AST_NODE_TYPES}});var a=ee;Object.defineProperty(t,"AST_TOKEN_TYPES",{enumerable:!0,get:function(){return a.AST_TOKEN_TYPES}}),r(te,t),r(ne,t),r(re,t)});function oe({parent:e},t){for(;e&&e.type!==ae.AST_NODE_TYPES.Program;){if(t(e))return e;e=e.parent}return null}const se={allowNullOrUndefined:!1};var ie=l({name:"eqeqeq",meta:{type:"suggestion",docs:{description:"Requires `===` and `!==` in place of `==` and `!=`",category:"Best Practices",recommended:"error",suggestion:!0},fixable:"code",schema:[{type:"object",properties:{allowNullOrUndefined:{type:"boolean",default:se.allowNullOrUndefined}},additionalProperties:!1}],messages:{eqeqeq:"Expected `{{expectedOperation}}` but received `{{actualOperation}}`",suggestStrictEquality:"Replace `{{expectedOperation}}` with `{{actualOperation}}`"}},defaultOptions:[se],create(e,[{allowNullOrUndefined:t}]){p(e);const n=e.getSourceCode();return{"Binary[operation=/^(==|!=)$/]"(r){const{left:a,operation:o,right:s,sourceSpan:{start:i,end:c}}=r;if(t&&(de(a)||de(s)))return;const l={actualOperation:o,expectedOperation:`${o}=`};e.report(v({loc:{start:n.getLocFromIndex(i),end:n.getLocFromIndex(c)},messageId:"eqeqeq",data:l},me(a)||me(s)?{fix:e=>le({node:r,left:a,right:s,start:i,end:c,fixer:e})}:{suggest:[{messageId:"suggestStrictEquality",fix:e=>le({node:r,left:a,right:s,start:i,end:c,fixer:e}),data:l}]}))}}}});function ce({span:{start:e,end:t}}){return t-e}const le=({node:e,left:t,right:n,start:r,end:a,fixer:o})=>{var s;const{source:i}=null!=(s=oe(e,ue))?s:{};return i?o.insertTextAfterRange([r+ce(t)+1,a-ce(n)-1],"="):null};function ue(e){return e instanceof n.ASTWithSource}function pe(e){return e instanceof n.LiteralPrimitive}function me(e){return pe(e)&&"string"==typeof e.value&&(t=e.value,!(!Number.isNaN(Number.parseFloat(String(t)))&&Number.isFinite(Number(t))));var t}function de(e){return pe(e)&&null==e.value}const ge=/[a-z]/i,fe=new Set(["charset","class","color","colspan","fill","formControlName","height","href","id","lang","ngClass","routerLink","src","stroke","stroke-width","style","svgIcon","tabindex","target","type","viewBox","width","xmlns"]),ye={checkAttributes:!0,checkId:!0,checkText:!0,ignoreAttributes:[...fe]};var Se=l({name:"i18n",meta:{type:"suggestion",docs:{description:"Helps to ensure following best practices for i18n. Checks for missing i18n attributes on elements and non-ignored attributes containing text. Can also highlight tags that do not use custom ID (@@) feature. ",category:"Best Practices",recommended:!1,suggestion:!0},fixable:"code",schema:[{type:"object",properties:{boundTextAllowedPattern:{type:"string"},checkId:{type:"boolean",default:ye.checkId},checkText:{type:"boolean",default:ye.checkText},checkAttributes:{type:"boolean",default:ye.checkAttributes},ignoreAttributes:{type:"array",items:{type:"string"},default:[...fe]},ignoreTags:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{i18nAttribute:'Attribute "{{attributeName}}" has no corresponding i18n attribute. See more at https://angular.io/guide/i18n#translate-attributes',i18nId:"Missing custom message identifier. See more at https://angular.io/guide/i18n#use-a-custom-id-with-a-description",i18nIdOnAttribute:'Missing custom message identifier on attribute "{{attributeName}}". See more at https://angular.io/guide/i18n#use-a-custom-id-with-a-description',i18nSuggestIgnore:'Add the attribute name "{{attributeName}}" to the `ignoreAttributes` option in the eslint config',i18nText:"Each element containing text node should have an i18n attribute. See more at https://angular.io/guide/i18n"}},defaultOptions:[ye],create(e,[{boundTextAllowedPattern:t,checkAttributes:r,checkId:a,checkText:o,ignoreAttributes:s,ignoreTags:i}]){const c=u(e),l=e.getSourceCode(),p=RegExp(null!=t?t:ge),m=new Set([...fe,...null!=s?s:[]]),d=new Set(i);function g(e){return e.customId}function f(e){return e instanceof n.TmplAstText&&/\S/.test(e.value)||e instanceof n.TmplAstBoundText&&e.value instanceof n.ASTWithSource&&e.value.ast instanceof n.Interpolation&&p.test(e.value.ast.strings.join("").trim())}function y(e,t,n){return m.has(t)||m.has(`${e}[${t}]`)||0===n.trim().length||"true"===n||"false"===n}function S({attributes:t,children:s,i18n:i,parent:u,sourceSpan:p},m){const d=c.convertNodeSourceSpanToLoc(p);for(const{i18n:n,name:o,value:s}of t)n?a&&!g(n)&&e.report({messageId:"i18nIdOnAttribute",loc:d,data:{attributeName:o}}):r&&!y(m,o,s)&&e.report({messageId:"i18nAttribute",loc:d,data:{attributeName:o},fix:e=>{const t=l.getIndexFromLoc(d.start)+1+m.length;return e.replaceTextRange([t,t],` i18n-${o}`)},suggest:[{messageId:"i18nSuggestIgnore",data:{attributeName:o},fix:e=>e.insertTextBeforeRange([0,0],"")}]});i?a&&!function(e,t){return!((e instanceof n.TmplAstElement||e instanceof n.TmplAstTemplate)&&(null==e||!e.i18n)&&!g(t))}(u,i)&&e.report({messageId:"i18nId",loc:d}):o&&s.some(f)&&e.report({messageId:"i18nText",loc:d})}return{Element(e){d.has(e.name)||S(e,e.name)},Template(e){S(e,e.tagName)}}}}),Te=l({name:"mouse-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the Mouse Events mouseover and mouseout are accompanied with Key Events focus and blur.",category:"Best Practices",recommended:!1},schema:[],messages:{mouseOverEventHasFocusEvent:"mouseover must be accompanied by focus event for accessibility.",mouseOutEventHasBlurEvent:"mouseout must be accompanied by blur event for accessibility"}},defaultOptions:[],create(e){const t=u(e);return{Element(n){let r=!1,a=!1,o=!1,s=!1;for(const e of n.outputs)r="mouseover"===e.name,a="mouseout"===e.name,o="focus"===e.name,s="blur"===e.name;if(!r&&!a)return;const i=t.convertNodeSourceSpanToLoc(n.sourceSpan);r&&!o&&e.report({loc:i,messageId:"mouseOverEventHasFocusEvent"}),a&&!s&&e.report({loc:i,messageId:"mouseOutEventHasBlurEvent"})}}}}),be=l({name:"no-any",meta:{type:"suggestion",docs:{description:'The use of "$any" nullifies the compile-time benefits of Angular\'s type system',category:"Best Practices",recommended:!1,suggestion:!0},schema:[],messages:{noAny:'Avoid using "$any" in templates',suggestRemoveAny:"Remove $any"}},defaultOptions:[],create(e){p(e);const t=e.getSourceCode();return{'MethodCall[name="$any"]:not([receiver.expression]):not([receiver.name])'({nameSpan:n,sourceSpan:{end:r,start:a}}){e.report({messageId:"noAny",loc:{start:t.getLocFromIndex(a),end:t.getLocFromIndex(r)},suggest:[{messageId:"suggestRemoveAny",fix:e=>[e.removeRange([n.start,n.end+1]),e.removeRange([r-1,r])]}]})}}}}),xe=l({name:"no-autofocus",meta:{type:"suggestion",docs:{description:"Ensures that the `autofocus` attribute is not used",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{noAutofocus:"The `autofocus` attribute should not be used, as it reduces usability and accessibility for users"}},defaultOptions:[],create(e){const t=u(e);return{[`Element[name=${_([...k()])}] > :matches(BoundAttribute, TextAttribute)[name="autofocus"]`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noAutofocus",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),he=l({name:"no-call-expression",meta:{type:"suggestion",docs:{description:"Disallows calling expressions in templates, except for output handlers",category:"Best Practices",recommended:!1},schema:[],messages:{noCallExpression:"Avoid calling expressions in templates"}},defaultOptions:[],create(e){p(e);const t=e.getSourceCode();return{'MethodCall[name!="$any"], SafeMethodCall'(n){if(oe(n,ve))return;const{sourceSpan:{start:r,end:a}}=n;e.report({messageId:"noCallExpression",loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(a)}})}}}});function ve(e){return e instanceof n.TmplAstBoundEvent}var Ee=l({name:"no-distracting-elements",meta:{type:"suggestion",docs:{description:"Enforces that no distracting elements are used",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{noDistractingElements:"Do not use <{{element}}> elements as they can create visual accessibility issues and are deprecated"}},defaultOptions:[],create(e){const t=u(e);return{"Element[name=/^(blink|marquee)$/]"({name:n,sourceSpan:r}){const a=t.convertNodeSourceSpanToLoc(r);e.report({loc:a,messageId:"noDistractingElements",data:{element:n},fix:e=>e.removeRange([r.start.offset,r.end.offset])})}}}});const Ae={allowTwoWayDataBinding:!0};var we=l({name:"no-duplicate-attributes",meta:{type:"problem",docs:{description:"Ensures that there are no duplicate input properties or output event listeners",category:"Possible Errors",recommended:!1,suggestion:!0},schema:[{type:"object",properties:{allowTwoWayDataBinding:{type:"boolean",default:Ae.allowTwoWayDataBinding,description:`\nWhether or not two-way data binding is allowed as an exception to the rule.\n\nDefault is: \`${Ae.allowTwoWayDataBinding}\``.trim()}},additionalProperties:!1}],messages:{noDuplicateAttributes:"Duplicate attribute `{{attributeName}}`",suggestRemoveAttribute:"Remove attribute `{{attributeName}}`"}},defaultOptions:[Ae],create(e,[{allowTwoWayDataBinding:t}]){const n=u(e);return{Element({inputs:r,outputs:a,attributes:o}){[...Ce([...r,...o]),...Ce(t?a.filter(e=>!r.some(t=>t.sourceSpan.start===e.sourceSpan.start&&t.sourceSpan.end===e.sourceSpan.end)):a)].forEach(t=>{const r=n.convertNodeSourceSpanToLoc(t.sourceSpan),a={attributeName:Ie(t)};e.report({messageId:"noDuplicateAttributes",loc:r,data:a,suggest:[{messageId:"suggestRemoveAttribute",fix:e=>e.removeRange([r.start.column,r.end.column+1]),data:a}]})})}}}});function Ie(e){if("type"in e)if("BoundAttribute"===e.type)switch(e.__originalType){case 2:return`class.${e.name}`;case 3:return`style.${e.name}${e.unit?"."+e.unit:""}`;case 4:return`@${e.name}`}else if("BoundEvent"===e.type){if(1===e.__originalType)return`@${e.name}${e.phase?"."+e.phase:""}`;if(e.target)return`${e.target}:${e.name}`}return e.name}function Ce(e){return e.filter(t=>e.some(e=>e!==t&&Ie(e)===Ie(t)))}var Pe=l({name:"no-negated-async",meta:{type:"suggestion",docs:{description:"Ensures that async pipe results are not negated",category:"Best Practices",recommended:"error",suggestion:!0},schema:[],messages:{noNegatedAsync:"Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead",suggestFalseComparison:"Compare with `false`",suggestNullComparison:"Compare with `null`",suggestUndefinedComparison:"Compare with `undefined`"}},defaultOptions:[],create(e){p(e);const t=e.getSourceCode();return{':not(PrefixNot) > PrefixNot > BindingPipe[name="async"]'({parent:{sourceSpan:{end:n,start:r}}}){e.report({messageId:"noNegatedAsync",loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(n)},suggest:[{messageId:"suggestFalseComparison",textToInsert:" === false"},{messageId:"suggestNullComparison",textToInsert:" === null"},{messageId:"suggestUndefinedComparison",textToInsert:" === undefined"}].map(({messageId:e,textToInsert:t})=>({messageId:e,fix:e=>[e.removeRange([r,r+1]),e.insertTextAfterRange([n,n],t)]}))})}}}}),Ne=l({name:"no-positive-tabindex",meta:{type:"suggestion",docs:{description:"Ensures that the `tabindex` attribute is not positive",category:"Best Practices",recommended:!1},schema:[],messages:{noPositiveTabindex:"The `tabindex` attribute should not be positive",suggestNonNegativeTabindex:'Use `tabindex="{{tabindex}}"`'}},defaultOptions:[],create(e){const t=u(e);return{[`Element[name=${_([...k()])}] > BoundAttribute[name="tabindex"][value.ast.value>0], TextAttribute[name="tabindex"][value>0]`]({valueSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noPositiveTabindex",suggest:["-1","0"].map(e=>({messageId:"suggestNonNegativeTabindex",fix:t=>t.replaceTextRange([n.start.offset,n.end.offset],e),data:{tabindex:e}}))})}}}}),Oe=l({name:"use-track-by-function",meta:{type:"suggestion",docs:{description:"Ensures trackBy function is used",category:"Best Practices",recommended:!1},schema:[],messages:{useTrackByFunction:"Missing trackBy function in ngFor directive"}},defaultOptions:[],create(e){const t=u(e);return{'BoundAttribute.inputs[name="ngForOf"]'({parent:{inputs:n},sourceSpan:r}){if(n.some(Be))return;const a=t.convertNodeSourceSpanToLoc(r);e.report({messageId:"useTrackByFunction",loc:a})},'BoundAttribute.templateAttrs[name="ngForOf"]'({parent:{templateAttrs:n}}){if(n.some(Be))return;const{start:r}=t.convertNodeSourceSpanToLoc(n[0].sourceSpan),{end:a}=t.convertNodeSourceSpanToLoc(n[n.length-1].sourceSpan),o={start:v({},r,{column:r.column-1}),end:v({},a,{column:a.column+1})};e.report({messageId:"useTrackByFunction",loc:o})}}}});function Be(e){return e instanceof n.TmplAstBoundAttribute&&"ngForTrackBy"===e.name}module.exports={configs:{all:{extends:"./configs/base.json",rules:{"@angular-eslint/template/accessibility-alt-text":"error","@angular-eslint/template/accessibility-elements-content":"error","@angular-eslint/template/accessibility-label-for":"error","@angular-eslint/template/accessibility-label-has-associated-control":"error","@angular-eslint/template/accessibility-table-scope":"error","@angular-eslint/template/accessibility-valid-aria":"error","@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/click-events-have-key-events":"error","@angular-eslint/template/conditional-complexity":"error","@angular-eslint/template/cyclomatic-complexity":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/i18n":"error","@angular-eslint/template/mouse-events-have-key-events":"error","@angular-eslint/template/no-any":"error","@angular-eslint/template/no-autofocus":"error","@angular-eslint/template/no-call-expression":"error","@angular-eslint/template/no-distracting-elements":"error","@angular-eslint/template/no-duplicate-attributes":"error","@angular-eslint/template/no-negated-async":"error","@angular-eslint/template/no-positive-tabindex":"error","@angular-eslint/template/use-track-by-function":"error"}},base:{parser:"@angular-eslint/template-parser",plugins:["@angular-eslint/template"]},recommended:{extends:"./configs/base.json",rules:{"@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/no-negated-async":"error"}},"process-inline-templates":{parser:"@typescript-eslint/parser",parserOptions:{ecmaVersion:2020,sourceType:"module"},plugins:["@angular-eslint/template"],processor:"@angular-eslint/template/extract-inline-html"}},processors:c,rules:{"accessibility-alt-text":g,"accessibility-elements-content":h,"accessibility-label-for":P,[N]:D,"accessibility-table-scope":F,"accessibility-valid-aria":K,"banana-in-box":q,"conditional-complexity":Y,"click-events-have-key-events":W,"cyclomatic-complexity":Q,eqeqeq:ie,i18n:Se,"mouse-events-have-key-events":Te,"no-any":be,"no-autofocus":xe,"no-call-expression":he,"no-distracting-elements":Ee,"no-duplicate-attributes":we,"no-negated-async":Pe,"no-positive-tabindex":Ne,"use-track-by-function":Oe}};
|
|
1
|
+
var e=require("typescript"),t=require("@typescript-eslint/experimental-utils/dist/eslint-utils"),n=require("@angular/compiler"),r=require("aria-query");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e);function s(e,t){const n=(e=e.replace(/\r\n/g,"\n")).indexOf(t);return[n,n+t.length]}const u=new Map;var i={"extract-inline-html":{preprocess:function(e,t){const n=[e];if(!function(e,t){return!![".component.ts",".page.ts",".dialog.ts",".modal.ts",".popover.ts",".bottomsheet.ts",".snackbar.ts"].some(e=>t.endsWith(e))||!(!e.includes("Component")||!e.includes("@angular/core"))}(e,t))return n;try{const r=o.default.createSourceFile(t,e,o.default.ScriptTarget.Latest,!0),a=r.statements.filter(e=>o.default.isClassDeclaration(e));if(!a||!a.length)return n;const i=[];for(const e of a)if(e.decorators)for(const t of e.decorators)o.default.isCallExpression(t.expression)&&o.default.isIdentifier(t.expression.expression)&&"Component"===t.expression.expression.text&&i.push(t);if(!i||!i.length)return n;const c=[e];let l=0;for(const t of i){if(!o.default.isDecorator(t)||!o.default.isCallExpression(t.expression)||1!==t.expression.arguments.length)continue;const n=t.expression.arguments[0];if(!o.default.isObjectLiteralExpression(n))continue;const a=n.properties.find(e=>e&&e.name&&"template"===e.name.getText());if(n.properties.find(e=>e&&e.name&&"templateUrl"===e.name.getText())||!a)continue;if(!o.default.isPropertyAssignment(a)||!o.default.isStringLiteralLike(a.initializer))continue;const i=a.initializer.text,p=s(e,i),m=`inline-template-${++l}.component.html`;u.set(m,{range:p,lineAndCharacter:{start:r.getLineAndCharacterOfPosition(p[0]),end:r.getLineAndCharacterOfPosition(p[1])}}),c.push({text:i,filename:m})}return c}catch(e){return console.log(e),console.error("preprocess: ERROR could not parse @Component() metadata",t),n}},postprocess:function(e,t){const n=e[0];if(1===e.length)return n;const r=e.slice(1);return[...n,...[].concat(...r.map((e,t)=>{const n=`inline-template-${++t}.component.html`,r=u.get(n);return r?e.map(e=>{if(e.line=e.line+r.lineAndCharacter.start.line,e.endLine=e.endLine+r.lineAndCharacter.start.line,e.fix){const t=r.range[0];e.fix.range=[t+e.fix.range[0],t+e.fix.range[1]]}return e}):[]}))]},supportsAutofix:!0}};const c=(l=e=>`https://github.com/angular-eslint/angular-eslint/blob/master/packages/eslint-plugin/docs/rules/${e}.md`,function({name:e,meta:n,defaultOptions:r,create:a}){return{meta:Object.assign(Object.assign({},n),{docs:Object.assign(Object.assign({},n.docs),{url:l(e)})}),defaultOptions:r,create(e){const n=t.applyDefault(r,e.options);return a(e,n)}}});var l;function p(e){return m(e),e.parserServices}function m(e){var t,n;if(null==(t=e.parserServices)||!t.convertNodeSourceSpanToLoc||null==(n=e.parserServices)||!n.convertElementSourceSpanToLoc)throw new Error("You have used a rule which requires '@angular-eslint/template-parser' to be used as the 'parser' in your ESLint config.")}const d=Symbol("PROPERTY_READ");function g(e){var t;const{details:r}=null!=(t=e.keySpan)?t:{};return r?e instanceof n.TmplAstBoundEvent?function({keySpan:{details:e},name:t}){return t===`${e}Change`}(e)?e.name:r:r.replace("attr.",""):e.name}function f({attributes:e,inputs:t},r){const a=[...e,...t].find(e=>g(e)===r);if("string"==typeof(null==a?void 0:a.value))return a.value;if(!((null==a?void 0:a.value)instanceof n.ASTWithSource))return null;if(a.value.ast instanceof n.LiteralArray)return a.value.ast.expressions;if(a.value.ast instanceof n.LiteralMap){const{keys:e,values:t}=a.value.ast;return e.reduce((e,n,r)=>e.set(n.key,t[r]),new Map)}return a.value.ast instanceof n.LiteralPrimitive?a.value.ast.value:d}var y=c({name:"accessibility-alt-text",meta:{type:"suggestion",docs:{description:"Enforces alternate text for elements which require the alt, aria-label, aria-labelledby attributes.",category:"Best Practices",recommended:!1},schema:[],messages:{accessibilityAltText:"<{{element}}/> element must have a text alternative."}},defaultOptions:[],create(e){const t=p(e);return{"Element[name=/^(img|area|object|input)$/]"(n){if(!function(e){return"img"===e.name?function(e){return e.attributes.some(({name:e})=>T(e))||e.inputs.some(({name:e})=>T(e))}(e):"object"===e.name?function(e){let t=!1,n=!1;for(const r of e.attributes)t="title"===r.name,n=A(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r="title"===t.name,a=A(t.name);return!(!r&&!a)||e.children.length>0&&!!e.children[0].value}(e):"area"===e.name?S(e):function(e){return"image"!==f(e,"type")||S(e)}(e)}(n)){const r=t.convertElementSourceSpanToLoc(e,n);e.report({loc:r,messageId:"accessibilityAltText",data:{element:n.name}})}}}}});function S(e){let t=!1,n=!1;for(const r of e.attributes)t=T(r.name),n=A(r.name);if(t||n)return!0;let r=!1,a=!1;for(const t of e.inputs)r=T(t.name),a=A(t.name);return r||a}function A(e){return"aria-label"===e||"aria-labelledby"===e}function T(e){return"alt"===e}var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){var t={exports:{}};return e(t,t.exports),t.exports}var x=E(function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,(n=t.AST_NODE_TYPES||(t.AST_NODE_TYPES={})).ArrayExpression="ArrayExpression",n.ArrayPattern="ArrayPattern",n.ArrowFunctionExpression="ArrowFunctionExpression",n.AssignmentExpression="AssignmentExpression",n.AssignmentPattern="AssignmentPattern",n.AwaitExpression="AwaitExpression",n.BinaryExpression="BinaryExpression",n.BlockStatement="BlockStatement",n.BreakStatement="BreakStatement",n.CallExpression="CallExpression",n.CatchClause="CatchClause",n.ChainExpression="ChainExpression",n.ClassBody="ClassBody",n.ClassDeclaration="ClassDeclaration",n.ClassExpression="ClassExpression",n.ClassProperty="ClassProperty",n.ConditionalExpression="ConditionalExpression",n.ContinueStatement="ContinueStatement",n.DebuggerStatement="DebuggerStatement",n.Decorator="Decorator",n.DoWhileStatement="DoWhileStatement",n.EmptyStatement="EmptyStatement",n.ExportAllDeclaration="ExportAllDeclaration",n.ExportDefaultDeclaration="ExportDefaultDeclaration",n.ExportNamedDeclaration="ExportNamedDeclaration",n.ExportSpecifier="ExportSpecifier",n.ExpressionStatement="ExpressionStatement",n.ForInStatement="ForInStatement",n.ForOfStatement="ForOfStatement",n.ForStatement="ForStatement",n.FunctionDeclaration="FunctionDeclaration",n.FunctionExpression="FunctionExpression",n.Identifier="Identifier",n.IfStatement="IfStatement",n.ImportDeclaration="ImportDeclaration",n.ImportDefaultSpecifier="ImportDefaultSpecifier",n.ImportExpression="ImportExpression",n.ImportNamespaceSpecifier="ImportNamespaceSpecifier",n.ImportSpecifier="ImportSpecifier",n.JSXAttribute="JSXAttribute",n.JSXClosingElement="JSXClosingElement",n.JSXClosingFragment="JSXClosingFragment",n.JSXElement="JSXElement",n.JSXEmptyExpression="JSXEmptyExpression",n.JSXExpressionContainer="JSXExpressionContainer",n.JSXFragment="JSXFragment",n.JSXIdentifier="JSXIdentifier",n.JSXMemberExpression="JSXMemberExpression",n.JSXNamespacedName="JSXNamespacedName",n.JSXOpeningElement="JSXOpeningElement",n.JSXOpeningFragment="JSXOpeningFragment",n.JSXSpreadAttribute="JSXSpreadAttribute",n.JSXSpreadChild="JSXSpreadChild",n.JSXText="JSXText",n.LabeledStatement="LabeledStatement",n.Literal="Literal",n.LogicalExpression="LogicalExpression",n.MemberExpression="MemberExpression",n.MetaProperty="MetaProperty",n.MethodDefinition="MethodDefinition",n.NewExpression="NewExpression",n.ObjectExpression="ObjectExpression",n.ObjectPattern="ObjectPattern",n.Program="Program",n.Property="Property",n.RestElement="RestElement",n.ReturnStatement="ReturnStatement",n.SequenceExpression="SequenceExpression",n.SpreadElement="SpreadElement",n.Super="Super",n.SwitchCase="SwitchCase",n.SwitchStatement="SwitchStatement",n.TaggedTemplateExpression="TaggedTemplateExpression",n.TemplateElement="TemplateElement",n.TemplateLiteral="TemplateLiteral",n.ThisExpression="ThisExpression",n.ThrowStatement="ThrowStatement",n.TryStatement="TryStatement",n.UnaryExpression="UnaryExpression",n.UpdateExpression="UpdateExpression",n.VariableDeclaration="VariableDeclaration",n.VariableDeclarator="VariableDeclarator",n.WhileStatement="WhileStatement",n.WithStatement="WithStatement",n.YieldExpression="YieldExpression",n.TSAbstractClassProperty="TSAbstractClassProperty",n.TSAbstractKeyword="TSAbstractKeyword",n.TSAbstractMethodDefinition="TSAbstractMethodDefinition",n.TSAnyKeyword="TSAnyKeyword",n.TSArrayType="TSArrayType",n.TSAsExpression="TSAsExpression",n.TSAsyncKeyword="TSAsyncKeyword",n.TSBigIntKeyword="TSBigIntKeyword",n.TSBooleanKeyword="TSBooleanKeyword",n.TSCallSignatureDeclaration="TSCallSignatureDeclaration",n.TSClassImplements="TSClassImplements",n.TSConditionalType="TSConditionalType",n.TSConstructorType="TSConstructorType",n.TSConstructSignatureDeclaration="TSConstructSignatureDeclaration",n.TSDeclareFunction="TSDeclareFunction",n.TSDeclareKeyword="TSDeclareKeyword",n.TSEmptyBodyFunctionExpression="TSEmptyBodyFunctionExpression",n.TSEnumDeclaration="TSEnumDeclaration",n.TSEnumMember="TSEnumMember",n.TSExportAssignment="TSExportAssignment",n.TSExportKeyword="TSExportKeyword",n.TSExternalModuleReference="TSExternalModuleReference",n.TSFunctionType="TSFunctionType",n.TSImportEqualsDeclaration="TSImportEqualsDeclaration",n.TSImportType="TSImportType",n.TSIndexedAccessType="TSIndexedAccessType",n.TSIndexSignature="TSIndexSignature",n.TSInferType="TSInferType",n.TSInterfaceBody="TSInterfaceBody",n.TSInterfaceDeclaration="TSInterfaceDeclaration",n.TSInterfaceHeritage="TSInterfaceHeritage",n.TSIntersectionType="TSIntersectionType",n.TSIntrinsicKeyword="TSIntrinsicKeyword",n.TSLiteralType="TSLiteralType",n.TSMappedType="TSMappedType",n.TSMethodSignature="TSMethodSignature",n.TSModuleBlock="TSModuleBlock",n.TSModuleDeclaration="TSModuleDeclaration",n.TSNamedTupleMember="TSNamedTupleMember",n.TSNamespaceExportDeclaration="TSNamespaceExportDeclaration",n.TSNeverKeyword="TSNeverKeyword",n.TSNonNullExpression="TSNonNullExpression",n.TSNullKeyword="TSNullKeyword",n.TSNumberKeyword="TSNumberKeyword",n.TSObjectKeyword="TSObjectKeyword",n.TSOptionalType="TSOptionalType",n.TSParameterProperty="TSParameterProperty",n.TSParenthesizedType="TSParenthesizedType",n.TSPrivateKeyword="TSPrivateKeyword",n.TSPropertySignature="TSPropertySignature",n.TSProtectedKeyword="TSProtectedKeyword",n.TSPublicKeyword="TSPublicKeyword",n.TSQualifiedName="TSQualifiedName",n.TSReadonlyKeyword="TSReadonlyKeyword",n.TSRestType="TSRestType",n.TSStaticKeyword="TSStaticKeyword",n.TSStringKeyword="TSStringKeyword",n.TSSymbolKeyword="TSSymbolKeyword",n.TSTemplateLiteralType="TSTemplateLiteralType",n.TSThisType="TSThisType",n.TSTupleType="TSTupleType",n.TSTypeAliasDeclaration="TSTypeAliasDeclaration",n.TSTypeAnnotation="TSTypeAnnotation",n.TSTypeAssertion="TSTypeAssertion",n.TSTypeLiteral="TSTypeLiteral",n.TSTypeOperator="TSTypeOperator",n.TSTypeParameter="TSTypeParameter",n.TSTypeParameterDeclaration="TSTypeParameterDeclaration",n.TSTypeParameterInstantiation="TSTypeParameterInstantiation",n.TSTypePredicate="TSTypePredicate",n.TSTypeQuery="TSTypeQuery",n.TSTypeReference="TSTypeReference",n.TSUndefinedKeyword="TSUndefinedKeyword",n.TSUnionType="TSUnionType",n.TSUnknownKeyword="TSUnknownKeyword",n.TSVoidKeyword="TSVoidKeyword",(r=t.AST_TOKEN_TYPES||(t.AST_TOKEN_TYPES={})).Boolean="Boolean",r.Identifier="Identifier",r.JSXIdentifier="JSXIdentifier",r.JSXText="JSXText",r.Keyword="Keyword",r.Null="Null",r.Numeric="Numeric",r.Punctuator="Punctuator",r.RegularExpression="RegularExpression",r.String="String",r.Template="Template",r.Block="Block",r.Line="Line"});Object.defineProperty(exports,"__esModule",{value:!0});var C={__proto__:null};Object.defineProperty(exports,"__esModule",{value:!0});var h={__proto__:null},F=E(function(e,t){var n=b&&b.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=b&&b.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=b&&b.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)"default"!==a&&Object.prototype.hasOwnProperty.call(e,a)&&n(t,e,a);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TSESTree=void 0,t.TSESTree=a(x)}),B=E(function(e,t){var n=b&&b.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=b&&b.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.AST_TOKEN_TYPES=t.AST_NODE_TYPES=void 0,Object.defineProperty(t,"AST_NODE_TYPES",{enumerable:!0,get:function(){return x.AST_NODE_TYPES}});var a=x;Object.defineProperty(t,"AST_TOKEN_TYPES",{enumerable:!0,get:function(){return a.AST_TOKEN_TYPES}}),r(C,t),r(h,t),r(F,t)});function v({parent:e},t){for(;e&&e.type!==B.AST_NODE_TYPES.Program;){if(t(e))return e;e=e.parent}return null}function D(e){if(v(e,w)||function(e){const t=f(e,"style");if("string"!=typeof t)return!1;const n=t.replace(/[\s'"]/g,"");return n.includes("display:none")||n.includes("visibility:hidden")}(e)||function(e){const t=f(e,"ngStyle");return t instanceof Map&&("none"===t.get("display")||"hidden"===t.get("visibility"))}(e)||function(e){return"none"===f(e,"style.display")||"true"===String(f(e,"style.display.none"))||"hidden"===f(e,"style.visibility")||"true"===String(f(e,"style.visibility.hidden"))}(e)||I(e,"aria-hidden")||I(e,"hidden"))return!0;if("INPUT"!==e.name.toUpperCase())return!1;const t=f(e,"type");return"string"==typeof t&&"HIDDEN"===t.toUpperCase()}function I(e,t){const n=f(e,t);return""===n||"true"===String(n)}function w(e){return e instanceof n.TmplAstElement&&D(e)}const N=new Set(["aria-label","innerHtml","innerHTML","innerText","outerHTML","title"]);var P=c({name:"accessibility-elements-content",meta:{type:"suggestion",docs:{description:"Ensures that the heading, anchor and button elements have content in it",category:"Best Practices",recommended:!1},schema:[],messages:{accessibilityElementsContent:"<{{element}}> should have content"}},defaultOptions:[],create(e){const t=p(e);return{"Element[name=/^(a|button|h1|h2|h3|h4|h5|h6)$/][children.length=0]"(n){if(D(n))return;const{attributes:r,inputs:a,name:o,sourceSpan:s}=n;if([...r,...a].map(({name:e})=>e).some(e=>N.has(e)))return;const u=t.convertNodeSourceSpanToLoc(s);e.report({loc:u,messageId:"accessibilityElementsContent",data:{element:o}})}}}});function O(){return(O=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(e,t){return function e({children:r}){return r.some(r=>r instanceof n.TmplAstElement&&(r.name===t||e(r)))}(e)}const L={items:{type:"string"},type:"array",uniqueItems:!0},_=["button","input","meter","output","progress","select","textarea"],R=["for","htmlFor"],K=["label"];var j=c({name:"accessibility-label-for",meta:{deprecated:!0,replacedBy:["accessibility-label-has-associated-control"],type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",category:"Best Practices",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:O({},L),labelAttributes:O({},L),labelComponents:O({},L)},type:"object"}],messages:{accessibilityLabelFor:"A label element/component must be associated with a form element"}},defaultOptions:[{controlComponents:_,labelAttributes:R,labelComponents:K}],create(e,[t]){const n=p(e),{controlComponents:r,labelAttributes:a,labelComponents:o}=function({controlComponents:e,labelAttributes:t,labelComponents:n}){return{controlComponents:new Set([..._,...null!=e?e:[]]),labelAttributes:new Set([...R,...null!=t?t:[]]),labelComponents:new Set([...K,...null!=n?n:[]])}}(t);var s;return{[`Element[name=${s=[...o],RegExp(`^(${s.join("|")})$`)}]`](t){const o=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if([...a].some(e=>o.has(e))||function(e,t){return Boolean([...e].some(e=>k(t,e)))}(r,t))return;const s=n.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:s,messageId:"accessibilityLabelFor"})}}}});const M="accessibility-label-has-associated-control",$=["input","meter","output","progress","select","textarea"],q=[{inputs:["for","htmlFor"],selector:"label"}];var X=c({name:M,meta:{type:"suggestion",docs:{description:"Ensures that a label element/component is associated with a form element",category:"Best Practices",recommended:!1},schema:[{additionalProperties:!1,properties:{controlComponents:{items:{type:"string"},type:"array",uniqueItems:!0},labelComponents:{items:{additionalProperties:!1,properties:{inputs:{items:{type:"string"},type:"array",uniqueItems:!0},selector:{type:"string"}},required:["selector"],type:"object"},type:"array",uniqueItems:!0}},type:"object"}],messages:{accessibilityLabelHasAssociatedControl:"A label component must be associated with a form element"}},defaultOptions:[{controlComponents:$,labelComponents:q}],create(e,[{controlComponents:t,labelComponents:n}]){const r=p(e),a=new Set([...$,...null!=t?t:[]]),o=[...q,...null!=n?n:[]],s=o.map(({selector:e})=>e);return{[`Element[name=${RegExp(`^(${s.join("|")})$`)}]`](t){var n;const s=o.find(({selector:e})=>e===t.name);if(!s)return;const u=new Set([...t.attributes,...t.inputs].map(({name:e})=>e));if((null==(n=s.inputs)?void 0:n.some(e=>u.has(e)))||function(e,t){return Boolean([...e].some(e=>k(t,e)))}(a,t))return;const i=r.convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:i,messageId:"accessibilityLabelHasAssociatedControl"})}}}});let J=null;function U(){var e;return null!=(e=J)?e:J=new Set(r.dom.keys())}function W(e){return RegExp(`^(${e.join("|")})$`)}var Y=c({name:"accessibility-table-scope",meta:{type:"suggestion",docs:{description:"Ensures that the `scope` attribute is only used on the `<th>` element",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{accessibilityTableScope:"The `scope` attribute should only be on the `<th>` element"}},defaultOptions:[],create(e){const t=p(e);return{[`Element[name=${W([...U()].filter(e=>"th"!==e))}] > :matches(BoundAttribute, TextAttribute)[name='scope']`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"accessibilityTableScope",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),H=c({name:"accessibility-valid-aria",meta:{type:"suggestion",docs:{description:"Ensures that correct ARIA attributes and respective values are used",category:"Best Practices",recommended:!1,suggestion:!0},schema:[],messages:{accessibilityValidAria:"The `{{attribute}}` is an invalid ARIA attribute",accessibilityValidAriaValue:"The `{{attribute}}` has an invalid value. Check the valid values at https://raw.githack.com/w3c/aria/stable/#roles",suggestRemoveInvalidAria:"Remove attribute `{{attribute}}`"}},defaultOptions:[],create(e){const t=p(e);return{[`Element[name=${W([...U()])}] > :matches(BoundAttribute, TextAttribute)[name=/^aria-.+/]`](a){const{name:o,sourceSpan:s}=a,u=r.aria.get(o),i=t.convertNodeSourceSpanToLoc(s);if(!u)return void e.report({loc:i,messageId:"accessibilityValidAria",data:{attribute:o},suggest:[{messageId:"suggestRemoveInvalidAria",data:{attribute:o},fix:e=>e.removeRange([s.start.offset-1,s.end.offset])}]});const c=function(e){return e instanceof n.TmplAstBoundAttribute&&e.value instanceof n.ASTWithSource?e.value.ast:e}(a);(function(e){return!function(e){return e instanceof n.LiteralArray||e instanceof n.LiteralMap}(e)&&!function(e){return e instanceof n.LiteralPrimitive||e instanceof n.TmplAstTextAttribute}(e)})(c)||function({allowundefined:e,type:t,values:n},r){if(e&&z(r))return!0;switch(t){case"boolean":return V(r);case"tristate":return V(r)||z(r);case"id":case"idlist":return!0;case"integer":return a=r,!Number.isNaN(a)&&parseInt(Number(a))==a&&!Number.isNaN(parseInt(a,10));case"number":return function(e){return!Number.isNaN(Number.parseFloat(e))&&Number.isFinite(e)}(r);case"string":return function(e){return"string"==typeof e}(r);case"token":case"tokenlist":{const e=V(r)?JSON.parse(r):r;return Boolean(null==n?void 0:n.includes(e))}}var a}(u,c.value)||e.report({loc:i,messageId:"accessibilityValidAriaValue",data:{attribute:o}})}}}});function V(e){return"boolean"==typeof e||"false"===e||"true"===e}function z(e){return null==e}const Q=/\[(.*)\]/;var Z=c({name:"banana-in-box",meta:{type:"suggestion",docs:{description:"Ensures that the two-way data binding syntax is correct",category:"Best Practices",recommended:"error"},fixable:"code",schema:[],messages:{bananaInBox:"Invalid binding syntax. Use [(expr)] instead"}},defaultOptions:[],create(e){const t=p(e),n=e.getSourceCode();return{BoundEvent({name:r,sourceSpan:a}){const o=r.match(Q);if(!o)return;const s=t.convertNodeSourceSpanToLoc(a);e.report({messageId:"bananaInBox",loc:s,fix:e=>{const[,t]=o,a=`[(${t})]`,u=n.getIndexFromLoc(s.start);return e.replaceTextRange([u,u+r.length+2],a)}})}}}});let G=null,ee=null,te=null;const ne=new Set(["none","presentation"]);var re=c({name:"click-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the click event is accompanied with at least one key event keyup, keydown or keypress.",category:"Best Practices",recommended:!1},schema:[],messages:{clickEventsHaveKeyEvents:"click must be accompanied by either keyup, keydown or keypress event for accessibility."}},defaultOptions:[],create:e=>({Element(t){if(!U().has(t.name))return;if(function(e){const t=f(e,"role");return"string"==typeof t&&ne.has(t)}(t)||D(t)||function(e){return U().has(e.name)&&function(e){function t({attributes:t,name:n}){return e.name===n&&function(e,t){const n=[...t.attributes,...t.inputs];return e.every(e=>n.some(({name:n})=>"a"===t.name&&"routerLink"===n||e.name===n&&(!e.value||e.value===f(t,e.name))))}(null!=t?t:[],e)}return!!function(){if(null===ee){const e=[...r.roles.keys()],t=[...r.elementRoles],n=new Set(e.filter(e=>{const t=r.roles.get(e);return t&&!t.abstract&&"progressbar"!==e&&t.superClass.some(e=>e.includes("widget"))}).concat("toolbar"));ee=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return ee}().some(t)||!function(){if(null===te){const e=[...r.roles.keys()],t=[...r.elementRoles],n=new Set(e.filter(e=>{const t=r.roles.get(e);return t&&!t.abstract&&"toolbar"!==e&&!t.superClass.some(e=>e.includes("widget"))}).concat("progressbar"));te=t.reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return te}().some(t)&&function(){if(null===G){const{AXObjects:e,elementAXObjects:t}=require("axobject-query"),n=new Set(Array.from(e.keys()).filter(t=>"widget"===e.get(t).type));G=[...t].reduce((e,[t,r])=>e.concat([...r].every(e=>n.has(e))?t:[]),[])}return G}().some(t)}(e)}(t))return;let n=!1,a=!1;for(const e of t.outputs)n="click"===e.name,a=e.name.startsWith("keyup")||e.name.startsWith("keydown")||e.name.startsWith("keypress");if(!n||a)return;const o=p(e).convertNodeSourceSpanToLoc(t.sourceSpan);e.report({loc:o,messageId:"clickEventsHaveKeyEvents"})}})}),ae=c({name:"conditional-complexity",meta:{type:"suggestion",docs:{description:"The conditional complexity should not exceed a rational limit",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{minimum:1,type:"number"}},additionalProperties:!1}],messages:{"conditionalСomplexity":"The conditional complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){m(e);const r=e.getSourceCode();return{BoundAttribute(a){if(!a.value.source)return;const o=ue(oe((se||(se=new n.Parser(new n.Lexer))).parseBinding(a.value.source,"",0).ast));if(o<=t)return;const{sourceSpan:{start:s,end:u}}=a.value;e.report({loc:{start:r.getLocFromIndex(s),end:r.getLocFromIndex(u)},messageId:"conditionalСomplexity",data:{maxComplexity:t,totalComplexity:o}})},Interpolation({expressions:n}){for(const a of n){const n=ue(a);if(n<=t)continue;const{sourceSpan:{start:o,end:s}}=a;e.report({loc:{start:r.getLocFromIndex(o),end:r.getLocFromIndex(s)},messageId:"conditionalСomplexity",data:{maxComplexity:t,totalComplexity:n}})}}}}});function oe(e){return e instanceof n.BindingPipe?e.exp:e}let se=null;function ue(e){const t=oe(e);if(!(t instanceof n.Binary||t instanceof n.Conditional))return 0;let r=1;return t instanceof n.Binary&&(t.left instanceof n.Binary&&(r+=ue(t.left)),t.right instanceof n.Binary&&(r+=ue(t.right))),t instanceof n.Conditional&&(r+=ue(t.condition)+ue(t.trueExp)+ue(t.falseExp)),r}var ie=c({name:"cyclomatic-complexity",meta:{type:"suggestion",docs:{description:"Checks cyclomatic complexity against a specified limit. It is a quantitative measure of the number of linearly independent paths through a program's source code",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{maxComplexity:{type:"number",minimum:1}},additionalProperties:!1}],messages:{cyclomaticComplexity:"The cyclomatic complexity {{totalComplexity}} exceeds the defined limit {{maxComplexity}}"}},defaultOptions:[{maxComplexity:5}],create(e,[{maxComplexity:t}]){let n=0;const r=p(e);return{'BoundAttribute[name=/^(ngForOf|ngIf|ngSwitchCase)$/], TextAttribute[name="ngSwitchDefault"]'({sourceSpan:a}){if(n+=1,n<=t)return;const o=r.convertNodeSourceSpanToLoc(a);e.report({messageId:"cyclomaticComplexity",loc:o,data:{maxComplexity:t,totalComplexity:n}})}}}});const ce={allowNullOrUndefined:!1};var le=c({name:"eqeqeq",meta:{type:"suggestion",docs:{description:"Requires `===` and `!==` in place of `==` and `!=`",category:"Best Practices",recommended:"error",suggestion:!0},fixable:"code",schema:[{type:"object",properties:{allowNullOrUndefined:{type:"boolean",default:ce.allowNullOrUndefined}},additionalProperties:!1}],messages:{eqeqeq:"Expected `{{expectedOperation}}` but received `{{actualOperation}}`",suggestStrictEquality:"Replace `{{expectedOperation}}` with `{{actualOperation}}`"}},defaultOptions:[ce],create(e,[{allowNullOrUndefined:t}]){m(e);const n=e.getSourceCode();return{"Binary[operation=/^(==|!=)$/]"(r){const{left:a,operation:o,right:s,sourceSpan:{start:u,end:i}}=r;if(t&&(ye(a)||ye(s)))return;const c={actualOperation:o,expectedOperation:`${o}=`};e.report(O({loc:{start:n.getLocFromIndex(u),end:n.getLocFromIndex(i)},messageId:"eqeqeq",data:c},fe(a)||fe(s)?{fix:e=>me({node:r,left:a,right:s,start:u,end:i,fixer:e})}:{suggest:[{messageId:"suggestStrictEquality",fix:e=>me({node:r,left:a,right:s,start:u,end:i,fixer:e}),data:c}]}))}}}});function pe({span:{start:e,end:t}}){return t-e}const me=({node:e,left:t,right:n,start:r,end:a,fixer:o})=>{var s;const{source:u}=null!=(s=v(e,de))?s:{};return u?o.insertTextAfterRange([r+pe(t)+1,a-pe(n)-1],"="):null};function de(e){return e instanceof n.ASTWithSource}function ge(e){return e instanceof n.LiteralPrimitive}function fe(e){return ge(e)&&"string"==typeof e.value&&(t=e.value,!(!Number.isNaN(Number.parseFloat(String(t)))&&Number.isFinite(Number(t))));var t}function ye(e){return ge(e)&&null==e.value}const Se=/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Ae=/[a-z]/i,Te=new Set(["charset","class","color","colspan","fill","formControlName","height","href","id","lang","ngClass","ngProjectAs","routerLink","src","stroke","stroke-width","style","svgIcon","tabindex","target","type","viewBox","width","xmlns"]),be={checkAttributes:!0,checkId:!0,checkText:!0,ignoreAttributes:[...Te]},Ee="https://angular.io/guide/i18n",xe=`${Ee}#mark-element-attributes-for-translations`,Ce=`${Ee}#mark-plurals-and-alternates-for-translation`,he=`${Ee}#mark-text-for-translations`,Fe=`${Ee}#manage-marked-text-with-custom-ids`,Be=`${Ee}#define-unique-custom-ids`;var ve=c({name:"i18n",meta:{type:"suggestion",docs:{description:"Ensures following best practices for i18n. Checks for missing i18n attributes on elements and attributes containing texts. Can also check for texts without i18n attribute, elements that do not use custom ID (@@) feature and duplicate custom IDs",category:"Best Practices",recommended:!1,suggestion:!0},fixable:"code",schema:[{type:"object",properties:{boundTextAllowedPattern:{type:"string"},checkAttributes:{type:"boolean",default:be.checkAttributes},checkId:{type:"boolean",default:be.checkId},checkText:{type:"boolean",default:be.checkText},ignoreAttributes:{type:"array",items:{type:"string"},default:[...Te]},ignoreTags:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{i18nAttribute:`Attribute "{{attributeName}}" has no corresponding i18n attribute. See more at ${xe}`,i18nAttributeOnIcuOrText:`Each element containing text node should have an i18n attribute. See more at ${Ce} and ${he}`,i18nCustomIdOnAttribute:`Missing custom ID on attribute "i18n-{{attributeName}}". See more at ${Fe}`,i18nCustomIdOnElement:`Missing custom ID on element. See more at ${Fe}`,i18nDuplicateCustomId:`Duplicate custom ID "@@{{customId}}". See more at ${Be}`,suggestAddI18nAttribute:"Add the `i18n` attribute",suggestIgnoreAttribute:'Add the attribute name "{{attributeName}}" to the `ignoreAttributes` option in the eslint config'}},defaultOptions:[be],create(e,[{boundTextAllowedPattern:t,checkAttributes:r,checkId:a,checkText:o,ignoreAttributes:s,ignoreTags:u}]){const i=p(e),c=e.getSourceCode(),l=RegExp(null!=t?t:Ae),m=new Set([...Te,...null!=s?s:[]]),d=new Set(u),g=new Map;return O({},a&&{"Element[i18n]"(t){!function({i18n:{customId:t},name:n,parent:r,sourceSpan:a}){if(d.has(n)||we(r))return;if(!Ne(t)){var o;const e=null!=(o=g.get(t))?o:[];return void g.set(t,[...e,a])}const s=i.convertNodeSourceSpanToLoc(a);e.report({messageId:"i18nCustomIdOnElement",loc:s})}(t)}},(r||a)&&{[`Element > TextAttribute[value=${Se}]`](t){!function({i18n:t,keySpan:n,name:o,parent:{name:s},sourceSpan:u,value:l}){if(d.has(s))return;const p=i.convertNodeSourceSpanToLoc(null!=n?n:u);if(a&&t){const{customId:n}=t;if(Ne(n))e.report({messageId:"i18nCustomIdOnAttribute",loc:p,data:{attributeName:o}});else{var f;const e=null!=(f=g.get(n))?f:[];g.set(n,[...e,u])}}t||!r||function(e,t,n,r){return e.has(n)||e.has(`${t}[${n}]`)||Ne(r)||function(e){return"false"===e||"true"===e}(r)||function(e){const t=Number.parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)}(r)}(m,s,o,l)||e.report({messageId:"i18nAttribute",loc:p,data:{attributeName:o},fix:e=>{const{end:t}=i.convertNodeSourceSpanToLoc(u),n=c.getIndexFromLoc(t);return e.insertTextAfterRange([n,n],` i18n-${o}`)},suggest:[{messageId:"suggestIgnoreAttribute",data:{attributeName:o},fix:e=>e.insertTextBeforeRange([0,0],"")}]})}(t)}},o&&{[`BoundText, Icu, Text[value=${Se}]`](t){!function(t){var r;const{parent:a,sourceSpan:o}=t;if(t instanceof n.TmplAstBoundText&&function(e,{value:{ast:{strings:t}}}){return e.test(t.join("").trim())}(l,t)||Ie(a)&&(a.i18n||d.has(a.name)))return;const s=i.convertNodeSourceSpanToLoc(o);e.report(O({messageId:"i18nAttributeOnIcuOrText",loc:s},null!=a&&null!=(r=a.children)&&r.filter(Ie).length?{suggest:[{messageId:"suggestAddI18nAttribute",fix:e=>De(c,i,e,s,a)}]}:{fix:e=>De(c,i,e,s,a)}))}(t)}},{"Program:exit"(){!function(){for(const[t,n]of g){if(n.length<=1)break;for(const r of n){const n=i.convertNodeSourceSpanToLoc(r);e.report({messageId:"i18nDuplicateCustomId",loc:n,data:{customId:t}})}}g.clear()}()}})}});function De(e,t,n,r,a){return Ie(a)?v(a,we)?[]:function(e,t,{start:n},r){const a=e.getIndexFromLoc(n)+r.length+1;return t.insertTextAfterRange([a,a]," i18n")}(e,n,t.convertNodeSourceSpanToLoc(a.sourceSpan),a.name):function(e,t,{start:n,end:r}){const a=e.getIndexFromLoc(n),o=e.getIndexFromLoc(r);return[t.insertTextBeforeRange([a,a],"<ng-container i18n>"),t.insertTextAfterRange([o,o],"</ng-container>")]}(e,n,r)}function Ie(e){return e instanceof n.TmplAstElement}function we(e){return Boolean(Ie(e)&&e.i18n)}function Ne(e){return 0===e.trim().length}var Pe=c({name:"mouse-events-have-key-events",meta:{type:"suggestion",docs:{description:"Ensures that the Mouse Events mouseover and mouseout are accompanied with Key Events focus and blur.",category:"Best Practices",recommended:!1},schema:[],messages:{mouseOverEventHasFocusEvent:"mouseover must be accompanied by focus event for accessibility.",mouseOutEventHasBlurEvent:"mouseout must be accompanied by blur event for accessibility"}},defaultOptions:[],create(e){const t=p(e);return{Element(n){let r=!1,a=!1,o=!1,s=!1;for(const e of n.outputs)r="mouseover"===e.name,a="mouseout"===e.name,o="focus"===e.name,s="blur"===e.name;if(!r&&!a)return;const u=t.convertNodeSourceSpanToLoc(n.sourceSpan);r&&!o&&e.report({loc:u,messageId:"mouseOverEventHasFocusEvent"}),a&&!s&&e.report({loc:u,messageId:"mouseOutEventHasBlurEvent"})}}}}),Oe=c({name:"no-any",meta:{type:"suggestion",docs:{description:'The use of "$any" nullifies the compile-time benefits of Angular\'s type system',category:"Best Practices",recommended:!1,suggestion:!0},schema:[],messages:{noAny:'Avoid using "$any" in templates',suggestRemoveAny:"Remove $any"}},defaultOptions:[],create(e){m(e);const t=e.getSourceCode();return{'MethodCall[name="$any"]:not([receiver.expression]):not([receiver.name])'({nameSpan:n,sourceSpan:{end:r,start:a}}){e.report({messageId:"noAny",loc:{start:t.getLocFromIndex(a),end:t.getLocFromIndex(r)},suggest:[{messageId:"suggestRemoveAny",fix:e=>[e.removeRange([n.start,n.end+1]),e.removeRange([r-1,r])]}]})}}}}),ke=c({name:"no-autofocus",meta:{type:"suggestion",docs:{description:"Ensures that the `autofocus` attribute is not used",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{noAutofocus:"The `autofocus` attribute should not be used, as it reduces usability and accessibility for users"}},defaultOptions:[],create(e){const t=p(e);return{[`Element[name=${W([...U()])}] > :matches(BoundAttribute, TextAttribute)[name="autofocus"]`]({sourceSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noAutofocus",fix:e=>e.removeRange([n.start.offset-1,n.end.offset])})}}}}),Le=c({name:"no-call-expression",meta:{type:"suggestion",docs:{description:"Disallows calling expressions in templates, except for output handlers",category:"Best Practices",recommended:!1},schema:[],messages:{noCallExpression:"Avoid calling expressions in templates"}},defaultOptions:[],create(e){m(e);const t=e.getSourceCode();return{'FunctionCall, MethodCall[name!="$any"], SafeMethodCall'(n){if(Boolean(v(n,_e)))return;const{sourceSpan:{start:r,end:a}}=n;e.report({loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(a)},messageId:"noCallExpression"})}}}});function _e(e){return e instanceof n.TmplAstBoundEvent}var Re=c({name:"no-distracting-elements",meta:{type:"suggestion",docs:{description:"Enforces that no distracting elements are used",category:"Best Practices",recommended:!1},fixable:"code",schema:[],messages:{noDistractingElements:"Do not use <{{element}}> elements as they can create visual accessibility issues and are deprecated"}},defaultOptions:[],create(e){const t=p(e);return{"Element[name=/^(blink|marquee)$/]"({name:n,sourceSpan:r}){const a=t.convertNodeSourceSpanToLoc(r);e.report({loc:a,messageId:"noDistractingElements",data:{element:n},fix:e=>e.removeRange([r.start.offset,r.end.offset])})}}}});const Ke={allowTwoWayDataBinding:!0};var je=c({name:"no-duplicate-attributes",meta:{type:"problem",docs:{description:"Ensures that there are no duplicate input properties or output event listeners",category:"Possible Errors",recommended:!1,suggestion:!0},schema:[{type:"object",properties:{allowTwoWayDataBinding:{type:"boolean",default:Ke.allowTwoWayDataBinding,description:"Whether or not two-way data binding is allowed as an exception to the rule."}},additionalProperties:!1}],messages:{noDuplicateAttributes:"Duplicate attribute `{{attributeName}}`",suggestRemoveAttribute:"Remove attribute `{{attributeName}}`"}},defaultOptions:[Ke],create(e,[{allowTwoWayDataBinding:t}]){const n=p(e);return{Element({inputs:r,outputs:a,attributes:o}){[...Me([...r,...o]),...Me(t?a.filter(e=>!r.some(t=>t.sourceSpan.start===e.sourceSpan.start&&t.sourceSpan.end===e.sourceSpan.end)):a)].forEach(t=>{const r=n.convertNodeSourceSpanToLoc(t.sourceSpan),a={attributeName:g(t)};e.report({loc:r,messageId:"noDuplicateAttributes",data:a,suggest:[{messageId:"suggestRemoveAttribute",fix:e=>e.removeRange([r.start.column,r.end.column+1]),data:a}]})})}}}});function Me(e){return e.filter(t=>e.some(e=>e!==t&&g(e)===g(t)))}var $e=c({name:"no-negated-async",meta:{type:"suggestion",docs:{description:"Ensures that async pipe results are not negated",category:"Best Practices",recommended:"error",suggestion:!0},schema:[],messages:{noNegatedAsync:"Async pipe results should not be negated. Use `(observable | async) === false`, `(observable | async) === null`, or `(observable | async) === undefined` to check its value instead",suggestFalseComparison:"Compare with `false`",suggestNullComparison:"Compare with `null`",suggestUndefinedComparison:"Compare with `undefined`"}},defaultOptions:[],create(e){m(e);const t=e.getSourceCode();return{':not(PrefixNot) > PrefixNot > BindingPipe[name="async"]'({parent:{sourceSpan:{end:n,start:r}}}){e.report({messageId:"noNegatedAsync",loc:{start:t.getLocFromIndex(r),end:t.getLocFromIndex(n)},suggest:[{messageId:"suggestFalseComparison",textToInsert:" === false"},{messageId:"suggestNullComparison",textToInsert:" === null"},{messageId:"suggestUndefinedComparison",textToInsert:" === undefined"}].map(({messageId:e,textToInsert:t})=>({messageId:e,fix:e=>[e.removeRange([r,r+1]),e.insertTextAfterRange([n,n],t)]}))})}}}}),qe=c({name:"no-positive-tabindex",meta:{type:"suggestion",docs:{description:"Ensures that the `tabindex` attribute is not positive",category:"Best Practices",recommended:!1},schema:[],messages:{noPositiveTabindex:"The `tabindex` attribute should not be positive",suggestNonNegativeTabindex:'Use `tabindex="{{tabindex}}"`'}},defaultOptions:[],create(e){const t=p(e);return{[`Element[name=${W([...U()])}] > BoundAttribute[name="tabindex"][value.ast.value>0], TextAttribute[name="tabindex"][value>0]`]({valueSpan:n}){const r=t.convertNodeSourceSpanToLoc(n);e.report({loc:r,messageId:"noPositiveTabindex",suggest:["-1","0"].map(e=>({messageId:"suggestNonNegativeTabindex",fix:t=>t.replaceTextRange([n.start.offset,n.end.offset],e),data:{tabindex:e}}))})}}}}),Xe=c({name:"use-track-by-function",meta:{type:"suggestion",docs:{description:"Ensures trackBy function is used",category:"Best Practices",recommended:!1},schema:[],messages:{useTrackByFunction:"Missing trackBy function in ngFor directive"}},defaultOptions:[],create(e){const t=p(e);return{'BoundAttribute.inputs[name="ngForOf"]'({parent:{inputs:n},sourceSpan:r}){if(n.some(Je))return;const a=t.convertNodeSourceSpanToLoc(r);e.report({messageId:"useTrackByFunction",loc:a})},'BoundAttribute.templateAttrs[name="ngForOf"]'({parent:{templateAttrs:n}}){if(n.some(Je))return;const{start:r}=t.convertNodeSourceSpanToLoc(n[0].sourceSpan),{end:a}=t.convertNodeSourceSpanToLoc(n[n.length-1].sourceSpan),o={start:O({},r,{column:r.column-1}),end:O({},a,{column:a.column+1})};e.report({messageId:"useTrackByFunction",loc:o})}}}});function Je(e){return e instanceof n.TmplAstBoundAttribute&&"ngForTrackBy"===e.name}module.exports={configs:{all:{extends:"./configs/base.json",rules:{"@angular-eslint/template/accessibility-alt-text":"error","@angular-eslint/template/accessibility-elements-content":"error","@angular-eslint/template/accessibility-label-for":"error","@angular-eslint/template/accessibility-label-has-associated-control":"error","@angular-eslint/template/accessibility-table-scope":"error","@angular-eslint/template/accessibility-valid-aria":"error","@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/click-events-have-key-events":"error","@angular-eslint/template/conditional-complexity":"error","@angular-eslint/template/cyclomatic-complexity":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/i18n":"error","@angular-eslint/template/mouse-events-have-key-events":"error","@angular-eslint/template/no-any":"error","@angular-eslint/template/no-autofocus":"error","@angular-eslint/template/no-call-expression":"error","@angular-eslint/template/no-distracting-elements":"error","@angular-eslint/template/no-duplicate-attributes":"error","@angular-eslint/template/no-negated-async":"error","@angular-eslint/template/no-positive-tabindex":"error","@angular-eslint/template/use-track-by-function":"error"}},base:{parser:"@angular-eslint/template-parser",plugins:["@angular-eslint/template"]},recommended:{extends:"./configs/base.json",rules:{"@angular-eslint/template/banana-in-box":"error","@angular-eslint/template/eqeqeq":"error","@angular-eslint/template/no-negated-async":"error"}},"process-inline-templates":{parser:"@typescript-eslint/parser",parserOptions:{ecmaVersion:2020,sourceType:"module"},plugins:["@angular-eslint/template"],processor:"@angular-eslint/template/extract-inline-html"}},processors:i,rules:{"accessibility-alt-text":y,"accessibility-elements-content":P,"accessibility-label-for":j,[M]:X,"accessibility-table-scope":Y,"accessibility-valid-aria":H,"banana-in-box":Z,"conditional-complexity":ae,"click-events-have-key-events":re,"cyclomatic-complexity":ie,eqeqeq:le,i18n:ve,"mouse-events-have-key-events":Pe,"no-any":Oe,"no-autofocus":ke,"no-call-expression":Le,"no-distracting-elements":Re,"no-duplicate-attributes":je,"no-negated-async":$e,"no-positive-tabindex":qe,"use-track-by-function":Xe}};
|
package/dist/rules/i18n.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/experimental-utils';
|
|
1
2
|
declare type Options = [
|
|
2
3
|
{
|
|
3
4
|
readonly boundTextAllowedPattern?: string;
|
|
5
|
+
readonly checkAttributes?: boolean;
|
|
4
6
|
readonly checkId?: boolean;
|
|
5
7
|
readonly checkText?: boolean;
|
|
6
|
-
readonly checkAttributes?: boolean;
|
|
7
8
|
readonly ignoreAttributes?: readonly string[];
|
|
8
9
|
readonly ignoreTags?: readonly string[];
|
|
9
10
|
}
|
|
10
11
|
];
|
|
11
|
-
export declare type MessageIds = 'i18nAttribute' | '
|
|
12
|
+
export declare type MessageIds = 'i18nAttribute' | 'i18nAttributeOnIcuOrText' | 'i18nCustomIdOnAttribute' | 'i18nCustomIdOnElement' | 'i18nDuplicateCustomId' | 'suggestAddI18nAttribute' | 'suggestIgnoreAttribute';
|
|
12
13
|
export declare const RULE_NAME = "i18n";
|
|
13
|
-
declare const _default:
|
|
14
|
+
declare const _default: TSESLint.RuleModule<MessageIds, Options, TSESLint.RuleListener>;
|
|
14
15
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TmplAstElement } from '@angular/compiler';
|
|
2
2
|
import type { ARIARoleRelationConceptAttribute } from 'aria-query';
|
|
3
|
-
export declare function attributesComparator(
|
|
3
|
+
export declare function attributesComparator(ariaRoleRelationConceptAttributes: readonly ARIARoleRelationConceptAttribute[], node: TmplAstElement): boolean;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { TmplAstElement } from '@angular/compiler';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the attribute value.
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* getAttributeValue(Element(`<div property="test"></div>`), 'nonExistent'); // null
|
|
7
|
+
* getAttributeValue(Element(`<div aria-role="none"></div>`), 'role'); // 'none'
|
|
8
|
+
* getAttributeValue(Element(`<div [attr.aria-checked]="true"></div>`), 'aria-checked'); // true
|
|
9
|
+
* getAttributeValue(Element(`<button [variant]="variant"></button>`), 'variant'); // PROPERTY
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAttributeValue({ attributes, inputs }: TmplAstElement, attributeName: string): unknown;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TmplAstBoundAttribute, TmplAstTextAttribute } from '@angular/compiler';
|
|
2
|
+
import { TmplAstBoundEvent } from '@angular/compiler';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the original attribute name.
|
|
5
|
+
* @example
|
|
6
|
+
* ```html
|
|
7
|
+
* <div [style.display.none]="test"></div> <!-- Instead of "display", "style.display.none" -->
|
|
8
|
+
* <div [attr.role]="'none'"></div> <!-- Instead of "attr.role", "role" -->
|
|
9
|
+
* <div ([ngModel])="test"></div> <!-- Instead of "ngModel", "ngModelChange" -->
|
|
10
|
+
* <div (@fade.start)="handle()"></div> <!-- Instead of "fade", "@fade.start" -->
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOriginalAttributeName(attribute: TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstTextAttribute): string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TmplAstElement } from '@angular/compiler';
|
|
2
2
|
/**
|
|
3
|
-
* Whether an element
|
|
4
|
-
*
|
|
3
|
+
* Whether an element content cannot be read by a screen reader. It can happen in the following situations:
|
|
4
|
+
* - It has `display: none` or `visibility: hidden` style;
|
|
5
|
+
* - It has `aria-hidden` or `hidden` attribute;
|
|
6
|
+
* - It's an `<input type="hidden">`;
|
|
7
|
+
* - One of its ancestors met one of the following situations above.
|
|
5
8
|
*/
|
|
6
9
|
export declare function isHiddenFromScreenReader(node: TmplAstElement): boolean;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin-template",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.1",
|
|
4
4
|
"description": "ESLint plugin for Angular Templates",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"axobject-query": "^2.2.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular-eslint/utils": "12.
|
|
25
|
+
"@angular-eslint/utils": "12.4.1",
|
|
26
26
|
"@types/aria-query": "^4.2.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"eslint": "*",
|
|
31
31
|
"typescript": "*"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "b38d82894ed39358a48c4689dd79749ad9216dc1"
|
|
34
34
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getLiteralValue<T>(value: T): boolean | T;
|