projecte_ionic/node_modules/@angular-eslint/eslint-plugin/dist/index.js
2022-02-09 18:30:03 +01:00

1 line
40 KiB
JavaScript
Executable file

var e=require("@typescript-eslint/experimental-utils"),t=require("@angular/compiler");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}const n=Object.keys;var o,a,s,i;!function(e){e.Component="Component",e.Directive="Directive",e.Injectable="Injectable",e.NgModule="NgModule",e.Pipe="Pipe"}(o||(o={})),function(e){e.Attribute="Attribute",e.Host="Host",e.Inject="Inject",e.Optional="Optional",e.Self="Self",e.SkipSelf="SkipSelf"}(a||(a={})),function(e){e.HostListener="HostListener"}(s||(s={})),function(e){e.ContentChild="ContentChild",e.ContentChildren="ContentChildren",e.HostBinding="HostBinding",e.Input="Input",e.Output="Output",e.ViewChild="ViewChild",e.ViewChildren="ViewChildren"}(i||(i={}));const l=r({},a,s,i);var c,p;!function(e){e.AfterContentChecked="AfterContentChecked",e.AfterContentInit="AfterContentInit",e.AfterViewChecked="AfterViewChecked",e.AfterViewInit="AfterViewInit",e.DoBootstrap="DoBootstrap",e.DoCheck="DoCheck",e.OnChanges="OnChanges",e.OnDestroy="OnDestroy",e.OnInit="OnInit"}(c||(c={})),function(e){e.ngAfterContentChecked="ngAfterContentChecked",e.ngAfterContentInit="ngAfterContentInit",e.ngAfterViewChecked="ngAfterViewChecked",e.ngAfterViewInit="ngAfterViewInit",e.ngDoBootstrap="ngDoBootstrap",e.ngDoCheck="ngDoCheck",e.ngOnChanges="ngOnChanges",e.ngOnDestroy="ngOnDestroy",e.ngOnInit="ngOnInit"}(p||(p={}));const u="camelCase",d="kebab-case",m=n(o),g=n(l),f=n(c),y=n(p),h=new Map([[o.Component,new Set([p.ngAfterContentChecked,p.ngAfterContentInit,p.ngAfterViewChecked,p.ngAfterViewInit,p.ngOnChanges,p.ngOnDestroy,p.ngOnInit,p.ngDoCheck])],[o.Directive,new Set([p.ngAfterContentChecked,p.ngAfterContentInit,p.ngAfterViewChecked,p.ngAfterViewInit,p.ngOnChanges,p.ngOnDestroy,p.ngOnInit,p.ngDoCheck])],[o.Injectable,new Set([p.ngOnDestroy])],[o.NgModule,new Set([p.ngDoBootstrap])],[o.Pipe,new Set([p.ngOnDestroy])]]),x=new Set(g),v=new Set(m),b=new Map([[o.Component,x],[o.Directive,x],[o.Injectable,new Set([l.Host,l.Inject,l.Optional,l.Self,l.SkipSelf])],[o.NgModule,new Set([l.Host,l.Inject,l.Optional,l.Self,l.SkipSelf])],[o.Pipe,new Set([l.Host,l.Inject,l.Optional,l.Self,l.SkipSelf])]]);function C(e){return"CallExpression"===e.type}function w(e){return"Identifier"===e.type}function D(e){return"MemberExpression"===e.type}function I(e){return"ClassDeclaration"===e.type}function O(e){return"ObjectExpression"===e.type}function P(e){return"ArrayExpression"===e.type}function k(e){return"Literal"===e.type}function S(e){return"TemplateLiteral"===e.type}function A(e){return"ImportDeclaration"===e.type}function j(e){return"ImportSpecifier"===e.type}function M(e){return"Literal"===e.type&&"string"==typeof e.value}function E(e){return"MethodDefinition"===e.type}function N({parent:e},t){for(;e&&"Program"!==e.type;){if(t(e))return e;e=e.parent}return null}const B=e=>{var t;return I(e)?null==(t=e.id)?void 0:t.name:e.parent?B(e.parent):void 0},T=({decorators:e})=>null==e?void 0:e.map($).filter(Y).find(G),$=e=>{const{expression:t}=e;return w(t)?t.name:C(t)&&w(t.callee)?t.callee.name:void 0},L=e=>{const{expression:t}=e;return D(t)?t.property.name:t.name},V=e=>e.implements||[],R=e=>V(e).map(L),q=e=>R(e).filter(H),U=new Set(f),F=new Set(y),H=e=>U.has(e),z=e=>F.has(e),G=e=>v.has(e);function W(e){if("Identifier"===e.key.type)return e.key.name;if("Literal"===e.key.type)return e.key.raw;throw new Error(`Unexpected "ClassProperty.key.type" provided: ${e.key.type}`)}const Z=(e,t)=>{const r=(e=>{const{expression:t}=e;if(!C(t)||!t.arguments||0===t.arguments.length)return;const r=t.arguments[0];return O(r)&&r.properties?r:void 0})(e);if(!r||!O(r))return;const n=r.properties.find(e=>e.key&&w(e.key)&&e.key.name===t);return n&&"Property"===n.type?n:void 0},Q=(e,t)=>{const r=Z(e,t);if(r)return r.value},J=e=>e.body.body.filter(E),K=e=>k(e.key)?e.key.value:e.key.name;function X(e){return Array.isArray(e)?e:null!=e?[e]:[]}const Y=e=>null!=e,_={attribute:e=>0!==e.length,camelCase:e=>/^[a-zA-Z0-9[\]]+$/.test(e),element:e=>null!==e,kebabCase:e=>/^[a-z0-9-]+-[a-z0-9-]+$/.test(e),prefix(e,t){const r=new RegExp(`^\\[?(${e})`);return n=>{if(!e)return!0;if(!r.test(n))return!1;const o=n.replace(r,"");if(t===u)return!o||o[0]===o[0].toUpperCase();if(t===d)return!o||"-"===o[0];throw Error("Invalid selector style!")}}};function ee(e,t){let r=e;for(;r=r.parent;)if("Program"===r.type)return r.body.some(r=>A(r)&&r.source.value===t&&r.specifiers.some(t=>j(t)&&t.imported.name===e.name&&t.local.name===e.name));return!1}const te=e=>{const t=e.length;return 1===t?`"${e[0]}"`:`${e.map(e=>`"${e}"`).slice(0,t-1).join(", ")} or "${[...e].pop()}"`},re=e=>RegExp(`^(${e.join("|")})$`),ne=e.ESLintUtils.RuleCreator(e=>"https://github.com/angular-eslint/angular-eslint");var oe=ne({name:"contextual-decorator",meta:{type:"suggestion",docs:{description:"Ensures that classes use contextual decorators in its body.",category:"Best Practices",recommended:!1},schema:[],messages:{contextualDecorator:'Decorator out of context for "@{{classDecoratorName}}()"'}},defaultOptions:[],create:e=>({"MethodDefinition[kind=/^(get|set|method)$/], ClassProperty, TSParameterProperty"(t){!function(e,t){var r;if(null==(r=t.decorators)||!r.length)return;const n=function(e){for(;e.parent;){if("ClassDeclaration"===e.type)return e;e=e.parent}return null}(t);if(!n)return;const o=T(n);if(o)for(const r of t.decorators)ae(e,r,o)}(e,t)}})});function ae(e,t,r){const n=$(t);if(!n||!x.has(n))return;const o=b.get(r);o&&!o.has(n)&&e.report({node:t,messageId:"contextualDecorator",data:{classDecoratorName:r}})}const se='ClassDeclaration > Decorator:matches([expression.callee.name="Component"], [expression.callee.name="Directive"])',ie='ClassDeclaration > Decorator[expression.callee.name="Component"]',le='ClassDeclaration > Decorator[expression.callee.name="Directive"]',ce='ClassDeclaration > Decorator[expression.callee.name="Pipe"]';var pe=ne({name:"component-class-suffix",meta:{type:"suggestion",docs:{description:'Classes decorated with @Component must have suffix "Component" (or custom) in their name. See more at https://angular.io/styleguide#style-02-03.',category:"Best Practices",recommended:"error"},schema:[{type:"object",properties:{suffixes:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{componentClassSuffix:"The name of the class {{className}} should end with the suffix {{suffixes}} (https://angular.io/styleguide#style-02-03)"}},defaultOptions:[{suffixes:["Component"]}],create(e,[t]){const{suffixes:r}=t;return{[ie](t){const n=t.parent,o=B(n);o&&r.some(e=>o.endsWith(e))||e.report({node:n.id?n.id:n,messageId:"componentClassSuffix",data:{className:o,suffixes:r}})}}}});const ue=/\r\n|\r|\n/;function de(e){return S(e)?e.quasis[0].value.raw.trim().split(ue).length:k(e)?e.raw.trim().split(ue).length:0}var me=ne({name:"component-max-inline-declarations",meta:{type:"suggestion",docs:{description:"Enforces a maximum number of lines in inline template, styles and animations",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{template:{minimum:0,type:"number"},styles:{minimum:0,type:"number"},animations:{minimum:0,type:"number"}},additionalProperties:!1}],messages:{componentMaxInlineDeclarations:"`{{propertyType}}` has too many lines ({{lineCount}}). Maximum allowed is {{max}} (https://angular.io/guide/styleguide#style-05-04)"}},defaultOptions:[{template:3,styles:3,animations:15}],create:(e,[{template:t=3,styles:r=3,animations:n=15}])=>({[`${ie} Property[key.name='template']`]({value:r}){const n=de(r);n<=t||e.report({node:r,messageId:"componentMaxInlineDeclarations",data:{lineCount:n,max:t,propertyType:"template"}})},[`${ie} Property[key.name='styles']`]({value:t}){if(!P(t))return;const n=t.elements.reduce((e,t)=>e+de(t),0);n<=r||e.report({node:t,messageId:"componentMaxInlineDeclarations",data:{lineCount:n,max:r,propertyType:"styles"}})},[`${ie} Property[key.name='animations']`]({value:t}){if(!P(t)||0===t.elements.length)return;const r=Math.max(t.loc.end.line-t.loc.start.line-2,1);r<=n||e.report({node:t,messageId:"componentMaxInlineDeclarations",data:{lineCount:r,max:n,propertyType:"animations"}})}})});const ge="attribute",fe="element",ye={[ge]:"attrs",[fe]:fe},he=(e,t,r)=>{r.report({node:e,messageId:"prefixFailure",data:{prefix:t}})},xe=(e,t,r)=>{r.report({node:e,messageId:"styleFailure",data:{style:t}})},ve=(e,t,r)=>{r.report({node:e,messageId:"typeFailure",data:{type:t}})},be=(e,t,r)=>{const n=X(e),o=r,a=n.length>0&&n.every(e=>-1!==[fe,ge].indexOf(e)),s=t.length>0,i=-1!==[u,d].indexOf(o);return a&&s&&i},Ce=(e,r,n,o)=>{const a=X(r||["attrs",fe]).reduce((e,t)=>e.concat(ye[t]),[]),s=o===d?_.kebabCase:_.camelCase;let i=null;if(e&&k(e)?i=t.CssSelector.parse(e.raw):e&&S(e)&&e.quasis[0]&&(i=t.CssSelector.parse(e.quasis[0].value.raw)),!i)return null;const l=((e,t)=>e.reduce((e,r)=>{const n=t.reduce((e,t)=>{const n=r[t];return n?e.concat(n):e},[]);return e.concat(n)},[]))(i,a),c=l.some(e=>n.some(t=>_.prefix(t,o)(e))),p=l.some(e=>s(e));return{hasExpectedPrefix:c,hasExpectedType:l.length>0,hasExpectedStyle:p}};var we=ne({name:"component-selector",meta:{type:"suggestion",docs:{description:"Component selectors should follow given naming rules. See more at https://angular.io/guide/styleguide#style-02-07, https://angular.io/guide/styleguide#style-05-02\n and https://angular.io/guide/styleguide#style-05-03.",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{type:{oneOf:[{type:"string"},{type:"array",items:{enum:[fe,ge]}}]},prefix:{oneOf:[{type:"string"},{type:"array"}]},style:{type:"string",enum:[u,d]}},additionalProperties:!1}],messages:{prefixFailure:"The selector should be prefixed by one of the prefixes: '{{prefix}}' (https://angular.io/guide/styleguide#style-02-07)",styleFailure:"The selector should be {{style}} (https://angular.io/guide/styleguide#style-05-02)",typeFailure:"The selector should be used as an {{type}} (https://angular.io/guide/styleguide#style-05-03)"}},defaultOptions:[{type:"",prefix:"",style:""}],create(e,[t]){const{type:r,prefix:n,style:o}=t;return{[ie](t){const a=Q(t,"selector");if(!a)return;if(!be(r,n,o))return;const s=Ce(a,r,X(n),o);null!==s&&(s.hasExpectedType?s.hasExpectedStyle?s.hasExpectedPrefix||he(a,n,e):xe(a,o,e):ve(a,r,e))}}}}),De=ne({name:"contextual-lifecycle",meta:{type:"problem",docs:{description:"Ensures that lifecycle methods are used in a correct context",category:"Possible Errors",recommended:"error"},schema:[],messages:{contextuaLifecycle:"This lifecycle method is not called for {{decorator}}"}},defaultOptions:[],create(e){function t({parent:t},r){const n=t,o=h.get(r),a=J(n);for(const t of a){const n=K(t);!z(n)||null!=o&&o.has(n)||e.report({node:t.key,messageId:"contextuaLifecycle",data:{decorator:r}})}}return{[ie](e){t(e,o.Component)},[le](e){t(e,o.Directive)},'ClassDeclaration > Decorator[expression.callee.name="Injectable"]'(e){t(e,o.Injectable)},'ClassDeclaration > Decorator[expression.callee.name="NgModule"]'(e){t(e,o.NgModule)},[ce](e){t(e,o.Pipe)}}}}),Ie=ne({name:"directive-class-suffix",meta:{type:"suggestion",docs:{description:'Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. See more at https://angular.io/styleguide#style-02-03.',category:"Best Practices",recommended:"error"},schema:[{type:"object",properties:{suffixes:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{directiveClassSuffix:"The name of the class {{className}} should end with suffix(es) {{suffixes}} (https://angular.io/styleguide#style-02-03)"}},defaultOptions:[{suffixes:["Directive"]}],create:(e,[{suffixes:t}])=>({[le](r){if(!Q(r,"selector"))return;const n=r.parent,o=B(n),a=R(n).some(e=>e.endsWith("Validator")),s=t.concat(a?"Validator":[]);var i;o&&s.some(e=>o.endsWith(e))||e.report({node:null!=(i=n.id)?i:n,messageId:"directiveClassSuffix",data:{className:o,suffixes:te(s)}})}})}),Oe=ne({name:"directive-selector",meta:{type:"suggestion",docs:{description:"Directive selectors should follow given naming rules. See more at https://angular.io/guide/styleguide#style-02-06 and https://angular.io/guide/styleguide#style-02-08.",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{type:{oneOf:[{type:"string"},{type:"array",items:{enum:[fe,ge]}}]},prefix:{oneOf:[{type:"string"},{type:"array"}]},style:{type:"string",enum:[u,d]}},additionalProperties:!1}],messages:{prefixFailure:"The selector should be prefixed by one of the prefixes: '{{prefix}}' (https://angular.io/guide/styleguide#style-02-08)",styleFailure:"The selector should be {{style}} (https://angular.io/guide/styleguide#style-02-06)",typeFailure:"The selector should be used as an {{type}} (https://angular.io/guide/styleguide#style-02-06)"}},defaultOptions:[{type:"",prefix:"",style:""}],create(e,[t]){const{type:r,prefix:n,style:o}=t;return{[le](t){const a=Q(t,"selector");if(!a)return;if(!be(r,n,o))return;const s=Ce(a,r,X(n),o);null!==s&&(s.hasExpectedType?s.hasExpectedStyle?s.hasExpectedPrefix||he(a,n,e):xe(a,o,e):ve(a,r,e))}}}}),Pe=ne({name:"no-attribute-decorator",meta:{type:"problem",docs:{description:"Disallows usage of @Attribute decorator.",category:"Possible Errors",recommended:!1},schema:[],messages:{noAttributeDecorator:"The usage of @Attribute is considered a bad practice. Use @Input instead"}},defaultOptions:[],create:e=>({'ClassDeclaration MethodDefinition[key.name="constructor"] Decorator[expression.callee.name="Attribute"]'(t){e.report({node:t,messageId:"noAttributeDecorator"})}})});const ke=[c.DoCheck,c.OnChanges],Se=[p.ngDoCheck,p.ngOnChanges];var Ae=ne({name:"no-conflicting-lifecycle",meta:{type:"suggestion",docs:{description:"Ensures that directives not implement conflicting lifecycle interfaces.",category:"Best Practices",recommended:"error"},schema:[],messages:{noConflictingLifecycleInterface:`Implementing ${c.DoCheck} and ${c.OnChanges} in a class is not recommended`,noConflictingLifecycleMethod:`Declaring ${p.ngDoCheck} and ${p.ngOnChanges} method in a class is not recommended`}},defaultOptions:[],create:e=>({ClassDeclaration(t){(t=>{const r=q(t);if(!ke.every(e=>r.includes(e)))return;const n=V(t).filter(e=>w(e.expression)&&H(e.expression.name));for(const t of n)e.report({node:t,messageId:"noConflictingLifecycleInterface"})})(t),(t=>{const r=(e=>J(e).map(K).filter(z))(t);if(!Se.every(e=>r.includes(e)))return;const n=J(t).filter(e=>w(e.key)&&z(e.key.name));for(const t of n)e.report({node:t,messageId:"noConflictingLifecycleMethod"})})(t)}})}),je=ne({name:"no-forward-ref",meta:{type:"suggestion",docs:{description:"Disallows usage of `forwardRef` references for DI",category:"Best Practices",recommended:!1},schema:[],messages:{noForwardRef:"Avoid using `forwardRef`"}},defaultOptions:[],create:e=>({'CallExpression[callee.type="Identifier"][callee.name="forwardRef"]'(t){e.report({node:t,messageId:"noForwardRef"})}})}),Me=ne({name:"no-host-metadata-property",meta:{type:"suggestion",docs:{description:"Disallows usage of the `host` metadata property. See more at https://angular.io/styleguide#style-06-03.",category:"Best Practices",recommended:"error"},schema:[],messages:{noHostMetadataProperty:`Use @${l.HostBinding} or @${l.HostListener} rather than the \`host\` metadata property (https://angular.io/styleguide#style-06-03)`}},defaultOptions:[],create:e=>({[se](t){const r=Q(t,"host");r&&e.report({node:r.parent,messageId:"noHostMetadataProperty"})}})}),Ee=ne({name:"no-input-prefix",meta:{type:"suggestion",docs:{description:"Input names should not be prefixed by the configured disallowed prefixes.",category:"Best Practices",recommended:!1},schema:[{type:"object",properties:{prefixes:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{noInputPrefix:"@Inputs should not be prefixed by {{disallowedPrefixes}}"}},defaultOptions:[{prefixes:[]}],create:(e,[t])=>({':matches(ClassProperty, MethodDefinition[kind="set"]) > Decorator[expression.callee.name="Input"]'(r){if(!ee(r.expression.callee,"@angular/core"))return;const n=r.parent,o=W(n),a=t.prefixes;a.some(e=>e===o||new RegExp(`^${e}[^a-z]`).test(o))&&e.report({node:n,messageId:"noInputPrefix",data:{disallowedPrefixes:a.join(", ")}})}})});const Ne=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-controls","aria-current","aria-describedby","aria-disabled","aria-dragged","aria-dropeffect","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-labelledby","aria-level","aria-live","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"]);var Be=ne({name:"no-input-rename",meta:{type:"suggestion",docs:{description:"Disallows renaming directive inputs by providing a string to the decorator.",category:"Best Practices",recommended:"error"},schema:[],messages:{noInputRename:"In the class {{className}}, the directive input property {{propertyName}} should not be renamed"}},defaultOptions:[],create:e=>({':matches(ClassProperty, MethodDefinition[kind="set"]) > Decorator[expression.callee.name="Input"]'(t){const r=t.expression;if(!ee(r.callee,"@angular/core"))return;if(0===r.arguments.length)return;let n;const a=t.parent,s=a.parent.parent,i=s.decorators&&s.decorators.find(e=>C(e.expression)&&w(e.expression.callee)&&e.expression.callee.name===o.Directive);if(i){const e=Q(i,"selector");e&&k(e)&&e.value&&(n=(e.value.toString()||"").replace(/[[\]\s]/g,"").split(","))}const l=r.arguments[0].value;l&&w(a.key)&&((e,t)=>{return!!(e!==t&&n&&n.some(r=>new RegExp(`^${r}((${t[0].toUpperCase()+t.slice(1)}$)|(?=$))`).test(e))||Ne.has(e)&&t===(r=e,r.replace(/-[a-zA-Z]/g,e=>e[1].toUpperCase())));var r})(l.toString(),a.key.name)||e.report({node:a,messageId:"noInputRename",data:{className:s.id&&s.id.name,propertyName:a.key.name}})}})}),Te=ne({name:"no-inputs-metadata-property",meta:{type:"suggestion",docs:{description:"Disallows usage of the `inputs` metadata property. See more at https://angular.io/styleguide#style-05-12.",category:"Best Practices",recommended:"error"},schema:[],messages:{noInputsMetadataProperty:`Use @${l.Input} rather than the \`inputs\` metadata property (https://angular.io/styleguide#style-05-12)`}},defaultOptions:[],create:e=>({[se](t){const r=Q(t,"inputs");r&&e.report({node:r.parent,messageId:"noInputsMetadataProperty"})}})}),$e=ne({name:"no-lifecycle-call",meta:{type:"suggestion",docs:{description:"Disallows explicit calls to lifecycle methods",category:"Best Practices",recommended:!1},schema:[],messages:{noLifecycleCall:"Avoid explicit calls to lifecycle methods"}},defaultOptions:[],create:e=>({[`ClassDeclaration MemberExpression[property.name=${re([...F])}]`]:t=>{!T(function(e){return N(e,I)}(t))||function(e){return"Super"===e.type}(t.object)&&function(e){const t=N(e,E);return Boolean(t&&function({property:e},{key:t}){return w(e)&&w(t)&&e.name===t.name}(e,t))}(t)||e.report({node:t.parent,messageId:"noLifecycleCall"})}})}),Le=ne({name:"no-output-native",meta:{type:"suggestion",docs:{description:"Disallows naming directive outputs as standard DOM event.",category:"Best Practices",recommended:"error"},schema:[],messages:{noOutputNative:"The output property should not be named or renamed as a native event"}},defaultOptions:[],create:e=>({'ClassProperty > Decorator[expression.callee.name="Output"]'(t){const r=t.parent;if(!B(t))return;const n=W(r),o=t.expression.arguments[0],a=o&&k(o)&&o.value||n;a&&(Ve||(Ve=new Set(["abort","afterprint","animationend","animationiteration","animationstart","appinstalled","audioprocess","audioend","audiostart","beforeprint","beforeunload","beginEvent","blocked","blur","boundary","cached","canplay","canplaythrough","change","chargingchange","chargingtimechange","checking","click","close","complete","compositionend","compositionstart","compositionupdate","contextmenu","copy","cut","dblclick","devicechange","devicelight","devicemotion","deviceorientation","deviceproximity","dischargingtimechange","DOMAttributeNameChanged","DOMAttrModified","DOMCharacterDataModified","DOMContentLoaded","DOMElementNameChanged","focus","focusin","focusout","DOMNodeInserted","DOMNodeInsertedIntoDocument","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMSubtreeModified","downloading","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","end","ended","endEvent","error","fullscreenchange","fullscreenerror","gamepadconnected","gamepaddisconnected","gotpointercapture","hashchange","lostpointercapture","input","invalid","keydown","keypress","keyup","languagechange","levelchange","load","loadeddata","loadedmetadata","loadend","loadstart","mark","message","messageerror","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","nomatch","notificationclick","noupdate","obsolete","offline","online","open","orientationchange","pagehide","pageshow","paste","pause","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","pointerlockerror","pointermove","pointerout","pointerover","pointerup","play","playing","popstate","progress","push","pushsubscriptionchange","ratechange","readystatechange","repeatEvent","reset","resize","resourcetimingbufferfull","result","resume","scroll","seeked","seeking","select","selectstart","selectionchange","show","soundend","soundstart","speechend","speechstart","stalled","start","storage","submit","success","suspend","SVGAbort","SVGError","SVGLoad","SVGResize","SVGScroll","SVGUnload","SVGZoom","timeout","timeupdate","touchcancel","touchend","touchmove","touchstart","transitionend","unload","updateready","upgradeneeded","userproximity","voiceschanged","versionchange","visibilitychange","volumechange","waiting","wheel"]))).has(a.toString())&&e.report({node:r,messageId:"noOutputNative"})}})});let Ve=null;var Re=ne({name:"no-output-on-prefix",meta:{type:"suggestion",docs:{description:"Name events without the prefix on. See more at https://angular.io/guide/styleguide#dont-prefix-output-properties.",category:"Best Practices",recommended:"error"},schema:[],messages:{noOutputOnPrefix:'In the class "{{className}}", the output property "{{memberName}}" should not be prefixed with on'}},defaultOptions:[],create:e=>({'ClassProperty > Decorator[expression.callee.name="Output"]'(t){const r=t.parent,n=B(t),o=W(r);o&&/^on((?![a-z])|(?=$))/.test(o)&&e.report({node:r,messageId:"noOutputOnPrefix",data:{className:n,memberName:o}})}})}),qe=ne({name:"no-output-rename",meta:{type:"suggestion",docs:{description:"Disallows renaming directive outputs by providing a string to the decorator.",category:"Best Practices",recommended:"error"},schema:[],messages:{noOutputRename:"@Outputs should not be renamed"}},defaultOptions:[],create:e=>({'ClassProperty > Decorator[expression.callee.name="Output"]'(t){const r=t.expression;if(!ee(r.callee,"@angular/core"))return;if(0===r.arguments.length)return;let n;const a=t.parent,s=a.parent.parent,i=s.decorators&&s.decorators.find(e=>C(e.expression)&&w(e.expression.callee)&&e.expression.callee.name===o.Directive);if(i){const e=Q(i,"selector");e&&k(e)&&e.value&&(n=new Set((e.value.toString()||"").replace(/[[\]\s]/g,"").split(",")))}const l=r.arguments[0].value;l&&w(a.key)&&((e,t)=>!(!n||!n.has(e)||e===t))(l.toString(),a.key.name)||e.report({node:a,messageId:"noOutputRename"})}})}),Ue=ne({name:"no-outputs-metadata-property",meta:{type:"suggestion",docs:{description:"Disallows usage of the `outputs` metadata property. See more at https://angular.io/styleguide#style-05-12.",category:"Best Practices",recommended:"error"},schema:[],messages:{noOutputsMetadataProperty:`Use @${l.Output} rather than the \`outputs\` metadata property (https://angular.io/styleguide#style-05-12)`}},defaultOptions:[],create:e=>({[se](t){const r=Q(t,"outputs");r&&e.report({node:r.parent,messageId:"noOutputsMetadataProperty"})}})}),Fe=ne({name:"no-pipe-impure",meta:{type:"suggestion",docs:{description:"Disallows the declaration of impure pipes.",category:"Best Practices",recommended:!1},schema:[],messages:{noPipeImpure:"Impure pipes should be avoided because they are invoked on each change-detection cycle."}},defaultOptions:[],create:e=>({[ce](t){const r=Z(t,"pure");r&&k(r.value)&&!r.value.value&&e.report({node:r.value,messageId:"noPipeImpure"})}})}),He=ne({name:"no-queries-metadata-property",meta:{type:"suggestion",docs:{description:"Disallows usage of the `queries` metadata property. See more at https://angular.io/styleguide#style-05-12.",category:"Best Practices",recommended:!1},schema:[],messages:{noQueriesMetadataProperty:`Use @${l.Output} rather than the \`queries\` metadata property (https://angular.io/styleguide#style-05-12)`}},defaultOptions:[],create:e=>({[se](t){const r=Q(t,"queries");r&&e.report({node:r.parent,messageId:"noQueriesMetadataProperty"})}})}),ze=ne({name:"no-empty-lifecycle-method",meta:{type:"suggestion",docs:{description:"Disallows declaring empty lifecycle methods",category:"Best Practices",recommended:"error"},schema:[],messages:{noEmptyLifecycleMethod:"Lifecycle methods should not be empty"}},defaultOptions:[],create:e=>({[`MethodDefinition[key.name=${re([...F])}][value.body.body.length=0]`](t){T(t.parent.parent)&&e.report({node:t.key,messageId:"noEmptyLifecycleMethod"})}})});const Ge="prefer-on-push-component-change-detection";var We=ne({name:Ge,meta:{type:"suggestion",docs:{description:"Enforces component's change detection to ChangeDetectionStrategy.OnPush.",category:"Best Practices",recommended:!1},schema:[],messages:{preferOnPushComponentChangeDetection:"The changeDetection value of a component should be set to ChangeDetectionStrategy.OnPush"}},defaultOptions:[],create:e=>({[ie](t){const r=Q(t,"changeDetection");r?w(r.property)&&"OnPush"===r.property.name||e.report({node:r,messageId:"preferOnPushComponentChangeDetection"}):e.report({node:t,messageId:"preferOnPushComponentChangeDetection"})}})}),Ze=ne({name:"prefer-output-readonly",meta:{type:"suggestion",docs:{description:"Prefer to declare `@Output` as readonly since they are not supposed to be reassigned",category:"Best Practices",recommended:!1},schema:[],messages:{preferOutputReadonly:"Prefer to declare `@Output` as readonly since they are not supposed to be reassigned"}},defaultOptions:[],create:e=>({'ClassProperty[readonly=undefined] > Decorator[expression.callee.name="Output"]'({parent:t}){e.report({node:t.key,messageId:"preferOutputReadonly"})}})});const Qe=/^\.{1,2}\/[^./]/;var Je=ne({name:"relative-url-prefix",meta:{type:"suggestion",docs:{description:"The ./ and ../ prefix is standard syntax for relative URLs; don't depend on Angular's current ability to do without that prefix. See more at https://angular.io/styleguide#style-05-04.",category:"Best Practices",recommended:!1},schema:[],messages:{relativeUrlPrefix:"The ./ and ../ prefix is standard syntax for relative URLs. (https://angular.io/styleguide#style-05-04)"}},defaultOptions:[],create:e=>({[ie](t){const r=Z(t,"templateUrl");r&&M(r.value)&&(Qe.test(r.value.value)||e.report({node:r.value,messageId:"relativeUrlPrefix"}));const n=Z(t,"styleUrls");n&&n.value&&P(n.value)&&n.value.elements.length>0&&n.value.elements.forEach(t=>{M(t)&&!Qe.test(t.value)&&e.report({node:t,messageId:"relativeUrlPrefix"})})}})});const Ke=["bootstrap","declarations","entryComponents","exports","imports","providers","schemas"];var Xe=ne({name:"sort-ngmodule-metadata-arrays",meta:{type:"suggestion",docs:{description:"Enforces ASC alphabetical order for NgModule metadata arrays for easy visual scanning",category:"Best Practices",recommended:!1},schema:[],messages:{sortNgmoduleMetadataArrays:"NgModule metadata arrays should be sorted in ASC alphabetical order"}},defaultOptions:[],create:e=>({'ClassDeclaration > Decorator[expression.callee.name="NgModule"]'(t){Ke.forEach(r=>{const n=Q(t,r);if(!n||!P(n)||n.elements.length<2)return;const o=n.elements.filter(w).find(({name:e},t,r)=>{var n;const o=null==(n=r[t+1])?void 0:n.name;return o&&1===e.localeCompare(o)});o&&e.report({messageId:"sortNgmoduleMetadataArrays",node:o})})}})}),Ye=ne({name:"use-component-selector",meta:{type:"suggestion",docs:{description:"Component selector must be declared",category:"Best Practices",recommended:!1},schema:[],messages:{useComponentSelector:"The selector of the component '{{className}}' is mandatory"}},defaultOptions:[],create:e=>({[ie](t){const r=t.parent;if(!r||!r.id||!r.id.name)return;const n=Q(t,"selector");n&&M(n)&&n.value.length||e.report({node:t,messageId:"useComponentSelector",data:{className:r.id.name}})}})}),_e=ne({name:"use-component-view-encapsulation",meta:{type:"suggestion",docs:{description:"Disallows using ViewEncapsulation.None",category:"Best Practices",recommended:!1},schema:[],messages:{useComponentViewEncapsulation:"Using ViewEncapsulation.None makes your styles global, which may have an unintended effect"}},defaultOptions:[],create:e=>({[ie](t){const r=Q(t,"encapsulation");!r||D(r)&&w(r.property)&&"None"!==r.property.name||e.report({node:r,messageId:"useComponentViewEncapsulation"})}})}),et=ne({name:"use-injectable-provided-in",meta:{type:"suggestion",docs:{description:`"Using the 'providedIn' property makes classes decorated with @${o.Injectable} tree shakeable`,category:"Best Practices",recommended:!1},schema:[],messages:{useInjectableProvidedIn:`Classes decorated with @${o.Injectable} should use the 'providedIn' property`}},defaultOptions:[],create:e=>({'ClassDeclaration > Decorator[expression.callee.name="Injectable"]'(t){Q(t,"providedIn")||e.report({node:t,messageId:"useInjectableProvidedIn"})}})}),tt=ne({name:"use-lifecycle-interface",meta:{type:"suggestion",docs:{description:"Ensures that classes implement lifecycle interfaces corresponding to the declared lifecycle methods",category:"Best Practices",recommended:"warn"},schema:[],messages:{useLifecycleInterface:"Lifecycle interface '{{interfaceName}}' should be implemented for method '{{methodName}}'. (https://angular.io/styleguide#style-09-01)"}},defaultOptions:[],create:e=>({[`MethodDefinition[key.name=${re([...F])}]`]({key:t,parent:r}){const n=r.parent;if(!T(n))return;const o=q(n),a=t.name,s=(e=>e.slice(2))(a);o.includes(c[s])||e.report({node:t,messageId:"useLifecycleInterface",data:{interfaceName:s,methodName:a}})}})}),rt=ne({name:"use-pipe-transform-interface",meta:{type:"suggestion",docs:{description:"Ensures that Pipes implement `PipeTransform` interface",category:"Best Practices",recommended:"error"},fixable:"code",schema:[],messages:{usePipeTransformInterface:"Pipes should implement `PipeTransform` interface"}},defaultOptions:[],create:e=>({[ce]({parent:t}){if(R(t).find(e=>"PipeTransform"===e))return;const{errorNode:r,implementsNodeReplace:n,implementsTextReplace:o}=function(e){const t=e.id,[r,n,o]=e.implements?[t,ot(e.implements),", PipeTransform"]:[t,t," implements PipeTransform"];return{errorNode:r,implementsNodeReplace:n,implementsTextReplace:o}}(t);e.report({node:r,messageId:"usePipeTransformInterface",fix:e=>[nt(t,e),e.insertTextAfter(n,o)]})}})});function nt(e,t){const r=function(e,t){let r=e;for(;r=r.parent;)if("Program"===r.type)return r.body.find(e=>A(e)&&"@angular/core"===e.source.value);return r}(e);if(null==r||!r.specifiers.length)return t.insertTextAfterRange([0,0],"import { PipeTransform } from '@angular/core';\n");const n=ot(r.specifiers);return t.insertTextAfter(n,", PipeTransform")}function ot(e){return e.slice(-1)[0]}var at=ne({name:"pipe-prefix",meta:{type:"suggestion",docs:{description:"Enforce consistent prefix for pipes.",category:"Stylistic Issues",recommended:!1},schema:[{type:"object",properties:{prefixes:{type:"array",items:{type:"string"},minimum:1,uniqueItems:!0}},additionalProperties:!1}],messages:{pipePrefix:"@Pipe's name should be prefixed by {{prefixes}}"}},defaultOptions:[{prefixes:[]}],create:(e,[{prefixes:t}])=>({[ce](r){const n=Q(r,"name");if(!n)return;if(!function(e){return Array.isArray(e)&&e.length>0}(t))return;const o=t.join("|"),a=_.prefix(o,"camelCase");let s;M(n)?s=n.value:S(n)&&n.quasis[0]&&(s=n.quasis[0].value.raw),s&&(a.apply(this,[s])||e.report({node:n,messageId:"pipePrefix",data:{prefixes:te(t)}}))}})});module.exports={configs:{all:{extends:"./configs/base.json",rules:{"@angular-eslint/component-class-suffix":"error","@angular-eslint/component-max-inline-declarations":"error","@angular-eslint/component-selector":"error","@angular-eslint/contextual-decorator":"error","@angular-eslint/contextual-lifecycle":"error","@angular-eslint/directive-class-suffix":"error","@angular-eslint/directive-selector":"error","@angular-eslint/no-attribute-decorator":"error","@angular-eslint/no-conflicting-lifecycle":"error","@angular-eslint/no-empty-lifecycle-method":"error","@angular-eslint/no-forward-ref":"error","@angular-eslint/no-host-metadata-property":"error","@angular-eslint/no-input-prefix":"error","@angular-eslint/no-input-rename":"error","@angular-eslint/no-inputs-metadata-property":"error","@angular-eslint/no-lifecycle-call":"error","@angular-eslint/no-output-native":"error","@angular-eslint/no-output-on-prefix":"error","@angular-eslint/no-output-rename":"error","@angular-eslint/no-outputs-metadata-property":"error","@angular-eslint/no-pipe-impure":"error","@angular-eslint/no-queries-metadata-property":"error","@angular-eslint/pipe-prefix":"error","@angular-eslint/prefer-on-push-component-change-detection":"error","@angular-eslint/prefer-output-readonly":"error","@angular-eslint/relative-url-prefix":"error","@angular-eslint/sort-ngmodule-metadata-arrays":"error","@angular-eslint/use-component-selector":"error","@angular-eslint/use-component-view-encapsulation":"error","@angular-eslint/use-injectable-provided-in":"error","@angular-eslint/use-lifecycle-interface":"error","@angular-eslint/use-pipe-transform-interface":"error"}},base:{parser:"@typescript-eslint/parser",parserOptions:{ecmaVersion:2020,sourceType:"module",project:"./tsconfig.json"},plugins:["@typescript-eslint","@angular-eslint"]},recommended:{extends:"./configs/base.json",rules:{"@angular-eslint/component-class-suffix":"error","@angular-eslint/contextual-lifecycle":"error","@angular-eslint/directive-class-suffix":"error","@angular-eslint/no-conflicting-lifecycle":"error","@angular-eslint/no-empty-lifecycle-method":"error","@angular-eslint/no-host-metadata-property":"error","@angular-eslint/no-input-rename":"error","@angular-eslint/no-inputs-metadata-property":"error","@angular-eslint/no-output-native":"error","@angular-eslint/no-output-on-prefix":"error","@angular-eslint/no-output-rename":"error","@angular-eslint/no-outputs-metadata-property":"error","@angular-eslint/use-lifecycle-interface":"warn","@angular-eslint/use-pipe-transform-interface":"error"}},"recommended--extra":{extends:"./configs/base.json",rules:{"no-restricted-imports":["error",{paths:[{name:"rxjs/Rx",message:"Please import directly from 'rxjs' instead"}]}],"@typescript-eslint/member-ordering":["error",{default:["static-field","instance-field","static-method","instance-method"]}],"no-restricted-syntax":["error",{selector:'CallExpression[callee.object.name="console"][callee.property.name=/^(debug|info|time|timeEnd|trace)$/]',message:"Unexpected property on console object was called"}],"@typescript-eslint/no-inferrable-types":["error",{ignoreParameters:!0}],"@typescript-eslint/no-non-null-assertion":"error","no-fallthrough":"error"}},"ng-cli-compat":{extends:["./configs/base.json"],env:{browser:!0,es6:!0,node:!0},plugins:["eslint-plugin-import","eslint-plugin-jsdoc","eslint-plugin-prefer-arrow"],rules:{"@typescript-eslint/interface-name-prefix":"off","@typescript-eslint/explicit-member-accessibility":"off","sort-keys":"off","@angular-eslint/component-class-suffix":"error","@angular-eslint/component-selector":["error",{type:"element",prefix:"app",style:"kebab-case"}],"@angular-eslint/contextual-lifecycle":"error","@angular-eslint/directive-class-suffix":"error","@angular-eslint/directive-selector":["error",{type:"attribute",prefix:"app",style:"camelCase"}],"@angular-eslint/no-conflicting-lifecycle":"error","@angular-eslint/no-host-metadata-property":"error","@angular-eslint/no-input-rename":"error","@angular-eslint/no-inputs-metadata-property":"error","@angular-eslint/no-output-native":"error","@angular-eslint/no-output-on-prefix":"error","@angular-eslint/no-output-rename":"error","@angular-eslint/no-outputs-metadata-property":"error","@angular-eslint/use-lifecycle-interface":"error","@angular-eslint/use-pipe-transform-interface":"error","@typescript-eslint/adjacent-overload-signatures":"error","@typescript-eslint/array-type":"off","@typescript-eslint/ban-types":["error",{types:{Object:{message:"Avoid using the `Object` type. Did you mean `object`?"},Function:{message:"Avoid using the `Function` type. Prefer a specific function type, like `() => void`."},Boolean:{message:"Avoid using the `Boolean` type. Did you mean `boolean`?"},Number:{message:"Avoid using the `Number` type. Did you mean `number`?"},String:{message:"Avoid using the `String` type. Did you mean `string`?"},Symbol:{message:"Avoid using the `Symbol` type. Did you mean `symbol`?"}}}],"@typescript-eslint/consistent-type-assertions":"error","@typescript-eslint/dot-notation":"error","@typescript-eslint/member-ordering":"error","@typescript-eslint/naming-convention":"error","@typescript-eslint/no-empty-function":"off","@typescript-eslint/no-empty-interface":"error","@typescript-eslint/no-explicit-any":"off","@typescript-eslint/no-inferrable-types":["error",{ignoreParameters:!0}],"@typescript-eslint/no-misused-new":"error","@typescript-eslint/no-namespace":"error","@typescript-eslint/no-non-null-assertion":"error","@typescript-eslint/no-parameter-properties":"off","@typescript-eslint/no-unused-expressions":"error","@typescript-eslint/no-use-before-define":"off","@typescript-eslint/no-var-requires":"off","@typescript-eslint/prefer-for-of":"error","@typescript-eslint/prefer-function-type":"error","@typescript-eslint/prefer-namespace-keyword":"error","@typescript-eslint/triple-slash-reference":["error",{path:"always",types:"prefer-import",lib:"always"}],"@typescript-eslint/unified-signatures":"error",complexity:"off","constructor-super":"error",eqeqeq:["error","smart"],"guard-for-in":"error","id-blacklist":["error","any","Number","number","String","string","Boolean","boolean","Undefined","undefined"],"id-match":"error","import/no-deprecated":"warn","jsdoc/newline-after-description":"error","jsdoc/no-types":"error","max-classes-per-file":"off","no-bitwise":"error","no-caller":"error","no-cond-assign":"error","no-console":["error",{allow:["log","warn","dir","timeLog","assert","clear","count","countReset","group","groupEnd","table","dirxml","error","groupCollapsed","Console","profile","profileEnd","timeStamp","context"]}],"no-debugger":"error","no-empty":"off","no-eval":"error","no-fallthrough":"error","no-invalid-this":"off","no-new-wrappers":"error","no-restricted-imports":["error",{name:"rxjs/Rx",message:"Please import directly from 'rxjs' instead"}],"@typescript-eslint/no-shadow":["error",{hoist:"all"}],"no-throw-literal":"error","no-undef-init":"error","no-underscore-dangle":"error","no-unsafe-finally":"error","no-unused-labels":"error","no-var":"error","object-shorthand":"error","one-var":["error","never"],"prefer-arrow/prefer-arrow-functions":"error","prefer-const":"error",radix:"error","use-isnan":"error","valid-typeof":"off"}},"ng-cli-compat--formatting-add-on":{plugins:["eslint-plugin-jsdoc"],rules:{"arrow-body-style":"error","arrow-parens":"off","comma-dangle":"off",curly:"error","eol-last":"error","jsdoc/check-alignment":"error","max-len":["error",{code:140}],"new-parens":"error","no-multiple-empty-lines":"off","no-trailing-spaces":"error","quote-props":["error","as-needed"],"space-before-function-paren":["error",{anonymous:"never",asyncArrow:"always",named:"never"}],"@typescript-eslint/member-delimiter-style":["error",{multiline:{delimiter:"semi",requireLast:!0},singleline:{delimiter:"semi",requireLast:!1}}],quotes:"off","@typescript-eslint/quotes":["error","single",{allowTemplateLiterals:!0}],"@typescript-eslint/semi":["error","always"],"@typescript-eslint/type-annotation-spacing":"error"}}},rules:{"contextual-decorator":oe,"component-class-suffix":pe,"component-max-inline-declarations":me,"component-selector":we,"contextual-lifecycle":De,"directive-class-suffix":Ie,"directive-selector":Oe,"no-attribute-decorator":Pe,"no-conflicting-lifecycle":Ae,"no-forward-ref":je,"no-host-metadata-property":Me,"no-input-prefix":Ee,"no-input-rename":Be,"no-inputs-metadata-property":Te,"no-lifecycle-call":$e,"no-output-native":Le,"no-output-on-prefix":Re,"no-output-rename":qe,"no-outputs-metadata-property":Ue,"no-pipe-impure":Fe,"no-queries-metadata-property":He,"no-empty-lifecycle-method":ze,[Ge]:We,"prefer-output-readonly":Ze,"relative-url-prefix":Je,"sort-ngmodule-metadata-arrays":Xe,"use-component-selector":Ye,"use-component-view-encapsulation":_e,"use-injectable-provided-in":et,"use-lifecycle-interface":tt,"use-pipe-transform-interface":rt,"pipe-prefix":at}};