@ls-stack/extended-lint 0.61.1 → 0.61.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.
@@ -12,7 +12,7 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(c),I=new Set,v=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;v=T}let R=Array.isArray;function N(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let P=C.node.parent;if(P==null&&(yt(v.block,C.node.id),P=C.node.parent,P==null))return!1;if(P.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let O=k.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let F=C.node.id,{name:M}=O;if(M==="useRef"&&F.type==="Identifier")return!0;if(Ur(O)&&F.type==="Identifier"){for(let j of T.references)j!==F&&d.add(j.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(F.type==="ArrayPattern"&&F.elements.length===2&&R(T.identifiers)){if(F.elements[1]===T.identifiers[0]){if(M==="useState"){let j=T.references,ce=0;for(let Te=0;Te<j.length;Te++){if(j[Te].isWrite()&&ce++,ce>1)return!1;p.set(j[Te].identifier,F.elements[0])}}return!0}else if(F.elements[0]===T.identifiers[0]){if(M==="useState"){let j=T.references;for(let ce=0;ce<j.length;ce++)u.add(j[ce].identifier)}return!1}}}else if(M==="useTransition"&&F.type==="ArrayPattern"&&F.elements.length===2&&Array.isArray(T.identifiers)&&F.elements[1]===T.identifiers[0])return!0;return!1}function L(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,P=v.childScopes,O=null,F;for(F=0;F<P.length;F++){let M=P[F],j=M.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){O=M;break}}if(O==null)return!1;for(F=0;F<O.through.length;F++){let M=O.through[F];if(M.resolved!=null&&I.has(M.resolved.scope)&&!Z(M.resolved))return!1}return!0}let Z=y(N,m),q=y(L,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==c;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let Y=new Map,de=new Map;De(S);function De(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=yt(c,C.identifier),P=yn(k),O=Ee(P,de);if(w&&P.type==="Identifier"&&(P.parent.type==="MemberExpression"||P.parent.type==="OptionalMemberExpression")&&!P.parent.computed&&P.parent.property.type==="Identifier"&&P.parent.property.name==="current"&&te(C)&&ee.set(O,{reference:C,dependencyNode:P}),P.parent.type==="TSTypeQuery"||P.parent.type==="TSTypeReference")continue;let F=C.resolved.defs[0];if(F!=null&&!(F.node!=null&&F.node.init===c.parent)&&F.type!=="TypeParameter")if(Y.has(O))Y.get(O).references.push(C);else{let M=C.resolved,j=Z(M)||q(M);Y.set(O,{isStable:j,references:[C]})}}for(let C of T.childScopes)De(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let P=T.resolved.references,O=!1;for(let F=0;F<P.length;F++){let{identifier:M}=P[F],{parent:j}=M;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){O=!0;break}}O||s({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Ce(T,C){ie.has(C)||(ie.add(C),s({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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 ${r(b)}.`}))}let pe=new Set;if(Y.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(P=>{P.writeExpr&&Ce(P.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(Y.forEach(({isStable:C,references:k},P)=>{T||k.forEach(O=>{if(T)return;let F=O.identifier;if(!p.has(F))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===c&&(T=P)})}),T){let{suggestedDependencies:C}=mt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(c,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],Ue=new Set;x.type!=="ArrayExpression"?s({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(O){return O.removeRange(T.range)}}]});let C;try{C=Ee(T,de)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?Y.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let P=!v.through.some(O=>O.identifier===k);Pe.push({key:C,node:T}),P||Ue.add(C)});let{suggestedDependencies:ur,unnecessaryDependencies:Ye,missingDependencies:Ie,duplicateDependencies:en}=mt({dependencies:Y,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:Ue,isEffect:w}),Be=ur;if(en.size+Ie.size+Ye.size===0){if(n)return;jr({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:P})=>{let O=P==="function"?"useCallback":"useMemo",F=P==="function"?"definition":"initialization",M=`wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,j=k?`To fix this, ${M}`:`Move it inside the ${g} callback. Alternatively, ${M}`,ce=P==="conditional"||P==="logical expression"?"could make":"makes",Te=`The '${C.name.name}' ${P} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${j}`,tn;k&&C.type==="Variable"&&P==="function"&&(tn=[{desc:`Wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,fix(nn){let[mr,dr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[nn.insertTextBefore(C.node.init,mr),nn.insertTextAfter(C.node.init,dr)]}}]),s({node:C.node,message:Te,suggest:tn})});return}!w&&Ie.size>0&&(Be=mt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:Ue,isEffect:w}).suggestedDependencies);function fr(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}fr()&&Be.sort();function ot(T){let C=T.split("."),k="";for(let P=0;P<C.length;P++){if(P!==0){let O=C.slice(0,P+1).join("."),F=de.get(O)===!0;k+=F?"?.":"."}k+=C[P]}return k}function at(T,C,k,P){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+_r(Array.from(T).sort().map(O=>"'"+ot(O)+"'"))+`. Either ${P} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Ye.size>0){let T=null;if(Array.from(Ye.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)fe=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ue.size>0){let C=Array.from(Ue)[0];S.set.has(C)||(fe=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&Ie.has("props")){let T=Y.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let P=0;P<C.length;P++){let O=C[P],F=yt(v.block,O.identifier);if(!F){k=!1;break}let M=F.parent;if(M==null){k=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){k=!1;break}}k&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&Ie.size>0){let T=null;Ie.forEach(C=>{if(T)return;let k=v.set.get(C),P=Y.get(C);if(P.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let F=!1,M;for(let j=0;j<P.references.length;j++)if(M=P.references[j].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){F=!0;break}F&&(T=C)}),T!==null&&(fe=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&Ie.size>0){let T=null;if(Ie.forEach(C=>{if(T!==null)return;let P=Y.get(C).references,O,F;for(let M=0;M<P.length;M++){for(O=P[M].identifier,F=O.parent;F!=null&&F!==v.block;){if(F.type==="CallExpression"){let j=p.get(F.callee);if(j!=null){if(j.name===C)T={missingDep:C,setter:F.callee.name,form:"updater"};else if(u.has(O))T={missingDep:C,setter:F.callee.name,form:"reducer"};else{let ce=P[M].resolved;if(ce!=null){let Te=ce.defs[0];Te!=null&&Te.type==="Parameter"&&(T={missingDep:C,setter:F.callee.name,form:"inlineReducer"})}}break}}F=F.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":fe=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:x,message:`React Hook ${r(b)} has `+(at(Ie,"a","missing","include")||at(Ye,"an","unnecessary","exclude")||at(en,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Be.map(ot).join(", ")}]`,fix(T){return T.replaceText(x,`[${Be.map(ot).join(", ")}]`)}}]})}function h(c){let x=Lr(c.callee,i);if(x===-1)return;let b=c.arguments[x],g=c.callee,w=gn(g).name,S=c.arguments[x+1],I=/Effect($|[^a-z])/g.test(w);if(!b){s({node:g,message:`React Hook ${w} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!I)){if(!S&&!I){(w==="useMemo"||w==="useCallback")&&s({node:g,message:`React Hook ${w} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,w,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let v=t(c).set.get(b.name);if(v==null||v.defs==null)return;let R=v.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,w,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,w,I);return}break}break;default:s({node:g,message:`React Hook ${w} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${w} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(v){return v.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let c of e.sourceCode.getAllComments())if(Mr.test(c.value))return n=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:c=>h(c)}}};function mt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let c=s(a,h);c.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let h=s(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=s(a,E);h.isSatisfiedRecursively=!0});function s(E,h){let c=h.split("."),x=E;for(let b of c){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,c){let x=h.split("."),b=E;for(let g of x){let w=b.children.get(g);if(!w)return;c(w),b=w}}let p=new Set,u=new Set;m(a,p,u,E=>E);function m(E,h,c,x){E.children.forEach((b,g)=>{let w=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&c.add(w);return}if(b.isUsed){h.add(w);return}m(b,h,c,S=>w+"."+S)})}let f=[],d=new Set,y=new Set;return n.forEach(({key:E})=>{u.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function we(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 we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function jr({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!Sn(n,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function yn(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)?yn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function dt(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Ee(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Ee(e.object,n),t=Ee(e.property,null),o=`${r}.${t}`;return dt(e,n,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ee(e.object,n),t=Ee(e.property,null),o=`${r}.${t}`;return dt(e,n,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Ee(r.object,n),o=Ee(r.property,null),a=`${t}.${o}`;return dt(r,n,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function gn(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Lr(e,n){let r=gn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Ee(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return n.additionalHooks.test(t)?0:-1}else return-1}}function yt(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),$r(t,n))return t;if(Sn(t,n))for(let[o,a]of Object.entries(t))o!=="parent"&&(mn(a)?(a.parent=t,r.push(a)):Array.isArray(a)&&a.forEach(i=>{mn(i)&&(i.parent=t,r.push(i))}))}return null}function _r(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function $r(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function Sn(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function Ur(e){return!1}var Ae=require("@typescript-eslint/utils"),re=he(require("typescript")),hn=require("zod/v4");var zr=Ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tn="improved-no-unnecessary-condition",Wr=hn.z.object({}),Vr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Hr=new Set(Vr),gt={name:Tn,rule:zr({name:Tn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[_(Wr)]},defaultOptions:[{}],create(e){let n=Ae.ESLintUtils.getParserServices(e,!0),r=n.program?.getTypeChecker();if(!r||!n.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===Ae.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown?null:s.flags&re.default.TypeFlags.StringLike?["string"]:s.flags&re.default.TypeFlags.NumberLike?["number"]:s.flags&re.default.TypeFlags.BigIntLike?["bigint"]:s.flags&re.default.TypeFlags.BooleanLike?["boolean"]:s.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&re.default.TypeFlags.Undefined||s.flags&re.default.TypeFlags.Void?["undefined"]:s.flags&re.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&re.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&re.default.TypeFlags.NonPrimitive?["object"]:s.flags&re.default.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=n.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)u.push(...d);else return null}return u}let m=o(p);return m?(u.push(...m),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===Ae.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===Ae.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Jr(u,Hr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(u);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:u}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:Xe(m)}})}return{BinaryExpression:i}}})};function Xe(e){return Array.from(new Set(e)).join(" | ")||"never"}function Me(e,n){let r=e.argument;return r.type===Ae.AST_NODE_TYPES.Identifier?r.name:n.sourceCode.getText(r)}function Jr(e,n){return n.has(e)}var Ze=require("@typescript-eslint/utils"),Ge=require("zod/v4");var Yr=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-call-with-explicit-generics",Br=Ge.z.object({functions:Ge.z.array(Ge.z.string())}),qr=Yr({name:En,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[_(Br)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:o}=t;o.type===Ze.AST_NODE_TYPES.Identifier&&r.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),St={name:En,rule:qr};var Fe=require("@typescript-eslint/utils"),Xr=Fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xn="no-call-with-inferred-generics",Gr=Xr({name:xn,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,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==Fe.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=n.disallowTypes}=a;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&t.typeArguments?.params.some(u=>!s&&u.type===Fe.AST_NODE_TYPES.TSAnyKeyword||l&&u.type===Fe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===Fe.AST_NODE_TYPES.Identifier&&l.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Tt={name:xn,rule:Gr};var In=require("@typescript-eslint/utils"),Zr=In.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-commented-out-code",Kr=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Qr=/^\s*return\s+/,ei=/\w=("|'|`)/,ti=/\w+:\s*('|"|`)/,ni=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,ri=/\w+-\w+:/,ii=/\w+_\w+:/,si=/\?\s+\w/,oi=/:\s+\w/,ai=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,li=/^\s*\d+[,}]/,pi=/^\s*\[[^\]]*\][,}]/,ci=/^\s*\{[^}]*\}[,}]/,ui=/\.\w+\(/,fi=/\[\w+\]/,mi=/^\s*(['"`]).+?\1\s*:/,di=/^<[A-Z]\w*(\s|>|\/)/,yi=/^<[a-z]+(\s|>|\/)/,gi=/<[A-Z]\w*(\s.*)?>/,Si=/<\/[A-Z]\w*>/,Ti=/<[a-z]+(\s.*)?>/,hi=/<\/[a-z]+>/,Ei=/^\s*[*\s]*$/,xi=/^[a-zA-Z]/,bi=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ci=/```[\s\S]*?```/g,Ii=/`[^`]*`/g,bn=/[a-zA-Z0-9]/,Ri=/\.[A-Za-z_][A-Za-z0-9_]*\(/,wi=/[{}[\]()`=<>]/,Ai=/:\s*(['"`[{(]|\w+\s*=>)/,vi=/\bif\s*\(|\belse\b|=>/,X={returnStatement:Qr,stringAssignment:ei,objectPropertyWithQuotes:ti,computedPropertyAssignment:ni,kebabCaseProperty:ri,snakeCaseProperty:ii,ternaryOperator:si,colonWithWord:oi,quotedString:ai,numberWithComma:li,arrayWithComma:pi,objectWithComma:ci,methodCall:ui,arrayAccess:fi,quotedPropertyKey:mi,jsxSelfClosing:di,jsxElement:yi,jsxOpeningTag:gi,jsxClosingTag:Si,htmlOpeningTag:Ti,htmlClosingTag:hi,jsdocComment:Ei};function ki(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&xi.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||Ri.test(n)||wi.test(n)||Ai.test(n)||vi.test(n)?!1:!!(n.includes(":")&&bi.test(n))}var Pi=[") {","return;",X.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",X.stringAssignment,");",X.objectPropertyWithQuotes,X.computedPropertyAssignment,X.kebabCaseProperty,X.snakeCaseProperty,"&&","||","()",X.ternaryOperator,X.colonWithWord,X.quotedString,X.numberWithComma,X.arrayWithComma,X.objectWithComma,X.methodCall,X.arrayAccess,"?.(","??","=>",X.quotedPropertyKey],Fi=["/>","</",X.jsxSelfClosing,X.jsxElement,X.jsxOpeningTag,X.jsxClosingTag,X.htmlOpeningTag,X.htmlClosingTag],Cn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Oi=Zr({name:Rn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,o){if(t.startsWith("/"))return!1;let a=t.trimStart();if(t.startsWith("*")||a.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||X.jsdocComment.test(t))return!1;for(let i of Cn)if(a.startsWith(i))return!1;if(t.includes("https://")||ki(a))return!1;if(o==="Block"){for(let i of Fi)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Kr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Pi)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,o){let a=t,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ci);p.some(m=>bn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(Ii);return s.some(p=>bn.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=n(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:Cn.join(", ")}})}}}}}),ht={name:Rn,rule:Oi};var Ke=require("@typescript-eslint/utils"),Ni=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-default-export",Di=Ni({name:wn,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(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===Ke.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Et={name:wn,rule:Di};var An=require("@typescript-eslint/utils"),Mi=An.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vn="no-leaked-text-in-jsx",ji=[",",";","[","]","(",")"],Li=Mi({name:vn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";ji.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),xt={name:vn,rule:Li};var ve=require("@typescript-eslint/utils"),_i=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="no-non-camel-case-functions",$i=/^(\$?[a-z][a-zA-Z0-9]*)$/;function kn(e){if(e.typeName.type!==ve.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===ve.AST_NODE_TYPES.Identifier&&n.name==="JSX"&&r.name==="Element"}var Ui=_i({name:Pn,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(n){if(n.id&&!$i.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===ve.AST_NODE_TYPES.TSTypeReference?kn(r):r.type===ve.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===ve.AST_NODE_TYPES.TSTypeReference&&kn(o))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),bt={name:Pn,rule:Ui};var W=require("@typescript-eslint/utils");var Ct=require("@typescript-eslint/utils");function je(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:je(e.parent,n,r===1/0?r:r-1)}function*It(e){yield e,e.parent&&(yield*It(e.parent))}function Rt(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function Fn(e,n,r){let o=r.getDeclaredVariables(e).find(a=>a.name===n||a.identifiers[0]?.parent.type===Ct.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===Ct.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===n);return o?o.references.filter(a=>!a.init):[]}var zi=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),On="no-optional-root-props",Wi=zi({name:On,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let a=e.sourceCode.getDeclaredVariables(t)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of It(i.identifier)){if("returnType"in s||s.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===W.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===W.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=je(l.parent.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Qe(u,e.sourceCode);return m?!(m.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===W.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=je(l,W.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Qe(p,e.sourceCode):!1}if(l.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Qe(l,e.sourceCode)}return!1}function r(t){t.key.type!==W.TSESTree.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=je(t,W.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===W.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(et(t)||!n(t)))for(let o of t.typeAnnotation.members)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(t){if(!(et(t)||!n(t)))for(let o of t.body.body)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(t){if(t.typeName.type!==W.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==W.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=je(t.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Qe(a,e.sourceCode);if(!(!i||i.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function et(e){return e?e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Qe(e,n){if(et(e))return;let r;if(e.type===W.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===W.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!et(a[0].identifier.parent.parent))return a[0].identifier}var wt={name:On,rule:Wi};var ze=require("@typescript-eslint/utils");var We=H({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===ze.AST_NODE_TYPES.Identifier?n.has(t.name):t.type===ze.AST_NODE_TYPES.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)n.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===ze.AST_NODE_TYPES.VariableDeclaration)for(let o of t.declaration.declarations)r(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===ze.AST_NODE_TYPES.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var Nn=require("@typescript-eslint/utils"),tt=he(require("path")),xe=require("zod/v4");var Vi=Nn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dn="no-relative-imports",Hi=xe.z.object({find:xe.z.string(),replacement:xe.z.string()}),Ji=xe.z.object({aliases:xe.z.array(Hi),rootDir:xe.z.string().optional(),allowNotFoundAliases:xe.z.boolean().optional(),_dev_simulateFileName:xe.z.string().optional()}),Yi=Vi({name:Dn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[_(Ji)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=tt.default.dirname(s);return tt.default.resolve(l,i)}function a(i){let s=n.rootDir??process.cwd(),l=tt.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of n.aliases)if(l.startsWith(u)){let m=l.replace(u,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let l=o(s,r),p=a(l);!p&&n.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),At={name:Dn,rule:Yi};var G=require("@typescript-eslint/utils"),vt=require("zod/v4");var Bi=vt.z.object({customMessage:vt.z.string().optional()}),kt=H({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(Bi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case G.AST_NODE_TYPES.Literal:return!0;case G.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===G.AST_NODE_TYPES.Property?o.computed||o.value.type===G.AST_NODE_TYPES.Identifier&&o.key.type===G.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case G.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===G.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case G.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case G.AST_NODE_TYPES.ConditionalExpression:case G.AST_NODE_TYPES.LogicalExpression:case G.AST_NODE_TYPES.BinaryExpression:case G.AST_NODE_TYPES.UnaryExpression:case G.AST_NODE_TYPES.CallExpression:case G.AST_NODE_TYPES.MemberExpression:case G.AST_NODE_TYPES.Identifier:case G.AST_NODE_TYPES.ArrowFunctionExpression:case G.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==G.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.AST_NODE_TYPES.Literal&&(o=t.value),o&&r(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});var Ve=require("@typescript-eslint/utils"),Oe=he(require("zod/v4"));var qi=Oe.object({alternativeMsgs:Oe.object({inArrayFind:Oe.string().optional(),inArrayFilter:Oe.string().optional()}).optional(),__dev_simulateFileName:Oe.string().optional()});function Xi(e){return e.typeAnnotation.type!==Ve.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Gi=/\.(typeGuards|type-guards)\.(ts|tsx)$/;function Zi(e){return Gi.test(e)}function Ki(e){let n=e.parent;for(;n;){if(n.type===Ve.AST_NODE_TYPES.CallExpression&&n.callee.type===Ve.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===Ve.AST_NODE_TYPES.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Pt=H({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[_(qi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Zi(r))return{};function t(o){if(!Xi(o))return;let a=Ki(o);if(n.alternativeMsgs&&a){let i=a.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});var Ne=require("@typescript-eslint/utils");var Qi="no-unnecessary-async-on-jsx-props";function es(e){if(e.body.type!==Ne.AST_NODE_TYPES.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Ne.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ne.AST_NODE_TYPES.AwaitExpression}var Ft=H({name:Qi,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){es(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(t.replaceTextRange([i.range[0],l.range[0]],"")):a.push(t.remove(i))}function s(l){if(l.type===Ne.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?a.push(t.replaceTextRange([p.range[0],u.range[0]],"")):a.push(t.remove(p))}}if(l.type===Ne.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===Ne.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});var be=require("@typescript-eslint/utils"),Ot=he(require("typescript")),Le=he(require("zod/v4"));var ts=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-unnecessary-casting",ns=Le.default.object({additionalCastFunctions:Le.default.array(Le.default.object({name:Le.default.string(),expectedType:Le.default.enum(["string","number"])})).optional()}),Nt={name:Mn,rule:ts({name:Mn,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[_(ns)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=be.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case be.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case be.AST_NODE_TYPES.TemplateLiteral:return m==="string";case be.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,m){return m==="number"?!!(u.flags&Ot.TypeFlags.NumberLike):!!(u.flags&Ot.TypeFlags.StringLike)}function l(u,m){return f=>f.replaceText(u,e.sourceCode.getText(m))}function p(u){if(!a||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===be.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=u;if(f.type!==be.AST_NODE_TYPES.Identifier)return;let d=f.name,y=t.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,c;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",c={name:y.name,type:y.expectedType}),e.report({node:u,messageId:h,...c?{data:c}:{},fix:l(u,m)})}}return{CallExpression:p}}})};var He=require("@typescript-eslint/utils"),ye=he(require("zod/v4"));var rs=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),Dt=H({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[_(rs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):t.has(s)}function a(s){let{callee:l}=s;if(l.type===He.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===He.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==He.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===He.AST_NODE_TYPES.CallExpression){let u=a(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return s.typeAnnotation?f.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});var le=require("@typescript-eslint/utils");var Mt=H({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===le.AST_NODE_TYPES.ObjectPattern||!n.init||n.init.type!==le.AST_NODE_TYPES.ObjectExpression||n.id.type===le.AST_NODE_TYPES.Identifier&&n.id.typeAnnotation||n.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==le.AST_NODE_TYPES.Identifier)return;let t=is(n,e.sourceCode);if(t.length===0)return;let o=n.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of t){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===le.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;a.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function is(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var V=require("@typescript-eslint/utils"),ke=require("zod/v4");var ss=ke.z.object({selectors:ke.z.array(ke.z.object({name:ke.z.string(),selectorProp:ke.z.string().optional(),selectorArgPos:ke.z.number().optional(),returnProp:ke.z.string().optional()}))}),os=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="no-unused-selected-values",jt={name:jn,rule:os({name:jn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(ss)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===V.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=ls(a);if(!i)return;let s=t.get(i);if(!s)return;let l=as(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ps(l);if(!p)return;let u=Ln(p.properties,void 0);if(!u)return;if(o.id.type===V.AST_NODE_TYPES.ObjectPattern){let d=Ln(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of u)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==V.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=cs(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==V.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==V.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of u)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function as(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===V.AST_NODE_TYPES.ArrowFunctionExpression||t.type===V.AST_NODE_TYPES.FunctionExpression)return t;if(r&&t.type===V.AST_NODE_TYPES.ObjectExpression){let o=t.properties.find(i=>i.type===V.AST_NODE_TYPES.Property&&i.key.type===V.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==V.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===V.AST_NODE_TYPES.ArrowFunctionExpression||a.type===V.AST_NODE_TYPES.FunctionExpression)return a}return null}function ls(e){return e.callee.type===V.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===V.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===V.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ps(e){if(e.body.type===V.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===V.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===V.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==V.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}function Ln(e,n){let r=e;if(n){let o=e.find(a=>a.type===V.AST_NODE_TYPES.Property&&a.key.type===V.AST_NODE_TYPES.Identifier&&a.key.name===n);if(o?.type!==V.AST_NODE_TYPES.Property||o.value.type!==V.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let t=new Map;for(let o of r){if(o.type!==V.AST_NODE_TYPES.Property||o.key.type!==V.AST_NODE_TYPES.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function cs(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var J=require("@typescript-eslint/utils");var Lt=H({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===J.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(a){if(o)return;if(!t){let s=us(a);s&&(t=s);return}let i=fs(a,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,l]of t)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function us(e){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==J.AST_NODE_TYPES.ObjectExpression)return null;let t=Rt(r.properties,a=>a.type!==J.AST_NODE_TYPES.Property||a.key.type!==J.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===J.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===J.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===J.AST_NODE_TYPES.FunctionExpression?ms(a.value):null);if(!t)return null;let o=new Map;for(let a of t.properties)a.type===J.AST_NODE_TYPES.Property&&a.key.type===J.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function fs(e,n){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==J.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==J.AST_NODE_TYPES.ObjectPattern||!Rt(e.parent.id.properties,i=>i.type===J.AST_NODE_TYPES.Property&&i.key.type===J.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Fn(e.parent,"formFields",n),a=new Set;for(let{identifier:i}of o){if(i.type!==J.AST_NODE_TYPES.Identifier||i.parent.type===J.AST_NODE_TYPES.Property&&i.parent.parent.type===J.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===J.AST_NODE_TYPES.ReturnStatement||i.parent.type===J.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===J.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==J.AST_NODE_TYPES.Identifier||i.parent.property.type!==J.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function ms(e){if(e.body.type===J.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===J.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===J.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==J.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}var z=require("@typescript-eslint/utils"),Je=require("zod/v4");var ds=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function _n(e){let n=[];for(let r of e.members)r.type===z.AST_NODE_TYPES.TSPropertySignature&&r.key.type===z.AST_NODE_TYPES.Identifier&&n.push([r.key.name,r]);return n}function $n(e,...n){for(let r of n)e.set(...r);return e}var ys=Je.z.object({forceCheckOnFCPropTypesWithName:Je.z.array(Je.z.string()).optional(),alwaysCheckFunctionOptionTypes:Je.z.boolean().optional()}),Un="no-unused-type-props-in-args",_t=null,gs=ds({name:Un,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:[_(ys)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!_t&&(_t=r.map(l=>new RegExp(l)));function o(l,p,u,m,f=!0,d=!1){let y=u.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&_t?.some(g=>g.test(y)),c=d&&t;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===z.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!c)){if(x.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===z.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,u,m,f,d=!1){if(m.type===z.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.key.type===z.AST_NODE_TYPES.Identifier&&u.set(y.key.name,y);return}if(m.type===z.AST_NODE_TYPES.TSTypeLiteral){$n(u,..._n(m));return}if(m.type===z.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)a(l,p,u,y,!0,d);return}f||m.type===z.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===z.AST_NODE_TYPES.Identifier&&o(l,p,m.typeName,u,!0,d)}function i(l,p,u,m=!1){for(let f of u)if(f.type===z.AST_NODE_TYPES.ObjectPattern&&f.typeAnnotation){let d=new Map;if(a(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;s(f,d)}else f.type===z.AST_NODE_TYPES.AssignmentPattern&&f.left.type===z.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let u=[];if(l.properties.at(-1)?.type===z.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===z.AST_NODE_TYPES.Property&&y.key.type===z.AST_NODE_TYPES.Identifier&&u.push(y.key.name);let f=[],d=[];for(let[y,E]of p)u.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let c=l.properties.at(-1),x=d.join(", ");return c?c.type===z.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(c,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,m=p.id.type===z.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===z.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===z.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===z.AST_NODE_TYPES.Identifier)o(!0,l,m.typeName,u,!1);else if(m.type===z.AST_NODE_TYPES.TSTypeLiteral)$n(u,..._n(m));else if(m.type===z.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===z.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===z.AST_NODE_TYPES.Identifier?o(!0,l,f.typeName,u,!1):a(!0,l,u,f,!0);if(u.size!==0&&p.init?.type===z.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===z.AST_NODE_TYPES.ObjectPattern&&s(f,u)}}},FunctionDeclaration(l){i(!1,l,l.params,t)},ArrowFunctionExpression(l){i(!1,l,l.params,t)}}}}),$t={name:Un,rule:gs};var ue=require("@typescript-eslint/utils");var Ut=H({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===ue.AST_NODE_TYPES.Identifier?n.has(t.callee.name):t.callee.type===ue.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===ue.AST_NODE_TYPES.Identifier&&t.callee.property.type===ue.AST_NODE_TYPES.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&n.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ue.AST_NODE_TYPES.CallExpression&&r(t.init)&&t.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(t).set.get(t.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==t&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var _e=require("@typescript-eslint/utils"),Ss=_e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="prefer-named-functions",zn=new Map,Ts=Ss({name:Wn,meta:{hasSuggestions:!0,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:{suggestion:"Convert to named function",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,[n]){let r=null;if(n.ignoreRegex){let t=zn.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),zn.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===_e.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===_e.AST_NODE_TYPES.Identifier){let o=t.id.name;if(t.id.typeAnnotation||r&&r.test(o)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==_e.AST_NODE_TYPES.BlockStatement)return;let a=t.parent,i=t.init.params,s=t.init.body,l=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),zt={name:Wn,rule:Ts};var D=require("@typescript-eslint/utils"),ge=require("zod/v4");var hs=ge.z.object({disallowedFunctions:ge.z.array(ge.z.object({name:ge.z.string(),allowUsingWithArgs:ge.z.boolean().optional(),hookAlternative:ge.z.string().optional(),message:ge.z.string().optional(),allowUseInside:ge.z.array(ge.z.string()).optional()}))}),Es=/^use[A-Z]/,xs=/^[A-Z]/;function nt(e){return Es.test(e)}function Vn(e){return xs.test(e)}function bs(e){return e.type===D.AST_NODE_TYPES.Identifier?nt(e.name):e.type===D.AST_NODE_TYPES.MemberExpression&&e.property.type===D.AST_NODE_TYPES.Identifier?nt(e.property.name):!1}function Hn(e,n){return e.type===D.AST_NODE_TYPES.Identifier?e.name===n:e.type===D.AST_NODE_TYPES.MemberExpression&&e.object.type===D.AST_NODE_TYPES.Identifier&&e.property.type===D.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===n:!1}function Jn(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&Hn(e.parent.callee,"forwardRef"))}function Yn(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&Hn(e.parent.callee,"memo"))}function Wt(e){if(e.type===D.AST_NODE_TYPES.FunctionDeclaration||e.type===D.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===D.AST_NODE_TYPES.FunctionExpression||e.type===D.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===D.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===D.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===D.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===D.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Cs(e){let n=e.parent,r=!1;for(;n;){if(n.type===D.AST_NODE_TYPES.FunctionDeclaration||n.type===D.AST_NODE_TYPES.FunctionExpression||n.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(n);if(t&&t.type===D.AST_NODE_TYPES.Identifier){if(Vn(t.name)||nt(t.name))return!r;r=!0}else{if(Jn(n)||Yn(n))return!r;if(n.parent.type===D.AST_NODE_TYPES.CallExpression){let o=n.parent;bs(o.callee)||(r=!0)}else n.parent.type===D.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Bn(e){return e.callee.type===D.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===D.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===D.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Is(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===D.AST_NODE_TYPES.FunctionDeclaration||r.type===D.AST_NODE_TYPES.FunctionExpression||r.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(r);if(t&&t.type===D.AST_NODE_TYPES.Identifier&&n.includes(t.name))return!0}else if(r.type===D.AST_NODE_TYPES.CallExpression){let t=Bn(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function Rs(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===D.AST_NODE_TYPES.Identifier&&n.name==="undefined")}function ws(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===D.AST_NODE_TYPES.FunctionDeclaration||t.type===D.AST_NODE_TYPES.FunctionExpression||t.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let o=Wt(t);if(o&&o.type===D.AST_NODE_TYPES.Identifier){if(Vn(o.name)||nt(o.name)){r=!0;break}}else if(Jn(t)||Yn(t)){r=!0;break}}t=t.parent}return r?n.length===0?Cs(e):!Is(e,n):!1}var Vt=H({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[_(hs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Bn(o);if(!a)return;let i=t.get(a);if(!i||i.allowUsingWithArgs&&Rs(o))return;let s=i.allowUseInside||[];ws(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===D.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===D.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===D.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var B=require("@typescript-eslint/utils"),rt=he(require("zod/v4"));var As=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xn="prefer-single-line-if",vs=rt.default.object({maxLineLength:rt.default.number().optional(),maxNonSimpleConditionLength:rt.default.number().optional()}),ks=As({name:Xn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[_(vs)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==B.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let a=t.consequent.body[0];if(!a)return;if(a.type===B.AST_NODE_TYPES.ReturnStatement){if(!Zn(a))return}else if(!(a.type===B.AST_NODE_TYPES.ContinueStatement||a.type===B.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===B.AST_NODE_TYPES.LogicalExpression||t.test.type===B.AST_NODE_TYPES.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=qn(t.test);if(!m&&t.test.type===B.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let f=t.test.argument;qn(f)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let s=r.getText(a);if(i.includes(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(c),I=new Set,v=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;v=T}let R=Array.isArray;function N(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let P=C.node.parent;if(P==null&&(yt(v.block,C.node.id),P=C.node.parent,P==null))return!1;if(P.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let O=k.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let F=C.node.id,{name:M}=O;if(M==="useRef"&&F.type==="Identifier")return!0;if(Ur(O)&&F.type==="Identifier"){for(let j of T.references)j!==F&&d.add(j.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(F.type==="ArrayPattern"&&F.elements.length===2&&R(T.identifiers)){if(F.elements[1]===T.identifiers[0]){if(M==="useState"){let j=T.references,ce=0;for(let Te=0;Te<j.length;Te++){if(j[Te].isWrite()&&ce++,ce>1)return!1;p.set(j[Te].identifier,F.elements[0])}}return!0}else if(F.elements[0]===T.identifiers[0]){if(M==="useState"){let j=T.references;for(let ce=0;ce<j.length;ce++)u.add(j[ce].identifier)}return!1}}}else if(M==="useTransition"&&F.type==="ArrayPattern"&&F.elements.length===2&&Array.isArray(T.identifiers)&&F.elements[1]===T.identifiers[0])return!0;return!1}function L(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,P=v.childScopes,O=null,F;for(F=0;F<P.length;F++){let M=P[F],j=M.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){O=M;break}}if(O==null)return!1;for(F=0;F<O.through.length;F++){let M=O.through[F];if(M.resolved!=null&&I.has(M.resolved.scope)&&!Z(M.resolved))return!1}return!0}let Z=y(N,m),q=y(L,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==c;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let Y=new Map,de=new Map;De(S);function De(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=yt(c,C.identifier),P=yn(k),O=Ee(P,de);if(w&&P.type==="Identifier"&&(P.parent.type==="MemberExpression"||P.parent.type==="OptionalMemberExpression")&&!P.parent.computed&&P.parent.property.type==="Identifier"&&P.parent.property.name==="current"&&te(C)&&ee.set(O,{reference:C,dependencyNode:P}),P.parent.type==="TSTypeQuery"||P.parent.type==="TSTypeReference")continue;let F=C.resolved.defs[0];if(F!=null&&!(F.node!=null&&F.node.init===c.parent)&&F.type!=="TypeParameter")if(Y.has(O))Y.get(O).references.push(C);else{let M=C.resolved,j=Z(M)||q(M);Y.set(O,{isStable:j,references:[C]})}}for(let C of T.childScopes)De(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let P=T.resolved.references,O=!1;for(let F=0;F<P.length;F++){let{identifier:M}=P[F],{parent:j}=M;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){O=!0;break}}O||s({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Ce(T,C){ie.has(C)||(ie.add(C),s({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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 ${r(b)}.`}))}let pe=new Set;if(Y.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(P=>{P.writeExpr&&Ce(P.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(Y.forEach(({isStable:C,references:k},P)=>{T||k.forEach(O=>{if(T)return;let F=O.identifier;if(!p.has(F))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===c&&(T=P)})}),T){let{suggestedDependencies:C}=mt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(c,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],Ue=new Set;x.type!=="ArrayExpression"?s({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(O){return O.removeRange(T.range)}}]});let C;try{C=Ee(T,de)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?Y.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let P=!v.through.some(O=>O.identifier===k);Pe.push({key:C,node:T}),P||Ue.add(C)});let{suggestedDependencies:ur,unnecessaryDependencies:Ye,missingDependencies:Ie,duplicateDependencies:en}=mt({dependencies:Y,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:Ue,isEffect:w}),Be=ur;if(en.size+Ie.size+Ye.size===0){if(n)return;jr({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:P})=>{let O=P==="function"?"useCallback":"useMemo",F=P==="function"?"definition":"initialization",M=`wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,j=k?`To fix this, ${M}`:`Move it inside the ${g} callback. Alternatively, ${M}`,ce=P==="conditional"||P==="logical expression"?"could make":"makes",Te=`The '${C.name.name}' ${P} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${j}`,tn;k&&C.type==="Variable"&&P==="function"&&(tn=[{desc:`Wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,fix(nn){let[mr,dr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[nn.insertTextBefore(C.node.init,mr),nn.insertTextAfter(C.node.init,dr)]}}]),s({node:C.node,message:Te,suggest:tn})});return}!w&&Ie.size>0&&(Be=mt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:Ue,isEffect:w}).suggestedDependencies);function fr(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}fr()&&Be.sort();function ot(T){let C=T.split("."),k="";for(let P=0;P<C.length;P++){if(P!==0){let O=C.slice(0,P+1).join("."),F=de.get(O)===!0;k+=F?"?.":"."}k+=C[P]}return k}function at(T,C,k,P){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+_r(Array.from(T).sort().map(O=>"'"+ot(O)+"'"))+`. Either ${P} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Ye.size>0){let T=null;if(Array.from(Ye.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)fe=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Ue.size>0){let C=Array.from(Ue)[0];S.set.has(C)||(fe=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&Ie.has("props")){let T=Y.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let P=0;P<C.length;P++){let O=C[P],F=yt(v.block,O.identifier);if(!F){k=!1;break}let M=F.parent;if(M==null){k=!1;break}if(M.type!=="MemberExpression"&&M.type!=="OptionalMemberExpression"){k=!1;break}}k&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&Ie.size>0){let T=null;Ie.forEach(C=>{if(T)return;let k=v.set.get(C),P=Y.get(C);if(P.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let F=!1,M;for(let j=0;j<P.references.length;j++)if(M=P.references[j].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){F=!0;break}F&&(T=C)}),T!==null&&(fe=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&Ie.size>0){let T=null;if(Ie.forEach(C=>{if(T!==null)return;let P=Y.get(C).references,O,F;for(let M=0;M<P.length;M++){for(O=P[M].identifier,F=O.parent;F!=null&&F!==v.block;){if(F.type==="CallExpression"){let j=p.get(F.callee);if(j!=null){if(j.name===C)T={missingDep:C,setter:F.callee.name,form:"updater"};else if(u.has(O))T={missingDep:C,setter:F.callee.name,form:"reducer"};else{let ce=P[M].resolved;if(ce!=null){let Te=ce.defs[0];Te!=null&&Te.type==="Parameter"&&(T={missingDep:C,setter:F.callee.name,form:"inlineReducer"})}}break}}F=F.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":fe=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:x,message:`React Hook ${r(b)} has `+(at(Ie,"a","missing","include")||at(Ye,"an","unnecessary","exclude")||at(en,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Be.map(ot).join(", ")}]`,fix(T){return T.replaceText(x,`[${Be.map(ot).join(", ")}]`)}}]})}function h(c){let x=Lr(c.callee,i);if(x===-1)return;let b=c.arguments[x],g=c.callee,w=gn(g).name,S=c.arguments[x+1],I=/Effect($|[^a-z])/g.test(w);if(!b){s({node:g,message:`React Hook ${w} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!I)){if(!S&&!I){(w==="useMemo"||w==="useCallback")&&s({node:g,message:`React Hook ${w} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,w,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let v=t(c).set.get(b.name);if(v==null||v.defs==null)return;let R=v.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,w,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,w,I);return}break}break;default:s({node:g,message:`React Hook ${w} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${w} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(v){return v.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let c of e.sourceCode.getAllComments())if(Mr.test(c.value))return n=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:c=>h(c)}}};function mt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let c=s(a,h);c.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let h=s(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=s(a,E);h.isSatisfiedRecursively=!0});function s(E,h){let c=h.split("."),x=E;for(let b of c){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,c){let x=h.split("."),b=E;for(let g of x){let w=b.children.get(g);if(!w)return;c(w),b=w}}let p=new Set,u=new Set;m(a,p,u,E=>E);function m(E,h,c,x){E.children.forEach((b,g)=>{let w=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&c.add(w);return}if(b.isUsed){h.add(w);return}m(b,h,c,S=>w+"."+S)})}let f=[],d=new Set,y=new Set;return n.forEach(({key:E})=>{u.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function we(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 we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function jr({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!Sn(n,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function yn(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)?yn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function dt(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Ee(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Ee(e.object,n),t=Ee(e.property,null),o=`${r}.${t}`;return dt(e,n,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ee(e.object,n),t=Ee(e.property,null),o=`${r}.${t}`;return dt(e,n,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Ee(r.object,n),o=Ee(r.property,null),a=`${t}.${o}`;return dt(r,n,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function gn(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Lr(e,n){let r=gn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Ee(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return n.additionalHooks.test(t)?0:-1}else return-1}}function yt(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),$r(t,n))return t;if(Sn(t,n))for(let[o,a]of Object.entries(t))o!=="parent"&&(mn(a)?(a.parent=t,r.push(a)):Array.isArray(a)&&a.forEach(i=>{mn(i)&&(i.parent=t,r.push(i))}))}return null}function _r(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function $r(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function Sn(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function Ur(e){return!1}var Ae=require("@typescript-eslint/utils"),re=he(require("typescript")),hn=require("zod/v4");var zr=Ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tn="improved-no-unnecessary-condition",Wr=hn.z.object({}),Vr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Hr=new Set(Vr),gt={name:Tn,rule:zr({name:Tn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[_(Wr)]},defaultOptions:[{}],create(e){let n=Ae.ESLintUtils.getParserServices(e,!0),r=n.program?.getTypeChecker();if(!r||!n.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===Ae.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown?null:s.flags&re.default.TypeFlags.StringLike?["string"]:s.flags&re.default.TypeFlags.NumberLike?["number"]:s.flags&re.default.TypeFlags.BigIntLike?["bigint"]:s.flags&re.default.TypeFlags.BooleanLike?["boolean"]:s.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&re.default.TypeFlags.Undefined||s.flags&re.default.TypeFlags.Void?["undefined"]:s.flags&re.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&re.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&re.default.TypeFlags.NonPrimitive?["object"]:s.flags&re.default.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=n.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)u.push(...d);else return null}return u}let m=o(p);return m?(u.push(...m),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===Ae.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===Ae.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Jr(u,Hr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(u);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:u}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Me(p,e),actualType:Xe(m),conditionType:u}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Me(p,e),type:Xe(m)}})}return{BinaryExpression:i}}})};function Xe(e){return Array.from(new Set(e)).join(" | ")||"never"}function Me(e,n){let r=e.argument;return r.type===Ae.AST_NODE_TYPES.Identifier?r.name:n.sourceCode.getText(r)}function Jr(e,n){return n.has(e)}var Ze=require("@typescript-eslint/utils"),Ge=require("zod/v4");var Yr=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-call-with-explicit-generics",Br=Ge.z.object({functions:Ge.z.array(Ge.z.string())}),qr=Yr({name:En,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[_(Br)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:o}=t;o.type===Ze.AST_NODE_TYPES.Identifier&&r.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),St={name:En,rule:qr};var Fe=require("@typescript-eslint/utils"),Xr=Fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xn="no-call-with-inferred-generics",Gr=Xr({name:xn,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,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==Fe.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=n.disallowTypes}=a;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&t.typeArguments?.params.some(u=>!s&&u.type===Fe.AST_NODE_TYPES.TSAnyKeyword||l&&u.type===Fe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===Fe.AST_NODE_TYPES.Identifier&&l.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Tt={name:xn,rule:Gr};var In=require("@typescript-eslint/utils"),Zr=In.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-commented-out-code",Kr=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Qr=/^\s*return\s+/,ei=/\w=("|'|`)/,ti=/\w+:\s*('|"|`)/,ni=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,ri=/\w+-\w+:/,ii=/\w+_\w+:/,si=/\?\s+\w/,oi=/:\s+\w/,ai=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,li=/^\s*\d+[,}]/,pi=/^\s*\[[^\]]*\][,}]/,ci=/^\s*\{[^}]*\}[,}]/,ui=/\.\w+\(/,fi=/\[\w+\]/,mi=/^\s*(['"`]).+?\1\s*:/,di=/^<[A-Z]\w*(\s|>|\/)/,yi=/^<[a-z]+(\s|>|\/)/,gi=/<[A-Z]\w*(\s.*)?>/,Si=/<\/[A-Z]\w*>/,Ti=/<[a-z]+(\s.*)?>/,hi=/<\/[a-z]+>/,Ei=/^\s*[*\s]*$/,xi=/^[a-zA-Z]/,bi=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ci=/```[\s\S]*?```/g,Ii=/`[^`]*`/g,bn=/[a-zA-Z0-9]/,Ri=/\.[A-Za-z_][A-Za-z0-9_]*\(/,wi=/[{}[\]()`=<>]/,Ai=/:\s*(['"`[{(]|\w+\s*=>)/,vi=/\bif\s*\(|\belse\b|=>/,X={returnStatement:Qr,stringAssignment:ei,objectPropertyWithQuotes:ti,computedPropertyAssignment:ni,kebabCaseProperty:ri,snakeCaseProperty:ii,ternaryOperator:si,colonWithWord:oi,quotedString:ai,numberWithComma:li,arrayWithComma:pi,objectWithComma:ci,methodCall:ui,arrayAccess:fi,quotedPropertyKey:mi,jsxSelfClosing:di,jsxElement:yi,jsxOpeningTag:gi,jsxClosingTag:Si,htmlOpeningTag:Ti,htmlClosingTag:hi,jsdocComment:Ei};function ki(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&xi.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||Ri.test(n)||wi.test(n)||Ai.test(n)||vi.test(n)?!1:!!(n.includes(":")&&bi.test(n))}var Pi=[") {","return;",X.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",X.stringAssignment,");",X.objectPropertyWithQuotes,X.computedPropertyAssignment,X.kebabCaseProperty,X.snakeCaseProperty,"&&","||","()",X.ternaryOperator,X.colonWithWord,X.quotedString,X.numberWithComma,X.arrayWithComma,X.objectWithComma,X.methodCall,X.arrayAccess,"?.(","??","=>",X.quotedPropertyKey],Fi=["/>","</",X.jsxSelfClosing,X.jsxElement,X.jsxOpeningTag,X.jsxClosingTag,X.htmlOpeningTag,X.htmlClosingTag],Cn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Oi=Zr({name:Rn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,o){if(t.startsWith("/"))return!1;let a=t.trimStart();if(t.startsWith("*")||a.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||X.jsdocComment.test(t))return!1;for(let i of Cn)if(a.startsWith(i))return!1;if(t.includes("https://")||ki(a))return!1;if(o==="Block"){for(let i of Fi)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Kr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Pi)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,o){let a=t,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ci);p.some(m=>bn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(Ii);return s.some(p=>bn.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=n(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:Cn.join(", ")}})}}}}}),ht={name:Rn,rule:Oi};var Ke=require("@typescript-eslint/utils"),Ni=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-default-export",Di=Ni({name:wn,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(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===Ke.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Et={name:wn,rule:Di};var An=require("@typescript-eslint/utils"),Mi=An.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vn="no-leaked-text-in-jsx",ji=[",",";","[","]","(",")"],Li=Mi({name:vn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";ji.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),xt={name:vn,rule:Li};var ve=require("@typescript-eslint/utils"),_i=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="no-non-camel-case-functions",$i=/^(\$?[a-z][a-zA-Z0-9]*)$/;function kn(e){if(e.typeName.type!==ve.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===ve.AST_NODE_TYPES.Identifier&&n.name==="JSX"&&r.name==="Element"}var Ui=_i({name:Pn,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(n){if(n.id&&!$i.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===ve.AST_NODE_TYPES.TSTypeReference?kn(r):r.type===ve.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===ve.AST_NODE_TYPES.TSTypeReference&&kn(o))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),bt={name:Pn,rule:Ui};var W=require("@typescript-eslint/utils");var Ct=require("@typescript-eslint/utils");function je(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:je(e.parent,n,r===1/0?r:r-1)}function*It(e){yield e,e.parent&&(yield*It(e.parent))}function Rt(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function Fn(e,n,r){let o=r.getDeclaredVariables(e).find(a=>a.name===n||a.identifiers[0]?.parent.type===Ct.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===Ct.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===n);return o?o.references.filter(a=>!a.init):[]}var zi=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),On="no-optional-root-props",Wi=zi({name:On,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let a=e.sourceCode.getDeclaredVariables(t)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of It(i.identifier)){if("returnType"in s||s.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===W.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===W.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=je(l.parent.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Qe(u,e.sourceCode);return m?!(m.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===W.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===W.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=je(l,W.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!Qe(p,e.sourceCode):!1}if(l.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Qe(l,e.sourceCode)}return!1}function r(t){t.key.type!==W.TSESTree.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=je(t,W.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===W.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(et(t)||!n(t)))for(let o of t.typeAnnotation.members)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(t){if(!(et(t)||!n(t)))for(let o of t.body.body)o.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(t){if(t.typeName.type!==W.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==W.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=je(t.parent,W.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Qe(a,e.sourceCode);if(!(!i||i.parent.type===W.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===W.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===W.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function et(e){return e?e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===W.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Qe(e,n){if(et(e))return;let r;if(e.type===W.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===W.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===W.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!et(a[0].identifier.parent.parent))return a[0].identifier}var wt={name:On,rule:Wi};var ze=require("@typescript-eslint/utils");var We=H({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===ze.AST_NODE_TYPES.Identifier?n.has(t.name):t.type===ze.AST_NODE_TYPES.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)n.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===ze.AST_NODE_TYPES.VariableDeclaration)for(let o of t.declaration.declarations)r(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===ze.AST_NODE_TYPES.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var Nn=require("@typescript-eslint/utils"),tt=he(require("path")),xe=require("zod/v4");var Vi=Nn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dn="no-relative-imports",Hi=xe.z.object({find:xe.z.string(),replacement:xe.z.string()}),Ji=xe.z.object({aliases:xe.z.array(Hi),rootDir:xe.z.string().optional(),allowNotFoundAliases:xe.z.boolean().optional(),_dev_simulateFileName:xe.z.string().optional()}),Yi=Vi({name:Dn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[_(Ji)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=tt.default.dirname(s);return tt.default.resolve(l,i)}function a(i){let s=n.rootDir??process.cwd(),l=tt.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of n.aliases)if(l.startsWith(u)){let m=l.replace(u,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let l=o(s,r),p=a(l);!p&&n.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),At={name:Dn,rule:Yi};var G=require("@typescript-eslint/utils"),vt=require("zod/v4");var Bi=vt.z.object({customMessage:vt.z.string().optional()}),kt=H({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(Bi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case G.AST_NODE_TYPES.Literal:return!0;case G.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===G.AST_NODE_TYPES.Property?o.computed||o.value.type===G.AST_NODE_TYPES.Identifier&&o.key.type===G.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case G.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===G.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case G.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case G.AST_NODE_TYPES.ConditionalExpression:case G.AST_NODE_TYPES.LogicalExpression:case G.AST_NODE_TYPES.BinaryExpression:case G.AST_NODE_TYPES.UnaryExpression:case G.AST_NODE_TYPES.CallExpression:case G.AST_NODE_TYPES.MemberExpression:case G.AST_NODE_TYPES.Identifier:case G.AST_NODE_TYPES.ArrowFunctionExpression:case G.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==G.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.AST_NODE_TYPES.Literal&&(o=t.value),o&&r(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});var Ve=require("@typescript-eslint/utils"),Oe=he(require("zod/v4"));var qi=Oe.object({alternativeMsgs:Oe.object({inArrayFind:Oe.string().optional(),inArrayFilter:Oe.string().optional()}).optional(),__dev_simulateFileName:Oe.string().optional()});function Xi(e){return e.typeAnnotation.type!==Ve.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Gi=/(typeGuards|type-guards)\.(ts|tsx)$/;function Zi(e){return Gi.test(e)}function Ki(e){let n=e.parent;for(;n;){if(n.type===Ve.AST_NODE_TYPES.CallExpression&&n.callee.type===Ve.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===Ve.AST_NODE_TYPES.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Pt=H({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[_(qi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Zi(r))return{};function t(o){if(!Xi(o))return;let a=Ki(o);if(n.alternativeMsgs&&a){let i=a.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});var Ne=require("@typescript-eslint/utils");var Qi="no-unnecessary-async-on-jsx-props";function es(e){if(e.body.type!==Ne.AST_NODE_TYPES.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Ne.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ne.AST_NODE_TYPES.AwaitExpression}var Ft=H({name:Qi,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){es(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(t.replaceTextRange([i.range[0],l.range[0]],"")):a.push(t.remove(i))}function s(l){if(l.type===Ne.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?a.push(t.replaceTextRange([p.range[0],u.range[0]],"")):a.push(t.remove(p))}}if(l.type===Ne.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===Ne.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});var be=require("@typescript-eslint/utils"),Ot=he(require("typescript")),Le=he(require("zod/v4"));var ts=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-unnecessary-casting",ns=Le.default.object({additionalCastFunctions:Le.default.array(Le.default.object({name:Le.default.string(),expectedType:Le.default.enum(["string","number"])})).optional()}),Nt={name:Mn,rule:ts({name:Mn,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[_(ns)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=be.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case be.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case be.AST_NODE_TYPES.TemplateLiteral:return m==="string";case be.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,m){return m==="number"?!!(u.flags&Ot.TypeFlags.NumberLike):!!(u.flags&Ot.TypeFlags.StringLike)}function l(u,m){return f=>f.replaceText(u,e.sourceCode.getText(m))}function p(u){if(!a||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===be.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=u;if(f.type!==be.AST_NODE_TYPES.Identifier)return;let d=f.name,y=t.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,c;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",c={name:y.name,type:y.expectedType}),e.report({node:u,messageId:h,...c?{data:c}:{},fix:l(u,m)})}}return{CallExpression:p}}})};var He=require("@typescript-eslint/utils"),ye=he(require("zod/v4"));var rs=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),Dt=H({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[_(rs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):t.has(s)}function a(s){let{callee:l}=s;if(l.type===He.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===He.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==He.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===He.AST_NODE_TYPES.CallExpression){let u=a(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return s.typeAnnotation?f.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});var le=require("@typescript-eslint/utils");var Mt=H({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===le.AST_NODE_TYPES.ObjectPattern||!n.init||n.init.type!==le.AST_NODE_TYPES.ObjectExpression||n.id.type===le.AST_NODE_TYPES.Identifier&&n.id.typeAnnotation||n.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==le.AST_NODE_TYPES.Identifier)return;let t=is(n,e.sourceCode);if(t.length===0)return;let o=n.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of t){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===le.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;a.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function is(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var V=require("@typescript-eslint/utils"),ke=require("zod/v4");var ss=ke.z.object({selectors:ke.z.array(ke.z.object({name:ke.z.string(),selectorProp:ke.z.string().optional(),selectorArgPos:ke.z.number().optional(),returnProp:ke.z.string().optional()}))}),os=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="no-unused-selected-values",jt={name:jn,rule:os({name:jn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(ss)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===V.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=ls(a);if(!i)return;let s=t.get(i);if(!s)return;let l=as(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ps(l);if(!p)return;let u=Ln(p.properties,void 0);if(!u)return;if(o.id.type===V.AST_NODE_TYPES.ObjectPattern){let d=Ln(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of u)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==V.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=cs(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==V.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==V.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of u)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function as(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===V.AST_NODE_TYPES.ArrowFunctionExpression||t.type===V.AST_NODE_TYPES.FunctionExpression)return t;if(r&&t.type===V.AST_NODE_TYPES.ObjectExpression){let o=t.properties.find(i=>i.type===V.AST_NODE_TYPES.Property&&i.key.type===V.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==V.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===V.AST_NODE_TYPES.ArrowFunctionExpression||a.type===V.AST_NODE_TYPES.FunctionExpression)return a}return null}function ls(e){return e.callee.type===V.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===V.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===V.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ps(e){if(e.body.type===V.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===V.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===V.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==V.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}function Ln(e,n){let r=e;if(n){let o=e.find(a=>a.type===V.AST_NODE_TYPES.Property&&a.key.type===V.AST_NODE_TYPES.Identifier&&a.key.name===n);if(o?.type!==V.AST_NODE_TYPES.Property||o.value.type!==V.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let t=new Map;for(let o of r){if(o.type!==V.AST_NODE_TYPES.Property||o.key.type!==V.AST_NODE_TYPES.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function cs(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var J=require("@typescript-eslint/utils");var Lt=H({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===J.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(a){if(o)return;if(!t){let s=us(a);s&&(t=s);return}let i=fs(a,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,l]of t)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function us(e){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==J.AST_NODE_TYPES.ObjectExpression)return null;let t=Rt(r.properties,a=>a.type!==J.AST_NODE_TYPES.Property||a.key.type!==J.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===J.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===J.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===J.AST_NODE_TYPES.FunctionExpression?ms(a.value):null);if(!t)return null;let o=new Map;for(let a of t.properties)a.type===J.AST_NODE_TYPES.Property&&a.key.type===J.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function fs(e,n){if(!(e.callee.type===J.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==J.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==J.AST_NODE_TYPES.ObjectPattern||!Rt(e.parent.id.properties,i=>i.type===J.AST_NODE_TYPES.Property&&i.key.type===J.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Fn(e.parent,"formFields",n),a=new Set;for(let{identifier:i}of o){if(i.type!==J.AST_NODE_TYPES.Identifier||i.parent.type===J.AST_NODE_TYPES.Property&&i.parent.parent.type===J.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===J.AST_NODE_TYPES.ReturnStatement||i.parent.type===J.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===J.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==J.AST_NODE_TYPES.Identifier||i.parent.property.type!==J.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function ms(e){if(e.body.type===J.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===J.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===J.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==J.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}var z=require("@typescript-eslint/utils"),Je=require("zod/v4");var ds=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function _n(e){let n=[];for(let r of e.members)r.type===z.AST_NODE_TYPES.TSPropertySignature&&r.key.type===z.AST_NODE_TYPES.Identifier&&n.push([r.key.name,r]);return n}function $n(e,...n){for(let r of n)e.set(...r);return e}var ys=Je.z.object({forceCheckOnFCPropTypesWithName:Je.z.array(Je.z.string()).optional(),alwaysCheckFunctionOptionTypes:Je.z.boolean().optional()}),Un="no-unused-type-props-in-args",_t=null,gs=ds({name:Un,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:[_(ys)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!_t&&(_t=r.map(l=>new RegExp(l)));function o(l,p,u,m,f=!0,d=!1){let y=u.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&_t?.some(g=>g.test(y)),c=d&&t;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===z.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!c)){if(x.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===z.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,u,m,f,d=!1){if(m.type===z.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.key.type===z.AST_NODE_TYPES.Identifier&&u.set(y.key.name,y);return}if(m.type===z.AST_NODE_TYPES.TSTypeLiteral){$n(u,..._n(m));return}if(m.type===z.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)a(l,p,u,y,!0,d);return}f||m.type===z.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===z.AST_NODE_TYPES.Identifier&&o(l,p,m.typeName,u,!0,d)}function i(l,p,u,m=!1){for(let f of u)if(f.type===z.AST_NODE_TYPES.ObjectPattern&&f.typeAnnotation){let d=new Map;if(a(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;s(f,d)}else f.type===z.AST_NODE_TYPES.AssignmentPattern&&f.left.type===z.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let u=[];if(l.properties.at(-1)?.type===z.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===z.AST_NODE_TYPES.Property&&y.key.type===z.AST_NODE_TYPES.Identifier&&u.push(y.key.name);let f=[],d=[];for(let[y,E]of p)u.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let c=l.properties.at(-1),x=d.join(", ");return c?c.type===z.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(c,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,m=p.id.type===z.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===z.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===z.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===z.AST_NODE_TYPES.Identifier)o(!0,l,m.typeName,u,!1);else if(m.type===z.AST_NODE_TYPES.TSTypeLiteral)$n(u,..._n(m));else if(m.type===z.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===z.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===z.AST_NODE_TYPES.Identifier?o(!0,l,f.typeName,u,!1):a(!0,l,u,f,!0);if(u.size!==0&&p.init?.type===z.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===z.AST_NODE_TYPES.ObjectPattern&&s(f,u)}}},FunctionDeclaration(l){i(!1,l,l.params,t)},ArrowFunctionExpression(l){i(!1,l,l.params,t)}}}}),$t={name:Un,rule:gs};var ue=require("@typescript-eslint/utils");var Ut=H({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===ue.AST_NODE_TYPES.Identifier?n.has(t.callee.name):t.callee.type===ue.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===ue.AST_NODE_TYPES.Identifier&&t.callee.property.type===ue.AST_NODE_TYPES.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&n.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ue.AST_NODE_TYPES.CallExpression&&r(t.init)&&t.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(t).set.get(t.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==t&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var _e=require("@typescript-eslint/utils"),Ss=_e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="prefer-named-functions",zn=new Map,Ts=Ss({name:Wn,meta:{hasSuggestions:!0,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:{suggestion:"Convert to named function",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,[n]){let r=null;if(n.ignoreRegex){let t=zn.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),zn.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===_e.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===_e.AST_NODE_TYPES.Identifier){let o=t.id.name;if(t.id.typeAnnotation||r&&r.test(o)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==_e.AST_NODE_TYPES.BlockStatement)return;let a=t.parent,i=t.init.params,s=t.init.body,l=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),zt={name:Wn,rule:Ts};var D=require("@typescript-eslint/utils"),ge=require("zod/v4");var hs=ge.z.object({disallowedFunctions:ge.z.array(ge.z.object({name:ge.z.string(),allowUsingWithArgs:ge.z.boolean().optional(),hookAlternative:ge.z.string().optional(),message:ge.z.string().optional(),allowUseInside:ge.z.array(ge.z.string()).optional()}))}),Es=/^use[A-Z]/,xs=/^[A-Z]/;function nt(e){return Es.test(e)}function Vn(e){return xs.test(e)}function bs(e){return e.type===D.AST_NODE_TYPES.Identifier?nt(e.name):e.type===D.AST_NODE_TYPES.MemberExpression&&e.property.type===D.AST_NODE_TYPES.Identifier?nt(e.property.name):!1}function Hn(e,n){return e.type===D.AST_NODE_TYPES.Identifier?e.name===n:e.type===D.AST_NODE_TYPES.MemberExpression&&e.object.type===D.AST_NODE_TYPES.Identifier&&e.property.type===D.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===n:!1}function Jn(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&Hn(e.parent.callee,"forwardRef"))}function Yn(e){return!!(e.parent&&e.parent.type===D.AST_NODE_TYPES.CallExpression&&Hn(e.parent.callee,"memo"))}function Wt(e){if(e.type===D.AST_NODE_TYPES.FunctionDeclaration||e.type===D.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===D.AST_NODE_TYPES.FunctionExpression||e.type===D.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===D.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===D.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===D.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===D.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Cs(e){let n=e.parent,r=!1;for(;n;){if(n.type===D.AST_NODE_TYPES.FunctionDeclaration||n.type===D.AST_NODE_TYPES.FunctionExpression||n.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(n);if(t&&t.type===D.AST_NODE_TYPES.Identifier){if(Vn(t.name)||nt(t.name))return!r;r=!0}else{if(Jn(n)||Yn(n))return!r;if(n.parent.type===D.AST_NODE_TYPES.CallExpression){let o=n.parent;bs(o.callee)||(r=!0)}else n.parent.type===D.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Bn(e){return e.callee.type===D.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===D.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===D.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Is(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===D.AST_NODE_TYPES.FunctionDeclaration||r.type===D.AST_NODE_TYPES.FunctionExpression||r.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let t=Wt(r);if(t&&t.type===D.AST_NODE_TYPES.Identifier&&n.includes(t.name))return!0}else if(r.type===D.AST_NODE_TYPES.CallExpression){let t=Bn(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function Rs(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===D.AST_NODE_TYPES.Identifier&&n.name==="undefined")}function ws(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===D.AST_NODE_TYPES.FunctionDeclaration||t.type===D.AST_NODE_TYPES.FunctionExpression||t.type===D.AST_NODE_TYPES.ArrowFunctionExpression){let o=Wt(t);if(o&&o.type===D.AST_NODE_TYPES.Identifier){if(Vn(o.name)||nt(o.name)){r=!0;break}}else if(Jn(t)||Yn(t)){r=!0;break}}t=t.parent}return r?n.length===0?Cs(e):!Is(e,n):!1}var Vt=H({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[_(hs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Bn(o);if(!a)return;let i=t.get(a);if(!i||i.allowUsingWithArgs&&Rs(o))return;let s=i.allowUseInside||[];ws(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===D.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===D.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===D.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var B=require("@typescript-eslint/utils"),rt=he(require("zod/v4"));var As=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xn="prefer-single-line-if",vs=rt.default.object({maxLineLength:rt.default.number().optional(),maxNonSimpleConditionLength:rt.default.number().optional()}),ks=As({name:Xn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[_(vs)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==B.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let a=t.consequent.body[0];if(!a)return;if(a.type===B.AST_NODE_TYPES.ReturnStatement){if(!Zn(a))return}else if(!(a.type===B.AST_NODE_TYPES.ContinueStatement||a.type===B.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===B.AST_NODE_TYPES.LogicalExpression||t.test.type===B.AST_NODE_TYPES.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=qn(t.test);if(!m&&t.test.type===B.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let f=t.test.argument;qn(f)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let s=r.getText(a);if(i.includes(`
16
16
  `))return;let l=r.getTokenAfter(t);if(l&&l.type===B.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let m=r.getTokenAfter(l);if(m&&m.type===B.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Ps(r,t),u=`if (${i}) ${s}`;n.maxLineLength&&u.length+p.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,u)})}}}});function qn(e){return e.type===B.AST_NODE_TYPES.CallExpression||e.type===B.AST_NODE_TYPES.BinaryExpression||e.type===B.AST_NODE_TYPES.MemberExpression&&Gn(e)}function Gn(e){return e.object.type===B.AST_NODE_TYPES.MemberExpression?Gn(e.object):e.object.type!==B.AST_NODE_TYPES.Identifier}function Ps(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}function Zn(e){if(!e.argument)return!0;let n=e.argument;return n.type===B.AST_NODE_TYPES.ArrayExpression&&n.elements.length===0||n.type===B.AST_NODE_TYPES.ObjectExpression&&n.properties.length===0||n.type===B.AST_NODE_TYPES.Literal||n.type===B.AST_NODE_TYPES.Identifier||n.type===B.AST_NODE_TYPES.TemplateLiteral||n.type===B.AST_NODE_TYPES.TaggedTemplateExpression?!0:n.type===B.AST_NODE_TYPES.CallExpression?n.arguments.length===0:n.type===B.AST_NODE_TYPES.UnaryExpression?Zn(n):!1}var Ht={name:Xn,rule:ks};var se=require("@typescript-eslint/utils"),me=require("zod/v4");var Fs=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kn="react-compiler-migration",Os=me.z.object({disallowHooks:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string()})).optional(),disallowMethods:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string().optional(),requireTrueProp:me.z.string().optional()})).optional()}),Ns=/eslint +react-compiler\/react-compiler: +\["error/;function Ds(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===se.AST_NODE_TYPES.MemberExpression&&e.property.type===se.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Ms=Fs({name:Kn,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[_(Os)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[n]){let r=!1;for(let t of e.sourceCode.getAllComments())if(Ns.test(t.value)){r=!0;break}return r?{CallExpression(t){if(n.disallowHooks?.length){let o=null,a=null;if(t.callee.type===se.AST_NODE_TYPES.Identifier?(o=t.callee.name,a=t.callee):t.callee.type===se.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===se.AST_NODE_TYPES.Identifier&&(o=t.callee.property.name,a=t.callee.property),o){let i=n.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(n.disallowMethods?.length&&Ds(t.callee)){for(let o of t.arguments)if(o.type===se.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===se.AST_NODE_TYPES.Property&&a.key.type===se.AST_NODE_TYPES.Identifier){let i=a.key.name,s=n.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let u of o.properties)if(u.type===se.AST_NODE_TYPES.Property&&u.key.type===se.AST_NODE_TYPES.Identifier&&u.key.name===l&&u.value.type===se.AST_NODE_TYPES.Literal&&u.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>s.replacement?l.replaceText(a.key,s.replacement):null}]})}}}}}}:{}}}),Jt={name:Kn,rule:Ms};var it=require("@typescript-eslint/utils"),js=it.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qn="require-description",Ls=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,_s=/^eslint-disable-(next-)?line$/u,$s=js({name:Qn,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,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Us(o);a!=null&&(t.has(a.kind)||a.description||e.report({loc:Vs(o.loc),messageId:"missingDescription"}))}}}}}),er={name:Qn,rule:$s};function Us(e){let{text:n,description:r}=Ws(e.value);if(!n)return null;let t=Ls.exec(n);if(!t)return null;let o=t[1];if(!o)return null;let a=_s.test(o);if(e.type===it.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+o.length);return{kind:o,value:i.trim(),description:r}}var zs=/\s-{2,}\s/u;function Ws(e){let n=e.split(zs);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function Vs(e){return{start:{line:e.start.line,column:-1},end:e.end}}var $=require("@typescript-eslint/utils"),Se=require("zod/v4");var Hs=Se.z.object({varsToCheck:Se.z.array(Se.z.object({selector:Se.z.string().optional(),fromFnCall:Se.z.string().optional(),prop:Se.z.string().or(Se.z.array(Se.z.string())),errorMsg:Se.z.string().optional()}))}),Yt=H({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[_(Hs)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,s,l,p){let u=new Set;for(let f of i.properties)f.type===$.AST_NODE_TYPES.Property&&f.key.type===$.AST_NODE_TYPES.Identifier&&u.add(f.key.name);let m=s.filter(f=>!u.has(f));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:l||""}});else{let f=m.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:f,fnName:p,customMsg:l||""}})}}function o(i){if(i.init?.type===$.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===$.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===$.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===$.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===$.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let a={};for(let i of n.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===$.AST_NODE_TYPES.VariableDeclarator&&s.id.type===$.AST_NODE_TYPES.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===$.AST_NODE_TYPES.VariableDeclarator&&s.id.type===$.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];t(s.id,l,i.errorMsg,o(s))}});for(let i of n.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=u=>{if(u.type!==$.AST_NODE_TYPES.MemberExpression||u.parent.type!==$.AST_NODE_TYPES.CallExpression)return;let m=u.parent;if(m.parent.type!==$.AST_NODE_TYPES.VariableDeclarator)return;let f=m.parent;if(f.id.type===$.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===$.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[u]=m=>{if(m.type!==$.AST_NODE_TYPES.MemberExpression||m.parent.type!==$.AST_NODE_TYPES.CallExpression)return;let f=m.parent;if(f.parent.type!==$.AST_NODE_TYPES.VariableDeclarator)return;let d=f.parent;if(d.id.type===$.AST_NODE_TYPES.Identifier)r.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===$.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==$.AST_NODE_TYPES.Identifier||p.parent.type!==$.AST_NODE_TYPES.CallExpression)return;let u=p.parent;if(u.parent.type!==$.AST_NODE_TYPES.VariableDeclarator)return;let m=u.parent;if(m.id.type===$.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===$.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:u}]of r){let f=e.sourceCode.getScope(p).set.get(i);if(f){let d=new Set(s);for(let y of f.references){let E=y.identifier,h=E.parent;if(!(h.type===$.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===$.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===$.AST_NODE_TYPES.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===$.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===$.AST_NODE_TYPES.ObjectPattern){for(let c of h.id.properties)c.type===$.AST_NODE_TYPES.Property&&c.key.type===$.AST_NODE_TYPES.Identifier&&d.has(c.key.name)&&d.delete(c.key.name);if(d.size===0)break;continue}if(!(h.type===$.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===$.AST_NODE_TYPES.Identifier&&!s.includes(h.property.name))){d.clear();break}}}if(d.size>0){let y=Array.from(d);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:u,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:l||""}})}}}}}}}});function rr(e){return/^use[A-Z0-9]/.test(e)}function st(e){return e.type==="Identifier"?rr(e.name):e.type==="MemberExpression"&&!e.computed&&st(e.property)?e.object.type==="Identifier":!1}function ir(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function sr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function or(e){return!!(e.parent&&e.parent.callee&&sr(e.parent.callee,"forwardRef"))}function ar(e){return!!(e.parent&&e.parent.callee&&sr(e.parent.callee,"memo"))}function Bt(e){for(;e;){let n=pr(e);if(n&&(ir(n)||st(n))||or(e)||ar(e))return!0;e=e.parent}return!1}function tr(e){return!1}function qt(e){return!1}var Js=/eslint +react-compiler\/react-compiler: +\["error/,lr={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 l of e.sourceCode.getAllComments())if(Js.test(l.value))return{CallExpression(p){let u=null;p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}}let n=typeof e.getSource=="function"?l=>n(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),t=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let u=p.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&tr(u.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let u=o.pop();if(u.size===0)return;let m=new Set;function f(g,w){let{cache:S}=f,I=S.get(g.id),v=new Set(w);if(v.has(g.id)){let R=[...v],N=R.slice(R.indexOf(g.id)+1);for(let L of N)m.add(L);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.prevSegments)I+=f(R,v)}return g.reachable&&I===BigInt("0")?S.delete(g.id):S.set(g.id,I),I}function d(g,w){let{cache:S}=d,I=S.get(g.id),v=new Set(w);if(v.has(g.id)){let R=Array.from(v),N=R.slice(R.indexOf(g.id)+1);for(let L of N)m.add(L);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.nextSegments)I+=d(R,v)}return S.set(g.id,I),I}function y(g){let{cache:w}=y,S=w.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(w.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let I of g.prevSegments){let v=y(I);v<S&&(S=v)}S+=1}return w.set(g.id,S),S}f.cache=new Map,d.cache=new Map,y.cache=new Map;let E=d(l.initialSegment),h=pr(p),c=Bt(p),x=h?ir(h)||st(h):or(p)||ar(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let w=y(g);w<b&&(b=w)}for(let[g,w]of u){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=y(g):b<y(g),I=f(g)*d(g),v=m.has(g.id);for(let R of w)if(v&&!qt(R)&&e.report({node:R,message:`React Hook "${n(R)}" 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.`}),x){if(p.async&&e.report({node:R,message:`React Hook "${n(R)}" cannot be called in an async function.`}),!v&&I!==E&&!qt(R)){let L=`React Hook "${n(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:L})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${n(R)}" 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:R,message:N})}else if(h){let N=`React Hook "${n(R)}" is called in function "${n(h)}" 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:R,message:N})}else if(p.type==="Program"){let N=`React Hook "${n(R)}" 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:R,message:N})}else if(c&&!qt(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let L=p.parent;if(L.parent.type==="VariableDeclarator"&&rr(L.parent.id.name))return}let N=`React Hook "${n(R)}" 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:R,message:N})}}},CallExpression(l){if(st(l.callee)){let p=nr(o),u=nr(a),m=p.get(u);m||(m=[],p.set(u,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||tr(l.callee))&&l.arguments.length>0&&(t=l)},Identifier(l){t==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${n(l)}\` 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"(l){l===t&&(t=null)},FunctionDeclaration(l){Bt(l)&&s(r(l))},ArrowFunctionExpression(l){Bt(l)&&s(r(l))}}}};function pr(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 nr(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),oe=he(require("zod/v4"));var Ys=/^\s+$/,Xt=/\r?\n/,Bs=/^(\s*)/,qs=/^(\s*)\S/,Xs=/\r?\n/,Gs=oe.object({indent:oe.union([oe.string().regex(Ys),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Gt=H({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[_(Gs)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(c=>c.toLowerCase());function s(c){let x=c.split(Xt),b=x.filter(w=>w.trim()!=="");if(b.length===0)return c;let g=Number.POSITIVE_INFINITY;for(let w of b){let S=w.match(Bs);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?c:x.map(w=>w.slice(g)).join(`
17
17
  `)}function l(c,x,b){return c.split(Xt).map(w=>w.trim()===""?w:b.repeat(x)+w).join(`
18
18
  `)}function p(c){if(c.type===Q.AST_NODE_TYPES.Identifier)return c.name;if(c.type===Q.AST_NODE_TYPES.MemberExpression){let x=c.object.type===Q.AST_NODE_TYPES.Identifier?c.object.name:null,b=c.property.type===Q.AST_NODE_TYPES.Identifier?c.property.name:null;return x&&b?`${x}.${b}`:b}return null}function u(c,x){if(!c)return!1;for(let b of x)if(b.includes(".")){let g=b.split(".");if(c.type===Q.AST_NODE_TYPES.MemberExpression&&c.object.type===Q.AST_NODE_TYPES.Identifier&&c.property.type===Q.AST_NODE_TYPES.Identifier&&c.object.name===g[0]&&c.property.name===g[1])return!0}else if(c.type===Q.AST_NODE_TYPES.Identifier&&c.name===b)return!0;return!1}function m(c,x){let b=c.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?x.includes(g):!1}function f(c,x){if(!c||c.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:w=!0,optionalMember:S=!0}=x;return g!==void 0&&c.arguments.length!==g||!w&&c.optional||c.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&c.callee.optional||c.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:c.callee.property.name===b}function d(c,x){if(!c||c.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:w=!0}=x;return g!==void 0&&c.arguments.length!==g||!w&&c.optional||c.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:c.callee.name===b}function y(c){return f(c.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&c.parent.type===Q.AST_NODE_TYPES.CallExpression&&c.parent.arguments[0]===c&&d(c.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?c.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(c){if(i.length>0){let x=n.getTokenBefore(c,{includeComments:!0});if(x?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(x.value.trim().toLowerCase()))return!0}return!!(y(c)||o.length>0&&m(c,o)||t.length>0&&c.parent.type===Q.AST_NODE_TYPES.CallExpression&&c.parent.arguments.includes(c)&&u(c.parent.callee,t))}function h(c){let x=`__PLACEHOLDER__${Math.random()}`,b=c.quasis.map(Y=>n.getText(Y).slice(1,Y.tail?-1:-2)).join(x),g=b.match(Xs);if(!g)return;let w=g[0],S=n.lines[n.getLocFromIndex(c.range[0]).line-1];if(!S)return;let v=S.match(qs)?.[1]??"",R;typeof a=="string"?R=a:typeof a=="number"?R=" ".repeat(a):R=v.startsWith(" ")?" ":" ";let L=s(b).replace(new RegExp(`^${w}|${w}[ ]*$`,"g"),""),Z=w+l(L,1,v+R)+w+v,q=b.includes(`\r
@@ -12,7 +12,7 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(c),I=new Set,A=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;A=T}let R=Array.isArray;function N(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let P=C.node.parent;if(P==null&&(st(A.block,C.node.id),P=C.node.parent,P==null))return!1;if(P.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let O=k.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let F=C.node.id,{name:D}=O;if(D==="useRef"&&F.type==="Identifier")return!0;if(kr(O)&&F.type==="Identifier"){for(let j of T.references)j!==F&&d.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(F.type==="ArrayPattern"&&F.elements.length===2&&R(T.identifiers)){if(F.elements[1]===T.identifiers[0]){if(D==="useState"){let j=T.references,pe=0;for(let ge=0;ge<j.length;ge++){if(j[ge].isWrite()&&pe++,pe>1)return!1;p.set(j[ge].identifier,F.elements[0])}}return!0}else if(F.elements[0]===T.identifiers[0]){if(D==="useState"){let j=T.references;for(let pe=0;pe<j.length;pe++)u.add(j[pe].identifier)}return!1}}}else if(D==="useTransition"&&F.type==="ArrayPattern"&&F.elements.length===2&&Array.isArray(T.identifiers)&&F.elements[1]===T.identifiers[0])return!0;return!1}function L(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,P=A.childScopes,O=null,F;for(F=0;F<P.length;F++){let D=P[F],j=D.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){O=D;break}}if(O==null)return!1;for(F=0;F<O.through.length;F++){let D=O.through[F];if(D.resolved!=null&&I.has(D.resolved.scope)&&!X(D.resolved))return!1}return!0}let X=y(N,m),B=y(L,f),K=new Map;function ee(T){let C=T.from,k=!1;for(;C.block!==c;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let J=new Map,me=new Map;ve(S);function ve(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=st(c,C.identifier),P=on(k),O=Se(P,me);if(w&&P.type==="Identifier"&&(P.parent.type==="MemberExpression"||P.parent.type==="OptionalMemberExpression")&&!P.parent.computed&&P.parent.property.type==="Identifier"&&P.parent.property.name==="current"&&ee(C)&&K.set(O,{reference:C,dependencyNode:P}),P.parent.type==="TSTypeQuery"||P.parent.type==="TSTypeReference")continue;let F=C.resolved.defs[0];if(F!=null&&!(F.node!=null&&F.node.init===c.parent)&&F.type!=="TypeParameter")if(J.has(O))J.get(O).references.push(C);else{let D=C.resolved,j=X(D)||B(D);J.set(O,{isStable:j,references:[C]})}}for(let C of T.childScopes)ve(C)}K.forEach(({reference:T,dependencyNode:C},k)=>{let P=T.resolved.references,O=!1;for(let F=0;F<P.length;F++){let{identifier:D}=P[F],{parent:j}=D;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){O=!0;break}}O||s({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let re=new Set;function Ee(T,C){re.has(C)||(re.add(C),s({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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 ${r(b)}.`}))}let le=new Set;if(J.forEach(({isStable:T,references:C},k)=>{T&&le.add(k),C.forEach(P=>{P.writeExpr&&Ee(P.writeExpr,k)})}),re.size>0)return;if(!x){let T=null;if(J.forEach(({isStable:C,references:k},P)=>{T||k.forEach(O=>{if(T)return;let F=O.identifier;if(!p.has(F))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===c&&(T=P)})}),T){let{suggestedDependencies:C}=rt({dependencies:J,declaredDependencies:[],stableDependencies:le,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(c,`, [${C.join(", ")}]`)}}]})}return}let Ie=[],Oe=new Set;x.type!=="ArrayExpression"?s({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(O){return O.removeRange(T.range)}}]});let C;try{C=Se(T,me)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?J.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let P=!A.through.some(O=>O.identifier===k);Ie.push({key:C,node:T}),P||Oe.add(C)});let{suggestedDependencies:ir,unnecessaryDependencies:_e,missingDependencies:xe,duplicateDependencies:Jt}=rt({dependencies:J,declaredDependencies:Ie,stableDependencies:le,externalDependencies:Oe,isEffect:w}),$e=ir;if(Jt.size+xe.size+_e.size===0){if(n)return;Rr({declaredDependencies:Ie,declaredDependenciesNode:x,componentScope:A,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:P})=>{let O=P==="function"?"useCallback":"useMemo",F=P==="function"?"definition":"initialization",D=`wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,j=k?`To fix this, ${D}`:`Move it inside the ${g} callback. Alternatively, ${D}`,pe=P==="conditional"||P==="logical expression"?"could make":"makes",ge=`The '${C.name.name}' ${P} ${pe} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${j}`,Yt;k&&C.type==="Variable"&&P==="function"&&(Yt=[{desc:`Wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,fix(Bt){let[or,ar]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Bt.insertTextBefore(C.node.init,or),Bt.insertTextAfter(C.node.init,ar)]}}]),s({node:C.node,message:ge,suggest:Yt})});return}!w&&xe.size>0&&($e=rt({dependencies:J,declaredDependencies:[],stableDependencies:le,externalDependencies:Oe,isEffect:w}).suggestedDependencies);function sr(){if(Ie.length===0)return!0;let T=Ie.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}sr()&&$e.sort();function Ze(T){let C=T.split("."),k="";for(let P=0;P<C.length;P++){if(P!==0){let O=C.slice(0,P+1).join("."),F=me.get(O)===!0;k+=F?"?.":"."}k+=C[P]}return k}function Ke(T,C,k,P){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+Ar(Array.from(T).sort().map(O=>"'"+Ze(O)+"'"))+`. Either ${P} ${T.size>1?"them":"it"} or remove the dependency array.`}let ue="";if(_e.size>0){let T=null;if(Array.from(_e.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)ue=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Oe.size>0){let C=Array.from(Oe)[0];S.set.has(C)||(ue=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ue&&xe.has("props")){let T=J.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let P=0;P<C.length;P++){let O=C[P],F=st(A.block,O.identifier);if(!F){k=!1;break}let D=F.parent;if(D==null){k=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){k=!1;break}}k&&(ue=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!ue&&xe.size>0){let T=null;xe.forEach(C=>{if(T)return;let k=A.set.get(C),P=J.get(C);if(P.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let F=!1,D;for(let j=0;j<P.references.length;j++)if(D=P.references[j].identifier,D!=null&&D.parent!=null&&(D.parent.type==="CallExpression"||D.parent.type==="OptionalCallExpression")&&D.parent.callee===D){F=!0;break}F&&(T=C)}),T!==null&&(ue=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ue&&xe.size>0){let T=null;if(xe.forEach(C=>{if(T!==null)return;let P=J.get(C).references,O,F;for(let D=0;D<P.length;D++){for(O=P[D].identifier,F=O.parent;F!=null&&F!==A.block;){if(F.type==="CallExpression"){let j=p.get(F.callee);if(j!=null){if(j.name===C)T={missingDep:C,setter:F.callee.name,form:"updater"};else if(u.has(O))T={missingDep:C,setter:F.callee.name,form:"reducer"};else{let pe=P[D].resolved;if(pe!=null){let ge=pe.defs[0];ge!=null&&ge.type==="Parameter"&&(T={missingDep:C,setter:F.callee.name,form:"inlineReducer"})}}break}}F=F.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ue=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ue=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ue=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:x,message:`React Hook ${r(b)} has `+(Ke(xe,"a","missing","include")||Ke(_e,"an","unnecessary","exclude")||Ke(Jt,"a","duplicate","omit"))+ue,suggest:[{desc:`Update the dependencies array to be: [${$e.map(Ze).join(", ")}]`,fix(T){return T.replaceText(x,`[${$e.map(Ze).join(", ")}]`)}}]})}function h(c){let x=wr(c.callee,i);if(x===-1)return;let b=c.arguments[x],g=c.callee,w=an(g).name,S=c.arguments[x+1],I=/Effect($|[^a-z])/g.test(w);if(!b){s({node:g,message:`React Hook ${w} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!I)){if(!S&&!I){(w==="useMemo"||w==="useCallback")&&s({node:g,message:`React Hook ${w} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,w,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=t(c).set.get(b.name);if(A==null||A.defs==null)return;let R=A.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,w,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,w,I);return}break}break;default:s({node:g,message:`React Hook ${w} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${w} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let c of e.sourceCode.getAllComments())if(Ir.test(c.value))return n=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:c=>h(c)}}};function rt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let c=s(a,h);c.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let h=s(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=s(a,E);h.isSatisfiedRecursively=!0});function s(E,h){let c=h.split("."),x=E;for(let b of c){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,c){let x=h.split("."),b=E;for(let g of x){let w=b.children.get(g);if(!w)return;c(w),b=w}}let p=new Set,u=new Set;m(a,p,u,E=>E);function m(E,h,c,x){E.children.forEach((b,g)=>{let w=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&c.add(w);return}if(b.isUsed){h.add(w);return}m(b,h,c,S=>w+"."+S)})}let f=[],d=new Set,y=new Set;return n.forEach(({key:E})=>{u.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function be(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 be(e.consequent)!=null||be(e.alternate)!=null?"conditional":null;case"LogicalExpression":return be(e.left)!=null||be(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return be(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return be(e.expression);case"TSAsExpression":return be(e.expression)}return null}function Rr({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=be(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!ln(n,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function on(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)?on(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function it(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Se(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Se(e.object,n),t=Se(e.property,null),o=`${r}.${t}`;return it(e,n,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Se(e.object,n),t=Se(e.property,null),o=`${r}.${t}`;return it(e,n,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Se(r.object,n),o=Se(r.property,null),a=`${t}.${o}`;return it(r,n,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function an(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function wr(e,n){let r=an(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Se(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return n.additionalHooks.test(t)?0:-1}else return-1}}function st(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),vr(t,n))return t;if(ln(t,n))for(let[o,a]of Object.entries(t))o!=="parent"&&(rn(a)?(a.parent=t,r.push(a)):Array.isArray(a)&&a.forEach(i=>{rn(i)&&(i.parent=t,r.push(i))}))}return null}function Ar(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function rn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function vr(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function ln(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function kr(e){return!1}import{AST_NODE_TYPES as ze,ESLintUtils as cn}from"@typescript-eslint/utils";import ie from"typescript";import{z as Pr}from"zod/v4";var Fr=cn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="improved-no-unnecessary-condition",Or=Pr.object({}),Nr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Dr=new Set(Nr),ot={name:pn,rule:Fr({name:pn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[_(Or)]},defaultOptions:[{}],create(e){let n=cn.getParserServices(e,!0),r=n.program?.getTypeChecker();if(!r||!n.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===ze.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&ie.TypeFlags.Any||s.flags&ie.TypeFlags.Unknown?null:s.flags&ie.TypeFlags.StringLike?["string"]:s.flags&ie.TypeFlags.NumberLike?["number"]:s.flags&ie.TypeFlags.BigIntLike?["bigint"]:s.flags&ie.TypeFlags.BooleanLike?["boolean"]:s.flags&ie.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ie.TypeFlags.Undefined||s.flags&ie.TypeFlags.Void?["undefined"]:s.flags&ie.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ie.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ie.TypeFlags.NonPrimitive?["object"]:s.flags&ie.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=n.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&ie.TypeFlags.Any||p.flags&ie.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)u.push(...d);else return null}return u}let m=o(p);return m?(u.push(...m),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===ze.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===ze.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Mr(u,Dr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(u);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:u}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:Ue(m)}})}return{BinaryExpression:i}}})};function Ue(e){return Array.from(new Set(e)).join(" | ")||"never"}function ke(e,n){let r=e.argument;return r.type===ze.Identifier?r.name:n.sourceCode.getText(r)}function Mr(e,n){return n.has(e)}import{AST_NODE_TYPES as jr,ESLintUtils as Lr}from"@typescript-eslint/utils";import{z as at}from"zod/v4";var _r=Lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-call-with-explicit-generics",$r=at.object({functions:at.array(at.string())}),Ur=_r({name:un,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[_($r)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:o}=t;o.type===jr.Identifier&&r.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),lt={name:un,rule:Ur};import{AST_NODE_TYPES as We,ESLintUtils as zr}from"@typescript-eslint/utils";var Wr=zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fn="no-call-with-inferred-generics",Vr=Wr({name:fn,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,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==We.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=n.disallowTypes}=a;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&t.typeArguments?.params.some(u=>!s&&u.type===We.TSAnyKeyword||l&&u.type===We.TSTypeReference&&u.typeName.type===We.Identifier&&l.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),pt={name:fn,rule:Vr};import{ESLintUtils as Hr}from"@typescript-eslint/utils";var Jr=Hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-commented-out-code",Yr=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Br=/^\s*return\s+/,qr=/\w=("|'|`)/,Xr=/\w+:\s*('|"|`)/,Gr=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Zr=/\w+-\w+:/,Kr=/\w+_\w+:/,Qr=/\?\s+\w/,ei=/:\s+\w/,ti=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ni=/^\s*\d+[,}]/,ri=/^\s*\[[^\]]*\][,}]/,ii=/^\s*\{[^}]*\}[,}]/,si=/\.\w+\(/,oi=/\[\w+\]/,ai=/^\s*(['"`]).+?\1\s*:/,li=/^<[A-Z]\w*(\s|>|\/)/,pi=/^<[a-z]+(\s|>|\/)/,ci=/<[A-Z]\w*(\s.*)?>/,ui=/<\/[A-Z]\w*>/,fi=/<[a-z]+(\s.*)?>/,mi=/<\/[a-z]+>/,di=/^\s*[*\s]*$/,yi=/^[a-zA-Z]/,gi=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Si=/```[\s\S]*?```/g,Ti=/`[^`]*`/g,mn=/[a-zA-Z0-9]/,hi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Ei=/[{}[\]()`=<>]/,xi=/:\s*(['"`[{(]|\w+\s*=>)/,bi=/\bif\s*\(|\belse\b|=>/,q={returnStatement:Br,stringAssignment:qr,objectPropertyWithQuotes:Xr,computedPropertyAssignment:Gr,kebabCaseProperty:Zr,snakeCaseProperty:Kr,ternaryOperator:Qr,colonWithWord:ei,quotedString:ti,numberWithComma:ni,arrayWithComma:ri,objectWithComma:ii,methodCall:si,arrayAccess:oi,quotedPropertyKey:ai,jsxSelfClosing:li,jsxElement:pi,jsxOpeningTag:ci,jsxClosingTag:ui,htmlOpeningTag:fi,htmlClosingTag:mi,jsdocComment:di};function Ci(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&yi.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||hi.test(n)||Ei.test(n)||xi.test(n)||bi.test(n)?!1:!!(n.includes(":")&&gi.test(n))}var Ii=[") {","return;",q.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",q.stringAssignment,");",q.objectPropertyWithQuotes,q.computedPropertyAssignment,q.kebabCaseProperty,q.snakeCaseProperty,"&&","||","()",q.ternaryOperator,q.colonWithWord,q.quotedString,q.numberWithComma,q.arrayWithComma,q.objectWithComma,q.methodCall,q.arrayAccess,"?.(","??","=>",q.quotedPropertyKey],Ri=["/>","</",q.jsxSelfClosing,q.jsxElement,q.jsxOpeningTag,q.jsxClosingTag,q.htmlOpeningTag,q.htmlClosingTag],dn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],wi=Jr({name:yn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,o){if(t.startsWith("/"))return!1;let a=t.trimStart();if(t.startsWith("*")||a.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||q.jsdocComment.test(t))return!1;for(let i of dn)if(a.startsWith(i))return!1;if(t.includes("https://")||Ci(a))return!1;if(o==="Block"){for(let i of Ri)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Yr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ii)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,o){let a=t,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Si);p.some(m=>mn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(Ti);return s.some(p=>mn.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=n(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:dn.join(", ")}})}}}}}),ct={name:yn,rule:wi};import{ESLintUtils as Ai,TSESTree as vi}from"@typescript-eslint/utils";var ki=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gn="no-default-export",Pi=ki({name:gn,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(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===vi.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),ut={name:gn,rule:Pi};import{ESLintUtils as Fi}from"@typescript-eslint/utils";var Oi=Fi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-leaked-text-in-jsx",Ni=[",",";","[","]","(",")"],Di=Oi({name:Sn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";Ni.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),ft={name:Sn,rule:Di};import{AST_NODE_TYPES as Ne,ESLintUtils as Mi}from"@typescript-eslint/utils";var ji=Mi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-non-camel-case-functions",Li=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Tn(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Ne.Identifier&&n.name==="JSX"&&r.name==="Element"}var _i=ji({name:hn,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(n){if(n.id&&!Li.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Ne.TSTypeReference?Tn(r):r.type===Ne.TSUnionType&&r.types.some(o=>o.type===Ne.TSTypeReference&&Tn(o))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),mt={name:hn,rule:_i};import{ESLintUtils as $i,TSESTree as V}from"@typescript-eslint/utils";import{AST_NODE_TYPES as En}from"@typescript-eslint/utils";function Pe(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:Pe(e.parent,n,r===1/0?r:r-1)}function*dt(e){yield e,e.parent&&(yield*dt(e.parent))}function yt(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function xn(e,n,r){let o=r.getDeclaredVariables(e).find(a=>a.name===n||a.identifiers[0]?.parent.type===En.Property&&a.identifiers[0].parent.key.type===En.Identifier&&a.identifiers[0].parent.key.name===n);return o?o.references.filter(a=>!a.init):[]}var Ui=$i.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-optional-root-props",zi=Ui({name:bn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let a=e.sourceCode.getDeclaredVariables(t)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of dt(i.identifier)){if("returnType"in s||s.type===V.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===V.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=Pe(l.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Ve(u,e.sourceCode);return m?!(m.parent.type===V.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===V.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.AST_NODE_TYPES.ArrowFunctionExpression){let p=Pe(l,V.AST_NODE_TYPES.VariableDeclaration);return p?!!Ve(p,e.sourceCode):!1}if(l.type===V.AST_NODE_TYPES.FunctionDeclaration)return!!Ve(l,e.sourceCode)}return!1}function r(t){t.key.type!==V.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Pe(t,V.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral&&!(He(t)||!n(t)))for(let o of t.typeAnnotation.members)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(t){if(!(He(t)||!n(t)))for(let o of t.body.body)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(t){if(t.typeName.type!==V.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==V.AST_NODE_TYPES.TSTypeLiteral)return;let a=Pe(t.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Ve(a,e.sourceCode);if(!(!i||i.parent.type===V.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===V.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function He(e){return e?e.parent?.type===V.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ve(e,n){if(He(e))return;let r;if(e.type===V.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===V.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!He(a[0].identifier.parent.parent))return a[0].identifier}var gt={name:bn,rule:zi};import{AST_NODE_TYPES as Je}from"@typescript-eslint/utils";var De=W({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===Je.Identifier?n.has(t.name):t.type===Je.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)n.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===Je.VariableDeclaration)for(let o of t.declaration.declarations)r(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===Je.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as Wi}from"@typescript-eslint/utils";import St from"path";import{z as Ce}from"zod/v4";var Vi=Wi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="no-relative-imports",Hi=Ce.object({find:Ce.string(),replacement:Ce.string()}),Ji=Ce.object({aliases:Ce.array(Hi),rootDir:Ce.string().optional(),allowNotFoundAliases:Ce.boolean().optional(),_dev_simulateFileName:Ce.string().optional()}),Yi=Vi({name:Cn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[_(Ji)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=St.dirname(s);return St.resolve(l,i)}function a(i){let s=n.rootDir??process.cwd(),l=St.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of n.aliases)if(l.startsWith(u)){let m=l.replace(u,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let l=o(s,r),p=a(l);!p&&n.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Tt={name:Cn,rule:Yi};import{AST_NODE_TYPES as G}from"@typescript-eslint/utils";import{z as In}from"zod/v4";var Bi=In.object({customMessage:In.string().optional()}),ht=W({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(Bi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case G.Literal:return!0;case G.ObjectExpression:return t.properties.every(o=>o.type===G.Property?o.computed||o.value.type===G.Identifier&&o.key.type===G.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case G.ArrayExpression:return t.elements.every(o=>o?o.type===G.SpreadElement?!1:r(o):!0);case G.TemplateLiteral:return t.expressions.length===0;case G.ConditionalExpression:case G.LogicalExpression:case G.BinaryExpression:case G.UnaryExpression:case G.CallExpression:case G.MemberExpression:case G.Identifier:case G.ArrowFunctionExpression:case G.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.JSXExpressionContainer?t.value.expression.type!==G.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.Literal&&(o=t.value),o&&r(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as Ye}from"@typescript-eslint/utils";import*as we from"zod/v4";var qi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function Xi(e){return e.typeAnnotation.type!==Ye.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Gi=/\.(typeGuards|type-guards)\.(ts|tsx)$/;function Zi(e){return Gi.test(e)}function Ki(e){let n=e.parent;for(;n;){if(n.type===Ye.CallExpression&&n.callee.type===Ye.MemberExpression&&n.callee.property.type===Ye.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Et=W({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[_(qi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Zi(r))return{};function t(o){if(!Xi(o))return;let a=Ki(o);if(n.alternativeMsgs&&a){let i=a.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});import{AST_NODE_TYPES as Fe}from"@typescript-eslint/utils";var Qi="no-unnecessary-async-on-jsx-props";function es(e){if(e.body.type!==Fe.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Fe.ExpressionStatement?!1:r.expression.type===Fe.AwaitExpression}var xt=W({name:Qi,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){es(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(t.replaceTextRange([i.range[0],l.range[0]],"")):a.push(t.remove(i))}function s(l){if(l.type===Fe.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?a.push(t.replaceTextRange([p.range[0],u.range[0]],"")):a.push(t.remove(p))}}if(l.type===Fe.BlockStatement)for(let p of l.body)s(p);else l.type===Fe.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});import{AST_NODE_TYPES as Me,ESLintUtils as wn}from"@typescript-eslint/utils";import*as bt from"typescript";import je from"zod/v4";var ts=wn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-unnecessary-casting",ns=je.object({additionalCastFunctions:je.array(je.object({name:je.string(),expectedType:je.enum(["string","number"])})).optional()}),Ct={name:Rn,rule:ts({name:Rn,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[_(ns)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=wn.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case Me.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case Me.TemplateLiteral:return m==="string";case Me.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,m){return m==="number"?!!(u.flags&bt.TypeFlags.NumberLike):!!(u.flags&bt.TypeFlags.StringLike)}function l(u,m){return f=>f.replaceText(u,e.sourceCode.getText(m))}function p(u){if(!a||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===Me.SpreadElement)return;let{callee:f}=u;if(f.type!==Me.Identifier)return;let d=f.name,y=t.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,c;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",c={name:y.name,type:y.expectedType}),e.report({node:u,messageId:h,...c?{data:c}:{},fix:l(u,m)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Be}from"@typescript-eslint/utils";import*as de from"zod/v4";var rs=de.object({methods:de.union([de.array(de.string()),de.literal("array")])}),It=W({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[_(rs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):t.has(s)}function a(s){let{callee:l}=s;if(l.type===Be.MemberExpression){let p=l.property;if(p.type===Be.Identifier)return p.name}return null}function i(s,l){if(s.type!==Be.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Be.CallExpression){let u=a(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return s.typeAnnotation?f.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var Rt=W({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===ae.ObjectPattern||!n.init||n.init.type!==ae.ObjectExpression||n.id.type===ae.Identifier&&n.id.typeAnnotation||n.parent.parent.type===ae.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==ae.Identifier)return;let t=is(n,e.sourceCode);if(t.length===0)return;let o=n.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),a=new Set;for(let i of t){if(i.identifier.parent.type!==ae.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==ae.Identifier)return;a.add(s.property.name)}if(s.parent.type===ae.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function is(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as Y,ESLintUtils as ss}from"@typescript-eslint/utils";import{z as Ae}from"zod/v4";var os=Ae.object({selectors:Ae.array(Ae.object({name:Ae.string(),selectorProp:Ae.string().optional(),selectorArgPos:Ae.number().optional(),returnProp:Ae.string().optional()}))}),as=ss.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),An="no-unused-selected-values",wt={name:An,rule:as({name:An,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(os)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===Y.CallExpression&&(a=o.init),!a)return;let i=ps(a);if(!i)return;let s=t.get(i);if(!s)return;let l=ls(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=cs(l);if(!p)return;let u=vn(p.properties,void 0);if(!u)return;if(o.id.type===Y.ObjectPattern){let d=vn(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of u)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==Y.Identifier||s.returnProp)return;let m=us(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==Y.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==Y.Identifier)return;f.add(y.name)}for(let[d,y]of u)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function ls(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===Y.ArrowFunctionExpression||t.type===Y.FunctionExpression)return t;if(r&&t.type===Y.ObjectExpression){let o=t.properties.find(i=>i.type===Y.Property&&i.key.type===Y.Identifier&&i.key.name===r);if(o?.type!==Y.Property)return null;let a=o.value;if(a.type===Y.ArrowFunctionExpression||a.type===Y.FunctionExpression)return a}return null}function ps(e){return e.callee.type===Y.Identifier?e.callee.name:e.callee.type===Y.MemberExpression&&e.callee.property.type===Y.Identifier?e.callee.property.name:null}function cs(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let n=e.body.body.filter(r=>r.type===Y.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==Y.ObjectExpression?null:n[0].argument}return null}function vn(e,n){let r=e;if(n){let o=e.find(a=>a.type===Y.Property&&a.key.type===Y.Identifier&&a.key.name===n);if(o?.type!==Y.Property||o.value.type!==Y.ObjectPattern)return null;r=o.value.properties}let t=new Map;for(let o of r){if(o.type!==Y.Property||o.key.type!==Y.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function us(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as H}from"@typescript-eslint/utils";var At=W({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===H.ImportDeclaration&&a.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(a){if(o)return;if(!t){let s=fs(a);s&&(t=s);return}let i=ms(a,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,l]of t)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function fs(e){if(!(e.callee.type===H.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==H.ObjectExpression)return null;let t=yt(r.properties,a=>a.type!==H.Property||a.key.type!==H.Identifier||a.key.name!=="initialConfig"?null:a.value.type===H.ObjectExpression?a.value:a.value.type===H.ArrowFunctionExpression||a.value.type===H.FunctionExpression?ds(a.value):null);if(!t)return null;let o=new Map;for(let a of t.properties)a.type===H.Property&&a.key.type===H.Identifier&&o.set(a.key.name,a);return o}function ms(e,n){if(!(e.callee.type===H.Identifier&&e.callee.name==="useFormState")||e.parent.type!==H.VariableDeclarator||e.parent.id.type!==H.ObjectPattern||!yt(e.parent.id.properties,i=>i.type===H.Property&&i.key.type===H.Identifier&&i.key.name==="formFields"&&i))return null;let o=xn(e.parent,"formFields",n),a=new Set;for(let{identifier:i}of o){if(i.type!==H.Identifier||i.parent.type===H.Property&&i.parent.parent.type===H.ObjectExpression&&i.parent.parent.parent.type===H.ReturnStatement||i.parent.type===H.ReturnStatement)return null;if(i.parent.type===H.MemberExpression){if(i.parent.object.type!==H.Identifier||i.parent.property.type!==H.Identifier)return null;a.add(i.parent.property.name)}}return a}function ds(e){if(e.body.type===H.ObjectExpression)return e.body;if(e.body.type===H.BlockStatement){let n=e.body.body.filter(r=>r.type===H.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==H.ObjectExpression?null:n[0].argument}return null}import{AST_NODE_TYPES as U,ESLintUtils as ys}from"@typescript-eslint/utils";import{z as qe}from"zod/v4";var gs=ys.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function kn(e){let n=[];for(let r of e.members)r.type===U.TSPropertySignature&&r.key.type===U.Identifier&&n.push([r.key.name,r]);return n}function Pn(e,...n){for(let r of n)e.set(...r);return e}var Ss=qe.object({forceCheckOnFCPropTypesWithName:qe.array(qe.string()).optional(),alwaysCheckFunctionOptionTypes:qe.boolean().optional()}),Fn="no-unused-type-props-in-args",vt=null,Ts=gs({name:Fn,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:[_(Ss)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!vt&&(vt=r.map(l=>new RegExp(l)));function o(l,p,u,m,f=!0,d=!1){let y=u.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&vt?.some(g=>g.test(y)),c=d&&t;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===U.ExportNamedDeclaration;if(!(f&&b&&!c)){if(x.type===U.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===U.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,u,m,f,d=!1){if(m.type===U.TSInterfaceBody){for(let y of m.body)y.type===U.TSPropertySignature&&y.key.type===U.Identifier&&u.set(y.key.name,y);return}if(m.type===U.TSTypeLiteral){Pn(u,...kn(m));return}if(m.type===U.TSIntersectionType){for(let y of m.types)a(l,p,u,y,!0,d);return}f||m.type===U.TSTypeReference&&m.typeName.type===U.Identifier&&o(l,p,m.typeName,u,!0,d)}function i(l,p,u,m=!1){for(let f of u)if(f.type===U.ObjectPattern&&f.typeAnnotation){let d=new Map;if(a(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;s(f,d)}else f.type===U.AssignmentPattern&&f.left.type===U.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let u=[];if(l.properties.at(-1)?.type===U.RestElement)return;for(let y of l.properties)y.type===U.Property&&y.key.type===U.Identifier&&u.push(y.key.name);let f=[],d=[];for(let[y,E]of p)u.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let c=l.properties.at(-1),x=d.join(", ");return c?c.type===U.RestElement?null:h.insertTextAfter(c,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,m=p.id.type===U.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===U.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===U.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===U.TSTypeReference&&m.typeName.type===U.Identifier)o(!0,l,m.typeName,u,!1);else if(m.type===U.TSTypeLiteral)Pn(u,...kn(m));else if(m.type===U.TSIntersectionType)for(let f of m.types)f.type===U.TSTypeReference&&f.typeName.type===U.Identifier?o(!0,l,f.typeName,u,!1):a(!0,l,u,f,!0);if(u.size!==0&&p.init?.type===U.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===U.ObjectPattern&&s(f,u)}}},FunctionDeclaration(l){i(!1,l,l.params,t)},ArrowFunctionExpression(l){i(!1,l,l.params,t)}}}}),kt={name:Fn,rule:Ts};import{AST_NODE_TYPES as fe}from"@typescript-eslint/utils";var Pt=W({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===fe.Identifier?n.has(t.callee.name):t.callee.type===fe.MemberExpression&&t.callee.object.type===fe.Identifier&&t.callee.property.type===fe.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===fe.ImportSpecifier&&o.imported.type===fe.Identifier&&o.imported.name==="useRef"&&n.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===fe.CallExpression&&r(t.init)&&t.id.type===fe.Identifier){let a=e.sourceCode.getScope(t).set.get(t.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==t&&!(p.type===fe.JSXExpressionContainer&&p.parent.type===fe.JSXAttribute&&p.parent.name.type===fe.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});import{AST_NODE_TYPES as Ft,ESLintUtils as hs}from"@typescript-eslint/utils";var Es=hs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="prefer-named-functions",On=new Map,xs=Es({name:Nn,meta:{hasSuggestions:!0,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:{suggestion:"Convert to named function",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,[n]){let r=null;if(n.ignoreRegex){let t=On.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),On.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===Ft.ArrowFunctionExpression&&t.id.type===Ft.Identifier){let o=t.id.name;if(t.id.typeAnnotation||r&&r.test(o)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Ft.BlockStatement)return;let a=t.parent,i=t.init.params,s=t.init.body,l=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ot={name:Nn,rule:xs};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as Te}from"zod/v4";var bs=Te.object({disallowedFunctions:Te.array(Te.object({name:Te.string(),allowUsingWithArgs:Te.boolean().optional(),hookAlternative:Te.string().optional(),message:Te.string().optional(),allowUseInside:Te.array(Te.string()).optional()}))}),Cs=/^use[A-Z]/,Is=/^[A-Z]/;function Xe(e){return Cs.test(e)}function Dn(e){return Is.test(e)}function Rs(e){return e.type===M.Identifier?Xe(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?Xe(e.property.name):!1}function Mn(e,n){return e.type===M.Identifier?e.name===n:e.type===M.MemberExpression&&e.object.type===M.Identifier&&e.property.type===M.Identifier?e.object.name==="React"&&e.property.name===n:!1}function jn(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Mn(e.parent.callee,"forwardRef"))}function Ln(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Mn(e.parent.callee,"memo"))}function Nt(e){if(e.type===M.FunctionDeclaration||e.type===M.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.FunctionExpression||e.type===M.ArrowFunctionExpression){if(e.parent.type===M.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ws(e){let n=e.parent,r=!1;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let t=Nt(n);if(t&&t.type===M.Identifier){if(Dn(t.name)||Xe(t.name))return!r;r=!0}else{if(jn(n)||Ln(n))return!r;if(n.parent.type===M.CallExpression){let o=n.parent;Rs(o.callee)||(r=!0)}else n.parent.type===M.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function _n(e){return e.callee.type===M.Identifier?e.callee.name:e.callee.type===M.MemberExpression&&e.callee.property.type===M.Identifier?e.callee.property.name:null}function As(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let t=Nt(r);if(t&&t.type===M.Identifier&&n.includes(t.name))return!0}else if(r.type===M.CallExpression){let t=_n(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function vs(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===M.Identifier&&n.name==="undefined")}function ks(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let o=Nt(t);if(o&&o.type===M.Identifier){if(Dn(o.name)||Xe(o.name)){r=!0;break}}else if(jn(t)||Ln(t)){r=!0;break}}t=t.parent}return r?n.length===0?ws(e):!As(e,n):!1}var Dt=W({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[_(bs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=_n(o);if(!a)return;let i=t.get(a);if(!i||i.allowUsingWithArgs&&vs(o))return;let s=i.allowUseInside||[];ks(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===M.Identifier?l.replaceText(o.callee,p):o.callee.type===M.MemberExpression&&o.callee.property.type===M.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as Z,AST_TOKEN_TYPES as $n,ESLintUtils as Ps}from"@typescript-eslint/utils";import Mt from"zod/v4";var Fs=Ps.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="prefer-single-line-if",Os=Mt.object({maxLineLength:Mt.number().optional(),maxNonSimpleConditionLength:Mt.number().optional()}),Ns=Fs({name:zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[_(Os)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==Z.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let a=t.consequent.body[0];if(!a)return;if(a.type===Z.ReturnStatement){if(!Vn(a))return}else if(!(a.type===Z.ContinueStatement||a.type===Z.BreakStatement))return;if(t.test.type===Z.LogicalExpression||t.test.type===Z.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=Un(t.test);if(!m&&t.test.type===Z.UnaryExpression&&t.test.operator==="!"){let f=t.test.argument;Un(f)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let s=r.getText(a);if(i.includes(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(c),I=new Set,A=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;A=T}let R=Array.isArray;function N(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let P=C.node.parent;if(P==null&&(st(A.block,C.node.id),P=C.node.parent,P==null))return!1;if(P.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let O=k.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let F=C.node.id,{name:D}=O;if(D==="useRef"&&F.type==="Identifier")return!0;if(kr(O)&&F.type==="Identifier"){for(let j of T.references)j!==F&&d.add(j.identifier);return!0}else if(D==="useState"||D==="useReducer"){if(F.type==="ArrayPattern"&&F.elements.length===2&&R(T.identifiers)){if(F.elements[1]===T.identifiers[0]){if(D==="useState"){let j=T.references,pe=0;for(let ge=0;ge<j.length;ge++){if(j[ge].isWrite()&&pe++,pe>1)return!1;p.set(j[ge].identifier,F.elements[0])}}return!0}else if(F.elements[0]===T.identifiers[0]){if(D==="useState"){let j=T.references;for(let pe=0;pe<j.length;pe++)u.add(j[pe].identifier)}return!1}}}else if(D==="useTransition"&&F.type==="ArrayPattern"&&F.elements.length===2&&Array.isArray(T.identifiers)&&F.elements[1]===T.identifiers[0])return!0;return!1}function L(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,P=A.childScopes,O=null,F;for(F=0;F<P.length;F++){let D=P[F],j=D.block;if(k.type==="FunctionDeclaration"&&j===k||k.type==="VariableDeclarator"&&j.parent===k){O=D;break}}if(O==null)return!1;for(F=0;F<O.through.length;F++){let D=O.through[F];if(D.resolved!=null&&I.has(D.resolved.scope)&&!X(D.resolved))return!1}return!0}let X=y(N,m),B=y(L,f),K=new Map;function ee(T){let C=T.from,k=!1;for(;C.block!==c;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let J=new Map,me=new Map;ve(S);function ve(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=st(c,C.identifier),P=on(k),O=Se(P,me);if(w&&P.type==="Identifier"&&(P.parent.type==="MemberExpression"||P.parent.type==="OptionalMemberExpression")&&!P.parent.computed&&P.parent.property.type==="Identifier"&&P.parent.property.name==="current"&&ee(C)&&K.set(O,{reference:C,dependencyNode:P}),P.parent.type==="TSTypeQuery"||P.parent.type==="TSTypeReference")continue;let F=C.resolved.defs[0];if(F!=null&&!(F.node!=null&&F.node.init===c.parent)&&F.type!=="TypeParameter")if(J.has(O))J.get(O).references.push(C);else{let D=C.resolved,j=X(D)||B(D);J.set(O,{isStable:j,references:[C]})}}for(let C of T.childScopes)ve(C)}K.forEach(({reference:T,dependencyNode:C},k)=>{let P=T.resolved.references,O=!1;for(let F=0;F<P.length;F++){let{identifier:D}=P[F],{parent:j}=D;if(j!=null&&j.type==="MemberExpression"&&!j.computed&&j.property.type==="Identifier"&&j.property.name==="current"&&j.parent.type==="AssignmentExpression"&&j.parent.left===j){O=!0;break}}O||s({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let re=new Set;function Ee(T,C){re.has(C)||(re.add(C),s({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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 ${r(b)}.`}))}let le=new Set;if(J.forEach(({isStable:T,references:C},k)=>{T&&le.add(k),C.forEach(P=>{P.writeExpr&&Ee(P.writeExpr,k)})}),re.size>0)return;if(!x){let T=null;if(J.forEach(({isStable:C,references:k},P)=>{T||k.forEach(O=>{if(T)return;let F=O.identifier;if(!p.has(F))return;let j=O.from;for(;j.type!=="function";)j=j.upper;j.block===c&&(T=P)})}),T){let{suggestedDependencies:C}=rt({dependencies:J,declaredDependencies:[],stableDependencies:le,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(c,`, [${C.join(", ")}]`)}}]})}return}let Ie=[],Oe=new Set;x.type!=="ArrayExpression"?s({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(O){return O.removeRange(T.range)}}]});let C;try{C=Se(T,me)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?J.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let P=!A.through.some(O=>O.identifier===k);Ie.push({key:C,node:T}),P||Oe.add(C)});let{suggestedDependencies:ir,unnecessaryDependencies:_e,missingDependencies:xe,duplicateDependencies:Jt}=rt({dependencies:J,declaredDependencies:Ie,stableDependencies:le,externalDependencies:Oe,isEffect:w}),$e=ir;if(Jt.size+xe.size+_e.size===0){if(n)return;Rr({declaredDependencies:Ie,declaredDependenciesNode:x,componentScope:A,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:P})=>{let O=P==="function"?"useCallback":"useMemo",F=P==="function"?"definition":"initialization",D=`wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,j=k?`To fix this, ${D}`:`Move it inside the ${g} callback. Alternatively, ${D}`,pe=P==="conditional"||P==="logical expression"?"could make":"makes",ge=`The '${C.name.name}' ${P} ${pe} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${j}`,Yt;k&&C.type==="Variable"&&P==="function"&&(Yt=[{desc:`Wrap the ${F} of '${C.name.name}' in its own ${O}() Hook.`,fix(Bt){let[or,ar]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Bt.insertTextBefore(C.node.init,or),Bt.insertTextAfter(C.node.init,ar)]}}]),s({node:C.node,message:ge,suggest:Yt})});return}!w&&xe.size>0&&($e=rt({dependencies:J,declaredDependencies:[],stableDependencies:le,externalDependencies:Oe,isEffect:w}).suggestedDependencies);function sr(){if(Ie.length===0)return!0;let T=Ie.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}sr()&&$e.sort();function Ze(T){let C=T.split("."),k="";for(let P=0;P<C.length;P++){if(P!==0){let O=C.slice(0,P+1).join("."),F=me.get(O)===!0;k+=F?"?.":"."}k+=C[P]}return k}function Ke(T,C,k,P){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+Ar(Array.from(T).sort().map(O=>"'"+Ze(O)+"'"))+`. Either ${P} ${T.size>1?"them":"it"} or remove the dependency array.`}let ue="";if(_e.size>0){let T=null;if(Array.from(_e.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)ue=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Oe.size>0){let C=Array.from(Oe)[0];S.set.has(C)||(ue=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ue&&xe.has("props")){let T=J.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let P=0;P<C.length;P++){let O=C[P],F=st(A.block,O.identifier);if(!F){k=!1;break}let D=F.parent;if(D==null){k=!1;break}if(D.type!=="MemberExpression"&&D.type!=="OptionalMemberExpression"){k=!1;break}}k&&(ue=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!ue&&xe.size>0){let T=null;xe.forEach(C=>{if(T)return;let k=A.set.get(C),P=J.get(C);if(P.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let F=!1,D;for(let j=0;j<P.references.length;j++)if(D=P.references[j].identifier,D!=null&&D.parent!=null&&(D.parent.type==="CallExpression"||D.parent.type==="OptionalCallExpression")&&D.parent.callee===D){F=!0;break}F&&(T=C)}),T!==null&&(ue=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ue&&xe.size>0){let T=null;if(xe.forEach(C=>{if(T!==null)return;let P=J.get(C).references,O,F;for(let D=0;D<P.length;D++){for(O=P[D].identifier,F=O.parent;F!=null&&F!==A.block;){if(F.type==="CallExpression"){let j=p.get(F.callee);if(j!=null){if(j.name===C)T={missingDep:C,setter:F.callee.name,form:"updater"};else if(u.has(O))T={missingDep:C,setter:F.callee.name,form:"reducer"};else{let pe=P[D].resolved;if(pe!=null){let ge=pe.defs[0];ge!=null&&ge.type==="Parameter"&&(T={missingDep:C,setter:F.callee.name,form:"inlineReducer"})}}break}}F=F.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":ue=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":ue=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":ue=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:x,message:`React Hook ${r(b)} has `+(Ke(xe,"a","missing","include")||Ke(_e,"an","unnecessary","exclude")||Ke(Jt,"a","duplicate","omit"))+ue,suggest:[{desc:`Update the dependencies array to be: [${$e.map(Ze).join(", ")}]`,fix(T){return T.replaceText(x,`[${$e.map(Ze).join(", ")}]`)}}]})}function h(c){let x=wr(c.callee,i);if(x===-1)return;let b=c.arguments[x],g=c.callee,w=an(g).name,S=c.arguments[x+1],I=/Effect($|[^a-z])/g.test(w);if(!b){s({node:g,message:`React Hook ${w} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!I)){if(!S&&!I){(w==="useMemo"||w==="useCallback")&&s({node:g,message:`React Hook ${w} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,w,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let A=t(c).set.get(b.name);if(A==null||A.defs==null)return;let R=A.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,w,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,w,I);return}break}break;default:s({node:g,message:`React Hook ${w} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${w} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(A){return A.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let c of e.sourceCode.getAllComments())if(Ir.test(c.value))return n=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:c=>h(c)}}};function rt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let c=s(a,h);c.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let h=s(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=s(a,E);h.isSatisfiedRecursively=!0});function s(E,h){let c=h.split("."),x=E;for(let b of c){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,c){let x=h.split("."),b=E;for(let g of x){let w=b.children.get(g);if(!w)return;c(w),b=w}}let p=new Set,u=new Set;m(a,p,u,E=>E);function m(E,h,c,x){E.children.forEach((b,g)=>{let w=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&c.add(w);return}if(b.isUsed){h.add(w);return}m(b,h,c,S=>w+"."+S)})}let f=[],d=new Set,y=new Set;return n.forEach(({key:E})=>{u.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function be(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 be(e.consequent)!=null||be(e.alternate)!=null?"conditional":null;case"LogicalExpression":return be(e.left)!=null||be(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return be(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return be(e.expression);case"TSAsExpression":return be(e.expression)}return null}function Rr({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=be(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!ln(n,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function on(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)?on(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function it(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Se(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Se(e.object,n),t=Se(e.property,null),o=`${r}.${t}`;return it(e,n,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Se(e.object,n),t=Se(e.property,null),o=`${r}.${t}`;return it(e,n,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Se(r.object,n),o=Se(r.property,null),a=`${t}.${o}`;return it(r,n,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function an(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function wr(e,n){let r=an(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Se(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return n.additionalHooks.test(t)?0:-1}else return-1}}function st(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),vr(t,n))return t;if(ln(t,n))for(let[o,a]of Object.entries(t))o!=="parent"&&(rn(a)?(a.parent=t,r.push(a)):Array.isArray(a)&&a.forEach(i=>{rn(i)&&(i.parent=t,r.push(i))}))}return null}function Ar(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function rn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function vr(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function ln(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function kr(e){return!1}import{AST_NODE_TYPES as ze,ESLintUtils as cn}from"@typescript-eslint/utils";import ie from"typescript";import{z as Pr}from"zod/v4";var Fr=cn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="improved-no-unnecessary-condition",Or=Pr.object({}),Nr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Dr=new Set(Nr),ot={name:pn,rule:Fr({name:pn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".'},schema:[_(Or)]},defaultOptions:[{}],create(e){let n=cn.getParserServices(e,!0),r=n.program?.getTypeChecker();if(!r||!n.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===ze.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&ie.TypeFlags.Any||s.flags&ie.TypeFlags.Unknown?null:s.flags&ie.TypeFlags.StringLike?["string"]:s.flags&ie.TypeFlags.NumberLike?["number"]:s.flags&ie.TypeFlags.BigIntLike?["bigint"]:s.flags&ie.TypeFlags.BooleanLike?["boolean"]:s.flags&ie.TypeFlags.ESSymbolLike?["symbol"]:s.flags&ie.TypeFlags.Undefined||s.flags&ie.TypeFlags.Void?["undefined"]:s.flags&ie.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&ie.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&ie.TypeFlags.NonPrimitive?["object"]:s.flags&ie.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=n.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&ie.TypeFlags.Any||p.flags&ie.TypeFlags.Unknown)return null;let u=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)u.push(...d);else return null}return u}let m=o(p);return m?(u.push(...m),u):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,u=null;if(t(s.left)?(p=s.left,u=s.right.type===ze.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(p=s.right,u=s.left.type===ze.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!u||!Mr(u,Dr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(u);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:u}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ke(p,e),actualType:Ue(m),conditionType:u}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ke(p,e),type:Ue(m)}})}return{BinaryExpression:i}}})};function Ue(e){return Array.from(new Set(e)).join(" | ")||"never"}function ke(e,n){let r=e.argument;return r.type===ze.Identifier?r.name:n.sourceCode.getText(r)}function Mr(e,n){return n.has(e)}import{AST_NODE_TYPES as jr,ESLintUtils as Lr}from"@typescript-eslint/utils";import{z as at}from"zod/v4";var _r=Lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="no-call-with-explicit-generics",$r=at.object({functions:at.array(at.string())}),Ur=_r({name:un,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[_($r)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:o}=t;o.type===jr.Identifier&&r.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),lt={name:un,rule:Ur};import{AST_NODE_TYPES as We,ESLintUtils as zr}from"@typescript-eslint/utils";var Wr=zr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fn="no-call-with-inferred-generics",Vr=Wr({name:fn,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,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==We.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=n.disallowTypes}=a;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&t.typeArguments?.params.some(u=>!s&&u.type===We.TSAnyKeyword||l&&u.type===We.TSTypeReference&&u.typeName.type===We.Identifier&&l.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),pt={name:fn,rule:Vr};import{ESLintUtils as Hr}from"@typescript-eslint/utils";var Jr=Hr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-commented-out-code",Yr=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Br=/^\s*return\s+/,qr=/\w=("|'|`)/,Xr=/\w+:\s*('|"|`)/,Gr=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Zr=/\w+-\w+:/,Kr=/\w+_\w+:/,Qr=/\?\s+\w/,ei=/:\s+\w/,ti=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ni=/^\s*\d+[,}]/,ri=/^\s*\[[^\]]*\][,}]/,ii=/^\s*\{[^}]*\}[,}]/,si=/\.\w+\(/,oi=/\[\w+\]/,ai=/^\s*(['"`]).+?\1\s*:/,li=/^<[A-Z]\w*(\s|>|\/)/,pi=/^<[a-z]+(\s|>|\/)/,ci=/<[A-Z]\w*(\s.*)?>/,ui=/<\/[A-Z]\w*>/,fi=/<[a-z]+(\s.*)?>/,mi=/<\/[a-z]+>/,di=/^\s*[*\s]*$/,yi=/^[a-zA-Z]/,gi=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Si=/```[\s\S]*?```/g,Ti=/`[^`]*`/g,mn=/[a-zA-Z0-9]/,hi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Ei=/[{}[\]()`=<>]/,xi=/:\s*(['"`[{(]|\w+\s*=>)/,bi=/\bif\s*\(|\belse\b|=>/,q={returnStatement:Br,stringAssignment:qr,objectPropertyWithQuotes:Xr,computedPropertyAssignment:Gr,kebabCaseProperty:Zr,snakeCaseProperty:Kr,ternaryOperator:Qr,colonWithWord:ei,quotedString:ti,numberWithComma:ni,arrayWithComma:ri,objectWithComma:ii,methodCall:si,arrayAccess:oi,quotedPropertyKey:ai,jsxSelfClosing:li,jsxElement:pi,jsxOpeningTag:ci,jsxClosingTag:ui,htmlOpeningTag:fi,htmlClosingTag:mi,jsdocComment:di};function Ci(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&yi.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||hi.test(n)||Ei.test(n)||xi.test(n)||bi.test(n)?!1:!!(n.includes(":")&&gi.test(n))}var Ii=[") {","return;",q.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",q.stringAssignment,");",q.objectPropertyWithQuotes,q.computedPropertyAssignment,q.kebabCaseProperty,q.snakeCaseProperty,"&&","||","()",q.ternaryOperator,q.colonWithWord,q.quotedString,q.numberWithComma,q.arrayWithComma,q.objectWithComma,q.methodCall,q.arrayAccess,"?.(","??","=>",q.quotedPropertyKey],Ri=["/>","</",q.jsxSelfClosing,q.jsxElement,q.jsxOpeningTag,q.jsxClosingTag,q.htmlOpeningTag,q.htmlClosingTag],dn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],wi=Jr({name:yn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,o){if(t.startsWith("/"))return!1;let a=t.trimStart();if(t.startsWith("*")||a.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||q.jsdocComment.test(t))return!1;for(let i of dn)if(a.startsWith(i))return!1;if(t.includes("https://")||Ci(a))return!1;if(o==="Block"){for(let i of Ri)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Yr)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ii)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,o){let a=t,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Si);p.some(m=>mn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(Ti);return s.some(p=>mn.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=n(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:dn.join(", ")}})}}}}}),ct={name:yn,rule:wi};import{ESLintUtils as Ai,TSESTree as vi}from"@typescript-eslint/utils";var ki=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gn="no-default-export",Pi=ki({name:gn,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(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===vi.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),ut={name:gn,rule:Pi};import{ESLintUtils as Fi}from"@typescript-eslint/utils";var Oi=Fi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-leaked-text-in-jsx",Ni=[",",";","[","]","(",")"],Di=Oi({name:Sn,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";Ni.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),ft={name:Sn,rule:Di};import{AST_NODE_TYPES as Ne,ESLintUtils as Mi}from"@typescript-eslint/utils";var ji=Mi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-non-camel-case-functions",Li=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Tn(e){if(e.typeName.type!==Ne.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Ne.Identifier&&n.name==="JSX"&&r.name==="Element"}var _i=ji({name:hn,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(n){if(n.id&&!Li.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Ne.TSTypeReference?Tn(r):r.type===Ne.TSUnionType&&r.types.some(o=>o.type===Ne.TSTypeReference&&Tn(o))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),mt={name:hn,rule:_i};import{ESLintUtils as $i,TSESTree as V}from"@typescript-eslint/utils";import{AST_NODE_TYPES as En}from"@typescript-eslint/utils";function Pe(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:Pe(e.parent,n,r===1/0?r:r-1)}function*dt(e){yield e,e.parent&&(yield*dt(e.parent))}function yt(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function xn(e,n,r){let o=r.getDeclaredVariables(e).find(a=>a.name===n||a.identifiers[0]?.parent.type===En.Property&&a.identifiers[0].parent.key.type===En.Identifier&&a.identifiers[0].parent.key.name===n);return o?o.references.filter(a=>!a.init):[]}var Ui=$i.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-optional-root-props",zi=Ui({name:bn,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let a=e.sourceCode.getDeclaredVariables(t)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of dt(i.identifier)){if("returnType"in s||s.type===V.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===V.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=Pe(l.parent.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Ve(u,e.sourceCode);return m?!(m.parent.type===V.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===V.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.AST_NODE_TYPES.ArrowFunctionExpression){let p=Pe(l,V.AST_NODE_TYPES.VariableDeclaration);return p?!!Ve(p,e.sourceCode):!1}if(l.type===V.AST_NODE_TYPES.FunctionDeclaration)return!!Ve(l,e.sourceCode)}return!1}function r(t){t.key.type!==V.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Pe(t,V.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral&&!(He(t)||!n(t)))for(let o of t.typeAnnotation.members)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(t){if(!(He(t)||!n(t)))for(let o of t.body.body)o.type===V.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(t){if(t.typeName.type!==V.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==V.AST_NODE_TYPES.TSTypeLiteral)return;let a=Pe(t.parent,V.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=Ve(a,e.sourceCode);if(!(!i||i.parent.type===V.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===V.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function He(e){return e?e.parent?.type===V.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ve(e,n){if(He(e))return;let r;if(e.type===V.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===V.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!He(a[0].identifier.parent.parent))return a[0].identifier}var gt={name:bn,rule:zi};import{AST_NODE_TYPES as Je}from"@typescript-eslint/utils";var De=W({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===Je.Identifier?n.has(t.name):t.type===Je.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let o of t.specifiers)n.add(o.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===Je.VariableDeclaration)for(let o of t.declaration.declarations)r(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===Je.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as Wi}from"@typescript-eslint/utils";import St from"path";import{z as Ce}from"zod/v4";var Vi=Wi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="no-relative-imports",Hi=Ce.object({find:Ce.string(),replacement:Ce.string()}),Ji=Ce.object({aliases:Ce.array(Hi),rootDir:Ce.string().optional(),allowNotFoundAliases:Ce.boolean().optional(),_dev_simulateFileName:Ce.string().optional()}),Yi=Vi({name:Cn,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[_(Ji)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=St.dirname(s);return St.resolve(l,i)}function a(i){let s=n.rootDir??process.cwd(),l=St.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of n.aliases)if(l.startsWith(u)){let m=l.replace(u,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!t(s))return;let l=o(s,r),p=a(l);!p&&n.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Tt={name:Cn,rule:Yi};import{AST_NODE_TYPES as G}from"@typescript-eslint/utils";import{z as In}from"zod/v4";var Bi=In.object({customMessage:In.string().optional()}),ht=W({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[_(Bi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case G.Literal:return!0;case G.ObjectExpression:return t.properties.every(o=>o.type===G.Property?o.computed||o.value.type===G.Identifier&&o.key.type===G.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case G.ArrayExpression:return t.elements.every(o=>o?o.type===G.SpreadElement?!1:r(o):!0);case G.TemplateLiteral:return t.expressions.length===0;case G.ConditionalExpression:case G.LogicalExpression:case G.BinaryExpression:case G.UnaryExpression:case G.CallExpression:case G.MemberExpression:case G.Identifier:case G.ArrowFunctionExpression:case G.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===G.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===G.JSXExpressionContainer?t.value.expression.type!==G.JSXEmptyExpression&&(o=t.value.expression):t.value.type===G.Literal&&(o=t.value),o&&r(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as Ye}from"@typescript-eslint/utils";import*as we from"zod/v4";var qi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function Xi(e){return e.typeAnnotation.type!==Ye.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Gi=/(typeGuards|type-guards)\.(ts|tsx)$/;function Zi(e){return Gi.test(e)}function Ki(e){let n=e.parent;for(;n;){if(n.type===Ye.CallExpression&&n.callee.type===Ye.MemberExpression&&n.callee.property.type===Ye.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Et=W({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[_(qi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Zi(r))return{};function t(o){if(!Xi(o))return;let a=Ki(o);if(n.alternativeMsgs&&a){let i=a.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});import{AST_NODE_TYPES as Fe}from"@typescript-eslint/utils";var Qi="no-unnecessary-async-on-jsx-props";function es(e){if(e.body.type!==Fe.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Fe.ExpressionStatement?!1:r.expression.type===Fe.AwaitExpression}var xt=W({name:Qi,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){es(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(t.replaceTextRange([i.range[0],l.range[0]],"")):a.push(t.remove(i))}function s(l){if(l.type===Fe.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?a.push(t.replaceTextRange([p.range[0],u.range[0]],"")):a.push(t.remove(p))}}if(l.type===Fe.BlockStatement)for(let p of l.body)s(p);else l.type===Fe.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});import{AST_NODE_TYPES as Me,ESLintUtils as wn}from"@typescript-eslint/utils";import*as bt from"typescript";import je from"zod/v4";var ts=wn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-unnecessary-casting",ns=je.object({additionalCastFunctions:je.array(je.object({name:je.string(),expectedType:je.enum(["string","number"])})).optional()}),Ct={name:Rn,rule:ts({name:Rn,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[_(ns)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=wn.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case Me.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case Me.TemplateLiteral:return m==="string";case Me.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,m){return m==="number"?!!(u.flags&bt.TypeFlags.NumberLike):!!(u.flags&bt.TypeFlags.StringLike)}function l(u,m){return f=>f.replaceText(u,e.sourceCode.getText(m))}function p(u){if(!a||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===Me.SpreadElement)return;let{callee:f}=u;if(f.type!==Me.Identifier)return;let d=f.name,y=t.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,c;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",c={name:y.name,type:y.expectedType}),e.report({node:u,messageId:h,...c?{data:c}:{},fix:l(u,m)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Be}from"@typescript-eslint/utils";import*as de from"zod/v4";var rs=de.object({methods:de.union([de.array(de.string()),de.literal("array")])}),It=W({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[_(rs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):t.has(s)}function a(s){let{callee:l}=s;if(l.type===Be.MemberExpression){let p=l.property;if(p.type===Be.Identifier)return p.name}return null}function i(s,l){if(s.type!==Be.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Be.CallExpression){let u=a(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return s.typeAnnotation?f.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var Rt=W({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===ae.ObjectPattern||!n.init||n.init.type!==ae.ObjectExpression||n.id.type===ae.Identifier&&n.id.typeAnnotation||n.parent.parent.type===ae.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==ae.Identifier)return;let t=is(n,e.sourceCode);if(t.length===0)return;let o=n.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),a=new Set;for(let i of t){if(i.identifier.parent.type!==ae.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===ae.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==ae.Identifier)return;a.add(s.property.name)}if(s.parent.type===ae.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function is(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as Y,ESLintUtils as ss}from"@typescript-eslint/utils";import{z as Ae}from"zod/v4";var os=Ae.object({selectors:Ae.array(Ae.object({name:Ae.string(),selectorProp:Ae.string().optional(),selectorArgPos:Ae.number().optional(),returnProp:Ae.string().optional()}))}),as=ss.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),An="no-unused-selected-values",wt={name:An,rule:as({name:An,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[_(os)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===Y.CallExpression&&(a=o.init),!a)return;let i=ps(a);if(!i)return;let s=t.get(i);if(!s)return;let l=ls(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=cs(l);if(!p)return;let u=vn(p.properties,void 0);if(!u)return;if(o.id.type===Y.ObjectPattern){let d=vn(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of u)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==Y.Identifier||s.returnProp)return;let m=us(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==Y.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==Y.Identifier)return;f.add(y.name)}for(let[d,y]of u)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function ls(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===Y.ArrowFunctionExpression||t.type===Y.FunctionExpression)return t;if(r&&t.type===Y.ObjectExpression){let o=t.properties.find(i=>i.type===Y.Property&&i.key.type===Y.Identifier&&i.key.name===r);if(o?.type!==Y.Property)return null;let a=o.value;if(a.type===Y.ArrowFunctionExpression||a.type===Y.FunctionExpression)return a}return null}function ps(e){return e.callee.type===Y.Identifier?e.callee.name:e.callee.type===Y.MemberExpression&&e.callee.property.type===Y.Identifier?e.callee.property.name:null}function cs(e){if(e.body.type===Y.ObjectExpression)return e.body;if(e.body.type===Y.BlockStatement){let n=e.body.body.filter(r=>r.type===Y.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==Y.ObjectExpression?null:n[0].argument}return null}function vn(e,n){let r=e;if(n){let o=e.find(a=>a.type===Y.Property&&a.key.type===Y.Identifier&&a.key.name===n);if(o?.type!==Y.Property||o.value.type!==Y.ObjectPattern)return null;r=o.value.properties}let t=new Map;for(let o of r){if(o.type!==Y.Property||o.key.type!==Y.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function us(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as H}from"@typescript-eslint/utils";var At=W({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===H.ImportDeclaration&&a.source.value==="t-state-form"))return{};let t=null,o=!1;return{CallExpression(a){if(o)return;if(!t){let s=fs(a);s&&(t=s);return}let i=ms(a,e.sourceCode);if(i){o=!0;for(let s of i)t.delete(s);if(t.size!==0)for(let[s,l]of t)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function fs(e){if(!(e.callee.type===H.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==H.ObjectExpression)return null;let t=yt(r.properties,a=>a.type!==H.Property||a.key.type!==H.Identifier||a.key.name!=="initialConfig"?null:a.value.type===H.ObjectExpression?a.value:a.value.type===H.ArrowFunctionExpression||a.value.type===H.FunctionExpression?ds(a.value):null);if(!t)return null;let o=new Map;for(let a of t.properties)a.type===H.Property&&a.key.type===H.Identifier&&o.set(a.key.name,a);return o}function ms(e,n){if(!(e.callee.type===H.Identifier&&e.callee.name==="useFormState")||e.parent.type!==H.VariableDeclarator||e.parent.id.type!==H.ObjectPattern||!yt(e.parent.id.properties,i=>i.type===H.Property&&i.key.type===H.Identifier&&i.key.name==="formFields"&&i))return null;let o=xn(e.parent,"formFields",n),a=new Set;for(let{identifier:i}of o){if(i.type!==H.Identifier||i.parent.type===H.Property&&i.parent.parent.type===H.ObjectExpression&&i.parent.parent.parent.type===H.ReturnStatement||i.parent.type===H.ReturnStatement)return null;if(i.parent.type===H.MemberExpression){if(i.parent.object.type!==H.Identifier||i.parent.property.type!==H.Identifier)return null;a.add(i.parent.property.name)}}return a}function ds(e){if(e.body.type===H.ObjectExpression)return e.body;if(e.body.type===H.BlockStatement){let n=e.body.body.filter(r=>r.type===H.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==H.ObjectExpression?null:n[0].argument}return null}import{AST_NODE_TYPES as U,ESLintUtils as ys}from"@typescript-eslint/utils";import{z as qe}from"zod/v4";var gs=ys.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function kn(e){let n=[];for(let r of e.members)r.type===U.TSPropertySignature&&r.key.type===U.Identifier&&n.push([r.key.name,r]);return n}function Pn(e,...n){for(let r of n)e.set(...r);return e}var Ss=qe.object({forceCheckOnFCPropTypesWithName:qe.array(qe.string()).optional(),alwaysCheckFunctionOptionTypes:qe.boolean().optional()}),Fn="no-unused-type-props-in-args",vt=null,Ts=gs({name:Fn,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:[_(Ss)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!vt&&(vt=r.map(l=>new RegExp(l)));function o(l,p,u,m,f=!0,d=!1){let y=u.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&vt?.some(g=>g.test(y)),c=d&&t;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===U.ExportNamedDeclaration;if(!(f&&b&&!c)){if(x.type===U.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===U.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,u,m,f,d=!1){if(m.type===U.TSInterfaceBody){for(let y of m.body)y.type===U.TSPropertySignature&&y.key.type===U.Identifier&&u.set(y.key.name,y);return}if(m.type===U.TSTypeLiteral){Pn(u,...kn(m));return}if(m.type===U.TSIntersectionType){for(let y of m.types)a(l,p,u,y,!0,d);return}f||m.type===U.TSTypeReference&&m.typeName.type===U.Identifier&&o(l,p,m.typeName,u,!0,d)}function i(l,p,u,m=!1){for(let f of u)if(f.type===U.ObjectPattern&&f.typeAnnotation){let d=new Map;if(a(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;s(f,d)}else f.type===U.AssignmentPattern&&f.left.type===U.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let u=[];if(l.properties.at(-1)?.type===U.RestElement)return;for(let y of l.properties)y.type===U.Property&&y.key.type===U.Identifier&&u.push(y.key.name);let f=[],d=[];for(let[y,E]of p)u.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let c=l.properties.at(-1),x=d.join(", ");return c?c.type===U.RestElement?null:h.insertTextAfter(c,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,m=p.id.type===U.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===U.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===U.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===U.TSTypeReference&&m.typeName.type===U.Identifier)o(!0,l,m.typeName,u,!1);else if(m.type===U.TSTypeLiteral)Pn(u,...kn(m));else if(m.type===U.TSIntersectionType)for(let f of m.types)f.type===U.TSTypeReference&&f.typeName.type===U.Identifier?o(!0,l,f.typeName,u,!1):a(!0,l,u,f,!0);if(u.size!==0&&p.init?.type===U.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===U.ObjectPattern&&s(f,u)}}},FunctionDeclaration(l){i(!1,l,l.params,t)},ArrowFunctionExpression(l){i(!1,l,l.params,t)}}}}),kt={name:Fn,rule:Ts};import{AST_NODE_TYPES as fe}from"@typescript-eslint/utils";var Pt=W({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===fe.Identifier?n.has(t.callee.name):t.callee.type===fe.MemberExpression&&t.callee.object.type===fe.Identifier&&t.callee.property.type===fe.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let o of t.specifiers)o.type===fe.ImportSpecifier&&o.imported.type===fe.Identifier&&o.imported.name==="useRef"&&n.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===fe.CallExpression&&r(t.init)&&t.id.type===fe.Identifier){let a=e.sourceCode.getScope(t).set.get(t.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==t&&!(p.type===fe.JSXExpressionContainer&&p.parent.type===fe.JSXAttribute&&p.parent.name.type===fe.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});import{AST_NODE_TYPES as Ft,ESLintUtils as hs}from"@typescript-eslint/utils";var Es=hs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="prefer-named-functions",On=new Map,xs=Es({name:Nn,meta:{hasSuggestions:!0,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:{suggestion:"Convert to named function",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,[n]){let r=null;if(n.ignoreRegex){let t=On.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),On.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===Ft.ArrowFunctionExpression&&t.id.type===Ft.Identifier){let o=t.id.name;if(t.id.typeAnnotation||r&&r.test(o)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Ft.BlockStatement)return;let a=t.parent,i=t.init.params,s=t.init.body,l=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ot={name:Nn,rule:xs};import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as Te}from"zod/v4";var bs=Te.object({disallowedFunctions:Te.array(Te.object({name:Te.string(),allowUsingWithArgs:Te.boolean().optional(),hookAlternative:Te.string().optional(),message:Te.string().optional(),allowUseInside:Te.array(Te.string()).optional()}))}),Cs=/^use[A-Z]/,Is=/^[A-Z]/;function Xe(e){return Cs.test(e)}function Dn(e){return Is.test(e)}function Rs(e){return e.type===M.Identifier?Xe(e.name):e.type===M.MemberExpression&&e.property.type===M.Identifier?Xe(e.property.name):!1}function Mn(e,n){return e.type===M.Identifier?e.name===n:e.type===M.MemberExpression&&e.object.type===M.Identifier&&e.property.type===M.Identifier?e.object.name==="React"&&e.property.name===n:!1}function jn(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Mn(e.parent.callee,"forwardRef"))}function Ln(e){return!!(e.parent&&e.parent.type===M.CallExpression&&Mn(e.parent.callee,"memo"))}function Nt(e){if(e.type===M.FunctionDeclaration||e.type===M.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.FunctionExpression||e.type===M.ArrowFunctionExpression){if(e.parent.type===M.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ws(e){let n=e.parent,r=!1;for(;n;){if(n.type===M.FunctionDeclaration||n.type===M.FunctionExpression||n.type===M.ArrowFunctionExpression){let t=Nt(n);if(t&&t.type===M.Identifier){if(Dn(t.name)||Xe(t.name))return!r;r=!0}else{if(jn(n)||Ln(n))return!r;if(n.parent.type===M.CallExpression){let o=n.parent;Rs(o.callee)||(r=!0)}else n.parent.type===M.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function _n(e){return e.callee.type===M.Identifier?e.callee.name:e.callee.type===M.MemberExpression&&e.callee.property.type===M.Identifier?e.callee.property.name:null}function As(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===M.FunctionDeclaration||r.type===M.FunctionExpression||r.type===M.ArrowFunctionExpression){let t=Nt(r);if(t&&t.type===M.Identifier&&n.includes(t.name))return!0}else if(r.type===M.CallExpression){let t=_n(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function vs(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===M.Identifier&&n.name==="undefined")}function ks(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===M.FunctionDeclaration||t.type===M.FunctionExpression||t.type===M.ArrowFunctionExpression){let o=Nt(t);if(o&&o.type===M.Identifier){if(Dn(o.name)||Xe(o.name)){r=!0;break}}else if(jn(t)||Ln(t)){r=!0;break}}t=t.parent}return r?n.length===0?ws(e):!As(e,n):!1}var Dt=W({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[_(bs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=_n(o);if(!a)return;let i=t.get(a);if(!i||i.allowUsingWithArgs&&vs(o))return;let s=i.allowUseInside||[];ks(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===M.Identifier?l.replaceText(o.callee,p):o.callee.type===M.MemberExpression&&o.callee.property.type===M.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as Z,AST_TOKEN_TYPES as $n,ESLintUtils as Ps}from"@typescript-eslint/utils";import Mt from"zod/v4";var Fs=Ps.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="prefer-single-line-if",Os=Mt.object({maxLineLength:Mt.number().optional(),maxNonSimpleConditionLength:Mt.number().optional()}),Ns=Fs({name:zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[_(Os)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==Z.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let a=t.consequent.body[0];if(!a)return;if(a.type===Z.ReturnStatement){if(!Vn(a))return}else if(!(a.type===Z.ContinueStatement||a.type===Z.BreakStatement))return;if(t.test.type===Z.LogicalExpression||t.test.type===Z.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=Un(t.test);if(!m&&t.test.type===Z.UnaryExpression&&t.test.operator==="!"){let f=t.test.argument;Un(f)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let s=r.getText(a);if(i.includes(`
16
16
  `))return;let l=r.getTokenAfter(t);if(l&&l.type===$n.Punctuator&&l.value==="}"){let m=r.getTokenAfter(l);if(m&&m.type===$n.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Ds(r,t),u=`if (${i}) ${s}`;n.maxLineLength&&u.length+p.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,u)})}}}});function Un(e){return e.type===Z.CallExpression||e.type===Z.BinaryExpression||e.type===Z.MemberExpression&&Wn(e)}function Wn(e){return e.object.type===Z.MemberExpression?Wn(e.object):e.object.type!==Z.Identifier}function Ds(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}function Vn(e){if(!e.argument)return!0;let n=e.argument;return n.type===Z.ArrayExpression&&n.elements.length===0||n.type===Z.ObjectExpression&&n.properties.length===0||n.type===Z.Literal||n.type===Z.Identifier||n.type===Z.TemplateLiteral||n.type===Z.TaggedTemplateExpression?!0:n.type===Z.CallExpression?n.arguments.length===0:n.type===Z.UnaryExpression?Vn(n):!1}var jt={name:zn,rule:Ns};import{AST_NODE_TYPES as ce,ESLintUtils as Ms}from"@typescript-eslint/utils";import{z as ye}from"zod/v4";var js=Ms.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hn="react-compiler-migration",Ls=ye.object({disallowHooks:ye.array(ye.object({name:ye.string(),replacement:ye.string()})).optional(),disallowMethods:ye.array(ye.object({name:ye.string(),replacement:ye.string().optional(),requireTrueProp:ye.string().optional()})).optional()}),_s=/eslint +react-compiler\/react-compiler: +\["error/;function $s(e){return e.type===ce.Identifier?e.name.startsWith("use"):e.type===ce.MemberExpression&&e.property.type===ce.Identifier?e.property.name.startsWith("use"):!1}var Us=js({name:Hn,meta:{type:"suggestion",fixable:"code",docs:{description:"Rules to help migrate to the new React compiler"},messages:{disallowedFunctionOrMethod:"{{functionOrMethod}} is not supported in react compiler. Use {{replacement}} instead.",replace:"Replace with safe alternative {{replacement}}",disallowedMethodWithMissingRequireTrueProp:"{{method}} is should have a prop named {{requireTrueProp}} set to true when used in react compiler."},hasSuggestions:!0,schema:[_(Ls)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[n]){let r=!1;for(let t of e.sourceCode.getAllComments())if(_s.test(t.value)){r=!0;break}return r?{CallExpression(t){if(n.disallowHooks?.length){let o=null,a=null;if(t.callee.type===ce.Identifier?(o=t.callee.name,a=t.callee):t.callee.type===ce.MemberExpression&&t.callee.property.type===ce.Identifier&&(o=t.callee.property.name,a=t.callee.property),o){let i=n.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(n.disallowMethods?.length&&$s(t.callee)){for(let o of t.arguments)if(o.type===ce.ObjectExpression){for(let a of o.properties)if(a.type===ce.Property&&a.key.type===ce.Identifier){let i=a.key.name,s=n.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let u of o.properties)if(u.type===ce.Property&&u.key.type===ce.Identifier&&u.key.name===l&&u.value.type===ce.Literal&&u.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>s.replacement?l.replaceText(a.key,s.replacement):null}]})}}}}}}:{}}}),Lt={name:Hn,rule:Us};import{ESLintUtils as zs,TSESTree as Ws}from"@typescript-eslint/utils";var Vs=zs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jn="require-description",Hs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Js=/^eslint-disable-(next-)?line$/u,Ys=Vs({name:Jn,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,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Bs(o);a!=null&&(t.has(a.kind)||a.description||e.report({loc:Gs(o.loc),messageId:"missingDescription"}))}}}}}),Yn={name:Jn,rule:Ys};function Bs(e){let{text:n,description:r}=Xs(e.value);if(!n)return null;let t=Hs.exec(n);if(!t)return null;let o=t[1];if(!o)return null;let a=Js.test(o);if(e.type===Ws.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+o.length);return{kind:o,value:i.trim(),description:r}}var qs=/\s-{2,}\s/u;function Xs(e){let n=e.split(qs);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function Gs(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as $}from"@typescript-eslint/utils";import{z as he}from"zod/v4";var Zs=he.object({varsToCheck:he.array(he.object({selector:he.string().optional(),fromFnCall:he.string().optional(),prop:he.string().or(he.array(he.string())),errorMsg:he.string().optional()}))}),_t=W({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[_(Zs)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,s,l,p){let u=new Set;for(let f of i.properties)f.type===$.Property&&f.key.type===$.Identifier&&u.add(f.key.name);let m=s.filter(f=>!u.has(f));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:l||""}});else{let f=m.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:f,fnName:p,customMsg:l||""}})}}function o(i){if(i.init?.type===$.CallExpression){if(i.init.callee.type===$.Identifier)return i.init.callee.name;if(i.init.callee.type===$.MemberExpression&&i.init.callee.property.type===$.Identifier)return i.init.callee.object.type===$.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let a={};for(let i of n.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===$.VariableDeclarator&&s.id.type===$.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===$.VariableDeclarator&&s.id.type===$.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];t(s.id,l,i.errorMsg,o(s))}});for(let i of n.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=u=>{if(u.type!==$.MemberExpression||u.parent.type!==$.CallExpression)return;let m=u.parent;if(m.parent.type!==$.VariableDeclarator)return;let f=m.parent;if(f.id.type===$.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===$.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];t(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[u]=m=>{if(m.type!==$.MemberExpression||m.parent.type!==$.CallExpression)return;let f=m.parent;if(f.parent.type!==$.VariableDeclarator)return;let d=f.parent;if(d.id.type===$.Identifier)r.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===$.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==$.Identifier||p.parent.type!==$.CallExpression)return;let u=p.parent;if(u.parent.type!==$.VariableDeclarator)return;let m=u.parent;if(m.id.type===$.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===$.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:u}]of r){let f=e.sourceCode.getScope(p).set.get(i);if(f){let d=new Set(s);for(let y of f.references){let E=y.identifier,h=E.parent;if(!(h.type===$.VariableDeclarator&&h.id===E)){if(h.type===$.MemberExpression&&h.object===E&&h.property.type===$.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===$.VariableDeclarator&&h.init===E&&h.id.type===$.ObjectPattern){for(let c of h.id.properties)c.type===$.Property&&c.key.type===$.Identifier&&d.has(c.key.name)&&d.delete(c.key.name);if(d.size===0)break;continue}if(!(h.type===$.MemberExpression&&h.object===E&&h.property.type===$.Identifier&&!s.includes(h.property.name))){d.clear();break}}}if(d.size>0){let y=Array.from(d);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:u,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:l||""}})}}}}}}}});function Xn(e){return/^use[A-Z0-9]/.test(e)}function Ge(e){return e.type==="Identifier"?Xn(e.name):e.type==="MemberExpression"&&!e.computed&&Ge(e.property)?e.object.type==="Identifier":!1}function Gn(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Zn(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function Kn(e){return!!(e.parent&&e.parent.callee&&Zn(e.parent.callee,"forwardRef"))}function Qn(e){return!!(e.parent&&e.parent.callee&&Zn(e.parent.callee,"memo"))}function $t(e){for(;e;){let n=tr(e);if(n&&(Gn(n)||Ge(n))||Kn(e)||Qn(e))return!0;e=e.parent}return!1}function Bn(e){return!1}function Ut(e){return!1}var Ks=/eslint +react-compiler\/react-compiler: +\["error/,er={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 l of e.sourceCode.getAllComments())if(Ks.test(l.value))return{CallExpression(p){let u=null;p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}}let n=typeof e.getSource=="function"?l=>n(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),t=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let u=p.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&Bn(u.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let u=o.pop();if(u.size===0)return;let m=new Set;function f(g,w){let{cache:S}=f,I=S.get(g.id),A=new Set(w);if(A.has(g.id)){let R=[...A],N=R.slice(R.indexOf(g.id)+1);for(let L of N)m.add(L);return BigInt("0")}if(A.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.prevSegments)I+=f(R,A)}return g.reachable&&I===BigInt("0")?S.delete(g.id):S.set(g.id,I),I}function d(g,w){let{cache:S}=d,I=S.get(g.id),A=new Set(w);if(A.has(g.id)){let R=Array.from(A),N=R.slice(R.indexOf(g.id)+1);for(let L of N)m.add(L);return BigInt("0")}if(A.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.nextSegments)I+=d(R,A)}return S.set(g.id,I),I}function y(g){let{cache:w}=y,S=w.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(w.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let I of g.prevSegments){let A=y(I);A<S&&(S=A)}S+=1}return w.set(g.id,S),S}f.cache=new Map,d.cache=new Map,y.cache=new Map;let E=d(l.initialSegment),h=tr(p),c=$t(p),x=h?Gn(h)||Ge(h):Kn(p)||Qn(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let w=y(g);w<b&&(b=w)}for(let[g,w]of u){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=y(g):b<y(g),I=f(g)*d(g),A=m.has(g.id);for(let R of w)if(A&&!Ut(R)&&e.report({node:R,message:`React Hook "${n(R)}" 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.`}),x){if(p.async&&e.report({node:R,message:`React Hook "${n(R)}" cannot be called in an async function.`}),!A&&I!==E&&!Ut(R)){let L=`React Hook "${n(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:L})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${n(R)}" 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:R,message:N})}else if(h){let N=`React Hook "${n(R)}" is called in function "${n(h)}" 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:R,message:N})}else if(p.type==="Program"){let N=`React Hook "${n(R)}" 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:R,message:N})}else if(c&&!Ut(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let L=p.parent;if(L.parent.type==="VariableDeclarator"&&Xn(L.parent.id.name))return}let N=`React Hook "${n(R)}" 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:R,message:N})}}},CallExpression(l){if(Ge(l.callee)){let p=qn(o),u=qn(a),m=p.get(u);m||(m=[],p.set(u,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Bn(l.callee))&&l.arguments.length>0&&(t=l)},Identifier(l){t==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${n(l)}\` 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"(l){l===t&&(t=null)},FunctionDeclaration(l){$t(l)&&s(r(l))},ArrowFunctionExpression(l){$t(l)&&s(r(l))}}}};function tr(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 qn(e){return e[e.length-1]}import{AST_NODE_TYPES as te,AST_TOKEN_TYPES as Qs}from"@typescript-eslint/utils";import*as se from"zod/v4";var eo=/^\s+$/,zt=/\r?\n/,to=/^(\s*)/,no=/^(\s*)\S/,ro=/\r?\n/,io=se.object({indent:se.union([se.string().regex(eo),se.number().int().min(1)]).optional(),tags:se.array(se.string()).optional(),functions:se.array(se.string()).optional(),comments:se.array(se.string()).optional()}),Wt=W({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[_(io)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(c=>c.toLowerCase());function s(c){let x=c.split(zt),b=x.filter(w=>w.trim()!=="");if(b.length===0)return c;let g=Number.POSITIVE_INFINITY;for(let w of b){let S=w.match(to);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?c:x.map(w=>w.slice(g)).join(`
17
17
  `)}function l(c,x,b){return c.split(zt).map(w=>w.trim()===""?w:b.repeat(x)+w).join(`
18
18
  `)}function p(c){if(c.type===te.Identifier)return c.name;if(c.type===te.MemberExpression){let x=c.object.type===te.Identifier?c.object.name:null,b=c.property.type===te.Identifier?c.property.name:null;return x&&b?`${x}.${b}`:b}return null}function u(c,x){if(!c)return!1;for(let b of x)if(b.includes(".")){let g=b.split(".");if(c.type===te.MemberExpression&&c.object.type===te.Identifier&&c.property.type===te.Identifier&&c.object.name===g[0]&&c.property.name===g[1])return!0}else if(c.type===te.Identifier&&c.name===b)return!0;return!1}function m(c,x){let b=c.parent;if(b.type!==te.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?x.includes(g):!1}function f(c,x){if(!c||c.type!==te.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:w=!0,optionalMember:S=!0}=x;return g!==void 0&&c.arguments.length!==g||!w&&c.optional||c.callee.type!==te.MemberExpression||!S&&c.callee.optional||c.callee.property.type!==te.Identifier?!1:c.callee.property.name===b}function d(c,x){if(!c||c.type!==te.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:w=!0}=x;return g!==void 0&&c.arguments.length!==g||!w&&c.optional||c.callee.type!==te.Identifier?!1:c.callee.name===b}function y(c){return f(c.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&c.parent.type===te.CallExpression&&c.parent.arguments[0]===c&&d(c.parent.callee.type===te.MemberExpression?c.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(c){if(i.length>0){let x=n.getTokenBefore(c,{includeComments:!0});if(x?.type===Qs.Block&&i.includes(x.value.trim().toLowerCase()))return!0}return!!(y(c)||o.length>0&&m(c,o)||t.length>0&&c.parent.type===te.CallExpression&&c.parent.arguments.includes(c)&&u(c.parent.callee,t))}function h(c){let x=`__PLACEHOLDER__${Math.random()}`,b=c.quasis.map(J=>n.getText(J).slice(1,J.tail?-1:-2)).join(x),g=b.match(ro);if(!g)return;let w=g[0],S=n.lines[n.getLocFromIndex(c.range[0]).line-1];if(!S)return;let A=S.match(no)?.[1]??"",R;typeof a=="string"?R=a:typeof a=="number"?R=" ".repeat(a):R=A.startsWith(" ")?" ":" ";let L=s(b).replace(new RegExp(`^${w}|${w}[ ]*$`,"g"),""),X=w+l(L,1,A+R)+w+A,B=b.includes(`\r
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.61.1",
3
+ "version": "0.61.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"