@ls-stack/extended-lint 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var ce=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var wt=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Rt=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of xt(t))!Tt.call(e,l)&&l!==n&&ce(e,l,{get:()=>t[l],enumerable:!(a=Et(t,l))||a.enumerable});return e};var It=e=>Rt(ce({},"__esModule",{value:!0}),e);var cn={};wt(cn,{extendedLintPlugin:()=>an});module.exports=It(cn);var J=require("@typescript-eslint/utils");var le=Symbol.for("optional");function q(e){return{...e,[le]:!0}}function Ae(e,t){return{enum:e,...t}}function $e(e){return{...e,type:"boolean"}}function _(e){return{...e,type:"string"}}function De(e){return{...e,type:"number"}}function Oe(e){return{...e,type:"integer"}}function X(e,t){return{...t,type:"array",items:e}}function W(e,t){let n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let a,l=[];for(a in e)e[a][le]?e[a][le]=void 0:l.push(a);l.length>0&&(n.required=l)}return n}function ue(...e){return{anyOf:e}}var kt=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ct=W({disallow:q(X(W({selector:_(),message:_(),replace:q(ue(_(),W({regex:_(),with:_()}))),replaceType:q(Ae(["suggestion","autofix"]))}))),__dev_simulateFileName:q(_()),mustMatchSyntax:q(X(W({includeRegex:_(),mustCallFn:X(W({anyCall:X(W({fn:_(),withArgs:X(W({pos:Oe(),literal:ue(_(),De(),$e())}))})),message:_()}))})))}),_e="advanced-no-restricted-syntax",vt=kt({name:_e,meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ct],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e){let t={},{mustMatchSyntax:n,__dev_simulateFileName:a,disallow:l}=e.options[0],E=a??e.filename,c=[],y=new Set;for(let{includeRegex:s,mustCallFn:f}of n??[]){let T=At(E,new RegExp(s));if(!T)continue;let w=F=>{let A=F;for(let{name:b,value:p}of T)A=A.replaceAll(b,p);return A};for(let{anyCall:F,message:A}of f)y.add(A),c.push(b=>{let{callee:p}=b;if(p.type===J.AST_NODE_TYPES.Identifier){for(let{fn:O,withArgs:R}of F)if(p.name===O){y.delete(A);for(let S of R){let u=b.arguments[S.pos];if(!u){e.report({node:b,messageId:"default",data:{message:`Missing required argument at position ${S.pos}: ${w(A)}`}});continue}if(u.type!==J.AST_NODE_TYPES.Literal){e.report({node:u,messageId:"default",data:{message:`Argument at position ${S.pos} should be a literal: ${w(A)}`}});continue}let v=typeof S.literal=="string"?w(S.literal):S.literal;u.value!==v&&e.report({node:u,messageId:"default",data:{message:`Invalid argument value: ${w(A)}`}})}break}}})}for(let{selector:s,message:f,replace:T,replaceType:w="suggestion"}of l??[]){if(s==="CallExpression"){c.push(F=>{i(T,F,f,w)});continue}t[s]=F=>{i(T,F,f,w)}}return c.length>0&&(t.CallExpression=s=>{if(s.type===J.AST_NODE_TYPES.CallExpression)for(let f of c)f(s)}),t["Program:exit"]=s=>{for(let f of y)e.report({node:s,messageId:"default",data:{message:`Missing required call: ${f}`}})},t;function i(s,f,T,w){let F=A=>{if(!s)return null;if(typeof s=="string")return A.replaceText(f,s);{let b=new RegExp(s.regex),p=e.sourceCode.getText(f);return A.replaceText(f,p.replace(b,s.with))}};e.report({node:f,messageId:"default",data:{message:T},fix:s&&w==="autofix"?F:void 0,suggest:s&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof s=="string"?s:s.with}"`},fix:F}]:void 0})}}});function At(e,t){let n=[],a=t.exec(e);if(!a)return null;let[l,...E]=a;n.push({name:"$0_lowercase",value:l.toLowerCase()}),n.push({name:"$0_capitalize",value:Me(l)}),n.push({name:"$0_uncapitalize",value:Pe(l)}),n.push({name:"$0",value:l});for(let c=0;c<E.length;c++){let y=`$${c+1}`,i=E[c];n.push({name:`${y}_lowercase`,value:i.toLowerCase()}),n.push({name:`${y}_capitalize`,value:Me(i)}),n.push({name:`${y}_uncapitalize`,value:Pe(i)}),n.push({name:y,value:i})}return n}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Pe(e){return e.charAt(0).toLowerCase()+e.slice(1)}var fe={name:_e,rule:vt};var $t=/eslint +react-compiler\/react-compiler: +\["error/,Le={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let p of e.sourceCode.getAllComments())if($t.test(p.value))return{}}let t=typeof e.getSource=="function"?p=>t(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,E={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function c(p){l&&Array.isArray(p.suggest)&&p.suggest.length>0&&(p.fix=p.suggest[0].fix),e.report(p)}let y=e.getSourceCode().scopeManager,i=new WeakMap,s=new WeakSet,f=new WeakMap,T=new WeakMap,w=new WeakSet;function F(p,O){return function(R){if(O.has(R))return O.get(R);let S=p(R);return O.set(R,S),S}}function A(p,O,R,S,u){u&&p.async&&c({node:p,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ "use strict";var ce=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var wt=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Rt=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of xt(t))!Tt.call(e,l)&&l!==n&&ce(e,l,{get:()=>t[l],enumerable:!(a=Et(t,l))||a.enumerable});return e};var It=e=>Rt(ce({},"__esModule",{value:!0}),e);var cn={};wt(cn,{extendedLintPlugin:()=>an});module.exports=It(cn);var J=require("@typescript-eslint/utils");var le=Symbol.for("optional");function z(e){return{...e,[le]:!0}}function $e(e,t){return{enum:e,...t}}function Ae(e){return{...e,type:"boolean"}}function _(e){return{...e,type:"string"}}function De(e){return{...e,type:"number"}}function Oe(e){return{...e,type:"integer"}}function X(e,t){return{...t,type:"array",items:e}}function W(e,t){let n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let a,l=[];for(a in e)e[a][le]?e[a][le]=void 0:l.push(a);l.length>0&&(n.required=l)}return n}function ue(...e){return{anyOf:e}}var kt=J.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ct=W({disallow:z(X(W({selector:_(),message:_(),replace:z(ue(_(),W({regex:_(),with:_()}))),replaceType:z($e(["suggestion","autofix"]))}))),__dev_simulateFileName:z(_()),mustMatchSyntax:z(X(W({includeRegex:_(),mustCallFn:X(W({anyCall:X(W({fn:_(),withArgs:X(W({atIndex:Oe(),literal:ue(_(),De(),Ae())}))})),message:z(_())}))})))}),_e="advanced-no-restricted-syntax",vt=kt({name:_e,meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[Ct],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e){let t={},{mustMatchSyntax:n,__dev_simulateFileName:a,disallow:l}=e.options[0],E=a??e.filename,c=[],y=new Set;for(let{includeRegex:s,mustCallFn:f}of n??[]){let R=$t(E,new RegExp(s));if(!R)continue;let I=F=>{let $=F;for(let{name:b,value:p}of R)$=$.replaceAll(b,p);return $};for(let{anyCall:F,message:$}of f){let b=`Expected file to call the function: ${F.map(({fn:p})=>p).join(" or ")}`;y.add(b),c.push(p=>{let{callee:O}=p;if(O.type===J.AST_NODE_TYPES.Identifier){for(let{fn:k,withArgs:A}of F)if(O.name===k){y.delete(b);for(let u of A){let S=p.arguments[u.atIndex],w=typeof u.literal=="string"?I(u.literal):u.literal;if(!S){e.report({node:p,messageId:"default",data:{message:`Missing argument with value "${w}" at index ${u.atIndex}${$?`: ${I($)}`:""}`}});continue}if(S.type!==J.AST_NODE_TYPES.Literal){e.report({node:S,messageId:"default",data:{message:`Argument at position ${u.atIndex} should the literal "${w}"${$?`: ${I($)}`:""}`}});continue}S.value!==w&&e.report({node:S,messageId:"default",data:{message:`Argument should have the value "${w}"${$?`: ${I($)}`:""}`},fix:x=>x.replaceText(S,typeof w=="string"?`'${w}'`:String(w))})}break}}})}}for(let{selector:s,message:f,replace:R,replaceType:I="suggestion"}of l??[]){if(s==="CallExpression"){c.push(F=>{i(R,F,f,I)});continue}t[s]=F=>{i(R,F,f,I)}}return c.length>0&&(t.CallExpression=s=>{if(s.type===J.AST_NODE_TYPES.CallExpression)for(let f of c)f(s)}),t["Program:exit"]=s=>{for(let f of y)e.report({node:s,messageId:"default",data:{message:`${f}`}})},t;function i(s,f,R,I){let F=$=>{if(!s)return null;if(typeof s=="string")return $.replaceText(f,s);{let b=new RegExp(s.regex),p=e.sourceCode.getText(f);return $.replaceText(f,p.replace(b,s.with))}};e.report({node:f,messageId:"default",data:{message:R},fix:s&&I==="autofix"?F:void 0,suggest:s&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof s=="string"?s:s.with}"`},fix:F}]:void 0})}}});function $t(e,t){let n=[],a=t.exec(e);if(!a)return null;let[l,...E]=a;n.push({name:"$0_lowercase",value:l.toLowerCase()}),n.push({name:"$0_capitalize",value:Me(l)}),n.push({name:"$0_uncapitalize",value:Pe(l)}),n.push({name:"$0",value:l});for(let c=0;c<E.length;c++){let y=`$${c+1}`,i=E[c];n.push({name:`${y}_lowercase`,value:i.toLowerCase()}),n.push({name:`${y}_capitalize`,value:Me(i)}),n.push({name:`${y}_uncapitalize`,value:Pe(i)}),n.push({name:y,value:i})}return n}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Pe(e){return e.charAt(0).toLowerCase()+e.slice(1)}var fe={name:_e,rule:vt};var At=/eslint +react-compiler\/react-compiler: +\["error/,Le={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let p of e.sourceCode.getAllComments())if(At.test(p.value))return{}}let t=typeof e.getSource=="function"?p=>t(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,E={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function c(p){l&&Array.isArray(p.suggest)&&p.suggest.length>0&&(p.fix=p.suggest[0].fix),e.report(p)}let y=e.getSourceCode().scopeManager,i=new WeakMap,s=new WeakSet,f=new WeakMap,R=new WeakMap,I=new WeakSet;function F(p,O){return function(k){if(O.has(k))return O.get(k);let A=p(k);return O.set(k,A),A}}function $(p,O,k,A,u){u&&p.async&&c({node:p,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
2
2
 
3
3
  useEffect(() => {
4
4
  async function fetchData() {
@@ -9,4 +9,4 @@ useEffect(() => {
9
9
  fetchData();
10
10
  }, [someId]); // Or [] if effect doesn't need props or state
11
11
 
12
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let v=y.acquire(p),D=new Set,I=null;{let r=v.upper;for(;r&&(D.add(r),r.type!=="function");)r=r.upper;if(!r)return;I=r}let M=Array.isArray;function k(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node.type!=="VariableDeclarator")return!1;let m=o.node.init;if(m==null)return!1;for(;m.type==="TSAsExpression";)m=m.expression;let d=o.node.parent;if(d==null&&(de(I.block,o.node.id),d=o.node.parent,d==null))return!1;if(d.kind==="const"&&m.type==="Literal"&&(typeof m.value=="string"||typeof m.value=="number"||m.value===null))return!0;if(m.type!=="CallExpression")return!1;let h=m.callee;if(h.type==="MemberExpression"&&h.object.name==="React"&&h.property!=null&&!h.computed&&(h=h.property),h.type!=="Identifier")return!1;let g=o.node.id,{name:x}=h;if(x==="useRef"&&g.type==="Identifier")return!0;if(Pt(h)&&g.type==="Identifier"){for(let C of r.references)C!==g&&w.add(C.identifier);return!0}else if(x==="useState"||x==="useReducer"){if(g.type==="ArrayPattern"&&g.elements.length===2&&M(r.identifiers)){if(g.elements[1]===r.identifiers[0]){if(x==="useState"){let C=r.references,L=0;for(let U=0;U<C.length;U++){if(C[U].isWrite()&&L++,L>1)return!1;i.set(C[U].identifier,g.elements[0])}}return!0}else if(g.elements[0]===r.identifiers[0]){if(x==="useState"){let C=r.references;for(let L=0;L<C.length;L++)s.add(C[L].identifier)}return!1}}}else if(x==="useTransition"&&g.type==="ArrayPattern"&&g.elements.length===2&&Array.isArray(r.identifiers)&&g.elements[1]===r.identifiers[0])return!0;return!1}function P(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node==null||o.node.id==null)return!1;let m=o.node,d=I.childScopes,h=null,g;for(g=0;g<d.length;g++){let x=d[g],C=x.block;if(m.type==="FunctionDeclaration"&&C===m||m.type==="VariableDeclarator"&&C.parent===m){h=x;break}}if(h==null)return!1;for(g=0;g<h.through.length;g++){let x=h.through[g];if(x.resolved!=null&&D.has(x.resolved.scope)&&!H(x.resolved))return!1}return!0}let H=F(k,f),mt=F(P,T),Re=new Map;function dt(r){let o=r.from,m=!1;for(;o.block!==p;)o.type==="function"&&(m=o.block.parent!=null&&o.block.parent.type==="ReturnStatement"),o=o.upper;return m}let j=new Map,se=new Map;Ie(v);function Ie(r){for(let o of r.references){if(!o.resolved||!D.has(o.resolved.scope))continue;let m=de(p,o.identifier),d=He(m),h=z(d,se);if(u&&d.type==="Identifier"&&(d.parent.type==="MemberExpression"||d.parent.type==="OptionalMemberExpression")&&!d.parent.computed&&d.parent.property.type==="Identifier"&&d.parent.property.name==="current"&&dt(o)&&Re.set(h,{reference:o,dependencyNode:d}),d.parent.type==="TSTypeQuery"||d.parent.type==="TSTypeReference")continue;let g=o.resolved.defs[0];if(g!=null&&!(g.node!=null&&g.node.init===p.parent)&&g.type!=="TypeParameter")if(j.has(h))j.get(h).references.push(o);else{let x=o.resolved,C=H(x)||mt(x);j.set(h,{isStable:C,references:[o]})}}for(let o of r.childScopes)Ie(o)}Re.forEach(({reference:r,dependencyNode:o},m)=>{let d=r.resolved.references,h=!1;for(let g=0;g<d.length;g++){let{identifier:x}=d[g],{parent:C}=x;if(C!=null&&C.type==="MemberExpression"&&!C.computed&&C.property.type==="Identifier"&&C.property.name==="current"&&C.parent.type==="AssignmentExpression"&&C.parent.left===C){h=!0;break}}h||c({node:o.parent.property,message:`The ref value '${m}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${m}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function yt(r,o){ie.has(o)||(ie.add(o),c({node:r,message:`Assignments to the '${o}' variable from inside React Hook ${t(R)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${t(R)}.`}))}let ee=new Set;if(j.forEach(({isStable:r,references:o},m)=>{r&&ee.add(m),o.forEach(d=>{d.writeExpr&&yt(d.writeExpr,m)})}),ie.size>0)return;if(!O){let r=null;if(j.forEach(({isStable:o,references:m},d)=>{r||m.forEach(h=>{if(r)return;let g=h.identifier;if(!i.has(g))return;let C=h.from;for(;C.type!=="function";)C=C.upper;C.block===p&&(r=d)})}),r){let{suggestedDependencies:o}=pe({dependencies:j,declaredDependencies:[],stableDependencies:ee,externalDependencies:new Set,isEffect:!0});c({node:R,message:`React Hook ${S} contains a call to '${r}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+o.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${o.join(", ")}]`,fix(m){return m.insertTextAfter(p,`, [${o.join(", ")}]`)}}]})}return}let Y=[],Z=new Set;O.type!=="ArrayExpression"?c({node:O,message:`React Hook ${t(R)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):O.elements.forEach(r=>{if(r===null)return;if(r.type==="SpreadElement"){c({node:r,message:`React Hook ${t(R)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}w.has(r)&&c({node:r,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${t(r)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${t(r)}\``,fix(h){return h.removeRange(r.range)}}]});let o;try{o=z(r,se)}catch(h){if(/Unsupported node type/.test(h.message)){r.type==="Literal"?j.has(r.value)?c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. Did you mean to include ${r.value} in the array instead?`}):c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):c({node:r,message:`React Hook ${t(R)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw h}let m=r;for(;m.type==="MemberExpression"||m.type==="OptionalMemberExpression"||m.type==="ChainExpression";)m=m.object||m.expression.object;let d=!I.through.some(h=>h.identifier===m);Y.push({key:o,node:r}),d||Z.add(o)});let{suggestedDependencies:gt,unnecessaryDependencies:te,missingDependencies:B,duplicateDependencies:ke}=pe({dependencies:j,declaredDependencies:Y,stableDependencies:ee,externalDependencies:Z,isEffect:u}),ne=gt;if(ke.size+B.size+te.size===0){Dt({declaredDependencies:Y,declaredDependenciesNode:O,componentScope:I,scope:v}).forEach(({construction:o,isUsedOutsideOfHook:m,depType:d})=>{let h=d==="function"?"useCallback":"useMemo",g=d==="function"?"definition":"initialization",x=`wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,C=m?`To fix this, ${x}`:`Move it inside the ${S} callback. Alternatively, ${x}`,L=d==="conditional"||d==="logical expression"?"could make":"makes",U=`The '${o.name.name}' ${d} ${L} the dependencies of ${S} Hook (at line ${O.loc.start.line}) change on every render. ${C}`,Ce;m&&o.type==="Variable"&&d==="function"&&(Ce=[{desc:`Wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,fix(ve){let[bt,St]=h==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ve.insertTextBefore(o.node.init,bt),ve.insertTextAfter(o.node.init,St)]}}]),c({node:o.node,message:U,suggest:Ce})});return}!u&&B.size>0&&(ne=pe({dependencies:j,declaredDependencies:[],stableDependencies:ee,externalDependencies:Z,isEffect:u}).suggestedDependencies);function ht(){if(Y.length===0)return!0;let r=Y.map(m=>m.key),o=r.slice().sort();return r.join(",")===o.join(",")}ht()&&ne.sort();function oe(r){let o=r.split("."),m="";for(let d=0;d<o.length;d++){if(d!==0){let h=o.slice(0,d+1).join("."),g=se.get(h)===!0;m+=g?"?.":"."}m+=o[d]}return m}function ae(r,o,m,d){return r.size===0?null:(r.size>1?"":o+" ")+m+" "+(r.size>1?"dependencies":"dependency")+": "+Ft(Array.from(r).sort().map(h=>"'"+oe(h)+"'"))+`. Either ${d} ${r.size>1?"them":"it"} or remove the dependency array.`}let N="";if(te.size>0){let r=null;if(Array.from(te.keys()).forEach(o=>{r===null&&o.endsWith(".current")&&(r=o)}),r!==null)N=` Mutable values like '${r}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Z.size>0){let o=Array.from(Z)[0];v.set.has(o)||(N=` Outer scope values like '${o}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!N&&B.has("props")){let r=j.get("props");if(r==null)return;let o=r.references;if(!Array.isArray(o))return;let m=!0;for(let d=0;d<o.length;d++){let h=o[d],g=de(I.block,h.identifier);if(!g){m=!1;break}let x=g.parent;if(x==null){m=!1;break}if(x.type!=="MemberExpression"&&x.type!=="OptionalMemberExpression"){m=!1;break}}m&&(N=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${S} call and refer to those specific props inside ${t(R)}.`)}if(!N&&B.size>0){let r=null;B.forEach(o=>{if(r)return;let m=I.set.get(o),d=j.get(o);if(d.references[0].resolved!==m)return;let h=m.defs[0];if(h==null||h.name==null||h.type!=="Parameter")return;let g=!1,x;for(let C=0;C<d.references.length;C++)if(x=d.references[C].identifier,x!=null&&x.parent!=null&&(x.parent.type==="CallExpression"||x.parent.type==="OptionalCallExpression")&&x.parent.callee===x){g=!0;break}g&&(r=o)}),r!==null&&(N=` If '${r}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!N&&B.size>0){let r=null;if(B.forEach(o=>{if(r!==null)return;let d=j.get(o).references,h,g;for(let x=0;x<d.length;x++){for(h=d[x].identifier,g=h.parent;g!=null&&g!==I.block;){if(g.type==="CallExpression"){let C=i.get(g.callee);if(C!=null){if(C.name===o)r={missingDep:o,setter:g.callee.name,form:"updater"};else if(s.has(h))r={missingDep:o,setter:g.callee.name,form:"reducer"};else{let L=d[x].resolved;if(L!=null){let U=L.defs[0];U!=null&&U.type==="Parameter"&&(r={missingDep:o,setter:g.callee.name,form:"inlineReducer"})}}break}}g=g.parent}if(r!==null)break}}),r!==null)switch(r.form){case"reducer":N=` You can also replace multiple useState variables with useReducer if '${r.setter}' needs the current value of '${r.missingDep}'.`;break;case"inlineReducer":N=` If '${r.setter}' needs the current value of '${r.missingDep}', you can also switch to useReducer instead of useState and read '${r.missingDep}' in the reducer.`;break;case"updater":N=` You can also do a functional update '${r.setter}(${r.missingDep.slice(0,1)} => ...)' if you only need '${r.missingDep}' in the '${r.setter}' call.`;break;default:throw new Error("Unknown case.")}}c({node:O,message:`React Hook ${t(R)} has `+(ae(B,"a","missing","include")||ae(te,"an","unnecessary","exclude")||ae(ke,"a","duplicate","omit"))+N,suggest:[{desc:`Update the dependencies array to be: [${ne.map(oe).join(", ")}]`,fix(r){return r.replaceText(O,`[${ne.map(oe).join(", ")}]`)}}]})}function b(p){let O=Ot(p.callee,E);if(O===-1)return;let R=p.arguments[O],S=p.callee,u=Ne(S).name,v=p.arguments[O+1],D=/Effect($|[^a-z])/g.test(u);if(!R){c({node:S,message:`React Hook ${u} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!v&&!D){(u==="useMemo"||u==="useCallback")&&c({node:S,message:`React Hook ${u} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(R.type){case"FunctionExpression":case"ArrowFunctionExpression":A(R,v,S,u,D);return;case"Identifier":if(!v||v.elements&&v.elements.some(k=>k&&k.type==="Identifier"&&k.name===R.name))return;let I=n(p).set.get(R.name);if(I==null||I.defs==null)return;let M=I.defs[0];if(!M||!M.node||M.type!=="Variable"&&M.type!=="FunctionName")break;switch(M.node.type){case"FunctionDeclaration":A(M.node,v,S,u,D);return;case"VariableDeclarator":let k=M.node.init;if(!k)break;switch(k.type){case"ArrowFunctionExpression":case"FunctionExpression":A(k,v,S,u,D);return}break}break;default:c({node:S,message:`React Hook ${u} received a function whose dependencies are unknown. Pass an inline function instead.`});return}c({node:S,message:`React Hook ${u} has a missing dependency: '${R.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${R.name}]`,fix(I){return I.replaceText(v,`[${R.name}]`)}}]})}return{CallExpression:b}}};function pe({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:a,isEffect:l}){let E=c();function c(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,p)=>{let O=y(E,p);O.isUsed=!0,i(E,p,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let p=y(E,b);p.isSatisfiedRecursively=!0}),n.forEach(b=>{let p=y(E,b);p.isSatisfiedRecursively=!0});function y(b,p){let O=p.split("."),R=b;for(let S of O){let u=R.children.get(S);u||(u=c(),R.children.set(S,u)),R=u}return R}function i(b,p,O){let R=p.split("."),S=b;for(let u of R){let v=S.children.get(u);if(!v)return;O(v),S=v}}let s=new Set,f=new Set;T(E,s,f,b=>b);function T(b,p,O,R){b.children.forEach((S,u)=>{let v=R(u);if(S.isSatisfiedRecursively){S.isSubtreeUsed&&O.add(v);return}if(S.isUsed){p.add(v);return}T(S,p,O,D=>v+"."+D)})}let w=[],F=new Set,A=new Set;return t.forEach(({key:b})=>{f.has(b)?w.indexOf(b)===-1?w.push(b):A.add(b):F.add(b)}),s.forEach(b=>{w.push(b)}),{suggestedDependencies:w,unnecessaryDependencies:F,duplicateDependencies:A,missingDependencies:s}}function G(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return G(e.consequent)!=null||G(e.alternate)!=null?"conditional":null;case"LogicalExpression":return G(e.left)!=null||G(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return G(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return G(e.expression);case"TSAsExpression":return G(e.expression)}return null}function Dt({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:a}){let l=e.map(({key:c})=>{let y=n.variables.find(s=>s.name===c);if(y==null)return null;let i=y.defs[0];if(i==null)return null;if(i.type==="Variable"&&i.node.type==="VariableDeclarator"&&i.node.id.type==="Identifier"&&i.node.init!=null){let s=G(i.node.init);if(s!=null)return[y,s]}return i.type==="FunctionName"&&i.node.type==="FunctionDeclaration"?[y,"function"]:i.type==="ClassName"&&i.node.type==="ClassDeclaration"?[y,"class"]:null}).filter(Boolean);function E(c){let y=!1;for(let i=0;i<c.references.length;i++){let s=c.references[i];if(s.writeExpr){if(y)return!0;y=!0;continue}let f=s.from;for(;f!==a&&f!=null;)f=f.upper;if(f!==a&&!We(t,s.identifier))return!0}return!1}return l.map(([c,y])=>({construction:c.defs[0],depType:y,isUsedOutsideOfHook:E(c)}))}function He(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?He(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function me(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function z(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=z(e.object,t),a=z(e.property,null),l=`${n}.${a}`;return me(e,t,l),l}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=z(e.object,t),a=z(e.property,null),l=`${n}.${a}`;return me(e,t,l),l}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let a=z(n.object,t),l=z(n.property,null),E=`${a}.${l}`;return me(n,t,E),E}else throw new Error(`Unsupported node type: ${e.type}`)}function Ne(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ot(e,t){let n=Ne(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let a;try{a=z(n,null)}catch(l){if(/Unsupported node type/.test(l.message))return 0;throw l}return t.additionalHooks.test(a)?0:-1}else return-1}}function de(e,t){let n=[e],a=null;for(;n.length;){if(a=n.shift(),Mt(a,t))return a;if(We(a,t))for(let[l,E]of Object.entries(a))l!=="parent"&&(je(E)?(E.parent=a,n.push(E)):Array.isArray(E)&&E.forEach(c=>{je(c)&&(c.parent=a,n.push(c))}))}return null}function Ft(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Mt(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function We(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Pt(e){return!1}var K=require("@typescript-eslint/utils"),_t=K.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ue="no-call-with-inferred-generics",jt=_t({name:Ue,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e){let t=e.options[0],n=new Map(t.functions.map(a=>[a.name,a]));return{CallExpression(a){let{callee:l}=a;if(l.type!==K.AST_NODE_TYPES.Identifier)return;let E=n.get(l.name);if(!E)return;let{minGenerics:c=1,allowAny:y,disallowTypes:i=t.disallowTypes}=E;(a.typeArguments?.params.length||0)<(c||0)&&e.report({node:a,messageId:"missingGenericDeclaration",data:{functionName:l.name,minGenerics:c||0}}),!(y&&!i)&&a.typeArguments?.params?.some(f=>!y&&f.type===K.AST_NODE_TYPES.TSAnyKeyword||i&&f.type===K.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===K.AST_NODE_TYPES.Identifier&&i.includes(f.typeName.name))&&e.report({node:a,messageId:"anyUsedInGenerics",data:{functionName:l.name}})}}}}),ye={name:Ue,rule:jt};var Q=require("@typescript-eslint/utils"),Lt=Q.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ze="no-commented-out-code",Ht=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return "],Nt=[") {","return;","if (","else {","for (","switch (","/>","</","},",": {"," } = ","={",/\w=("|')/,");"],Wt=Lt({name:ze,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with `INFO:` if you want to keep this code commented out."},schema:[]},defaultOptions:[],create:function(e){function t(n){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("INFO:")||a.startsWith("TODO:")||a.startsWith("DOCS:")||a.startsWith("FIX:")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example"))return!1;for(let l of Ht)if(a.startsWith(l))return{wrongPattern:l};for(let l of Nt)if(typeof l=="string"){if(n.includes(l))return{wrongPattern:l}}else if(l.test(n))return{wrongPattern:`regex(${l.toString()})`};return!1}return{Program(){let a=e.sourceCode.getAllComments();for(let l of a)if(l.type===Q.TSESTree.AST_TOKEN_TYPES.Line||l.type===Q.TSESTree.AST_TOKEN_TYPES.Block){let E=t(l.value);E&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:E.wrongPattern}})}}}}}),ge={name:ze,rule:Wt};var Ve=require("@typescript-eslint/utils"),Ut=Ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Be="no-default-export",zt=Ut({name:Be,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let n of t.specifiers)n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),he={name:Be,rule:zt};var V=require("@typescript-eslint/utils"),Vt=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xe="no-non-camel-case-functions",Bt=/^[a-z][a-zA-Z0-9]*$/;function qe(e){return e.typeName.type===V.AST_NODE_TYPES.TSQualifiedName&&e.typeName.left.type===V.AST_NODE_TYPES.Identifier&&e.typeName.left.name==="JSX"&&e.typeName.right.type===V.AST_NODE_TYPES.Identifier&&e.typeName.right.name==="Element"}var qt=Vt({name:Xe,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Bt.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===V.AST_NODE_TYPES.TSTypeReference?qe(n):n.type===V.AST_NODE_TYPES.TSUnionType&&n.types.some(l=>l.type===V.AST_NODE_TYPES.TSTypeReference&&qe(l))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),be={name:Xe,rule:qt};var $=require("@typescript-eslint/utils");var Xt=$.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ge(e){let t=[];for(let n of e.members)n.type===$.AST_NODE_TYPES.TSPropertySignature&&n.key.type===$.AST_NODE_TYPES.Identifier&&t.push([n.key.name,n]);return t}function Ke(e,...t){for(let n of t)e.set(...n);return e}var Gt=W({forceCheckOnFCPropTypesWithName:q(X(_()))}),Je="no-unused-type-props-in-args",Se=null,Kt=Xt({name:Je,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[Gt],fixable:"code"},defaultOptions:[{}],create:function(e){let{forceCheckOnFCPropTypesWithName:t}=e.options[0]||{};t&&!Se&&(Se=t.map(c=>new RegExp(c)));function n(c,y,i,s,f=!0){let T=i.name,w=e.sourceCode.getScope(y).references.find(b=>b.identifier.name===T)?.resolved,F=c&&Se?.some(b=>b.test(T));if(!w||!F&&w.references.filter(b=>b.isTypeReference).length>1)return;let A=w?.defs[0]?.node;if(!(f&&A?.parent?.type===$.AST_NODE_TYPES.ExportNamedDeclaration)){if(A?.type===$.AST_NODE_TYPES.TSTypeAliasDeclaration){a(c,y,s,A.typeAnnotation,!0);return}if(A?.type===$.AST_NODE_TYPES.TSInterfaceDeclaration){a(c,y,s,A.body,!0);return}}}function a(c,y,i,s,f){if(s.type===$.AST_NODE_TYPES.TSInterfaceBody){for(let T of s.body)T.type===$.AST_NODE_TYPES.TSPropertySignature&&T.key.type===$.AST_NODE_TYPES.Identifier&&i.set(T.key.name,T);return}if(s.type===$.AST_NODE_TYPES.TSTypeLiteral){Ke(i,...Ge(s));return}if(s.type===$.AST_NODE_TYPES.TSIntersectionType){for(let T of s.types)a(c,y,i,T,!0);return}f||s.type===$.AST_NODE_TYPES.TSTypeReference&&s.typeName.type===$.AST_NODE_TYPES.Identifier&&n(c,y,s.typeName,i)}function l(c,y,i){for(let s of i)if(s.type==="ObjectPattern"&&s.typeAnnotation){let f=new Map;if(a(c,y,f,s.typeAnnotation.typeAnnotation,!1),f.size===0)continue;E(s,f)}else s.type===$.AST_NODE_TYPES.AssignmentPattern&&s.left.type===$.AST_NODE_TYPES.ObjectPattern&&l(c,y,[s.left])}function E(c,y){let i=[];if(c.properties.at(-1)?.type===$.AST_NODE_TYPES.RestElement)return;for(let w of c.properties)w.type===$.AST_NODE_TYPES.Property&&w.key.type===$.AST_NODE_TYPES.Identifier&&i.push(w.key.name);let f=[],T=[];for(let[w,F]of y)i.includes(w)||(T.push(w),f.push({node:F,messageId:"unusedObjectTypeProperty",data:{propertyName:w}}));for(let[w,F]of f.entries())e.report({...F,fix:w===f.length-1?A=>{let b=c.properties.at(-1),p=T.join(", ");return b?b?.type===$.AST_NODE_TYPES.RestElement?null:A.insertTextAfter(b,`, ${p}`):A.insertTextBeforeRange([c.range[0]+1,c.range[1]],`${p}`)}:void 0})}return{VariableDeclaration:function(c){let y=c.declarations[0];if(!y)return;let i=new Map,s=y.id.type===$.AST_NODE_TYPES.Identifier&&y.id.typeAnnotation?.typeAnnotation.type===$.AST_NODE_TYPES.TSTypeReference&&y.id.typeAnnotation.typeAnnotation.typeName.type===$.AST_NODE_TYPES.Identifier&&y.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&y.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(s){if(s.type===$.AST_NODE_TYPES.TSTypeReference&&s.typeName.type===$.AST_NODE_TYPES.Identifier)n(!0,c,s.typeName,i,!1);else if(s.type===$.AST_NODE_TYPES.TSTypeLiteral)Ke(i,...Ge(s));else if(s.type===$.AST_NODE_TYPES.TSIntersectionType)for(let f of s.types)f.type===$.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===$.AST_NODE_TYPES.Identifier?n(!0,c,f.typeName,i,!1):a(!0,c,i,f,!0);if(i.size!==0&&y.init?.type===$.AST_NODE_TYPES.ArrowFunctionExpression){let f=y.init.params[0];if(!f){e.report({node:y.init,messageId:"missingComponentParam"});return}f.type===$.AST_NODE_TYPES.ObjectPattern&&E(f,i)}}},FunctionDeclaration:function(c){l(!1,c,c.params)},ArrowFunctionExpression:function(c){l(!1,c,c.params)}}}}),Ee={name:Je,rule:Kt};var Ze=require("@typescript-eslint/utils"),Jt=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qe="prefer-named-functions",Ye=new Map,Yt=Jt({name:Qe,meta:{type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e){let t=e.options[0]||{},n=null;if(t.ignoreRegex){let a=Ye.get(t.ignoreRegex);a?n=a:(n=new RegExp(t.ignoreRegex),Ye.set(t.ignoreRegex,n))}return{VariableDeclarator(a){if(a.init&&a.init.type==="ArrowFunctionExpression"&&a.id.type==="Identifier"){let l=a.id.name;if(a.id.typeAnnotation||n&&n.test(l)||!t.disallowArrowFnWithImplicitReturns&&a.init.body.type!=="BlockStatement")return;e.report({node:a.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:l,ignoreRegex:t.ignoreRegex}})}}}}}),xe={name:Qe,rule:Yt};var et=require("@typescript-eslint/utils"),Zt=et.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tt="require-description",Qt=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,en=/^eslint-disable-(next-)?line$/u,tn=Zt({name:tt,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e){let t=e.sourceCode,n=new Set(e.options[0]&&e.options[0].ignore||[]);return{Program(){for(let a of t.getAllComments()){let l=nn(a);l!=null&&(n.has(l.kind)||l.description||e.report({loc:sn(a.loc),messageId:"missingDescription"}))}}}}}),nt={name:tt,rule:tn};function nn(e){let{text:t,description:n}=rn(e.value);if(!t)return null;let a=Qt.exec(t);if(!a)return null;let l=a[1];if(!l)return null;let E=en.test(l);if(e.type==="Line"&&!E||E&&e.loc.start.line!==e.loc.end.line)return null;let c=t.slice(a.index+l.length);return{kind:l,value:c.trim(),description:n}}function rn(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function sn(e){return{start:{line:e.start.line,column:-1},end:e.end}}function it(e){return/^use[A-Z0-9]/.test(e)}function re(e){return e.type==="Identifier"?it(e.name):e.type==="MemberExpression"&&!e.computed&&re(e.property)?e.object.type==="Identifier":!1}function ot(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function at(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function ct(e){return!!(e.parent&&e.parent.callee&&at(e.parent.callee,"forwardRef"))}function lt(e){return!!(e.parent&&e.parent.callee&&at(e.parent.callee,"memo"))}function Te(e){for(;e;){let t=ft(e);if(t&&(ot(t)||re(t))||ct(e)||lt(e))return!0;e=e.parent}return!1}function rt(e){return!1}function we(e){return!1}var on=/eslint +react-compiler\/react-compiler: +\["error/,ut={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let i of e.sourceCode.getAllComments())if(on.test(i.value))return{CallExpression(s){let f=null;s.callee.name==="useMemo"?f="useMemo":s.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:s,message:`"${f}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?i=>t(i):i=>e.sourceCode.getText(i),n=typeof e.getScope=="function"?()=>n():i=>e.sourceCode.getScope(i),a=null,l=[],E=[],c=new WeakSet;function y(i){for(let s of i.references){let f=s.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&rt(f.init.callee))for(let T of s.resolved.references)T!==s&&c.add(T.identifier)}}return{onCodePathSegmentStart:i=>E.push(i),onCodePathSegmentEnd:()=>E.pop(),onCodePathStart:()=>l.push(new Map),onCodePathEnd(i,s){let f=l.pop();if(f.size===0)return;let T=new Set;function w(u,v){let{cache:D}=w,I=D.get(u.id),M=new Set(v);if(M.has(u.id)){let k=[...M],P=k.slice(k.indexOf(u.id)+1);for(let H of P)T.add(H);return BigInt("0")}if(M.add(u.id),I!==void 0)return I;if(i.thrownSegments.includes(u))I=BigInt("0");else if(u.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let k of u.prevSegments)I+=w(k,M)}return u.reachable&&I===BigInt("0")?D.delete(u.id):D.set(u.id,I),I}function F(u,v){let{cache:D}=F,I=D.get(u.id),M=new Set(v);if(M.has(u.id)){let k=Array.from(M),P=k.slice(k.indexOf(u.id)+1);for(let H of P)T.add(H);return BigInt("0")}if(M.add(u.id),I!==void 0)return I;if(i.thrownSegments.includes(u))I=BigInt("0");else if(u.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let k of u.nextSegments)I+=F(k,M)}return D.set(u.id,I),I}function A(u){let{cache:v}=A,D=v.get(u.id);if(D===null)return 1/0;if(D!==void 0)return D;if(v.set(u.id,null),u.prevSegments.length===0)D=1;else{D=1/0;for(let I of u.prevSegments){let M=A(I);M<D&&(D=M)}D+=1}return v.set(u.id,D),D}w.cache=new Map,F.cache=new Map,A.cache=new Map;let b=F(i.initialSegment),p=ft(s),O=Te(s),R=p?ot(p)||re(p):ct(s)||lt(s),S=1/0;for(let u of i.finalSegments){if(!u.reachable)continue;let v=A(u);v<S&&(S=v)}for(let[u,v]of f){if(!u.reachable)continue;let D=u.nextSegments.length===0?S<=A(u):S<A(u),I=w(u)*F(u),M=T.has(u.id);for(let k of v)if(M&&!we(k)&&e.report({node:k,message:`React Hook "${t(k)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),R){if(s.async&&e.report({node:k,message:`React Hook "${t(k)}" cannot be called in an async function.`}),!M&&I!==b&&!we(k)){let H=`React Hook "${t(k)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(D?" Did you accidentally call a React Hook after an early return?":"");e.report({node:k,message:H})}}else if(s.parent&&(s.parent.type==="MethodDefinition"||s.parent.type==="ClassProperty")&&s.parent.value===s){let P=`React Hook "${t(k)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}else if(p){let P=`React Hook "${t(k)}" is called in function "${t(p)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:k,message:P})}else if(s.type==="Program"){let P=`React Hook "${t(k)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}else if(O&&!we(k)){if(s.parent.type==="CallExpression"&&s.parent.callee.type==="Identifier"&&s.parent.callee.name==="useCallback"){let H=s.parent;if(H.parent.type==="VariableDeclarator"&&it(H.parent.id.name))return}let P=`React Hook "${t(k)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}}},CallExpression(i){if(re(i.callee)){let s=st(l),f=st(E),T=s.get(f);T||(T=[],s.set(f,T)),T.push(i.callee)}i.callee.type==="Identifier"&&(i.callee.name==="useEffect"||rt(i.callee))&&i.arguments.length>0&&(a=i)},Identifier(i){a==null&&c.has(i)&&i.parent.type!=="CallExpression"&&e.report({node:i,message:`\`${t(i)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(i){i===a&&(a=null)},FunctionDeclaration(i){Te(i)&&y(n(i))},ArrowFunctionExpression(i){Te(i)&&y(n(i))}}}};function ft(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function st(e){return e[e.length-1]}var pt={[Ee.name]:Ee.rule,[ge.name]:ge.rule,[ye.name]:ye.rule,"rules-of-hooks":ut,"exhaustive-deps":Le,"require-description":nt.rule,[he.name]:he.rule,[be.name]:be.rule,[xe.name]:xe.rule,[fe.name]:fe.rule};var an={rules:pt};0&&(module.exports={extendedLintPlugin});
12
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=y.acquire(p),w=new Set,x=null;{let r=S.upper;for(;r&&(w.add(r),r.type!=="function");)r=r.upper;if(!r)return;x=r}let M=Array.isArray;function C(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node.type!=="VariableDeclarator")return!1;let m=o.node.init;if(m==null)return!1;for(;m.type==="TSAsExpression";)m=m.expression;let d=o.node.parent;if(d==null&&(de(x.block,o.node.id),d=o.node.parent,d==null))return!1;if(d.kind==="const"&&m.type==="Literal"&&(typeof m.value=="string"||typeof m.value=="number"||m.value===null))return!0;if(m.type!=="CallExpression")return!1;let h=m.callee;if(h.type==="MemberExpression"&&h.object.name==="React"&&h.property!=null&&!h.computed&&(h=h.property),h.type!=="Identifier")return!1;let g=o.node.id,{name:T}=h;if(T==="useRef"&&g.type==="Identifier")return!0;if(Pt(h)&&g.type==="Identifier"){for(let v of r.references)v!==g&&I.add(v.identifier);return!0}else if(T==="useState"||T==="useReducer"){if(g.type==="ArrayPattern"&&g.elements.length===2&&M(r.identifiers)){if(g.elements[1]===r.identifiers[0]){if(T==="useState"){let v=r.references,L=0;for(let U=0;U<v.length;U++){if(v[U].isWrite()&&L++,L>1)return!1;i.set(v[U].identifier,g.elements[0])}}return!0}else if(g.elements[0]===r.identifiers[0]){if(T==="useState"){let v=r.references;for(let L=0;L<v.length;L++)s.add(v[L].identifier)}return!1}}}else if(T==="useTransition"&&g.type==="ArrayPattern"&&g.elements.length===2&&Array.isArray(r.identifiers)&&g.elements[1]===r.identifiers[0])return!0;return!1}function P(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node==null||o.node.id==null)return!1;let m=o.node,d=x.childScopes,h=null,g;for(g=0;g<d.length;g++){let T=d[g],v=T.block;if(m.type==="FunctionDeclaration"&&v===m||m.type==="VariableDeclarator"&&v.parent===m){h=T;break}}if(h==null)return!1;for(g=0;g<h.through.length;g++){let T=h.through[g];if(T.resolved!=null&&w.has(T.resolved.scope)&&!H(T.resolved))return!1}return!0}let H=F(C,f),mt=F(P,R),Re=new Map;function dt(r){let o=r.from,m=!1;for(;o.block!==p;)o.type==="function"&&(m=o.block.parent!=null&&o.block.parent.type==="ReturnStatement"),o=o.upper;return m}let j=new Map,se=new Map;Ie(S);function Ie(r){for(let o of r.references){if(!o.resolved||!w.has(o.resolved.scope))continue;let m=de(p,o.identifier),d=He(m),h=V(d,se);if(u&&d.type==="Identifier"&&(d.parent.type==="MemberExpression"||d.parent.type==="OptionalMemberExpression")&&!d.parent.computed&&d.parent.property.type==="Identifier"&&d.parent.property.name==="current"&&dt(o)&&Re.set(h,{reference:o,dependencyNode:d}),d.parent.type==="TSTypeQuery"||d.parent.type==="TSTypeReference")continue;let g=o.resolved.defs[0];if(g!=null&&!(g.node!=null&&g.node.init===p.parent)&&g.type!=="TypeParameter")if(j.has(h))j.get(h).references.push(o);else{let T=o.resolved,v=H(T)||mt(T);j.set(h,{isStable:v,references:[o]})}}for(let o of r.childScopes)Ie(o)}Re.forEach(({reference:r,dependencyNode:o},m)=>{let d=r.resolved.references,h=!1;for(let g=0;g<d.length;g++){let{identifier:T}=d[g],{parent:v}=T;if(v!=null&&v.type==="MemberExpression"&&!v.computed&&v.property.type==="Identifier"&&v.property.name==="current"&&v.parent.type==="AssignmentExpression"&&v.parent.left===v){h=!0;break}}h||c({node:o.parent.property,message:`The ref value '${m}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${m}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function yt(r,o){ie.has(o)||(ie.add(o),c({node:r,message:`Assignments to the '${o}' variable from inside React Hook ${t(k)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${t(k)}.`}))}let ee=new Set;if(j.forEach(({isStable:r,references:o},m)=>{r&&ee.add(m),o.forEach(d=>{d.writeExpr&&yt(d.writeExpr,m)})}),ie.size>0)return;if(!O){let r=null;if(j.forEach(({isStable:o,references:m},d)=>{r||m.forEach(h=>{if(r)return;let g=h.identifier;if(!i.has(g))return;let v=h.from;for(;v.type!=="function";)v=v.upper;v.block===p&&(r=d)})}),r){let{suggestedDependencies:o}=pe({dependencies:j,declaredDependencies:[],stableDependencies:ee,externalDependencies:new Set,isEffect:!0});c({node:k,message:`React Hook ${A} contains a call to '${r}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+o.join(", ")+`] as a second argument to the ${A} Hook.`,suggest:[{desc:`Add dependencies array: [${o.join(", ")}]`,fix(m){return m.insertTextAfter(p,`, [${o.join(", ")}]`)}}]})}return}let Y=[],Z=new Set;O.type!=="ArrayExpression"?c({node:O,message:`React Hook ${t(k)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):O.elements.forEach(r=>{if(r===null)return;if(r.type==="SpreadElement"){c({node:r,message:`React Hook ${t(k)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}I.has(r)&&c({node:r,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${t(r)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${t(r)}\``,fix(h){return h.removeRange(r.range)}}]});let o;try{o=V(r,se)}catch(h){if(/Unsupported node type/.test(h.message)){r.type==="Literal"?j.has(r.value)?c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. Did you mean to include ${r.value} in the array instead?`}):c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):c({node:r,message:`React Hook ${t(k)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw h}let m=r;for(;m.type==="MemberExpression"||m.type==="OptionalMemberExpression"||m.type==="ChainExpression";)m=m.object||m.expression.object;let d=!x.through.some(h=>h.identifier===m);Y.push({key:o,node:r}),d||Z.add(o)});let{suggestedDependencies:gt,unnecessaryDependencies:te,missingDependencies:q,duplicateDependencies:ke}=pe({dependencies:j,declaredDependencies:Y,stableDependencies:ee,externalDependencies:Z,isEffect:u}),ne=gt;if(ke.size+q.size+te.size===0){Dt({declaredDependencies:Y,declaredDependenciesNode:O,componentScope:x,scope:S}).forEach(({construction:o,isUsedOutsideOfHook:m,depType:d})=>{let h=d==="function"?"useCallback":"useMemo",g=d==="function"?"definition":"initialization",T=`wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,v=m?`To fix this, ${T}`:`Move it inside the ${A} callback. Alternatively, ${T}`,L=d==="conditional"||d==="logical expression"?"could make":"makes",U=`The '${o.name.name}' ${d} ${L} the dependencies of ${A} Hook (at line ${O.loc.start.line}) change on every render. ${v}`,Ce;m&&o.type==="Variable"&&d==="function"&&(Ce=[{desc:`Wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,fix(ve){let[bt,St]=h==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ve.insertTextBefore(o.node.init,bt),ve.insertTextAfter(o.node.init,St)]}}]),c({node:o.node,message:U,suggest:Ce})});return}!u&&q.size>0&&(ne=pe({dependencies:j,declaredDependencies:[],stableDependencies:ee,externalDependencies:Z,isEffect:u}).suggestedDependencies);function ht(){if(Y.length===0)return!0;let r=Y.map(m=>m.key),o=r.slice().sort();return r.join(",")===o.join(",")}ht()&&ne.sort();function oe(r){let o=r.split("."),m="";for(let d=0;d<o.length;d++){if(d!==0){let h=o.slice(0,d+1).join("."),g=se.get(h)===!0;m+=g?"?.":"."}m+=o[d]}return m}function ae(r,o,m,d){return r.size===0?null:(r.size>1?"":o+" ")+m+" "+(r.size>1?"dependencies":"dependency")+": "+Ft(Array.from(r).sort().map(h=>"'"+oe(h)+"'"))+`. Either ${d} ${r.size>1?"them":"it"} or remove the dependency array.`}let N="";if(te.size>0){let r=null;if(Array.from(te.keys()).forEach(o=>{r===null&&o.endsWith(".current")&&(r=o)}),r!==null)N=` Mutable values like '${r}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Z.size>0){let o=Array.from(Z)[0];S.set.has(o)||(N=` Outer scope values like '${o}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!N&&q.has("props")){let r=j.get("props");if(r==null)return;let o=r.references;if(!Array.isArray(o))return;let m=!0;for(let d=0;d<o.length;d++){let h=o[d],g=de(x.block,h.identifier);if(!g){m=!1;break}let T=g.parent;if(T==null){m=!1;break}if(T.type!=="MemberExpression"&&T.type!=="OptionalMemberExpression"){m=!1;break}}m&&(N=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${A} call and refer to those specific props inside ${t(k)}.`)}if(!N&&q.size>0){let r=null;q.forEach(o=>{if(r)return;let m=x.set.get(o),d=j.get(o);if(d.references[0].resolved!==m)return;let h=m.defs[0];if(h==null||h.name==null||h.type!=="Parameter")return;let g=!1,T;for(let v=0;v<d.references.length;v++)if(T=d.references[v].identifier,T!=null&&T.parent!=null&&(T.parent.type==="CallExpression"||T.parent.type==="OptionalCallExpression")&&T.parent.callee===T){g=!0;break}g&&(r=o)}),r!==null&&(N=` If '${r}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!N&&q.size>0){let r=null;if(q.forEach(o=>{if(r!==null)return;let d=j.get(o).references,h,g;for(let T=0;T<d.length;T++){for(h=d[T].identifier,g=h.parent;g!=null&&g!==x.block;){if(g.type==="CallExpression"){let v=i.get(g.callee);if(v!=null){if(v.name===o)r={missingDep:o,setter:g.callee.name,form:"updater"};else if(s.has(h))r={missingDep:o,setter:g.callee.name,form:"reducer"};else{let L=d[T].resolved;if(L!=null){let U=L.defs[0];U!=null&&U.type==="Parameter"&&(r={missingDep:o,setter:g.callee.name,form:"inlineReducer"})}}break}}g=g.parent}if(r!==null)break}}),r!==null)switch(r.form){case"reducer":N=` You can also replace multiple useState variables with useReducer if '${r.setter}' needs the current value of '${r.missingDep}'.`;break;case"inlineReducer":N=` If '${r.setter}' needs the current value of '${r.missingDep}', you can also switch to useReducer instead of useState and read '${r.missingDep}' in the reducer.`;break;case"updater":N=` You can also do a functional update '${r.setter}(${r.missingDep.slice(0,1)} => ...)' if you only need '${r.missingDep}' in the '${r.setter}' call.`;break;default:throw new Error("Unknown case.")}}c({node:O,message:`React Hook ${t(k)} has `+(ae(q,"a","missing","include")||ae(te,"an","unnecessary","exclude")||ae(ke,"a","duplicate","omit"))+N,suggest:[{desc:`Update the dependencies array to be: [${ne.map(oe).join(", ")}]`,fix(r){return r.replaceText(O,`[${ne.map(oe).join(", ")}]`)}}]})}function b(p){let O=Ot(p.callee,E);if(O===-1)return;let k=p.arguments[O],A=p.callee,u=Ne(A).name,S=p.arguments[O+1],w=/Effect($|[^a-z])/g.test(u);if(!k){c({node:A,message:`React Hook ${u} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!S&&!w){(u==="useMemo"||u==="useCallback")&&c({node:A,message:`React Hook ${u} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(k.type){case"FunctionExpression":case"ArrowFunctionExpression":$(k,S,A,u,w);return;case"Identifier":if(!S||S.elements&&S.elements.some(C=>C&&C.type==="Identifier"&&C.name===k.name))return;let x=n(p).set.get(k.name);if(x==null||x.defs==null)return;let M=x.defs[0];if(!M||!M.node||M.type!=="Variable"&&M.type!=="FunctionName")break;switch(M.node.type){case"FunctionDeclaration":$(M.node,S,A,u,w);return;case"VariableDeclarator":let C=M.node.init;if(!C)break;switch(C.type){case"ArrowFunctionExpression":case"FunctionExpression":$(C,S,A,u,w);return}break}break;default:c({node:A,message:`React Hook ${u} received a function whose dependencies are unknown. Pass an inline function instead.`});return}c({node:A,message:`React Hook ${u} has a missing dependency: '${k.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${k.name}]`,fix(x){return x.replaceText(S,`[${k.name}]`)}}]})}return{CallExpression:b}}};function pe({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:a,isEffect:l}){let E=c();function c(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,p)=>{let O=y(E,p);O.isUsed=!0,i(E,p,k=>{k.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let p=y(E,b);p.isSatisfiedRecursively=!0}),n.forEach(b=>{let p=y(E,b);p.isSatisfiedRecursively=!0});function y(b,p){let O=p.split("."),k=b;for(let A of O){let u=k.children.get(A);u||(u=c(),k.children.set(A,u)),k=u}return k}function i(b,p,O){let k=p.split("."),A=b;for(let u of k){let S=A.children.get(u);if(!S)return;O(S),A=S}}let s=new Set,f=new Set;R(E,s,f,b=>b);function R(b,p,O,k){b.children.forEach((A,u)=>{let S=k(u);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&O.add(S);return}if(A.isUsed){p.add(S);return}R(A,p,O,w=>S+"."+w)})}let I=[],F=new Set,$=new Set;return t.forEach(({key:b})=>{f.has(b)?I.indexOf(b)===-1?I.push(b):$.add(b):F.add(b)}),s.forEach(b=>{I.push(b)}),{suggestedDependencies:I,unnecessaryDependencies:F,duplicateDependencies:$,missingDependencies:s}}function G(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return G(e.consequent)!=null||G(e.alternate)!=null?"conditional":null;case"LogicalExpression":return G(e.left)!=null||G(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return G(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return G(e.expression);case"TSAsExpression":return G(e.expression)}return null}function Dt({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:a}){let l=e.map(({key:c})=>{let y=n.variables.find(s=>s.name===c);if(y==null)return null;let i=y.defs[0];if(i==null)return null;if(i.type==="Variable"&&i.node.type==="VariableDeclarator"&&i.node.id.type==="Identifier"&&i.node.init!=null){let s=G(i.node.init);if(s!=null)return[y,s]}return i.type==="FunctionName"&&i.node.type==="FunctionDeclaration"?[y,"function"]:i.type==="ClassName"&&i.node.type==="ClassDeclaration"?[y,"class"]:null}).filter(Boolean);function E(c){let y=!1;for(let i=0;i<c.references.length;i++){let s=c.references[i];if(s.writeExpr){if(y)return!0;y=!0;continue}let f=s.from;for(;f!==a&&f!=null;)f=f.upper;if(f!==a&&!We(t,s.identifier))return!0}return!1}return l.map(([c,y])=>({construction:c.defs[0],depType:y,isUsedOutsideOfHook:E(c)}))}function He(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?He(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function me(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function V(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=V(e.object,t),a=V(e.property,null),l=`${n}.${a}`;return me(e,t,l),l}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=V(e.object,t),a=V(e.property,null),l=`${n}.${a}`;return me(e,t,l),l}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let a=V(n.object,t),l=V(n.property,null),E=`${a}.${l}`;return me(n,t,E),E}else throw new Error(`Unsupported node type: ${e.type}`)}function Ne(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ot(e,t){let n=Ne(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let a;try{a=V(n,null)}catch(l){if(/Unsupported node type/.test(l.message))return 0;throw l}return t.additionalHooks.test(a)?0:-1}else return-1}}function de(e,t){let n=[e],a=null;for(;n.length;){if(a=n.shift(),Mt(a,t))return a;if(We(a,t))for(let[l,E]of Object.entries(a))l!=="parent"&&(je(E)?(E.parent=a,n.push(E)):Array.isArray(E)&&E.forEach(c=>{je(c)&&(c.parent=a,n.push(c))}))}return null}function Ft(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Mt(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function We(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Pt(e){return!1}var K=require("@typescript-eslint/utils"),_t=K.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ue="no-call-with-inferred-generics",jt=_t({name:Ue,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e){let t=e.options[0],n=new Map(t.functions.map(a=>[a.name,a]));return{CallExpression(a){let{callee:l}=a;if(l.type!==K.AST_NODE_TYPES.Identifier)return;let E=n.get(l.name);if(!E)return;let{minGenerics:c=1,allowAny:y,disallowTypes:i=t.disallowTypes}=E;(a.typeArguments?.params.length||0)<(c||0)&&e.report({node:a,messageId:"missingGenericDeclaration",data:{functionName:l.name,minGenerics:c||0}}),!(y&&!i)&&a.typeArguments?.params?.some(f=>!y&&f.type===K.AST_NODE_TYPES.TSAnyKeyword||i&&f.type===K.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===K.AST_NODE_TYPES.Identifier&&i.includes(f.typeName.name))&&e.report({node:a,messageId:"anyUsedInGenerics",data:{functionName:l.name}})}}}}),ye={name:Ue,rule:jt};var Q=require("@typescript-eslint/utils"),Lt=Q.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ze="no-commented-out-code",Ht=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return "],Nt=[") {","return;","if (","else {","for (","switch (","/>","</","},",": {"," } = ","={",/\w=("|')/,");"],Wt=Lt({name:ze,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with `INFO:` if you want to keep this code commented out."},schema:[]},defaultOptions:[],create:function(e){function t(n){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("INFO:")||a.startsWith("TODO:")||a.startsWith("DOCS:")||a.startsWith("FIX:")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example"))return!1;for(let l of Ht)if(a.startsWith(l))return{wrongPattern:l};for(let l of Nt)if(typeof l=="string"){if(n.includes(l))return{wrongPattern:l}}else if(l.test(n))return{wrongPattern:`regex(${l.toString()})`};return!1}return{Program(){let a=e.sourceCode.getAllComments();for(let l of a)if(l.type===Q.TSESTree.AST_TOKEN_TYPES.Line||l.type===Q.TSESTree.AST_TOKEN_TYPES.Block){let E=t(l.value);E&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:E.wrongPattern}})}}}}}),ge={name:ze,rule:Wt};var Ve=require("@typescript-eslint/utils"),Ut=Ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Be="no-default-export",zt=Ut({name:Be,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let n of t.specifiers)n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),he={name:Be,rule:zt};var B=require("@typescript-eslint/utils"),Vt=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xe="no-non-camel-case-functions",Bt=/^[a-z][a-zA-Z0-9]*$/;function qe(e){return e.typeName.type===B.AST_NODE_TYPES.TSQualifiedName&&e.typeName.left.type===B.AST_NODE_TYPES.Identifier&&e.typeName.left.name==="JSX"&&e.typeName.right.type===B.AST_NODE_TYPES.Identifier&&e.typeName.right.name==="Element"}var qt=Vt({name:Xe,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Bt.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===B.AST_NODE_TYPES.TSTypeReference?qe(n):n.type===B.AST_NODE_TYPES.TSUnionType&&n.types.some(l=>l.type===B.AST_NODE_TYPES.TSTypeReference&&qe(l))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),be={name:Xe,rule:qt};var D=require("@typescript-eslint/utils");var Xt=D.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ge(e){let t=[];for(let n of e.members)n.type===D.AST_NODE_TYPES.TSPropertySignature&&n.key.type===D.AST_NODE_TYPES.Identifier&&t.push([n.key.name,n]);return t}function Ke(e,...t){for(let n of t)e.set(...n);return e}var Gt=W({forceCheckOnFCPropTypesWithName:z(X(_()))}),Je="no-unused-type-props-in-args",Se=null,Kt=Xt({name:Je,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[Gt],fixable:"code"},defaultOptions:[{}],create:function(e){let{forceCheckOnFCPropTypesWithName:t}=e.options[0]||{};t&&!Se&&(Se=t.map(c=>new RegExp(c)));function n(c,y,i,s,f=!0){let R=i.name,I=e.sourceCode.getScope(y).references.find(b=>b.identifier.name===R)?.resolved,F=c&&Se?.some(b=>b.test(R));if(!I||!F&&I.references.filter(b=>b.isTypeReference).length>1)return;let $=I?.defs[0]?.node;if(!(f&&$?.parent?.type===D.AST_NODE_TYPES.ExportNamedDeclaration)){if($?.type===D.AST_NODE_TYPES.TSTypeAliasDeclaration){a(c,y,s,$.typeAnnotation,!0);return}if($?.type===D.AST_NODE_TYPES.TSInterfaceDeclaration){a(c,y,s,$.body,!0);return}}}function a(c,y,i,s,f){if(s.type===D.AST_NODE_TYPES.TSInterfaceBody){for(let R of s.body)R.type===D.AST_NODE_TYPES.TSPropertySignature&&R.key.type===D.AST_NODE_TYPES.Identifier&&i.set(R.key.name,R);return}if(s.type===D.AST_NODE_TYPES.TSTypeLiteral){Ke(i,...Ge(s));return}if(s.type===D.AST_NODE_TYPES.TSIntersectionType){for(let R of s.types)a(c,y,i,R,!0);return}f||s.type===D.AST_NODE_TYPES.TSTypeReference&&s.typeName.type===D.AST_NODE_TYPES.Identifier&&n(c,y,s.typeName,i)}function l(c,y,i){for(let s of i)if(s.type==="ObjectPattern"&&s.typeAnnotation){let f=new Map;if(a(c,y,f,s.typeAnnotation.typeAnnotation,!1),f.size===0)continue;E(s,f)}else s.type===D.AST_NODE_TYPES.AssignmentPattern&&s.left.type===D.AST_NODE_TYPES.ObjectPattern&&l(c,y,[s.left])}function E(c,y){let i=[];if(c.properties.at(-1)?.type===D.AST_NODE_TYPES.RestElement)return;for(let I of c.properties)I.type===D.AST_NODE_TYPES.Property&&I.key.type===D.AST_NODE_TYPES.Identifier&&i.push(I.key.name);let f=[],R=[];for(let[I,F]of y)i.includes(I)||(R.push(I),f.push({node:F,messageId:"unusedObjectTypeProperty",data:{propertyName:I}}));for(let[I,F]of f.entries())e.report({...F,fix:I===f.length-1?$=>{let b=c.properties.at(-1),p=R.join(", ");return b?b?.type===D.AST_NODE_TYPES.RestElement?null:$.insertTextAfter(b,`, ${p}`):$.insertTextBeforeRange([c.range[0]+1,c.range[1]],`${p}`)}:void 0})}return{VariableDeclaration:function(c){let y=c.declarations[0];if(!y)return;let i=new Map,s=y.id.type===D.AST_NODE_TYPES.Identifier&&y.id.typeAnnotation?.typeAnnotation.type===D.AST_NODE_TYPES.TSTypeReference&&y.id.typeAnnotation.typeAnnotation.typeName.type===D.AST_NODE_TYPES.Identifier&&y.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&y.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(s){if(s.type===D.AST_NODE_TYPES.TSTypeReference&&s.typeName.type===D.AST_NODE_TYPES.Identifier)n(!0,c,s.typeName,i,!1);else if(s.type===D.AST_NODE_TYPES.TSTypeLiteral)Ke(i,...Ge(s));else if(s.type===D.AST_NODE_TYPES.TSIntersectionType)for(let f of s.types)f.type===D.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===D.AST_NODE_TYPES.Identifier?n(!0,c,f.typeName,i,!1):a(!0,c,i,f,!0);if(i.size!==0&&y.init?.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let f=y.init.params[0];if(!f){e.report({node:y.init,messageId:"missingComponentParam"});return}f.type===D.AST_NODE_TYPES.ObjectPattern&&E(f,i)}}},FunctionDeclaration:function(c){l(!1,c,c.params)},ArrowFunctionExpression:function(c){l(!1,c,c.params)}}}}),Ee={name:Je,rule:Kt};var Ze=require("@typescript-eslint/utils"),Jt=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qe="prefer-named-functions",Ye=new Map,Yt=Jt({name:Qe,meta:{type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e){let t=e.options[0]||{},n=null;if(t.ignoreRegex){let a=Ye.get(t.ignoreRegex);a?n=a:(n=new RegExp(t.ignoreRegex),Ye.set(t.ignoreRegex,n))}return{VariableDeclarator(a){if(a.init&&a.init.type==="ArrowFunctionExpression"&&a.id.type==="Identifier"){let l=a.id.name;if(a.id.typeAnnotation||n&&n.test(l)||!t.disallowArrowFnWithImplicitReturns&&a.init.body.type!=="BlockStatement")return;e.report({node:a.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:l,ignoreRegex:t.ignoreRegex}})}}}}}),xe={name:Qe,rule:Yt};var et=require("@typescript-eslint/utils"),Zt=et.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tt="require-description",Qt=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,en=/^eslint-disable-(next-)?line$/u,tn=Zt({name:tt,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e){let t=e.sourceCode,n=new Set(e.options[0]&&e.options[0].ignore||[]);return{Program(){for(let a of t.getAllComments()){let l=nn(a);l!=null&&(n.has(l.kind)||l.description||e.report({loc:sn(a.loc),messageId:"missingDescription"}))}}}}}),nt={name:tt,rule:tn};function nn(e){let{text:t,description:n}=rn(e.value);if(!t)return null;let a=Qt.exec(t);if(!a)return null;let l=a[1];if(!l)return null;let E=en.test(l);if(e.type==="Line"&&!E||E&&e.loc.start.line!==e.loc.end.line)return null;let c=t.slice(a.index+l.length);return{kind:l,value:c.trim(),description:n}}function rn(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function sn(e){return{start:{line:e.start.line,column:-1},end:e.end}}function it(e){return/^use[A-Z0-9]/.test(e)}function re(e){return e.type==="Identifier"?it(e.name):e.type==="MemberExpression"&&!e.computed&&re(e.property)?e.object.type==="Identifier":!1}function ot(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function at(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function ct(e){return!!(e.parent&&e.parent.callee&&at(e.parent.callee,"forwardRef"))}function lt(e){return!!(e.parent&&e.parent.callee&&at(e.parent.callee,"memo"))}function Te(e){for(;e;){let t=ft(e);if(t&&(ot(t)||re(t))||ct(e)||lt(e))return!0;e=e.parent}return!1}function rt(e){return!1}function we(e){return!1}var on=/eslint +react-compiler\/react-compiler: +\["error/,ut={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let i of e.sourceCode.getAllComments())if(on.test(i.value))return{CallExpression(s){let f=null;s.callee.name==="useMemo"?f="useMemo":s.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:s,message:`"${f}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?i=>t(i):i=>e.sourceCode.getText(i),n=typeof e.getScope=="function"?()=>n():i=>e.sourceCode.getScope(i),a=null,l=[],E=[],c=new WeakSet;function y(i){for(let s of i.references){let f=s.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&rt(f.init.callee))for(let R of s.resolved.references)R!==s&&c.add(R.identifier)}}return{onCodePathSegmentStart:i=>E.push(i),onCodePathSegmentEnd:()=>E.pop(),onCodePathStart:()=>l.push(new Map),onCodePathEnd(i,s){let f=l.pop();if(f.size===0)return;let R=new Set;function I(u,S){let{cache:w}=I,x=w.get(u.id),M=new Set(S);if(M.has(u.id)){let C=[...M],P=C.slice(C.indexOf(u.id)+1);for(let H of P)R.add(H);return BigInt("0")}if(M.add(u.id),x!==void 0)return x;if(i.thrownSegments.includes(u))x=BigInt("0");else if(u.prevSegments.length===0)x=BigInt("1");else{x=BigInt("0");for(let C of u.prevSegments)x+=I(C,M)}return u.reachable&&x===BigInt("0")?w.delete(u.id):w.set(u.id,x),x}function F(u,S){let{cache:w}=F,x=w.get(u.id),M=new Set(S);if(M.has(u.id)){let C=Array.from(M),P=C.slice(C.indexOf(u.id)+1);for(let H of P)R.add(H);return BigInt("0")}if(M.add(u.id),x!==void 0)return x;if(i.thrownSegments.includes(u))x=BigInt("0");else if(u.nextSegments.length===0)x=BigInt("1");else{x=BigInt("0");for(let C of u.nextSegments)x+=F(C,M)}return w.set(u.id,x),x}function $(u){let{cache:S}=$,w=S.get(u.id);if(w===null)return 1/0;if(w!==void 0)return w;if(S.set(u.id,null),u.prevSegments.length===0)w=1;else{w=1/0;for(let x of u.prevSegments){let M=$(x);M<w&&(w=M)}w+=1}return S.set(u.id,w),w}I.cache=new Map,F.cache=new Map,$.cache=new Map;let b=F(i.initialSegment),p=ft(s),O=Te(s),k=p?ot(p)||re(p):ct(s)||lt(s),A=1/0;for(let u of i.finalSegments){if(!u.reachable)continue;let S=$(u);S<A&&(A=S)}for(let[u,S]of f){if(!u.reachable)continue;let w=u.nextSegments.length===0?A<=$(u):A<$(u),x=I(u)*F(u),M=R.has(u.id);for(let C of S)if(M&&!we(C)&&e.report({node:C,message:`React Hook "${t(C)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),k){if(s.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!M&&x!==b&&!we(C)){let H=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:H})}}else if(s.parent&&(s.parent.type==="MethodDefinition"||s.parent.type==="ClassProperty")&&s.parent.value===s){let P=`React Hook "${t(C)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}else if(p){let P=`React Hook "${t(C)}" is called in function "${t(p)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:C,message:P})}else if(s.type==="Program"){let P=`React Hook "${t(C)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}else if(O&&!we(C)){if(s.parent.type==="CallExpression"&&s.parent.callee.type==="Identifier"&&s.parent.callee.name==="useCallback"){let H=s.parent;if(H.parent.type==="VariableDeclarator"&&it(H.parent.id.name))return}let P=`React Hook "${t(C)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}}},CallExpression(i){if(re(i.callee)){let s=st(l),f=st(E),R=s.get(f);R||(R=[],s.set(f,R)),R.push(i.callee)}i.callee.type==="Identifier"&&(i.callee.name==="useEffect"||rt(i.callee))&&i.arguments.length>0&&(a=i)},Identifier(i){a==null&&c.has(i)&&i.parent.type!=="CallExpression"&&e.report({node:i,message:`\`${t(i)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(i){i===a&&(a=null)},FunctionDeclaration(i){Te(i)&&y(n(i))},ArrowFunctionExpression(i){Te(i)&&y(n(i))}}}};function ft(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function st(e){return e[e.length-1]}var pt={[Ee.name]:Ee.rule,[ge.name]:ge.rule,[ye.name]:ye.rule,"rules-of-hooks":ut,"exhaustive-deps":Le,"require-description":nt.rule,[he.name]:he.rule,[be.name]:be.rule,[xe.name]:xe.rule,[fe.name]:fe.rule};var an={rules:pt};0&&(module.exports={extendedLintPlugin});
@@ -1,4 +1,4 @@
1
- import{AST_NODE_TYPES as ce,ESLintUtils as gt}from"@typescript-eslint/utils";var oe=Symbol.for("optional");function B(e){return{...e,[oe]:!0}}function Ce(e,t){return{enum:e,...t}}function ve(e){return{...e,type:"boolean"}}function _(e){return{...e,type:"string"}}function Ae(e){return{...e,type:"number"}}function $e(e){return{...e,type:"integer"}}function q(e,t){return{...t,type:"array",items:e}}function W(e,t){let n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let a,l=[];for(a in e)e[a][oe]?e[a][oe]=void 0:l.push(a);l.length>0&&(n.required=l)}return n}function ae(...e){return{anyOf:e}}var ht=gt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bt=W({disallow:B(q(W({selector:_(),message:_(),replace:B(ae(_(),W({regex:_(),with:_()}))),replaceType:B(Ce(["suggestion","autofix"]))}))),__dev_simulateFileName:B(_()),mustMatchSyntax:B(q(W({includeRegex:_(),mustCallFn:q(W({anyCall:q(W({fn:_(),withArgs:q(W({pos:$e(),literal:ae(_(),Ae(),ve())}))})),message:_()}))})))}),Me="advanced-no-restricted-syntax",St=ht({name:Me,meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[bt],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e){let t={},{mustMatchSyntax:n,__dev_simulateFileName:a,disallow:l}=e.options[0],E=a??e.filename,c=[],y=new Set;for(let{includeRegex:s,mustCallFn:f}of n??[]){let T=Et(E,new RegExp(s));if(!T)continue;let w=F=>{let A=F;for(let{name:b,value:p}of T)A=A.replaceAll(b,p);return A};for(let{anyCall:F,message:A}of f)y.add(A),c.push(b=>{let{callee:p}=b;if(p.type===ce.Identifier){for(let{fn:D,withArgs:R}of F)if(p.name===D){y.delete(A);for(let S of R){let u=b.arguments[S.pos];if(!u){e.report({node:b,messageId:"default",data:{message:`Missing required argument at position ${S.pos}: ${w(A)}`}});continue}if(u.type!==ce.Literal){e.report({node:u,messageId:"default",data:{message:`Argument at position ${S.pos} should be a literal: ${w(A)}`}});continue}let v=typeof S.literal=="string"?w(S.literal):S.literal;u.value!==v&&e.report({node:u,messageId:"default",data:{message:`Invalid argument value: ${w(A)}`}})}break}}})}for(let{selector:s,message:f,replace:T,replaceType:w="suggestion"}of l??[]){if(s==="CallExpression"){c.push(F=>{i(T,F,f,w)});continue}t[s]=F=>{i(T,F,f,w)}}return c.length>0&&(t.CallExpression=s=>{if(s.type===ce.CallExpression)for(let f of c)f(s)}),t["Program:exit"]=s=>{for(let f of y)e.report({node:s,messageId:"default",data:{message:`Missing required call: ${f}`}})},t;function i(s,f,T,w){let F=A=>{if(!s)return null;if(typeof s=="string")return A.replaceText(f,s);{let b=new RegExp(s.regex),p=e.sourceCode.getText(f);return A.replaceText(f,p.replace(b,s.with))}};e.report({node:f,messageId:"default",data:{message:T},fix:s&&w==="autofix"?F:void 0,suggest:s&&w==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof s=="string"?s:s.with}"`},fix:F}]:void 0})}}});function Et(e,t){let n=[],a=t.exec(e);if(!a)return null;let[l,...E]=a;n.push({name:"$0_lowercase",value:l.toLowerCase()}),n.push({name:"$0_capitalize",value:Oe(l)}),n.push({name:"$0_uncapitalize",value:Fe(l)}),n.push({name:"$0",value:l});for(let c=0;c<E.length;c++){let y=`$${c+1}`,i=E[c];n.push({name:`${y}_lowercase`,value:i.toLowerCase()}),n.push({name:`${y}_capitalize`,value:Oe(i)}),n.push({name:`${y}_uncapitalize`,value:Fe(i)}),n.push({name:y,value:i})}return n}function Oe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fe(e){return e.charAt(0).toLowerCase()+e.slice(1)}var le={name:Me,rule:St};var xt=/eslint +react-compiler\/react-compiler: +\["error/,_e={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let p of e.sourceCode.getAllComments())if(xt.test(p.value))return{}}let t=typeof e.getSource=="function"?p=>t(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,E={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function c(p){l&&Array.isArray(p.suggest)&&p.suggest.length>0&&(p.fix=p.suggest[0].fix),e.report(p)}let y=e.getSourceCode().scopeManager,i=new WeakMap,s=new WeakSet,f=new WeakMap,T=new WeakMap,w=new WeakSet;function F(p,D){return function(R){if(D.has(R))return D.get(R);let S=p(R);return D.set(R,S),S}}function A(p,D,R,S,u){u&&p.async&&c({node:p,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ import{AST_NODE_TYPES as ce,ESLintUtils as gt}from"@typescript-eslint/utils";var oe=Symbol.for("optional");function z(e){return{...e,[oe]:!0}}function Ce(e,t){return{enum:e,...t}}function ve(e){return{...e,type:"boolean"}}function _(e){return{...e,type:"string"}}function $e(e){return{...e,type:"number"}}function Ae(e){return{...e,type:"integer"}}function q(e,t){return{...t,type:"array",items:e}}function W(e,t){let n={...t,type:"object",properties:e};if(e&&(n.additionalProperties||=!1,!n.required)){let a,l=[];for(a in e)e[a][oe]?e[a][oe]=void 0:l.push(a);l.length>0&&(n.required=l)}return n}function ae(...e){return{anyOf:e}}var ht=gt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bt=W({disallow:z(q(W({selector:_(),message:_(),replace:z(ae(_(),W({regex:_(),with:_()}))),replaceType:z(Ce(["suggestion","autofix"]))}))),__dev_simulateFileName:z(_()),mustMatchSyntax:z(q(W({includeRegex:_(),mustCallFn:q(W({anyCall:q(W({fn:_(),withArgs:q(W({atIndex:Ae(),literal:ae(_(),$e(),ve())}))})),message:z(_())}))})))}),Me="advanced-no-restricted-syntax",St=ht({name:Me,meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[bt],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e){let t={},{mustMatchSyntax:n,__dev_simulateFileName:a,disallow:l}=e.options[0],E=a??e.filename,c=[],y=new Set;for(let{includeRegex:s,mustCallFn:f}of n??[]){let R=Et(E,new RegExp(s));if(!R)continue;let I=O=>{let $=O;for(let{name:b,value:p}of R)$=$.replaceAll(b,p);return $};for(let{anyCall:O,message:$}of f){let b=`Expected file to call the function: ${O.map(({fn:p})=>p).join(" or ")}`;y.add(b),c.push(p=>{let{callee:D}=p;if(D.type===ce.Identifier){for(let{fn:k,withArgs:A}of O)if(D.name===k){y.delete(b);for(let u of A){let S=p.arguments[u.atIndex],w=typeof u.literal=="string"?I(u.literal):u.literal;if(!S){e.report({node:p,messageId:"default",data:{message:`Missing argument with value "${w}" at index ${u.atIndex}${$?`: ${I($)}`:""}`}});continue}if(S.type!==ce.Literal){e.report({node:S,messageId:"default",data:{message:`Argument at position ${u.atIndex} should the literal "${w}"${$?`: ${I($)}`:""}`}});continue}S.value!==w&&e.report({node:S,messageId:"default",data:{message:`Argument should have the value "${w}"${$?`: ${I($)}`:""}`},fix:x=>x.replaceText(S,typeof w=="string"?`'${w}'`:String(w))})}break}}})}}for(let{selector:s,message:f,replace:R,replaceType:I="suggestion"}of l??[]){if(s==="CallExpression"){c.push(O=>{i(R,O,f,I)});continue}t[s]=O=>{i(R,O,f,I)}}return c.length>0&&(t.CallExpression=s=>{if(s.type===ce.CallExpression)for(let f of c)f(s)}),t["Program:exit"]=s=>{for(let f of y)e.report({node:s,messageId:"default",data:{message:`${f}`}})},t;function i(s,f,R,I){let O=$=>{if(!s)return null;if(typeof s=="string")return $.replaceText(f,s);{let b=new RegExp(s.regex),p=e.sourceCode.getText(f);return $.replaceText(f,p.replace(b,s.with))}};e.report({node:f,messageId:"default",data:{message:R},fix:s&&I==="autofix"?O:void 0,suggest:s&&I==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof s=="string"?s:s.with}"`},fix:O}]:void 0})}}});function Et(e,t){let n=[],a=t.exec(e);if(!a)return null;let[l,...E]=a;n.push({name:"$0_lowercase",value:l.toLowerCase()}),n.push({name:"$0_capitalize",value:Oe(l)}),n.push({name:"$0_uncapitalize",value:Fe(l)}),n.push({name:"$0",value:l});for(let c=0;c<E.length;c++){let y=`$${c+1}`,i=E[c];n.push({name:`${y}_lowercase`,value:i.toLowerCase()}),n.push({name:`${y}_capitalize`,value:Oe(i)}),n.push({name:`${y}_uncapitalize`,value:Fe(i)}),n.push({name:y,value:i})}return n}function Oe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fe(e){return e.charAt(0).toLowerCase()+e.slice(1)}var le={name:Me,rule:St};var xt=/eslint +react-compiler\/react-compiler: +\["error/,_e={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let p of e.sourceCode.getAllComments())if(xt.test(p.value))return{}}let t=typeof e.getSource=="function"?p=>t(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,l=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,E={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:l};function c(p){l&&Array.isArray(p.suggest)&&p.suggest.length>0&&(p.fix=p.suggest[0].fix),e.report(p)}let y=e.getSourceCode().scopeManager,i=new WeakMap,s=new WeakSet,f=new WeakMap,R=new WeakMap,I=new WeakSet;function O(p,D){return function(k){if(D.has(k))return D.get(k);let A=p(k);return D.set(k,A),A}}function $(p,D,k,A,u){u&&p.async&&c({node:p,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
2
2
 
3
3
  useEffect(() => {
4
4
  async function fetchData() {
@@ -9,4 +9,4 @@ useEffect(() => {
9
9
  fetchData();
10
10
  }, [someId]); // Or [] if effect doesn't need props or state
11
11
 
12
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let v=y.acquire(p),$=new Set,I=null;{let r=v.upper;for(;r&&($.add(r),r.type!=="function");)r=r.upper;if(!r)return;I=r}let M=Array.isArray;function k(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node.type!=="VariableDeclarator")return!1;let m=o.node.init;if(m==null)return!1;for(;m.type==="TSAsExpression";)m=m.expression;let d=o.node.parent;if(d==null&&(pe(I.block,o.node.id),d=o.node.parent,d==null))return!1;if(d.kind==="const"&&m.type==="Literal"&&(typeof m.value=="string"||typeof m.value=="number"||m.value===null))return!0;if(m.type!=="CallExpression")return!1;let h=m.callee;if(h.type==="MemberExpression"&&h.object.name==="React"&&h.property!=null&&!h.computed&&(h=h.property),h.type!=="Identifier")return!1;let g=o.node.id,{name:x}=h;if(x==="useRef"&&g.type==="Identifier")return!0;if(kt(h)&&g.type==="Identifier"){for(let C of r.references)C!==g&&w.add(C.identifier);return!0}else if(x==="useState"||x==="useReducer"){if(g.type==="ArrayPattern"&&g.elements.length===2&&M(r.identifiers)){if(g.elements[1]===r.identifiers[0]){if(x==="useState"){let C=r.references,L=0;for(let U=0;U<C.length;U++){if(C[U].isWrite()&&L++,L>1)return!1;i.set(C[U].identifier,g.elements[0])}}return!0}else if(g.elements[0]===r.identifiers[0]){if(x==="useState"){let C=r.references;for(let L=0;L<C.length;L++)s.add(C[L].identifier)}return!1}}}else if(x==="useTransition"&&g.type==="ArrayPattern"&&g.elements.length===2&&Array.isArray(r.identifiers)&&g.elements[1]===r.identifiers[0])return!0;return!1}function P(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node==null||o.node.id==null)return!1;let m=o.node,d=I.childScopes,h=null,g;for(g=0;g<d.length;g++){let x=d[g],C=x.block;if(m.type==="FunctionDeclaration"&&C===m||m.type==="VariableDeclarator"&&C.parent===m){h=x;break}}if(h==null)return!1;for(g=0;g<h.through.length;g++){let x=h.through[g];if(x.resolved!=null&&$.has(x.resolved.scope)&&!H(x.resolved))return!1}return!0}let H=F(k,f),lt=F(P,T),Te=new Map;function ut(r){let o=r.from,m=!1;for(;o.block!==p;)o.type==="function"&&(m=o.block.parent!=null&&o.block.parent.type==="ReturnStatement"),o=o.upper;return m}let j=new Map,ne=new Map;we(v);function we(r){for(let o of r.references){if(!o.resolved||!$.has(o.resolved.scope))continue;let m=pe(p,o.identifier),d=je(m),h=z(d,ne);if(u&&d.type==="Identifier"&&(d.parent.type==="MemberExpression"||d.parent.type==="OptionalMemberExpression")&&!d.parent.computed&&d.parent.property.type==="Identifier"&&d.parent.property.name==="current"&&ut(o)&&Te.set(h,{reference:o,dependencyNode:d}),d.parent.type==="TSTypeQuery"||d.parent.type==="TSTypeReference")continue;let g=o.resolved.defs[0];if(g!=null&&!(g.node!=null&&g.node.init===p.parent)&&g.type!=="TypeParameter")if(j.has(h))j.get(h).references.push(o);else{let x=o.resolved,C=H(x)||lt(x);j.set(h,{isStable:C,references:[o]})}}for(let o of r.childScopes)we(o)}Te.forEach(({reference:r,dependencyNode:o},m)=>{let d=r.resolved.references,h=!1;for(let g=0;g<d.length;g++){let{identifier:x}=d[g],{parent:C}=x;if(C!=null&&C.type==="MemberExpression"&&!C.computed&&C.property.type==="Identifier"&&C.property.name==="current"&&C.parent.type==="AssignmentExpression"&&C.parent.left===C){h=!0;break}}h||c({node:o.parent.property,message:`The ref value '${m}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${m}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let re=new Set;function ft(r,o){re.has(o)||(re.add(o),c({node:r,message:`Assignments to the '${o}' variable from inside React Hook ${t(R)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${t(R)}.`}))}let Y=new Set;if(j.forEach(({isStable:r,references:o},m)=>{r&&Y.add(m),o.forEach(d=>{d.writeExpr&&ft(d.writeExpr,m)})}),re.size>0)return;if(!D){let r=null;if(j.forEach(({isStable:o,references:m},d)=>{r||m.forEach(h=>{if(r)return;let g=h.identifier;if(!i.has(g))return;let C=h.from;for(;C.type!=="function";)C=C.upper;C.block===p&&(r=d)})}),r){let{suggestedDependencies:o}=ue({dependencies:j,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});c({node:R,message:`React Hook ${S} contains a call to '${r}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+o.join(", ")+`] as a second argument to the ${S} Hook.`,suggest:[{desc:`Add dependencies array: [${o.join(", ")}]`,fix(m){return m.insertTextAfter(p,`, [${o.join(", ")}]`)}}]})}return}let K=[],J=new Set;D.type!=="ArrayExpression"?c({node:D,message:`React Hook ${t(R)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):D.elements.forEach(r=>{if(r===null)return;if(r.type==="SpreadElement"){c({node:r,message:`React Hook ${t(R)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}w.has(r)&&c({node:r,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${t(r)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${t(r)}\``,fix(h){return h.removeRange(r.range)}}]});let o;try{o=z(r,ne)}catch(h){if(/Unsupported node type/.test(h.message)){r.type==="Literal"?j.has(r.value)?c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. Did you mean to include ${r.value} in the array instead?`}):c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):c({node:r,message:`React Hook ${t(R)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw h}let m=r;for(;m.type==="MemberExpression"||m.type==="OptionalMemberExpression"||m.type==="ChainExpression";)m=m.object||m.expression.object;let d=!I.through.some(h=>h.identifier===m);K.push({key:o,node:r}),d||J.add(o)});let{suggestedDependencies:pt,unnecessaryDependencies:Z,missingDependencies:V,duplicateDependencies:Re}=ue({dependencies:j,declaredDependencies:K,stableDependencies:Y,externalDependencies:J,isEffect:u}),Q=pt;if(Re.size+V.size+Z.size===0){Tt({declaredDependencies:K,declaredDependenciesNode:D,componentScope:I,scope:v}).forEach(({construction:o,isUsedOutsideOfHook:m,depType:d})=>{let h=d==="function"?"useCallback":"useMemo",g=d==="function"?"definition":"initialization",x=`wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,C=m?`To fix this, ${x}`:`Move it inside the ${S} callback. Alternatively, ${x}`,L=d==="conditional"||d==="logical expression"?"could make":"makes",U=`The '${o.name.name}' ${d} ${L} the dependencies of ${S} Hook (at line ${D.loc.start.line}) change on every render. ${C}`,Ie;m&&o.type==="Variable"&&d==="function"&&(Ie=[{desc:`Wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,fix(ke){let[dt,yt]=h==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ke.insertTextBefore(o.node.init,dt),ke.insertTextAfter(o.node.init,yt)]}}]),c({node:o.node,message:U,suggest:Ie})});return}!u&&V.size>0&&(Q=ue({dependencies:j,declaredDependencies:[],stableDependencies:Y,externalDependencies:J,isEffect:u}).suggestedDependencies);function mt(){if(K.length===0)return!0;let r=K.map(m=>m.key),o=r.slice().sort();return r.join(",")===o.join(",")}mt()&&Q.sort();function se(r){let o=r.split("."),m="";for(let d=0;d<o.length;d++){if(d!==0){let h=o.slice(0,d+1).join("."),g=ne.get(h)===!0;m+=g?"?.":"."}m+=o[d]}return m}function ie(r,o,m,d){return r.size===0?null:(r.size>1?"":o+" ")+m+" "+(r.size>1?"dependencies":"dependency")+": "+Rt(Array.from(r).sort().map(h=>"'"+se(h)+"'"))+`. Either ${d} ${r.size>1?"them":"it"} or remove the dependency array.`}let N="";if(Z.size>0){let r=null;if(Array.from(Z.keys()).forEach(o=>{r===null&&o.endsWith(".current")&&(r=o)}),r!==null)N=` Mutable values like '${r}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(J.size>0){let o=Array.from(J)[0];v.set.has(o)||(N=` Outer scope values like '${o}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!N&&V.has("props")){let r=j.get("props");if(r==null)return;let o=r.references;if(!Array.isArray(o))return;let m=!0;for(let d=0;d<o.length;d++){let h=o[d],g=pe(I.block,h.identifier);if(!g){m=!1;break}let x=g.parent;if(x==null){m=!1;break}if(x.type!=="MemberExpression"&&x.type!=="OptionalMemberExpression"){m=!1;break}}m&&(N=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${S} call and refer to those specific props inside ${t(R)}.`)}if(!N&&V.size>0){let r=null;V.forEach(o=>{if(r)return;let m=I.set.get(o),d=j.get(o);if(d.references[0].resolved!==m)return;let h=m.defs[0];if(h==null||h.name==null||h.type!=="Parameter")return;let g=!1,x;for(let C=0;C<d.references.length;C++)if(x=d.references[C].identifier,x!=null&&x.parent!=null&&(x.parent.type==="CallExpression"||x.parent.type==="OptionalCallExpression")&&x.parent.callee===x){g=!0;break}g&&(r=o)}),r!==null&&(N=` If '${r}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!N&&V.size>0){let r=null;if(V.forEach(o=>{if(r!==null)return;let d=j.get(o).references,h,g;for(let x=0;x<d.length;x++){for(h=d[x].identifier,g=h.parent;g!=null&&g!==I.block;){if(g.type==="CallExpression"){let C=i.get(g.callee);if(C!=null){if(C.name===o)r={missingDep:o,setter:g.callee.name,form:"updater"};else if(s.has(h))r={missingDep:o,setter:g.callee.name,form:"reducer"};else{let L=d[x].resolved;if(L!=null){let U=L.defs[0];U!=null&&U.type==="Parameter"&&(r={missingDep:o,setter:g.callee.name,form:"inlineReducer"})}}break}}g=g.parent}if(r!==null)break}}),r!==null)switch(r.form){case"reducer":N=` You can also replace multiple useState variables with useReducer if '${r.setter}' needs the current value of '${r.missingDep}'.`;break;case"inlineReducer":N=` If '${r.setter}' needs the current value of '${r.missingDep}', you can also switch to useReducer instead of useState and read '${r.missingDep}' in the reducer.`;break;case"updater":N=` You can also do a functional update '${r.setter}(${r.missingDep.slice(0,1)} => ...)' if you only need '${r.missingDep}' in the '${r.setter}' call.`;break;default:throw new Error("Unknown case.")}}c({node:D,message:`React Hook ${t(R)} has `+(ie(V,"a","missing","include")||ie(Z,"an","unnecessary","exclude")||ie(Re,"a","duplicate","omit"))+N,suggest:[{desc:`Update the dependencies array to be: [${Q.map(se).join(", ")}]`,fix(r){return r.replaceText(D,`[${Q.map(se).join(", ")}]`)}}]})}function b(p){let D=wt(p.callee,E);if(D===-1)return;let R=p.arguments[D],S=p.callee,u=Le(S).name,v=p.arguments[D+1],$=/Effect($|[^a-z])/g.test(u);if(!R){c({node:S,message:`React Hook ${u} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!v&&!$){(u==="useMemo"||u==="useCallback")&&c({node:S,message:`React Hook ${u} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(R.type){case"FunctionExpression":case"ArrowFunctionExpression":A(R,v,S,u,$);return;case"Identifier":if(!v||v.elements&&v.elements.some(k=>k&&k.type==="Identifier"&&k.name===R.name))return;let I=n(p).set.get(R.name);if(I==null||I.defs==null)return;let M=I.defs[0];if(!M||!M.node||M.type!=="Variable"&&M.type!=="FunctionName")break;switch(M.node.type){case"FunctionDeclaration":A(M.node,v,S,u,$);return;case"VariableDeclarator":let k=M.node.init;if(!k)break;switch(k.type){case"ArrowFunctionExpression":case"FunctionExpression":A(k,v,S,u,$);return}break}break;default:c({node:S,message:`React Hook ${u} received a function whose dependencies are unknown. Pass an inline function instead.`});return}c({node:S,message:`React Hook ${u} has a missing dependency: '${R.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${R.name}]`,fix(I){return I.replaceText(v,`[${R.name}]`)}}]})}return{CallExpression:b}}};function ue({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:a,isEffect:l}){let E=c();function c(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,p)=>{let D=y(E,p);D.isUsed=!0,i(E,p,R=>{R.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let p=y(E,b);p.isSatisfiedRecursively=!0}),n.forEach(b=>{let p=y(E,b);p.isSatisfiedRecursively=!0});function y(b,p){let D=p.split("."),R=b;for(let S of D){let u=R.children.get(S);u||(u=c(),R.children.set(S,u)),R=u}return R}function i(b,p,D){let R=p.split("."),S=b;for(let u of R){let v=S.children.get(u);if(!v)return;D(v),S=v}}let s=new Set,f=new Set;T(E,s,f,b=>b);function T(b,p,D,R){b.children.forEach((S,u)=>{let v=R(u);if(S.isSatisfiedRecursively){S.isSubtreeUsed&&D.add(v);return}if(S.isUsed){p.add(v);return}T(S,p,D,$=>v+"."+$)})}let w=[],F=new Set,A=new Set;return t.forEach(({key:b})=>{f.has(b)?w.indexOf(b)===-1?w.push(b):A.add(b):F.add(b)}),s.forEach(b=>{w.push(b)}),{suggestedDependencies:w,unnecessaryDependencies:F,duplicateDependencies:A,missingDependencies:s}}function X(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return X(e.consequent)!=null||X(e.alternate)!=null?"conditional":null;case"LogicalExpression":return X(e.left)!=null||X(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return X(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return X(e.expression);case"TSAsExpression":return X(e.expression)}return null}function Tt({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:a}){let l=e.map(({key:c})=>{let y=n.variables.find(s=>s.name===c);if(y==null)return null;let i=y.defs[0];if(i==null)return null;if(i.type==="Variable"&&i.node.type==="VariableDeclarator"&&i.node.id.type==="Identifier"&&i.node.init!=null){let s=X(i.node.init);if(s!=null)return[y,s]}return i.type==="FunctionName"&&i.node.type==="FunctionDeclaration"?[y,"function"]:i.type==="ClassName"&&i.node.type==="ClassDeclaration"?[y,"class"]:null}).filter(Boolean);function E(c){let y=!1;for(let i=0;i<c.references.length;i++){let s=c.references[i];if(s.writeExpr){if(y)return!0;y=!0;continue}let f=s.from;for(;f!==a&&f!=null;)f=f.upper;if(f!==a&&!He(t,s.identifier))return!0}return!1}return l.map(([c,y])=>({construction:c.defs[0],depType:y,isUsedOutsideOfHook:E(c)}))}function je(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?je(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function fe(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function z(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=z(e.object,t),a=z(e.property,null),l=`${n}.${a}`;return fe(e,t,l),l}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=z(e.object,t),a=z(e.property,null),l=`${n}.${a}`;return fe(e,t,l),l}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let a=z(n.object,t),l=z(n.property,null),E=`${a}.${l}`;return fe(n,t,E),E}else throw new Error(`Unsupported node type: ${e.type}`)}function Le(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function wt(e,t){let n=Le(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let a;try{a=z(n,null)}catch(l){if(/Unsupported node type/.test(l.message))return 0;throw l}return t.additionalHooks.test(a)?0:-1}else return-1}}function pe(e,t){let n=[e],a=null;for(;n.length;){if(a=n.shift(),It(a,t))return a;if(He(a,t))for(let[l,E]of Object.entries(a))l!=="parent"&&(Pe(E)?(E.parent=a,n.push(E)):Array.isArray(E)&&E.forEach(c=>{Pe(c)&&(c.parent=a,n.push(c))}))}return null}function Rt(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function Pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function It(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function He(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function kt(e){return!1}import{AST_NODE_TYPES as ee,ESLintUtils as Ct}from"@typescript-eslint/utils";var vt=Ct.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ne="no-call-with-inferred-generics",At=vt({name:Ne,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e){let t=e.options[0],n=new Map(t.functions.map(a=>[a.name,a]));return{CallExpression(a){let{callee:l}=a;if(l.type!==ee.Identifier)return;let E=n.get(l.name);if(!E)return;let{minGenerics:c=1,allowAny:y,disallowTypes:i=t.disallowTypes}=E;(a.typeArguments?.params.length||0)<(c||0)&&e.report({node:a,messageId:"missingGenericDeclaration",data:{functionName:l.name,minGenerics:c||0}}),!(y&&!i)&&a.typeArguments?.params?.some(f=>!y&&f.type===ee.TSAnyKeyword||i&&f.type===ee.TSTypeReference&&f.typeName.type===ee.Identifier&&i.includes(f.typeName.name))&&e.report({node:a,messageId:"anyUsedInGenerics",data:{functionName:l.name}})}}}}),me={name:Ne,rule:At};import{ESLintUtils as $t,TSESTree as We}from"@typescript-eslint/utils";var Dt=$t.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ue="no-commented-out-code",Ot=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return "],Ft=[") {","return;","if (","else {","for (","switch (","/>","</","},",": {"," } = ","={",/\w=("|')/,");"],Mt=Dt({name:Ue,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with `INFO:` if you want to keep this code commented out."},schema:[]},defaultOptions:[],create:function(e){function t(n){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("INFO:")||a.startsWith("TODO:")||a.startsWith("DOCS:")||a.startsWith("FIX:")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example"))return!1;for(let l of Ot)if(a.startsWith(l))return{wrongPattern:l};for(let l of Ft)if(typeof l=="string"){if(n.includes(l))return{wrongPattern:l}}else if(l.test(n))return{wrongPattern:`regex(${l.toString()})`};return!1}return{Program(){let a=e.sourceCode.getAllComments();for(let l of a)if(l.type===We.AST_TOKEN_TYPES.Line||l.type===We.AST_TOKEN_TYPES.Block){let E=t(l.value);E&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:E.wrongPattern}})}}}}}),de={name:Ue,rule:Mt};import{ESLintUtils as Pt}from"@typescript-eslint/utils";var _t=Pt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ze="no-default-export",jt=_t({name:ze,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let n of t.specifiers)n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ye={name:ze,rule:jt};import{AST_NODE_TYPES as G,ESLintUtils as Lt}from"@typescript-eslint/utils";var Ht=Lt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Be="no-non-camel-case-functions",Nt=/^[a-z][a-zA-Z0-9]*$/;function Ve(e){return e.typeName.type===G.TSQualifiedName&&e.typeName.left.type===G.Identifier&&e.typeName.left.name==="JSX"&&e.typeName.right.type===G.Identifier&&e.typeName.right.name==="Element"}var Wt=Ht({name:Be,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Nt.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===G.TSTypeReference?Ve(n):n.type===G.TSUnionType&&n.types.some(l=>l.type===G.TSTypeReference&&Ve(l))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),ge={name:Be,rule:Wt};import{AST_NODE_TYPES as O,ESLintUtils as Ut}from"@typescript-eslint/utils";var zt=Ut.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function qe(e){let t=[];for(let n of e.members)n.type===O.TSPropertySignature&&n.key.type===O.Identifier&&t.push([n.key.name,n]);return t}function Xe(e,...t){for(let n of t)e.set(...n);return e}var Vt=W({forceCheckOnFCPropTypesWithName:B(q(_()))}),Ge="no-unused-type-props-in-args",he=null,Bt=zt({name:Ge,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[Vt],fixable:"code"},defaultOptions:[{}],create:function(e){let{forceCheckOnFCPropTypesWithName:t}=e.options[0]||{};t&&!he&&(he=t.map(c=>new RegExp(c)));function n(c,y,i,s,f=!0){let T=i.name,w=e.sourceCode.getScope(y).references.find(b=>b.identifier.name===T)?.resolved,F=c&&he?.some(b=>b.test(T));if(!w||!F&&w.references.filter(b=>b.isTypeReference).length>1)return;let A=w?.defs[0]?.node;if(!(f&&A?.parent?.type===O.ExportNamedDeclaration)){if(A?.type===O.TSTypeAliasDeclaration){a(c,y,s,A.typeAnnotation,!0);return}if(A?.type===O.TSInterfaceDeclaration){a(c,y,s,A.body,!0);return}}}function a(c,y,i,s,f){if(s.type===O.TSInterfaceBody){for(let T of s.body)T.type===O.TSPropertySignature&&T.key.type===O.Identifier&&i.set(T.key.name,T);return}if(s.type===O.TSTypeLiteral){Xe(i,...qe(s));return}if(s.type===O.TSIntersectionType){for(let T of s.types)a(c,y,i,T,!0);return}f||s.type===O.TSTypeReference&&s.typeName.type===O.Identifier&&n(c,y,s.typeName,i)}function l(c,y,i){for(let s of i)if(s.type==="ObjectPattern"&&s.typeAnnotation){let f=new Map;if(a(c,y,f,s.typeAnnotation.typeAnnotation,!1),f.size===0)continue;E(s,f)}else s.type===O.AssignmentPattern&&s.left.type===O.ObjectPattern&&l(c,y,[s.left])}function E(c,y){let i=[];if(c.properties.at(-1)?.type===O.RestElement)return;for(let w of c.properties)w.type===O.Property&&w.key.type===O.Identifier&&i.push(w.key.name);let f=[],T=[];for(let[w,F]of y)i.includes(w)||(T.push(w),f.push({node:F,messageId:"unusedObjectTypeProperty",data:{propertyName:w}}));for(let[w,F]of f.entries())e.report({...F,fix:w===f.length-1?A=>{let b=c.properties.at(-1),p=T.join(", ");return b?b?.type===O.RestElement?null:A.insertTextAfter(b,`, ${p}`):A.insertTextBeforeRange([c.range[0]+1,c.range[1]],`${p}`)}:void 0})}return{VariableDeclaration:function(c){let y=c.declarations[0];if(!y)return;let i=new Map,s=y.id.type===O.Identifier&&y.id.typeAnnotation?.typeAnnotation.type===O.TSTypeReference&&y.id.typeAnnotation.typeAnnotation.typeName.type===O.Identifier&&y.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&y.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(s){if(s.type===O.TSTypeReference&&s.typeName.type===O.Identifier)n(!0,c,s.typeName,i,!1);else if(s.type===O.TSTypeLiteral)Xe(i,...qe(s));else if(s.type===O.TSIntersectionType)for(let f of s.types)f.type===O.TSTypeReference&&f.typeName.type===O.Identifier?n(!0,c,f.typeName,i,!1):a(!0,c,i,f,!0);if(i.size!==0&&y.init?.type===O.ArrowFunctionExpression){let f=y.init.params[0];if(!f){e.report({node:y.init,messageId:"missingComponentParam"});return}f.type===O.ObjectPattern&&E(f,i)}}},FunctionDeclaration:function(c){l(!1,c,c.params)},ArrowFunctionExpression:function(c){l(!1,c,c.params)}}}}),be={name:Ge,rule:Bt};import{ESLintUtils as qt}from"@typescript-eslint/utils";var Xt=qt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Je="prefer-named-functions",Ke=new Map,Gt=Xt({name:Je,meta:{type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e){let t=e.options[0]||{},n=null;if(t.ignoreRegex){let a=Ke.get(t.ignoreRegex);a?n=a:(n=new RegExp(t.ignoreRegex),Ke.set(t.ignoreRegex,n))}return{VariableDeclarator(a){if(a.init&&a.init.type==="ArrowFunctionExpression"&&a.id.type==="Identifier"){let l=a.id.name;if(a.id.typeAnnotation||n&&n.test(l)||!t.disallowArrowFnWithImplicitReturns&&a.init.body.type!=="BlockStatement")return;e.report({node:a.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:l,ignoreRegex:t.ignoreRegex}})}}}}}),Se={name:Je,rule:Gt};import{ESLintUtils as Kt}from"@typescript-eslint/utils";var Jt=Kt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ye="require-description",Yt=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Zt=/^eslint-disable-(next-)?line$/u,Qt=Jt({name:Ye,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e){let t=e.sourceCode,n=new Set(e.options[0]&&e.options[0].ignore||[]);return{Program(){for(let a of t.getAllComments()){let l=en(a);l!=null&&(n.has(l.kind)||l.description||e.report({loc:nn(a.loc),messageId:"missingDescription"}))}}}}}),Ze={name:Ye,rule:Qt};function en(e){let{text:t,description:n}=tn(e.value);if(!t)return null;let a=Yt.exec(t);if(!a)return null;let l=a[1];if(!l)return null;let E=Zt.test(l);if(e.type==="Line"&&!E||E&&e.loc.start.line!==e.loc.end.line)return null;let c=t.slice(a.index+l.length);return{kind:l,value:c.trim(),description:n}}function tn(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function nn(e){return{start:{line:e.start.line,column:-1},end:e.end}}function tt(e){return/^use[A-Z0-9]/.test(e)}function te(e){return e.type==="Identifier"?tt(e.name):e.type==="MemberExpression"&&!e.computed&&te(e.property)?e.object.type==="Identifier":!1}function nt(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function rt(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function st(e){return!!(e.parent&&e.parent.callee&&rt(e.parent.callee,"forwardRef"))}function it(e){return!!(e.parent&&e.parent.callee&&rt(e.parent.callee,"memo"))}function Ee(e){for(;e;){let t=at(e);if(t&&(nt(t)||te(t))||st(e)||it(e))return!0;e=e.parent}return!1}function Qe(e){return!1}function xe(e){return!1}var rn=/eslint +react-compiler\/react-compiler: +\["error/,ot={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let i of e.sourceCode.getAllComments())if(rn.test(i.value))return{CallExpression(s){let f=null;s.callee.name==="useMemo"?f="useMemo":s.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:s,message:`"${f}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?i=>t(i):i=>e.sourceCode.getText(i),n=typeof e.getScope=="function"?()=>n():i=>e.sourceCode.getScope(i),a=null,l=[],E=[],c=new WeakSet;function y(i){for(let s of i.references){let f=s.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&Qe(f.init.callee))for(let T of s.resolved.references)T!==s&&c.add(T.identifier)}}return{onCodePathSegmentStart:i=>E.push(i),onCodePathSegmentEnd:()=>E.pop(),onCodePathStart:()=>l.push(new Map),onCodePathEnd(i,s){let f=l.pop();if(f.size===0)return;let T=new Set;function w(u,v){let{cache:$}=w,I=$.get(u.id),M=new Set(v);if(M.has(u.id)){let k=[...M],P=k.slice(k.indexOf(u.id)+1);for(let H of P)T.add(H);return BigInt("0")}if(M.add(u.id),I!==void 0)return I;if(i.thrownSegments.includes(u))I=BigInt("0");else if(u.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let k of u.prevSegments)I+=w(k,M)}return u.reachable&&I===BigInt("0")?$.delete(u.id):$.set(u.id,I),I}function F(u,v){let{cache:$}=F,I=$.get(u.id),M=new Set(v);if(M.has(u.id)){let k=Array.from(M),P=k.slice(k.indexOf(u.id)+1);for(let H of P)T.add(H);return BigInt("0")}if(M.add(u.id),I!==void 0)return I;if(i.thrownSegments.includes(u))I=BigInt("0");else if(u.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let k of u.nextSegments)I+=F(k,M)}return $.set(u.id,I),I}function A(u){let{cache:v}=A,$=v.get(u.id);if($===null)return 1/0;if($!==void 0)return $;if(v.set(u.id,null),u.prevSegments.length===0)$=1;else{$=1/0;for(let I of u.prevSegments){let M=A(I);M<$&&($=M)}$+=1}return v.set(u.id,$),$}w.cache=new Map,F.cache=new Map,A.cache=new Map;let b=F(i.initialSegment),p=at(s),D=Ee(s),R=p?nt(p)||te(p):st(s)||it(s),S=1/0;for(let u of i.finalSegments){if(!u.reachable)continue;let v=A(u);v<S&&(S=v)}for(let[u,v]of f){if(!u.reachable)continue;let $=u.nextSegments.length===0?S<=A(u):S<A(u),I=w(u)*F(u),M=T.has(u.id);for(let k of v)if(M&&!xe(k)&&e.report({node:k,message:`React Hook "${t(k)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),R){if(s.async&&e.report({node:k,message:`React Hook "${t(k)}" cannot be called in an async function.`}),!M&&I!==b&&!xe(k)){let H=`React Hook "${t(k)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+($?" Did you accidentally call a React Hook after an early return?":"");e.report({node:k,message:H})}}else if(s.parent&&(s.parent.type==="MethodDefinition"||s.parent.type==="ClassProperty")&&s.parent.value===s){let P=`React Hook "${t(k)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}else if(p){let P=`React Hook "${t(k)}" is called in function "${t(p)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:k,message:P})}else if(s.type==="Program"){let P=`React Hook "${t(k)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}else if(D&&!xe(k)){if(s.parent.type==="CallExpression"&&s.parent.callee.type==="Identifier"&&s.parent.callee.name==="useCallback"){let H=s.parent;if(H.parent.type==="VariableDeclarator"&&tt(H.parent.id.name))return}let P=`React Hook "${t(k)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:k,message:P})}}},CallExpression(i){if(te(i.callee)){let s=et(l),f=et(E),T=s.get(f);T||(T=[],s.set(f,T)),T.push(i.callee)}i.callee.type==="Identifier"&&(i.callee.name==="useEffect"||Qe(i.callee))&&i.arguments.length>0&&(a=i)},Identifier(i){a==null&&c.has(i)&&i.parent.type!=="CallExpression"&&e.report({node:i,message:`\`${t(i)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(i){i===a&&(a=null)},FunctionDeclaration(i){Ee(i)&&y(n(i))},ArrowFunctionExpression(i){Ee(i)&&y(n(i))}}}};function at(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function et(e){return e[e.length-1]}var ct={[be.name]:be.rule,[de.name]:de.rule,[me.name]:me.rule,"rules-of-hooks":ot,"exhaustive-deps":_e,"require-description":Ze.rule,[ye.name]:ye.rule,[ge.name]:ge.rule,[Se.name]:Se.rule,[le.name]:le.rule};var Wn={rules:ct};export{Wn as extendedLintPlugin};
12
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=y.acquire(p),w=new Set,x=null;{let r=S.upper;for(;r&&(w.add(r),r.type!=="function");)r=r.upper;if(!r)return;x=r}let M=Array.isArray;function C(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node.type!=="VariableDeclarator")return!1;let m=o.node.init;if(m==null)return!1;for(;m.type==="TSAsExpression";)m=m.expression;let d=o.node.parent;if(d==null&&(pe(x.block,o.node.id),d=o.node.parent,d==null))return!1;if(d.kind==="const"&&m.type==="Literal"&&(typeof m.value=="string"||typeof m.value=="number"||m.value===null))return!0;if(m.type!=="CallExpression")return!1;let h=m.callee;if(h.type==="MemberExpression"&&h.object.name==="React"&&h.property!=null&&!h.computed&&(h=h.property),h.type!=="Identifier")return!1;let g=o.node.id,{name:T}=h;if(T==="useRef"&&g.type==="Identifier")return!0;if(kt(h)&&g.type==="Identifier"){for(let v of r.references)v!==g&&I.add(v.identifier);return!0}else if(T==="useState"||T==="useReducer"){if(g.type==="ArrayPattern"&&g.elements.length===2&&M(r.identifiers)){if(g.elements[1]===r.identifiers[0]){if(T==="useState"){let v=r.references,L=0;for(let U=0;U<v.length;U++){if(v[U].isWrite()&&L++,L>1)return!1;i.set(v[U].identifier,g.elements[0])}}return!0}else if(g.elements[0]===r.identifiers[0]){if(T==="useState"){let v=r.references;for(let L=0;L<v.length;L++)s.add(v[L].identifier)}return!1}}}else if(T==="useTransition"&&g.type==="ArrayPattern"&&g.elements.length===2&&Array.isArray(r.identifiers)&&g.elements[1]===r.identifiers[0])return!0;return!1}function P(r){if(!M(r.defs))return!1;let o=r.defs[0];if(o==null||o.node==null||o.node.id==null)return!1;let m=o.node,d=x.childScopes,h=null,g;for(g=0;g<d.length;g++){let T=d[g],v=T.block;if(m.type==="FunctionDeclaration"&&v===m||m.type==="VariableDeclarator"&&v.parent===m){h=T;break}}if(h==null)return!1;for(g=0;g<h.through.length;g++){let T=h.through[g];if(T.resolved!=null&&w.has(T.resolved.scope)&&!H(T.resolved))return!1}return!0}let H=O(C,f),lt=O(P,R),Te=new Map;function ut(r){let o=r.from,m=!1;for(;o.block!==p;)o.type==="function"&&(m=o.block.parent!=null&&o.block.parent.type==="ReturnStatement"),o=o.upper;return m}let j=new Map,ne=new Map;we(S);function we(r){for(let o of r.references){if(!o.resolved||!w.has(o.resolved.scope))continue;let m=pe(p,o.identifier),d=je(m),h=V(d,ne);if(u&&d.type==="Identifier"&&(d.parent.type==="MemberExpression"||d.parent.type==="OptionalMemberExpression")&&!d.parent.computed&&d.parent.property.type==="Identifier"&&d.parent.property.name==="current"&&ut(o)&&Te.set(h,{reference:o,dependencyNode:d}),d.parent.type==="TSTypeQuery"||d.parent.type==="TSTypeReference")continue;let g=o.resolved.defs[0];if(g!=null&&!(g.node!=null&&g.node.init===p.parent)&&g.type!=="TypeParameter")if(j.has(h))j.get(h).references.push(o);else{let T=o.resolved,v=H(T)||lt(T);j.set(h,{isStable:v,references:[o]})}}for(let o of r.childScopes)we(o)}Te.forEach(({reference:r,dependencyNode:o},m)=>{let d=r.resolved.references,h=!1;for(let g=0;g<d.length;g++){let{identifier:T}=d[g],{parent:v}=T;if(v!=null&&v.type==="MemberExpression"&&!v.computed&&v.property.type==="Identifier"&&v.property.name==="current"&&v.parent.type==="AssignmentExpression"&&v.parent.left===v){h=!0;break}}h||c({node:o.parent.property,message:`The ref value '${m}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${m}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let re=new Set;function ft(r,o){re.has(o)||(re.add(o),c({node:r,message:`Assignments to the '${o}' variable from inside React Hook ${t(k)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${t(k)}.`}))}let Y=new Set;if(j.forEach(({isStable:r,references:o},m)=>{r&&Y.add(m),o.forEach(d=>{d.writeExpr&&ft(d.writeExpr,m)})}),re.size>0)return;if(!D){let r=null;if(j.forEach(({isStable:o,references:m},d)=>{r||m.forEach(h=>{if(r)return;let g=h.identifier;if(!i.has(g))return;let v=h.from;for(;v.type!=="function";)v=v.upper;v.block===p&&(r=d)})}),r){let{suggestedDependencies:o}=ue({dependencies:j,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});c({node:k,message:`React Hook ${A} contains a call to '${r}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+o.join(", ")+`] as a second argument to the ${A} Hook.`,suggest:[{desc:`Add dependencies array: [${o.join(", ")}]`,fix(m){return m.insertTextAfter(p,`, [${o.join(", ")}]`)}}]})}return}let K=[],J=new Set;D.type!=="ArrayExpression"?c({node:D,message:`React Hook ${t(k)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):D.elements.forEach(r=>{if(r===null)return;if(r.type==="SpreadElement"){c({node:r,message:`React Hook ${t(k)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}I.has(r)&&c({node:r,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${t(r)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${t(r)}\``,fix(h){return h.removeRange(r.range)}}]});let o;try{o=V(r,ne)}catch(h){if(/Unsupported node type/.test(h.message)){r.type==="Literal"?j.has(r.value)?c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. Did you mean to include ${r.value} in the array instead?`}):c({node:r,message:`The ${r.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):c({node:r,message:`React Hook ${t(k)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw h}let m=r;for(;m.type==="MemberExpression"||m.type==="OptionalMemberExpression"||m.type==="ChainExpression";)m=m.object||m.expression.object;let d=!x.through.some(h=>h.identifier===m);K.push({key:o,node:r}),d||J.add(o)});let{suggestedDependencies:pt,unnecessaryDependencies:Z,missingDependencies:B,duplicateDependencies:Re}=ue({dependencies:j,declaredDependencies:K,stableDependencies:Y,externalDependencies:J,isEffect:u}),Q=pt;if(Re.size+B.size+Z.size===0){Tt({declaredDependencies:K,declaredDependenciesNode:D,componentScope:x,scope:S}).forEach(({construction:o,isUsedOutsideOfHook:m,depType:d})=>{let h=d==="function"?"useCallback":"useMemo",g=d==="function"?"definition":"initialization",T=`wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,v=m?`To fix this, ${T}`:`Move it inside the ${A} callback. Alternatively, ${T}`,L=d==="conditional"||d==="logical expression"?"could make":"makes",U=`The '${o.name.name}' ${d} ${L} the dependencies of ${A} Hook (at line ${D.loc.start.line}) change on every render. ${v}`,Ie;m&&o.type==="Variable"&&d==="function"&&(Ie=[{desc:`Wrap the ${g} of '${o.name.name}' in its own ${h}() Hook.`,fix(ke){let[dt,yt]=h==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ke.insertTextBefore(o.node.init,dt),ke.insertTextAfter(o.node.init,yt)]}}]),c({node:o.node,message:U,suggest:Ie})});return}!u&&B.size>0&&(Q=ue({dependencies:j,declaredDependencies:[],stableDependencies:Y,externalDependencies:J,isEffect:u}).suggestedDependencies);function mt(){if(K.length===0)return!0;let r=K.map(m=>m.key),o=r.slice().sort();return r.join(",")===o.join(",")}mt()&&Q.sort();function se(r){let o=r.split("."),m="";for(let d=0;d<o.length;d++){if(d!==0){let h=o.slice(0,d+1).join("."),g=ne.get(h)===!0;m+=g?"?.":"."}m+=o[d]}return m}function ie(r,o,m,d){return r.size===0?null:(r.size>1?"":o+" ")+m+" "+(r.size>1?"dependencies":"dependency")+": "+Rt(Array.from(r).sort().map(h=>"'"+se(h)+"'"))+`. Either ${d} ${r.size>1?"them":"it"} or remove the dependency array.`}let N="";if(Z.size>0){let r=null;if(Array.from(Z.keys()).forEach(o=>{r===null&&o.endsWith(".current")&&(r=o)}),r!==null)N=` Mutable values like '${r}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(J.size>0){let o=Array.from(J)[0];S.set.has(o)||(N=` Outer scope values like '${o}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!N&&B.has("props")){let r=j.get("props");if(r==null)return;let o=r.references;if(!Array.isArray(o))return;let m=!0;for(let d=0;d<o.length;d++){let h=o[d],g=pe(x.block,h.identifier);if(!g){m=!1;break}let T=g.parent;if(T==null){m=!1;break}if(T.type!=="MemberExpression"&&T.type!=="OptionalMemberExpression"){m=!1;break}}m&&(N=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${A} call and refer to those specific props inside ${t(k)}.`)}if(!N&&B.size>0){let r=null;B.forEach(o=>{if(r)return;let m=x.set.get(o),d=j.get(o);if(d.references[0].resolved!==m)return;let h=m.defs[0];if(h==null||h.name==null||h.type!=="Parameter")return;let g=!1,T;for(let v=0;v<d.references.length;v++)if(T=d.references[v].identifier,T!=null&&T.parent!=null&&(T.parent.type==="CallExpression"||T.parent.type==="OptionalCallExpression")&&T.parent.callee===T){g=!0;break}g&&(r=o)}),r!==null&&(N=` If '${r}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!N&&B.size>0){let r=null;if(B.forEach(o=>{if(r!==null)return;let d=j.get(o).references,h,g;for(let T=0;T<d.length;T++){for(h=d[T].identifier,g=h.parent;g!=null&&g!==x.block;){if(g.type==="CallExpression"){let v=i.get(g.callee);if(v!=null){if(v.name===o)r={missingDep:o,setter:g.callee.name,form:"updater"};else if(s.has(h))r={missingDep:o,setter:g.callee.name,form:"reducer"};else{let L=d[T].resolved;if(L!=null){let U=L.defs[0];U!=null&&U.type==="Parameter"&&(r={missingDep:o,setter:g.callee.name,form:"inlineReducer"})}}break}}g=g.parent}if(r!==null)break}}),r!==null)switch(r.form){case"reducer":N=` You can also replace multiple useState variables with useReducer if '${r.setter}' needs the current value of '${r.missingDep}'.`;break;case"inlineReducer":N=` If '${r.setter}' needs the current value of '${r.missingDep}', you can also switch to useReducer instead of useState and read '${r.missingDep}' in the reducer.`;break;case"updater":N=` You can also do a functional update '${r.setter}(${r.missingDep.slice(0,1)} => ...)' if you only need '${r.missingDep}' in the '${r.setter}' call.`;break;default:throw new Error("Unknown case.")}}c({node:D,message:`React Hook ${t(k)} has `+(ie(B,"a","missing","include")||ie(Z,"an","unnecessary","exclude")||ie(Re,"a","duplicate","omit"))+N,suggest:[{desc:`Update the dependencies array to be: [${Q.map(se).join(", ")}]`,fix(r){return r.replaceText(D,`[${Q.map(se).join(", ")}]`)}}]})}function b(p){let D=wt(p.callee,E);if(D===-1)return;let k=p.arguments[D],A=p.callee,u=Le(A).name,S=p.arguments[D+1],w=/Effect($|[^a-z])/g.test(u);if(!k){c({node:A,message:`React Hook ${u} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!S&&!w){(u==="useMemo"||u==="useCallback")&&c({node:A,message:`React Hook ${u} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(k.type){case"FunctionExpression":case"ArrowFunctionExpression":$(k,S,A,u,w);return;case"Identifier":if(!S||S.elements&&S.elements.some(C=>C&&C.type==="Identifier"&&C.name===k.name))return;let x=n(p).set.get(k.name);if(x==null||x.defs==null)return;let M=x.defs[0];if(!M||!M.node||M.type!=="Variable"&&M.type!=="FunctionName")break;switch(M.node.type){case"FunctionDeclaration":$(M.node,S,A,u,w);return;case"VariableDeclarator":let C=M.node.init;if(!C)break;switch(C.type){case"ArrowFunctionExpression":case"FunctionExpression":$(C,S,A,u,w);return}break}break;default:c({node:A,message:`React Hook ${u} received a function whose dependencies are unknown. Pass an inline function instead.`});return}c({node:A,message:`React Hook ${u} has a missing dependency: '${k.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${k.name}]`,fix(x){return x.replaceText(S,`[${k.name}]`)}}]})}return{CallExpression:b}}};function ue({dependencies:e,declaredDependencies:t,stableDependencies:n,externalDependencies:a,isEffect:l}){let E=c();function c(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,p)=>{let D=y(E,p);D.isUsed=!0,i(E,p,k=>{k.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let p=y(E,b);p.isSatisfiedRecursively=!0}),n.forEach(b=>{let p=y(E,b);p.isSatisfiedRecursively=!0});function y(b,p){let D=p.split("."),k=b;for(let A of D){let u=k.children.get(A);u||(u=c(),k.children.set(A,u)),k=u}return k}function i(b,p,D){let k=p.split("."),A=b;for(let u of k){let S=A.children.get(u);if(!S)return;D(S),A=S}}let s=new Set,f=new Set;R(E,s,f,b=>b);function R(b,p,D,k){b.children.forEach((A,u)=>{let S=k(u);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&D.add(S);return}if(A.isUsed){p.add(S);return}R(A,p,D,w=>S+"."+w)})}let I=[],O=new Set,$=new Set;return t.forEach(({key:b})=>{f.has(b)?I.indexOf(b)===-1?I.push(b):$.add(b):O.add(b)}),s.forEach(b=>{I.push(b)}),{suggestedDependencies:I,unnecessaryDependencies:O,duplicateDependencies:$,missingDependencies:s}}function X(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return X(e.consequent)!=null||X(e.alternate)!=null?"conditional":null;case"LogicalExpression":return X(e.left)!=null||X(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return X(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return X(e.expression);case"TSAsExpression":return X(e.expression)}return null}function Tt({declaredDependencies:e,declaredDependenciesNode:t,componentScope:n,scope:a}){let l=e.map(({key:c})=>{let y=n.variables.find(s=>s.name===c);if(y==null)return null;let i=y.defs[0];if(i==null)return null;if(i.type==="Variable"&&i.node.type==="VariableDeclarator"&&i.node.id.type==="Identifier"&&i.node.init!=null){let s=X(i.node.init);if(s!=null)return[y,s]}return i.type==="FunctionName"&&i.node.type==="FunctionDeclaration"?[y,"function"]:i.type==="ClassName"&&i.node.type==="ClassDeclaration"?[y,"class"]:null}).filter(Boolean);function E(c){let y=!1;for(let i=0;i<c.references.length;i++){let s=c.references[i];if(s.writeExpr){if(y)return!0;y=!0;continue}let f=s.from;for(;f!==a&&f!=null;)f=f.upper;if(f!==a&&!He(t,s.identifier))return!0}return!1}return l.map(([c,y])=>({construction:c.defs[0],depType:y,isUsedOutsideOfHook:E(c)}))}function je(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?je(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function fe(e,t,n){t&&(e.optional?t.has(n)||t.set(n,!0):t.has(n)||t.set(n,!1))}function V(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let n=e.name;return t&&t.set(n,!1),n}else if(e.type==="MemberExpression"&&!e.computed){let n=V(e.object,t),a=V(e.property,null),l=`${n}.${a}`;return fe(e,t,l),l}else if(e.type==="OptionalMemberExpression"&&!e.computed){let n=V(e.object,t),a=V(e.property,null),l=`${n}.${a}`;return fe(e,t,l),l}else if(e.type==="ChainExpression"&&!e.computed){let n=e.expression;if(n.type==="CallExpression")throw new Error(`Unsupported node type: ${n.type}`);let a=V(n.object,t),l=V(n.property,null),E=`${a}.${l}`;return fe(n,t,E),E}else throw new Error(`Unsupported node type: ${e.type}`)}function Le(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function wt(e,t){let n=Le(e);if(n.type!=="Identifier")return-1;switch(n.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(n===e&&t&&t.additionalHooks){let a;try{a=V(n,null)}catch(l){if(/Unsupported node type/.test(l.message))return 0;throw l}return t.additionalHooks.test(a)?0:-1}else return-1}}function pe(e,t){let n=[e],a=null;for(;n.length;){if(a=n.shift(),It(a,t))return a;if(He(a,t))for(let[l,E]of Object.entries(a))l!=="parent"&&(Pe(E)?(E.parent=a,n.push(E)):Array.isArray(E)&&E.forEach(c=>{Pe(c)&&(c.parent=a,n.push(c))}))}return null}function Rt(e){let t="";for(let n=0;n<e.length;n++)t+=e[n],n===0&&e.length===2?t+=" and ":n===e.length-2&&e.length>2?t+=", and ":n<e.length-1&&(t+=", ");return t}function Pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function It(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function He(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function kt(e){return!1}import{AST_NODE_TYPES as ee,ESLintUtils as Ct}from"@typescript-eslint/utils";var vt=Ct.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ne="no-call-with-inferred-generics",$t=vt({name:Ne,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e){let t=e.options[0],n=new Map(t.functions.map(a=>[a.name,a]));return{CallExpression(a){let{callee:l}=a;if(l.type!==ee.Identifier)return;let E=n.get(l.name);if(!E)return;let{minGenerics:c=1,allowAny:y,disallowTypes:i=t.disallowTypes}=E;(a.typeArguments?.params.length||0)<(c||0)&&e.report({node:a,messageId:"missingGenericDeclaration",data:{functionName:l.name,minGenerics:c||0}}),!(y&&!i)&&a.typeArguments?.params?.some(f=>!y&&f.type===ee.TSAnyKeyword||i&&f.type===ee.TSTypeReference&&f.typeName.type===ee.Identifier&&i.includes(f.typeName.name))&&e.report({node:a,messageId:"anyUsedInGenerics",data:{functionName:l.name}})}}}}),me={name:Ne,rule:$t};import{ESLintUtils as At,TSESTree as We}from"@typescript-eslint/utils";var Dt=At.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ue="no-commented-out-code",Ot=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return "],Ft=[") {","return;","if (","else {","for (","switch (","/>","</","},",": {"," } = ","={",/\w=("|')/,");"],Mt=Dt({name:Ue,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with `INFO:` if you want to keep this code commented out."},schema:[]},defaultOptions:[],create:function(e){function t(n){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("INFO:")||a.startsWith("TODO:")||a.startsWith("DOCS:")||a.startsWith("FIX:")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example"))return!1;for(let l of Ot)if(a.startsWith(l))return{wrongPattern:l};for(let l of Ft)if(typeof l=="string"){if(n.includes(l))return{wrongPattern:l}}else if(l.test(n))return{wrongPattern:`regex(${l.toString()})`};return!1}return{Program(){let a=e.sourceCode.getAllComments();for(let l of a)if(l.type===We.AST_TOKEN_TYPES.Line||l.type===We.AST_TOKEN_TYPES.Block){let E=t(l.value);E&&e.report({node:l,messageId:"commentedOutCode",data:{wrongPattern:E.wrongPattern}})}}}}}),de={name:Ue,rule:Mt};import{ESLintUtils as Pt}from"@typescript-eslint/utils";var _t=Pt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ze="no-default-export",jt=_t({name:ze,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let n of t.specifiers)n.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ye={name:ze,rule:jt};import{AST_NODE_TYPES as G,ESLintUtils as Lt}from"@typescript-eslint/utils";var Ht=Lt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Be="no-non-camel-case-functions",Nt=/^[a-z][a-zA-Z0-9]*$/;function Ve(e){return e.typeName.type===G.TSQualifiedName&&e.typeName.left.type===G.Identifier&&e.typeName.left.name==="JSX"&&e.typeName.right.type===G.Identifier&&e.typeName.right.name==="Element"}var Wt=Ht({name:Be,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Nt.test(t.id.name)){let n=t.returnType?.typeAnnotation;if(n&&(n.type===G.TSTypeReference?Ve(n):n.type===G.TSUnionType&&n.types.some(l=>l.type===G.TSTypeReference&&Ve(l))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),ge={name:Be,rule:Wt};import{AST_NODE_TYPES as F,ESLintUtils as Ut}from"@typescript-eslint/utils";var zt=Ut.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function qe(e){let t=[];for(let n of e.members)n.type===F.TSPropertySignature&&n.key.type===F.Identifier&&t.push([n.key.name,n]);return t}function Xe(e,...t){for(let n of t)e.set(...n);return e}var Vt=W({forceCheckOnFCPropTypesWithName:z(q(_()))}),Ge="no-unused-type-props-in-args",he=null,Bt=zt({name:Ge,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[Vt],fixable:"code"},defaultOptions:[{}],create:function(e){let{forceCheckOnFCPropTypesWithName:t}=e.options[0]||{};t&&!he&&(he=t.map(c=>new RegExp(c)));function n(c,y,i,s,f=!0){let R=i.name,I=e.sourceCode.getScope(y).references.find(b=>b.identifier.name===R)?.resolved,O=c&&he?.some(b=>b.test(R));if(!I||!O&&I.references.filter(b=>b.isTypeReference).length>1)return;let $=I?.defs[0]?.node;if(!(f&&$?.parent?.type===F.ExportNamedDeclaration)){if($?.type===F.TSTypeAliasDeclaration){a(c,y,s,$.typeAnnotation,!0);return}if($?.type===F.TSInterfaceDeclaration){a(c,y,s,$.body,!0);return}}}function a(c,y,i,s,f){if(s.type===F.TSInterfaceBody){for(let R of s.body)R.type===F.TSPropertySignature&&R.key.type===F.Identifier&&i.set(R.key.name,R);return}if(s.type===F.TSTypeLiteral){Xe(i,...qe(s));return}if(s.type===F.TSIntersectionType){for(let R of s.types)a(c,y,i,R,!0);return}f||s.type===F.TSTypeReference&&s.typeName.type===F.Identifier&&n(c,y,s.typeName,i)}function l(c,y,i){for(let s of i)if(s.type==="ObjectPattern"&&s.typeAnnotation){let f=new Map;if(a(c,y,f,s.typeAnnotation.typeAnnotation,!1),f.size===0)continue;E(s,f)}else s.type===F.AssignmentPattern&&s.left.type===F.ObjectPattern&&l(c,y,[s.left])}function E(c,y){let i=[];if(c.properties.at(-1)?.type===F.RestElement)return;for(let I of c.properties)I.type===F.Property&&I.key.type===F.Identifier&&i.push(I.key.name);let f=[],R=[];for(let[I,O]of y)i.includes(I)||(R.push(I),f.push({node:O,messageId:"unusedObjectTypeProperty",data:{propertyName:I}}));for(let[I,O]of f.entries())e.report({...O,fix:I===f.length-1?$=>{let b=c.properties.at(-1),p=R.join(", ");return b?b?.type===F.RestElement?null:$.insertTextAfter(b,`, ${p}`):$.insertTextBeforeRange([c.range[0]+1,c.range[1]],`${p}`)}:void 0})}return{VariableDeclaration:function(c){let y=c.declarations[0];if(!y)return;let i=new Map,s=y.id.type===F.Identifier&&y.id.typeAnnotation?.typeAnnotation.type===F.TSTypeReference&&y.id.typeAnnotation.typeAnnotation.typeName.type===F.Identifier&&y.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&y.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(s){if(s.type===F.TSTypeReference&&s.typeName.type===F.Identifier)n(!0,c,s.typeName,i,!1);else if(s.type===F.TSTypeLiteral)Xe(i,...qe(s));else if(s.type===F.TSIntersectionType)for(let f of s.types)f.type===F.TSTypeReference&&f.typeName.type===F.Identifier?n(!0,c,f.typeName,i,!1):a(!0,c,i,f,!0);if(i.size!==0&&y.init?.type===F.ArrowFunctionExpression){let f=y.init.params[0];if(!f){e.report({node:y.init,messageId:"missingComponentParam"});return}f.type===F.ObjectPattern&&E(f,i)}}},FunctionDeclaration:function(c){l(!1,c,c.params)},ArrowFunctionExpression:function(c){l(!1,c,c.params)}}}}),be={name:Ge,rule:Bt};import{ESLintUtils as qt}from"@typescript-eslint/utils";var Xt=qt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Je="prefer-named-functions",Ke=new Map,Gt=Xt({name:Je,meta:{type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e){let t=e.options[0]||{},n=null;if(t.ignoreRegex){let a=Ke.get(t.ignoreRegex);a?n=a:(n=new RegExp(t.ignoreRegex),Ke.set(t.ignoreRegex,n))}return{VariableDeclarator(a){if(a.init&&a.init.type==="ArrowFunctionExpression"&&a.id.type==="Identifier"){let l=a.id.name;if(a.id.typeAnnotation||n&&n.test(l)||!t.disallowArrowFnWithImplicitReturns&&a.init.body.type!=="BlockStatement")return;e.report({node:a.id,messageId:n?"withIgnoreRegex":"default",data:{functionName:l,ignoreRegex:t.ignoreRegex}})}}}}}),Se={name:Je,rule:Gt};import{ESLintUtils as Kt}from"@typescript-eslint/utils";var Jt=Kt.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ye="require-description",Yt=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Zt=/^eslint-disable-(next-)?line$/u,Qt=Jt({name:Ye,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e){let t=e.sourceCode,n=new Set(e.options[0]&&e.options[0].ignore||[]);return{Program(){for(let a of t.getAllComments()){let l=en(a);l!=null&&(n.has(l.kind)||l.description||e.report({loc:nn(a.loc),messageId:"missingDescription"}))}}}}}),Ze={name:Ye,rule:Qt};function en(e){let{text:t,description:n}=tn(e.value);if(!t)return null;let a=Yt.exec(t);if(!a)return null;let l=a[1];if(!l)return null;let E=Zt.test(l);if(e.type==="Line"&&!E||E&&e.loc.start.line!==e.loc.end.line)return null;let c=t.slice(a.index+l.length);return{kind:l,value:c.trim(),description:n}}function tn(e){let t=e.split(/\s-{2,}\s/u);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function nn(e){return{start:{line:e.start.line,column:-1},end:e.end}}function tt(e){return/^use[A-Z0-9]/.test(e)}function te(e){return e.type==="Identifier"?tt(e.name):e.type==="MemberExpression"&&!e.computed&&te(e.property)?e.object.type==="Identifier":!1}function nt(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function rt(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function st(e){return!!(e.parent&&e.parent.callee&&rt(e.parent.callee,"forwardRef"))}function it(e){return!!(e.parent&&e.parent.callee&&rt(e.parent.callee,"memo"))}function Ee(e){for(;e;){let t=at(e);if(t&&(nt(t)||te(t))||st(e)||it(e))return!0;e=e.parent}return!1}function Qe(e){return!1}function xe(e){return!1}var rn=/eslint +react-compiler\/react-compiler: +\["error/,ot={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let i of e.sourceCode.getAllComments())if(rn.test(i.value))return{CallExpression(s){let f=null;s.callee.name==="useMemo"?f="useMemo":s.callee.name==="useCallback"&&(f="useCallback"),f&&e.report({node:s,message:`"${f}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?i=>t(i):i=>e.sourceCode.getText(i),n=typeof e.getScope=="function"?()=>n():i=>e.sourceCode.getScope(i),a=null,l=[],E=[],c=new WeakSet;function y(i){for(let s of i.references){let f=s.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&Qe(f.init.callee))for(let R of s.resolved.references)R!==s&&c.add(R.identifier)}}return{onCodePathSegmentStart:i=>E.push(i),onCodePathSegmentEnd:()=>E.pop(),onCodePathStart:()=>l.push(new Map),onCodePathEnd(i,s){let f=l.pop();if(f.size===0)return;let R=new Set;function I(u,S){let{cache:w}=I,x=w.get(u.id),M=new Set(S);if(M.has(u.id)){let C=[...M],P=C.slice(C.indexOf(u.id)+1);for(let H of P)R.add(H);return BigInt("0")}if(M.add(u.id),x!==void 0)return x;if(i.thrownSegments.includes(u))x=BigInt("0");else if(u.prevSegments.length===0)x=BigInt("1");else{x=BigInt("0");for(let C of u.prevSegments)x+=I(C,M)}return u.reachable&&x===BigInt("0")?w.delete(u.id):w.set(u.id,x),x}function O(u,S){let{cache:w}=O,x=w.get(u.id),M=new Set(S);if(M.has(u.id)){let C=Array.from(M),P=C.slice(C.indexOf(u.id)+1);for(let H of P)R.add(H);return BigInt("0")}if(M.add(u.id),x!==void 0)return x;if(i.thrownSegments.includes(u))x=BigInt("0");else if(u.nextSegments.length===0)x=BigInt("1");else{x=BigInt("0");for(let C of u.nextSegments)x+=O(C,M)}return w.set(u.id,x),x}function $(u){let{cache:S}=$,w=S.get(u.id);if(w===null)return 1/0;if(w!==void 0)return w;if(S.set(u.id,null),u.prevSegments.length===0)w=1;else{w=1/0;for(let x of u.prevSegments){let M=$(x);M<w&&(w=M)}w+=1}return S.set(u.id,w),w}I.cache=new Map,O.cache=new Map,$.cache=new Map;let b=O(i.initialSegment),p=at(s),D=Ee(s),k=p?nt(p)||te(p):st(s)||it(s),A=1/0;for(let u of i.finalSegments){if(!u.reachable)continue;let S=$(u);S<A&&(A=S)}for(let[u,S]of f){if(!u.reachable)continue;let w=u.nextSegments.length===0?A<=$(u):A<$(u),x=I(u)*O(u),M=R.has(u.id);for(let C of S)if(M&&!xe(C)&&e.report({node:C,message:`React Hook "${t(C)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),k){if(s.async&&e.report({node:C,message:`React Hook "${t(C)}" cannot be called in an async function.`}),!M&&x!==b&&!xe(C)){let H=`React Hook "${t(C)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:C,message:H})}}else if(s.parent&&(s.parent.type==="MethodDefinition"||s.parent.type==="ClassProperty")&&s.parent.value===s){let P=`React Hook "${t(C)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}else if(p){let P=`React Hook "${t(C)}" is called in function "${t(p)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:C,message:P})}else if(s.type==="Program"){let P=`React Hook "${t(C)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}else if(D&&!xe(C)){if(s.parent.type==="CallExpression"&&s.parent.callee.type==="Identifier"&&s.parent.callee.name==="useCallback"){let H=s.parent;if(H.parent.type==="VariableDeclarator"&&tt(H.parent.id.name))return}let P=`React Hook "${t(C)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:C,message:P})}}},CallExpression(i){if(te(i.callee)){let s=et(l),f=et(E),R=s.get(f);R||(R=[],s.set(f,R)),R.push(i.callee)}i.callee.type==="Identifier"&&(i.callee.name==="useEffect"||Qe(i.callee))&&i.arguments.length>0&&(a=i)},Identifier(i){a==null&&c.has(i)&&i.parent.type!=="CallExpression"&&e.report({node:i,message:`\`${t(i)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(i){i===a&&(a=null)},FunctionDeclaration(i){Ee(i)&&y(n(i))},ArrowFunctionExpression(i){Ee(i)&&y(n(i))}}}};function at(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function et(e){return e[e.length-1]}var ct={[be.name]:be.rule,[de.name]:de.rule,[me.name]:me.rule,"rules-of-hooks":ot,"exhaustive-deps":_e,"require-description":Ze.rule,[ye.name]:ye.rule,[ge.name]:ge.rule,[Se.name]:Se.rule,[le.name]:le.rule};var Wn={rules:ct};export{Wn as extendedLintPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"