@ls-stack/extended-lint 0.62.0 → 0.62.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Ir=Object.create;var qe=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var kr=(e,t)=>{for(var r in t)qe(e,r,{get:t[r],enumerable:!0})},sn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ar(t))!vr.call(e,o)&&o!==r&&qe(e,o,{get:()=>t[o],enumerable:!(n=Rr(t,o))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?Ir(wr(e)):{},sn(t||!e||!e.__esModule?qe(r,"default",{value:e,enumerable:!0}):r,e)),Fr=e=>sn(qe({},"__esModule",{value:!0}),e);var mo={};kr(mo,{extendedLintPlugin:()=>fo});module.exports=Fr(mo);var ne=require("@typescript-eslint/utils"),w=require("zod/v4");var on=require("@typescript-eslint/utils"),an=Ee(require("zod/v4"));function J(e){let r=on.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return an.toJSONSchema(e)}var Pr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),pt=J({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(Pr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,m=new Map,f=new Set,d=new Map;function y(S){for(let I of S.specifiers)I.type===ne.AST_NODE_TYPES.ImportSpecifier&&I.imported.type===ne.AST_NODE_TYPES.Identifier&&I.imported.name!==I.local.name&&d.set(I.local.name,I.imported.name)}function E(S){if(S.declaration){if(S.declaration.type===ne.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let I=S.declaration.id.name;for(let v of Array.from(f)){let[R,D]=v.split(":");R===I&&(D==="function"||D==="any")&&f.delete(v)}}else if(S.declaration.type===ne.AST_NODE_TYPES.VariableDeclaration){for(let I of S.declaration.declarations)if(I.id.type===ne.AST_NODE_TYPES.Identifier){let v=I.id.name;for(let R of Array.from(f)){let[D,_]=R.split(":");D===v&&(_==="variable"||_==="any")&&f.delete(R)}}}}for(let I of S.specifiers)if(I.exported.type===ne.AST_NODE_TYPES.Identifier){let v=I.exported.name;for(let R of Array.from(f)){let[D,_]=R.split(":");D===v&&_==="any"&&f.delete(R)}}}function h(S){S.id.type===ne.AST_NODE_TYPES.Identifier&&S.init?.type===ne.AST_NODE_TYPES.Identifier&&d.set(S.id.name,S.init.name)}function u(S){return d.get(S)??S}function x(S,I){return u(S)===I||S===I}for(let{includeRegex:S,mustCallFn:I,mustMatchSelector:v,mustHaveExport:R}of n??[]){let _=function(K){let q=K;for(let{name:ee,value:te}of D??[])q=q.replaceAll(ee,te);return q};var A=_;let D=Or(s,new RegExp(S));if(D){for(let{anyCall:K,message:q}of I??[]){let ee=`Expected file to call the function: ${K.map(({fn:te})=>te).join(" or ")}`;c.add(ee),l.push(te=>{let{callee:X}=te;if(X.type===ne.AST_NODE_TYPES.Identifier){for(let{fn:de,withArgs:Me}of K)if(X.name===de){c.delete(ee);for(let ie of Me){let Ie=te.arguments[ie.atIndex],pe=typeof ie.literal=="string"?_(ie.literal):ie.literal;if(!Ie){e.report({node:te,messageId:"default",data:{message:`Missing argument with value "${pe}" at index ${ie.atIndex}${q?`: ${_(q)}`:""}`}});continue}if(Ie.type!==ne.AST_NODE_TYPES.Literal){e.report({node:Ie,messageId:"default",data:{message:`Argument at position ${ie.atIndex} should the literal "${pe}"${q?`: ${_(q)}`:""}`}});continue}Ie.value!==pe&&e.report({node:Ie,messageId:"default",data:{message:`Argument should have the value "${pe}"${q?`: ${_(q)}`:""}`},fix:Pe=>Pe.replaceText(Ie,typeof pe=="string"?`'${pe}'`:String(pe))})}break}}})}for(let{selector:K,message:q}of v??[])m.set(K,_(q)),p.set(_(K),()=>{m.delete(K)});for(let{name:K,type:q,message:ee}of R??[]){let te=_(K),X=_(ee);f.add(`${te}:${q}:${X}`)}}}for(let{fn:S,withArgs:I,message:v,replaceWith:R,ignoreRegex:D}of i??[])D&&new RegExp(D).test(s)||l.push(_=>{let{callee:K}=_;if(K.type!==ne.AST_NODE_TYPES.Identifier||!x(K.name,S))return;if(I)for(let ee of I){let te=_.arguments[ee.atIndex];if(!te){e.report({node:_,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${v}`}});return}if(te.type!==ne.AST_NODE_TYPES.Literal||te.value!==ee.value)return}let q=ee=>R?ee.replaceText(_,R):null;e.report({node:_,messageId:"default",data:{message:v},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:q}]:void 0})});function b(S,I){let v=r[S];v?r[S]=R=>{v(R),I(R)}:r[S]=I}for(let{selector:S,message:I,replace:v,replaceType:R="suggestion"}of a??[]){if(S==="CallExpression"){l.push(D=>{g(v,D,I,R)});continue}r[S]=D=>{g(v,D,I,R)}}if(p.size>0)for(let[S,I]of p)b(S,I);return l.length>0&&(r.CallExpression=S=>{if(S.type===ne.AST_NODE_TYPES.CallExpression)for(let I of l)I(S)}),r.ImportDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ImportDeclaration&&y(S)},r.ExportNamedDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ExportNamedDeclaration&&E(S)},r.VariableDeclarator=S=>{S.type===ne.AST_NODE_TYPES.VariableDeclarator&&h(S)},r["Program:exit"]=S=>{for(let I of c)e.report({node:S,messageId:"default",data:{message:I}});for(let[,I]of m)e.report({node:S,messageId:"default",data:{message:I}});for(let I of f){let[v,R,D]=I.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${v}" of type ${R}: ${D}`}})}},r;function g(S,I,v,R){let D=_=>{if(!S)return null;if(typeof S=="string")return _.replaceText(I,S);{let K=new RegExp(S.regex),q=e.sourceCode.getText(I);return _.replaceText(I,q.replace(K,S.with))}};e.report({node:I,messageId:"default",data:{message:v},fix:S&&R==="autofix"?D:void 0,suggest:S&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:D}]:void 0})}}});function Or(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:ln(o)}),r.push({name:"$0_uncapitalize",value:pn(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];l!==void 0&&(r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:ln(l)}),r.push({name:`${s}_uncapitalize`,value:pn(l)}),r.push({name:s,value:l}))}return r}function ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var z=require("@typescript-eslint/utils"),Ae=require("zod/v4");var Nr=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="collapse-simple-objs-in-one-line",Dr=Ae.z.object({maxLineLength:Ae.z.number().optional(),maxProperties:Ae.z.number().optional(),nestedObjMaxLineLength:Ae.z.number().optional(),nestedObjMaxProperties:Ae.z.number().optional(),ignoreTypesWithSuffix:Ae.z.array(Ae.z.string()).optional()}),Mr=Nr({name:un,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[$(Dr)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===z.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===z.AST_NODE_TYPES.Property,m=c?i:o,f=p.properties.length;if(f>m)return!1;if(f===1){let y=p.properties[0];return!y||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ObjectExpression||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(h=>h&&ct(h))?!1:{text:r.getText(y),isNested:c,propsSize:f}}let d=[];for(let y of p.properties){if(y.type===z.AST_NODE_TYPES.Property&&!ct(y.value))return!1;d.push(r.getText(y))}return{text:d.join(", "),isNested:c,propsSize:f}}else{let c=p.parent.parent?.type===z.AST_NODE_TYPES.TSPropertySignature,m=c?i:o,f=p.members.length;if(f>m)return!1;if(n.length>0&&p.parent.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(n.some(E=>y.endsWith(E)))return!1}if(f===1){let y=p.members[0];return!y||y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(y),isNested:c,propsSize:1}}if(p.parent.type===z.AST_NODE_TYPES.TSIntersectionType||p.parent.type===z.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let d=[];for(let y of p.members){if(y.type!==z.AST_NODE_TYPES.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===z.AST_NODE_TYPES.TSTypeLiteral||!cn(E))return!1;if(E.type===z.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let u=E.typeArguments.params[0];if(!u||!cn(u))return!1}let h=r.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),d.push(h)}return{text:d.join("; "),isNested:c,propsSize:f}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==z.AST_NODE_TYPES.JSXExpressionContainer){let E=0,h=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==z.AST_TOKEN_TYPES.Punctuator||h?!0:b.value===","?(E++,!1):b.value===";"?(E++,h=!0,!1):b.value===")"||b.value==="}"?(E++,!1):!0});if(E>4)return;let x=u?.type===z.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
1
+ "use strict";var Ir=Object.create;var qe=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var kr=(e,t)=>{for(var r in t)qe(e,r,{get:t[r],enumerable:!0})},sn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ar(t))!vr.call(e,o)&&o!==r&&qe(e,o,{get:()=>t[o],enumerable:!(n=Rr(t,o))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?Ir(wr(e)):{},sn(t||!e||!e.__esModule?qe(r,"default",{value:e,enumerable:!0}):r,e)),Fr=e=>sn(qe({},"__esModule",{value:!0}),e);var mo={};kr(mo,{extendedLintPlugin:()=>fo});module.exports=Fr(mo);var ne=require("@typescript-eslint/utils"),w=require("zod/v4");var on=require("@typescript-eslint/utils"),an=Ee(require("zod/v4"));function J(e){let r=on.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return an.toJSONSchema(e)}var Pr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),pt=J({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(Pr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,m=new Map,f=new Set,d=new Map;function y(S){for(let I of S.specifiers)I.type===ne.AST_NODE_TYPES.ImportSpecifier&&I.imported.type===ne.AST_NODE_TYPES.Identifier&&I.imported.name!==I.local.name&&d.set(I.local.name,I.imported.name)}function E(S){if(S.declaration){if(S.declaration.type===ne.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let I=S.declaration.id.name;for(let v of Array.from(f)){let[R,N]=v.split(":");R===I&&(N==="function"||N==="any")&&f.delete(v)}}else if(S.declaration.type===ne.AST_NODE_TYPES.VariableDeclaration){for(let I of S.declaration.declarations)if(I.id.type===ne.AST_NODE_TYPES.Identifier){let v=I.id.name;for(let R of Array.from(f)){let[N,_]=R.split(":");N===v&&(_==="variable"||_==="any")&&f.delete(R)}}}}for(let I of S.specifiers)if(I.exported.type===ne.AST_NODE_TYPES.Identifier){let v=I.exported.name;for(let R of Array.from(f)){let[N,_]=R.split(":");N===v&&_==="any"&&f.delete(R)}}}function h(S){S.id.type===ne.AST_NODE_TYPES.Identifier&&S.init?.type===ne.AST_NODE_TYPES.Identifier&&d.set(S.id.name,S.init.name)}function u(S){return d.get(S)??S}function x(S,I){return u(S)===I||S===I}for(let{includeRegex:S,mustCallFn:I,mustMatchSelector:v,mustHaveExport:R}of n??[]){let _=function(K){let q=K;for(let{name:ee,value:te}of N??[])q=q.replaceAll(ee,te);return q};var A=_;let N=Or(s,new RegExp(S));if(N){for(let{anyCall:K,message:q}of I??[]){let ee=`Expected file to call the function: ${K.map(({fn:te})=>te).join(" or ")}`;c.add(ee),l.push(te=>{let{callee:X}=te;if(X.type===ne.AST_NODE_TYPES.Identifier){for(let{fn:de,withArgs:Me}of K)if(X.name===de){c.delete(ee);for(let ie of Me){let Ie=te.arguments[ie.atIndex],pe=typeof ie.literal=="string"?_(ie.literal):ie.literal;if(!Ie){e.report({node:te,messageId:"default",data:{message:`Missing argument with value "${pe}" at index ${ie.atIndex}${q?`: ${_(q)}`:""}`}});continue}if(Ie.type!==ne.AST_NODE_TYPES.Literal){e.report({node:Ie,messageId:"default",data:{message:`Argument at position ${ie.atIndex} should the literal "${pe}"${q?`: ${_(q)}`:""}`}});continue}Ie.value!==pe&&e.report({node:Ie,messageId:"default",data:{message:`Argument should have the value "${pe}"${q?`: ${_(q)}`:""}`},fix:Pe=>Pe.replaceText(Ie,typeof pe=="string"?`'${pe}'`:String(pe))})}break}}})}for(let{selector:K,message:q}of v??[])m.set(K,_(q)),p.set(_(K),()=>{m.delete(K)});for(let{name:K,type:q,message:ee}of R??[]){let te=_(K),X=_(ee);f.add(`${te}:${q}:${X}`)}}}for(let{fn:S,withArgs:I,message:v,replaceWith:R,ignoreRegex:N}of i??[])N&&new RegExp(N).test(s)||l.push(_=>{let{callee:K}=_;if(K.type!==ne.AST_NODE_TYPES.Identifier||!x(K.name,S))return;if(I)for(let ee of I){let te=_.arguments[ee.atIndex];if(!te){e.report({node:_,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${v}`}});return}if(te.type!==ne.AST_NODE_TYPES.Literal||te.value!==ee.value)return}let q=ee=>R?ee.replaceText(_,R):null;e.report({node:_,messageId:"default",data:{message:v},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:q}]:void 0})});function b(S,I){let v=r[S];v?r[S]=R=>{v(R),I(R)}:r[S]=I}for(let{selector:S,message:I,replace:v,replaceType:R="suggestion"}of a??[]){if(S==="CallExpression"){l.push(N=>{g(v,N,I,R)});continue}r[S]=N=>{g(v,N,I,R)}}if(p.size>0)for(let[S,I]of p)b(S,I);return l.length>0&&(r.CallExpression=S=>{if(S.type===ne.AST_NODE_TYPES.CallExpression)for(let I of l)I(S)}),r.ImportDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ImportDeclaration&&y(S)},r.ExportNamedDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ExportNamedDeclaration&&E(S)},r.VariableDeclarator=S=>{S.type===ne.AST_NODE_TYPES.VariableDeclarator&&h(S)},r["Program:exit"]=S=>{for(let I of c)e.report({node:S,messageId:"default",data:{message:I}});for(let[,I]of m)e.report({node:S,messageId:"default",data:{message:I}});for(let I of f){let[v,R,N]=I.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${v}" of type ${R}: ${N}`}})}},r;function g(S,I,v,R){let N=_=>{if(!S)return null;if(typeof S=="string")return _.replaceText(I,S);{let K=new RegExp(S.regex),q=e.sourceCode.getText(I);return _.replaceText(I,q.replace(K,S.with))}};e.report({node:I,messageId:"default",data:{message:v},fix:S&&R==="autofix"?N:void 0,suggest:S&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:N}]:void 0})}}});function Or(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:ln(o)}),r.push({name:"$0_uncapitalize",value:pn(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];l!==void 0&&(r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:ln(l)}),r.push({name:`${s}_uncapitalize`,value:pn(l)}),r.push({name:s,value:l}))}return r}function ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var z=require("@typescript-eslint/utils"),Ae=require("zod/v4");var Nr=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="collapse-simple-objs-in-one-line",Dr=Ae.z.object({maxLineLength:Ae.z.number().optional(),maxProperties:Ae.z.number().optional(),nestedObjMaxLineLength:Ae.z.number().optional(),nestedObjMaxProperties:Ae.z.number().optional(),ignoreTypesWithSuffix:Ae.z.array(Ae.z.string()).optional()}),Mr=Nr({name:un,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[$(Dr)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===z.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===z.AST_NODE_TYPES.Property,m=c?i:o,f=p.properties.length;if(f>m)return!1;if(f===1){let y=p.properties[0];return!y||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ObjectExpression||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(h=>h&&ct(h))?!1:{text:r.getText(y),isNested:c,propsSize:f}}let d=[];for(let y of p.properties){if(y.type===z.AST_NODE_TYPES.Property&&!ct(y.value))return!1;d.push(r.getText(y))}return{text:d.join(", "),isNested:c,propsSize:f}}else{let c=p.parent.parent?.type===z.AST_NODE_TYPES.TSPropertySignature,m=c?i:o,f=p.members.length;if(f>m)return!1;if(n.length>0&&p.parent.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(n.some(E=>y.endsWith(E)))return!1}if(f===1){let y=p.members[0];return!y||y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(y),isNested:c,propsSize:1}}if(p.parent.type===z.AST_NODE_TYPES.TSIntersectionType||p.parent.type===z.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let d=[];for(let y of p.members){if(y.type!==z.AST_NODE_TYPES.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===z.AST_NODE_TYPES.TSTypeLiteral||!cn(E))return!1;if(E.type===z.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let u=E.typeArguments.params[0];if(!u||!cn(u))return!1}let h=r.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),d.push(h)}return{text:d.join("; "),isNested:c,propsSize:f}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==z.AST_NODE_TYPES.JSXExpressionContainer){let E=0,h=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==z.AST_TOKEN_TYPES.Punctuator||h?!0:b.value===","?(E++,!1):b.value===";"?(E++,h=!0,!1):b.value===")"||b.value==="}"?(E++,!1):!0});if(E>4)return;let x=u?.type===z.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
2
2
  `);if(u?.loc.start.line===p.loc.end.line&&!x)return}let c=s(p);if(!c)return;let m=c.text;if(m.includes(`
3
3
  `)||r.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let f=`{ ${m} }`,d=Lr(r,p),y=c.isNested&&c.propsSize>2?a:t.maxLineLength;y&&f.length+d.length+jr(p,r)>y||e.report({node:p,messageId:"singleLineProp",fix:E=>E.replaceText(p,f)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function cn(e){return e.type===z.AST_NODE_TYPES.TSLiteralType||e.type===z.AST_NODE_TYPES.TSTypeReference||e.type===z.AST_NODE_TYPES.TSNumberKeyword||e.type===z.AST_NODE_TYPES.TSStringKeyword||e.type===z.AST_NODE_TYPES.TSBooleanKeyword||e.type===z.AST_NODE_TYPES.TSNullKeyword||e.type===z.AST_NODE_TYPES.TSUndefinedKeyword}function ct(e,t){return!!(e.type===z.AST_NODE_TYPES.Literal||e.type===z.AST_NODE_TYPES.Identifier||e.type===z.AST_NODE_TYPES.TemplateLiteral||e.type===z.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===z.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&ct(r,!0)))}function jr(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
4
  `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function Lr(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var ut={name:un,rule:Mr};var _r=/eslint +react-compiler\/react-compiler: +\["error/,mn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(u){a&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,m=new WeakMap,f=new WeakMap,d=new WeakSet;function y(u,x){return function(b){if(x.has(b))return x.get(b);let g=u(b);return x.set(b,g),g}}function E(u,x,b,g,A){A&&u.async&&s({node:u,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
@@ -12,17 +12,17 @@ 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(u),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 D(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 F=C.node.parent;if(F==null&&(dt(v.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.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 P=C.node.id,{name:j}=O;if(j==="useRef"&&P.type==="Identifier")return!0;if(Vr(O)&&P.type==="Identifier"){for(let L of T.references)L!==P&&d.add(L.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&R(T.identifiers)){if(P.elements[1]===T.identifiers[0]){if(j==="useState"){let L=T.references,ce=0;for(let he=0;he<L.length;he++){if(L[he].isWrite()&&ce++,ce>1)return!1;p.set(L[he].identifier,P.elements[0])}}return!0}else if(P.elements[0]===T.identifiers[0]){if(j==="useState"){let L=T.references;for(let ce=0;ce<L.length;ce++)c.add(L[ce].identifier)}return!1}}}else if(j==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(T.identifiers)&&P.elements[1]===T.identifiers[0])return!0;return!1}function _(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,F=v.childScopes,O=null,P;for(P=0;P<F.length;P++){let j=F[P],L=j.block;if(k.type==="FunctionDeclaration"&&L===k||k.type==="VariableDeclarator"&&L.parent===k){O=j;break}}if(O==null)return!1;for(P=0;P<O.through.length;P++){let j=O.through[P];if(j.resolved!=null&&I.has(j.resolved.scope)&&!K(j.resolved))return!1}return!0}let K=y(D,m),q=y(_,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==u;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let X=new Map,de=new Map;Me(S);function Me(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=dt(u,C.identifier),F=dn(k),O=xe(F,de);if(A&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&te(C)&&ee.set(O,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let P=C.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(X.has(O))X.get(O).references.push(C);else{let j=C.resolved,L=K(j)||q(j);X.set(O,{isStable:L,references:[C]})}}for(let C of T.childScopes)Me(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let F=T.resolved.references,O=!1;for(let P=0;P<F.length;P++){let{identifier:j}=F[P],{parent:L}=j;if(L!=null&&L.type==="MemberExpression"&&!L.computed&&L.property.type==="Identifier"&&L.property.name==="current"&&L.parent.type==="AssignmentExpression"&&L.parent.left===L){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 Ie(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(X.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(F=>{F.writeExpr&&Ie(F.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(X.forEach(({isStable:C,references:k},F)=>{T||k.forEach(O=>{if(T)return;let P=O.identifier;if(!p.has(P))return;let L=O.from;for(;L.type!=="function";)L=L.upper;L.block===u&&(T=F)})}),T){let{suggestedDependencies:C}=ft({dependencies:X,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(u,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],ze=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=xe(T,de)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?X.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 F=!v.through.some(O=>O.identifier===k);Pe.push({key:C,node:T}),F||ze.add(C)});let{suggestedDependencies:Er,unnecessaryDependencies:Xe,missingDependencies:Re,duplicateDependencies:tn}=ft({dependencies:X,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:ze,isEffect:A}),Be=Er;if(tn.size+Re.size+Xe.size===0){if(t)return;$r({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:F})=>{let O=F==="function"?"useCallback":"useMemo",P=F==="function"?"definition":"initialization",j=`wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,L=k?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,ce=F==="conditional"||F==="logical expression"?"could make":"makes",he=`The '${C.name.name}' ${F} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${L}`,nn;k&&C.type==="Variable"&&F==="function"&&(nn=[{desc:`Wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,fix(rn){let[br,Cr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[rn.insertTextBefore(C.node.init,br),rn.insertTextAfter(C.node.init,Cr)]}}]),s({node:C.node,message:he,suggest:nn})});return}!A&&Re.size>0&&(Be=ft({dependencies:X,declaredDependencies:[],stableDependencies:pe,externalDependencies:ze,isEffect:A}).suggestedDependencies);function xr(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}xr()&&Be.sort();function at(T){let C=T.split("."),k="";for(let F=0;F<C.length;F++){if(F!==0){let O=C.slice(0,F+1).join("."),P=de.get(O)===!0;k+=P?"?.":"."}k+=C[F]}return k}function lt(T,C,k,F){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+zr(Array.from(T).sort().map(O=>"'"+at(O)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Xe.size>0){let T=null;if(Array.from(Xe.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(ze.size>0){let C=Array.from(ze)[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&&Re.has("props")){let T=X.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let F=0;F<C.length;F++){let O=C[F],P=dt(v.block,O.identifier);if(!P){k=!1;break}let j=P.parent;if(j==null){k=!1;break}if(j.type!=="MemberExpression"&&j.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&&Re.size>0){let T=null;Re.forEach(C=>{if(T)return;let k=v.set.get(C),F=X.get(C);if(F.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let P=!1,j;for(let L=0;L<F.references.length;L++)if(j=F.references[L].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){P=!0;break}P&&(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&&Re.size>0){let T=null;if(Re.forEach(C=>{if(T!==null)return;let F=X.get(C).references,O,P;for(let j=0;j<F.length;j++){for(O=F[j].identifier,P=O.parent;P!=null&&P!==v.block;){if(P.type==="CallExpression"){let L=p.get(P.callee);if(L!=null){if(L.name===C)T={missingDep:C,setter:P.callee.name,form:"updater"};else if(c.has(O))T={missingDep:C,setter:P.callee.name,form:"reducer"};else{let ce=F[j].resolved;if(ce!=null){let he=ce.defs[0];he!=null&&he.type==="Parameter"&&(T={missingDep:C,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.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 `+(lt(Re,"a","missing","include")||lt(Xe,"an","unnecessary","exclude")||lt(tn,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Be.map(at).join(", ")}]`,fix(T){return T.replaceText(x,`[${Be.map(at).join(", ")}]`)}}]})}function h(u){let x=Ur(u.callee,i);if(x===-1)return;let b=u.arguments[x],g=u.callee,A=yn(g).name,S=u.arguments[x+1],I=/Effect($|[^a-z])/g.test(A);if(!b){s({node:g,message:`React Hook ${A} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!I)){if(!S&&!I){(A==="useMemo"||A==="useCallback")&&s({node:g,message:`React Hook ${A} 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,A,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(D=>D&&D.type==="Identifier"&&D.name===b.name))return;let v=n(u).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,A,I);return;case"VariableDeclarator":let D=R.node.init;if(!D)break;switch(D.type){case"ArrowFunctionExpression":case"FunctionExpression":E(D,S,g,A,I);return}break}break;default:s({node:g,message:`React Hook ${A} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${A} 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 u of e.sourceCode.getAllComments())if(_r.test(u.value))return t=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:u=>h(u)}}};function ft({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let u=s(a,h);u.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),t.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 u=h.split("."),x=E;for(let b of u){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,u){let x=h.split("."),b=E;for(let g of x){let A=b.children.get(g);if(!A)return;u(A),b=A}}let p=new Set,c=new Set;m(a,p,c,E=>E);function m(E,h,u,x){E.children.forEach((b,g)=>{let A=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(A);return}if(b.isUsed){h.add(A);return}m(b,h,u,S=>A+"."+S)})}let f=[],d=new Set,y=new Set;return t.forEach(({key:E})=>{c.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 $r({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){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 c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!gn(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function dn(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)?dn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function mt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function xe(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,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 n=xe(r.object,t),o=xe(r.property,null),a=`${n}.${o}`;return mt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function yn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ur(e,t){let r=yn(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&&t&&t.additionalHooks){let n;try{n=xe(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function dt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Wr(n,t))return n;if(gn(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(fn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{fn(i)&&(i.parent=n,r.push(i))}))}return null}function zr(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Wr(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function gn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Vr(e){return!1}var ve=require("@typescript-eslint/utils"),re=Ee(require("typescript")),Tn=require("zod/v4");var Hr=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="improved-no-unnecessary-condition",Jr=Tn.z.object({}),Yr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Xr=new Set(Yr),yt={name:Sn,rule:Hr({name:Sn,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:[$(Jr)]},defaultOptions:[{}],create(e){let t=ve.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===ve.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=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)c.push(...d);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===ve.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===ve.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Br(c,Xr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(c);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Ge(m)}})}return{BinaryExpression:i}}})};function Ge(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===ve.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Br(e,t){return t.has(e)}var Ke=require("@typescript-eslint/utils"),Ze=require("zod/v4");var qr=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-call-with-explicit-generics",Gr=Ze.z.object({functions:Ze.z.array(Ze.z.string())}),Zr=qr({name:hn,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:[$(Gr)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Ke.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),gt={name:hn,rule:Zr};var Oe=require("@typescript-eslint/utils"),Kr=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-call-with-inferred-generics",Qr=Kr({name:En,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,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params.some(c=>!s&&c.type===Oe.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===Oe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Oe.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),St={name:En,rule:Qr};var Cn=require("@typescript-eslint/utils"),ei=Cn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-commented-out-code",ti=["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:"],ni=/^\s*return\s+/,ri=/\w=("|'|`)/,ii=/\w+:\s*('|"|`)/,si=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,oi=/\w+-\w+:/,ai=/\w+_\w+:/,li=/\?\s+\w/,pi=/:\s+\w/,ci=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ui=/^\s*\d+[,}]/,fi=/^\s*\[[^\]]*\][,}]/,mi=/^\s*\{[^}]*\}[,}]/,di=/\.\w+\(/,yi=/\[\w+\]/,gi=/^\s*(['"`]).+?\1\s*:/,Si=/^<[A-Z]\w*(\s|>|\/)/,Ti=/^<[a-z]+(\s|>|\/)/,hi=/<[A-Z]\w*(\s.*)?>/,Ei=/<\/[A-Z]\w*>/,xi=/<[a-z]+(\s.*)?>/,bi=/<\/[a-z]+>/,Ci=/^\s*[*\s]*$/,Ii=/^[a-zA-Z]/,Ri=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ai=/```[\s\S]*?```/g,wi=/`[^`]*`/g,xn=/[a-zA-Z0-9]/,vi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ki=/[{}[\]()`=<>]/,Fi=/:\s*(['"`[{(]|\w+\s*=>)/,Pi=/\bif\s*\(|\belse\b|=>/,G={returnStatement:ni,stringAssignment:ri,objectPropertyWithQuotes:ii,computedPropertyAssignment:si,kebabCaseProperty:oi,snakeCaseProperty:ai,ternaryOperator:li,colonWithWord:pi,quotedString:ci,numberWithComma:ui,arrayWithComma:fi,objectWithComma:mi,methodCall:di,arrayAccess:yi,quotedPropertyKey:gi,jsxSelfClosing:Si,jsxElement:Ti,jsxOpeningTag:hi,jsxClosingTag:Ei,htmlOpeningTag:xi,htmlClosingTag:bi,jsdocComment:Ci};function Oi(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Ii.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||vi.test(t)||ki.test(t)||Fi.test(t)||Pi.test(t)?!1:!!(t.includes(":")&&Ri.test(t))}var Ni=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],Di=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],bn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Mi=ei({name:In,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 t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||G.jsdocComment.test(n))return!1;for(let i of bn)if(a.startsWith(i))return!1;if(n.includes("https://")||Oi(a))return!1;if(o==="Block"){for(let i of Di)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of ti)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ni)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ai);p.some(m=>xn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(wi);return s.some(p=>xn.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=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:bn.join(", ")}})}}}}}),Tt={name:In,rule:Mi};var Qe=require("@typescript-eslint/utils"),ji=Qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-default-export",Li=ji({name:Rn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Qe.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ht={name:Rn,rule:Li};var An=require("@typescript-eslint/utils"),_i=An.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-leaked-text-in-jsx",$i=[",",";","[","]","(",")"],Ui=_i({name:wn,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(t){let r=t.value.trim();if(!r)return;let n="";$i.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Et={name:wn,rule:Ui};var ke=require("@typescript-eslint/utils"),zi=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kn="no-non-camel-case-functions",Wi=/^(\$?[a-z][a-zA-Z0-9]*)$/;function vn(e){if(e.typeName.type!==ke.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ke.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Vi=zi({name:kn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Wi.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ke.AST_NODE_TYPES.TSTypeReference?vn(r):r.type===ke.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===ke.AST_NODE_TYPES.TSTypeReference&&vn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),xt={name:kn,rule:Vi};var V=require("@typescript-eslint/utils");var bt=require("@typescript-eslint/utils");function Le(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Le(e.parent,t,r===1/0?r:r-1)}function*Ct(e){yield e,e.parent&&(yield*Ct(e.parent))}function It(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Pn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===bt.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===bt.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}function Fn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Hi(e,t){return e[t]}function On(e,t,r){let n=r.visitorKeys,o=new Set;function a(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let c=Hi(i,p);if(c){if(Array.isArray(c)){for(let m of c)if(Fn(m)&&a(m))return!0}else if(Fn(c)&&a(c))return!0}}return!1}a(e)}var Ji=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="no-optional-root-props",Yi=Ji({name:Nn,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 t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of Ct(i.identifier)){if("returnType"in s||s.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Le(l.parent.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=et(c,e.sourceCode);return m?!(m.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===V.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Le(l,V.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!et(p,e.sourceCode):!1}if(l.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!et(l,e.sourceCode)}return!1}function r(n){n.key.type!==V.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Le(n,V.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===V.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(tt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(tt(n)||!t(n)))for(let o of n.body.body)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==V.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==V.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Le(n.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=et(a,e.sourceCode);if(!(!i||i.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function tt(e){return e?e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function et(e,t){if(tt(e))return;let r;if(e.type===V.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.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])&&!tt(a[0].identifier.parent.parent))return a[0].identifier}var Rt={name:Nn,rule:Yi};var We=require("@typescript-eslint/utils");var Ve=J({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 t=new Set;function r(n){return n?n.type===We.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===We.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===We.AST_NODE_TYPES.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===We.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Dn=require("@typescript-eslint/utils"),nt=Ee(require("path")),be=require("zod/v4");var Xi=Dn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-relative-imports",Bi=be.z.object({find:be.z.string(),replacement:be.z.string()}),qi=be.z.object({aliases:be.z.array(Bi),rootDir:be.z.string().optional(),allowNotFoundAliases:be.z.boolean().optional(),_dev_simulateFileName:be.z.string().optional()}),Gi=Xi({name:Mn,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:[$(qi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=nt.default.dirname(s);return nt.default.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=nt.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let m=l.replace(c,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),At={name:Mn,rule:Gi};var Z=require("@typescript-eslint/utils"),wt=require("zod/v4");var Zi=wt.z.object({customMessage:wt.z.string().optional()}),vt=J({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(Zi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case Z.AST_NODE_TYPES.Literal:return!0;case Z.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===Z.AST_NODE_TYPES.Property?o.computed||o.value.type===Z.AST_NODE_TYPES.Identifier&&o.key.type===Z.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case Z.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===Z.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case Z.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case Z.AST_NODE_TYPES.ConditionalExpression:case Z.AST_NODE_TYPES.LogicalExpression:case Z.AST_NODE_TYPES.BinaryExpression:case Z.AST_NODE_TYPES.UnaryExpression:case Z.AST_NODE_TYPES.CallExpression:case Z.AST_NODE_TYPES.MemberExpression:case Z.AST_NODE_TYPES.Identifier:case Z.AST_NODE_TYPES.ArrowFunctionExpression:case Z.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===Z.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===Z.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==Z.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===Z.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var He=require("@typescript-eslint/utils"),Ne=Ee(require("zod/v4"));var Ki=Ne.object({alternativeMsgs:Ne.object({inArrayFind:Ne.string().optional(),inArrayFilter:Ne.string().optional()}).optional(),__dev_simulateFileName:Ne.string().optional()});function Qi(e){return e.typeAnnotation.type!==He.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var es=/(typeGuards|type-guards)\.(ts|tsx)$/;function ts(e){return es.test(e)}function ns(e){let t=e.parent;for(;t;){if(t.type===He.AST_NODE_TYPES.CallExpression&&t.callee.type===He.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===He.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var kt=J({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:[$(Ki)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ts(r))return{};function n(o){if(!Qi(o))return;let a=ns(o);if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.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)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var De=require("@typescript-eslint/utils");var rs="no-unnecessary-async-on-jsx-props";function is(e){if(e.body.type!==De.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==De.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===De.AST_NODE_TYPES.AwaitExpression}var Ft=J({name:rs,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 t(r){is(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===De.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===De.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===De.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Ce=require("@typescript-eslint/utils"),Pt=Ee(require("typescript")),_e=Ee(require("zod/v4"));var ss=Ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="no-unnecessary-casting",os=_e.default.object({additionalCastFunctions:_e.default.array(_e.default.object({name:_e.default.string(),expectedType:_e.default.enum(["string","number"])})).optional()}),Ot={name:jn,rule:ss({name:jn,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:[$(os)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Ce.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,m){switch(c.type){case Ce.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Ce.AST_NODE_TYPES.TemplateLiteral:return m==="string";case Ce.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&Pt.TypeFlags.NumberLike):!!(c.flags&Pt.TypeFlags.StringLike)}function l(c,m){return f=>f.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!a||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Ce.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=c;if(f.type!==Ce.AST_NODE_TYPES.Identifier)return;let d=f.name,y=n.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,u;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...u?{data:u}:{},fix:l(c,m)})}}return{CallExpression:p}}})};var Je=require("@typescript-eslint/utils"),ye=Ee(require("zod/v4"));var as=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),Nt=J({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:[$(as)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===Je.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Je.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==Je.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Je.AST_NODE_TYPES.CallExpression){let c=a(p);c&&o(c)&&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 Dt=J({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(t){if(t.id.type===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.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||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=ls(t,e.sourceCode);if(n.length===0)return;let o=t.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 n){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 ls(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var H=require("@typescript-eslint/utils"),Fe=require("zod/v4");var ps=Fe.z.object({selectors:Fe.z.array(Fe.z.object({name:Fe.z.string(),selectorProp:Fe.z.string().optional(),selectorArgPos:Fe.z.number().optional(),returnProp:Fe.z.string().optional()}))}),cs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ln="no-unused-selected-values",Mt={name:Ln,rule:cs({name:Ln,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(ps)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===H.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=fs(a);if(!i)return;let s=n.get(i);if(!s)return;let l=us(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ms(l);if(!p)return;let c=_n(p.properties,void 0);if(!c)return;if(o.id.type===H.AST_NODE_TYPES.ObjectPattern){let d=_n(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of c)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==H.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=ds(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==H.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==H.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of c)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function us(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===H.AST_NODE_TYPES.ArrowFunctionExpression||n.type===H.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===H.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===H.AST_NODE_TYPES.Property&&i.key.type===H.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==H.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===H.AST_NODE_TYPES.ArrowFunctionExpression||a.type===H.AST_NODE_TYPES.FunctionExpression)return a}return null}function fs(e){return e.callee.type===H.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===H.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===H.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ms(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function _n(e,t){let r=e;if(t){let o=e.find(a=>a.type===H.AST_NODE_TYPES.Property&&a.key.type===H.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==H.AST_NODE_TYPES.Property||o.value.type!==H.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==H.AST_NODE_TYPES.Property||o.key.type!==H.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ds(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var Y=require("@typescript-eslint/utils");var jt=J({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===Y.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=ys(a);s&&(n=s);return}let i=gs(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function ys(e){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==Y.AST_NODE_TYPES.ObjectExpression)return null;let n=It(r.properties,a=>a.type!==Y.AST_NODE_TYPES.Property||a.key.type!==Y.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===Y.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===Y.AST_NODE_TYPES.FunctionExpression?Ss(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===Y.AST_NODE_TYPES.Property&&a.key.type===Y.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function gs(e,t){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==Y.AST_NODE_TYPES.ObjectPattern||!It(e.parent.id.properties,i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Pn(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==Y.AST_NODE_TYPES.Identifier||i.parent.type===Y.AST_NODE_TYPES.Property&&i.parent.parent.type===Y.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===Y.AST_NODE_TYPES.ReturnStatement||i.parent.type===Y.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===Y.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==Y.AST_NODE_TYPES.Identifier||i.parent.property.type!==Y.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ss(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var W=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Ts=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $n(e){let t=[];for(let r of e.members)r.type===W.AST_NODE_TYPES.TSPropertySignature&&r.key.type===W.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Un(e,...t){for(let r of t)e.set(...r);return e}var hs=Ye.z.object({forceCheckOnFCPropTypesWithName:Ye.z.array(Ye.z.string()).optional(),alwaysCheckFunctionOptionTypes:Ye.z.boolean().optional()}),zn="no-unused-type-props-in-args",Lt=null,Es=Ts({name:zn,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:[$(hs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!Lt&&(Lt=r.map(l=>new RegExp(l)));function o(l,p,c,m,f=!0,d=!1){let y=c.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&Lt?.some(g=>g.test(y)),u=d&&n;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===W.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!u)){if(x.type===W.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===W.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,c,m,f,d=!1){if(m.type===W.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===W.AST_NODE_TYPES.TSPropertySignature&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.set(y.key.name,y);return}if(m.type===W.AST_NODE_TYPES.TSTypeLiteral){Un(c,...$n(m));return}if(m.type===W.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)a(l,p,c,y,!0,d);return}f||m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier&&o(l,p,m.typeName,c,!0,d)}function i(l,p,c,m=!1){for(let f of c)if(f.type===W.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===W.AST_NODE_TYPES.AssignmentPattern&&f.left.type===W.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let c=[];if(l.properties.at(-1)?.type===W.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===W.AST_NODE_TYPES.Property&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.push(y.key.name);let f=[],d=[];for(let[y,E]of p)c.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 u=l.properties.at(-1),x=d.join(", ");return u?u.type===W.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(u,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],c=new Map,m=p.id.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier)o(!0,l,m.typeName,c,!1);else if(m.type===W.AST_NODE_TYPES.TSTypeLiteral)Un(c,...$n(m));else if(m.type===W.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===W.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===W.AST_NODE_TYPES.Identifier?o(!0,l,f.typeName,c,!1):a(!0,l,c,f,!0);if(c.size!==0&&p.init?.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===W.AST_NODE_TYPES.ObjectPattern&&s(f,c)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),_t={name:zn,rule:Es};var ue=require("@typescript-eslint/utils");var $t=J({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 t=new Set;function r(n){return n.callee.type===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(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:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var $e=require("@typescript-eslint/utils"),xs=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="prefer-named-functions",Wn=new Map,bs=xs({name:Vn,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,[t]){let r=null;if(t.ignoreRegex){let n=Wn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Wn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===$e.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===$e.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==$e.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ut={name:Vn,rule:bs};var M=require("@typescript-eslint/utils"),ge=require("zod/v4");var Cs=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()}))}),Is=/^use[A-Z]/,Rs=/^[A-Z]/;function rt(e){return Is.test(e)}function Hn(e){return Rs.test(e)}function As(e){return e.type===M.AST_NODE_TYPES.Identifier?rt(e.name):e.type===M.AST_NODE_TYPES.MemberExpression&&e.property.type===M.AST_NODE_TYPES.Identifier?rt(e.property.name):!1}function Jn(e,t){return e.type===M.AST_NODE_TYPES.Identifier?e.name===t:e.type===M.AST_NODE_TYPES.MemberExpression&&e.object.type===M.AST_NODE_TYPES.Identifier&&e.property.type===M.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Yn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"forwardRef"))}function Xn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"memo"))}function zt(e){if(e.type===M.AST_NODE_TYPES.FunctionDeclaration||e.type===M.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.AST_NODE_TYPES.FunctionExpression||e.type===M.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===M.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ws(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.AST_NODE_TYPES.FunctionDeclaration||t.type===M.AST_NODE_TYPES.FunctionExpression||t.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(t);if(n&&n.type===M.AST_NODE_TYPES.Identifier){if(Hn(n.name)||rt(n.name))return!r;r=!0}else{if(Yn(t)||Xn(t))return!r;if(t.parent.type===M.AST_NODE_TYPES.CallExpression){let o=t.parent;As(o.callee)||(r=!0)}else t.parent.type===M.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Bn(e){return e.callee.type===M.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===M.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===M.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function vs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.AST_NODE_TYPES.FunctionDeclaration||r.type===M.AST_NODE_TYPES.FunctionExpression||r.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(r);if(n&&n.type===M.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===M.AST_NODE_TYPES.CallExpression){let n=Bn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ks(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Fs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.AST_NODE_TYPES.FunctionDeclaration||n.type===M.AST_NODE_TYPES.FunctionExpression||n.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let o=zt(n);if(o&&o.type===M.AST_NODE_TYPES.Identifier){if(Hn(o.name)||rt(o.name)){r=!0;break}}else if(Yn(n)||Xn(n)){r=!0;break}}n=n.parent}return r?t.length===0?ws(e):!vs(e,t):!1}var Wt=J({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:[$(Cs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Bn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ks(o))return;let s=i.allowUseInside||[];Fs(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.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===M.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var B=require("@typescript-eslint/utils"),it=Ee(require("zod/v4"));var Ps=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="prefer-single-line-if",Os=it.default.object({maxLineLength:it.default.number().optional(),maxNonSimpleConditionLength:it.default.number().optional()}),Ns=Ps({name:Gn,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,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==B.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(!a)return;if(a.type===B.AST_NODE_TYPES.ReturnStatement){if(!Kn(a))return}else if(!(a.type===B.AST_NODE_TYPES.ContinueStatement||a.type===B.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===B.AST_NODE_TYPES.LogicalExpression||n.test.type===B.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=qn(n.test);if(!m&&n.test.type===B.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;qn(f)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
- `))return;let l=r.getTokenAfter(n);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=Ds(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,c)})}}}});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&&Zn(e)}function Zn(e){return e.object.type===B.AST_NODE_TYPES.MemberExpression?Zn(e.object):e.object.type!==B.AST_NODE_TYPES.Identifier}function Ds(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Kn(e){if(!e.argument)return!0;let t=e.argument;return t.type===B.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===B.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===B.AST_NODE_TYPES.Literal||t.type===B.AST_NODE_TYPES.Identifier||t.type===B.AST_NODE_TYPES.TemplateLiteral||t.type===B.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===B.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===B.AST_NODE_TYPES.UnaryExpression?Kn(t):!1}var Vt={name:Gn,rule:Ns};var N=require("@typescript-eslint/utils"),Ht=require("zod/v4");var Ms=N.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="react-compiler-extra",js=Ht.z.object({runOnlyWithEnableCompilerDirective:Ht.z.boolean().optional()}),Ls=/eslint +react-compiler\/react-compiler: +\["error/;function or(e){return e.type===N.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===N.AST_NODE_TYPES.MemberExpression&&e.property.type===N.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Se(e){if(!e)return!1;switch(e.type){case N.AST_NODE_TYPES.JSXElement:case N.AST_NODE_TYPES.JSXFragment:return!0;case N.AST_NODE_TYPES.ConditionalExpression:return Se(e.consequent)||Se(e.alternate);case N.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Se(e.right):e.operator==="||"?Se(e.left)||Se(e.right):!1;case N.AST_NODE_TYPES.CallExpression:if(e.callee.type===N.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===N.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===N.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==N.AST_NODE_TYPES.SpreadElement&&Se(t))return!0;return!1;default:return!1}}function _s(e){let t=e.typeAnnotation;if(t.type===N.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===N.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===N.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===N.AST_NODE_TYPES.Identifier&&t.typeName.right.type===N.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var $s=/^[A-Z][a-zA-Z0-9]*$/;function Qn(e){return $s.test(e)}function er(e){return e.startsWith("use")&&e.length>3}function tr(e,t,r){return r&&_s(r)?t?Qn(t.name):e.type===N.AST_NODE_TYPES.FunctionDeclaration&&e.id?Qn(e.id.name):!0:!!(t&&er(t.name)||e.type===N.AST_NODE_TYPES.FunctionDeclaration&&e.id&&er(e.id.name))}function nr(e){if(e.body.type===N.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===N.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===N.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Us(e,t){let r={containsJSX:!1,containsHookCalls:!1};return On(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case N.AST_NODE_TYPES.JSXElement:case N.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case N.AST_NODE_TYPES.CallExpression:or(n.callee)&&(r.containsHookCalls=!0),Se(n)&&(r.containsJSX=!0);break;case N.AST_NODE_TYPES.ReturnStatement:n.argument&&Se(n.argument)&&(r.containsJSX=!0);break;case N.AST_NODE_TYPES.VariableDeclarator:n.init&&Se(n.init)&&(r.containsJSX=!0);break;case N.AST_NODE_TYPES.AssignmentExpression:Se(n.right)&&(r.containsJSX=!0);break}},t),r}function rr(e,t){let r=e.body,n=Us(r,t);return n.containsJSX||n.containsHookCalls}var zs=/\bthis[.[]/;function ir(e){return zs.test(e)}var Ws=Ms({name:sr,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:"React components and hooks should create JSX elements or call other hooks for optimal React compiler detection.",addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization'},hasSuggestions:!0,schema:[$(js)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(Ls.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===N.AST_NODE_TYPES.Property&&i.method&&i.value.type===N.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(ir(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(d=>s.getText(d)).join(", "),f="";p.generator?f=`${l}: function* (${m}) ${c}`:f=`${l}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,f)})}}}function o(a){for(let i of a.properties)if(i.type===N.AST_NODE_TYPES.Property&&i.value.type===N.AST_NODE_TYPES.ObjectExpression){for(let s of i.value.properties)if(s.type===N.AST_NODE_TYPES.Property&&s.method&&s.value.type===N.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(s.value.body);ir(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(or(a.callee))for(let i of a.arguments){if(i.type===N.AST_NODE_TYPES.ObjectExpression&&(n(i),o(i)),i.type===N.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===N.AST_NODE_TYPES.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===N.AST_NODE_TYPES.BlockStatement))for(let s of i.body.body)s.type===N.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===N.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===N.AST_NODE_TYPES.FunctionExpression)for(let s of i.body.body)s.type===N.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===N.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument))}},VariableDeclarator(a){if(a.id.type===N.AST_NODE_TYPES.Identifier&&a.init&&(a.init.type===N.AST_NODE_TYPES.ArrowFunctionExpression||a.init.type===N.AST_NODE_TYPES.FunctionExpression)){let i=a.init,s=a.id,l=a.id.typeAnnotation;if(tr(i,s,l)){let p=rr(i,e.sourceCode),c=nr(i);!p&&!c&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===N.AST_NODE_TYPES.BlockStatement){let f=i.body.range[0]+1;return m.insertTextAfterRange([f,f],`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),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 F=C.node.parent;if(F==null&&(dt(v.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.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 P=C.node.id,{name:j}=O;if(j==="useRef"&&P.type==="Identifier")return!0;if(Vr(O)&&P.type==="Identifier"){for(let L of T.references)L!==P&&d.add(L.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&R(T.identifiers)){if(P.elements[1]===T.identifiers[0]){if(j==="useState"){let L=T.references,ce=0;for(let he=0;he<L.length;he++){if(L[he].isWrite()&&ce++,ce>1)return!1;p.set(L[he].identifier,P.elements[0])}}return!0}else if(P.elements[0]===T.identifiers[0]){if(j==="useState"){let L=T.references;for(let ce=0;ce<L.length;ce++)c.add(L[ce].identifier)}return!1}}}else if(j==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(T.identifiers)&&P.elements[1]===T.identifiers[0])return!0;return!1}function _(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,F=v.childScopes,O=null,P;for(P=0;P<F.length;P++){let j=F[P],L=j.block;if(k.type==="FunctionDeclaration"&&L===k||k.type==="VariableDeclarator"&&L.parent===k){O=j;break}}if(O==null)return!1;for(P=0;P<O.through.length;P++){let j=O.through[P];if(j.resolved!=null&&I.has(j.resolved.scope)&&!K(j.resolved))return!1}return!0}let K=y(N,m),q=y(_,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==u;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let X=new Map,de=new Map;Me(S);function Me(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=dt(u,C.identifier),F=dn(k),O=xe(F,de);if(A&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&te(C)&&ee.set(O,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let P=C.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(X.has(O))X.get(O).references.push(C);else{let j=C.resolved,L=K(j)||q(j);X.set(O,{isStable:L,references:[C]})}}for(let C of T.childScopes)Me(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let F=T.resolved.references,O=!1;for(let P=0;P<F.length;P++){let{identifier:j}=F[P],{parent:L}=j;if(L!=null&&L.type==="MemberExpression"&&!L.computed&&L.property.type==="Identifier"&&L.property.name==="current"&&L.parent.type==="AssignmentExpression"&&L.parent.left===L){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 Ie(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(X.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(F=>{F.writeExpr&&Ie(F.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(X.forEach(({isStable:C,references:k},F)=>{T||k.forEach(O=>{if(T)return;let P=O.identifier;if(!p.has(P))return;let L=O.from;for(;L.type!=="function";)L=L.upper;L.block===u&&(T=F)})}),T){let{suggestedDependencies:C}=ft({dependencies:X,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(u,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],ze=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=xe(T,de)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?X.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 F=!v.through.some(O=>O.identifier===k);Pe.push({key:C,node:T}),F||ze.add(C)});let{suggestedDependencies:Er,unnecessaryDependencies:Xe,missingDependencies:Re,duplicateDependencies:tn}=ft({dependencies:X,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:ze,isEffect:A}),Be=Er;if(tn.size+Re.size+Xe.size===0){if(t)return;$r({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:F})=>{let O=F==="function"?"useCallback":"useMemo",P=F==="function"?"definition":"initialization",j=`wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,L=k?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,ce=F==="conditional"||F==="logical expression"?"could make":"makes",he=`The '${C.name.name}' ${F} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${L}`,nn;k&&C.type==="Variable"&&F==="function"&&(nn=[{desc:`Wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,fix(rn){let[br,Cr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[rn.insertTextBefore(C.node.init,br),rn.insertTextAfter(C.node.init,Cr)]}}]),s({node:C.node,message:he,suggest:nn})});return}!A&&Re.size>0&&(Be=ft({dependencies:X,declaredDependencies:[],stableDependencies:pe,externalDependencies:ze,isEffect:A}).suggestedDependencies);function xr(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}xr()&&Be.sort();function at(T){let C=T.split("."),k="";for(let F=0;F<C.length;F++){if(F!==0){let O=C.slice(0,F+1).join("."),P=de.get(O)===!0;k+=P?"?.":"."}k+=C[F]}return k}function lt(T,C,k,F){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+zr(Array.from(T).sort().map(O=>"'"+at(O)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Xe.size>0){let T=null;if(Array.from(Xe.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(ze.size>0){let C=Array.from(ze)[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&&Re.has("props")){let T=X.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let F=0;F<C.length;F++){let O=C[F],P=dt(v.block,O.identifier);if(!P){k=!1;break}let j=P.parent;if(j==null){k=!1;break}if(j.type!=="MemberExpression"&&j.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&&Re.size>0){let T=null;Re.forEach(C=>{if(T)return;let k=v.set.get(C),F=X.get(C);if(F.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let P=!1,j;for(let L=0;L<F.references.length;L++)if(j=F.references[L].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){P=!0;break}P&&(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&&Re.size>0){let T=null;if(Re.forEach(C=>{if(T!==null)return;let F=X.get(C).references,O,P;for(let j=0;j<F.length;j++){for(O=F[j].identifier,P=O.parent;P!=null&&P!==v.block;){if(P.type==="CallExpression"){let L=p.get(P.callee);if(L!=null){if(L.name===C)T={missingDep:C,setter:P.callee.name,form:"updater"};else if(c.has(O))T={missingDep:C,setter:P.callee.name,form:"reducer"};else{let ce=F[j].resolved;if(ce!=null){let he=ce.defs[0];he!=null&&he.type==="Parameter"&&(T={missingDep:C,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.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 `+(lt(Re,"a","missing","include")||lt(Xe,"an","unnecessary","exclude")||lt(tn,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Be.map(at).join(", ")}]`,fix(T){return T.replaceText(x,`[${Be.map(at).join(", ")}]`)}}]})}function h(u){let x=Ur(u.callee,i);if(x===-1)return;let b=u.arguments[x],g=u.callee,A=yn(g).name,S=u.arguments[x+1],I=/Effect($|[^a-z])/g.test(A);if(!b){s({node:g,message:`React Hook ${A} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!I)){if(!S&&!I){(A==="useMemo"||A==="useCallback")&&s({node:g,message:`React Hook ${A} 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,A,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let v=n(u).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,A,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,A,I);return}break}break;default:s({node:g,message:`React Hook ${A} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${A} 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 u of e.sourceCode.getAllComments())if(_r.test(u.value))return t=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:u=>h(u)}}};function ft({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let u=s(a,h);u.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),t.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 u=h.split("."),x=E;for(let b of u){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,u){let x=h.split("."),b=E;for(let g of x){let A=b.children.get(g);if(!A)return;u(A),b=A}}let p=new Set,c=new Set;m(a,p,c,E=>E);function m(E,h,u,x){E.children.forEach((b,g)=>{let A=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(A);return}if(b.isUsed){h.add(A);return}m(b,h,u,S=>A+"."+S)})}let f=[],d=new Set,y=new Set;return t.forEach(({key:E})=>{c.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 $r({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){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 c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!gn(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function dn(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)?dn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function mt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function xe(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,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 n=xe(r.object,t),o=xe(r.property,null),a=`${n}.${o}`;return mt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function yn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ur(e,t){let r=yn(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&&t&&t.additionalHooks){let n;try{n=xe(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function dt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Wr(n,t))return n;if(gn(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(fn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{fn(i)&&(i.parent=n,r.push(i))}))}return null}function zr(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Wr(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function gn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Vr(e){return!1}var ve=require("@typescript-eslint/utils"),re=Ee(require("typescript")),Tn=require("zod/v4");var Hr=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="improved-no-unnecessary-condition",Jr=Tn.z.object({}),Yr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Xr=new Set(Yr),yt={name:Sn,rule:Hr({name:Sn,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:[$(Jr)]},defaultOptions:[{}],create(e){let t=ve.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===ve.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=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)c.push(...d);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===ve.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===ve.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Br(c,Xr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(c);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Ge(m)}})}return{BinaryExpression:i}}})};function Ge(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===ve.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Br(e,t){return t.has(e)}var Ke=require("@typescript-eslint/utils"),Ze=require("zod/v4");var qr=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-call-with-explicit-generics",Gr=Ze.z.object({functions:Ze.z.array(Ze.z.string())}),Zr=qr({name:hn,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:[$(Gr)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Ke.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),gt={name:hn,rule:Zr};var Oe=require("@typescript-eslint/utils"),Kr=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-call-with-inferred-generics",Qr=Kr({name:En,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,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params.some(c=>!s&&c.type===Oe.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===Oe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Oe.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),St={name:En,rule:Qr};var Cn=require("@typescript-eslint/utils"),ei=Cn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-commented-out-code",ti=["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:"],ni=/^\s*return\s+/,ri=/\w=("|'|`)/,ii=/\w+:\s*('|"|`)/,si=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,oi=/\w+-\w+:/,ai=/\w+_\w+:/,li=/\?\s+\w/,pi=/:\s+\w/,ci=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ui=/^\s*\d+[,}]/,fi=/^\s*\[[^\]]*\][,}]/,mi=/^\s*\{[^}]*\}[,}]/,di=/\.\w+\(/,yi=/\[\w+\]/,gi=/^\s*(['"`]).+?\1\s*:/,Si=/^<[A-Z]\w*(\s|>|\/)/,Ti=/^<[a-z]+(\s|>|\/)/,hi=/<[A-Z]\w*(\s.*)?>/,Ei=/<\/[A-Z]\w*>/,xi=/<[a-z]+(\s.*)?>/,bi=/<\/[a-z]+>/,Ci=/^\s*[*\s]*$/,Ii=/^[a-zA-Z]/,Ri=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ai=/```[\s\S]*?```/g,wi=/`[^`]*`/g,xn=/[a-zA-Z0-9]/,vi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ki=/[{}[\]()`=<>]/,Fi=/:\s*(['"`[{(]|\w+\s*=>)/,Pi=/\bif\s*\(|\belse\b|=>/,G={returnStatement:ni,stringAssignment:ri,objectPropertyWithQuotes:ii,computedPropertyAssignment:si,kebabCaseProperty:oi,snakeCaseProperty:ai,ternaryOperator:li,colonWithWord:pi,quotedString:ci,numberWithComma:ui,arrayWithComma:fi,objectWithComma:mi,methodCall:di,arrayAccess:yi,quotedPropertyKey:gi,jsxSelfClosing:Si,jsxElement:Ti,jsxOpeningTag:hi,jsxClosingTag:Ei,htmlOpeningTag:xi,htmlClosingTag:bi,jsdocComment:Ci};function Oi(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Ii.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||vi.test(t)||ki.test(t)||Fi.test(t)||Pi.test(t)?!1:!!(t.includes(":")&&Ri.test(t))}var Ni=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],Di=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],bn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Mi=ei({name:In,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 t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||G.jsdocComment.test(n))return!1;for(let i of bn)if(a.startsWith(i))return!1;if(n.includes("https://")||Oi(a))return!1;if(o==="Block"){for(let i of Di)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of ti)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ni)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ai);p.some(m=>xn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(wi);return s.some(p=>xn.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=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:bn.join(", ")}})}}}}}),Tt={name:In,rule:Mi};var Qe=require("@typescript-eslint/utils"),ji=Qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-default-export",Li=ji({name:Rn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Qe.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ht={name:Rn,rule:Li};var An=require("@typescript-eslint/utils"),_i=An.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-leaked-text-in-jsx",$i=[",",";","[","]","(",")"],Ui=_i({name:wn,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(t){let r=t.value.trim();if(!r)return;let n="";$i.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Et={name:wn,rule:Ui};var ke=require("@typescript-eslint/utils"),zi=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kn="no-non-camel-case-functions",Wi=/^(\$?[a-z][a-zA-Z0-9]*)$/;function vn(e){if(e.typeName.type!==ke.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ke.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Vi=zi({name:kn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Wi.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ke.AST_NODE_TYPES.TSTypeReference?vn(r):r.type===ke.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===ke.AST_NODE_TYPES.TSTypeReference&&vn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),xt={name:kn,rule:Vi};var V=require("@typescript-eslint/utils");var bt=require("@typescript-eslint/utils");function Le(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Le(e.parent,t,r===1/0?r:r-1)}function*Ct(e){yield e,e.parent&&(yield*Ct(e.parent))}function It(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Pn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===bt.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===bt.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}function Fn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Hi(e,t){return e[t]}function On(e,t,r){let n=r.visitorKeys,o=new Set;function a(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let c=Hi(i,p);if(c){if(Array.isArray(c)){for(let m of c)if(Fn(m)&&a(m))return!0}else if(Fn(c)&&a(c))return!0}}return!1}a(e)}var Ji=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="no-optional-root-props",Yi=Ji({name:Nn,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 t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let s of Ct(i.identifier)){if("returnType"in s||s.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Le(l.parent.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=et(c,e.sourceCode);return m?!(m.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===V.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Le(l,V.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!et(p,e.sourceCode):!1}if(l.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!et(l,e.sourceCode)}return!1}function r(n){n.key.type!==V.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Le(n,V.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===V.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(tt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(tt(n)||!t(n)))for(let o of n.body.body)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==V.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==V.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Le(n.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=et(a,e.sourceCode);if(!(!i||i.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function tt(e){return e?e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function et(e,t){if(tt(e))return;let r;if(e.type===V.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.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])&&!tt(a[0].identifier.parent.parent))return a[0].identifier}var Rt={name:Nn,rule:Yi};var We=require("@typescript-eslint/utils");var Ve=J({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 t=new Set;function r(n){return n?n.type===We.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===We.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===We.AST_NODE_TYPES.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===We.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Dn=require("@typescript-eslint/utils"),nt=Ee(require("path")),be=require("zod/v4");var Xi=Dn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-relative-imports",Bi=be.z.object({find:be.z.string(),replacement:be.z.string()}),qi=be.z.object({aliases:be.z.array(Bi),rootDir:be.z.string().optional(),allowNotFoundAliases:be.z.boolean().optional(),_dev_simulateFileName:be.z.string().optional()}),Gi=Xi({name:Mn,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:[$(qi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=nt.default.dirname(s);return nt.default.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=nt.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let m=l.replace(c,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),At={name:Mn,rule:Gi};var Z=require("@typescript-eslint/utils"),wt=require("zod/v4");var Zi=wt.z.object({customMessage:wt.z.string().optional()}),vt=J({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(Zi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case Z.AST_NODE_TYPES.Literal:return!0;case Z.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===Z.AST_NODE_TYPES.Property?o.computed||o.value.type===Z.AST_NODE_TYPES.Identifier&&o.key.type===Z.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case Z.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===Z.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case Z.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case Z.AST_NODE_TYPES.ConditionalExpression:case Z.AST_NODE_TYPES.LogicalExpression:case Z.AST_NODE_TYPES.BinaryExpression:case Z.AST_NODE_TYPES.UnaryExpression:case Z.AST_NODE_TYPES.CallExpression:case Z.AST_NODE_TYPES.MemberExpression:case Z.AST_NODE_TYPES.Identifier:case Z.AST_NODE_TYPES.ArrowFunctionExpression:case Z.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===Z.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===Z.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==Z.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===Z.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var He=require("@typescript-eslint/utils"),Ne=Ee(require("zod/v4"));var Ki=Ne.object({alternativeMsgs:Ne.object({inArrayFind:Ne.string().optional(),inArrayFilter:Ne.string().optional()}).optional(),__dev_simulateFileName:Ne.string().optional()});function Qi(e){return e.typeAnnotation.type!==He.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var es=/(typeGuards|type-guards)\.(ts|tsx)$/;function ts(e){return es.test(e)}function ns(e){let t=e.parent;for(;t;){if(t.type===He.AST_NODE_TYPES.CallExpression&&t.callee.type===He.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===He.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var kt=J({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:[$(Ki)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ts(r))return{};function n(o){if(!Qi(o))return;let a=ns(o);if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.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)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var De=require("@typescript-eslint/utils");var rs="no-unnecessary-async-on-jsx-props";function is(e){if(e.body.type!==De.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==De.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===De.AST_NODE_TYPES.AwaitExpression}var Ft=J({name:rs,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 t(r){is(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===De.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===De.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===De.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Ce=require("@typescript-eslint/utils"),Pt=Ee(require("typescript")),_e=Ee(require("zod/v4"));var ss=Ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="no-unnecessary-casting",os=_e.default.object({additionalCastFunctions:_e.default.array(_e.default.object({name:_e.default.string(),expectedType:_e.default.enum(["string","number"])})).optional()}),Ot={name:jn,rule:ss({name:jn,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:[$(os)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Ce.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,m){switch(c.type){case Ce.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Ce.AST_NODE_TYPES.TemplateLiteral:return m==="string";case Ce.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&Pt.TypeFlags.NumberLike):!!(c.flags&Pt.TypeFlags.StringLike)}function l(c,m){return f=>f.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!a||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Ce.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=c;if(f.type!==Ce.AST_NODE_TYPES.Identifier)return;let d=f.name,y=n.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,u;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...u?{data:u}:{},fix:l(c,m)})}}return{CallExpression:p}}})};var Je=require("@typescript-eslint/utils"),ye=Ee(require("zod/v4"));var as=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),Nt=J({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:[$(as)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===Je.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Je.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==Je.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Je.AST_NODE_TYPES.CallExpression){let c=a(p);c&&o(c)&&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 Dt=J({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(t){if(t.id.type===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.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||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=ls(t,e.sourceCode);if(n.length===0)return;let o=t.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 n){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 ls(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var H=require("@typescript-eslint/utils"),Fe=require("zod/v4");var ps=Fe.z.object({selectors:Fe.z.array(Fe.z.object({name:Fe.z.string(),selectorProp:Fe.z.string().optional(),selectorArgPos:Fe.z.number().optional(),returnProp:Fe.z.string().optional()}))}),cs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ln="no-unused-selected-values",Mt={name:Ln,rule:cs({name:Ln,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(ps)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===H.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=fs(a);if(!i)return;let s=n.get(i);if(!s)return;let l=us(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ms(l);if(!p)return;let c=_n(p.properties,void 0);if(!c)return;if(o.id.type===H.AST_NODE_TYPES.ObjectPattern){let d=_n(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of c)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==H.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=ds(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==H.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==H.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of c)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function us(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===H.AST_NODE_TYPES.ArrowFunctionExpression||n.type===H.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===H.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===H.AST_NODE_TYPES.Property&&i.key.type===H.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==H.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===H.AST_NODE_TYPES.ArrowFunctionExpression||a.type===H.AST_NODE_TYPES.FunctionExpression)return a}return null}function fs(e){return e.callee.type===H.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===H.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===H.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ms(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function _n(e,t){let r=e;if(t){let o=e.find(a=>a.type===H.AST_NODE_TYPES.Property&&a.key.type===H.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==H.AST_NODE_TYPES.Property||o.value.type!==H.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==H.AST_NODE_TYPES.Property||o.key.type!==H.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ds(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var Y=require("@typescript-eslint/utils");var jt=J({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===Y.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=ys(a);s&&(n=s);return}let i=gs(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function ys(e){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==Y.AST_NODE_TYPES.ObjectExpression)return null;let n=It(r.properties,a=>a.type!==Y.AST_NODE_TYPES.Property||a.key.type!==Y.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===Y.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===Y.AST_NODE_TYPES.FunctionExpression?Ss(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===Y.AST_NODE_TYPES.Property&&a.key.type===Y.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function gs(e,t){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==Y.AST_NODE_TYPES.ObjectPattern||!It(e.parent.id.properties,i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Pn(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==Y.AST_NODE_TYPES.Identifier||i.parent.type===Y.AST_NODE_TYPES.Property&&i.parent.parent.type===Y.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===Y.AST_NODE_TYPES.ReturnStatement||i.parent.type===Y.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===Y.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==Y.AST_NODE_TYPES.Identifier||i.parent.property.type!==Y.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ss(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var W=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Ts=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $n(e){let t=[];for(let r of e.members)r.type===W.AST_NODE_TYPES.TSPropertySignature&&r.key.type===W.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Un(e,...t){for(let r of t)e.set(...r);return e}var hs=Ye.z.object({forceCheckOnFCPropTypesWithName:Ye.z.array(Ye.z.string()).optional(),alwaysCheckFunctionOptionTypes:Ye.z.boolean().optional()}),zn="no-unused-type-props-in-args",Lt=null,Es=Ts({name:zn,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:[$(hs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!Lt&&(Lt=r.map(l=>new RegExp(l)));function o(l,p,c,m,f=!0,d=!1){let y=c.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&Lt?.some(g=>g.test(y)),u=d&&n;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===W.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!u)){if(x.type===W.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===W.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,c,m,f,d=!1){if(m.type===W.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===W.AST_NODE_TYPES.TSPropertySignature&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.set(y.key.name,y);return}if(m.type===W.AST_NODE_TYPES.TSTypeLiteral){Un(c,...$n(m));return}if(m.type===W.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)a(l,p,c,y,!0,d);return}f||m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier&&o(l,p,m.typeName,c,!0,d)}function i(l,p,c,m=!1){for(let f of c)if(f.type===W.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===W.AST_NODE_TYPES.AssignmentPattern&&f.left.type===W.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let c=[];if(l.properties.at(-1)?.type===W.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===W.AST_NODE_TYPES.Property&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.push(y.key.name);let f=[],d=[];for(let[y,E]of p)c.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 u=l.properties.at(-1),x=d.join(", ");return u?u.type===W.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(u,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],c=new Map,m=p.id.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier)o(!0,l,m.typeName,c,!1);else if(m.type===W.AST_NODE_TYPES.TSTypeLiteral)Un(c,...$n(m));else if(m.type===W.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===W.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===W.AST_NODE_TYPES.Identifier?o(!0,l,f.typeName,c,!1):a(!0,l,c,f,!0);if(c.size!==0&&p.init?.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===W.AST_NODE_TYPES.ObjectPattern&&s(f,c)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),_t={name:zn,rule:Es};var ue=require("@typescript-eslint/utils");var $t=J({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 t=new Set;function r(n){return n.callee.type===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(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:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var $e=require("@typescript-eslint/utils"),xs=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="prefer-named-functions",Wn=new Map,bs=xs({name:Vn,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,[t]){let r=null;if(t.ignoreRegex){let n=Wn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Wn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===$e.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===$e.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==$e.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ut={name:Vn,rule:bs};var M=require("@typescript-eslint/utils"),ge=require("zod/v4");var Cs=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()}))}),Is=/^use[A-Z]/,Rs=/^[A-Z]/;function rt(e){return Is.test(e)}function Hn(e){return Rs.test(e)}function As(e){return e.type===M.AST_NODE_TYPES.Identifier?rt(e.name):e.type===M.AST_NODE_TYPES.MemberExpression&&e.property.type===M.AST_NODE_TYPES.Identifier?rt(e.property.name):!1}function Jn(e,t){return e.type===M.AST_NODE_TYPES.Identifier?e.name===t:e.type===M.AST_NODE_TYPES.MemberExpression&&e.object.type===M.AST_NODE_TYPES.Identifier&&e.property.type===M.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Yn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"forwardRef"))}function Xn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"memo"))}function zt(e){if(e.type===M.AST_NODE_TYPES.FunctionDeclaration||e.type===M.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.AST_NODE_TYPES.FunctionExpression||e.type===M.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===M.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ws(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.AST_NODE_TYPES.FunctionDeclaration||t.type===M.AST_NODE_TYPES.FunctionExpression||t.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(t);if(n&&n.type===M.AST_NODE_TYPES.Identifier){if(Hn(n.name)||rt(n.name))return!r;r=!0}else{if(Yn(t)||Xn(t))return!r;if(t.parent.type===M.AST_NODE_TYPES.CallExpression){let o=t.parent;As(o.callee)||(r=!0)}else t.parent.type===M.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Bn(e){return e.callee.type===M.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===M.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===M.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function vs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.AST_NODE_TYPES.FunctionDeclaration||r.type===M.AST_NODE_TYPES.FunctionExpression||r.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(r);if(n&&n.type===M.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===M.AST_NODE_TYPES.CallExpression){let n=Bn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ks(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Fs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.AST_NODE_TYPES.FunctionDeclaration||n.type===M.AST_NODE_TYPES.FunctionExpression||n.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let o=zt(n);if(o&&o.type===M.AST_NODE_TYPES.Identifier){if(Hn(o.name)||rt(o.name)){r=!0;break}}else if(Yn(n)||Xn(n)){r=!0;break}}n=n.parent}return r?t.length===0?ws(e):!vs(e,t):!1}var Wt=J({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:[$(Cs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Bn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ks(o))return;let s=i.allowUseInside||[];Fs(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.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===M.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var B=require("@typescript-eslint/utils"),it=Ee(require("zod/v4"));var Ps=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="prefer-single-line-if",Os=it.default.object({maxLineLength:it.default.number().optional(),maxNonSimpleConditionLength:it.default.number().optional()}),Ns=Ps({name:Gn,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,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==B.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(!a)return;if(a.type===B.AST_NODE_TYPES.ReturnStatement){if(!Kn(a))return}else if(!(a.type===B.AST_NODE_TYPES.ContinueStatement||a.type===B.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===B.AST_NODE_TYPES.LogicalExpression||n.test.type===B.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=qn(n.test);if(!m&&n.test.type===B.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;qn(f)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
+ `))return;let l=r.getTokenAfter(n);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=Ds(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,c)})}}}});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&&Zn(e)}function Zn(e){return e.object.type===B.AST_NODE_TYPES.MemberExpression?Zn(e.object):e.object.type!==B.AST_NODE_TYPES.Identifier}function Ds(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Kn(e){if(!e.argument)return!0;let t=e.argument;return t.type===B.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===B.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===B.AST_NODE_TYPES.Literal||t.type===B.AST_NODE_TYPES.Identifier||t.type===B.AST_NODE_TYPES.TemplateLiteral||t.type===B.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===B.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===B.AST_NODE_TYPES.UnaryExpression?Kn(t):!1}var Vt={name:Gn,rule:Ns};var D=require("@typescript-eslint/utils"),Ht=require("zod/v4");var Ms=D.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="react-compiler-extra",js=Ht.z.object({runOnlyWithEnableCompilerDirective:Ht.z.boolean().optional()}),Ls=/eslint +react-compiler\/react-compiler: +\["error/;function or(e){return e.type===D.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function Se(e){if(!e)return!1;switch(e.type){case D.AST_NODE_TYPES.JSXElement:case D.AST_NODE_TYPES.JSXFragment:return!0;case D.AST_NODE_TYPES.ConditionalExpression:return Se(e.consequent)||Se(e.alternate);case D.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Se(e.right):e.operator==="||"?Se(e.left)||Se(e.right):!1;case D.AST_NODE_TYPES.CallExpression:if(e.callee.type===D.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===D.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===D.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==D.AST_NODE_TYPES.SpreadElement&&Se(t))return!0;return!1;default:return!1}}function _s(e){let t=e.typeAnnotation;if(t.type===D.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===D.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===D.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===D.AST_NODE_TYPES.Identifier&&t.typeName.right.type===D.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var $s=/^[A-Z][a-zA-Z0-9]*$/;function Qn(e){return $s.test(e)}function er(e){return e.startsWith("use")&&e.length>3}function tr(e,t,r){return r&&_s(r)?t?Qn(t.name):e.type===D.AST_NODE_TYPES.FunctionDeclaration&&e.id?Qn(e.id.name):!0:!!(t&&er(t.name)||e.type===D.AST_NODE_TYPES.FunctionDeclaration&&e.id&&er(e.id.name))}function nr(e){if(e.body.type===D.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===D.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===D.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Us(e,t){let r={containsJSX:!1,containsHookCalls:!1};return On(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case D.AST_NODE_TYPES.JSXElement:case D.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case D.AST_NODE_TYPES.CallExpression:or(n.callee)&&(r.containsHookCalls=!0),Se(n)&&(r.containsJSX=!0);break;case D.AST_NODE_TYPES.ReturnStatement:n.argument&&Se(n.argument)&&(r.containsJSX=!0);break;case D.AST_NODE_TYPES.VariableDeclarator:n.init&&Se(n.init)&&(r.containsJSX=!0);break;case D.AST_NODE_TYPES.AssignmentExpression:Se(n.right)&&(r.containsJSX=!0);break}},t),r}function rr(e,t){let r=e.body,n=Us(r,t);return n.containsJSX||n.containsHookCalls}var zs=/\bthis[.[]/;function ir(e){return zs.test(e)}var Ws=Ms({name:sr,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:"React components and hooks should create JSX elements or call other hooks for optimal React compiler detection.",addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization'},hasSuggestions:!0,schema:[$(js)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(Ls.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===D.AST_NODE_TYPES.Property&&i.method&&i.value.type===D.AST_NODE_TYPES.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(ir(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(d=>s.getText(d)).join(", "),f="";p.generator?f=`${l}: function* (${m}) ${c}`:f=`${l}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,f)})}}}function o(a){for(let i of a.properties)if(i.type===D.AST_NODE_TYPES.Property&&i.value.type===D.AST_NODE_TYPES.ObjectExpression){for(let s of i.value.properties)if(s.type===D.AST_NODE_TYPES.Property&&s.method&&s.value.type===D.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(s.value.body);ir(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(or(a.callee))for(let i of a.arguments){if(i.type===D.AST_NODE_TYPES.ObjectExpression&&(n(i),o(i)),i.type===D.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===D.AST_NODE_TYPES.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===D.AST_NODE_TYPES.BlockStatement))for(let s of i.body.body)s.type===D.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===D.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===D.AST_NODE_TYPES.FunctionExpression)for(let s of i.body.body)s.type===D.AST_NODE_TYPES.ReturnStatement&&s.argument?.type===D.AST_NODE_TYPES.ObjectExpression&&(n(s.argument),o(s.argument))}},VariableDeclarator(a){if(a.id.type===D.AST_NODE_TYPES.Identifier&&a.init&&(a.init.type===D.AST_NODE_TYPES.ArrowFunctionExpression||a.init.type===D.AST_NODE_TYPES.FunctionExpression)){let i=a.init,s=a.id,l=a.id.typeAnnotation;if(tr(i,s,l)){let p=rr(i,e.sourceCode),c=nr(i);!p&&!c&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===D.AST_NODE_TYPES.BlockStatement){let f=i.body.range[0]+1;return m.insertTextAfterRange([f,f],`
17
17
  "use memo"
18
18
  `)}return null}}]})}}},FunctionDeclaration(a){if(tr(a)){let i=rr(a,e.sourceCode),s=nr(a);!i&&!s&&e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let p=a.body.range[0]+1;return l.insertTextAfterRange([p,p],`
19
19
  "use memo"
20
- `)}}]})}}}}}),Jt={name:sr,rule:Ws};var se=require("@typescript-eslint/utils"),me=require("zod/v4");var Vs=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="react-compiler-migration",Hs=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()}),Js=/eslint +react-compiler\/react-compiler: +\["error/;function Ys(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 Xs=Vs({name:ar,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:[$(Hs)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Js.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===se.AST_NODE_TYPES.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===se.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===se.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&Ys(n.callee)){for(let o of n.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=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===se.AST_NODE_TYPES.Property&&c.key.type===se.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===se.AST_NODE_TYPES.Literal&&c.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}]})}}}}}}:{}}}),Yt={name:ar,rule:Xs};var st=require("@typescript-eslint/utils"),Bs=st.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="require-description",qs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Gs=/^eslint-disable-(next-)?line$/u,Zs=Bs({name:lr,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,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Ks(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:to(o.loc),messageId:"missingDescription"}))}}}}}),pr={name:lr,rule:Zs};function Ks(e){let{text:t,description:r}=eo(e.value);if(!t)return null;let n=qs.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Gs.test(o);if(e.type===st.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Qs=/\s-{2,}\s/u;function eo(e){let t=e.split(Qs);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function to(e){return{start:{line:e.start.line,column:-1},end:e.end}}var U=require("@typescript-eslint/utils"),Te=require("zod/v4");var no=Te.z.object({varsToCheck:Te.z.array(Te.z.object({selector:Te.z.string().optional(),fromFnCall:Te.z.string().optional(),prop:Te.z.string().or(Te.z.array(Te.z.string())),errorMsg:Te.z.string().optional()}))}),Xt=J({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:[$(no)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,s,l,p){let c=new Set;for(let f of i.properties)f.type===U.AST_NODE_TYPES.Property&&f.key.type===U.AST_NODE_TYPES.Identifier&&c.add(f.key.name);let m=s.filter(f=>!c.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===U.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===U.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===U.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 t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.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===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==U.AST_NODE_TYPES.MemberExpression||c.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let m=c.parent;if(m.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let f=m.parent;if(f.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=m=>{if(m.type!==U.AST_NODE_TYPES.MemberExpression||m.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let f=m.parent;if(f.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let d=f.parent;if(d.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==U.AST_NODE_TYPES.Identifier||p.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let m=c.parent;if(m.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]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===U.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===U.AST_NODE_TYPES.ObjectPattern){for(let u of h.id.properties)u.type===U.AST_NODE_TYPES.Property&&u.key.type===U.AST_NODE_TYPES.Identifier&&d.has(u.key.name)&&d.delete(u.key.name);if(d.size===0)break;continue}if(!(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.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:c,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:c,customMsg:l||""}})}}}}}}}});function fr(e){return/^use[A-Z0-9]/.test(e)}function ot(e){return e.type==="Identifier"?fr(e.name):e.type==="MemberExpression"&&!e.computed&&ot(e.property)?e.object.type==="Identifier":!1}function mr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function dr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function yr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"forwardRef"))}function gr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"memo"))}function Bt(e){for(;e;){let t=Tr(e);if(t&&(mr(t)||ot(t))||yr(e)||gr(e))return!0;e=e.parent}return!1}function cr(e){return!1}function qt(e){return!1}var ro=/eslint +react-compiler\/react-compiler: +\["error/,Sr={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(ro.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&cr(c.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 c=o.pop();if(c.size===0)return;let m=new Set;function f(g,A){let{cache:S}=f,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=[...v],D=R.slice(R.indexOf(g.id)+1);for(let _ of D)m.add(_);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,A){let{cache:S}=d,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=Array.from(v),D=R.slice(R.indexOf(g.id)+1);for(let _ of D)m.add(_);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:A}=y,S=A.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(A.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 A.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),u=Bt(p),x=h?mr(h)||ot(h):yr(p)||gr(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let A=y(g);A<b&&(b=A)}for(let[g,A]of c){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 A)if(v&&!qt(R)&&e.report({node:R,message:`React Hook "${t(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 "${t(R)}" cannot be called in an async function.`}),!v&&I!==E&&!qt(R)){let _=`React Hook "${t(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:_})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let D=`React Hook "${t(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:D})}else if(h){let D=`React Hook "${t(R)}" is called in function "${t(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:D})}else if(p.type==="Program"){let D=`React Hook "${t(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:D})}else if(u&&!qt(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let _=p.parent;if(_.parent.type==="VariableDeclarator"&&fr(_.parent.id.name))return}let D=`React Hook "${t(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:D})}}},CallExpression(l){if(ot(l.callee)){let p=ur(o),c=ur(a),m=p.get(c);m||(m=[],p.set(c,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||cr(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(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===n&&(n=null)},FunctionDeclaration(l){Bt(l)&&s(r(l))},ArrowFunctionExpression(l){Bt(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 ur(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),oe=Ee(require("zod/v4"));var io=/^\s+$/,Gt=/\r?\n/,so=/^(\s*)/,oo=/^(\s*)\S/,ao=/\r?\n/,lo=oe.object({indent:oe.union([oe.string().regex(io),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Zt=J({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(lo)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let x=u.split(Gt),b=x.filter(A=>A.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let A of b){let S=A.match(so);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:x.map(A=>A.slice(g)).join(`
20
+ `)}}]})}}}}}),Jt={name:sr,rule:Ws};var se=require("@typescript-eslint/utils"),me=require("zod/v4");var Vs=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="react-compiler-migration",Hs=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()}),Js=/eslint +react-compiler\/react-compiler: +\["error/;function Ys(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 Xs=Vs({name:ar,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:[$(Hs)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Js.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===se.AST_NODE_TYPES.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===se.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===se.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&Ys(n.callee)){for(let o of n.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=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===se.AST_NODE_TYPES.Property&&c.key.type===se.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===se.AST_NODE_TYPES.Literal&&c.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}]})}}}}}}:{}}}),Yt={name:ar,rule:Xs};var st=require("@typescript-eslint/utils"),Bs=st.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="require-description",qs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Gs=/^eslint-disable-(next-)?line$/u,Zs=Bs({name:lr,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,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Ks(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:to(o.loc),messageId:"missingDescription"}))}}}}}),pr={name:lr,rule:Zs};function Ks(e){let{text:t,description:r}=eo(e.value);if(!t)return null;let n=qs.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Gs.test(o);if(e.type===st.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Qs=/\s-{2,}\s/u;function eo(e){let t=e.split(Qs);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function to(e){return{start:{line:e.start.line,column:-1},end:e.end}}var U=require("@typescript-eslint/utils"),Te=require("zod/v4");var no=Te.z.object({varsToCheck:Te.z.array(Te.z.object({selector:Te.z.string().optional(),fromFnCall:Te.z.string().optional(),prop:Te.z.string().or(Te.z.array(Te.z.string())),errorMsg:Te.z.string().optional()}))}),Xt=J({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:[$(no)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,s,l,p){let c=new Set;for(let f of i.properties)f.type===U.AST_NODE_TYPES.Property&&f.key.type===U.AST_NODE_TYPES.Identifier&&c.add(f.key.name);let m=s.filter(f=>!c.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===U.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===U.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===U.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 t.varsToCheck)i.selector&&(a[i.selector]=s=>{if(s.type===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.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===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==U.AST_NODE_TYPES.MemberExpression||c.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let m=c.parent;if(m.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let f=m.parent;if(f.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=m=>{if(m.type!==U.AST_NODE_TYPES.MemberExpression||m.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let f=m.parent;if(f.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let d=f.parent;if(d.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==U.AST_NODE_TYPES.Identifier||p.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let m=c.parent;if(m.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]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===U.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===U.AST_NODE_TYPES.ObjectPattern){for(let u of h.id.properties)u.type===U.AST_NODE_TYPES.Property&&u.key.type===U.AST_NODE_TYPES.Identifier&&d.has(u.key.name)&&d.delete(u.key.name);if(d.size===0)break;continue}if(!(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.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:c,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:c,customMsg:l||""}})}}}}}}}});function fr(e){return/^use[A-Z0-9]/.test(e)}function ot(e){return e.type==="Identifier"?fr(e.name):e.type==="MemberExpression"&&!e.computed&&ot(e.property)?e.object.type==="Identifier":!1}function mr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function dr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function yr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"forwardRef"))}function gr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"memo"))}function Bt(e){for(;e;){let t=Tr(e);if(t&&(mr(t)||ot(t))||yr(e)||gr(e))return!0;e=e.parent}return!1}function cr(e){return!1}function qt(e){return!1}var ro=/eslint +react-compiler\/react-compiler: +\["error/,Sr={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(ro.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&cr(c.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 c=o.pop();if(c.size===0)return;let m=new Set;function f(g,A){let{cache:S}=f,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=[...v],N=R.slice(R.indexOf(g.id)+1);for(let _ of N)m.add(_);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,A){let{cache:S}=d,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=Array.from(v),N=R.slice(R.indexOf(g.id)+1);for(let _ of N)m.add(_);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:A}=y,S=A.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(A.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 A.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),u=Bt(p),x=h?mr(h)||ot(h):yr(p)||gr(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let A=y(g);A<b&&(b=A)}for(let[g,A]of c){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 A)if(v&&!qt(R)&&e.report({node:R,message:`React Hook "${t(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 "${t(R)}" cannot be called in an async function.`}),!v&&I!==E&&!qt(R)){let _=`React Hook "${t(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:_})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`React Hook "${t(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 "${t(R)}" is called in function "${t(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 "${t(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(u&&!qt(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let _=p.parent;if(_.parent.type==="VariableDeclarator"&&fr(_.parent.id.name))return}let N=`React Hook "${t(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(ot(l.callee)){let p=ur(o),c=ur(a),m=p.get(c);m||(m=[],p.set(c,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||cr(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(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===n&&(n=null)},FunctionDeclaration(l){Bt(l)&&s(r(l))},ArrowFunctionExpression(l){Bt(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 ur(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),oe=Ee(require("zod/v4"));var io=/^\s+$/,Gt=/\r?\n/,so=/^(\s*)/,oo=/^(\s*)\S/,ao=/\r?\n/,lo=oe.object({indent:oe.union([oe.string().regex(io),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Zt=J({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(lo)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let x=u.split(Gt),b=x.filter(A=>A.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let A of b){let S=A.match(so);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:x.map(A=>A.slice(g)).join(`
21
21
  `)}function l(u,x,b){return u.split(Gt).map(A=>A.trim()===""?A:b.repeat(x)+A).join(`
22
22
  `)}function p(u){if(u.type===Q.AST_NODE_TYPES.Identifier)return u.name;if(u.type===Q.AST_NODE_TYPES.MemberExpression){let x=u.object.type===Q.AST_NODE_TYPES.Identifier?u.object.name:null,b=u.property.type===Q.AST_NODE_TYPES.Identifier?u.property.name:null;return x&&b?`${x}.${b}`:b}return null}function c(u,x){if(!u)return!1;for(let b of x)if(b.includes(".")){let g=b.split(".");if(u.type===Q.AST_NODE_TYPES.MemberExpression&&u.object.type===Q.AST_NODE_TYPES.Identifier&&u.property.type===Q.AST_NODE_TYPES.Identifier&&u.object.name===g[0]&&u.property.name===g[1])return!0}else if(u.type===Q.AST_NODE_TYPES.Identifier&&u.name===b)return!0;return!1}function m(u,x){let b=u.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?x.includes(g):!1}function f(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:A=!0,optionalMember:S=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&u.callee.optional||u.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.property.name===b}function d(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:A=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.name===b}function y(u){return f(u.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments[0]===u&&d(u.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?u.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(u){if(i.length>0){let x=t.getTokenBefore(u,{includeComments:!0});if(x?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(x.value.trim().toLowerCase()))return!0}return!!(y(u)||o.length>0&&m(u,o)||n.length>0&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments.includes(u)&&c(u.parent.callee,n))}function h(u){let x=`__PLACEHOLDER__${Math.random()}`,b=u.quasis.map(X=>t.getText(X).slice(1,X.tail?-1:-2)).join(x),g=b.match(ao);if(!g)return;let A=g[0],S=t.lines[t.getLocFromIndex(u.range[0]).line-1];if(!S)return;let v=S.match(oo)?.[1]??"",R;typeof a=="string"?R=a:typeof a=="number"?R=" ".repeat(a):R=v.startsWith(" ")?" ":" ";let _=s(b).replace(new RegExp(`^${A}|${A}[ ]*$`,"g"),""),K=A+l(_,1,v+R)+A+v,q=b.includes(`\r
23
23
  `)?`\r
24
24
  `:`
25
- `,ee=b.split(Gt),te=ee.map((X,de)=>de!==ee.length-1&&X===R+v?"":X).join(q);if(K!==te)return{node:u,messageId:"improperlyIndented",fix:X=>K.split(x).map((de,Me)=>{let ie=u.quasis[Me];return ie?X.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],de):[]}).flat()}}return{TemplateLiteral(u){if(!E(u))return;let x=h(u);if(x)return e.report(x)}}}});var Kt=require("@typescript-eslint/utils");function po(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function co(e){let t=e.parent;return t?.type===Kt.AST_NODE_TYPES.NewExpression&&t.callee.type===Kt.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Qt=J({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){po(r)||co(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var ae=require("@typescript-eslint/utils"),Ue=require("zod/v4");var uo=Ue.z.object({checkOnly:Ue.z.array(Ue.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Ue.z.array(Ue.z.string()).optional()}),en=J({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[$(uo)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function a(f){for(let d of o)if(f.range[0]>=d.range[0]&&f.range[1]<=d.range[1])return d;return null}function i(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.FunctionDeclaration||d.type===ae.AST_NODE_TYPES.FunctionExpression||d.type===ae.AST_NODE_TYPES.ArrowFunctionExpression){let y=d.params;for(let E of y)if(f.range[0]>=E.range[0]&&f.range[1]<=E.range[1])return!0;break}d=d.parent}return!1}function s(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.TSQualifiedName&&y.typeName.right.name==="FC")return!0}d=d.parent}return!1}function l(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.CallExpression||y.type===ae.AST_NODE_TYPES.NewExpression)return!0}d=d.parent}return!1}let p=[];function c(f){let d=[],y=new Map;for(let{typeName:h,firstUsage:u}of f){let x=y.get(u)||[];x.push(h),y.set(u,x)}for(let{typeName:h,firstUsage:u,firstUsagePosition:x,firstUsageInFunctionArgs:b}of f){let g=n.get(h);if(!g||g.statement===u)continue;let A=o.indexOf(g.statement),S=o.indexOf(u);if(A===-1||S===-1)continue;let I=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),R=(y.get(u)||[]).length>1;(I||R?A>S:A>S||A!==S-1)&&d.push({typeName:h,typeDef:g,targetStatement:u,firstUsagePosition:x})}if(d.length===0)return;d.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=o.indexOf(h.typeDef.statement),g=o.indexOf(u.typeDef.statement);return b-g});let E=d[0];E&&e.report({node:E.typeDef.node,messageId:"moveTypeAboveUsage",fix:m(d)})}function m(f){return function*(d){let y=new Map;for(let E of f){let h=y.get(E.targetStatement)||[];h.push(E),y.set(E.targetStatement,h)}for(let[,E]of y)E.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=o.indexOf(h.typeDef.statement),g=o.indexOf(u.typeDef.statement);return b-g});for(let E of f){let{typeDef:h}=E,u=h.statement,x=r.getCommentsBefore(u),b=u.range[0],g=u.range[1];x.length>0&&x[0]&&(b=x[0].range[0]),yield d.removeRange([b,g])}for(let[E,h]of y){let u=r.getCommentsBefore(E),x=u.length>0&&u[0]?u[0].range[0]:E.range[0],b=[];for(let g of h){let A=g.typeDef.statement,S=r.getText(A),I=r.getCommentsBefore(A),v=S;I.length>0&&(v=`${I.map(D=>r.getText(D)).join(`
25
+ `,ee=b.split(Gt),te=ee.map((X,de)=>de!==ee.length-1&&X===R+v?"":X).join(q);if(K!==te)return{node:u,messageId:"improperlyIndented",fix:X=>K.split(x).map((de,Me)=>{let ie=u.quasis[Me];return ie?X.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],de):[]}).flat()}}return{TemplateLiteral(u){if(!E(u))return;let x=h(u);if(x)return e.report(x)}}}});var Kt=require("@typescript-eslint/utils");function po(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function co(e){let t=e.parent;return t?.type===Kt.AST_NODE_TYPES.NewExpression&&t.callee.type===Kt.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Qt=J({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){po(r)||co(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var ae=require("@typescript-eslint/utils"),Ue=require("zod/v4");var uo=Ue.z.object({checkOnly:Ue.z.array(Ue.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Ue.z.array(Ue.z.string()).optional()}),en=J({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[$(uo)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function a(f){for(let d of o)if(f.range[0]>=d.range[0]&&f.range[1]<=d.range[1])return d;return null}function i(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.FunctionDeclaration||d.type===ae.AST_NODE_TYPES.FunctionExpression||d.type===ae.AST_NODE_TYPES.ArrowFunctionExpression){let y=d.params;for(let E of y)if(f.range[0]>=E.range[0]&&f.range[1]<=E.range[1])return!0;break}d=d.parent}return!1}function s(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.TSQualifiedName&&y.typeName.right.name==="FC")return!0}d=d.parent}return!1}function l(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.CallExpression||y.type===ae.AST_NODE_TYPES.NewExpression)return!0}d=d.parent}return!1}let p=[];function c(f){let d=[],y=new Map;for(let{typeName:h,firstUsage:u}of f){let x=y.get(u)||[];x.push(h),y.set(u,x)}for(let{typeName:h,firstUsage:u,firstUsagePosition:x,firstUsageInFunctionArgs:b}of f){let g=n.get(h);if(!g||g.statement===u)continue;let A=o.indexOf(g.statement),S=o.indexOf(u);if(A===-1||S===-1)continue;let I=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),R=(y.get(u)||[]).length>1;(I||R?A>S:A>S||A!==S-1)&&d.push({typeName:h,typeDef:g,targetStatement:u,firstUsagePosition:x})}if(d.length===0)return;d.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=o.indexOf(h.typeDef.statement),g=o.indexOf(u.typeDef.statement);return b-g});let E=d[0];E&&e.report({node:E.typeDef.node,messageId:"moveTypeAboveUsage",fix:m(d)})}function m(f){return function*(d){let y=new Map;for(let E of f){let h=y.get(E.targetStatement)||[];h.push(E),y.set(E.targetStatement,h)}for(let[,E]of y)E.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=o.indexOf(h.typeDef.statement),g=o.indexOf(u.typeDef.statement);return b-g});for(let E of f){let{typeDef:h}=E,u=h.statement,x=r.getCommentsBefore(u),b=u.range[0],g=u.range[1];x.length>0&&x[0]&&(b=x[0].range[0]),yield d.removeRange([b,g])}for(let[E,h]of y){let u=r.getCommentsBefore(E),x=u.length>0&&u[0]?u[0].range[0]:E.range[0],b=[];for(let g of h){let A=g.typeDef.statement,S=r.getText(A),I=r.getCommentsBefore(A),v=S;I.length>0&&(v=`${I.map(N=>r.getText(N)).join(`
26
26
  `)}
27
27
  ${S}`),b.push(v)}yield d.insertTextBeforeRange([x,x],`${b.join(`
28
28
 
@@ -13,7 +13,7 @@ useEffect(() => {
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
15
  Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),I=new Set,w=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;w=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 F=C.node.parent;if(F==null&&(st(w.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.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 P=C.node.id,{name:M}=O;if(M==="useRef"&&P.type==="Identifier")return!0;if(Pr(O)&&P.type==="Identifier"){for(let L of T.references)L!==P&&d.add(L.identifier);return!0}else if(M==="useState"||M==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&R(T.identifiers)){if(P.elements[1]===T.identifiers[0]){if(M==="useState"){let L=T.references,pe=0;for(let Se=0;Se<L.length;Se++){if(L[Se].isWrite()&&pe++,pe>1)return!1;p.set(L[Se].identifier,P.elements[0])}}return!0}else if(P.elements[0]===T.identifiers[0]){if(M==="useState"){let L=T.references;for(let pe=0;pe<L.length;pe++)c.add(L[pe].identifier)}return!1}}}else if(M==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(T.identifiers)&&P.elements[1]===T.identifiers[0])return!0;return!1}function _(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,F=w.childScopes,O=null,P;for(P=0;P<F.length;P++){let M=F[P],L=M.block;if(k.type==="FunctionDeclaration"&&L===k||k.type==="VariableDeclarator"&&L.parent===k){O=M;break}}if(O==null)return!1;for(P=0;P<O.through.length;P++){let M=O.through[P];if(M.resolved!=null&&I.has(M.resolved.scope)&&!G(M.resolved))return!1}return!0}let G=y(N,m),B=y(_,f),Q=new Map;function ee(T){let C=T.from,k=!1;for(;C.block!==u;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let Y=new Map,me=new Map;ke(S);function ke(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=st(u,C.identifier),F=rn(k),O=Te(F,me);if(A&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&ee(C)&&Q.set(O,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let P=C.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(Y.has(O))Y.get(O).references.push(C);else{let M=C.resolved,L=G(M)||B(M);Y.set(O,{isStable:L,references:[C]})}}for(let C of T.childScopes)ke(C)}Q.forEach(({reference:T,dependencyNode:C},k)=>{let F=T.resolved.references,O=!1;for(let P=0;P<F.length;P++){let{identifier:M}=F[P],{parent:L}=M;if(L!=null&&L.type==="MemberExpression"&&!L.computed&&L.property.type==="Identifier"&&L.property.name==="current"&&L.parent.type==="AssignmentExpression"&&L.parent.left===L){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 xe(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(Y.forEach(({isStable:T,references:C},k)=>{T&&le.add(k),C.forEach(F=>{F.writeExpr&&xe(F.writeExpr,k)})}),re.size>0)return;if(!x){let T=null;if(Y.forEach(({isStable:C,references:k},F)=>{T||k.forEach(O=>{if(T)return;let P=O.identifier;if(!p.has(P))return;let L=O.from;for(;L.type!=="function";)L=L.upper;L.block===u&&(T=F)})}),T){let{suggestedDependencies:C}=rt({dependencies:Y,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(u,`, [${C.join(", ")}]`)}}]})}return}let Re=[],Ne=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=Te(T,me)}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 F=!w.through.some(O=>O.identifier===k);Re.push({key:C,node:T}),F||Ne.add(C)});let{suggestedDependencies:mr,unnecessaryDependencies:$e,missingDependencies:be,duplicateDependencies:Yt}=rt({dependencies:Y,declaredDependencies:Re,stableDependencies:le,externalDependencies:Ne,isEffect:A}),Ue=mr;if(Yt.size+be.size+$e.size===0){if(t)return;wr({declaredDependencies:Re,declaredDependenciesNode:x,componentScope:w,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:F})=>{let O=F==="function"?"useCallback":"useMemo",P=F==="function"?"definition":"initialization",M=`wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,L=k?`To fix this, ${M}`:`Move it inside the ${g} callback. Alternatively, ${M}`,pe=F==="conditional"||F==="logical expression"?"could make":"makes",Se=`The '${C.name.name}' ${F} ${pe} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${L}`,Xt;k&&C.type==="Variable"&&F==="function"&&(Xt=[{desc:`Wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,fix(Bt){let[yr,gr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Bt.insertTextBefore(C.node.init,yr),Bt.insertTextAfter(C.node.init,gr)]}}]),s({node:C.node,message:Se,suggest:Xt})});return}!A&&be.size>0&&(Ue=rt({dependencies:Y,declaredDependencies:[],stableDependencies:le,externalDependencies:Ne,isEffect:A}).suggestedDependencies);function dr(){if(Re.length===0)return!0;let T=Re.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}dr()&&Ue.sort();function Ke(T){let C=T.split("."),k="";for(let F=0;F<C.length;F++){if(F!==0){let O=C.slice(0,F+1).join("."),P=me.get(O)===!0;k+=P?"?.":"."}k+=C[F]}return k}function Qe(T,C,k,F){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+kr(Array.from(T).sort().map(O=>"'"+Ke(O)+"'"))+`. Either ${F} ${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(Ne.size>0){let C=Array.from(Ne)[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&&be.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 F=0;F<C.length;F++){let O=C[F],P=st(w.block,O.identifier);if(!P){k=!1;break}let M=P.parent;if(M==null){k=!1;break}if(M.type!=="MemberExpression"&&M.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&&be.size>0){let T=null;be.forEach(C=>{if(T)return;let k=w.set.get(C),F=Y.get(C);if(F.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let P=!1,M;for(let L=0;L<F.references.length;L++)if(M=F.references[L].identifier,M!=null&&M.parent!=null&&(M.parent.type==="CallExpression"||M.parent.type==="OptionalCallExpression")&&M.parent.callee===M){P=!0;break}P&&(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&&be.size>0){let T=null;if(be.forEach(C=>{if(T!==null)return;let F=Y.get(C).references,O,P;for(let M=0;M<F.length;M++){for(O=F[M].identifier,P=O.parent;P!=null&&P!==w.block;){if(P.type==="CallExpression"){let L=p.get(P.callee);if(L!=null){if(L.name===C)T={missingDep:C,setter:P.callee.name,form:"updater"};else if(c.has(O))T={missingDep:C,setter:P.callee.name,form:"reducer"};else{let pe=F[M].resolved;if(pe!=null){let Se=pe.defs[0];Se!=null&&Se.type==="Parameter"&&(T={missingDep:C,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.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 `+(Qe(be,"a","missing","include")||Qe($e,"an","unnecessary","exclude")||Qe(Yt,"a","duplicate","omit"))+ue,suggest:[{desc:`Update the dependencies array to be: [${Ue.map(Ke).join(", ")}]`,fix(T){return T.replaceText(x,`[${Ue.map(Ke).join(", ")}]`)}}]})}function h(u){let x=vr(u.callee,i);if(x===-1)return;let b=u.arguments[x],g=u.callee,A=sn(g).name,S=u.arguments[x+1],I=/Effect($|[^a-z])/g.test(A);if(!b){s({node:g,message:`React Hook ${A} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!I)){if(!S&&!I){(A==="useMemo"||A==="useCallback")&&s({node:g,message:`React Hook ${A} 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,A,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let w=n(u).set.get(b.name);if(w==null||w.defs==null)return;let R=w.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,A,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,A,I);return}break}break;default:s({node:g,message:`React Hook ${A} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${A} 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(w){return w.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(Ar.test(u.value))return t=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:u=>h(u)}}};function rt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let u=s(a,h);u.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),t.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 u=h.split("."),x=E;for(let b of u){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,u){let x=h.split("."),b=E;for(let g of x){let A=b.children.get(g);if(!A)return;u(A),b=A}}let p=new Set,c=new Set;m(a,p,c,E=>E);function m(E,h,u,x){E.children.forEach((b,g)=>{let A=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(A);return}if(b.isUsed){h.add(A);return}m(b,h,u,S=>A+"."+S)})}let f=[],d=new Set,y=new Set;return t.forEach(({key:E})=>{c.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 Ce(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 Ce(e.consequent)!=null||Ce(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ce(e.left)!=null||Ce(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ce(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ce(e.expression);case"TSAsExpression":return Ce(e.expression)}return null}function wr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){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=Ce(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 c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!on(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function rn(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)?rn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function it(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Te(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Te(e.object,t),n=Te(e.property,null),o=`${r}.${n}`;return it(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Te(e.object,t),n=Te(e.property,null),o=`${r}.${n}`;return it(e,t,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 n=Te(r.object,t),o=Te(r.property,null),a=`${n}.${o}`;return it(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function sn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function vr(e,t){let r=sn(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&&t&&t.additionalHooks){let n;try{n=Te(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function st(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Fr(n,t))return n;if(on(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(tn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{tn(i)&&(i.parent=n,r.push(i))}))}return null}function kr(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Fr(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function on(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Pr(e){return!1}import{AST_NODE_TYPES as We,ESLintUtils as ln}from"@typescript-eslint/utils";import ie from"typescript";import{z as Or}from"zod/v4";var Nr=ln.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),an="improved-no-unnecessary-condition",Dr=Or.object({}),Mr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],jr=new Set(Mr),ot={name:an,rule:Nr({name:an,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:[$(Dr)]},defaultOptions:[{}],create(e){let t=ln.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===We.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=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&ie.TypeFlags.Any||p.flags&ie.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)c.push(...d);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===We.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===We.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Lr(c,jr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(c);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Fe(p,e),type:c}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Fe(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Fe(p,e),actualType:ze(m),conditionType:c}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Fe(p,e),actualType:ze(m),conditionType:c}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:Fe(p,e),actualType:ze(m),conditionType:c}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:Fe(p,e),type:ze(m)}})}return{BinaryExpression:i}}})};function ze(e){return Array.from(new Set(e)).join(" | ")||"never"}function Fe(e,t){let r=e.argument;return r.type===We.Identifier?r.name:t.sourceCode.getText(r)}function Lr(e,t){return t.has(e)}import{AST_NODE_TYPES as _r,ESLintUtils as $r}from"@typescript-eslint/utils";import{z as at}from"zod/v4";var Ur=$r.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pn="no-call-with-explicit-generics",zr=at.object({functions:at.array(at.string())}),Wr=Ur({name:pn,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:[$(zr)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===_r.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),lt={name:pn,rule:Wr};import{AST_NODE_TYPES as Ve,ESLintUtils as Vr}from"@typescript-eslint/utils";var Hr=Vr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cn="no-call-with-inferred-generics",Jr=Hr({name:cn,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,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Ve.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params.some(c=>!s&&c.type===Ve.TSAnyKeyword||l&&c.type===Ve.TSTypeReference&&c.typeName.type===Ve.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),pt={name:cn,rule:Jr};import{ESLintUtils as Yr}from"@typescript-eslint/utils";var Xr=Yr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mn="no-commented-out-code",Br=["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+/,Gr=/\w=("|'|`)/,Zr=/\w+:\s*('|"|`)/,Kr=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Qr=/\w+-\w+:/,ei=/\w+_\w+:/,ti=/\?\s+\w/,ni=/:\s+\w/,ri=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ii=/^\s*\d+[,}]/,si=/^\s*\[[^\]]*\][,}]/,oi=/^\s*\{[^}]*\}[,}]/,ai=/\.\w+\(/,li=/\[\w+\]/,pi=/^\s*(['"`]).+?\1\s*:/,ci=/^<[A-Z]\w*(\s|>|\/)/,ui=/^<[a-z]+(\s|>|\/)/,fi=/<[A-Z]\w*(\s.*)?>/,mi=/<\/[A-Z]\w*>/,di=/<[a-z]+(\s.*)?>/,yi=/<\/[a-z]+>/,gi=/^\s*[*\s]*$/,Si=/^[a-zA-Z]/,Ti=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,hi=/```[\s\S]*?```/g,Ei=/`[^`]*`/g,un=/[a-zA-Z0-9]/,xi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,bi=/[{}[\]()`=<>]/,Ci=/:\s*(['"`[{(]|\w+\s*=>)/,Ii=/\bif\s*\(|\belse\b|=>/,q={returnStatement:qr,stringAssignment:Gr,objectPropertyWithQuotes:Zr,computedPropertyAssignment:Kr,kebabCaseProperty:Qr,snakeCaseProperty:ei,ternaryOperator:ti,colonWithWord:ni,quotedString:ri,numberWithComma:ii,arrayWithComma:si,objectWithComma:oi,methodCall:ai,arrayAccess:li,quotedPropertyKey:pi,jsxSelfClosing:ci,jsxElement:ui,jsxOpeningTag:fi,jsxClosingTag:mi,htmlOpeningTag:di,htmlClosingTag:yi,jsdocComment:gi};function Ri(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Si.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||xi.test(t)||bi.test(t)||Ci.test(t)||Ii.test(t)?!1:!!(t.includes(":")&&Ti.test(t))}var Ai=[") {","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],wi=["/>","</",q.jsxSelfClosing,q.jsxElement,q.jsxOpeningTag,q.jsxClosingTag,q.htmlOpeningTag,q.htmlClosingTag],fn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],vi=Xr({name:mn,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 t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||q.jsdocComment.test(n))return!1;for(let i of fn)if(a.startsWith(i))return!1;if(n.includes("https://")||Ri(a))return!1;if(o==="Block"){for(let i of wi)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Br)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ai)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(hi);p.some(m=>un.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(Ei);return s.some(p=>un.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=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:fn.join(", ")}})}}}}}),ct={name:mn,rule:vi};import{ESLintUtils as ki,TSESTree as Fi}from"@typescript-eslint/utils";var Pi=ki.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dn="no-default-export",Oi=Pi({name:dn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===Fi.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ut={name:dn,rule:Oi};import{ESLintUtils as Ni}from"@typescript-eslint/utils";var Di=Ni.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yn="no-leaked-text-in-jsx",Mi=[",",";","[","]","(",")"],ji=Di({name:yn,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(t){let r=t.value.trim();if(!r)return;let n="";Mi.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),ft={name:yn,rule:ji};import{AST_NODE_TYPES as De,ESLintUtils as Li}from"@typescript-eslint/utils";var _i=Li.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="no-non-camel-case-functions",$i=/^(\$?[a-z][a-zA-Z0-9]*)$/;function gn(e){if(e.typeName.type!==De.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===De.Identifier&&t.name==="JSX"&&r.name==="Element"}var Ui=_i({name:Sn,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!$i.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===De.TSTypeReference?gn(r):r.type===De.TSUnionType&&r.types.some(o=>o.type===De.TSTypeReference&&gn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),mt={name:Sn,rule:Ui};import{ESLintUtils as Wi,TSESTree as H}from"@typescript-eslint/utils";import{AST_NODE_TYPES as Tn}from"@typescript-eslint/utils";function Pe(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Pe(e.parent,t,r===1/0?r:r-1)}function*dt(e){yield e,e.parent&&(yield*dt(e.parent))}function yt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function En(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===Tn.Property&&a.identifiers[0].parent.key.type===Tn.Identifier&&a.identifiers[0].parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}function hn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function zi(e,t){return e[t]}function xn(e,t,r){let n=r.visitorKeys,o=new Set;function a(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let c=zi(i,p);if(c){if(Array.isArray(c)){for(let m of c)if(hn(m)&&a(m))return!0}else if(hn(c)&&a(c))return!0}}return!1}a(e)}var Vi=Wi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),bn="no-optional-root-props",Hi=Vi({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 t(n){let a=e.sourceCode.getDeclaredVariables(n)[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===H.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===H.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===H.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===H.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Pe(l.parent.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=He(c,e.sourceCode);return m?!(m.parent.type===H.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===H.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===H.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let p=Pe(l,H.AST_NODE_TYPES.VariableDeclaration);return p?!!He(p,e.sourceCode):!1}if(l.type===H.AST_NODE_TYPES.FunctionDeclaration)return!!He(l,e.sourceCode)}return!1}function r(n){n.key.type!==H.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Pe(n,H.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeLiteral&&!(Je(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(Je(n)||!t(n)))for(let o of n.body.body)o.type===H.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==H.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==H.AST_NODE_TYPES.TSTypeLiteral)return;let a=Pe(n.parent,H.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=He(a,e.sourceCode);if(!(!i||i.parent.type===H.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===H.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===H.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Je(e){return e?e.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===H.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function He(e,t){if(Je(e))return;let r;if(e.type===H.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===H.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===H.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.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])&&!Je(a[0].identifier.parent.parent))return a[0].identifier}var gt={name:bn,rule:Hi};import{AST_NODE_TYPES as Ye}from"@typescript-eslint/utils";var Me=V({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 t=new Set;function r(n){return n?n.type===Ye.Identifier?t.has(n.name):n.type===Ye.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Ye.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Ye.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});import{ESLintUtils as Ji}from"@typescript-eslint/utils";import St from"path";import{z as Ie}from"zod/v4";var Yi=Ji.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="no-relative-imports",Xi=Ie.object({find:Ie.string(),replacement:Ie.string()}),Bi=Ie.object({aliases:Ie.array(Xi),rootDir:Ie.string().optional(),allowNotFoundAliases:Ie.boolean().optional(),_dev_simulateFileName:Ie.string().optional()}),qi=Yi({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:[$(Bi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(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=t.rootDir??process.cwd(),l=St.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let m=l.replace(c,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),Tt={name:Cn,rule:qi};import{AST_NODE_TYPES as Z}from"@typescript-eslint/utils";import{z as In}from"zod/v4";var Gi=In.object({customMessage:In.string().optional()}),ht=V({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(Gi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case Z.Literal:return!0;case Z.ObjectExpression:return n.properties.every(o=>o.type===Z.Property?o.computed||o.value.type===Z.Identifier&&o.key.type===Z.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case Z.ArrayExpression:return n.elements.every(o=>o?o.type===Z.SpreadElement?!1:r(o):!0);case Z.TemplateLiteral:return n.expressions.length===0;case Z.ConditionalExpression:case Z.LogicalExpression:case Z.BinaryExpression:case Z.UnaryExpression:case Z.CallExpression:case Z.MemberExpression:case Z.Identifier:case Z.ArrowFunctionExpression:case Z.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===Z.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===Z.JSXExpressionContainer?n.value.expression.type!==Z.JSXEmptyExpression&&(o=n.value.expression):n.value.type===Z.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as Xe}from"@typescript-eslint/utils";import*as we from"zod/v4";var Zi=we.object({alternativeMsgs:we.object({inArrayFind:we.string().optional(),inArrayFilter:we.string().optional()}).optional(),__dev_simulateFileName:we.string().optional()});function Ki(e){return e.typeAnnotation.type!==Xe.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Qi=/(typeGuards|type-guards)\.(ts|tsx)$/;function es(e){return Qi.test(e)}function ts(e){let t=e.parent;for(;t;){if(t.type===Xe.CallExpression&&t.callee.type===Xe.MemberExpression&&t.callee.property.type===Xe.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Et=V({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:[$(Zi)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(es(r))return{};function n(o){if(!Ki(o))return;let a=ts(o);if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.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)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as Oe}from"@typescript-eslint/utils";var ns="no-unnecessary-async-on-jsx-props";function rs(e){if(e.body.type!==Oe.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Oe.ExpressionStatement?!1:r.expression.type===Oe.AwaitExpression}var xt=V({name:ns,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 t(r){rs(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===Oe.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===Oe.BlockStatement)for(let p of l.body)s(p);else l.type===Oe.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as je,ESLintUtils as An}from"@typescript-eslint/utils";import*as bt from"typescript";import Le from"zod/v4";var is=An.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-unnecessary-casting",ss=Le.object({additionalCastFunctions:Le.array(Le.object({name:Le.string(),expectedType:Le.enum(["string","number"])})).optional()}),Ct={name:Rn,rule:is({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:[$(ss)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=An.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,m){switch(c.type){case je.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case je.TemplateLiteral:return m==="string";case je.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&bt.TypeFlags.NumberLike):!!(c.flags&bt.TypeFlags.StringLike)}function l(c,m){return f=>f.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!a||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===je.SpreadElement)return;let{callee:f}=c;if(f.type!==je.Identifier)return;let d=f.name,y=n.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,u;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...u?{data:u}:{},fix:l(c,m)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Be}from"@typescript-eslint/utils";import*as de from"zod/v4";var os=de.object({methods:de.union([de.array(de.string()),de.literal("array")])}),It=V({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:[$(os)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.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 c=a(p);c&&o(c)&&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=V({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(t){if(t.id.type===ae.ObjectPattern||!t.init||t.init.type!==ae.ObjectExpression||t.id.type===ae.Identifier&&t.id.typeAnnotation||t.parent.parent.type===ae.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===ae.Property&&i.key.type===ae.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==ae.Identifier)return;let n=as(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==ae.Property?!1:i.value.type===ae.FunctionExpression),a=new Set;for(let i of n){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 as(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as X,ESLintUtils as ls}from"@typescript-eslint/utils";import{z as ve}from"zod/v4";var ps=ve.object({selectors:ve.array(ve.object({name:ve.string(),selectorProp:ve.string().optional(),selectorArgPos:ve.number().optional(),returnProp:ve.string().optional()}))}),cs=ls.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-unused-selected-values",At={name:wn,rule:cs({name:wn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(ps)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===X.CallExpression&&(a=o.init),!a)return;let i=fs(a);if(!i)return;let s=n.get(i);if(!s)return;let l=us(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ms(l);if(!p)return;let c=vn(p.properties,void 0);if(!c)return;if(o.id.type===X.ObjectPattern){let d=vn(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of c)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==X.Identifier||s.returnProp)return;let m=ds(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==X.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==X.Identifier)return;f.add(y.name)}for(let[d,y]of c)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function us(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===X.ArrowFunctionExpression||n.type===X.FunctionExpression)return n;if(r&&n.type===X.ObjectExpression){let o=n.properties.find(i=>i.type===X.Property&&i.key.type===X.Identifier&&i.key.name===r);if(o?.type!==X.Property)return null;let a=o.value;if(a.type===X.ArrowFunctionExpression||a.type===X.FunctionExpression)return a}return null}function fs(e){return e.callee.type===X.Identifier?e.callee.name:e.callee.type===X.MemberExpression&&e.callee.property.type===X.Identifier?e.callee.property.name:null}function ms(e){if(e.body.type===X.ObjectExpression)return e.body;if(e.body.type===X.BlockStatement){let t=e.body.body.filter(r=>r.type===X.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==X.ObjectExpression?null:t[0].argument}return null}function vn(e,t){let r=e;if(t){let o=e.find(a=>a.type===X.Property&&a.key.type===X.Identifier&&a.key.name===t);if(o?.type!==X.Property||o.value.type!==X.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==X.Property||o.key.type!==X.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ds(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as J}from"@typescript-eslint/utils";var wt=V({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.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=ys(a);s&&(n=s);return}let i=gs(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function ys(e){if(!(e.callee.type===J.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==J.ObjectExpression)return null;let n=yt(r.properties,a=>a.type!==J.Property||a.key.type!==J.Identifier||a.key.name!=="initialConfig"?null:a.value.type===J.ObjectExpression?a.value:a.value.type===J.ArrowFunctionExpression||a.value.type===J.FunctionExpression?Ss(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===J.Property&&a.key.type===J.Identifier&&o.set(a.key.name,a);return o}function gs(e,t){if(!(e.callee.type===J.Identifier&&e.callee.name==="useFormState")||e.parent.type!==J.VariableDeclarator||e.parent.id.type!==J.ObjectPattern||!yt(e.parent.id.properties,i=>i.type===J.Property&&i.key.type===J.Identifier&&i.key.name==="formFields"&&i))return null;let o=En(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==J.Identifier||i.parent.type===J.Property&&i.parent.parent.type===J.ObjectExpression&&i.parent.parent.parent.type===J.ReturnStatement||i.parent.type===J.ReturnStatement)return null;if(i.parent.type===J.MemberExpression){if(i.parent.object.type!==J.Identifier||i.parent.property.type!==J.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ss(e){if(e.body.type===J.ObjectExpression)return e.body;if(e.body.type===J.BlockStatement){let t=e.body.body.filter(r=>r.type===J.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==J.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as z,ESLintUtils as Ts}from"@typescript-eslint/utils";import{z as qe}from"zod/v4";var hs=Ts.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function kn(e){let t=[];for(let r of e.members)r.type===z.TSPropertySignature&&r.key.type===z.Identifier&&t.push([r.key.name,r]);return t}function Fn(e,...t){for(let r of t)e.set(...r);return e}var Es=qe.object({forceCheckOnFCPropTypesWithName:qe.array(qe.string()).optional(),alwaysCheckFunctionOptionTypes:qe.boolean().optional()}),Pn="no-unused-type-props-in-args",vt=null,xs=hs({name:Pn,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:[$(Es)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!vt&&(vt=r.map(l=>new RegExp(l)));function o(l,p,c,m,f=!0,d=!1){let y=c.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&vt?.some(g=>g.test(y)),u=d&&n;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.ExportNamedDeclaration;if(!(f&&b&&!u)){if(x.type===z.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===z.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,c,m,f,d=!1){if(m.type===z.TSInterfaceBody){for(let y of m.body)y.type===z.TSPropertySignature&&y.key.type===z.Identifier&&c.set(y.key.name,y);return}if(m.type===z.TSTypeLiteral){Fn(c,...kn(m));return}if(m.type===z.TSIntersectionType){for(let y of m.types)a(l,p,c,y,!0,d);return}f||m.type===z.TSTypeReference&&m.typeName.type===z.Identifier&&o(l,p,m.typeName,c,!0,d)}function i(l,p,c,m=!1){for(let f of c)if(f.type===z.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.AssignmentPattern&&f.left.type===z.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let c=[];if(l.properties.at(-1)?.type===z.RestElement)return;for(let y of l.properties)y.type===z.Property&&y.key.type===z.Identifier&&c.push(y.key.name);let f=[],d=[];for(let[y,E]of p)c.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 u=l.properties.at(-1),x=d.join(", ");return u?u.type===z.RestElement?null:h.insertTextAfter(u,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],c=new Map,m=p.id.type===z.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===z.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===z.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===z.TSTypeReference&&m.typeName.type===z.Identifier)o(!0,l,m.typeName,c,!1);else if(m.type===z.TSTypeLiteral)Fn(c,...kn(m));else if(m.type===z.TSIntersectionType)for(let f of m.types)f.type===z.TSTypeReference&&f.typeName.type===z.Identifier?o(!0,l,f.typeName,c,!1):a(!0,l,c,f,!0);if(c.size!==0&&p.init?.type===z.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===z.ObjectPattern&&s(f,c)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),kt={name:Pn,rule:xs};import{AST_NODE_TYPES as fe}from"@typescript-eslint/utils";var Ft=V({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 t=new Set;function r(n){return n.callee.type===fe.Identifier?t.has(n.callee.name):n.callee.type===fe.MemberExpression&&n.callee.object.type===fe.Identifier&&n.callee.property.type===fe.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===fe.ImportSpecifier&&o.imported.type===fe.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===fe.CallExpression&&r(n.init)&&n.id.type===fe.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(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:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as Pt,ESLintUtils as bs}from"@typescript-eslint/utils";var Cs=bs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="prefer-named-functions",On=new Map,Is=Cs({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,[t]){let r=null;if(t.ignoreRegex){let n=On.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),On.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===Pt.ArrowFunctionExpression&&n.id.type===Pt.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==Pt.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ot={name:Nn,rule:Is};import{AST_NODE_TYPES as j}from"@typescript-eslint/utils";import{z as he}from"zod/v4";var Rs=he.object({disallowedFunctions:he.array(he.object({name:he.string(),allowUsingWithArgs:he.boolean().optional(),hookAlternative:he.string().optional(),message:he.string().optional(),allowUseInside:he.array(he.string()).optional()}))}),As=/^use[A-Z]/,ws=/^[A-Z]/;function Ge(e){return As.test(e)}function Dn(e){return ws.test(e)}function vs(e){return e.type===j.Identifier?Ge(e.name):e.type===j.MemberExpression&&e.property.type===j.Identifier?Ge(e.property.name):!1}function Mn(e,t){return e.type===j.Identifier?e.name===t:e.type===j.MemberExpression&&e.object.type===j.Identifier&&e.property.type===j.Identifier?e.object.name==="React"&&e.property.name===t:!1}function jn(e){return!!(e.parent&&e.parent.type===j.CallExpression&&Mn(e.parent.callee,"forwardRef"))}function Ln(e){return!!(e.parent&&e.parent.type===j.CallExpression&&Mn(e.parent.callee,"memo"))}function Nt(e){if(e.type===j.FunctionDeclaration||e.type===j.FunctionExpression&&e.id)return e.id||void 0;if(e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression){if(e.parent.type===j.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===j.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===j.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===j.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ks(e){let t=e.parent,r=!1;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression){let n=Nt(t);if(n&&n.type===j.Identifier){if(Dn(n.name)||Ge(n.name))return!r;r=!0}else{if(jn(t)||Ln(t))return!r;if(t.parent.type===j.CallExpression){let o=t.parent;vs(o.callee)||(r=!0)}else t.parent.type===j.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function _n(e){return e.callee.type===j.Identifier?e.callee.name:e.callee.type===j.MemberExpression&&e.callee.property.type===j.Identifier?e.callee.property.name:null}function Fs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===j.FunctionDeclaration||r.type===j.FunctionExpression||r.type===j.ArrowFunctionExpression){let n=Nt(r);if(n&&n.type===j.Identifier&&t.includes(n.name))return!0}else if(r.type===j.CallExpression){let n=_n(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Ps(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===j.Identifier&&t.name==="undefined")}function Os(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression){let o=Nt(n);if(o&&o.type===j.Identifier){if(Dn(o.name)||Ge(o.name)){r=!0;break}}else if(jn(n)||Ln(n)){r=!0;break}}n=n.parent}return r?t.length===0?ks(e):!Fs(e,t):!1}var Dt=V({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:[$(Rs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=_n(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&Ps(o))return;let s=i.allowUseInside||[];Os(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===j.Identifier?l.replaceText(o.callee,p):o.callee.type===j.MemberExpression&&o.callee.property.type===j.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as K,AST_TOKEN_TYPES as $n,ESLintUtils as Ns}from"@typescript-eslint/utils";import Mt from"zod/v4";var Ds=Ns.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="prefer-single-line-if",Ms=Mt.object({maxLineLength:Mt.number().optional(),maxNonSimpleConditionLength:Mt.number().optional()}),js=Ds({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:[$(Ms)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==K.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(!a)return;if(a.type===K.ReturnStatement){if(!Vn(a))return}else if(!(a.type===K.ContinueStatement||a.type===K.BreakStatement))return;if(n.test.type===K.LogicalExpression||n.test.type===K.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=Un(n.test);if(!m&&n.test.type===K.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;Un(f)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
16
- `))return;let l=r.getTokenAfter(n);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=Ls(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,c)})}}}});function Un(e){return e.type===K.CallExpression||e.type===K.BinaryExpression||e.type===K.MemberExpression&&Wn(e)}function Wn(e){return e.object.type===K.MemberExpression?Wn(e.object):e.object.type!==K.Identifier}function Ls(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Vn(e){if(!e.argument)return!0;let t=e.argument;return t.type===K.ArrayExpression&&t.elements.length===0||t.type===K.ObjectExpression&&t.properties.length===0||t.type===K.Literal||t.type===K.Identifier||t.type===K.TemplateLiteral||t.type===K.TaggedTemplateExpression?!0:t.type===K.CallExpression?t.arguments.length===0:t.type===K.UnaryExpression?Vn(t):!1}var jt={name:zn,rule:js};import{AST_NODE_TYPES as D,ESLintUtils as _s}from"@typescript-eslint/utils";import{z as Hn}from"zod/v4";var $s=_s.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zn="react-compiler-extra",Us=Hn.object({runOnlyWithEnableCompilerDirective:Hn.boolean().optional()}),zs=/eslint +react-compiler\/react-compiler: +\["error/;function Kn(e){return e.type===D.Identifier?e.name.startsWith("use"):e.type===D.MemberExpression&&e.property.type===D.Identifier?e.property.name.startsWith("use"):!1}function ye(e){if(!e)return!1;switch(e.type){case D.JSXElement:case D.JSXFragment:return!0;case D.ConditionalExpression:return ye(e.consequent)||ye(e.alternate);case D.LogicalExpression:return e.operator==="&&"?ye(e.right):e.operator==="||"?ye(e.left)||ye(e.right):!1;case D.CallExpression:if(e.callee.type===D.MemberExpression&&e.callee.object.type===D.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===D.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==D.SpreadElement&&ye(t))return!0;return!1;default:return!1}}function Ws(e){let t=e.typeAnnotation;if(t.type===D.TSTypeReference){if(t.typeName.type===D.Identifier)return t.typeName.name==="FC";if(t.typeName.type===D.TSQualifiedName&&t.typeName.left.type===D.Identifier&&t.typeName.right.type===D.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Vs=/^[A-Z][a-zA-Z0-9]*$/;function Jn(e){return Vs.test(e)}function Yn(e){return e.startsWith("use")&&e.length>3}function Xn(e,t,r){return r&&Ws(r)?t?Jn(t.name):e.type===D.FunctionDeclaration&&e.id?Jn(e.id.name):!0:!!(t&&Yn(t.name)||e.type===D.FunctionDeclaration&&e.id&&Yn(e.id.name))}function Bn(e){if(e.body.type===D.BlockStatement){for(let t of e.body.body)if(t.type===D.ExpressionStatement&&t.expression.type===D.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Hs(e,t){let r={containsJSX:!1,containsHookCalls:!1};return xn(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case D.JSXElement:case D.JSXFragment:r.containsJSX=!0;break;case D.CallExpression:Kn(n.callee)&&(r.containsHookCalls=!0),ye(n)&&(r.containsJSX=!0);break;case D.ReturnStatement:n.argument&&ye(n.argument)&&(r.containsJSX=!0);break;case D.VariableDeclarator:n.init&&ye(n.init)&&(r.containsJSX=!0);break;case D.AssignmentExpression:ye(n.right)&&(r.containsJSX=!0);break}},t),r}function qn(e,t){let r=e.body,n=Hs(r,t);return n.containsJSX||n.containsHookCalls}var Js=/\bthis[.[]/;function Gn(e){return Js.test(e)}var Ys=$s({name:Zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:"React components and hooks should create JSX elements or call other hooks for optimal React compiler detection.",addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization'},hasSuggestions:!0,schema:[$(Us)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(zs.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===D.Property&&i.method&&i.value.type===D.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Gn(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(d=>s.getText(d)).join(", "),f="";p.generator?f=`${l}: function* (${m}) ${c}`:f=`${l}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,f)})}}}function o(a){for(let i of a.properties)if(i.type===D.Property&&i.value.type===D.ObjectExpression){for(let s of i.value.properties)if(s.type===D.Property&&s.method&&s.value.type===D.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Gn(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(Kn(a.callee))for(let i of a.arguments){if(i.type===D.ObjectExpression&&(n(i),o(i)),i.type===D.ArrowFunctionExpression&&(i.body.type===D.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===D.BlockStatement))for(let s of i.body.body)s.type===D.ReturnStatement&&s.argument?.type===D.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===D.FunctionExpression)for(let s of i.body.body)s.type===D.ReturnStatement&&s.argument?.type===D.ObjectExpression&&(n(s.argument),o(s.argument))}},VariableDeclarator(a){if(a.id.type===D.Identifier&&a.init&&(a.init.type===D.ArrowFunctionExpression||a.init.type===D.FunctionExpression)){let i=a.init,s=a.id,l=a.id.typeAnnotation;if(Xn(i,s,l)){let p=qn(i,e.sourceCode),c=Bn(i);!p&&!c&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===D.BlockStatement){let f=i.body.range[0]+1;return m.insertTextAfterRange([f,f],`
16
+ `))return;let l=r.getTokenAfter(n);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=Ls(r,n),c=`if (${i}) ${s}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,c)})}}}});function Un(e){return e.type===K.CallExpression||e.type===K.BinaryExpression||e.type===K.MemberExpression&&Wn(e)}function Wn(e){return e.object.type===K.MemberExpression?Wn(e.object):e.object.type!==K.Identifier}function Ls(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Vn(e){if(!e.argument)return!0;let t=e.argument;return t.type===K.ArrayExpression&&t.elements.length===0||t.type===K.ObjectExpression&&t.properties.length===0||t.type===K.Literal||t.type===K.Identifier||t.type===K.TemplateLiteral||t.type===K.TaggedTemplateExpression?!0:t.type===K.CallExpression?t.arguments.length===0:t.type===K.UnaryExpression?Vn(t):!1}var jt={name:zn,rule:js};import{AST_NODE_TYPES as D,ESLintUtils as _s}from"@typescript-eslint/utils";import{z as Hn}from"zod/v4";var $s=_s.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zn="react-compiler-extra",Us=Hn.object({runOnlyWithEnableCompilerDirective:Hn.boolean().optional()}),zs=/eslint +react-compiler\/react-compiler: +\["error/;function Kn(e){return e.type===D.Identifier?e.name.startsWith("use"):!1}function ye(e){if(!e)return!1;switch(e.type){case D.JSXElement:case D.JSXFragment:return!0;case D.ConditionalExpression:return ye(e.consequent)||ye(e.alternate);case D.LogicalExpression:return e.operator==="&&"?ye(e.right):e.operator==="||"?ye(e.left)||ye(e.right):!1;case D.CallExpression:if(e.callee.type===D.MemberExpression&&e.callee.object.type===D.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===D.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==D.SpreadElement&&ye(t))return!0;return!1;default:return!1}}function Ws(e){let t=e.typeAnnotation;if(t.type===D.TSTypeReference){if(t.typeName.type===D.Identifier)return t.typeName.name==="FC";if(t.typeName.type===D.TSQualifiedName&&t.typeName.left.type===D.Identifier&&t.typeName.right.type===D.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Vs=/^[A-Z][a-zA-Z0-9]*$/;function Jn(e){return Vs.test(e)}function Yn(e){return e.startsWith("use")&&e.length>3}function Xn(e,t,r){return r&&Ws(r)?t?Jn(t.name):e.type===D.FunctionDeclaration&&e.id?Jn(e.id.name):!0:!!(t&&Yn(t.name)||e.type===D.FunctionDeclaration&&e.id&&Yn(e.id.name))}function Bn(e){if(e.body.type===D.BlockStatement){for(let t of e.body.body)if(t.type===D.ExpressionStatement&&t.expression.type===D.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Hs(e,t){let r={containsJSX:!1,containsHookCalls:!1};return xn(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case D.JSXElement:case D.JSXFragment:r.containsJSX=!0;break;case D.CallExpression:Kn(n.callee)&&(r.containsHookCalls=!0),ye(n)&&(r.containsJSX=!0);break;case D.ReturnStatement:n.argument&&ye(n.argument)&&(r.containsJSX=!0);break;case D.VariableDeclarator:n.init&&ye(n.init)&&(r.containsJSX=!0);break;case D.AssignmentExpression:ye(n.right)&&(r.containsJSX=!0);break}},t),r}function qn(e,t){let r=e.body,n=Hs(r,t);return n.containsJSX||n.containsHookCalls}var Js=/\bthis[.[]/;function Gn(e){return Js.test(e)}var Ys=$s({name:Zn,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:"React components and hooks should create JSX elements or call other hooks for optimal React compiler detection.",addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization'},hasSuggestions:!0,schema:[$(Us)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(zs.test(a.value)){r=!0;break}if(!r)return{}}function n(a){for(let i of a.properties)if(i.type===D.Property&&i.method&&i.value.type===D.FunctionExpression){let s=e.sourceCode,l=s.getText(i.key),p=i.value,c=s.getText(p.body);if(Gn(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(d=>s.getText(d)).join(", "),f="";p.generator?f=`${l}: function* (${m}) ${c}`:f=`${l}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,f)})}}}function o(a){for(let i of a.properties)if(i.type===D.Property&&i.value.type===D.ObjectExpression){for(let s of i.value.properties)if(s.type===D.Property&&s.method&&s.value.type===D.FunctionExpression){let p=e.sourceCode.getText(s.value.body);Gn(p)&&e.report({node:s,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(Kn(a.callee))for(let i of a.arguments){if(i.type===D.ObjectExpression&&(n(i),o(i)),i.type===D.ArrowFunctionExpression&&(i.body.type===D.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===D.BlockStatement))for(let s of i.body.body)s.type===D.ReturnStatement&&s.argument?.type===D.ObjectExpression&&(n(s.argument),o(s.argument));if(i.type===D.FunctionExpression)for(let s of i.body.body)s.type===D.ReturnStatement&&s.argument?.type===D.ObjectExpression&&(n(s.argument),o(s.argument))}},VariableDeclarator(a){if(a.id.type===D.Identifier&&a.init&&(a.init.type===D.ArrowFunctionExpression||a.init.type===D.FunctionExpression)){let i=a.init,s=a.id,l=a.id.typeAnnotation;if(Xn(i,s,l)){let p=qn(i,e.sourceCode),c=Bn(i);!p&&!c&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===D.BlockStatement){let f=i.body.range[0]+1;return m.insertTextAfterRange([f,f],`
17
17
  "use memo"
18
18
  `)}return null}}]})}}},FunctionDeclaration(a){if(Xn(a)){let i=qn(a,e.sourceCode),s=Bn(a);!i&&!s&&e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let p=a.body.range[0]+1;return l.insertTextAfterRange([p,p],`
19
19
  "use memo"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.62.0",
3
+ "version": "0.62.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"