@ls-stack/extended-lint 0.88.3 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extended-lint.js +22 -22
- package/dist/extended-lint.mjs +21 -21
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var $i=Object.create;var xt=Object.defineProperty;var Ui=Object.getOwnPropertyDescriptor;var zi=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty;var Ji=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zi(t))!Wi.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=Ui(t,o))||n.enumerable});return e};var Ne=(e,t,r)=>(r=e!=null?$i(Vi(e)):{},sr(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Xi=e=>sr(xt({},"__esModule",{value:!0}),e);var Nl={};Ji(Nl,{default:()=>Pl,extendedLintPlugin:()=>Oi});module.exports=Xi(Nl);var be=require("@typescript-eslint/utils"),_=require("zod/v4");var ar=require("@typescript-eslint/utils"),lr=Ne(require("zod/v4"));function z(e){let r=ar.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return lr.toJSONSchema(e)}var Bi=_.z.object({disallow:_.z.array(_.z.object({selector:_.z.string(),message:_.z.string(),replace:_.z.optional(_.z.union([_.z.string(),_.z.object({regex:_.z.string(),with:_.z.string()})])),replaceType:_.z.optional(_.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.z.optional(_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.optional(_.z.array(_.z.object({atIndex:_.z.number(),value:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))),message:_.z.string(),replaceWith:_.z.optional(_.z.string()),ignoreRegex:_.z.optional(_.z.string())}))),__dev_simulateFileName:_.z.optional(_.z.string()),mustMatchSyntax:_.z.optional(_.z.array(_.z.object({includeRegex:_.z.string(),excludeRegex:_.z.optional(_.z.string()),mustCallFn:_.z.optional(_.z.array(_.z.object({anyCall:_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.array(_.z.object({atIndex:_.z.number(),literal:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))})),message:_.z.optional(_.z.string())}))),mustMatchSelector:_.z.optional(_.z.array(_.z.object({selector:_.z.string(),message:_.z.string()}))),mustHaveExport:_.z.optional(_.z.array(_.z.object({name:_.z.string(),type:_.z.enum(["function","variable","any"]).default("any"),message:_.z.string()})))})))}),zt=z({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(Bi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,p=[],l=new Map,u=new Set,f=new Map,y=new Set,b=new Map;function m(x){for(let w of x.specifiers)w.type===be.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===be.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&b.set(w.local.name,w.imported.name)}function h(x){if(x.declaration){if(x.declaration.type===be.AST_NODE_TYPES.FunctionDeclaration&&x.declaration.id){let w=x.declaration.id.name;for(let k of Array.from(y)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(x.declaration.type===be.AST_NODE_TYPES.VariableDeclaration){for(let w of x.declaration.declarations)if(w.id.type===be.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&y.delete(N)}}}}for(let w of x.specifiers)if(w.exported.type===be.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&v==="any"&&y.delete(N)}}}function C(x){x.id.type===be.AST_NODE_TYPES.Identifier&&x.init?.type===be.AST_NODE_TYPES.Identifier&&b.set(x.id.name,x.init.name)}function S(x){return b.get(x)??x}function I(x,w){return S(x)===w||x===w}for(let{includeRegex:x,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:L}of v??[])F=F.replaceAll(P,L);return F};var E=d;let v=Hi(a,new RegExp(x));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:T,message:F}of k??[]){let P=`Expected file to call the function: ${T.map(({fn:L})=>L).join(" or ")}`;u.add(P),p.push(L=>{let{callee:X}=L;if(X.type===be.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:q}of T)if(X.name===G){u.delete(P);for(let D of q){let Z=L.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:L,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${d(F)}`:""}`}});continue}if(Z.type!==be.AST_NODE_TYPES.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${d(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${d(F)}`:""}`},fix:ue=>ue.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:T,message:F}of N??[])f.set(T,d(F)),l.set(d(T),()=>{f.delete(T)});for(let{name:T,type:F,message:P}of c??[]){let L=d(T),X=d(P);y.add(`${L}:${F}:${X}`)}}}for(let{fn:x,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||p.push(v=>{let{callee:d}=v;if(d.type!==be.AST_NODE_TYPES.Identifier||!I(d.name,x))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.AST_NODE_TYPES.Literal||P.value!==F.value)return}let T=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:T}]:void 0})});function A(x,w){let k=r[x];k?r[x]=N=>{k(N),w(N)}:r[x]=w}for(let{selector:x,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(x==="CallExpression"){p.push(c=>{g(k,c,w,N)});continue}r[x]=c=>{g(k,c,w,N)}}if(l.size>0)for(let[x,w]of l)A(x,w);return p.length>0&&(r.CallExpression=x=>{if(x.type===be.AST_NODE_TYPES.CallExpression)for(let w of p)w(x)}),r.ImportDeclaration=x=>{x.type===be.AST_NODE_TYPES.ImportDeclaration&&m(x)},r.ExportNamedDeclaration=x=>{x.type===be.AST_NODE_TYPES.ExportNamedDeclaration&&h(x)},r.VariableDeclarator=x=>{x.type===be.AST_NODE_TYPES.VariableDeclarator&&C(x)},r["Program:exit"]=x=>{for(let w of u)e.report({node:x,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:x,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:x,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(x,w,k,N){let c=v=>{if(!x)return null;if(typeof x=="string")return v.replaceText(w,x);{let d=new RegExp(x.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,x.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:x&&N==="autofix"?c:void 0,suggest:x&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof x=="string"?x:x.with}"`},fix:c}]:void 0})}}});function Hi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:pr(o)}),r.push({name:"$0_uncapitalize",value:cr(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,p=s[i];p!==void 0&&(r.push({name:`${a}_lowercase`,value:p.toLowerCase()}),r.push({name:`${a}_capitalize`,value:pr(p)}),r.push({name:`${a}_uncapitalize`,value:cr(p)}),r.push({name:a,value:p}))}return r}function pr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Yi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="collapse-simple-objs-in-one-line",qi=Ye.z.object({maxLineLength:Ye.z.number().optional(),maxProperties:Ye.z.number().optional(),nestedObjMaxLineLength:Ye.z.number().optional(),nestedObjMaxProperties:Ye.z.number().optional(),ignoreTypesWithSuffix:Ye.z.array(Ye.z.string()).optional()}),Zi=Yi({name:fr,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:[$(qi)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(l){if(l.type===re.AST_NODE_TYPES.ObjectExpression){let u=l.parent.type===re.AST_NODE_TYPES.Property,f=u?i:o,y=l.properties.length;if(y>f)return!1;if(y===1){let m=l.properties[0];return!m||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ObjectExpression||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&Vt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let b=[];for(let m of l.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Vt(m.value))return!1;b.push(r.getText(m))}return{text:b.join(", "),isNested:u,propsSize:y}}else{let u=l.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,f=u?i:o,y=l.members.length;if(y>f)return!1;if(n.length>0&&l.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=l.parent.id.name;if(n.some(h=>m.endsWith(h)))return!1}if(y===1){let m=l.members[0];return!m||m.type===re.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(l.parent.type===re.AST_NODE_TYPES.TSIntersectionType||l.parent.type===re.AST_NODE_TYPES.TSUnionType&&l.parent.types[0]!==l)return!1;let b=[];for(let m of l.members){if(m.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===re.AST_NODE_TYPES.TSTypeLiteral||!ur(h))return!1;if(h.type===re.AST_NODE_TYPES.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let S=h.typeArguments.params[0];if(!S||!ur(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),b.push(C)}return{text:b.join("; "),isNested:u,propsSize:y}}}function p(l){if(l.loc.start.line===l.loc.end.line)return;if(l.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let h=0,C=!1,S=r.getTokenAfter(l,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
|
|
2
|
-
`);if(
|
|
3
|
-
`)||r.getCommentsInside(l).length>0)return;
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function
|
|
1
|
+
"use strict";var Vi=Object.create;var It=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var Ji=Object.getOwnPropertyNames;var Xi=Object.getPrototypeOf,Bi=Object.prototype.hasOwnProperty;var Hi=(e,t)=>{for(var r in t)It(e,r,{get:t[r],enumerable:!0})},pr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ji(t))!Bi.call(e,o)&&o!==r&&It(e,o,{get:()=>t[o],enumerable:!(n=Wi(t,o))||n.enumerable});return e};var Ne=(e,t,r)=>(r=e!=null?Vi(Xi(e)):{},pr(t||!e||!e.__esModule?It(r,"default",{value:e,enumerable:!0}):r,e)),Yi=e=>pr(It({},"__esModule",{value:!0}),e);var Ml={};Hi(Ml,{default:()=>Ll,extendedLintPlugin:()=>Li});module.exports=Yi(Ml);var be=require("@typescript-eslint/utils"),_=require("zod/v4");var cr=require("@typescript-eslint/utils"),ur=Ne(require("zod/v4"));function U(e){let r=cr.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return ur.toJSONSchema(e)}var qi=_.z.object({disallow:_.z.array(_.z.object({selector:_.z.string(),message:_.z.string(),replace:_.z.optional(_.z.union([_.z.string(),_.z.object({regex:_.z.string(),with:_.z.string()})])),replaceType:_.z.optional(_.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.z.optional(_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.optional(_.z.array(_.z.object({atIndex:_.z.number(),value:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))),message:_.z.string(),replaceWith:_.z.optional(_.z.string()),ignoreRegex:_.z.optional(_.z.string())}))),__dev_simulateFileName:_.z.optional(_.z.string()),mustMatchSyntax:_.z.optional(_.z.array(_.z.object({includeRegex:_.z.string(),excludeRegex:_.z.optional(_.z.string()),mustCallFn:_.z.optional(_.z.array(_.z.object({anyCall:_.z.array(_.z.object({fn:_.z.string(),withArgs:_.z.array(_.z.object({atIndex:_.z.number(),literal:_.z.union([_.z.string(),_.z.number(),_.z.boolean()])}))})),message:_.z.optional(_.z.string())}))),mustMatchSelector:_.z.optional(_.z.array(_.z.object({selector:_.z.string(),message:_.z.string()}))),mustHaveExport:_.z.optional(_.z.array(_.z.object({name:_.z.string(),type:_.z.enum(["function","variable","any"]).default("any"),message:_.z.string()})))})))}),Wt=U({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(qi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,p=[],l=new Map,d=new Set,u=new Map,f=new Set,y=new Map;function m(x){for(let w of x.specifiers)w.type===be.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===be.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&y.set(w.local.name,w.imported.name)}function b(x){if(x.declaration){if(x.declaration.type===be.AST_NODE_TYPES.FunctionDeclaration&&x.declaration.id){let w=x.declaration.id.name;for(let k of Array.from(f)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&f.delete(k)}}else if(x.declaration.type===be.AST_NODE_TYPES.VariableDeclaration){for(let w of x.declaration.declarations)if(w.id.type===be.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(f)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&f.delete(N)}}}}for(let w of x.specifiers)if(w.exported.type===be.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(f)){let[c,v]=N.split(":");c===k&&v==="any"&&f.delete(N)}}}function C(x){x.id.type===be.AST_NODE_TYPES.Identifier&&x.init?.type===be.AST_NODE_TYPES.Identifier&&y.set(x.id.name,x.init.name)}function T(x){return y.get(x)??x}function I(x,w){return T(x)===w||x===w}for(let{includeRegex:x,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let g=function(E){let F=E;for(let{name:P,value:L}of v??[])F=F.replaceAll(P,L);return F};var h=g;let v=Zi(a,new RegExp(x));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:E,message:F}of k??[]){let P=`Expected file to call the function: ${E.map(({fn:L})=>L).join(" or ")}`;d.add(P),p.push(L=>{let{callee:X}=L;if(X.type===be.AST_NODE_TYPES.Identifier){for(let{fn:G,withArgs:q}of E)if(X.name===G){d.delete(P);for(let D of q){let Z=L.arguments[D.atIndex],B=typeof D.literal=="string"?g(D.literal):D.literal;if(!Z){e.report({node:L,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${g(F)}`:""}`}});continue}if(Z.type!==be.AST_NODE_TYPES.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${g(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${g(F)}`:""}`},fix:ue=>ue.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:E,message:F}of N??[])u.set(E,g(F)),l.set(g(E),()=>{u.delete(E)});for(let{name:E,type:F,message:P}of c??[]){let L=g(E),X=g(P);f.add(`${L}:${F}:${X}`)}}}for(let{fn:x,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||p.push(v=>{let{callee:g}=v;if(g.type!==be.AST_NODE_TYPES.Identifier||!I(g.name,x))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.AST_NODE_TYPES.Literal||P.value!==F.value)return}let E=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:E}]:void 0})});function A(x,w){let k=r[x];k?r[x]=N=>{k(N),w(N)}:r[x]=w}for(let{selector:x,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(x==="CallExpression"){p.push(c=>{S(k,c,w,N)});continue}r[x]=c=>{S(k,c,w,N)}}if(l.size>0)for(let[x,w]of l)A(x,w);return p.length>0&&(r.CallExpression=x=>{if(x.type===be.AST_NODE_TYPES.CallExpression)for(let w of p)w(x)}),r.ImportDeclaration=x=>{x.type===be.AST_NODE_TYPES.ImportDeclaration&&m(x)},r.ExportNamedDeclaration=x=>{x.type===be.AST_NODE_TYPES.ExportNamedDeclaration&&b(x)},r.VariableDeclarator=x=>{x.type===be.AST_NODE_TYPES.VariableDeclarator&&C(x)},r["Program:exit"]=x=>{for(let w of d)e.report({node:x,messageId:"default",data:{message:w}});for(let[,w]of u)e.report({node:x,messageId:"default",data:{message:w}});for(let w of f){let[k,N,c]=w.split(":");e.report({node:x,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function S(x,w,k,N){let c=v=>{if(!x)return null;if(typeof x=="string")return v.replaceText(w,x);{let g=new RegExp(x.regex),E=e.sourceCode.getText(w);return v.replaceText(w,E.replace(g,x.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:x&&N==="autofix"?c:void 0,suggest:x&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof x=="string"?x:x.with}"`},fix:c}]:void 0})}}});function Zi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:fr(o)}),r.push({name:"$0_uncapitalize",value:mr(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,p=s[i];p!==void 0&&(r.push({name:`${a}_lowercase`,value:p.toLowerCase()}),r.push({name:`${a}_capitalize`,value:fr(p)}),r.push({name:`${a}_uncapitalize`,value:mr(p)}),r.push({name:a,value:p}))}return r}function fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function mr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Gi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="collapse-simple-objs-in-one-line",Ki=Ye.z.object({maxLineLength:Ye.z.number().optional(),maxProperties:Ye.z.number().optional(),nestedObjMaxLineLength:Ye.z.number().optional(),nestedObjMaxProperties:Ye.z.number().optional(),ignoreTypesWithSuffix:Ye.z.array(Ye.z.string()).optional()}),Qi=Gi({name:yr,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:[$(Ki)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(l){if(l.type===re.AST_NODE_TYPES.ObjectExpression){let d=l.parent.type===re.AST_NODE_TYPES.Property,u=d?i:o,f=l.properties.length;if(f>u)return!1;if(f===1){let m=l.properties[0];return!m||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ObjectExpression||m.type===re.AST_NODE_TYPES.Property&&m.value.type===re.AST_NODE_TYPES.ArrayExpression&&!m.value.elements.every(C=>C&&Jt(C))?!1:{text:r.getText(m),isNested:d,propsSize:f}}let y=[];for(let m of l.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Jt(m.value))return!1;y.push(r.getText(m))}return{text:y.join(", "),isNested:d,propsSize:f}}else{let d=l.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,u=d?i:o,f=l.members.length;if(f>u)return!1;if(n.length>0&&l.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let m=l.parent.id.name;if(n.some(b=>m.endsWith(b)))return!1}if(f===1){let m=l.members[0];return!m||m.type===re.AST_NODE_TYPES.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(m),isNested:d,propsSize:1}}if(l.parent.type===re.AST_NODE_TYPES.TSIntersectionType||l.parent.type===re.AST_NODE_TYPES.TSUnionType&&l.parent.types[0]!==l)return!1;let y=[];for(let m of l.members){if(m.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let b=m.typeAnnotation?.typeAnnotation;if(!b||b.type===re.AST_NODE_TYPES.TSTypeLiteral||!dr(b))return!1;if(b.type===re.AST_NODE_TYPES.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let T=b.typeArguments.params[0];if(!T||!dr(T))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),y.push(C)}return{text:y.join("; "),isNested:d,propsSize:f}}}function p(l){if(l.loc.start.line===l.loc.end.line)return;if(l.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let b=0,C=!1,T=r.getTokenAfter(l,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||C?!0:A.value===","?(b++,!1):A.value===";"?(b++,C=!0,!1):A.value===")"||A.value==="}"?(b++,!1):!0});if(b>4)return;let I=T?.type===re.AST_TOKEN_TYPES.Template&&T.value.startsWith(`}
|
|
2
|
+
`);if(T?.loc.start.line===l.loc.end.line&&!I)return}let d=a(l);if(!d)return;let u=d.text;if(u.includes(`
|
|
3
|
+
`)||r.getCommentsInside(l).length>0)return;u.endsWith(";")&&(u=u.slice(0,-1));let f=`{ ${u} }`,y=to(r,l),m=d.isNested&&d.propsSize>2?s:t.maxLineLength;m&&f.length+y.length+eo(l,r)>m||e.report({node:l,messageId:"singleLineProp",fix:b=>b.replaceText(l,f)})}return{TSTypeLiteral:p,ObjectExpression:p}}});function dr(e){return e.type===re.AST_NODE_TYPES.TSLiteralType||e.type===re.AST_NODE_TYPES.TSTypeReference||e.type===re.AST_NODE_TYPES.TSNumberKeyword||e.type===re.AST_NODE_TYPES.TSStringKeyword||e.type===re.AST_NODE_TYPES.TSBooleanKeyword||e.type===re.AST_NODE_TYPES.TSNullKeyword||e.type===re.AST_NODE_TYPES.TSUndefinedKeyword}function Jt(e,t){return!!(e.type===re.AST_NODE_TYPES.Literal||e.type===re.AST_NODE_TYPES.Identifier||e.type===re.AST_NODE_TYPES.TemplateLiteral||e.type===re.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===re.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&Jt(r,!0)))}function eo(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
|
|
4
|
+
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function to(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Xt={name:yr,rule:Qi};var no=/eslint +react-compiler\/react-compiler: +\["error/;function gr(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Sr(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Er={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function a(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let p=e.getSourceCode().scopeManager,l=new WeakMap,d=new WeakSet,u=new WeakMap,f=new WeakMap,y=new WeakSet;function m(I,A){return function(S){if(A.has(S))return A.get(S);let h=I(S);return A.set(S,h),h}}function b(I,A,S,h,x){x&&I.async&&a({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
async function fetchData() {
|
|
@@ -12,44 +12,44 @@ 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 w=p.acquire(I),k=new Set,N=null;{let R=w.upper;for(;R&&(k.add(R),R.type!=="function");)R=R.upper;if(!R)return;N=R}let c=Array.isArray;function v(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let W=O.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=O.node.parent;if(J==null&&(Bt(N.block,O.node.id),J=O.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let V=O.node.id,{name:K}=Y;if(K==="useRef"&&V.type==="Identifier")return!0;if(io(Y)&&V.type==="Identifier"){for(let ee of R.references)ee!==V&&b.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&c(R.identifiers)){if(V.elements[1]===R.identifiers[0]){if(K==="useState"){let ee=R.references,Fe=0;for(let Ve=0;Ve<ee.length;Ve++){if(ee[Ve].isWrite()&&Fe++,Fe>1)return!1;l.set(ee[Ve].identifier,V.elements[0])}}return!0}else if(V.elements[0]===R.identifiers[0]){if(K==="useState"){let ee=R.references;for(let Fe=0;Fe<ee.length;Fe++)u.add(ee[Fe].identifier)}return!1}}}else if(K==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(R.identifiers)&&V.elements[1]===R.identifiers[0])return!0;return!1}function d(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let W=O.node,J=N.childScopes,Y=null,V;for(V=0;V<J.length;V++){let K=J[V],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(V=0;V<Y.through.length;V++){let K=Y.through[V];if(K.resolved!=null&&k.has(K.resolved.scope)&&!T(K.resolved))return!1}return!0}let T=m(v,f),F=m(d,y),P=new Map;function L(R){let O=R.from,W=!1;for(;O.block!==I;)O.type==="function"&&(W=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return W}let X=new Map,G=new Map;q(w);function q(R){for(let O of R.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let W=Bt(I,O.identifier),J=Sr(W),Y=We(J,G);if(x&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&L(O)&&P.set(Y,{reference:O,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let V=O.resolved.defs[0];if(V!=null&&!(V.node!=null&&V.node.init===I.parent)&&V.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(O);else{let K=O.resolved,ee=T(K)||F(K);X.set(Y,{isStable:ee,references:[O]})}}for(let O of R.childScopes)q(O)}P.forEach(({reference:R,dependencyNode:O},W)=>{let J=R.resolved.references,Y=!1;for(let V=0;V<J.length;V++){let{identifier:K}=J[V],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||a({node:O.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(R,O){D.has(O)||(D.add(O),a({node:R,message:`Assignments to the '${O}' variable from inside React Hook ${r(g)} 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(g)}.`}))}let B=new Set;if(X.forEach(({isStable:R,references:O},W)=>{R&&B.add(W),O.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let R=null;if(X.forEach(({isStable:O,references:W},J)=>{R||W.forEach(Y=>{if(R)return;let V=Y.identifier;if(!l.has(V))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(R=J)})}),R){let{suggestedDependencies:O}=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:g,message:`React Hook ${E} contains a call to '${R}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${E} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],ye=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(g)} 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.`}):A.elements.forEach(R=>{if(R===null)return;if(R.type==="SpreadElement"){a({node:R,message:`React Hook ${r(g)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}b.has(R)&&a({node:R,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(R)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(R)}\``,fix(Y){return Y.removeRange(R.range)}}]});let O;try{O=We(R,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){R.type==="Literal"?X.has(R.value)?a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. Did you mean to include ${R.value} in the array instead?`}):a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:R,message:`React Hook ${r(g)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=R;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!N.through.some(Y=>Y.identifier===W);ue.push({key:O,node:R}),J||ye.add(O)});let{suggestedDependencies:Pe,unnecessaryDependencies:He,missingDependencies:Ee,duplicateDependencies:mt}=Jt({dependencies:X,declaredDependencies:ue,stableDependencies:B,externalDependencies:ye,isEffect:x}),rt=Pe;if(mt.size+Ee.size+He.size===0){let R=yr(g),O=R&&mr(R);if(t&&!O)return;eo({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:V})=>{let K=V==="function"?"useCallback":"useMemo",ee=V==="function"?"definition":"initialization",Fe=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Ve=Y?`To fix this, ${Fe}`:`Move it inside the ${E} callback. Alternatively, ${Fe}`,ji=V==="conditional"||V==="logical expression"?"could make":"makes",Li=`The '${J.name.name}' ${V} ${ji} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Ve}`,ir;Y&&J.type==="Variable"&&V==="function"&&(ir=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(or){let[Mi,_i]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[or.insertTextBefore(J.node.init,Mi),or.insertTextAfter(J.node.init,_i)]}}]),a({node:J.node,message:Li,suggest:ir})});return}!x&&Ee.size>0&&(rt=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:ye,isEffect:x}).suggestedDependencies);function xe(){if(ue.length===0)return!0;let R=ue.map(W=>W.key),O=R.slice().sort();return R.join(",")===O.join(",")}xe()&&rt.sort();function Ae(R){let O=R.split("."),W="";for(let J=0;J<O.length;J++){if(J!==0){let Y=O.slice(0,J+1).join("."),V=G.get(Y)===!0;W+=V?"?.":"."}W+=O[J]}return W}function Ut(R,O,W,J){return R.size===0?null:(R.size>1?"":O+" ")+W+" "+(R.size>1?"dependencies":"dependency")+": "+no(Array.from(R).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${J} ${R.size>1?"them":"it"} or remove the dependency array.`}let Le="";if(He.size>0){let R=null;if(Array.from(He.keys()).forEach(O=>{R===null&&O.endsWith(".current")&&(R=O)}),R!==null)Le=` Mutable values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ye.size>0){let O=Array.from(ye)[0];w.set.has(O)||(Le=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Le&&Ee.has("props")){let R=X.get("props");if(R==null)return;let O=R.references;if(!Array.isArray(O))return;let W=!0;for(let J=0;J<O.length;J++){let Y=O[J],V=Bt(N.block,Y.identifier);if(!V){W=!1;break}let K=V.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(Le=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${E} call and refer to those specific props inside ${r(g)}.`)}if(!Le&&Ee.size>0){let R=null;Ee.forEach(O=>{if(R)return;let W=N.set.get(O),J=X.get(O);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let V=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){V=!0;break}V&&(R=O)}),R!==null&&(Le=` If '${R}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Le&&Ee.size>0){let R=null;if(Ee.forEach(O=>{if(R!==null)return;let J=X.get(O).references,Y,V;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,V=Y.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=l.get(V.callee);if(ee!=null){if(ee.name===O)R={missingDep:O,setter:V.callee.name,form:"updater"};else if(u.has(Y))R={missingDep:O,setter:V.callee.name,form:"reducer"};else{let Fe=J[K].resolved;if(Fe!=null){let Ve=Fe.defs[0];Ve!=null&&Ve.type==="Parameter"&&(R={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(R!==null)break}}),R!==null)switch(R.form){case"reducer":Le=` You can also replace multiple useState variables with useReducer if '${R.setter}' needs the current value of '${R.missingDep}'.`;break;case"inlineReducer":Le=` If '${R.setter}' needs the current value of '${R.missingDep}', you can also switch to useReducer instead of useState and read '${R.missingDep}' in the reducer.`;break;case"updater":Le=` You can also do a functional update '${R.setter}(${R.missingDep.slice(0,1)} => ...)' if you only need '${R.missingDep}' in the '${R.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(g)} has `+(Ut(Ee,"a","missing","include")||Ut(He,"an","unnecessary","exclude")||Ut(mt,"a","duplicate","omit"))+Le,suggest:[{desc:`Update the dependencies array to be: [${rt.map(Ae).join(", ")}]`,fix(R){return R.replaceText(A,`[${rt.map(Ae).join(", ")}]`)}}]})}function C(I){let A=to(I.callee,i);if(A===-1)return;let g=I.arguments[A],E=I.callee,x=Tr(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(x);if(!g){a({node:E,message:`React Hook ${x} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let N=yr(E);if(!(N&&mr(N)))return}if(!w&&!k){(x==="useMemo"||x==="useCallback")&&a({node:E,message:`React Hook ${x} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(g.type){case"FunctionExpression":case"ArrowFunctionExpression":h(g,w,E,x,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(v=>v&&v.type==="Identifier"&&v.name===g.name))return;let N=n(I).set.get(g.name);if(N==null||N.defs==null)return;let c=N.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":h(c.node,w,E,x,k);return;case"VariableDeclarator":let v=c.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":h(v,w,E,x,k);return}break}break;default:a({node:E,message:`React Hook ${x} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:E,message:`React Hook ${x} has a missing dependency: '${g.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${g.name}]`,fix(N){return N.replaceText(w,`[${g.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Qi.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function Jt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let s=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,C)=>{let S=a(s,C);S.isUsed=!0,p(s,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:h})=>{let C=a(s,h);C.isSatisfiedRecursively=!0}),r.forEach(h=>{let C=a(s,h);C.isSatisfiedRecursively=!0});function a(h,C){let S=C.split("."),I=h;for(let A of S){let g=I.children.get(A);g||(g=i(),I.children.set(A,g)),I=g}return I}function p(h,C,S){let I=C.split("."),A=h;for(let g of I){let E=A.children.get(g);if(!E)return;S(E),A=E}}let l=new Set,u=new Set;f(s,l,u,h=>h);function f(h,C,S,I){h.children.forEach((A,g)=>{let E=I(g);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(E);return}if(A.isUsed){C.add(E);return}f(A,C,S,x=>E+"."+x)})}let y=[],b=new Set,m=new Set;return t.forEach(({key:h})=>{u.has(h)?y.indexOf(h)===-1?y.push(h):m.add(h):b.add(h)}),l.forEach(h=>{y.push(h)}),{suggestedDependencies:y,unnecessaryDependencies:b,duplicateDependencies:m,missingDependencies:l}}function qe(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 qe(e.consequent)!=null||qe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return qe(e.left)!=null||qe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return qe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return qe(e.expression);case"TSAsExpression":return qe(e.expression)}return null}function eo({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let a=r.variables.find(l=>l.name===i);if(a==null)return null;let p=a.defs[0];if(p==null)return null;if(p.type==="Variable"&&p.node.type==="VariableDeclarator"&&p.node.id.type==="Identifier"&&p.node.init!=null){let l=qe(p.node.init);if(l!=null)return[a,l]}return p.type==="FunctionName"&&p.node.type==="FunctionDeclaration"?[a,"function"]:p.type==="ClassName"&&p.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function s(i){let a=!1;for(let p=0;p<i.references.length;p++){let l=i.references[p];if(l.writeExpr){if(a)return!0;a=!0;continue}let u=l.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!Er(t,l.identifier))return!0}return!1}return o.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:s(i)}))}function Sr(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)?Sr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Xt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function We(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=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Xt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Xt(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=We(r.object,t),o=We(r.property,null),s=`${n}.${o}`;return Xt(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function Tr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function to(e,t){let r=Tr(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=We(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 Bt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),ro(n,t))return n;if(Er(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(dr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{dr(i)&&(i.parent=n,r.push(i))}))}return null}function no(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 dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function ro(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 Er(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function io(e){return!1}var le=require("@typescript-eslint/utils"),H=Ne(require("typescript")),Zt=require("zod/v4");var Ht=require("@typescript-eslint/utils");function it(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:it(e.parent,t,r===1/0?r:r-1)}function*Yt(e){yield e,e.parent&&(yield*Yt(e.parent))}function qt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function br(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Ht.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===Ht.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function hr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function oo(e,t){return e[t]}function Me(e,t,r){let n=r.visitorKeys,o=new Set;function s(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let p=n[i.type];if(p)for(let l of p){let u=oo(i,l);if(u){if(Array.isArray(u)){for(let f of u)if(hr(f)&&s(f))return!0}else if(hr(u)&&s(u))return!0}}return!1}s(e)}var so=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="improved-no-unnecessary-condition",ao=Zt.z.object({alternativeForInCondition:Zt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),Cr={object:"Array",property:"isArray"},lo=["string","number","bigint","boolean","symbol","undefined","object","function","never"],po=new Set(lo),Gt={name:xr,rule:so({name:xr,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}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[$(ao)]},defaultOptions:[{}],create(e,[t]){let r=le.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===le.AST_NODE_TYPES.UnaryExpression&&c.operator==="typeof"}function s(c){return c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown?null:c.flags&H.default.TypeFlags.StringLike?["string"]:c.flags&H.default.TypeFlags.NumberLike?["number"]:c.flags&H.default.TypeFlags.BigIntLike?["bigint"]:c.flags&H.default.TypeFlags.BooleanLike?["boolean"]:c.flags&H.default.TypeFlags.ESSymbolLike?["symbol"]:c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void?["undefined"]:c.flags&H.default.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&H.default.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&H.default.TypeFlags.NonPrimitive?["object"]:c.flags&H.default.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v.expression);if(d.flags&H.default.TypeFlags.Any||d.flags&H.default.TypeFlags.Unknown)return null;let T=[];if(d.isUnion()){for(let P of d.types){let L=s(P);if(L)T.push(...L);else return null}return T}let F=s(d);return F?(T.push(...F),T):null}function a(c){if(!(c.operator==="==="||c.operator==="!=="))return;let d=null,T=null;if(o(c.left)?(d=c.left,T=c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,T=c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!T||!co(T,po))return;let F=i(d);if(!F)return;let P=c.operator==="!==",L=F.includes(T);F.length===1?L&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:T}}):!L&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Array.from(F)[0]}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):L&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!L&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Ct(F)}})}function p(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return null;if(c.isUnion()){let v=[];for(let d of c.types)if(d.flags&H.default.TypeFlags.StringLiteral){let T=d.value;v.push(T)}else return null;return v}return c.flags&H.default.TypeFlags.StringLiteral?[c.value]:null}function l(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(v),T=p(d);if(T)return T;let F=n.getSymbolAtLocation(v);if(F){let P=n.getTypeOfSymbolAtLocation(F,v),L=p(P);if(L)return L}return null}function u(c){let v=e.sourceCode.ast,d=null;return Me(v,T=>{if(T.type===le.AST_NODE_TYPES.VariableDeclarator&&T.id.type===le.AST_NODE_TYPES.Identifier&&T.id.name===c.name&&T.id.typeAnnotation){let F=T.id.typeAnnotation.typeAnnotation;if(F.type===le.AST_NODE_TYPES.TSUnionType){let P=[];for(let L of F.types)if(L.type===le.AST_NODE_TYPES.TSLiteralType&&L.literal.type===le.AST_NODE_TYPES.Literal&&typeof L.literal.value=="string")P.push(L.literal.value);else return!0;return d=P,!0}if(F.type===le.AST_NODE_TYPES.TSLiteralType&&F.literal.type===le.AST_NODE_TYPES.Literal&&typeof F.literal.value=="string")return d=[F.literal.value],!0}return!1},e.sourceCode),d}function f(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function y(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let v=n.getApparentType(c);if(v!==c&&(n.isArrayType(v)||n.isTupleType(v)))return!0;if(c.aliasSymbol){let T=n.getFullyQualifiedName(c.aliasSymbol);if(f(T))return!0}let d=c.getSymbol();if(d){let T=n.getFullyQualifiedName(d);if(f(T))return!0}return!1}function b(c){if(!n)return!1;if(c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void||c.flags&H.default.TypeFlags.Never)return!0;let v=c.getSymbol();if(v){let d=n.getFullyQualifiedName(v);if(d==="__function"||d==="__object"&&!y(c))return!0}return!1}function m(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let v=!0,d=!0;for(let T of c.types){let F=m(T);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(v=!1),F!=="alwaysFalse"&&(d=!1)}return v?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(c)?"alwaysTrue":b(c)?"alwaysFalse":"unknown"}function h(c){return!c.computed&&c.object.type===le.AST_NODE_TYPES.Identifier&&c.object.name===Cr.object&&c.property.type===le.AST_NODE_TYPES.Identifier&&c.property.name===Cr.property}function C(c){if(!n||c.callee.type!==le.AST_NODE_TYPES.MemberExpression||!h(c.callee)||c.arguments.length===0)return;let[v]=c.arguments;if(!v||v.type===le.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(v),T=n.getTypeAtLocation(d),F=m(T);F==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(c){if(c.callee.type!==le.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==le.AST_NODE_TYPES.Identifier||c.callee.computed)return;let v=c.callee.property.name;if(v!=="startsWith"&&v!=="endsWith"&&v!=="includes"||c.arguments.length!==1)return;let[d]=c.arguments;if(!d||d.type!==le.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let T=c.callee.object,F=l(T);if(!F&&T.type===le.AST_NODE_TYPES.Identifier&&(F=u(T)),!F||F.length===0)return;let P=d.value;if(v==="includes"&&F.length>1)return;let L=0,X=0;for(let G of F)if((v==="startsWith"?G.startsWith(P):v==="endsWith"?G.endsWith(P):G.includes(P))?L++:X++,L>0&&X>0)return;if(L>0&&X===0){let G=v==="startsWith"?"unnecessaryStartsWithCondition":v==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&L===0){let G=v==="startsWith"?"alwaysFalseStartsWithCondition":v==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function d(q){if(q.type!==le.AST_NODE_TYPES.MemberExpression||q.computed||q.property.type!==le.AST_NODE_TYPES.Identifier||q.property.name!=="length")return null;let D=q.object,Z=l(D);if(!Z||Z.length===0)return null;let B=[];for(let ue of Z)B.push(ue.length);return{values:B}}let T=d(c.left),F=d(c.right),P=null,L=null;if(T?c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(P=T.values,L=c.right.value):F&&c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(P=F.values,L=c.left.value),!P||L===null)return;let X=0,G=0;for(let q of P){let D=!1;if(c.operator==="==="?D=q===L:c.operator==="!=="?D=q!==L:c.operator===">"?D=q>L:c.operator===">="?D=q>=L:c.operator==="<"?D=q<L:c.operator==="<="&&(D=q<=L),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===le.AST_NODE_TYPES.Literal&&typeof c.value=="string")return c.value;let v=l(c);if(!v||v.length!==1)return null;let[d]=v;return d??null}function g(c){return(c.flags&H.default.TypeFlags.Intersection)!==0}function E(c){return(c.flags&H.default.TypeFlags.Object)!==0}function x(c){return!n||n.getIndexTypeOfType(c,H.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,H.default.IndexKind.Number)}function w(c,v){if(!n||x(c)||c.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(c,v);return d?d.flags&H.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,v){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown||c.flags&H.default.TypeFlags.Never||c.flags&H.default.TypeFlags.TypeParameter||c.flags&H.default.TypeFlags.IndexedAccess||c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.NonPrimitive||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void)return"unknown";if(c.isUnion()){let d=!0,T=!0;for(let F of c.types){let P=k(F,v);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(T=!1),P==="optional"))return"unknown"}return d?"required":T?"absent":"unknown"}if(g(c)){let d=c,T=!1,F=!1;for(let P of d.types){let L=k(P,v);if(L==="unknown")return"unknown";L==="required"?T=!0:L==="optional"&&(F=!0)}return T?"required":F?"optional":"absent"}return E(c)?w(c,v):"unknown"}function N(c){if(c.operator!=="in"||c.left.type===le.AST_NODE_TYPES.PrivateIdentifier)return;let v=A(c.left);if(!v)return;let d=c.right,T=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let F=n.getTypeAtLocation(T),P=k(F,v);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){a(c),I(c),N(c)},CallExpression(c){S(c),C(c)}}}})};function Ct(e){return Array.from(new Set(e)).join(" | ")||"never"}function ot(e,t){let r=e.argument;return r.type===le.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function co(e,t){return t.has(e)}var yt=require("@typescript-eslint/utils"),Qe=require("zod/v4");var uo=Qe.z.object({functions:Qe.z.array(Qe.z.string().or(Qe.z.object({name:Qe.z.string(),message:Qe.z.string()})))});function fo(e){if(e.type===yt.AST_NODE_TYPES.Identifier)return e.name;if(e.type===yt.AST_NODE_TYPES.MemberExpression&&e.property.type===yt.AST_NODE_TYPES.Identifier&&e.object.type===yt.AST_NODE_TYPES.Identifier)return`${e.object.name}.${e.property.name}`}var Kt=z({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[$(uo)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let s of t.functions){let i=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function o(s){if(r.has(s))return{message:r.get(s)};let i=s.indexOf(".");if(i!==-1){let a=s.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(s){let i=fo(s.callee);if(!i||!s.typeArguments)return;let a=o(i);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});var Oe=require("@typescript-eslint/utils"),mo=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-call-with-inferred-generics",yo=mo({name:Ir,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(s=>[s.name,s])),n=t.functions.some(s=>s.disallowTypeOf),o=new Set;return{...n&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Oe.AST_NODE_TYPES.TSTypeQuery&&o.add(s.id.name)}},CallExpression(s){let{callee:i}=s;if(i.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:p=1,allowAny:l,disallowTypes:u=t.disallowTypes,disallowTypeOf:f,disallowUnknown:y}=a;(s.typeArguments?.params.length||0)<(p||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:p||0}}),!(l&&!u)&&(s.typeArguments?.params.some(m=>!l&&m.type===Oe.AST_NODE_TYPES.TSAnyKeyword||u&&m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&u.includes(m.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),y&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),f&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSTypeQuery||m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&o.has(m.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),Qt={name:Ir,rule:yo};var Fr=require("@typescript-eslint/utils"),go=Fr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-commented-out-code",So=["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:"],To=/^\s*return\s+/,Eo=/\w=("|'|`)/,ho=/\w+:\s*('|"|`)/,bo=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,xo=/\w+-\w+:/,Co=/\w+_\w+:/,Io=/\?\s+\w/,Ao=/:\s+\w/,wo=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Fo=/^\s*\d+[,}]/,vo=/^\s*\[[^\]]*\][,}]/,Ro=/^\s*\{[^}]*\}[,}]/,ko=/\.\w+\(/,Po=/\[\w+\]/,No=/^\s*(['"`]).+?\1\s*:/,Oo=/^<[A-Z]\w*(\s|>|\/)/,Do=/^<[a-z]+(\s|>|\/)/,jo=/<[A-Z]\w*(\s.*)?>/,Lo=/<\/[A-Z]\w*>/,Mo=/<[a-z]+(\s.*)?>/,_o=/<\/[a-z]+>/,$o=/^\s*[*\s]*$/,Uo=/^[a-zA-Z]/,zo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Vo=/```[\s\S]*?```/g,Wo=/`[^`]*`/g,Ar=/[a-zA-Z0-9]/,Jo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Xo=/[{}[\]()`=<>]/,Bo=/:\s*(['"`[{(]|\w+\s*=>)/,Ho=/\bif\s*\(|\belse\b|=>/,de={returnStatement:To,stringAssignment:Eo,objectPropertyWithQuotes:ho,computedPropertyAssignment:bo,kebabCaseProperty:xo,snakeCaseProperty:Co,ternaryOperator:Io,colonWithWord:Ao,quotedString:wo,numberWithComma:Fo,arrayWithComma:vo,objectWithComma:Ro,methodCall:ko,arrayAccess:Po,quotedPropertyKey:No,jsxSelfClosing:Oo,jsxElement:Do,jsxOpeningTag:jo,jsxClosingTag:Lo,htmlOpeningTag:Mo,htmlClosingTag:_o,jsdocComment:$o};function Yo(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Uo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Jo.test(t)||Xo.test(t)||Bo.test(t)||Ho.test(t)?!1:!!(t.includes(":")&&zo.test(t))}var qo=[") {","return;",de.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",de.stringAssignment,");",de.objectPropertyWithQuotes,de.computedPropertyAssignment,de.kebabCaseProperty,de.snakeCaseProperty,"&&","||","()",de.ternaryOperator,de.colonWithWord,de.quotedString,de.numberWithComma,de.arrayWithComma,de.objectWithComma,de.methodCall,de.arrayAccess,"?.(","??","=>",de.quotedPropertyKey],Zo=["/>","</",de.jsxSelfClosing,de.jsxElement,de.jsxOpeningTag,de.jsxClosingTag,de.htmlOpeningTag,de.htmlClosingTag],wr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Go=go({name:vr,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 s=n.trimStart();if(n.startsWith("*")||s.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")||de.jsdocComment.test(n))return!1;for(let i of wr)if(s.startsWith(i))return!1;if(n.includes("https://")||Yo(s))return!1;if(o==="Block"){for(let i of Zo)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 So)if(s.startsWith(i))return{wrongPattern:i};for(let i of qo)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 s=n,i=s.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return s;if(o==="Block"&&s.includes("```")){let l=s.split(Vo);l.some(f=>Ar.test(f))&&(s=l.join(""))}if(!s.includes("`"))return s;let a=s.split(Wo);return a.some(l=>Ar.test(l))?a.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),a=t(i,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:wr.join(", ")}})}}}}}),en={name:vr,rule:Go};var It=require("@typescript-eslint/utils"),Ko=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rr="no-default-export",Qo=Ko({name:Rr,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===It.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),tn={name:Rr,rule:Qo};var kr=require("@typescript-eslint/utils"),es=kr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="no-leaked-text-in-jsx",ts=[",",";","[","]","(",")"],ns=es({name:Pr,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="";ts.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),nn={name:Pr,rule:ns};var Ze=require("@typescript-eslint/utils"),rs=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-non-camel-case-functions",is=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Nr(e){if(e.typeName.type!==Ze.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ze.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var os=rs({name:Or,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&&!is.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ze.AST_NODE_TYPES.TSTypeReference?Nr(r):r.type===Ze.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Ze.AST_NODE_TYPES.TSTypeReference&&Nr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),rn={name:Or,rule:os};var ae=require("@typescript-eslint/utils");var ss=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dr="no-optional-root-props",as=ss({name:Dr,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 s=e.sourceCode.getDeclaredVariables(n)[0];if(!s||s.references.length!==1)return!1;let i=s.references[0];if(!i)return!1;for(let a of Yt(i.identifier)){if("returnType"in a||a.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let p=a.parent;if(!p)return!1;if(p.type===ae.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&p.parent.type===ae.TSESTree.AST_NODE_TYPES.TSTypeReference&&p.parent.typeName.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&p.parent.typeName.name==="FC"){let u=it(p.parent.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=At(u,e.sourceCode);return f?!(f.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(a.type===ae.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(p.type===ae.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let l=it(p,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration);return l?!!At(l,e.sourceCode):!1}if(p.type===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!At(p,e.sourceCode)}return!1}function r(n){n.key.type!==ae.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 s=it(n,ae.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let i=e.sourceCode.getText(s);return o.replaceText(s,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(wt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(wt(n)||!t(n)))for(let o of n.body.body)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==ae.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=it(n.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=At(s,e.sourceCode);if(!(!i||i.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let p of o.members)p.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(p)}}}});function wt(e){return e?e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function At(e,t){if(wt(e))return;let r;if(e.type===ae.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===ae.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===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let s=o.references.filter(i=>i.identifier!==r);if(!(s.length!==1||!s[0])&&!wt(s[0].identifier.parent.parent))return s[0].identifier}var on={name:Dr,rule:as};var dt=require("@typescript-eslint/utils");var gt=z({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===dt.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===dt.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===dt.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===dt.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var jr=require("@typescript-eslint/utils"),Ft=Ne(require("path")),Je=require("zod/v4");var ls=jr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lr="no-relative-imports",ps=Je.z.object({find:Je.z.string(),replacement:Je.z.string()}),cs=Je.z.object({aliases:Je.z.array(ps),rootDir:Je.z.string().optional(),allowNotFoundAliases:Je.z.boolean().optional(),_dev_simulateFileName:Je.z.string().optional()}),us=ls({name:Lr,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:[$(cs)]},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,a){let p=Ft.default.dirname(a);return Ft.default.resolve(p,i)}function s(i){let a=t.rootDir??process.cwd(),p=Ft.default.relative(a,i);if(p.startsWith("."))return null;p.startsWith("/")||(p=`/${p}`);for(let{find:l,replacement:u}of t.aliases)if(p.startsWith(u)){let f=p.replace(u,l);return{alias:l,newPath:f}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let p=o(a,r),l=s(p);!l&&t.allowNotFoundAliases||e.report({node:i,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?u=>u.replaceText(i.source,`'${l.newPath}'`):void 0})}}}}),sn={name:Lr,rule:us};var ge=require("@typescript-eslint/utils"),an=require("zod/v4");var fs=an.z.object({customMessage:an.z.string().optional()}),ln=z({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(fs)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ge.AST_NODE_TYPES.Literal:return!0;case ge.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ge.AST_NODE_TYPES.Property?o.computed||o.value.type===ge.AST_NODE_TYPES.Identifier&&o.key.type===ge.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ge.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ge.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ge.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ge.AST_NODE_TYPES.ConditionalExpression:case ge.AST_NODE_TYPES.LogicalExpression:case ge.AST_NODE_TYPES.BinaryExpression:case ge.AST_NODE_TYPES.UnaryExpression:case ge.AST_NODE_TYPES.CallExpression:case ge.AST_NODE_TYPES.MemberExpression:case ge.AST_NODE_TYPES.Identifier:case ge.AST_NODE_TYPES.ArrowFunctionExpression:case ge.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ge.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ge.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ge.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ge.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var St=require("@typescript-eslint/utils"),et=Ne(require("zod/v4"));var ms=et.object({alternativeMsgs:et.object({inArrayFind:et.string().optional(),inArrayFilter:et.string().optional()}).optional(),__dev_simulateFileName:et.string().optional()});function ys(e){return e.typeAnnotation.type!==St.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var ds=/(typeGuards|type-guards)\.(ts|tsx)$/;function gs(e){return ds.test(e)}function Ss(e){let t=e.parent;for(;t;){if(t.type===St.AST_NODE_TYPES.CallExpression&&t.callee.type===St.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===St.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var pn=z({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:[$(ms)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(gs(r))return{};function n(o){if(!ys(o))return;let s=Ss(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:a,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 tt=require("@typescript-eslint/utils");var Ts="no-unnecessary-async-on-jsx-props";function Es(e){if(e.body.type!==tt.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!==tt.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===tt.AST_NODE_TYPES.AwaitExpression}var cn=z({name:Ts,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){Es(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,s=[],i=o.getFirstToken(r,p=>p.value==="async");if(i){let p=o.getTokenAfter(i);p?s.push(n.replaceTextRange([i.range[0],p.range[0]],"")):s.push(n.remove(i))}function a(p){if(p.type===tt.AST_NODE_TYPES.AwaitExpression){let l=o.getFirstToken(p);if(l&&l.value==="await"){let u=o.getTokenAfter(l);u?s.push(n.replaceTextRange([l.range[0],u.range[0]],"")):s.push(n.remove(l))}}if(p.type===tt.AST_NODE_TYPES.BlockStatement)for(let l of p.body)a(l);else p.type===tt.AST_NODE_TYPES.ExpressionStatement&&a(p.expression)}return a(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Xe=require("@typescript-eslint/utils"),un=Ne(require("typescript")),st=Ne(require("zod/v4"));var hs=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="no-unnecessary-casting",bs=st.default.object({additionalCastFunctions:st.default.array(st.default.object({name:st.default.string(),expectedType:st.default.enum(["string","number"])})).optional()}),fn={name:Mr,rule:hs({name:Mr,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:[$(bs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Xe.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(u,f){switch(u.type){case Xe.AST_NODE_TYPES.Literal:return f==="number"?typeof u.value=="number":typeof u.value=="string";case Xe.AST_NODE_TYPES.TemplateLiteral:return f==="string";case Xe.AST_NODE_TYPES.UnaryExpression:return f==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function a(u,f){return f==="number"?!!(u.flags&un.TypeFlags.NumberLike):!!(u.flags&un.TypeFlags.StringLike)}function p(u,f){return y=>y.replaceText(u,e.sourceCode.getText(f))}function l(u){if(!s||u.arguments.length!==1)return;let f=u.arguments[0];if(!f||f.type===Xe.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==Xe.AST_NODE_TYPES.Identifier)return;let b=y.name,m=n.find(C=>C.name===b);if(!m)return;if(i(f,m.expectedType)||a(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,S;b==="Number"?C="unnecessaryNumberCasting":b==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",S={name:m.name,type:m.expectedType}),e.report({node:u,messageId:C,...S?{data:S}:{},fix:p(u,f)})}}return{CallExpression:l}}})};var ve=require("@typescript-eslint/utils"),vt=Ne(require("zod/v4"));var xs=vt.object({ignoreWithDescription:vt.string().optional()}),mn=z({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[$(xs)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(p){let l=p.arguments[0];return l&&l.type===ve.AST_NODE_TYPES.Literal&&typeof l.value=="string"?l.value:null}function s(p){return!p||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(p)}function i(p){return p.length!==1?!1:n.body.filter(u=>{if(u.type===ve.AST_NODE_TYPES.ExpressionStatement){let f=u.expression;if(f.type===ve.AST_NODE_TYPES.CallExpression&&f.callee.type===ve.AST_NODE_TYPES.Identifier){let y=f.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function a(p){let l=p.arguments[1];if(l&&(l.type===ve.AST_NODE_TYPES.FunctionExpression||l.type===ve.AST_NODE_TYPES.ArrowFunctionExpression)&&l.body.type===ve.AST_NODE_TYPES.BlockStatement){let u=l.body.body;return u.length===0?"":u.map(y=>r.text.slice(y.range[0],y.range[1])).join(`
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=p.acquire(I),k=new Set,N=null;{let R=w.upper;for(;R&&(k.add(R),R.type!=="function");)R=R.upper;if(!R)return;N=R}let c=Array.isArray;function v(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let W=O.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=O.node.parent;if(J==null&&(Yt(N.block,O.node.id),J=O.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let V=O.node.id,{name:K}=Y;if(K==="useRef"&&V.type==="Identifier")return!0;if(ao(Y)&&V.type==="Identifier"){for(let ee of R.references)ee!==V&&y.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&c(R.identifiers)){if(V.elements[1]===R.identifiers[0]){if(K==="useState"){let ee=R.references,Fe=0;for(let Ve=0;Ve<ee.length;Ve++){if(ee[Ve].isWrite()&&Fe++,Fe>1)return!1;l.set(ee[Ve].identifier,V.elements[0])}}return!0}else if(V.elements[0]===R.identifiers[0]){if(K==="useState"){let ee=R.references;for(let Fe=0;Fe<ee.length;Fe++)d.add(ee[Fe].identifier)}return!1}}}else if(K==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(R.identifiers)&&V.elements[1]===R.identifiers[0])return!0;return!1}function g(R){if(!c(R.defs))return!1;let O=R.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let W=O.node,J=N.childScopes,Y=null,V;for(V=0;V<J.length;V++){let K=J[V],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(V=0;V<Y.through.length;V++){let K=Y.through[V];if(K.resolved!=null&&k.has(K.resolved.scope)&&!E(K.resolved))return!1}return!0}let E=m(v,u),F=m(g,f),P=new Map;function L(R){let O=R.from,W=!1;for(;O.block!==I;)O.type==="function"&&(W=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return W}let X=new Map,G=new Map;q(w);function q(R){for(let O of R.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let W=Yt(I,O.identifier),J=hr(W),Y=We(J,G);if(x&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&L(O)&&P.set(Y,{reference:O,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let V=O.resolved.defs[0];if(V!=null&&!(V.node!=null&&V.node.init===I.parent)&&V.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(O);else{let K=O.resolved,ee=E(K)||F(K);X.set(Y,{isStable:ee,references:[O]})}}for(let O of R.childScopes)q(O)}P.forEach(({reference:R,dependencyNode:O},W)=>{let J=R.resolved.references,Y=!1;for(let V=0;V<J.length;V++){let{identifier:K}=J[V],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||a({node:O.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(R,O){D.has(O)||(D.add(O),a({node:R,message:`Assignments to the '${O}' variable from inside React Hook ${r(S)} 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(S)}.`}))}let B=new Set;if(X.forEach(({isStable:R,references:O},W)=>{R&&B.add(W),O.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let R=null;if(X.forEach(({isStable:O,references:W},J)=>{R||W.forEach(Y=>{if(R)return;let V=Y.identifier;if(!l.has(V))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(R=J)})}),R){let{suggestedDependencies:O}=Bt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:new Set,isEffect:!0});a({node:S,message:`React Hook ${h} contains a call to '${R}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${h} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],de=new Set;A.type!=="ArrayExpression"?a({node:A,message:`React Hook ${r(S)} 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.`}):A.elements.forEach(R=>{if(R===null)return;if(R.type==="SpreadElement"){a({node:R,message:`React Hook ${r(S)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}y.has(R)&&a({node:R,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(R)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(R)}\``,fix(Y){return Y.removeRange(R.range)}}]});let O;try{O=We(R,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){R.type==="Literal"?X.has(R.value)?a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. Did you mean to include ${R.value} in the array instead?`}):a({node:R,message:`The ${R.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):a({node:R,message:`React Hook ${r(S)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=R;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!N.through.some(Y=>Y.identifier===W);ue.push({key:O,node:R}),J||de.add(O)});let{suggestedDependencies:Pe,unnecessaryDependencies:He,missingDependencies:Ee,duplicateDependencies:yt}=Bt({dependencies:X,declaredDependencies:ue,stableDependencies:B,externalDependencies:de,isEffect:x}),ot=Pe;if(yt.size+Ee.size+He.size===0){let R=Sr(S),O=R&&gr(R);if(t&&!O)return;ro({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:V})=>{let K=V==="function"?"useCallback":"useMemo",ee=V==="function"?"definition":"initialization",Fe=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Ve=Y?`To fix this, ${Fe}`:`Move it inside the ${h} callback. Alternatively, ${Fe}`,_i=V==="conditional"||V==="logical expression"?"could make":"makes",$i=`The '${J.name.name}' ${V} ${_i} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${Ve}`,ar;Y&&J.type==="Variable"&&V==="function"&&(ar=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(lr){let[Ui,zi]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[lr.insertTextBefore(J.node.init,Ui),lr.insertTextAfter(J.node.init,zi)]}}]),a({node:J.node,message:$i,suggest:ar})});return}!x&&Ee.size>0&&(ot=Bt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:de,isEffect:x}).suggestedDependencies);function xe(){if(ue.length===0)return!0;let R=ue.map(W=>W.key),O=R.slice().sort();return R.join(",")===O.join(",")}xe()&&ot.sort();function Ae(R){let O=R.split("."),W="";for(let J=0;J<O.length;J++){if(J!==0){let Y=O.slice(0,J+1).join("."),V=G.get(Y)===!0;W+=V?"?.":"."}W+=O[J]}return W}function Vt(R,O,W,J){return R.size===0?null:(R.size>1?"":O+" ")+W+" "+(R.size>1?"dependencies":"dependency")+": "+oo(Array.from(R).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${J} ${R.size>1?"them":"it"} or remove the dependency array.`}let Le="";if(He.size>0){let R=null;if(Array.from(He.keys()).forEach(O=>{R===null&&O.endsWith(".current")&&(R=O)}),R!==null)Le=` Mutable values like '${R}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(de.size>0){let O=Array.from(de)[0];w.set.has(O)||(Le=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Le&&Ee.has("props")){let R=X.get("props");if(R==null)return;let O=R.references;if(!Array.isArray(O))return;let W=!0;for(let J=0;J<O.length;J++){let Y=O[J],V=Yt(N.block,Y.identifier);if(!V){W=!1;break}let K=V.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(Le=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${h} call and refer to those specific props inside ${r(S)}.`)}if(!Le&&Ee.size>0){let R=null;Ee.forEach(O=>{if(R)return;let W=N.set.get(O),J=X.get(O);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let V=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){V=!0;break}V&&(R=O)}),R!==null&&(Le=` If '${R}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Le&&Ee.size>0){let R=null;if(Ee.forEach(O=>{if(R!==null)return;let J=X.get(O).references,Y,V;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,V=Y.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=l.get(V.callee);if(ee!=null){if(ee.name===O)R={missingDep:O,setter:V.callee.name,form:"updater"};else if(d.has(Y))R={missingDep:O,setter:V.callee.name,form:"reducer"};else{let Fe=J[K].resolved;if(Fe!=null){let Ve=Fe.defs[0];Ve!=null&&Ve.type==="Parameter"&&(R={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(R!==null)break}}),R!==null)switch(R.form){case"reducer":Le=` You can also replace multiple useState variables with useReducer if '${R.setter}' needs the current value of '${R.missingDep}'.`;break;case"inlineReducer":Le=` If '${R.setter}' needs the current value of '${R.missingDep}', you can also switch to useReducer instead of useState and read '${R.missingDep}' in the reducer.`;break;case"updater":Le=` You can also do a functional update '${R.setter}(${R.missingDep.slice(0,1)} => ...)' if you only need '${R.missingDep}' in the '${R.setter}' call.`;break;default:throw new Error("Unknown case.")}}a({node:A,message:`React Hook ${r(S)} has `+(Vt(Ee,"a","missing","include")||Vt(He,"an","unnecessary","exclude")||Vt(yt,"a","duplicate","omit"))+Le,suggest:[{desc:`Update the dependencies array to be: [${ot.map(Ae).join(", ")}]`,fix(R){return R.replaceText(A,`[${ot.map(Ae).join(", ")}]`)}}]})}function C(I){let A=io(I.callee,i);if(A===-1)return;let S=I.arguments[A],h=I.callee,x=br(h).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(x);if(!S){a({node:h,message:`React Hook ${x} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let N=Sr(h);if(!(N&&gr(N)))return}if(!w&&!k){(x==="useMemo"||x==="useCallback")&&a({node:h,message:`React Hook ${x} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(S.type){case"FunctionExpression":case"ArrowFunctionExpression":b(S,w,h,x,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(v=>v&&v.type==="Identifier"&&v.name===S.name))return;let N=n(I).set.get(S.name);if(N==null||N.defs==null)return;let c=N.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":b(c.node,w,h,x,k);return;case"VariableDeclarator":let v=c.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":b(v,w,h,x,k);return}break}break;default:a({node:h,message:`React Hook ${x} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:h,message:`React Hook ${x} has a missing dependency: '${S.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${S.name}]`,fix(N){return N.replaceText(w,`[${S.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(no.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function Bt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let s=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,C)=>{let T=a(s,C);T.isUsed=!0,p(s,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let C=a(s,b);C.isSatisfiedRecursively=!0}),r.forEach(b=>{let C=a(s,b);C.isSatisfiedRecursively=!0});function a(b,C){let T=C.split("."),I=b;for(let A of T){let S=I.children.get(A);S||(S=i(),I.children.set(A,S)),I=S}return I}function p(b,C,T){let I=C.split("."),A=b;for(let S of I){let h=A.children.get(S);if(!h)return;T(h),A=h}}let l=new Set,d=new Set;u(s,l,d,b=>b);function u(b,C,T,I){b.children.forEach((A,S)=>{let h=I(S);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&T.add(h);return}if(A.isUsed){C.add(h);return}u(A,C,T,x=>h+"."+x)})}let f=[],y=new Set,m=new Set;return t.forEach(({key:b})=>{d.has(b)?f.indexOf(b)===-1?f.push(b):m.add(b):y.add(b)}),l.forEach(b=>{f.push(b)}),{suggestedDependencies:f,unnecessaryDependencies:y,duplicateDependencies:m,missingDependencies:l}}function qe(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 qe(e.consequent)!=null||qe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return qe(e.left)!=null||qe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return qe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return qe(e.expression);case"TSAsExpression":return qe(e.expression)}return null}function ro({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let a=r.variables.find(l=>l.name===i);if(a==null)return null;let p=a.defs[0];if(p==null)return null;if(p.type==="Variable"&&p.node.type==="VariableDeclarator"&&p.node.id.type==="Identifier"&&p.node.init!=null){let l=qe(p.node.init);if(l!=null)return[a,l]}return p.type==="FunctionName"&&p.node.type==="FunctionDeclaration"?[a,"function"]:p.type==="ClassName"&&p.node.type==="ClassDeclaration"?[a,"class"]:null}).filter(Boolean);function s(i){let a=!1;for(let p=0;p<i.references.length;p++){let l=i.references[p];if(l.writeExpr){if(a)return!0;a=!0;continue}let d=l.from;for(;d!==n&&d!=null;)d=d.upper;if(d!==n&&!xr(t,l.identifier))return!0}return!1}return o.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:s(i)}))}function hr(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)?hr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Ht(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function We(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=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Ht(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=We(e.object,t),n=We(e.property,null),o=`${r}.${n}`;return Ht(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=We(r.object,t),o=We(r.property,null),s=`${n}.${o}`;return Ht(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function br(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function io(e,t){let r=br(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=We(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 Yt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),so(n,t))return n;if(xr(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(Tr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{Tr(i)&&(i.parent=n,r.push(i))}))}return null}function oo(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 Tr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function so(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 xr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function ao(e){return!1}var le=require("@typescript-eslint/utils"),H=Ne(require("typescript")),Kt=require("zod/v4");var qt=require("@typescript-eslint/utils");function st(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:st(e.parent,t,r===1/0?r:r-1)}function*Zt(e){yield e,e.parent&&(yield*Zt(e.parent))}function Gt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Ir(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===qt.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===qt.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function Cr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function lo(e,t){return e[t]}function Me(e,t,r){let n=r.visitorKeys,o=new Set;function s(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let p=n[i.type];if(p)for(let l of p){let d=lo(i,l);if(d){if(Array.isArray(d)){for(let u of d)if(Cr(u)&&s(u))return!0}else if(Cr(d)&&s(d))return!0}}return!1}s(e)}var po=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="improved-no-unnecessary-condition",co=Kt.z.object({alternativeForInCondition:Kt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),wr={object:"Array",property:"isArray"},uo=["string","number","bigint","boolean","symbol","undefined","object","function","never"],fo=new Set(uo),Qt={name:Ar,rule:po({name:Ar,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}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[$(co)]},defaultOptions:[{}],create(e,[t]){let r=le.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===le.AST_NODE_TYPES.UnaryExpression&&c.operator==="typeof"}function s(c){return c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown?null:c.flags&H.default.TypeFlags.StringLike?["string"]:c.flags&H.default.TypeFlags.NumberLike?["number"]:c.flags&H.default.TypeFlags.BigIntLike?["bigint"]:c.flags&H.default.TypeFlags.BooleanLike?["boolean"]:c.flags&H.default.TypeFlags.ESSymbolLike?["symbol"]:c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void?["undefined"]:c.flags&H.default.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&H.default.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&H.default.TypeFlags.NonPrimitive?["object"]:c.flags&H.default.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),g=n.getTypeAtLocation(v.expression);if(g.flags&H.default.TypeFlags.Any||g.flags&H.default.TypeFlags.Unknown)return null;let E=[];if(g.isUnion()){for(let P of g.types){let L=s(P);if(L)E.push(...L);else return null}return E}let F=s(g);return F?(E.push(...F),E):null}function a(c){if(!(c.operator==="==="||c.operator==="!=="))return;let g=null,E=null;if(o(c.left)?(g=c.left,E=c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(g=c.right,E=c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!g||!E||!mo(E,fo))return;let F=i(g);if(!F)return;let P=c.operator==="!==",L=F.includes(E);F.length===1?L&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:at(g,e),type:E}}):!L&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:at(g,e),type:Array.from(F)[0]}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:at(g,e),actualType:At(F),conditionType:E}}):L&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:at(g,e),actualType:At(F),conditionType:E}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:at(g,e),actualType:At(F),conditionType:E}}):!L&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:at(g,e),type:At(F)}})}function p(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return null;if(c.isUnion()){let v=[];for(let g of c.types)if(g.flags&H.default.TypeFlags.StringLiteral){let E=g.value;v.push(E)}else return null;return v}return c.flags&H.default.TypeFlags.StringLiteral?[c.value]:null}function l(c){if(!n)return null;let v=r.esTreeNodeToTSNodeMap.get(c),g=n.getTypeAtLocation(v),E=p(g);if(E)return E;let F=n.getSymbolAtLocation(v);if(F){let P=n.getTypeOfSymbolAtLocation(F,v),L=p(P);if(L)return L}return null}function d(c){let v=e.sourceCode.ast,g=null;return Me(v,E=>{if(E.type===le.AST_NODE_TYPES.VariableDeclarator&&E.id.type===le.AST_NODE_TYPES.Identifier&&E.id.name===c.name&&E.id.typeAnnotation){let F=E.id.typeAnnotation.typeAnnotation;if(F.type===le.AST_NODE_TYPES.TSUnionType){let P=[];for(let L of F.types)if(L.type===le.AST_NODE_TYPES.TSLiteralType&&L.literal.type===le.AST_NODE_TYPES.Literal&&typeof L.literal.value=="string")P.push(L.literal.value);else return!0;return g=P,!0}if(F.type===le.AST_NODE_TYPES.TSLiteralType&&F.literal.type===le.AST_NODE_TYPES.Literal&&typeof F.literal.value=="string")return g=[F.literal.value],!0}return!1},e.sourceCode),g}function u(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function f(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let v=n.getApparentType(c);if(v!==c&&(n.isArrayType(v)||n.isTupleType(v)))return!0;if(c.aliasSymbol){let E=n.getFullyQualifiedName(c.aliasSymbol);if(u(E))return!0}let g=c.getSymbol();if(g){let E=n.getFullyQualifiedName(g);if(u(E))return!0}return!1}function y(c){if(!n)return!1;if(c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void||c.flags&H.default.TypeFlags.Never)return!0;let v=c.getSymbol();if(v){let g=n.getFullyQualifiedName(v);if(g==="__function"||g==="__object"&&!f(c))return!0}return!1}function m(c){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let v=!0,g=!0;for(let E of c.types){let F=m(E);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(v=!1),F!=="alwaysFalse"&&(g=!1)}return v?"alwaysTrue":g?"alwaysFalse":"unknown"}return f(c)?"alwaysTrue":y(c)?"alwaysFalse":"unknown"}function b(c){return!c.computed&&c.object.type===le.AST_NODE_TYPES.Identifier&&c.object.name===wr.object&&c.property.type===le.AST_NODE_TYPES.Identifier&&c.property.name===wr.property}function C(c){if(!n||c.callee.type!==le.AST_NODE_TYPES.MemberExpression||!b(c.callee)||c.arguments.length===0)return;let[v]=c.arguments;if(!v||v.type===le.AST_NODE_TYPES.SpreadElement)return;let g=r.esTreeNodeToTSNodeMap.get(v),E=n.getTypeAtLocation(g),F=m(E);F==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function T(c){if(c.callee.type!==le.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==le.AST_NODE_TYPES.Identifier||c.callee.computed)return;let v=c.callee.property.name;if(v!=="startsWith"&&v!=="endsWith"&&v!=="includes"||c.arguments.length!==1)return;let[g]=c.arguments;if(!g||g.type!==le.AST_NODE_TYPES.Literal||typeof g.value!="string")return;let E=c.callee.object,F=l(E);if(!F&&E.type===le.AST_NODE_TYPES.Identifier&&(F=d(E)),!F||F.length===0)return;let P=g.value;if(v==="includes"&&F.length>1)return;let L=0,X=0;for(let G of F)if((v==="startsWith"?G.startsWith(P):v==="endsWith"?G.endsWith(P):G.includes(P))?L++:X++,L>0&&X>0)return;if(L>0&&X===0){let G=v==="startsWith"?"unnecessaryStartsWithCondition":v==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&L===0){let G=v==="startsWith"?"alwaysFalseStartsWithCondition":v==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function g(q){if(q.type!==le.AST_NODE_TYPES.MemberExpression||q.computed||q.property.type!==le.AST_NODE_TYPES.Identifier||q.property.name!=="length")return null;let D=q.object,Z=l(D);if(!Z||Z.length===0)return null;let B=[];for(let ue of Z)B.push(ue.length);return{values:B}}let E=g(c.left),F=g(c.right),P=null,L=null;if(E?c.right.type===le.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(P=E.values,L=c.right.value):F&&c.left.type===le.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(P=F.values,L=c.left.value),!P||L===null)return;let X=0,G=0;for(let q of P){let D=!1;if(c.operator==="==="?D=q===L:c.operator==="!=="?D=q!==L:c.operator===">"?D=q>L:c.operator===">="?D=q>=L:c.operator==="<"?D=q<L:c.operator==="<="&&(D=q<=L),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===le.AST_NODE_TYPES.Literal&&typeof c.value=="string")return c.value;let v=l(c);if(!v||v.length!==1)return null;let[g]=v;return g??null}function S(c){return(c.flags&H.default.TypeFlags.Intersection)!==0}function h(c){return(c.flags&H.default.TypeFlags.Object)!==0}function x(c){return!n||n.getIndexTypeOfType(c,H.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,H.default.IndexKind.Number)}function w(c,v){if(!n||x(c)||c.getProperties().length===0)return"unknown";let g=n.getPropertyOfType(c,v);return g?g.flags&H.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,v){if(c.flags&H.default.TypeFlags.Any||c.flags&H.default.TypeFlags.Unknown||c.flags&H.default.TypeFlags.Never||c.flags&H.default.TypeFlags.TypeParameter||c.flags&H.default.TypeFlags.IndexedAccess||c.flags&H.default.TypeFlags.StringLike||c.flags&H.default.TypeFlags.NumberLike||c.flags&H.default.TypeFlags.BigIntLike||c.flags&H.default.TypeFlags.BooleanLike||c.flags&H.default.TypeFlags.EnumLike||c.flags&H.default.TypeFlags.ESSymbolLike||c.flags&H.default.TypeFlags.NonPrimitive||c.flags&H.default.TypeFlags.Null||c.flags&H.default.TypeFlags.Undefined||c.flags&H.default.TypeFlags.Void)return"unknown";if(c.isUnion()){let g=!0,E=!0;for(let F of c.types){let P=k(F,v);if(P==="unknown"||(P!=="required"&&(g=!1),P!=="absent"&&(E=!1),P==="optional"))return"unknown"}return g?"required":E?"absent":"unknown"}if(S(c)){let g=c,E=!1,F=!1;for(let P of g.types){let L=k(P,v);if(L==="unknown")return"unknown";L==="required"?E=!0:L==="optional"&&(F=!0)}return E?"required":F?"optional":"absent"}return h(c)?w(c,v):"unknown"}function N(c){if(c.operator!=="in"||c.left.type===le.AST_NODE_TYPES.PrivateIdentifier)return;let v=A(c.left);if(!v)return;let g=c.right,E=r.esTreeNodeToTSNodeMap.get(g);if(!n)return;let F=n.getTypeAtLocation(E),P=k(F,v);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:v,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){a(c),I(c),N(c)},CallExpression(c){T(c),C(c)}}}})};function At(e){return Array.from(new Set(e)).join(" | ")||"never"}function at(e,t){let r=e.argument;return r.type===le.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function mo(e,t){return t.has(e)}var gt=require("@typescript-eslint/utils"),tt=require("zod/v4");var yo=tt.z.object({functions:tt.z.array(tt.z.string().or(tt.z.object({name:tt.z.string(),message:tt.z.string()})))});function go(e){if(e.type===gt.AST_NODE_TYPES.Identifier)return e.name;if(e.type===gt.AST_NODE_TYPES.MemberExpression&&e.property.type===gt.AST_NODE_TYPES.Identifier&&e.object.type===gt.AST_NODE_TYPES.Identifier)return`${e.object.name}.${e.property.name}`}var en=U({name:"no-call-with-explicit-generics",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)",noExplicitGenericsCustom:"{{ message }}"},schema:[$(yo)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map,n=new Map;for(let s of t.functions){let i=typeof s=="string"?s:s.name,a=typeof s=="string"?void 0:s.message;i.startsWith("*.")?n.set(i.slice(2),a):r.set(i,a)}function o(s){if(r.has(s))return{message:r.get(s)};let i=s.indexOf(".");if(i!==-1){let a=s.slice(i+1);if(n.has(a))return{message:n.get(a)}}}return{CallExpression(s){let i=go(s.callee);if(!i||!s.typeArguments)return;let a=o(i);a&&(a.message?e.report({node:s,messageId:"noExplicitGenericsCustom",data:{message:a.message}}):e.report({node:s,messageId:"noExplicitGenerics",data:{functionName:i}}))}}}});var Oe=require("@typescript-eslint/utils"),So=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-call-with-inferred-generics",To=So({name:Fr,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",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics",unknownUsedInGenerics:"Function '{{ functionName }}' should not be called with 'unknown' 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"}},disallowTypeOf:{type:"boolean"},disallowUnknown:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(s=>[s.name,s])),n=t.functions.some(s=>s.disallowTypeOf),o=new Set;return{...n&&{TSTypeAliasDeclaration(s){s.typeAnnotation.type===Oe.AST_NODE_TYPES.TSTypeQuery&&o.add(s.id.name)}},CallExpression(s){let{callee:i}=s;if(i.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(i.name);if(!a)return;let{minGenerics:p=1,allowAny:l,disallowTypes:d=t.disallowTypes,disallowTypeOf:u,disallowUnknown:f}=a;(s.typeArguments?.params.length||0)<(p||0)&&e.report({node:s,messageId:"missingGenericDeclaration",data:{functionName:i.name,minGenerics:p||0}}),!(l&&!d)&&(s.typeArguments?.params.some(m=>!l&&m.type===Oe.AST_NODE_TYPES.TSAnyKeyword||d&&m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&d.includes(m.typeName.name))&&e.report({node:s,messageId:"anyUsedInGenerics",data:{functionName:i.name}}),f&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSUnknownKeyword)&&e.report({node:s,messageId:"unknownUsedInGenerics",data:{functionName:i.name}}),u&&s.typeArguments?.params.some(m=>m.type===Oe.AST_NODE_TYPES.TSTypeQuery||m.type===Oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===Oe.AST_NODE_TYPES.Identifier&&o.has(m.typeName.name))&&e.report({node:s,messageId:"typeOfUsedInGenerics",data:{functionName:i.name}}))}}}}),tn={name:Fr,rule:To};var kr=require("@typescript-eslint/utils"),Eo=kr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="no-commented-out-code",ho=["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:"],bo=/^\s*return\s+/,xo=/\w=("|'|`)/,Co=/\w+:\s*('|"|`)/,Io=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Ao=/\w+-\w+:/,wo=/\w+_\w+:/,Fo=/\?\s+\w/,vo=/:\s+\w/,Ro=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ko=/^\s*\d+[,}]/,Po=/^\s*\[[^\]]*\][,}]/,No=/^\s*\{[^}]*\}[,}]/,Oo=/\.\w+\(/,Do=/\[\w+\]/,jo=/^\s*(['"`]).+?\1\s*:/,Lo=/^<[A-Z]\w*(\s|>|\/)/,Mo=/^<[a-z]+(\s|>|\/)/,_o=/<[A-Z]\w*(\s.*)?>/,$o=/<\/[A-Z]\w*>/,Uo=/<[a-z]+(\s.*)?>/,zo=/<\/[a-z]+>/,Vo=/^\s*[*\s]*$/,Wo=/^[a-zA-Z]/,Jo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Xo=/```[\s\S]*?```/g,Bo=/`[^`]*`/g,vr=/[a-zA-Z0-9]/,Ho=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Yo=/[{}[\]()`=<>]/,qo=/:\s*(['"`[{(]|\w+\s*=>)/,Zo=/\bif\s*\(|\belse\b|=>/,ye={returnStatement:bo,stringAssignment:xo,objectPropertyWithQuotes:Co,computedPropertyAssignment:Io,kebabCaseProperty:Ao,snakeCaseProperty:wo,ternaryOperator:Fo,colonWithWord:vo,quotedString:Ro,numberWithComma:ko,arrayWithComma:Po,objectWithComma:No,methodCall:Oo,arrayAccess:Do,quotedPropertyKey:jo,jsxSelfClosing:Lo,jsxElement:Mo,jsxOpeningTag:_o,jsxClosingTag:$o,htmlOpeningTag:Uo,htmlClosingTag:zo,jsdocComment:Vo};function Go(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Wo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Ho.test(t)||Yo.test(t)||qo.test(t)||Zo.test(t)?!1:!!(t.includes(":")&&Jo.test(t))}var Ko=[") {","return;",ye.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",ye.stringAssignment,");",ye.objectPropertyWithQuotes,ye.computedPropertyAssignment,ye.kebabCaseProperty,ye.snakeCaseProperty,"&&","||","()",ye.ternaryOperator,ye.colonWithWord,ye.quotedString,ye.numberWithComma,ye.arrayWithComma,ye.objectWithComma,ye.methodCall,ye.arrayAccess,"?.(","??","=>",ye.quotedPropertyKey],Qo=["/>","</",ye.jsxSelfClosing,ye.jsxElement,ye.jsxOpeningTag,ye.jsxClosingTag,ye.htmlOpeningTag,ye.htmlClosingTag],Rr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],es=Eo({name:Pr,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 s=n.trimStart();if(n.startsWith("*")||s.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")||ye.jsdocComment.test(n))return!1;for(let i of Rr)if(s.startsWith(i))return!1;if(n.includes("https://")||Go(s))return!1;if(o==="Block"){for(let i of Qo)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 ho)if(s.startsWith(i))return{wrongPattern:i};for(let i of Ko)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 s=n,i=s.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return s;if(o==="Block"&&s.includes("```")){let l=s.split(Xo);l.some(u=>vr.test(u))&&(s=l.join(""))}if(!s.includes("`"))return s;let a=s.split(Bo);return a.some(l=>vr.test(l))?a.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),a=t(i,s.type);a&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:a.wrongPattern,allowedPrefixes:Rr.join(", ")}})}}}}}),nn={name:Pr,rule:es};var wt=require("@typescript-eslint/utils"),ts=wt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-default-export",ns=ts({name:Nr,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===wt.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),rn={name:Nr,rule:ns};var Or=require("@typescript-eslint/utils"),rs=Or.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Dr="no-leaked-text-in-jsx",is=[",",";","[","]","(",")"],os=rs({name:Dr,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="";is.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),on={name:Dr,rule:os};var Ze=require("@typescript-eslint/utils"),ss=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lr="no-non-camel-case-functions",as=/^(\$?[a-z][a-zA-Z0-9]*)$/;function jr(e){if(e.typeName.type!==Ze.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Ze.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var ls=ss({name:Lr,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&&!as.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ze.AST_NODE_TYPES.TSTypeReference?jr(r):r.type===Ze.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Ze.AST_NODE_TYPES.TSTypeReference&&jr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),sn={name:Lr,rule:ls};var ae=require("@typescript-eslint/utils");var ps=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="no-optional-root-props",cs=ps({name:Mr,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 s=e.sourceCode.getDeclaredVariables(n)[0];if(!s||s.references.length!==1)return!1;let i=s.references[0];if(!i)return!1;for(let a of Zt(i.identifier)){if("returnType"in a||a.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let p=a.parent;if(!p)return!1;if(p.type===ae.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&p.parent.type===ae.TSESTree.AST_NODE_TYPES.TSTypeReference&&p.parent.typeName.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&p.parent.typeName.name==="FC"){let d=st(p.parent.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!d)return!1;let u=Ft(d,e.sourceCode);return u?!(u.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&u.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&u.parent.callee.name==="memo"):!1}if(a.type===ae.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(p.type===ae.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let l=st(p,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration);return l?!!Ft(l,e.sourceCode):!1}if(p.type===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Ft(p,e.sourceCode)}return!1}function r(n){n.key.type!==ae.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 s=st(n,ae.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let i=e.sourceCode.getText(s);return o.replaceText(s,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(vt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(vt(n)||!t(n)))for(let o of n.body.body)o.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==ae.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==ae.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=st(n.parent,ae.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=Ft(s,e.sourceCode);if(!(!i||i.parent.type===ae.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===ae.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let p of o.members)p.type===ae.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(p)}}}});function vt(e){return e?e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===ae.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Ft(e,t){if(vt(e))return;let r;if(e.type===ae.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===ae.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===ae.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let s=o.references.filter(i=>i.identifier!==r);if(!(s.length!==1||!s[0])&&!vt(s[0].identifier.parent.parent))return s[0].identifier}var an={name:Mr,rule:cs};var St=require("@typescript-eslint/utils");var Tt=U({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===St.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===St.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===St.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===St.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var _r=require("@typescript-eslint/utils"),Rt=Ne(require("path")),Je=require("zod/v4");var us=_r.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$r="no-relative-imports",fs=Je.z.object({find:Je.z.string(),replacement:Je.z.string()}),ms=Je.z.object({aliases:Je.z.array(fs),rootDir:Je.z.string().optional(),allowNotFoundAliases:Je.z.boolean().optional(),_dev_simulateFileName:Je.z.string().optional()}),ds=us({name:$r,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:[$(ms)]},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,a){let p=Rt.default.dirname(a);return Rt.default.resolve(p,i)}function s(i){let a=t.rootDir??process.cwd(),p=Rt.default.relative(a,i);if(p.startsWith("."))return null;p.startsWith("/")||(p=`/${p}`);for(let{find:l,replacement:d}of t.aliases)if(p.startsWith(d)){let u=p.replace(d,l);return{alias:l,newPath:u}}return null}return{ImportDeclaration(i){let a=i.source.value;if(!n(a))return;let p=o(a,r),l=s(p);!l&&t.allowNotFoundAliases||e.report({node:i,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?d=>d.replaceText(i.source,`'${l.newPath}'`):void 0})}}}}),ln={name:$r,rule:ds};var ge=require("@typescript-eslint/utils"),pn=require("zod/v4");var ys=pn.z.object({customMessage:pn.z.string().optional()}),cn=U({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(ys)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ge.AST_NODE_TYPES.Literal:return!0;case ge.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ge.AST_NODE_TYPES.Property?o.computed||o.value.type===ge.AST_NODE_TYPES.Identifier&&o.key.type===ge.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ge.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ge.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ge.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ge.AST_NODE_TYPES.ConditionalExpression:case ge.AST_NODE_TYPES.LogicalExpression:case ge.AST_NODE_TYPES.BinaryExpression:case ge.AST_NODE_TYPES.UnaryExpression:case ge.AST_NODE_TYPES.CallExpression:case ge.AST_NODE_TYPES.MemberExpression:case ge.AST_NODE_TYPES.Identifier:case ge.AST_NODE_TYPES.ArrowFunctionExpression:case ge.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ge.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ge.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ge.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ge.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var Et=require("@typescript-eslint/utils"),nt=Ne(require("zod/v4"));var gs=nt.object({alternativeMsgs:nt.object({inArrayFind:nt.string().optional(),inArrayFilter:nt.string().optional()}).optional(),__dev_simulateFileName:nt.string().optional()});function Ss(e){return e.typeAnnotation.type!==Et.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Ts=/(typeGuards|type-guards)\.(ts|tsx)$/;function Es(e){return Ts.test(e)}function hs(e){let t=e.parent;for(;t;){if(t.type===Et.AST_NODE_TYPES.CallExpression&&t.callee.type===Et.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===Et.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var un=U({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:[$(gs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Es(r))return{};function n(o){if(!Ss(o))return;let s=hs(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let a=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:a,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 rt=require("@typescript-eslint/utils");var bs="no-unnecessary-async-on-jsx-props";function xs(e){if(e.body.type!==rt.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!==rt.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===rt.AST_NODE_TYPES.AwaitExpression}var fn=U({name:bs,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){xs(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,s=[],i=o.getFirstToken(r,p=>p.value==="async");if(i){let p=o.getTokenAfter(i);p?s.push(n.replaceTextRange([i.range[0],p.range[0]],"")):s.push(n.remove(i))}function a(p){if(p.type===rt.AST_NODE_TYPES.AwaitExpression){let l=o.getFirstToken(p);if(l&&l.value==="await"){let d=o.getTokenAfter(l);d?s.push(n.replaceTextRange([l.range[0],d.range[0]],"")):s.push(n.remove(l))}}if(p.type===rt.AST_NODE_TYPES.BlockStatement)for(let l of p.body)a(l);else p.type===rt.AST_NODE_TYPES.ExpressionStatement&&a(p.expression)}return a(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Xe=require("@typescript-eslint/utils"),mn=Ne(require("typescript")),lt=Ne(require("zod/v4"));var Cs=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ur="no-unnecessary-casting",Is=lt.default.object({additionalCastFunctions:lt.default.array(lt.default.object({name:lt.default.string(),expectedType:lt.default.enum(["string","number"])})).optional()}),dn={name:Ur,rule:Cs({name:Ur,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:[$(Is)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Xe.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(d,u){switch(d.type){case Xe.AST_NODE_TYPES.Literal:return u==="number"?typeof d.value=="number":typeof d.value=="string";case Xe.AST_NODE_TYPES.TemplateLiteral:return u==="string";case Xe.AST_NODE_TYPES.UnaryExpression:return u==="number"?d.operator==="+"||d.operator==="-"||d.operator==="~":!1;default:return!1}}function a(d,u){return u==="number"?!!(d.flags&mn.TypeFlags.NumberLike):!!(d.flags&mn.TypeFlags.StringLike)}function p(d,u){return f=>f.replaceText(d,e.sourceCode.getText(u))}function l(d){if(!s||d.arguments.length!==1)return;let u=d.arguments[0];if(!u||u.type===Xe.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=d;if(f.type!==Xe.AST_NODE_TYPES.Identifier)return;let y=f.name,m=n.find(C=>C.name===y);if(!m)return;if(i(u,m.expectedType)||a(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(u)),m.expectedType)){let C,T;y==="Number"?C="unnecessaryNumberCasting":y==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",T={name:m.name,type:m.expectedType}),e.report({node:d,messageId:C,...T?{data:T}:{},fix:p(d,u)})}}return{CallExpression:l}}})};var ve=require("@typescript-eslint/utils"),kt=Ne(require("zod/v4"));var As=kt.object({ignoreWithDescription:kt.string().optional()}),yn=U({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[$(As)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(p){let l=p.arguments[0];return l&&l.type===ve.AST_NODE_TYPES.Literal&&typeof l.value=="string"?l.value:null}function s(p){return!p||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(p)}function i(p){return p.length!==1?!1:n.body.filter(d=>{if(d.type===ve.AST_NODE_TYPES.ExpressionStatement){let u=d.expression;if(u.type===ve.AST_NODE_TYPES.CallExpression&&u.callee.type===ve.AST_NODE_TYPES.Identifier){let f=u.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(f)}}return!1}).length===0}function a(p){let l=p.arguments[1];if(l&&(l.type===ve.AST_NODE_TYPES.FunctionExpression||l.type===ve.AST_NODE_TYPES.ArrowFunctionExpression)&&l.body.type===ve.AST_NODE_TYPES.BlockStatement){let d=l.body.body;return d.length===0?"":d.map(f=>r.text.slice(f.range[0],f.range[1])).join(`
|
|
16
16
|
|
|
17
|
-
`)}return""}return{Program(){let p=[];for(let y of n.body)y.type===ve.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===ve.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===ve.AST_NODE_TYPES.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&p.push(y.expression);if(!i(p))return;let[l]=p;if(!l)return;let u=o(l);if(s(u))return;let f=n.body.find(y=>y.type===ve.AST_NODE_TYPES.ExpressionStatement&&y.expression===l);!f||f.type!==ve.AST_NODE_TYPES.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let b=a(l);return b?y.replaceText(f,b):null}}]})}}}});var Tt=require("@typescript-eslint/utils"),_e=Ne(require("zod/v4"));var Cs=_e.object({methods:_e.union([_e.array(_e.string()),_e.literal("array")])}),yn=z({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:[$(Cs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(a){return Array.isArray(r)?r.includes(a):n.has(a)}function s(a){let{callee:p}=a;if(p.type===Tt.AST_NODE_TYPES.MemberExpression){let l=p.property;if(l.type===Tt.AST_NODE_TYPES.Identifier)return l.name}return null}function i(a,p){if(a.type!==Tt.AST_NODE_TYPES.Identifier||!a.typeAnnotation)return;let l=p.parent;if(l.type===Tt.AST_NODE_TYPES.CallExpression){let u=s(l);u&&o(u)&&l.arguments.indexOf(p)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return a.typeAnnotation?y.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let p of a.params)i(p,a)},FunctionExpression(a){for(let p of a.params)i(p,a)}}}});var we=require("@typescript-eslint/utils");var dn=z({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===we.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==we.AST_NODE_TYPES.ObjectExpression||t.id.type===we.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===we.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===we.AST_NODE_TYPES.Property&&i.key.type===we.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==we.AST_NODE_TYPES.Identifier)return;let n=Is(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==we.AST_NODE_TYPES.Property?!1:i.value.type===we.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==we.AST_NODE_TYPES.MemberExpression)return;let a=i.identifier.parent;if(a.object!==i.identifier)return;if(a.computed)if(a.property.type===we.AST_NODE_TYPES.Literal&&typeof a.property.value=="string")s.add(a.property.value);else return;else{if(a.property.type!==we.AST_NODE_TYPES.Identifier)return;s.add(a.property.name)}if(a.parent.type===we.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,a]of r)s.has(i)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Is(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 te=require("@typescript-eslint/utils"),gn=require("zod/v4");var As=gn.z.object({ignoreArgsMatching:gn.z.string().optional()}),Sn=z({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[$(As)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function o(i){return i.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.type===te.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportDefaultDeclaration}function s(i){let a=[];for(let p=0;p<i.length;p++){let l=i[p];if(!l||l.type!==te.AST_NODE_TYPES.Identifier)continue;let u=l.name;if(!n(u)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let f=l.typeAnnotation.typeAnnotation,y=[];for(let b of f.members)b.type===te.AST_NODE_TYPES.TSPropertySignature&&b.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:b.key.name,optional:b.optional===!0});y.some(b=>b.optional)?a.push({param:l,index:p,name:u,isObjectParam:!0,objectProps:y}):a.push({param:l,index:p,name:u,isObjectParam:!1})}else if(l.optional)a.push({param:l,index:p,name:u,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let f=l.typeAnnotation.typeAnnotation,y=[];for(let b of f.members)b.type===te.AST_NODE_TYPES.TSPropertySignature&&b.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:b.key.name,optional:b.optional===!0});y.some(b=>b.optional)&&a.push({param:l,index:p,name:u,isObjectParam:!0,objectProps:y})}}}return a}return{FunctionDeclaration(i){if(o(i))return;let a=s(i.params);a.length!==0&&r.push({node:i,declarationNode:i,optionalParams:a})},VariableDeclarator(i){if(i.id.type!==te.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==te.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==te.AST_NODE_TYPES.FunctionExpression||o(i.parent.parent))return;let p=[...s(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let l=i.id.typeAnnotation.typeAnnotation;if(l.typeName.type===te.AST_NODE_TYPES.Identifier&&l.typeName.name==="FC"){let u=l.typeArguments;if(u&&u.params.length===1){let f=u.params[0];if(f&&f.type===te.AST_NODE_TYPES.TSTypeLiteral){let y=[];for(let b of f.members)b.type===te.AST_NODE_TYPES.TSPropertySignature&&b.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:b.key.name,optional:b.optional===!0});y.some(b=>b.optional)&&p.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}p.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:p})},"Program:exit"(){for(let i of r){let p=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!p)continue;let l=p.references.filter(y=>y.identifier!==p.identifiers[0]);if(l.length===0)continue;let u=!1;for(let y of l){let b=y.identifier.parent;if(b.type===te.AST_NODE_TYPES.CallExpression&&y.identifier.type===te.AST_NODE_TYPES.Identifier&&b.arguments.includes(y.identifier)){u=!0;break}if(b.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(b.type===te.AST_NODE_TYPES.Property&&b.parent.type===te.AST_NODE_TYPES.ObjectExpression&&b.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(b.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let f=[];for(let y of l){let b=y.identifier.parent;if(b.type===te.AST_NODE_TYPES.CallExpression&&b.callee===y.identifier){let m=b.arguments.length,h=b.arguments.some(S=>S.type===te.AST_NODE_TYPES.SpreadElement);if(h){u=!0;break}let C={argCount:m,hasSpread:h};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<m){let I=b.arguments[S.index];if(I?.type===te.AST_NODE_TYPES.ObjectExpression){let A={};for(let g of I.properties)g.type===te.AST_NODE_TYPES.Property&&g.key.type===te.AST_NODE_TYPES.Identifier&&(A[g.key.name]=!0);C.objectArgs||(C.objectArgs=[]),C.objectArgs[S.index]=A}else if(I){u=!0;break}}f.push(C)}else if(b.type===te.AST_NODE_TYPES.JSXOpeningElement&&b.name===y.identifier){let m=b.attributes.some(C=>C.type===te.AST_NODE_TYPES.JSXSpreadAttribute);if(m){u=!0;break}let h={argCount:1,hasSpread:m};for(let C of i.optionalParams)if(C.isObjectParam&&C.index===0){let S={};for(let I of b.attributes)I.type===te.AST_NODE_TYPES.JSXAttribute&&I.name.type===te.AST_NODE_TYPES.JSXIdentifier&&(S[I.name.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[0]=S}f.push(h)}}if(!(u||f.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let b of y.objectProps){if(!b.optional)continue;let m=!1;for(let h of f)if(h.objectArgs&&h.objectArgs[y.index]){let C=h.objectArgs[y.index];if(C&&C[b.name]){m=!0;break}}m||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:b.name}})}else{let b=!1;for(let m of f)if(m.argCount>y.index){b=!0;break}b||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});var pe=require("@typescript-eslint/utils"),Ge=require("zod/v4");var ws=Ge.z.object({selectors:Ge.z.array(Ge.z.object({name:Ge.z.string(),selectorProp:Ge.z.string().optional(),selectorArgPos:Ge.z.number().optional(),returnProp:Ge.z.string().optional()}))}),Fs=pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="no-unused-selected-values",Tn={name:_r,rule:Fs({name:_r,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(ws)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let s=null;if(o.init?.type===pe.AST_NODE_TYPES.CallExpression&&(s=o.init),!s)return;let i=Rs(s);if(!i)return;let a=n.get(i);if(!a)return;let p=vs(s,a.selectorArgPos??0,a.selectorProp);if(!p)return;let l=ks(p);if(!l)return;let u=$r(l.properties,void 0);if(!u)return;if(o.id.type===pe.AST_NODE_TYPES.ObjectPattern){let b=$r(o.id.properties,a.returnProp);if(!b)return;for(let[m,h]of u)b.has(m)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==pe.AST_NODE_TYPES.Identifier||a.returnProp)return;let f=Ps(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let b of f){if(b.identifier.parent.type!==pe.AST_NODE_TYPES.MemberExpression)return;let m=b.identifier.parent.property;if(m.type!==pe.AST_NODE_TYPES.Identifier)return;y.add(m.name)}for(let[b,m]of u)y.has(b)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:b}})}}}})};function vs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||n.type===pe.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===pe.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==pe.AST_NODE_TYPES.Property)return null;let s=o.value;if(s.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||s.type===pe.AST_NODE_TYPES.FunctionExpression)return s}return null}function Rs(e){return e.callee.type===pe.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===pe.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===pe.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ks(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function $r(e,t){let r=e;if(t){let o=e.find(s=>s.type===pe.AST_NODE_TYPES.Property&&s.key.type===pe.AST_NODE_TYPES.Identifier&&s.key.name===t);if(o?.type!==pe.AST_NODE_TYPES.Property||o.value.type!==pe.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function Ps(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 ce=require("@typescript-eslint/utils");var En=z({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(s=>s.type===ce.AST_NODE_TYPES.ImportDeclaration&&s.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(s){if(o)return;if(!n){let a=Ns(s);a&&(n=a);return}let i=Os(s,e.sourceCode);if(i){o=!0;for(let a of i)n.delete(a);if(n.size!==0)for(let[a,p]of n)e.report({node:p,messageId:"unusedField",data:{name:a}})}}}}});function Ns(e){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ce.AST_NODE_TYPES.ObjectExpression)return null;let n=qt(r.properties,s=>s.type!==ce.AST_NODE_TYPES.Property||s.key.type!==ce.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===ce.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===ce.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===ce.AST_NODE_TYPES.FunctionExpression?Ds(s.value):null);if(!n)return null;let o=new Map;for(let s of n.properties)s.type===ce.AST_NODE_TYPES.Property&&s.key.type===ce.AST_NODE_TYPES.Identifier&&o.set(s.key.name,s);return o}function Os(e,t){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ce.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==ce.AST_NODE_TYPES.ObjectPattern||!qt(e.parent.id.properties,i=>i.type===ce.AST_NODE_TYPES.Property&&i.key.type===ce.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=br(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of o){if(i.type!==ce.AST_NODE_TYPES.Identifier||i.parent.type===ce.AST_NODE_TYPES.Property&&i.parent.parent.type===ce.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===ce.AST_NODE_TYPES.ReturnStatement||i.parent.type===ce.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===ce.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==ce.AST_NODE_TYPES.Identifier||i.parent.property.type!==ce.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function Ds(e){if(e.body.type===ce.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===ce.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===ce.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ce.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var oe=require("@typescript-eslint/utils"),Et=require("zod/v4");var js=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ur(e){let t=[];for(let r of e.members)r.type===oe.AST_NODE_TYPES.TSPropertySignature&&r.key.type===oe.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function zr(e,...t){for(let r of t)e.set(...r);return e}var Ls=Et.z.object({forceCheckOnFCPropTypesWithName:Et.z.array(Et.z.string()).optional(),alwaysCheckFunctionOptionTypes:Et.z.boolean().optional()}),Vr="no-unused-type-props-in-args",hn=null,Ms=js({name:Vr,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:[$(Ls)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!hn&&(hn=r.map(p=>new RegExp(p)));function o(p,l,u,f,y=!0,b=!1){let m=u.name,h=e.sourceCode.getScope(l).references.find(g=>g.identifier.name===m)?.resolved,C=p&&hn?.some(g=>g.test(m)),S=b&&n;if(!h||!C&&h.references.filter(g=>g.isTypeReference).length>1||!h.defs[0])return;let I=h.defs[0].node,A=I.parent?.type===oe.AST_NODE_TYPES.ExportNamedDeclaration;if(!(y&&A&&!S)){if(I.type===oe.AST_NODE_TYPES.TSTypeAliasDeclaration){s(p,l,f,I.typeAnnotation,!0,b);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(p,l,f,I.body,!0,b);return}}}function s(p,l,u,f,y,b=!1){if(f.type===oe.AST_NODE_TYPES.TSInterfaceBody){for(let m of f.body)m.type===oe.AST_NODE_TYPES.TSPropertySignature&&m.key.type===oe.AST_NODE_TYPES.Identifier&&u.set(m.key.name,m);return}if(f.type===oe.AST_NODE_TYPES.TSTypeLiteral){zr(u,...Ur(f));return}if(f.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let m of f.types)s(p,l,u,m,!0,b);return}y||f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(p,l,f.typeName,u,!0,b)}function i(p,l,u,f=!1){for(let y of u)if(y.type===oe.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let b=new Map;if(s(p,l,b,y.typeAnnotation.typeAnnotation,!1,f),b.size===0)continue;a(y,b)}else y.type===oe.AST_NODE_TYPES.AssignmentPattern&&y.left.type===oe.AST_NODE_TYPES.ObjectPattern&&i(p,l,[y.left],f)}function a(p,l){let u=[];if(p.properties.at(-1)?.type===oe.AST_NODE_TYPES.RestElement)return;for(let m of p.properties)m.type===oe.AST_NODE_TYPES.Property&&m.key.type===oe.AST_NODE_TYPES.Identifier&&u.push(m.key.name);let y=[],b=[];for(let[m,h]of l)u.includes(m)||(b.push(m),y.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,h]of y.entries())e.report({...h,fix:m===y.length-1?C=>{let S=p.properties.at(-1),I=b.join(", ");return S?S.type===oe.AST_NODE_TYPES.RestElement?null:C.insertTextAfter(S,`, ${I}`):C.insertTextBeforeRange([p.range[0]+1,p.range[1]],I)}:void 0})}return{VariableDeclaration(p){let l=p.declarations[0],u=new Map,f=l.id.type===oe.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===oe.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(f){if(f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier)o(!0,p,f.typeName,u,!1);else if(f.type===oe.AST_NODE_TYPES.TSTypeLiteral)zr(u,...Ur(f));else if(f.type===oe.AST_NODE_TYPES.TSIntersectionType)for(let y of f.types)y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.Identifier?o(!0,p,y.typeName,u,!1):s(!0,p,u,y,!0);if(u.size!==0&&l.init?.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let y=l.init.params[0];if(!y){e.report({node:l.init,messageId:"missingComponentParam"});return}y.type===oe.AST_NODE_TYPES.ObjectPattern&&a(y,u)}}},FunctionDeclaration(p){i(!1,p,p.params,n)},ArrowFunctionExpression(p){i(!1,p,p.params,n)}}}}),bn={name:Vr,rule:Ms};var De=require("@typescript-eslint/utils");var xn=z({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===De.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===De.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===De.AST_NODE_TYPES.Identifier&&n.callee.property.type===De.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===De.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===De.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===De.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===De.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let a of s.references){let l=a.identifier.parent;if(l!==n&&!(l.type===De.AST_NODE_TYPES.JSXExpressionContainer&&l.parent.type===De.AST_NODE_TYPES.JSXAttribute&&l.parent.name.type===De.AST_NODE_TYPES.JSXIdentifier&&l.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var at=require("@typescript-eslint/utils"),_s=at.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jr="prefer-named-functions",Wr=new Map,$s=_s({name:Jr,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=Wr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Wr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===at.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===at.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==at.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,a=n.init.body,p=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(s,`${p.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),Cn={name:Jr,rule:$s};var Q=require("@typescript-eslint/utils"),$e=require("zod/v4");var Us=$e.z.object({disallowedFunctions:$e.z.array($e.z.object({name:$e.z.string(),allowUsingWithArgs:$e.z.boolean().optional(),hookAlternative:$e.z.string().optional(),message:$e.z.string().optional(),allowUseInside:$e.z.array($e.z.string()).optional()}))}),zs=/^use[A-Z]/,Vs=/^[A-Z]/;function Rt(e){return zs.test(e)}function Xr(e){return Vs.test(e)}function Ws(e){return e.type===Q.AST_NODE_TYPES.Identifier?Rt(e.name):e.type===Q.AST_NODE_TYPES.MemberExpression&&e.property.type===Q.AST_NODE_TYPES.Identifier?Rt(e.property.name):!1}function Br(e,t){return e.type===Q.AST_NODE_TYPES.Identifier?e.name===t:e.type===Q.AST_NODE_TYPES.MemberExpression&&e.object.type===Q.AST_NODE_TYPES.Identifier&&e.property.type===Q.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Hr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Br(e.parent.callee,"forwardRef"))}function Yr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Br(e.parent.callee,"memo"))}function In(e){if(e.type===Q.AST_NODE_TYPES.FunctionDeclaration||e.type===Q.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.AST_NODE_TYPES.FunctionExpression||e.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===Q.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Js(e){let t=e.parent,r=!1;for(;t;){if(t.type===Q.AST_NODE_TYPES.FunctionDeclaration||t.type===Q.AST_NODE_TYPES.FunctionExpression||t.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=In(t);if(n&&n.type===Q.AST_NODE_TYPES.Identifier){if(Xr(n.name)||Rt(n.name))return!r;r=!0}else{if(Hr(t)||Yr(t))return!r;if(t.parent.type===Q.AST_NODE_TYPES.CallExpression){let o=t.parent;Ws(o.callee)||(r=!0)}else t.parent.type===Q.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function qr(e){return e.callee.type===Q.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Q.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Q.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Xs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.AST_NODE_TYPES.FunctionDeclaration||r.type===Q.AST_NODE_TYPES.FunctionExpression||r.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=In(r);if(n&&n.type===Q.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===Q.AST_NODE_TYPES.CallExpression){let n=qr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Bs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Hs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===Q.AST_NODE_TYPES.FunctionDeclaration||n.type===Q.AST_NODE_TYPES.FunctionExpression||n.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let o=In(n);if(o&&o.type===Q.AST_NODE_TYPES.Identifier){if(Xr(o.name)||Rt(o.name)){r=!0;break}}else if(Hr(n)||Yr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Js(e):!Xs(e,t):!1}var An=z({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:[$(Us)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let s=qr(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&Bs(o))return;let a=i.allowUseInside||[];Hs(o,a)&&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:p=>{let l=i.hookAlternative;return l?o.callee.type===Q.AST_NODE_TYPES.Identifier?p.replaceText(o.callee,l):o.callee.type===Q.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===Q.AST_NODE_TYPES.Identifier?p.replaceText(o.callee.property,l):null:null}}]:[]})}}}});var fe=require("@typescript-eslint/utils"),kt=Ne(require("zod/v4"));var Ys=fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gr="prefer-single-line-if",qs=kt.default.object({maxLineLength:kt.default.number().optional(),maxNonSimpleConditionLength:kt.default.number().optional()}),Zs=Ys({name:Gr,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:[$(qs)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==fe.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 s=n.consequent.body[0];if(!s)return;if(s.type===fe.AST_NODE_TYPES.ReturnStatement){if(!Qr(s))return}else if(!(s.type===fe.AST_NODE_TYPES.ContinueStatement||s.type===fe.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===fe.AST_NODE_TYPES.LogicalExpression||n.test.type===fe.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=Zr(n.test);if(!f&&n.test.type===fe.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Zr(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let a=r.getText(s);if(i.includes(`
|
|
18
|
-
`))return;let p=r.getTokenAfter(n);if(p&&p.type===fe.AST_TOKEN_TYPES.Punctuator&&p.value==="}"){let
|
|
17
|
+
`)}return""}return{Program(){let p=[];for(let f of n.body)f.type===ve.AST_NODE_TYPES.ExpressionStatement&&f.expression.type===ve.AST_NODE_TYPES.CallExpression&&f.expression.callee.type===ve.AST_NODE_TYPES.Identifier&&f.expression.callee.name==="describe"&&f.expression.arguments.length===2&&p.push(f.expression);if(!i(p))return;let[l]=p;if(!l)return;let d=o(l);if(s(d))return;let u=n.body.find(f=>f.type===ve.AST_NODE_TYPES.ExpressionStatement&&f.expression===l);!u||u.type!==ve.AST_NODE_TYPES.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(f){let y=a(l);return y?f.replaceText(u,y):null}}]})}}}});var ht=require("@typescript-eslint/utils"),_e=Ne(require("zod/v4"));var ws=_e.object({methods:_e.union([_e.array(_e.string()),_e.literal("array")])}),gn=U({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:[$(ws)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(a){return Array.isArray(r)?r.includes(a):n.has(a)}function s(a){let{callee:p}=a;if(p.type===ht.AST_NODE_TYPES.MemberExpression){let l=p.property;if(l.type===ht.AST_NODE_TYPES.Identifier)return l.name}return null}function i(a,p){if(a.type!==ht.AST_NODE_TYPES.Identifier||!a.typeAnnotation)return;let l=p.parent;if(l.type===ht.AST_NODE_TYPES.CallExpression){let d=s(l);d&&o(d)&&l.arguments.indexOf(p)===0&&e.report({node:a.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return a.typeAnnotation?f.remove(a.typeAnnotation):null}})}}return{ArrowFunctionExpression(a){for(let p of a.params)i(p,a)},FunctionExpression(a){for(let p of a.params)i(p,a)}}}});var we=require("@typescript-eslint/utils");var Sn=U({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===we.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==we.AST_NODE_TYPES.ObjectExpression||t.id.type===we.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===we.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===we.AST_NODE_TYPES.Property&&i.key.type===we.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==we.AST_NODE_TYPES.Identifier)return;let n=Fs(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==we.AST_NODE_TYPES.Property?!1:i.value.type===we.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==we.AST_NODE_TYPES.MemberExpression)return;let a=i.identifier.parent;if(a.object!==i.identifier)return;if(a.computed)if(a.property.type===we.AST_NODE_TYPES.Literal&&typeof a.property.value=="string")s.add(a.property.value);else return;else{if(a.property.type!==we.AST_NODE_TYPES.Identifier)return;s.add(a.property.name)}if(a.parent.type===we.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,a]of r)s.has(i)||e.report({node:a,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Fs(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 te=require("@typescript-eslint/utils"),Tn=require("zod/v4");var vs=Tn.z.object({ignoreArgsMatching:Tn.z.string().optional()}),En=U({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[$(vs)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function o(i){return i.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.type===te.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportDefaultDeclaration}function s(i){let a=[];for(let p=0;p<i.length;p++){let l=i[p];if(!l||l.type!==te.AST_NODE_TYPES.Identifier)continue;let d=l.name;if(!n(d)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let u=l.typeAnnotation.typeAnnotation,f=[];for(let y of u.members)y.type===te.AST_NODE_TYPES.TSPropertySignature&&y.key.type===te.AST_NODE_TYPES.Identifier&&f.push({name:y.key.name,optional:y.optional===!0});f.some(y=>y.optional)?a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:f}):a.push({param:l,index:p,name:d,isObjectParam:!1})}else if(l.optional)a.push({param:l,index:p,name:d,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let u=l.typeAnnotation.typeAnnotation,f=[];for(let y of u.members)y.type===te.AST_NODE_TYPES.TSPropertySignature&&y.key.type===te.AST_NODE_TYPES.Identifier&&f.push({name:y.key.name,optional:y.optional===!0});f.some(y=>y.optional)&&a.push({param:l,index:p,name:d,isObjectParam:!0,objectProps:f})}}}return a}return{FunctionDeclaration(i){if(o(i))return;let a=s(i.params);a.length!==0&&r.push({node:i,declarationNode:i,optionalParams:a})},VariableDeclarator(i){if(i.id.type!==te.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==te.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==te.AST_NODE_TYPES.FunctionExpression||o(i.parent.parent))return;let p=[...s(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let l=i.id.typeAnnotation.typeAnnotation;if(l.typeName.type===te.AST_NODE_TYPES.Identifier&&l.typeName.name==="FC"){let d=l.typeArguments;if(d&&d.params.length===1){let u=d.params[0];if(u&&u.type===te.AST_NODE_TYPES.TSTypeLiteral){let f=[];for(let y of u.members)y.type===te.AST_NODE_TYPES.TSPropertySignature&&y.key.type===te.AST_NODE_TYPES.Identifier&&f.push({name:y.key.name,optional:y.optional===!0});f.some(y=>y.optional)&&p.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:f})}}}}p.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:p})},"Program:exit"(){for(let i of r){let p=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!p)continue;let l=p.references.filter(f=>f.identifier!==p.identifiers[0]);if(l.length===0)continue;let d=!1;for(let f of l){let y=f.identifier.parent;if(y.type===te.AST_NODE_TYPES.CallExpression&&f.identifier.type===te.AST_NODE_TYPES.Identifier&&y.arguments.includes(f.identifier)){d=!0;break}if(y.type===te.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(y.type===te.AST_NODE_TYPES.Property&&y.parent.type===te.AST_NODE_TYPES.ObjectExpression&&y.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(y.type===te.AST_NODE_TYPES.JSXExpressionContainer){d=!0;break}}if(d)continue;let u=[];for(let f of l){let y=f.identifier.parent;if(y.type===te.AST_NODE_TYPES.CallExpression&&y.callee===f.identifier){let m=y.arguments.length,b=y.arguments.some(T=>T.type===te.AST_NODE_TYPES.SpreadElement);if(b){d=!0;break}let C={argCount:m,hasSpread:b};for(let T of i.optionalParams)if(T.isObjectParam&&T.index<m){let I=y.arguments[T.index];if(I?.type===te.AST_NODE_TYPES.ObjectExpression){let A={};for(let S of I.properties)S.type===te.AST_NODE_TYPES.Property&&S.key.type===te.AST_NODE_TYPES.Identifier&&(A[S.key.name]=!0);C.objectArgs||(C.objectArgs=[]),C.objectArgs[T.index]=A}else if(I){d=!0;break}}u.push(C)}else if(y.type===te.AST_NODE_TYPES.JSXOpeningElement&&y.name===f.identifier){let m=y.attributes.some(C=>C.type===te.AST_NODE_TYPES.JSXSpreadAttribute);if(m){d=!0;break}let b={argCount:1,hasSpread:m};for(let C of i.optionalParams)if(C.isObjectParam&&C.index===0){let T={};for(let I of y.attributes)I.type===te.AST_NODE_TYPES.JSXAttribute&&I.name.type===te.AST_NODE_TYPES.JSXIdentifier&&(T[I.name.name]=!0);b.objectArgs||(b.objectArgs=[]),b.objectArgs[0]=T}u.push(b)}}if(!(d||u.length===0))for(let f of i.optionalParams)if(f.isObjectParam&&f.objectProps)for(let y of f.objectProps){if(!y.optional)continue;let m=!1;for(let b of u)if(b.objectArgs&&b.objectArgs[f.index]){let C=b.objectArgs[f.index];if(C&&C[y.name]){m=!0;break}}m||e.report({node:f.param,messageId:"unusedOptionalProp",data:{name:y.name}})}else{let y=!1;for(let m of u)if(m.argCount>f.index){y=!0;break}y||e.report({node:f.param,messageId:"unusedOptionalArg",data:{name:f.name}})}}}}}});var pe=require("@typescript-eslint/utils"),Ge=require("zod/v4");var Rs=Ge.z.object({selectors:Ge.z.array(Ge.z.object({name:Ge.z.string(),selectorProp:Ge.z.string().optional(),selectorArgPos:Ge.z.number().optional(),returnProp:Ge.z.string().optional()}))}),ks=pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zr="no-unused-selected-values",hn={name:zr,rule:ks({name:zr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(Rs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let s=null;if(o.init?.type===pe.AST_NODE_TYPES.CallExpression&&(s=o.init),!s)return;let i=Ns(s);if(!i)return;let a=n.get(i);if(!a)return;let p=Ps(s,a.selectorArgPos??0,a.selectorProp);if(!p)return;let l=Os(p);if(!l)return;let d=Vr(l.properties,void 0);if(!d)return;if(o.id.type===pe.AST_NODE_TYPES.ObjectPattern){let y=Vr(o.id.properties,a.returnProp);if(!y)return;for(let[m,b]of d)y.has(m)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==pe.AST_NODE_TYPES.Identifier||a.returnProp)return;let u=Ds(o,e.sourceCode);if(u.length===0)return;let f=new Set;for(let y of u){if(y.identifier.parent.type!==pe.AST_NODE_TYPES.MemberExpression)return;let m=y.identifier.parent.property;if(m.type!==pe.AST_NODE_TYPES.Identifier)return;f.add(m.name)}for(let[y,m]of d)f.has(y)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:y}})}}}})};function Ps(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||n.type===pe.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===pe.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==pe.AST_NODE_TYPES.Property)return null;let s=o.value;if(s.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||s.type===pe.AST_NODE_TYPES.FunctionExpression)return s}return null}function Ns(e){return e.callee.type===pe.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===pe.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===pe.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Os(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function Vr(e,t){let r=e;if(t){let o=e.find(s=>s.type===pe.AST_NODE_TYPES.Property&&s.key.type===pe.AST_NODE_TYPES.Identifier&&s.key.name===t);if(o?.type!==pe.AST_NODE_TYPES.Property||o.value.type!==pe.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.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 ce=require("@typescript-eslint/utils");var bn=U({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(s=>s.type===ce.AST_NODE_TYPES.ImportDeclaration&&s.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(s){if(o)return;if(!n){let a=js(s);a&&(n=a);return}let i=Ls(s,e.sourceCode);if(i){o=!0;for(let a of i)n.delete(a);if(n.size!==0)for(let[a,p]of n)e.report({node:p,messageId:"unusedField",data:{name:a}})}}}}});function js(e){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ce.AST_NODE_TYPES.ObjectExpression)return null;let n=Gt(r.properties,s=>s.type!==ce.AST_NODE_TYPES.Property||s.key.type!==ce.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===ce.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===ce.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===ce.AST_NODE_TYPES.FunctionExpression?Ms(s.value):null);if(!n)return null;let o=new Map;for(let s of n.properties)s.type===ce.AST_NODE_TYPES.Property&&s.key.type===ce.AST_NODE_TYPES.Identifier&&o.set(s.key.name,s);return o}function Ls(e,t){if(!(e.callee.type===ce.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ce.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==ce.AST_NODE_TYPES.ObjectPattern||!Gt(e.parent.id.properties,i=>i.type===ce.AST_NODE_TYPES.Property&&i.key.type===ce.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Ir(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of o){if(i.type!==ce.AST_NODE_TYPES.Identifier||i.parent.type===ce.AST_NODE_TYPES.Property&&i.parent.parent.type===ce.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===ce.AST_NODE_TYPES.ReturnStatement||i.parent.type===ce.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===ce.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==ce.AST_NODE_TYPES.Identifier||i.parent.property.type!==ce.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function Ms(e){if(e.body.type===ce.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===ce.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===ce.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ce.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var oe=require("@typescript-eslint/utils"),bt=require("zod/v4");var _s=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Wr(e){let t=[];for(let r of e.members)r.type===oe.AST_NODE_TYPES.TSPropertySignature&&r.key.type===oe.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Jr(e,...t){for(let r of t)e.set(...r);return e}var $s=bt.z.object({forceCheckOnFCPropTypesWithName:bt.z.array(bt.z.string()).optional(),alwaysCheckFunctionOptionTypes:bt.z.boolean().optional()}),Xr="no-unused-type-props-in-args",xn=null,Us=_s({name:Xr,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:[$($s)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!xn&&(xn=r.map(p=>new RegExp(p)));function o(p,l,d,u,f=!0,y=!1){let m=d.name,b=e.sourceCode.getScope(l).references.find(S=>S.identifier.name===m)?.resolved,C=p&&xn?.some(S=>S.test(m)),T=y&&n;if(!b||!C&&b.references.filter(S=>S.isTypeReference).length>1||!b.defs[0])return;let I=b.defs[0].node,A=I.parent?.type===oe.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&A&&!T)){if(I.type===oe.AST_NODE_TYPES.TSTypeAliasDeclaration){s(p,l,u,I.typeAnnotation,!0,y);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(p,l,u,I.body,!0,y);return}}}function s(p,l,d,u,f,y=!1){if(u.type===oe.AST_NODE_TYPES.TSInterfaceBody){for(let m of u.body)m.type===oe.AST_NODE_TYPES.TSPropertySignature&&m.key.type===oe.AST_NODE_TYPES.Identifier&&d.set(m.key.name,m);return}if(u.type===oe.AST_NODE_TYPES.TSTypeLiteral){Jr(d,...Wr(u));return}if(u.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let m of u.types)s(p,l,d,m,!0,y);return}f||u.type===oe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(p,l,u.typeName,d,!0,y)}function i(p,l,d,u=!1){for(let f of d)if(f.type===oe.AST_NODE_TYPES.ObjectPattern&&f.typeAnnotation){let y=new Map;if(s(p,l,y,f.typeAnnotation.typeAnnotation,!1,u),y.size===0)continue;a(f,y)}else f.type===oe.AST_NODE_TYPES.AssignmentPattern&&f.left.type===oe.AST_NODE_TYPES.ObjectPattern&&i(p,l,[f.left],u)}function a(p,l){let d=[];if(p.properties.at(-1)?.type===oe.AST_NODE_TYPES.RestElement)return;for(let m of p.properties)m.type===oe.AST_NODE_TYPES.Property&&m.key.type===oe.AST_NODE_TYPES.Identifier&&d.push(m.key.name);let f=[],y=[];for(let[m,b]of l)d.includes(m)||(y.push(m),f.push({node:b,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,b]of f.entries())e.report({...b,fix:m===f.length-1?C=>{let T=p.properties.at(-1),I=y.join(", ");return T?T.type===oe.AST_NODE_TYPES.RestElement?null:C.insertTextAfter(T,`, ${I}`):C.insertTextBeforeRange([p.range[0]+1,p.range[1]],I)}:void 0})}return{VariableDeclaration(p){let l=p.declarations[0],d=new Map,u=l.id.type===oe.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===oe.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(u){if(u.type===oe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===oe.AST_NODE_TYPES.Identifier)o(!0,p,u.typeName,d,!1);else if(u.type===oe.AST_NODE_TYPES.TSTypeLiteral)Jr(d,...Wr(u));else if(u.type===oe.AST_NODE_TYPES.TSIntersectionType)for(let f of u.types)f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier?o(!0,p,f.typeName,d,!1):s(!0,p,d,f,!0);if(d.size!==0&&l.init?.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let f=l.init.params[0];if(!f){e.report({node:l.init,messageId:"missingComponentParam"});return}f.type===oe.AST_NODE_TYPES.ObjectPattern&&a(f,d)}}},FunctionDeclaration(p){i(!1,p,p.params,n)},ArrowFunctionExpression(p){i(!1,p,p.params,n)}}}}),Cn={name:Xr,rule:Us};var De=require("@typescript-eslint/utils");var In=U({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===De.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===De.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===De.AST_NODE_TYPES.Identifier&&n.callee.property.type===De.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===De.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===De.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===De.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===De.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let a of s.references){let l=a.identifier.parent;if(l!==n&&!(l.type===De.AST_NODE_TYPES.JSXExpressionContainer&&l.parent.type===De.AST_NODE_TYPES.JSXAttribute&&l.parent.name.type===De.AST_NODE_TYPES.JSXIdentifier&&l.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var pt=require("@typescript-eslint/utils"),zs=pt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hr="prefer-named-functions",Br=new Map,Vs=zs({name:Hr,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=Br.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Br.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===pt.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===pt.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==pt.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,a=n.init.body,p=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(s,`${p.async?"async ":""}function ${o}(${i.map(d=>e.sourceCode.getText(d)).join(", ")||""}) ${e.sourceCode.getText(a)}`)}]})}}}}}),An={name:Hr,rule:Vs};var Q=require("@typescript-eslint/utils"),$e=require("zod/v4");var Ws=$e.z.object({disallowedFunctions:$e.z.array($e.z.object({name:$e.z.string(),allowUsingWithArgs:$e.z.boolean().optional(),hookAlternative:$e.z.string().optional(),message:$e.z.string().optional(),allowUseInside:$e.z.array($e.z.string()).optional()}))}),Js=/^use[A-Z]/,Xs=/^[A-Z]/;function Pt(e){return Js.test(e)}function Yr(e){return Xs.test(e)}function Bs(e){return e.type===Q.AST_NODE_TYPES.Identifier?Pt(e.name):e.type===Q.AST_NODE_TYPES.MemberExpression&&e.property.type===Q.AST_NODE_TYPES.Identifier?Pt(e.property.name):!1}function qr(e,t){return e.type===Q.AST_NODE_TYPES.Identifier?e.name===t:e.type===Q.AST_NODE_TYPES.MemberExpression&&e.object.type===Q.AST_NODE_TYPES.Identifier&&e.property.type===Q.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Zr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&qr(e.parent.callee,"forwardRef"))}function Gr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&qr(e.parent.callee,"memo"))}function wn(e){if(e.type===Q.AST_NODE_TYPES.FunctionDeclaration||e.type===Q.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.AST_NODE_TYPES.FunctionExpression||e.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===Q.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Hs(e){let t=e.parent,r=!1;for(;t;){if(t.type===Q.AST_NODE_TYPES.FunctionDeclaration||t.type===Q.AST_NODE_TYPES.FunctionExpression||t.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=wn(t);if(n&&n.type===Q.AST_NODE_TYPES.Identifier){if(Yr(n.name)||Pt(n.name))return!r;r=!0}else{if(Zr(t)||Gr(t))return!r;if(t.parent.type===Q.AST_NODE_TYPES.CallExpression){let o=t.parent;Bs(o.callee)||(r=!0)}else t.parent.type===Q.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Kr(e){return e.callee.type===Q.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Q.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Q.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ys(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.AST_NODE_TYPES.FunctionDeclaration||r.type===Q.AST_NODE_TYPES.FunctionExpression||r.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let n=wn(r);if(n&&n.type===Q.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===Q.AST_NODE_TYPES.CallExpression){let n=Kr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function qs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Zs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===Q.AST_NODE_TYPES.FunctionDeclaration||n.type===Q.AST_NODE_TYPES.FunctionExpression||n.type===Q.AST_NODE_TYPES.ArrowFunctionExpression){let o=wn(n);if(o&&o.type===Q.AST_NODE_TYPES.Identifier){if(Yr(o.name)||Pt(o.name)){r=!0;break}}else if(Zr(n)||Gr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Hs(e):!Ys(e,t):!1}var Fn=U({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:[$(Ws)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let s=Kr(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&qs(o))return;let a=i.allowUseInside||[];Zs(o,a)&&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:p=>{let l=i.hookAlternative;return l?o.callee.type===Q.AST_NODE_TYPES.Identifier?p.replaceText(o.callee,l):o.callee.type===Q.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===Q.AST_NODE_TYPES.Identifier?p.replaceText(o.callee.property,l):null:null}}]:[]})}}}});var fe=require("@typescript-eslint/utils"),Nt=Ne(require("zod/v4"));var Gs=fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ei="prefer-single-line-if",Ks=Nt.default.object({maxLineLength:Nt.default.number().optional(),maxNonSimpleConditionLength:Nt.default.number().optional()}),Qs=Gs({name:ei,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:[$(Ks)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==fe.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 s=n.consequent.body[0];if(!s)return;if(s.type===fe.AST_NODE_TYPES.ReturnStatement){if(!ni(s))return}else if(!(s.type===fe.AST_NODE_TYPES.ContinueStatement||s.type===fe.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===fe.AST_NODE_TYPES.LogicalExpression||n.test.type===fe.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let u=Qr(n.test);if(!u&&n.test.type===fe.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;Qr(f)&&(u=!0)}if(u&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let a=r.getText(s);if(i.includes(`
|
|
18
|
+
`))return;let p=r.getTokenAfter(n);if(p&&p.type===fe.AST_TOKEN_TYPES.Punctuator&&p.value==="}"){let u=r.getTokenAfter(p);if(u&&u.type===fe.AST_TOKEN_TYPES.Keyword&&(u.value==="else"||u.value==="catch"))return}let l=ea(r,n),d=`if (${i}) ${a}`;t.maxLineLength&&d.length+l.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:u=>u.replaceText(n,d)})}}}});function Qr(e){return e.type===fe.AST_NODE_TYPES.CallExpression||e.type===fe.AST_NODE_TYPES.BinaryExpression||e.type===fe.AST_NODE_TYPES.MemberExpression&&ti(e)}function ti(e){return e.object.type===fe.AST_NODE_TYPES.MemberExpression?ti(e.object):e.object.type!==fe.AST_NODE_TYPES.Identifier}function ea(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function ni(e){if(!e.argument)return!0;let t=e.argument;return t.type===fe.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===fe.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===fe.AST_NODE_TYPES.Literal||t.type===fe.AST_NODE_TYPES.Identifier||t.type===fe.AST_NODE_TYPES.TemplateLiteral||t.type===fe.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===fe.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===fe.AST_NODE_TYPES.UnaryExpression?ni(t):!1}var vn={name:ei,rule:Qs};var j=require("@typescript-eslint/utils"),kn=require("zod/v4");var ta=j.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ai="react-compiler-extra",na=kn.z.object({runOnlyWithEnableCompilerDirective:kn.z.boolean().optional()}),ra=/eslint +react-compiler\/react-compiler: +\["error/;function ct(e){let t=null;if((e.type===j.AST_NODE_TYPES.FunctionDeclaration||e.type===j.AST_NODE_TYPES.FunctionExpression||e.type===j.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===j.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===j.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===j.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function ri(e){let t=e.parent;for(;t;){if(t.type===j.AST_NODE_TYPES.FunctionDeclaration||t.type===j.AST_NODE_TYPES.FunctionExpression||t.type===j.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function ia(e){return e.type===j.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function li(e){return e.type===j.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===j.AST_NODE_TYPES.MemberExpression&&e.property.type===j.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Ue(e){if(!e)return!1;switch(e.type){case j.AST_NODE_TYPES.JSXElement:case j.AST_NODE_TYPES.JSXFragment:return!0;case j.AST_NODE_TYPES.ConditionalExpression:return Ue(e.consequent)||Ue(e.alternate);case j.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Ue(e.right):e.operator==="||"?Ue(e.left)||Ue(e.right):!1;case j.AST_NODE_TYPES.CallExpression:if(e.callee.type===j.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===j.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===j.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==j.AST_NODE_TYPES.SpreadElement&&Ue(t))return!0;return!1;default:return!1}}function oa(e){let t=e.typeAnnotation;if(t.type===j.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===j.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===j.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===j.AST_NODE_TYPES.Identifier&&t.typeName.right.type===j.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var sa=/^[A-Z][a-zA-Z0-9]*$/;function Ct(e){return sa.test(e)}function Ot(e){return e.startsWith("use")&&e.length>3}function Pn(e,t,r,n){if(r&&oa(r))return t?Ct(t.name):e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?Ct(e.id.name):!0;if(t&&Ot(t.name)||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id&&Ot(e.id.name))return!0;if(n){let o=t?.name||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(o&&Ct(o)&&pi(e.body,n).containsJSX)return!0}return!1}function xt(e){if(e.body.type===j.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===j.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===j.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function pi(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Me(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case j.AST_NODE_TYPES.JSXElement:case j.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case j.AST_NODE_TYPES.CallExpression:ia(n.callee)&&(r.containsHookCalls=!0),Ue(n)&&(r.containsJSX=!0);break;case j.AST_NODE_TYPES.ReturnStatement:n.argument&&Ue(n.argument)&&(r.containsJSX=!0);break;case j.AST_NODE_TYPES.VariableDeclarator:n.init&&Ue(n.init)&&(r.containsJSX=!0);break;case j.AST_NODE_TYPES.AssignmentExpression:Ue(n.right)&&(r.containsJSX=!0);break}},t),r}function ii(e,t){let r=e.body,n=pi(r,t);return n.containsJSX||n.containsHookCalls}var aa=/\bthis[.[]/;function oi(e){return aa.test(e)}function la(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Me(e,n=>{if(r.containsHookCalls||(n.type===j.AST_NODE_TYPES.FunctionDeclaration||n.type===j.AST_NODE_TYPES.FunctionExpression||n.type===j.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===j.AST_NODE_TYPES.CallExpression&&li(n.callee)&&(r.containsHookCalls=!0)},t),r}function si(e){return Ct(e)||Ot(e)}function Rn(e,t,r,n){if(!la(e.body,t).containsHookCalls)return!1;let s=Pn(e,r,n,t);if(!s&&n){let i=r?.name||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&Ct(i)&&(s=!0)}return!s}var pa=ta({name:ai,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, call other hooks or use the "use memo" directive for optimal React compiler detection.',addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization',functionCallingHooksMustBeComponent:'Functions calling hooks must be React components (PascalCase with FC type) or hooks (start with "use").',useMemoDirectiveNaming:'Functions using "use memo" directive must follow React naming conventions (PascalCase for components or start with "use" for hooks).'},hasSuggestions:!0,schema:[$(na)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(ra.test(i.value)){r=!0;break}if(!r)return{}}function n(i){for(let a of i.properties)if(a.type===j.AST_NODE_TYPES.Property&&a.method&&a.value.type===j.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode,l=p.getText(a.key),d=a.value,u=p.getText(d.body);if(oi(u))e.report({node:a,messageId:"thisKeywordInMethod"});else{let f=d.params.map(m=>p.getText(m)).join(", "),y="";d.generator?y=`${l}: function* (${f}) ${u}`:d.async?y=`${l}: async (${f}) => ${u}`:y=`${l}: (${f}) => ${u}`,e.report({node:a,messageId:"objectMethodIsNotSupported",fix:m=>m.replaceText(a,y)})}}}function o(i){for(let a of i.properties)if(a.type===j.AST_NODE_TYPES.Property&&a.value.type===j.AST_NODE_TYPES.ObjectExpression){for(let p of a.value.properties)if(p.type===j.AST_NODE_TYPES.Property&&p.method&&p.value.type===j.AST_NODE_TYPES.FunctionExpression){let d=e.sourceCode.getText(p.value.body);oi(d)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}function s(i){let a=ri(i);return a!==null&&ct(a)}return{CallExpression(i){if(li(i.callee))for(let a of i.arguments){if(a.type===j.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(a),o(a)}if(a.type===j.AST_NODE_TYPES.ArrowFunctionExpression){if(a.body.type===j.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(a.body),o(a.body)}if(a.body.type===j.AST_NODE_TYPES.BlockStatement){for(let p of a.body.body)if(p.type===j.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===j.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(p.argument),o(p.argument)}}}if(a.type===j.AST_NODE_TYPES.FunctionExpression){for(let p of a.body.body)if(p.type===j.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===j.AST_NODE_TYPES.ObjectExpression){if(s(i))return;n(p.argument),o(p.argument)}}}},VariableDeclarator(i){if(i.id.type===j.AST_NODE_TYPES.Identifier&&i.init&&(i.init.type===j.AST_NODE_TYPES.ArrowFunctionExpression||i.init.type===j.AST_NODE_TYPES.FunctionExpression)){let a=i.init,p=i.id,l=i.id.typeAnnotation;if(xt(a)&&!si(p.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(Rn(a,e.sourceCode,p,l)){if(ct(a))return;e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(Pn(a,p,l,e.sourceCode)){let d=ii(a,e.sourceCode),u=xt(a);if(!d&&!u){if(ct(a))return;e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(f){if(a.body.type===j.AST_NODE_TYPES.BlockStatement){let y=a.body.range[0]+1;return f.insertTextAfterRange([y,y],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&
|
|
20
|
+
`)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&xt(i)&&!si(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Rn(i,e.sourceCode)){if(ct(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(Pn(i,void 0,void 0,e.sourceCode)){let a=ii(i,e.sourceCode),p=xt(i);if(!a&&!p){if(ct(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let d=i.body.range[0]+1;return l.insertTextAfterRange([d,d],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}}},FunctionExpression(i){if(ht(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Fn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.AST_NODE_TYPES.ObjectExpression)return;let a=ei(i);if(!a)return;let p;a.type===j.AST_NODE_TYPES.FunctionDeclaration&&a.id?p=a.id.name:(a.type===j.AST_NODE_TYPES.ArrowFunctionExpression||a.type===j.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===j.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===j.AST_NODE_TYPES.Identifier&&(p=a.parent.id.name),p&&Pt(p)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),kn={name:ii,rule:sa};var me=require("@typescript-eslint/utils"),je=require("zod/v4");var aa=me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ai="react-compiler-migration",la=je.z.object({disallowHooks:je.z.array(je.z.object({name:je.z.string(),replacement:je.z.string()})).optional(),disallowMethods:je.z.array(je.z.object({name:je.z.string(),replacement:je.z.string().optional(),requireTrueProp:je.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:je.z.boolean().optional()}),pa=/eslint +react-compiler\/react-compiler: +\["error/;function ca(e){let t=null;if((e.type===me.AST_NODE_TYPES.FunctionDeclaration||e.type===me.AST_NODE_TYPES.FunctionExpression||e.type===me.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===me.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===me.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===me.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function ua(e){let t=e.parent;for(;t;){if(t.type===me.AST_NODE_TYPES.FunctionDeclaration||t.type===me.AST_NODE_TYPES.FunctionExpression||t.type===me.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function fa(e){return e.type===me.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===me.AST_NODE_TYPES.MemberExpression&&e.property.type===me.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ma=aa({name:ai,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:[$(la)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(pa.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ua(o);return s!==null&&ca(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===me.AST_NODE_TYPES.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===me.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===me.AST_NODE_TYPES.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(p=>p.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:p=>p.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&fa(o.callee)){for(let s of o.arguments)if(s.type===me.AST_NODE_TYPES.ObjectExpression){for(let i of s.properties)if(i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier){let a=i.key.name,p=t.disallowMethods.find(l=>l.name===a);if(p){if(n(o))return;if(p.requireTrueProp){let l=p.requireTrueProp,u=!1;for(let f of s.properties)if(f.type===me.AST_NODE_TYPES.Property&&f.key.type===me.AST_NODE_TYPES.Identifier&&f.key.name===l&&f.value.type===me.AST_NODE_TYPES.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:l}});continue}}p.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:l=>p.replacement?l.replaceText(i.key,p.replacement):null}]})}}}}}}}}),Pn={name:ai,rule:ma};var se=require("@typescript-eslint/utils"),Nn=require("zod/v4");var ya=/\.(tsx|jsx)$/,da=/^[A-Z][A-Za-z0-9]*$/,ga=/^[A-Z][A-Z0-9_]*$/,li=80,Sa=Nn.z.object({ignoreConstCaseVarRegex:Nn.z.string().optional()}),Dn=z({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[$(Sa)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!ya.test(e.filename))return{};let r=e.sourceCode,n=Ra(t.ignoreConstCaseVarRegex),o=Ta(r.ast.body);return o.length===0?{}:{VariableDeclarator(s){if(s.id.type!==se.AST_NODE_TYPES.Identifier||!Ea(s)||!xa(s.init))return;let i=s.id.name;if(n&&va(i)&&n.test(i))return;let p=r.getDeclaredVariables(s).find(b=>b.name===i);if(!p)return;let l=new Set,u=!1,f=!1;for(let b of p.references){if(b.init)continue;f=!0;let m=ha(b.identifier,o);if(!m){u=!0;break}if(l.add(m),l.size>1)break}if(!f||u||l.size!==1)return;let[y]=Array.from(l);y&&e.report({node:s.id,messageId:"moveValueInsideComponent",data:{valueName:i,componentName:y}})}}}});function Ta(e){let t=[],r=new Set;function n(s,i){da.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==se.AST_NODE_TYPES.Identifier)continue;let a=pi(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===se.AST_NODE_TYPES.VariableDeclaration){o(s);continue}if(s.type===se.AST_NODE_TYPES.FunctionDeclaration){n(s.id.name,s);continue}s.type===se.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===se.AST_NODE_TYPES.VariableDeclaration?o(s.declaration):s.declaration.type===se.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function Ea(e){return e.parent.parent.type===se.AST_NODE_TYPES.Program}function ha(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function pi(e){if(!e)return null;let t=On(e);if(t.type===se.AST_NODE_TYPES.ArrowFunctionExpression||t.type===se.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==se.AST_NODE_TYPES.CallExpression||!ba(t.callee))return null;let r=t.arguments[0];if(!r||r.type===se.AST_NODE_TYPES.SpreadElement)return null;if(r.type===se.AST_NODE_TYPES.CallExpression)return pi(r);let n=On(r);return n.type===se.AST_NODE_TYPES.ArrowFunctionExpression||n.type===se.AST_NODE_TYPES.FunctionExpression?n:null}function ba(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===se.AST_NODE_TYPES.MemberExpression?e.property.type===se.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function On(e){let t=e;for(;;){if(t.type===se.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function xa(e){if(!e)return!1;let t=On(e);return Ca(t)?!1:Ia(t)?!0:Aa(t)}function Ca(e){return e.type===se.AST_NODE_TYPES.Identifier||e.type===se.AST_NODE_TYPES.MemberExpression}function Ia(e){if(e.type===se.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=li;if(e.type===se.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=li:!1}return!1}function Aa(e){return e.type===se.AST_NODE_TYPES.ArrayExpression||e.type===se.AST_NODE_TYPES.ObjectExpression||e.type===se.AST_NODE_TYPES.ClassExpression?!0:e.type===se.AST_NODE_TYPES.NewExpression?wa(e):!1}function wa(e){let t=Fa(e.callee);return t==="Set"||t==="Map"}function Fa(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name:e.type===se.AST_NODE_TYPES.MemberExpression?e.computed||e.property.type!==se.AST_NODE_TYPES.Identifier?null:e.property.name:null}function va(e){return ga.test(e)}function Ra(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}var U=require("@typescript-eslint/utils"),Ln=require("zod");var ka=Ln.z.object({runOnlyWithEnableCompilerDirective:Ln.z.boolean().optional()}),Pa=/eslint +react-compiler\/react-compiler: +\["error/,Na=/^\d+$/,Oa=/[\s_-]+/,Da=/[a-z][A-Z]/,ja=/^(.+?)([A-Z][a-z]+s?)$/,La=/^[a-z][a-zA-Z]*$/;function ci(e,t){let r=[];if(e.type===U.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===U.AST_NODE_TYPES.JSXAttribute&&n.name.type===U.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===U.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==U.AST_NODE_TYPES.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Me(s,a=>{switch(a.type){case U.AST_NODE_TYPES.ObjectExpression:case U.AST_NODE_TYPES.ArrowFunctionExpression:case U.AST_NODE_TYPES.FunctionExpression:case U.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function Ma(e){if(e.body.type===U.AST_NODE_TYPES.JSXElement||e.body.type===U.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===U.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===U.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===U.AST_NODE_TYPES.JSXElement||t.argument.type===U.AST_NODE_TYPES.JSXFragment))return!0}return!1}function _a(e,t){let r=e.callee;if(r.type===U.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===U.AST_NODE_TYPES.Identifier){let o=n.name,s=$a(o);if(s!==o)return Mn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===U.AST_NODE_TYPES.Identifier)return Mn(n.name)}return"ListItem"}function $a(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(Da)){let n=e.match(ja);if(n){let o=n[1],s=n[2];if(!o||!s)return jn(e);let i=jn(s);if(i!==s)return o+i}}return jn(e)}function jn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function Mn(e){return e.match(La)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Oa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ui(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Me(e,i=>{if(i.type===U.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Na.test(i.name)){let a=i.parent;if(a.type===U.AST_NODE_TYPES.Property&&a.key===i||a.type===U.AST_NODE_TYPES.MemberExpression&&a.property===i&&!a.computed||a.type===U.AST_NODE_TYPES.JSXOpeningElement||a.type===U.AST_NODE_TYPES.JSXClosingElement||a.type===U.AST_NODE_TYPES.JSXAttribute&&a.name.type===U.AST_NODE_TYPES.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function fi(e,t,r,n,o){let i=[...r.map(f=>f.type===U.AST_NODE_TYPES.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],a=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
|
|
23
|
-
`),p=i.map(
|
|
22
|
+
`)}}]})}}},FunctionExpression(i){if(xt(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Rn(i,e.sourceCode)){if(ct(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.AST_NODE_TYPES.ObjectExpression)return;let a=ri(i);if(!a)return;let p;a.type===j.AST_NODE_TYPES.FunctionDeclaration&&a.id?p=a.id.name:(a.type===j.AST_NODE_TYPES.ArrowFunctionExpression||a.type===j.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===j.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===j.AST_NODE_TYPES.Identifier&&(p=a.parent.id.name),p&&Ot(p)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),Nn={name:ai,rule:pa};var me=require("@typescript-eslint/utils"),je=require("zod/v4");var ca=me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ci="react-compiler-migration",ua=je.z.object({disallowHooks:je.z.array(je.z.object({name:je.z.string(),replacement:je.z.string()})).optional(),disallowMethods:je.z.array(je.z.object({name:je.z.string(),replacement:je.z.string().optional(),requireTrueProp:je.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:je.z.boolean().optional()}),fa=/eslint +react-compiler\/react-compiler: +\["error/;function ma(e){let t=null;if((e.type===me.AST_NODE_TYPES.FunctionDeclaration||e.type===me.AST_NODE_TYPES.FunctionExpression||e.type===me.AST_NODE_TYPES.ArrowFunctionExpression&&e.body.type===me.AST_NODE_TYPES.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===me.AST_NODE_TYPES.ExpressionStatement&&r.expression.type===me.AST_NODE_TYPES.Literal&&r.expression.value==="use no memo":!1}function da(e){let t=e.parent;for(;t;){if(t.type===me.AST_NODE_TYPES.FunctionDeclaration||t.type===me.AST_NODE_TYPES.FunctionExpression||t.type===me.AST_NODE_TYPES.ArrowFunctionExpression)return t;t=t.parent}return null}function ya(e){return e.type===me.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===me.AST_NODE_TYPES.MemberExpression&&e.property.type===me.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var ga=ca({name:ci,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:[$(ua)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(fa.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=da(o);return s!==null&&ma(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===me.AST_NODE_TYPES.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===me.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===me.AST_NODE_TYPES.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(p=>p.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:p=>p.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&ya(o.callee)){for(let s of o.arguments)if(s.type===me.AST_NODE_TYPES.ObjectExpression){for(let i of s.properties)if(i.type===me.AST_NODE_TYPES.Property&&i.key.type===me.AST_NODE_TYPES.Identifier){let a=i.key.name,p=t.disallowMethods.find(l=>l.name===a);if(p){if(n(o))return;if(p.requireTrueProp){let l=p.requireTrueProp,d=!1;for(let u of s.properties)if(u.type===me.AST_NODE_TYPES.Property&&u.key.type===me.AST_NODE_TYPES.Identifier&&u.key.name===l&&u.value.type===me.AST_NODE_TYPES.Literal&&u.value.value===!0){d=!0;break}if(!d){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:l}});continue}}p.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:l=>p.replacement?l.replaceText(i.key,p.replacement):null}]})}}}}}}}}),On={name:ci,rule:ga};var se=require("@typescript-eslint/utils"),Dn=require("zod/v4");var Sa=/\.(tsx|jsx)$/,Ta=/^[A-Z][A-Za-z0-9]*$/,Ea=/^[A-Z][A-Z0-9_]*$/,ui=80,ha=Dn.z.object({ignoreConstCaseVarRegex:Dn.z.string().optional()}),Ln=U({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, regex values, and class instantiations except Set/Map"},schema:[$(ha)],messages:{moveValueInsideComponent:"Module-level `{{valueName}}` is only used in React component `{{componentName}}`. Move it inside the component to improve memory usage."}},defaultOptions:[{}],create(e,[t]){if(!Sa.test(e.filename))return{};let r=e.sourceCode,n=Na(t.ignoreConstCaseVarRegex),o=ba(r.ast.body);return o.length===0?{}:{VariableDeclarator(s){if(s.id.type!==se.AST_NODE_TYPES.Identifier||!xa(s)||!Aa(s.init))return;let i=s.id.name;if(n&&Pa(i)&&n.test(i))return;let p=r.getDeclaredVariables(s).find(y=>y.name===i);if(!p)return;let l=new Set,d=!1,u=!1;for(let y of p.references){if(y.init)continue;u=!0;let m=Ca(y.identifier,o);if(!m){d=!0;break}if(l.add(m),l.size>1)break}if(!u||d||l.size!==1)return;let[f]=Array.from(l);f&&e.report({node:s.id,messageId:"moveValueInsideComponent",data:{valueName:i,componentName:f}})}}}});function ba(e){let t=[],r=new Set;function n(s,i){Ta.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==se.AST_NODE_TYPES.Identifier)continue;let a=fi(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===se.AST_NODE_TYPES.VariableDeclaration){o(s);continue}if(s.type===se.AST_NODE_TYPES.FunctionDeclaration){n(s.id.name,s);continue}s.type===se.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===se.AST_NODE_TYPES.VariableDeclaration?o(s.declaration):s.declaration.type===se.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function xa(e){return e.parent.parent.type===se.AST_NODE_TYPES.Program}function Ca(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function fi(e){if(!e)return null;let t=jn(e);if(t.type===se.AST_NODE_TYPES.ArrowFunctionExpression||t.type===se.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==se.AST_NODE_TYPES.CallExpression||!Ia(t.callee))return null;let r=t.arguments[0];if(!r||r.type===se.AST_NODE_TYPES.SpreadElement)return null;if(r.type===se.AST_NODE_TYPES.CallExpression)return fi(r);let n=jn(r);return n.type===se.AST_NODE_TYPES.ArrowFunctionExpression||n.type===se.AST_NODE_TYPES.FunctionExpression?n:null}function Ia(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===se.AST_NODE_TYPES.MemberExpression?e.property.type===se.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function jn(e){let t=e;for(;;){if(t.type===se.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===se.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function Aa(e){if(!e)return!1;let t=jn(e);return wa(t)?!1:Fa(t)?!0:va(t)}function wa(e){return e.type===se.AST_NODE_TYPES.Identifier||e.type===se.AST_NODE_TYPES.MemberExpression}function Fa(e){if(e.type===se.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=ui;if(e.type===se.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=ui:!1}return!1}function va(e){return e.type===se.AST_NODE_TYPES.ArrayExpression||e.type===se.AST_NODE_TYPES.ObjectExpression||e.type===se.AST_NODE_TYPES.ClassExpression?!0:e.type===se.AST_NODE_TYPES.NewExpression?Ra(e):!1}function Ra(e){let t=ka(e.callee);return t==="Set"||t==="Map"}function ka(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name:e.type===se.AST_NODE_TYPES.MemberExpression?e.computed||e.property.type!==se.AST_NODE_TYPES.Identifier?null:e.property.name:null}function Pa(e){return Ea.test(e)}function Na(e){if(!e)return null;try{return new RegExp(e)}catch{return null}}var z=require("@typescript-eslint/utils"),_n=require("zod");var Oa=_n.z.object({runOnlyWithEnableCompilerDirective:_n.z.boolean().optional()}),Da=/eslint +react-compiler\/react-compiler: +\["error/,ja=/^\d+$/,La=/[\s_-]+/,Ma=/[a-z][A-Z]/,_a=/^(.+?)([A-Z][a-z]+s?)$/,$a=/^[a-z][a-zA-Z]*$/;function mi(e,t){let r=[];if(e.type===z.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===z.AST_NODE_TYPES.JSXAttribute&&n.name.type===z.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===z.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==z.AST_NODE_TYPES.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Me(s,a=>{switch(a.type){case z.AST_NODE_TYPES.ObjectExpression:case z.AST_NODE_TYPES.ArrowFunctionExpression:case z.AST_NODE_TYPES.FunctionExpression:case z.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function Ua(e){if(e.body.type===z.AST_NODE_TYPES.JSXElement||e.body.type===z.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===z.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===z.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===z.AST_NODE_TYPES.JSXElement||t.argument.type===z.AST_NODE_TYPES.JSXFragment))return!0}return!1}function za(e,t){let r=e.callee;if(r.type===z.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===z.AST_NODE_TYPES.Identifier){let o=n.name,s=Va(o);if(s!==o)return $n(s)}}if(t.length>0){let n=t[0];if(n&&n.type===z.AST_NODE_TYPES.Identifier)return $n(n.name)}return"ListItem"}function Va(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(Ma)){let n=e.match(_a);if(n){let o=n[1],s=n[2];if(!o||!s)return Mn(e);let i=Mn(s);if(i!==s)return o+i}}return Mn(e)}function Mn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function $n(e){return e.match($a)?e.charAt(0).toUpperCase()+e.slice(1):e.split(La).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function di(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Me(e,i=>{if(i.type===z.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!ja.test(i.name)){let a=i.parent;if(a.type===z.AST_NODE_TYPES.Property&&a.key===i||a.type===z.AST_NODE_TYPES.MemberExpression&&a.property===i&&!a.computed||a.type===z.AST_NODE_TYPES.JSXOpeningElement||a.type===z.AST_NODE_TYPES.JSXClosingElement||a.type===z.AST_NODE_TYPES.JSXAttribute&&a.name.type===z.AST_NODE_TYPES.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function yi(e,t,r,n,o){let i=[...r.map(u=>u.type===z.AST_NODE_TYPES.Identifier?u.name:"item").map((u,f)=>({name:u,type:f===0?`${e}Type`:f===1?"number":"unknown"})),...n],a=i.map(u=>{let f=u.type;return u.name.includes("on")&&f==="any"&&(f="unknown"),` ${u.name}: ${f};`}).join(`
|
|
23
|
+
`),p=i.map(u=>u.name).join(", "),l=o.getText(t),d=`${e}Props`;return`type ${d} = {
|
|
24
24
|
${a}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const ${e}: FC<${
|
|
27
|
+
const ${e}: FC<${d}> = ({ ${p} }) => {
|
|
28
28
|
return (
|
|
29
29
|
${l}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Wa(e,t,r,n){let o=t.map(i=>i.type===z.AST_NODE_TYPES.Identifier?i.name:"item"),s=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function Ja(e){if(e.type===z.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===z.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return $n(t)}return"ListItem"}function Xa(e,t,r){let n=[r?`key={${r}}`:"",...t.map(o=>`${o.name}={${o.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function gi(e,t){for(let r of e.openingElement.attributes)if(r.type===z.AST_NODE_TYPES.JSXAttribute&&r.name.type===z.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===z.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==z.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var Un=U({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[$(Oa)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let o of r.getAllComments())if(Da.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===z.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===z.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Ba(n,r,e):Ha(n,r,e))}}}});function Ba(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==z.AST_NODE_TYPES.FunctionExpression||!Ua(n))return;let o=null;if(n.body.type===z.AST_NODE_TYPES.JSXElement||n.body.type===z.AST_NODE_TYPES.JSXFragment?o=n.body:n.body.type===z.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===z.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===z.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===z.AST_NODE_TYPES.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=mi(o,t);if(!s.hasUnstable)return;let i=za(e,n.params),a=n.params.map(u=>u.type===z.AST_NODE_TYPES.Identifier?u.name:"item"),p=di(o,a,t),l=o.type===z.AST_NODE_TYPES.JSXElement?gi(o,t):null,d=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:d},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=yi(i,o,n.params,p,t),y=Wa(i,n.params,p,l),m=e;for(;m.parent.type!==z.AST_NODE_TYPES.Program&&!(m.type===z.AST_NODE_TYPES.FunctionDeclaration||m.type===z.AST_NODE_TYPES.VariableDeclarator&&m.init&&(m.init.type===z.AST_NODE_TYPES.ArrowFunctionExpression||m.init.type===z.AST_NODE_TYPES.FunctionExpression));)m=m.parent;let b=[];return b.push(u.insertTextAfter(m,`
|
|
32
32
|
|
|
33
|
-
${
|
|
33
|
+
${f}`)),b.push(u.replaceText(o,y)),b}}]})}function Ha(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.AST_NODE_TYPES.JSXElement&&n.type!==z.AST_NODE_TYPES.JSXFragment)return;let o=n,s=mi(o,t);if(!s.hasUnstable)return;let i=Ja(o),a=di(o,[],t),p=o.type===z.AST_NODE_TYPES.JSXElement?gi(o,t):null,l=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:l},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:d=>{let u=yi(i,o,[],a,t),f=Xa(i,a,p),y=e;for(;y.parent.type!==z.AST_NODE_TYPES.Program&&!(y.type===z.AST_NODE_TYPES.FunctionDeclaration||y.type===z.AST_NODE_TYPES.VariableDeclarator&&y.init&&(y.init.type===z.AST_NODE_TYPES.ArrowFunctionExpression||y.init.type===z.AST_NODE_TYPES.FunctionExpression));)y=y.parent;let m=[];return m.push(d.insertTextAfter(y,`
|
|
34
34
|
|
|
35
|
-
${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Nt=require("@typescript-eslint/utils"),Xa=Nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yi="require-description",Ba=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ha=/^eslint-disable-(next-)?line$/u,Ya=Xa({name:yi,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 s=qa(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ka(o.loc),messageId:"missingDescription"}))}}}}}),di={name:yi,rule:Ya};function qa(e){let{text:t,description:r}=Ga(e.value);if(!t)return null;let n=Ba.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Ha.test(o);if(e.type===Nt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&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 Za=/\s-{2,}\s/u;function Ga(e){let t=e.split(Za);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ka(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),ze=require("zod/v4");var Qa=ze.z.object({varsToCheck:ze.z.array(ze.z.object({selector:ze.z.string().optional(),fromFnCall:ze.z.string().optional(),prop:ze.z.string().or(ze.z.array(ze.z.string())),errorMsg:ze.z.string().optional()}))}),$n=z({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:[$(Qa)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,p,l){let u=new Set;for(let y of i.properties)y.type===ne.AST_NODE_TYPES.Property&&y.key.type===ne.AST_NODE_TYPES.Identifier&&u.add(y.key.name);let f=a.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:l,customMsg:p||""}});else{let y=f.map(b=>`"${b}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:l,customMsg:p||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:o(a)}),a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.ObjectPattern){let p=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,p,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[l]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.AST_NODE_TYPES.ObjectPattern){let b=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,b,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[p,l]=a.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${p}"][property.name="${l}"]`;s[u]=f=>{if(f.type!==ne.AST_NODE_TYPES.MemberExpression||f.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let b=y.parent;if(b.id.type===ne.AST_NODE_TYPES.Identifier)r.set(b.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:b.id,fnName:i.fromFnCall||"unknown function"});else if(b.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(b.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let p=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[p]=l=>{if(l.type!==ne.AST_NODE_TYPES.Identifier||l.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=l.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.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===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:p,node:l,fnName:u}]of r){let y=e.sourceCode.getScope(l).set.get(i);if(y){let b=new Set(a);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===h)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&b.has(C.property.name)){if(b.delete(C.property.name),b.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===h&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of C.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&b.has(S.key.name)&&b.delete(S.key.name);if(b.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===h&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!a.includes(C.property.name))){b.clear();break}}}if(b.size>0){let m=Array.from(b);if(m.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:p||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:p||""}})}}}}}}}});function hi(e){return/^use[A-Z0-9]/.test(e)}function Ot(e){return e.type==="Identifier"?hi(e.name):e.type==="MemberExpression"&&!e.computed&&Ot(e.property)?e.object.type==="Identifier":!1}function bi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function xi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Ci(e){return!!(e.parent&&e.parent.callee&&xi(e.parent.callee,"forwardRef"))}function Ii(e){return!!(e.parent&&e.parent.callee&&xi(e.parent.callee,"memo"))}function Un(e){for(;e;){let t=wi(e);if(t&&(bi(t)||Ot(t))||Ci(e)||Ii(e))return!0;e=e.parent}return!1}function gi(e){return!1}function zn(e){return!1}var el=/eslint +react-compiler\/react-compiler: +\["error/;function Si(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function Ti(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Ai={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(l){let u=null;if(l.callee.name==="useMemo"?u="useMemo":l.callee.name==="useCallback"&&(u="useCallback"),u){let f=Ti(l);if(f&&Si(f))return;e.report({node:l,message:`"${u}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let l of e.sourceCode.getAllComments())if(el.test(l.value))return{CallExpression(u){let f=null;if(u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f){let y=Ti(u);if(y&&Si(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?l=>r(l):l=>e.sourceCode.getText(l),n=typeof e.getScope=="function"?()=>n():l=>e.sourceCode.getScope(l),o=null,s=[],i=[],a=new WeakSet;function p(l){for(let u of l.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&gi(f.init.callee))for(let y of u.resolved.references)y!==u&&a.add(y.identifier)}}return{onCodePathSegmentStart:l=>i.push(l),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,u){let f=s.pop();if(f.size===0)return;let y=new Set;function b(E,x){let{cache:w}=b,k=w.get(E.id),N=new Set(x);if(N.has(E.id)){let c=[...N],v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(l.thrownSegments.includes(E))k=BigInt("0");else if(E.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.prevSegments)k+=b(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,x){let{cache:w}=m,k=w.get(E.id),N=new Set(x);if(N.has(E.id)){let c=Array.from(N),v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(l.thrownSegments.includes(E))k=BigInt("0");else if(E.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.nextSegments)k+=m(c,N)}return w.set(E.id,k),k}function h(E){let{cache:x}=h,w=x.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(x.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let N=h(k);N<w&&(w=N)}w+=1}return x.set(E.id,w),w}b.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(l.initialSegment),S=wi(u),I=Un(u),A=S?bi(S)||Ot(S):Ci(u)||Ii(u),g=1/0;for(let E of l.finalSegments){if(!E.reachable)continue;let x=h(E);x<g&&(g=x)}for(let[E,x]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=b(E)*m(E),N=y.has(E.id);for(let c of x)if(N&&!zn(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!zn(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let v=`React Hook "${r(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(S){let v=`React Hook "${r(c)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(u.type==="Program"){let v=`React Hook "${r(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(I&&!zn(c)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&hi(d.parent.id.name))return}let v=`React Hook "${r(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}}},CallExpression(l){if(Ot(l.callee)){let u=Ei(s),f=Ei(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||gi(l.callee))&&l.arguments.length>0&&(o=l)},Identifier(l){o==null&&a.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${r(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===o&&(o=null)},FunctionDeclaration(l){Un(l)&&p(n(l))},ArrowFunctionExpression(l){Un(l)&&p(n(l))}}}};function wi(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 Ei(e){return e[e.length-1]}var Te=require("@typescript-eslint/utils"),Ce=Ne(require("zod/v4"));var tl=/^\s+$/,Vn=/\r?\n/,nl=/^(\s*)/,rl=/^(\s*)\S/,il=/\r?\n/,ol=Ce.object({indent:Ce.union([Ce.string().regex(tl),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),Wn=z({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(ol)],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:s}=e.options[0],i=r.map(S=>S.toLowerCase());function a(S){let I=S.split(Vn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let x=E.match(nl);x&&(g=Math.min(g,x[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
|
|
36
|
-
`)}function p(
|
|
37
|
-
`)}function l(
|
|
35
|
+
${u}`)),m.push(d.replaceText(o,f)),m}}]})}var Dt=require("@typescript-eslint/utils"),Ya=Dt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Si="require-description",qa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Za=/^eslint-disable-(next-)?line$/u,Ga=Ya({name:Si,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 s=Ka(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:tl(o.loc),messageId:"missingDescription"}))}}}}}),Ti={name:Si,rule:Ga};function Ka(e){let{text:t,description:r}=el(e.value);if(!t)return null;let n=qa.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Za.test(o);if(e.type===Dt.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&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 Qa=/\s-{2,}\s/u;function el(e){let t=e.split(Qa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function tl(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),ze=require("zod/v4");var nl=ze.z.object({varsToCheck:ze.z.array(ze.z.object({selector:ze.z.string().optional(),fromFnCall:ze.z.string().optional(),prop:ze.z.string().or(ze.z.array(ze.z.string())),errorMsg:ze.z.string().optional()}))}),zn=U({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:[$(nl)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,p,l){let d=new Set;for(let f of i.properties)f.type===ne.AST_NODE_TYPES.Property&&f.key.type===ne.AST_NODE_TYPES.Identifier&&d.add(f.key.name);let u=a.filter(f=>!d.has(f));if(u.length>0)if(u.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:u[0],fnName:l,customMsg:p||""}});else{let f=u.map(y=>`"${y}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:f,fnName:l,customMsg:p||""}})}}function o(i){if(i.init?.type===ne.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:o(a)}),a.type===ne.AST_NODE_TYPES.VariableDeclarator&&a.id.type===ne.AST_NODE_TYPES.ObjectPattern){let p=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,p,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[l]=d=>{if(d.type!==ne.AST_NODE_TYPES.MemberExpression||d.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=d.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.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===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(a.includes(".")){let[p,l]=a.split("."),d=`VariableDeclarator > CallExpression > MemberExpression[object.name="${p}"][property.name="${l}"]`;s[d]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.AST_NODE_TYPES.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let p=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[p]=l=>{if(l.type!==ne.AST_NODE_TYPES.Identifier||l.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let d=l.parent;if(d.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let u=d.parent;if(u.id.type===ne.AST_NODE_TYPES.Identifier)r.set(u.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:u.id,fnName:i.fromFnCall||"unknown function"});else if(u.id.type===ne.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(u.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:p,node:l,fnName:d}]of r){let f=e.sourceCode.getScope(l).set.get(i);if(f){let y=new Set(a);for(let m of f.references){let b=m.identifier,C=b.parent;if(!(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.id===b)){if(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===b&&C.property.type===ne.AST_NODE_TYPES.Identifier&&y.has(C.property.name)){if(y.delete(C.property.name),y.size===0)break;continue}if(C.type===ne.AST_NODE_TYPES.VariableDeclarator&&C.init===b&&C.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let T of C.id.properties)T.type===ne.AST_NODE_TYPES.Property&&T.key.type===ne.AST_NODE_TYPES.Identifier&&y.has(T.key.name)&&y.delete(T.key.name);if(y.size===0)break;continue}if(!(C.type===ne.AST_NODE_TYPES.MemberExpression&&C.object===b&&C.property.type===ne.AST_NODE_TYPES.Identifier&&!a.includes(C.property.name))){y.clear();break}}}if(y.size>0){let m=Array.from(y);if(m.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:m[0],fnName:d,customMsg:p||""}});else{let b=m.map(C=>`"${C}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:b,fnName:d,customMsg:p||""}})}}}}}}}});function Ci(e){return/^use[A-Z0-9]/.test(e)}function jt(e){return e.type==="Identifier"?Ci(e.name):e.type==="MemberExpression"&&!e.computed&&jt(e.property)?e.object.type==="Identifier":!1}function Ii(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Ai(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function wi(e){return!!(e.parent&&e.parent.callee&&Ai(e.parent.callee,"forwardRef"))}function Fi(e){return!!(e.parent&&e.parent.callee&&Ai(e.parent.callee,"memo"))}function Vn(e){for(;e;){let t=Ri(e);if(t&&(Ii(t)||jt(t))||wi(e)||Fi(e))return!0;e=e.parent}return!1}function Ei(e){return!1}function Wn(e){return!1}var rl=/eslint +react-compiler\/react-compiler: +\["error/;function hi(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function bi(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var vi={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"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(l){let d=null;if(l.callee.name==="useMemo"?d="useMemo":l.callee.name==="useCallback"&&(d="useCallback"),d){let u=bi(l);if(u&&hi(u))return;e.report({node:l,message:`"${d}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let l of e.sourceCode.getAllComments())if(rl.test(l.value))return{CallExpression(d){let u=null;if(d.callee.name==="useMemo"?u="useMemo":d.callee.name==="useCallback"&&(u="useCallback"),u){let f=bi(d);if(f&&hi(f))return;e.report({node:d,message:`"${u}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?l=>r(l):l=>e.sourceCode.getText(l),n=typeof e.getScope=="function"?()=>n():l=>e.sourceCode.getScope(l),o=null,s=[],i=[],a=new WeakSet;function p(l){for(let d of l.references){let u=d.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&Ei(u.init.callee))for(let f of d.resolved.references)f!==d&&a.add(f.identifier)}}return{onCodePathSegmentStart:l=>i.push(l),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,d){let u=s.pop();if(u.size===0)return;let f=new Set;function y(h,x){let{cache:w}=y,k=w.get(h.id),N=new Set(x);if(N.has(h.id)){let c=[...N],v=c.slice(c.indexOf(h.id)+1);for(let g of v)f.add(g);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(l.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of h.prevSegments)k+=y(c,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function m(h,x){let{cache:w}=m,k=w.get(h.id),N=new Set(x);if(N.has(h.id)){let c=Array.from(N),v=c.slice(c.indexOf(h.id)+1);for(let g of v)f.add(g);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(l.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of h.nextSegments)k+=m(c,N)}return w.set(h.id,k),k}function b(h){let{cache:x}=b,w=x.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(x.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=b(k);N<w&&(w=N)}w+=1}return x.set(h.id,w),w}y.cache=new Map,m.cache=new Map,b.cache=new Map;let C=m(l.initialSegment),T=Ri(d),I=Vn(d),A=T?Ii(T)||jt(T):wi(d)||Fi(d),S=1/0;for(let h of l.finalSegments){if(!h.reachable)continue;let x=b(h);x<S&&(S=x)}for(let[h,x]of u){if(!h.reachable)continue;let w=h.nextSegments.length===0?S<=b(h):S<b(h),k=y(h)*m(h),N=f.has(h.id);for(let c of x)if(N&&!Wn(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(d.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!Wn(c)){let g=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:g})}}else if(d.parent&&(d.parent.type==="MethodDefinition"||d.parent.type==="ClassProperty")&&d.parent.value===d){let v=`React Hook "${r(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(T){let v=`React Hook "${r(c)}" is called in function "${r(T)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(d.type==="Program"){let v=`React Hook "${r(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(I&&!Wn(c)){if(d.parent.type==="CallExpression"&&d.parent.callee.type==="Identifier"&&d.parent.callee.name==="useCallback"){let g=d.parent;if(g.parent.type==="VariableDeclarator"&&Ci(g.parent.id.name))return}let v=`React Hook "${r(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}}},CallExpression(l){if(jt(l.callee)){let d=xi(s),u=xi(i),f=d.get(u);f||(f=[],d.set(u,f)),f.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Ei(l.callee))&&l.arguments.length>0&&(o=l)},Identifier(l){o==null&&a.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${r(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===o&&(o=null)},FunctionDeclaration(l){Vn(l)&&p(n(l))},ArrowFunctionExpression(l){Vn(l)&&p(n(l))}}}};function Ri(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 xi(e){return e[e.length-1]}var Te=require("@typescript-eslint/utils"),Ce=Ne(require("zod/v4"));var il=/^\s+$/,Jn=/\r?\n/,ol=/^(\s*)/,sl=/^(\s*)\S/,al=/\r?\n/,ll=Ce.object({indent:Ce.union([Ce.string().regex(il),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),Xn=U({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(ll)],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:s}=e.options[0],i=r.map(T=>T.toLowerCase());function a(T){let I=T.split(Jn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return T;let S=Number.POSITIVE_INFINITY;for(let h of A){let x=h.match(ol);x&&(S=Math.min(S,x[1]?.length??0))}return!isFinite(S)||S===0?T:I.map(h=>h.slice(S)).join(`
|
|
36
|
+
`)}function p(T,I,A){return T.split(Jn).map(h=>h.trim()===""?h:A.repeat(I)+h).join(`
|
|
37
|
+
`)}function l(T){if(T.type===Te.AST_NODE_TYPES.Identifier)return T.name;if(T.type===Te.AST_NODE_TYPES.MemberExpression){let I=T.object.type===Te.AST_NODE_TYPES.Identifier?T.object.name:null,A=T.property.type===Te.AST_NODE_TYPES.Identifier?T.property.name:null;return I&&A?`${I}.${A}`:A}return null}function d(T,I){if(!T)return!1;for(let A of I)if(A.includes(".")){let S=A.split(".");if(T.type===Te.AST_NODE_TYPES.MemberExpression&&T.object.type===Te.AST_NODE_TYPES.Identifier&&T.property.type===Te.AST_NODE_TYPES.Identifier&&T.object.name===S[0]&&T.property.name===S[1])return!0}else if(T.type===Te.AST_NODE_TYPES.Identifier&&T.name===A)return!0;return!1}function u(T,I){let A=T.parent;if(A.type!==Te.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let S=l(A.tag);return S?I.includes(S):!1}function f(T,I){if(!T||T.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:S,optionalCall:h=!0,optionalMember:x=!0}=I;return S!==void 0&&T.arguments.length!==S||!h&&T.optional||T.callee.type!==Te.AST_NODE_TYPES.MemberExpression||!x&&T.callee.optional||T.callee.property.type!==Te.AST_NODE_TYPES.Identifier?!1:T.callee.property.name===A}function y(T,I){if(!T||T.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:S,optionalCall:h=!0}=I;return S!==void 0&&T.arguments.length!==S||!h&&T.optional||T.callee.type!==Te.AST_NODE_TYPES.Identifier?!1:T.callee.name===A}function m(T){return f(T.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&T.parent.type===Te.AST_NODE_TYPES.CallExpression&&T.parent.arguments[0]===T&&y(T.parent.callee.type===Te.AST_NODE_TYPES.MemberExpression?T.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function b(T){if(i.length>0){let I=t.getTokenBefore(T,{includeComments:!0});if(I?.type===Te.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(T)||o.length>0&&u(T,o)||n.length>0&&T.parent.type===Te.AST_NODE_TYPES.CallExpression&&T.parent.arguments.includes(T)&&d(T.parent.callee,n))}function C(T){let I=`__PLACEHOLDER__${Math.random()}`,A=T.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),S=A.match(al);if(!S)return;let h=S[0],x=t.lines[t.getLocFromIndex(T.range[0]).line-1];if(!x)return;let k=x.match(sl)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let v=a(A).replace(new RegExp(`^${h}|${h}[ ]*$`,"g"),""),g=h+p(v,1,k+N)+h+k,E=A.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,F=A.split(
|
|
40
|
+
`,F=A.split(Jn),P=F.map((L,X)=>X!==F.length-1&&L===N+k?"":L).join(E);if(g!==P)return{node:T,messageId:"improperlyIndented",fix:L=>g.split(I).map((X,G)=>{let q=T.quasis[G];return q?L.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(T){if(!b(T))return;let I=C(T);if(I)return e.report(I)}}}});var Bn=require("@typescript-eslint/utils");function pl(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function cl(e){let t=e.parent;return t?.type===Bn.AST_NODE_TYPES.NewExpression&&t.callee.type===Bn.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Hn=U({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){pl(r)||cl(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var he=require("@typescript-eslint/utils"),ut=require("zod/v4");var ul=ut.z.object({checkOnly:ut.z.array(ut.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:ut.z.array(ut.z.string()).optional()}),Yn=U({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:[$(ul)],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 s(m){for(let b of o)if(m.range[0]>=b.range[0]&&m.range[1]<=b.range[1])return b;return null}function i(m){let b=m.parent;for(;b;){if(b.type===he.AST_NODE_TYPES.FunctionDeclaration||b.type===he.AST_NODE_TYPES.FunctionExpression||b.type===he.AST_NODE_TYPES.ArrowFunctionExpression){let C=b.params;for(let T of C)if(m.range[0]>=T.range[0]&&m.range[1]<=T.range[1])return!0;break}b=b.parent}return!1}function a(m){let b=m.parent;for(;b;){if(b.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=b.parent;if(C.type===he.AST_NODE_TYPES.TSTypeReference&&C.typeName.type===he.AST_NODE_TYPES.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===he.AST_NODE_TYPES.TSTypeReference&&C.typeName.type===he.AST_NODE_TYPES.TSQualifiedName&&C.typeName.right.name==="FC")return!0}b=b.parent}return!1}function p(m){let b=m.parent;for(;b;){if(b.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=b.parent;if(C.type===he.AST_NODE_TYPES.CallExpression||C.type===he.AST_NODE_TYPES.NewExpression)return!0}b=b.parent}return!1}function l(m){let b=m.parent;for(;b;){if(b.type===he.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===he.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;b=b.parent}return!1}function d(m){return m.parent.type===he.AST_NODE_TYPES.TSIndexedAccessType&&m.parent.objectType===m}let u=[];function f(m){let b=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let S=C.get(A)||[];S.push(I),C.set(A,S)}for(let{typeName:I,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:h}of m){let x=n.get(I);if(!x||x.statement===A)continue;let w=o.indexOf(x.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let N=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&h),v=(C.get(A)||[]).length>1;(N||v?w>k:w>k||w!==k-1)&&b.push({typeName:I,typeDef:x,targetStatement:A,firstUsagePosition:S})}if(b.length===0)return;b.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let h=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return h-x});let T=b[0];T&&e.report({node:T.typeDef.node,messageId:"moveTypeAboveUsage",fix:y(b)})}function y(m){return function*(b){let C=new Map;for(let T of m){let I=C.get(T.targetStatement)||[];I.push(T),C.set(T.targetStatement,I)}for(let[,T]of C)T.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let h=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return h-x});for(let T of m){let{typeDef:I}=T,A=I.statement,S=r.getCommentsBefore(A),h=A.range[0],x=A.range[1];S.length>0&&S[0]&&(h=S[0].range[0]),yield b.removeRange([h,x])}for(let[T,I]of C){let A=r.getCommentsBefore(T),S=A.length>0&&A[0]?A[0].range[0]:T.range[0],h=[];for(let x of I){let w=x.typeDef.statement,k=r.getText(w),N=r.getCommentsBefore(w),c=k;N.length>0&&(c=`${N.map(g=>r.getText(g)).join(`
|
|
41
41
|
`)}
|
|
42
|
-
${k}`),
|
|
42
|
+
${k}`),h.push(c)}yield b.insertTextBeforeRange([S,S],`${h.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.AST_NODE_TYPES.Identifier){if(u(m))return;let h=i(m),C=a(m),S=p(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:S,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of f){let{typeName:I,node:A}=S;if(!n.has(I)||!h(S))continue;let g=s(A),E=n.get(I);if(!g||!E||g===E.statement)continue;m.has(I)||m.set(I,[]);let x=m.get(I);if(!x)return;x.includes(g)||x.push(g)}let C=[];for(let[S,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let g=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<g&&(g=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S||l(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:S,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});var ie=require("@typescript-eslint/utils"),ct=Ne(require("zod/v4"));var pl=["tsx"],cl=/^[A-Z][A-Za-z0-9]*$/,ul=ct.object({extensions:ct.array(ct.string()).optional()}),Hn=z({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[$(ul)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??pl,o=!1;for(let g of n)if(r.endsWith(g)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function p(g){return cl.test(g)}function l(g){if(g.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let E=g.callee;return E.type===ie.AST_NODE_TYPES.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===ie.AST_NODE_TYPES.MemberExpression&&E.property.type===ie.AST_NODE_TYPES.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function u(g){if(g.type===ie.AST_NODE_TYPES.JSXElement||g.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===ie.AST_NODE_TYPES.ArrayExpression){for(let E of g.elements)if(E&&(E.type===ie.AST_NODE_TYPES.JSXElement||E.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function f(g){if(g.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let x=E.body;if(u(x))return!0}return!1}function y(g){if(g.id.type!==ie.AST_NODE_TYPES.Identifier)return;let E=g.id.name,x=g.init;if(x){if(p(E)&&(x.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||x.type===ie.AST_NODE_TYPES.FunctionExpression||l(x))){i.add(E);return}x.type===ie.AST_NODE_TYPES.Identifier&&a.set(E,x.name),p(E)||f(x)&&i.add(E)}}function b(g){if(g.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let E of g.declarations)y(E);return}if(g.type===ie.AST_NODE_TYPES.FunctionDeclaration&&g.id){p(g.id.name)&&i.add(g.id.name);return}if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let x of E.declarations)y(x);return}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration&&E.id){p(E.id.name)&&i.add(E.id.name);return}}}for(let g of s.ast.body)b(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let x=a.get(g);return x?m(x,E):!1}let h=[];function C(g,E,x){h.push({node:g,isType:E,isComponent:x})}for(let g of s.ast.body){if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let x=g.declaration;if(x.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||x.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){C(x,!0,!1);continue}if(x.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of x.declarations){if(w.id.type!==ie.AST_NODE_TYPES.Identifier)continue;let k=w.id.name,N=m(k);C(w,E,N)}continue}if(x.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=x.id?.name,k=w?m(w)||p(w):!1;C(x,E,k);continue}C(x,E,!1);continue}if(g.specifiers.length>0)for(let x of g.specifiers){if(x.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=x.local.name,k=m(w);C(x,E,k)}continue}if(g.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.Identifier){let x=m(E.name)||p(E.name);C(g,!1,x);continue}if(E.type===ie.AST_NODE_TYPES.FunctionDeclaration||E.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||E.type===ie.AST_NODE_TYPES.FunctionExpression||E.type===ie.AST_NODE_TYPES.CallExpression){C(g,!1,!0);continue}C(g,!1,!1);continue}}let S=!1;for(let g of h)if(!g.isType&&g.isComponent){S=!0;break}if(!S)return{};let I=[];for(let g of h)g.isType||I.push(g);let A=-1;for(let[g,E]of I.entries())if(E.isComponent){A=g;break}if(A===-1)return{};for(let[g,E]of I.entries())if(g!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});var Be=require("@typescript-eslint/utils"),Dt=require("zod/v4");function jt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fl(e){return e.callee.type===Be.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Be.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Be.AST_NODE_TYPES.Identifier&&e.callee.property.type===Be.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var ml=Dt.z.object({ignorePrefixes:Dt.z.array(Dt.z.string()).optional()});function Fi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function yl(e){return`set${jt(e)}`}var Yn=z({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[$(ml)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.AST_NODE_TYPES.CallExpression||!fl(r.init)||r.id.type!==Be.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.AST_NODE_TYPES.Identifier||o.type!==Be.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],p=Fi(s,a),l=Fi(i,a);if(p===""){if(!l.startsWith("set")){let f=`set${jt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:jt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=yl(p);l!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:jt(p),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});var Se=require("@typescript-eslint/utils"),nt=require("zod/v4");var dl=nt.z.object({name:nt.z.string(),defaults:nt.z.array(nt.z.unknown())}),gl=nt.z.object({functions:nt.z.array(dl)});function Lt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,s)=>Lt(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,p=i.value;if(!Lt(a,p))return!1}return!0}function Sl(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&Lt(o.value,s.value)&&r.add(n)}return r}function vi(e){if(e.type===Se.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.AST_NODE_TYPES.Literal:return e.value;case Se.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.AST_NODE_TYPES.Property&&r.key.type===Se.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===Se.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===Se.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=vi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.AST_NODE_TYPES.SpreadElement))return t.type===Se.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Tl(e){return e.type===Se.AST_NODE_TYPES.Identifier?e.name:e.type===Se.AST_NODE_TYPES.MemberExpression&&e.property.type===Se.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var qn=z({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[$(gl)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let o=Tl(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,p=!1,l=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let h=s[m],C=i[m];if(!C||C.type===Se.AST_NODE_TYPES.SpreadElement){a=m;continue}let S=vi(C);if(h===void 0){a=m;continue}if(Lt(S,h)){C.type===Se.AST_NODE_TYPES.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,S),y.push({type:"simple",position:m+1,value:S}));continue}if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===0&&typeof h=="object"&&h!==null&&Object.keys(h).length>0){u.add(m),y.push({type:"object",position:m+1});continue}let I=Sl(S,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){u.add(m),y.push({type:"object",position:m+1});continue}else p=!0,l.set(m,I),y.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),a=m}else a=m}if(a<i.length-1||p||u.size>0){let m=function(){let C=[];for(let S of y)if(S.type==="simple")C.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")C.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=s?s[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let g=A;for(let E of I)if(E in g){let x=Object.getOwnPropertyDescriptor(g,E);x&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(x.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var b=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let S=[];if(p)for(let[A,g]of l){let E=i[A];if(E&&E.type===Se.AST_NODE_TYPES.ObjectExpression){let x=[];for(let k of E.properties)k.type===Se.AST_NODE_TYPES.Property&&k.key.type===Se.AST_NODE_TYPES.Identifier&&!k.computed&&g.has(k.key.name)||x.push(k);let w=x.map(k=>e.sourceCode.getText(k));S.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),g=e.sourceCode.getLastToken(n);A&&g&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}else{let A=i[I],g=e.sourceCode.getLastToken(n);g&&A&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}return S.length>0?S:null}})}}}}});var Re=require("@typescript-eslint/utils");function El(e){let t=e.parent;for(;t;){if(t.type===Re.AST_NODE_TYPES.AwaitExpression||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===Re.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===Re.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===Re.AST_NODE_TYPES.ArrayExpression&&t.parent.type===Re.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===Re.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Re.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Re.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function hl(e){let{callee:t}=e;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object.type===Re.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Zn=z({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){El(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){hl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var M=require("@typescript-eslint/utils"),Mt=require("zod/v4");var bl=Mt.z.object({mainComponentRegex:Mt.z.string().optional(),mainComponentSelector:Mt.z.string().optional()}),xl=/^[A-Z][A-Za-z0-9]*$/,Gn=z({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[$(bl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,p=[],l=[],u=new Set;function f(d){let T=d.node;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)if(F.id.type===M.AST_NODE_TYPES.Identifier&&F.id.name===d.name&&F.init)return F.init}if(T.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let F=T.declaration;if(F&&F.type===M.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.AST_NODE_TYPES.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let T=new Set;return Me(d,F=>(F.type===M.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&T.add(F.name),!1),r),T}function b(d){return xl.test(d)}function m(d){if(d.type!==M.AST_NODE_TYPES.CallExpression)return!1;let T=d.callee;return T.type===M.AST_NODE_TYPES.Identifier?T.name==="memo"||T.name==="forwardRef":T.type===M.AST_NODE_TYPES.MemberExpression&&T.property.type===M.AST_NODE_TYPES.Identifier?T.property.name==="memo"||T.property.name==="forwardRef":!1}function h(d){if(d.type===M.AST_NODE_TYPES.JSXElement||d.type===M.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===M.AST_NODE_TYPES.BlockStatement){for(let T of d.body)if(T.type===M.AST_NODE_TYPES.ReturnStatement&&T.argument)return h(T.argument)}if(d.type===M.AST_NODE_TYPES.ArrayExpression){for(let T of d.elements)if(T&&(T.type===M.AST_NODE_TYPES.JSXElement||T.type===M.AST_NODE_TYPES.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let T=d.body;if(T.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let F=T.body;if(h(F))return!0}return!1}function S(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.MemberExpression&&T.object.type===M.AST_NODE_TYPES.Identifier&&T.object.name==="styled")return!0;if(T.type===M.AST_NODE_TYPES.CallExpression){let F=T.callee;if(F.type===M.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let T=d.tag;if(T.type===M.AST_NODE_TYPES.Identifier&&T.name==="css")return!0}return!1}function A(d,T){if(d.id.type!==M.AST_NODE_TYPES.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){l.push({node:T,name:F});return}if((b(F)||P.type===M.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression||m(P))){if(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression){if(h(P.body)){i.add(F);return}}else if(m(P)){i.add(F);return}}P.type===M.AST_NODE_TYPES.Identifier&&a.set(F,P.name),b(F)||C(P)&&i.add(F)}}function g(d){return d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration||d.type===M.AST_NODE_TYPES.ExportNamedDeclaration}function E(d){if(d.type===M.AST_NODE_TYPES.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===M.AST_NODE_TYPES.VariableDeclaration){let T=d.declarations[0];if(T&&T.id.type===M.AST_NODE_TYPES.Identifier)return T.id.name}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:"default";if(T.type===M.AST_NODE_TYPES.Identifier)return T.name}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let T=d.declaration;if(T&&T.type===M.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:null;if(T&&T.type===M.AST_NODE_TYPES.VariableDeclaration){let F=T.declarations[0];if(F&&F.id.type===M.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function x(d,T){return o?u.has(d):n?n.test(T):g(d)}function w(d){let T=new Set;Me(d.node,F=>{if(F.type===M.AST_NODE_TYPES.Identifier)for(let P of l)P.name===F.name&&(T.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===M.AST_NODE_TYPES.JSXIdentifier)for(let L of l)L.name===P.name.name&&(T.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=T}function k(d){if(d.type===M.AST_NODE_TYPES.VariableDeclaration){for(let T of d.declarations)A(T,d);return}if(d.type===M.AST_NODE_TYPES.FunctionDeclaration){b(d.id.name)&&h(d.body)&&i.add(d.id.name);return}if(d.type===M.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let T=d.declaration;if(T.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of T.declarations)A(F,d);return}if(T.type===M.AST_NODE_TYPES.FunctionDeclaration&&T.id){b(T.id.name)&&h(T.body)&&i.add(T.id.name);return}}if(d.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let T=d.declaration;T.type===M.AST_NODE_TYPES.Identifier&&i.add(T.name),(T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ArrowFunctionExpression||T.type===M.AST_NODE_TYPES.FunctionExpression)&&(T.type===M.AST_NODE_TYPES.FunctionDeclaration?T.id?i.add(T.id.name):i.add("default"):h(T.body)&&i.add("default"))}}function N(d,T=new Set){if(i.has(d))return!0;if(T.has(d))return!1;T.add(d);let F=a.get(d);return F?N(F,T):!1}let c={};return o&&(c[o]=d=>{let T=d;for(;T.parent&&T.parent.type!==M.AST_NODE_TYPES.Program;)T=T.parent;T.parent&&(T.type===M.AST_NODE_TYPES.VariableDeclaration||T.type===M.AST_NODE_TYPES.FunctionDeclaration||T.type===M.AST_NODE_TYPES.ExportNamedDeclaration||T.type===M.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(T)}),c["Program:exit"]=d=>{let T=0;for(let D of d.body){if(D.type===M.AST_NODE_TYPES.ImportDeclaration){T+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&N(Z)){let B=x(D,Z);p.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:g(D)})}}if(!o&&n&&!p.some(D=>D.isMainComponent))for(let D of p)D.isExported&&(D.isMainComponent=!0);for(let D of p)w(D);let F=new Set;for(let D of l)F.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let B of l)B.node===Z&&P.set(B.name,D)}let L=new Map;for(let D of l){let Z=f(D),B=new Set;if(Z){let ue=y(Z);for(let ye of ue)F.has(ye)&&ye!==D.name&&B.add(ye)}L.set(D.name,B)}let X=new Map;for(let D of l){let Z=L.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let ue of Z){let ye=X.get(ue);(ye===void 0||B<ye)&&X.set(ue,B)}}let G=[];for(let D of l){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),B=-1;for(let xe of p){if(!xe.usedStyles.has(D.name))continue;let Ae=d.body.indexOf(xe.node);(B===-1||Ae<B)&&(B=Ae)}let ue=X.get(D.name);if(ue!==void 0&&(B===-1||ue<B)&&(B=ue),B===-1)continue;let ye=-1;for(let xe of p){let Ae=d.body.indexOf(xe.node);Ae<B&&Ae>ye&&(ye=Ae)}let Pe=Z<B,He=Z>ye,Ee=-1,mt=L.get(D.name);if(mt)for(let xe of mt){let Ae=P.get(xe);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let rt=Z>Ee;if(!(Pe&&He&&rt)){let xe=ye+1;if(Ee+1>xe&&(xe=Ee+1),xe<T&&(xe=T),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(p.length>1){let D=p.map(B=>({c:B,idx:d.body.indexOf(B.node)})).sort((B,ue)=>B.idx-ue.idx)[0]?.c,Z=p.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,d.body)})}},c;function v(d,T,F){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let L=new Map;for(let X of d){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:ue}of G){let ye=r.getCommentsBefore(ue.node),Pe=r.getText(ue.node);ye.length>0&&(Pe=`${ye.map(Ee=>r.getText(Ee)).join(`
|
|
46
|
+
`)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.AST_NODE_TYPES.Identifier){if(d(m))return;let b=i(m),C=a(m),T=p(m);u.push({typeName:m.typeName.name,node:m,inFunctionArgs:b,inFCProps:C,inGenericArgAtFunctionCall:T,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function b(T){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&T.inFunctionArgs||I==="FC"&&T.inFCProps||I==="generic-args-at-fn-calls"&&T.inGenericArgAtFunctionCall)return!0;return!1}for(let T of u){let{typeName:I,node:A}=T;if(!n.has(I)||!b(T))continue;let S=s(A),h=n.get(I);if(!S||!h||S===h.statement)continue;m.has(I)||m.set(I,[]);let x=m.get(I);if(!x)return;x.includes(S)||x.push(S)}let C=[];for(let[T,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let S=Number.MAX_SAFE_INTEGER,h=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of u)b(w)&&w.typeName===T&&s(w.node)===A&&w.usagePosition<S&&(S=w.usagePosition,h=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of u){if(N.typeName!==T)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of u){if(N.typeName!==T||l(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:T,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:h})}C.length>0&&f(C)}}}});var ie=require("@typescript-eslint/utils"),ft=Ne(require("zod/v4"));var fl=["tsx"],ml=/^[A-Z][A-Za-z0-9]*$/,dl=ft.object({extensions:ft.array(ft.string()).optional()}),qn=U({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[$(dl)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??fl,o=!1;for(let S of n)if(r.endsWith(S)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function p(S){return ml.test(S)}function l(S){if(S.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let h=S.callee;return h.type===ie.AST_NODE_TYPES.Identifier?h.name==="memo"||h.name==="forwardRef":h.type===ie.AST_NODE_TYPES.MemberExpression&&h.property.type===ie.AST_NODE_TYPES.Identifier?h.property.name==="memo"||h.property.name==="forwardRef":!1}function d(S){if(S.type===ie.AST_NODE_TYPES.JSXElement||S.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(S.type===ie.AST_NODE_TYPES.ArrayExpression){for(let h of S.elements)if(h&&(h.type===ie.AST_NODE_TYPES.JSXElement||h.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function u(S){if(S.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let h=S.body;if(h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let x=h.body;if(d(x))return!0}return!1}function f(S){if(S.id.type!==ie.AST_NODE_TYPES.Identifier)return;let h=S.id.name,x=S.init;if(x){if(p(h)&&(x.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||x.type===ie.AST_NODE_TYPES.FunctionExpression||l(x))){i.add(h);return}x.type===ie.AST_NODE_TYPES.Identifier&&a.set(h,x.name),p(h)||u(x)&&i.add(h)}}function y(S){if(S.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let h of S.declarations)f(h);return}if(S.type===ie.AST_NODE_TYPES.FunctionDeclaration&&S.id){p(S.id.name)&&i.add(S.id.name);return}if(S.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&S.declaration){let h=S.declaration;if(h.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let x of h.declarations)f(x);return}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration&&h.id){p(h.id.name)&&i.add(h.id.name);return}}}for(let S of s.ast.body)y(S);function m(S,h=new Set){if(i.has(S))return!0;if(h.has(S))return!1;h.add(S);let x=a.get(S);return x?m(x,h):!1}let b=[];function C(S,h,x){b.push({node:S,isType:h,isComponent:x})}for(let S of s.ast.body){if(S.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let h=S.exportKind==="type";if(S.declaration){let x=S.declaration;if(x.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||x.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){C(x,!0,!1);continue}if(x.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of x.declarations){if(w.id.type!==ie.AST_NODE_TYPES.Identifier)continue;let k=w.id.name,N=m(k);C(w,h,N)}continue}if(x.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=x.id?.name,k=w?m(w)||p(w):!1;C(x,h,k);continue}C(x,h,!1);continue}if(S.specifiers.length>0)for(let x of S.specifiers){if(x.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=x.local.name,k=m(w);C(x,h,k)}continue}if(S.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let h=S.declaration;if(h.type===ie.AST_NODE_TYPES.Identifier){let x=m(h.name)||p(h.name);C(S,!1,x);continue}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration||h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||h.type===ie.AST_NODE_TYPES.FunctionExpression||h.type===ie.AST_NODE_TYPES.CallExpression){C(S,!1,!0);continue}C(S,!1,!1);continue}}let T=!1;for(let S of b)if(!S.isType&&S.isComponent){T=!0;break}if(!T)return{};let I=[];for(let S of b)S.isType||I.push(S);let A=-1;for(let[S,h]of I.entries())if(h.isComponent){A=S;break}if(A===-1)return{};for(let[S,h]of I.entries())if(S!==A){e.report({node:h.node,messageId:"multipleExports"});break}return{}}});var Be=require("@typescript-eslint/utils"),Lt=require("zod/v4");function Mt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yl(e){return e.callee.type===Be.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Be.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Be.AST_NODE_TYPES.Identifier&&e.callee.property.type===Be.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var gl=Lt.z.object({ignorePrefixes:Lt.z.array(Lt.z.string()).optional()});function ki(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Sl(e){return`set${Mt(e)}`}var Zn=U({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[$(gl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.AST_NODE_TYPES.CallExpression||!yl(r.init)||r.id.type!==Be.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.AST_NODE_TYPES.Identifier||o.type!==Be.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],p=ki(s,a),l=ki(i,a);if(p===""){if(!l.startsWith("set")){let u=`set${Mt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Mt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}return}let d=Sl(p);l!==d&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Mt(p),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:u=>u.replaceText(o,d)}]})}}}});var Se=require("@typescript-eslint/utils"),it=require("zod/v4");var Tl=it.z.object({name:it.z.string(),defaults:it.z.array(it.z.unknown())}),El=it.z.object({functions:it.z.array(Tl)});function _t(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,s)=>_t(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,p=i.value;if(!_t(a,p))return!1}return!0}function hl(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&_t(o.value,s.value)&&r.add(n)}return r}function Pi(e){if(e.type===Se.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.AST_NODE_TYPES.Literal:return e.value;case Se.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.AST_NODE_TYPES.Property&&r.key.type===Se.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===Se.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===Se.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=Pi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.AST_NODE_TYPES.SpreadElement))return t.type===Se.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function bl(e){return e.type===Se.AST_NODE_TYPES.Identifier?e.name:e.type===Se.AST_NODE_TYPES.MemberExpression&&e.property.type===Se.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Gn=U({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[$(El)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let o=bl(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,p=!1,l=new Map,d=new Set,u=new Map,f=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let b=s[m],C=i[m];if(!C||C.type===Se.AST_NODE_TYPES.SpreadElement){a=m;continue}let T=Pi(C);if(b===void 0){a=m;continue}if(_t(T,b)){C.type===Se.AST_NODE_TYPES.ObjectExpression?(d.add(m),f.push({type:"object",position:m+1})):(u.set(m,T),f.push({type:"simple",position:m+1,value:T}));continue}if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===0&&typeof b=="object"&&b!==null&&Object.keys(b).length>0){d.add(m),f.push({type:"object",position:m+1});continue}let I=hl(T,b);if(I.size>0){let A=typeof b=="object"&&b!==null?Object.keys(b).length:0;if(C.type===Se.AST_NODE_TYPES.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){d.add(m),f.push({type:"object",position:m+1});continue}else p=!0,l.set(m,I),f.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),a=m}else a=m}if(a<i.length-1||p||d.size>0){let m=function(){let C=[];for(let T of f)if(T.type==="simple")C.push(`Param ${T.position} with value ${JSON.stringify(T.value)}`);else if(T.type==="object")C.push(`Param ${T.position} (object)`);else{let I=T.redundantProperties||[],A=s?s[T.position-1]:void 0;if(typeof A=="object"&&A!==null){let S=A;for(let h of I)if(h in S){let x=Object.getOwnPropertyDescriptor(S,h);x&&C.push(`Param ${T.position} property "${h}" with value ${JSON.stringify(x.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var y=m;let b=m();e.report({node:n,messageId:b.messageId,data:b.data,fix(C){let T=[];if(p)for(let[A,S]of l){let h=i[A];if(h&&h.type===Se.AST_NODE_TYPES.ObjectExpression){let x=[];for(let k of h.properties)k.type===Se.AST_NODE_TYPES.Property&&k.key.type===Se.AST_NODE_TYPES.Identifier&&!k.computed&&S.has(k.key.name)||x.push(k);let w=x.map(k=>e.sourceCode.getText(k));T.push(C.replaceText(h,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!d.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),S=e.sourceCode.getLastToken(n);A&&S&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}else{let A=i[I],S=e.sourceCode.getLastToken(n);S&&A&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}return T.length>0?T:null}})}}}}});var Re=require("@typescript-eslint/utils");function xl(e){let t=e.parent;for(;t;){if(t.type===Re.AST_NODE_TYPES.AwaitExpression||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===Re.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===Re.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===Re.AST_NODE_TYPES.ArrayExpression&&t.parent.type===Re.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===Re.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Re.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Re.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function Cl(e){let{callee:t}=e;return t.type===Re.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===Re.AST_NODE_TYPES.MemberExpression&&t.object.type===Re.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Kn=U({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){xl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){Cl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var M=require("@typescript-eslint/utils"),$t=require("zod/v4");var Il=$t.z.object({mainComponentRegex:$t.z.string().optional(),mainComponentSelector:$t.z.string().optional()}),Al=/^[A-Z][A-Za-z0-9]*$/,Qn=U({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[$(Il)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,p=[],l=[],d=new Set;function u(g){let E=g.node;if(E.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of E.declarations)if(F.id.type===M.AST_NODE_TYPES.Identifier&&F.id.name===g.name&&F.init)return F.init}if(E.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let F=E.declaration;if(F&&F.type===M.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.AST_NODE_TYPES.Identifier&&P.id.name===g.name&&P.init)return P.init}}return null}function f(g){let E=new Set;return Me(g,F=>(F.type===M.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&E.add(F.name),!1),r),E}function y(g){return Al.test(g)}function m(g){if(g.type!==M.AST_NODE_TYPES.CallExpression)return!1;let E=g.callee;return E.type===M.AST_NODE_TYPES.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===M.AST_NODE_TYPES.MemberExpression&&E.property.type===M.AST_NODE_TYPES.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function b(g){if(g.type===M.AST_NODE_TYPES.JSXElement||g.type===M.AST_NODE_TYPES.JSXFragment)return!0;if(g.type===M.AST_NODE_TYPES.BlockStatement){for(let E of g.body)if(E.type===M.AST_NODE_TYPES.ReturnStatement&&E.argument)return b(E.argument)}if(g.type===M.AST_NODE_TYPES.ArrayExpression){for(let E of g.elements)if(E&&(E.type===M.AST_NODE_TYPES.JSXElement||E.type===M.AST_NODE_TYPES.JSXFragment))return!0}return!1}function C(g){if(g.type!==M.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let F=E.body;if(b(F))return!0}return!1}function T(g){if(g.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let E=g.tag;if(E.type===M.AST_NODE_TYPES.MemberExpression&&E.object.type===M.AST_NODE_TYPES.Identifier&&E.object.name==="styled")return!0;if(E.type===M.AST_NODE_TYPES.CallExpression){let F=E.callee;if(F.type===M.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(g){if(g.type===M.AST_NODE_TYPES.TaggedTemplateExpression){let E=g.tag;if(E.type===M.AST_NODE_TYPES.Identifier&&E.name==="css")return!0}return!1}function A(g,E){if(g.id.type!==M.AST_NODE_TYPES.Identifier)return;let F=g.id.name,P=g.init;if(P){if(T(P)||I(P)){l.push({node:E,name:F});return}if((y(F)||P.type===M.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression||m(P))){if(P.type===M.AST_NODE_TYPES.ArrowFunctionExpression||P.type===M.AST_NODE_TYPES.FunctionExpression){if(b(P.body)){i.add(F);return}}else if(m(P)){i.add(F);return}}P.type===M.AST_NODE_TYPES.Identifier&&a.set(F,P.name),y(F)||C(P)&&i.add(F)}}function S(g){return g.type===M.AST_NODE_TYPES.ExportDefaultDeclaration||g.type===M.AST_NODE_TYPES.ExportNamedDeclaration}function h(g){if(g.type===M.AST_NODE_TYPES.FunctionDeclaration)return g.id?g.id.name:null;if(g.type===M.AST_NODE_TYPES.VariableDeclaration){let E=g.declarations[0];if(E&&E.id.type===M.AST_NODE_TYPES.Identifier)return E.id.name}if(g.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;if(E.type===M.AST_NODE_TYPES.FunctionDeclaration)return E.id?E.id.name:"default";if(E.type===M.AST_NODE_TYPES.Identifier)return E.name}if(g.type===M.AST_NODE_TYPES.ExportNamedDeclaration){let E=g.declaration;if(E&&E.type===M.AST_NODE_TYPES.FunctionDeclaration)return E.id?E.id.name:null;if(E&&E.type===M.AST_NODE_TYPES.VariableDeclaration){let F=E.declarations[0];if(F&&F.id.type===M.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function x(g,E){return o?d.has(g):n?n.test(E):S(g)}function w(g){let E=new Set;Me(g.node,F=>{if(F.type===M.AST_NODE_TYPES.Identifier)for(let P of l)P.name===F.name&&(E.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===M.AST_NODE_TYPES.JSXIdentifier)for(let L of l)L.name===P.name.name&&(E.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},r),g.usedStyles=E}function k(g){if(g.type===M.AST_NODE_TYPES.VariableDeclaration){for(let E of g.declarations)A(E,g);return}if(g.type===M.AST_NODE_TYPES.FunctionDeclaration){y(g.id.name)&&b(g.body)&&i.add(g.id.name);return}if(g.type===M.AST_NODE_TYPES.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===M.AST_NODE_TYPES.VariableDeclaration){for(let F of E.declarations)A(F,g);return}if(E.type===M.AST_NODE_TYPES.FunctionDeclaration&&E.id){y(E.id.name)&&b(E.body)&&i.add(E.id.name);return}}if(g.type===M.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;E.type===M.AST_NODE_TYPES.Identifier&&i.add(E.name),(E.type===M.AST_NODE_TYPES.FunctionDeclaration||E.type===M.AST_NODE_TYPES.ArrowFunctionExpression||E.type===M.AST_NODE_TYPES.FunctionExpression)&&(E.type===M.AST_NODE_TYPES.FunctionDeclaration?E.id?i.add(E.id.name):i.add("default"):b(E.body)&&i.add("default"))}}function N(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let F=a.get(g);return F?N(F,E):!1}let c={};return o&&(c[o]=g=>{let E=g;for(;E.parent&&E.parent.type!==M.AST_NODE_TYPES.Program;)E=E.parent;E.parent&&(E.type===M.AST_NODE_TYPES.VariableDeclaration||E.type===M.AST_NODE_TYPES.FunctionDeclaration||E.type===M.AST_NODE_TYPES.ExportNamedDeclaration||E.type===M.AST_NODE_TYPES.ExportDefaultDeclaration)&&d.add(E)}),c["Program:exit"]=g=>{let E=0;for(let D of g.body){if(D.type===M.AST_NODE_TYPES.ImportDeclaration){E+=1;continue}break}for(let D of g.body)k(D);for(let D of g.body){let Z=h(D);if(Z&&N(Z)){let B=x(D,Z);p.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:S(D)})}}if(!o&&n&&!p.some(D=>D.isMainComponent))for(let D of p)D.isExported&&(D.isMainComponent=!0);for(let D of p)w(D);let F=new Set;for(let D of l)F.add(D.name);let P=new Map;for(let D=0;D<g.body.length;D+=1){let Z=g.body[D];for(let B of l)B.node===Z&&P.set(B.name,D)}let L=new Map;for(let D of l){let Z=u(D),B=new Set;if(Z){let ue=f(Z);for(let de of ue)F.has(de)&&de!==D.name&&B.add(de)}L.set(D.name,B)}let X=new Map;for(let D of l){let Z=L.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let ue of Z){let de=X.get(ue);(de===void 0||B<de)&&X.set(ue,B)}}let G=[];for(let D of l){if(D.firstUsagePosition===void 0)continue;let Z=g.body.indexOf(D.node),B=-1;for(let xe of p){if(!xe.usedStyles.has(D.name))continue;let Ae=g.body.indexOf(xe.node);(B===-1||Ae<B)&&(B=Ae)}let ue=X.get(D.name);if(ue!==void 0&&(B===-1||ue<B)&&(B=ue),B===-1)continue;let de=-1;for(let xe of p){let Ae=g.body.indexOf(xe.node);Ae<B&&Ae>de&&(de=Ae)}let Pe=Z<B,He=Z>de,Ee=-1,yt=L.get(D.name);if(yt)for(let xe of yt){let Ae=P.get(xe);Ae!==void 0&&Ae>Ee&&(Ee=Ae)}let ot=Z>Ee;if(!(Pe&&He&&ot)){let xe=de+1;if(Ee+1>xe&&(xe=Ee+1),xe<E&&(xe=E),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(p.length>1){let D=p.map(B=>({c:B,idx:g.body.indexOf(B.node)})).sort((B,ue)=>B.idx-ue.idx)[0]?.c,Z=p.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||g,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,g.body)})}},c;function v(g,E,F){return function*(P){g.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of g){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let L=new Map;for(let X of g){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:ue}of G){let de=r.getCommentsBefore(ue.node),Pe=r.getText(ue.node);de.length>0&&(Pe=`${de.map(Ee=>r.getText(Ee)).join(`
|
|
47
47
|
`)}
|
|
48
48
|
${Pe}`),B.push(Pe)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
|
|
49
49
|
|
|
50
50
|
`)}
|
|
51
51
|
|
|
52
|
-
`)}if(
|
|
52
|
+
`)}if(E){let{component:X,targetBefore:G}=E,q=r.getCommentsBefore(X.node),D=X.node.range[0],Z=X.node.range[1];q.length>0&&q[0]&&(D=q[0].range[0]),D===X.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let B=r.getCommentsBefore(G),ue=B.length>0&&B[0]?B[0].range[0]:G.range[0],de=(()=>{let Pe=r.getText(X.node);return q.length>0&&(Pe=`${q.map(Ee=>r.getText(Ee)).join(`
|
|
53
53
|
`)}
|
|
54
|
-
${Pe}`),Pe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${
|
|
55
|
-
`)}}}}});var
|
|
54
|
+
${Pe}`),Pe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${de}
|
|
55
|
+
`)}}}}});var Ut=require("@typescript-eslint/utils"),er=Ne(require("typescript")),Ni=require("zod/v4");var wl=Ni.z.object({}),tr=U({name:"no-unnecessary-void-on-promise",meta:{type:"suggestion",docs:{description:"Disallow void operator on non-Promise function calls to avoid unnecessary void keywords added by no-floating-promises"},messages:{unnecessaryVoid:"Unnecessary void operator on non-Promise function call",removeVoid:"Remove void operator"},hasSuggestions:!0,schema:[$(wl)]},defaultOptions:[{}],create(e){let t=Ut.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o,s){if(o.flags&er.default.TypeFlags.Any||o.flags&er.default.TypeFlags.Unknown)return!1;let i=o.getProperty("then");return i?s.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==Ut.AST_NODE_TYPES.CallExpression)return;let s=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(s);if(!n(i,r)){let p=e.sourceCode.getText(o.argument);e.report({node:o,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(l){return l.replaceText(o,p)}}]})}}}}});var Ie=require("@typescript-eslint/utils"),mt=require("zod/v4");var Fl=mt.z.object({functions:mt.z.array(mt.z.string()).optional(),selectors:mt.z.array(mt.z.string()).optional()});function Oi(e){let t=e.parent;for(;t;){if(t.type===Ie.AST_NODE_TYPES.FunctionDeclaration||t.type===Ie.AST_NODE_TYPES.FunctionExpression||t.type===Ie.AST_NODE_TYPES.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Di(e){if(e.type===Ie.AST_NODE_TYPES.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ie.AST_NODE_TYPES.Identifier?r.name:r.type===Ie.AST_NODE_TYPES.MemberExpression&&r.property.type===Ie.AST_NODE_TYPES.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ie.AST_NODE_TYPES.Identifier?t.name:t.type===Ie.AST_NODE_TYPES.MemberExpression&&t.property.type===Ie.AST_NODE_TYPES.Identifier?t.property.name:null}var nr=U({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[$(Fl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(Oi(i))return;let a=Di(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(i){i.type===Ie.AST_NODE_TYPES.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ie.AST_NODE_TYPES.TaggedTemplateExpression&&o(i)}};for(let i of n)s[i]=a=>{if(a.type!==Ie.AST_NODE_TYPES.CallExpression&&a.type!==Ie.AST_NODE_TYPES.TaggedTemplateExpression||Oi(a))return;let p=Di(a);p&&e.report({node:a,messageId:"moduleLevel",data:{functionName:p}})};return s}});var ke=require("@typescript-eslint/utils");function vl(e,t){let{body:r}=e;if(r.type!==ke.AST_NODE_TYPES.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==ke.AST_NODE_TYPES.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function Rl(e){let t=e.parent;if(t.type!==ke.AST_NODE_TYPES.ReturnStatement)return null;let r=t.parent;if(r.type!==ke.AST_NODE_TYPES.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==ke.AST_NODE_TYPES.FunctionDeclaration&&n.type!==ke.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==ke.AST_NODE_TYPES.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var rr=U({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(r){let{callee:n,arguments:o}=r;if(o.length>0||n.type!==ke.AST_NODE_TYPES.FunctionExpression&&n.type!==ke.AST_NODE_TYPES.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:s}=n;if(s.type===ke.AST_NODE_TYPES.BlockStatement){if(s.body.length!==1){let l=Rl(r);if(l){if(t.getCommentsInside(n).length>0)return;let u=t.getText(s);e.report({node:r,messageId:"unnecessaryIife",fix:f=>{let{parentFunction:y}=l;return y.body.type!==ke.AST_NODE_TYPES.BlockStatement?null:f.replaceText(y.body,u)}})}return}let p=s.body[0];if(!p||p.type!==ke.AST_NODE_TYPES.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=vl(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:p=>p.replaceText(r,a)})}}}});var Ke=require("zod/v4");var kl="no-restricted-comments",Pl=Ke.z.object({regex:Ke.z.string().optional(),includes:Ke.z.string().optional(),message:Ke.z.string().optional(),autoFix:Ke.z.boolean().optional()}),Nl=Ke.z.object({patterns:Ke.z.array(Pl)}),ir=U({name:kl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[$(Nl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function o(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function s(i,a){return a.regex?o(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let p of i)for(let l of t.patterns)if(s(p.value,l)){let u=function(f){return f.remove(p)};var a=u;let d=l.regex??l.includes??"";l.message?e.report({loc:p.loc,messageId:"restrictedCommentWithMessage",data:{message:l.message},fix:l.autoFix?u:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:u}]}):e.report({loc:p.loc,messageId:"restrictedComment",data:{pattern:d},fix:l.autoFix?u:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:u}]});break}}}}});var zt=require("@typescript-eslint/utils"),dt=require("zod/v4");var Ol=dt.z.object({allow:dt.z.record(dt.z.string(),dt.z.array(dt.z.string())).optional()}),or=U({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[$(Ol)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function o(i){return i.type===zt.AST_NODE_TYPES.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===zt.AST_NODE_TYPES.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function s(i,a){let p=r[i];return p?p.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==zt.AST_NODE_TYPES.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let p=o(i.parent.name);!p||!p.isCustom||p.name&&s(p.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});var Qe=require("@typescript-eslint/utils"),et=require("zod/v4");var Dl=et.z.object({fn:et.z.string().optional(),selector:et.z.string().optional(),commentPrefix:et.z.string(),message:et.z.string().optional()}),jl=et.z.object({matches:et.z.array(Dl)}),sr=U({name:"require-usage-explanation",meta:{type:"problem",docs:{description:"Require explanatory comments with a specific prefix above matched code patterns"},schema:[$(jl)],messages:{default:"{{message}}"}},defaultOptions:[{matches:[]}],create(e,[t]){let r=e.sourceCode,n={},o=[];function s(u){let f=u;for(;f.parent;){let y=f.parent.type;if(y===Qe.AST_NODE_TYPES.Program||y===Qe.AST_NODE_TYPES.BlockStatement||y===Qe.AST_NODE_TYPES.SwitchCase)return f;f=f.parent}}function i(u,f){for(let y of u){let m=y.value.trim();if(m.startsWith(f)&&m.slice(f.length).trim().length>0)return!0}return!1}function a(u){let{callee:f}=u;if(f.type===Qe.AST_NODE_TYPES.Identifier)return f.name;if(f.type===Qe.AST_NODE_TYPES.MemberExpression&&f.property.type===Qe.AST_NODE_TYPES.Identifier)return f.property.name}function p(u,f,y){let m=`Add a comment with prefix "${u}" to explain why "${f}" is being used.`;return y?`${m} ${y}`:m}function l(u,f){let y=s(u);if(!y)return;let m=r.getCommentsBefore(y);i(m,f.commentPrefix)||e.report({node:u,messageId:"default",data:{message:p(f.commentPrefix,f.label,f.message)}})}function d(u,f){let y=n[u];y?n[u]=m=>{y(m),f(m)}:n[u]=f}for(let u of t.matches){if(u.fn){let f=u.fn,y={commentPrefix:u.commentPrefix,label:f,message:u.message};o.push(m=>{a(m)===f&&l(m,y)})}if(u.selector){let f={commentPrefix:u.commentPrefix,label:u.selector,message:u.message};d(u.selector,y=>{l(y,f)})}}return o.length>0&&d("CallExpression",u=>{if(u.type===Qe.AST_NODE_TYPES.CallExpression)for(let f of o)f(u)}),n}});var ji={[Cn.name]:Cn.rule,[nn.name]:nn.rule,[tn.name]:tn.rule,"rules-of-hooks":vi,"exhaustive-deps":Er,"require-description":Ti.rule,[rn.name]:rn.rule,[sn.name]:sn.rule,[An.name]:An.rule,[Wt.name]:Wt.rule,[en.name]:en.rule,[ln.name]:ln.rule,[Tt.name]:Tt.rule,[vn.name]:vn.rule,[an.name]:an.rule,[on.name]:on.rule,[cn.name]:cn.rule,[Xt.name]:Xt.rule,[On.name]:On.rule,[Nn.name]:Nn.rule,[Ln.name]:Ln.rule,[Un.name]:Un.rule,[Qt.name]:Qt.rule,[dn.name]:dn.rule,[yn.name]:yn.rule,[gn.name]:gn.rule,[hn.name]:hn.rule,[bn.name]:bn.rule,[Sn.name]:Sn.rule,[En.name]:En.rule,[Fn.name]:Fn.rule,[fn.name]:fn.rule,[un.name]:un.rule,[Hn.name]:Hn.rule,[In.name]:In.rule,[zn.name]:zn.rule,[Xn.name]:Xn.rule,[Yn.name]:Yn.rule,[qn.name]:qn.rule,[Zn.name]:Zn.rule,[Gn.name]:Gn.rule,[Kn.name]:Kn.rule,[Qn.name]:Qn.rule,[tr.name]:tr.rule,[nr.name]:nr.rule,[Tt.name]:Tt.rule,[rr.name]:rr.rule,[ir.name]:ir.rule,[or.name]:or.rule,[sr.name]:sr.rule};var Li={rules:ji},Ll=Li;0&&(module.exports={extendedLintPlugin});
|