@ls-stack/extended-lint 0.88.2 → 0.88.3
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 +16 -16
- package/dist/extended-lint.mjs +14 -14
- 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 $i=Object.getOwnPropertyDescriptor;var Ui=Object.getOwnPropertyNames;var zi=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var Wi=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},or=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ui(t))!Vi.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=$i(t,o))||n.enumerable});return e};var Ne=(e,t,r)=>(r=e!=null?_i(zi(e)):{},or(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Ji=e=>or(xt({},"__esModule",{value:!0}),e);var Al={};Wi(Al,{default:()=>Il,extendedLintPlugin:()=>Ni});module.exports=Ji(Al);var be=require("@typescript-eslint/utils"),_=require("zod/v4");var sr=require("@typescript-eslint/utils"),ar=Ne(require("zod/v4"));function U(e){let r=sr.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function z(e){return ar.toJSONSchema(e)}var Xi=_.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=U({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[z(Xi)],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,x=new Map;function m(b){for(let w of b.specifiers)w.type===be.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===be.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===be.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.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(b.declaration.type===be.AST_NODE_TYPES.VariableDeclaration){for(let w of b.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 b.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(b){b.id.type===be.AST_NODE_TYPES.Identifier&&b.init?.type===be.AST_NODE_TYPES.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:j}of v??[])F=F.replaceAll(P,j);return F};var E=d;let v=Bi(a,new RegExp(b));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:j})=>j).join(" or ")}`;u.add(P),p.push(j=>{let{callee:X}=j;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=j.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:j,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 j=d(T),X=d(P);y.add(`${j}:${F}:${X}`)}}}for(let{fn:b,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,b))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(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){p.push(c=>{g(k,c,w,N)});continue}r[b]=c=>{g(k,c,w,N)}}if(l.size>0)for(let[b,w]of l)A(b,w);return p.length>0&&(r.CallExpression=b=>{if(b.type===be.AST_NODE_TYPES.CallExpression)for(let w of p)w(b)}),r.ImportDeclaration=b=>{b.type===be.AST_NODE_TYPES.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===be.AST_NODE_TYPES.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===be.AST_NODE_TYPES.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(b,w,k,N){let c=v=>{if(!b)return null;if(typeof b=="string")return v.replaceText(w,b);{let d=new RegExp(b.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?c:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Bi(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:lr(o)}),r.push({name:"$0_uncapitalize",value:pr(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:lr(p)}),r.push({name:`${a}_uncapitalize`,value:pr(p)}),r.push({name:a,value:p}))}return r}function lr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pr(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Hi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="collapse-simple-objs-in-one-line",Yi=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=Hi({name:ur,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:[z(Yi)]},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 x=[];for(let m of l.properties){if(m.type===re.AST_NODE_TYPES.Property&&!Vt(m.value))return!1;x.push(r.getText(m))}return{text:x.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 x=[];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||!cr(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||!cr(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.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(`}
|
|
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
2
|
`);if(S?.loc.start.line===l.loc.end.line&&!I)return}let u=a(l);if(!u)return;let f=u.text;if(f.includes(`
|
|
3
|
-
`)||r.getCommentsInside(l).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function
|
|
3
|
+
`)||r.getCommentsInside(l).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,b=Ki(r,l),m=u.isNested&&u.propsSize>2?s:t.maxLineLength;m&&y.length+b.length+Gi(l,r)>m||e.report({node:l,messageId:"singleLineProp",fix:h=>h.replaceText(l,y)})}return{TSTypeLiteral:p,ObjectExpression:p}}});function ur(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 Vt(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&&Vt(r,!0)))}function Gi(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 Ki(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Wt={name:fr,rule:Zi};var Qi=/eslint +react-compiler\/react-compiler: +\["error/;function mr(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 yr(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 gr={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,u=new WeakSet,f=new WeakMap,y=new WeakMap,b=new WeakSet;function m(I,A){return function(g){if(A.has(g))return A.get(g);let E=I(g);return A.set(g,E),E}}function h(I,A,g,E,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,14 +12,14 @@ 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(ro(Y)&&V.type==="Identifier"){for(let ee of R.references)ee!==V&&x.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 j(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=gr(W),Y=We(J,G);if(b&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&j(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}x.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:b}),rt=Pe;if(mt.size+Ee.size+He.size===0){let R=mr(g),O=R&&fr(R);if(t&&!O)return;Qi({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}`,Di=V==="conditional"||V==="logical expression"?"could make":"makes",Li=`The '${J.name.name}' ${V} ${Di} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Ve}`,rr;Y&&J.type==="Variable"&&V==="function"&&(rr=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(ir){let[ji,Mi]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[ir.insertTextBefore(J.node.init,ji),ir.insertTextAfter(J.node.init,Mi)]}}]),a({node:J.node,message:Li,suggest:rr})});return}!b&&Ee.size>0&&(rt=Jt({dependencies:X,declaredDependencies:[],stableDependencies:B,externalDependencies:ye,isEffect:b}).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")+": "+to(Array.from(R).sort().map(Y=>"'"+Ae(Y)+"'"))+`. Either ${J} ${R.size>1?"them":"it"} or remove the dependency array.`}let je="";if(He.size>0){let R=null;if(Array.from(He.keys()).forEach(O=>{R===null&&O.endsWith(".current")&&(R=O)}),R!==null)je=` 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)||(je=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!je&&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&&(je=` 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(!je&&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&&(je=` If '${R}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!je&&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":je=` You can also replace multiple useState variables with useReducer if '${R.setter}' needs the current value of '${R.missingDep}'.`;break;case"inlineReducer":je=` 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":je=` 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"))+je,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=eo(I.callee,i);if(A===-1)return;let g=I.arguments[A],E=I.callee,b=Sr(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!g){a({node:E,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let N=mr(E);if(!(N&&fr(N)))return}if(!w&&!k){(b==="useMemo"||b==="useCallback")&&a({node:E,message:`React Hook ${b} 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,b,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,b,k);return;case"VariableDeclarator":let v=c.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":h(v,w,E,b,k);return}break}break;default:a({node:E,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}a({node:E,message:`React Hook ${b} 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(Ki.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,b=>E+"."+b)})}let y=[],x=new Set,m=new Set;return t.forEach(({key:h})=>{u.has(h)?y.indexOf(h)===-1?y.push(h):m.add(h):x.add(h)}),l.forEach(h=>{y.push(h)}),{suggestedDependencies:y,unnecessaryDependencies:x,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 Qi({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&&!Tr(t,l.identifier))return!0}return!1}return o.map(([i,a])=>({construction:i.defs[0],depType:a,isUsedOutsideOfHook:s(i)}))}function gr(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)?gr(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 Sr(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function eo(e,t){let r=Sr(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(),no(n,t))return n;if(Tr(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(yr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{yr(i)&&(i.parent=n,r.push(i))}))}return null}function to(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 yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function no(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 Tr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function ro(e){return!1}var ae=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 hr(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 Er(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function io(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=io(i,l);if(u){if(Array.isArray(u)){for(let f of u)if(Er(f)&&s(f))return!0}else if(Er(u)&&s(u))return!0}}return!1}s(e)}var oo=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="improved-no-unnecessary-condition",so=Zt.z.object({alternativeForInCondition:Zt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),xr={object:"Array",property:"isArray"},ao=["string","number","bigint","boolean","symbol","undefined","object","function","never"],lo=new Set(ao),Gt={name:br,rule:oo({name:br,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:[z(so)]},defaultOptions:[{}],create(e,[t]){let r=ae.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===ae.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 j=s(P);if(j)T.push(...j);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===ae.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,T=c.left.type===ae.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!T||!po(T,lo))return;let F=i(d);if(!F)return;let P=c.operator==="!==",j=F.includes(T);F.length===1?j&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:T}}):!j&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:ot(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):j&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:ot(d,e),actualType:Ct(F),conditionType:T}}):!j&&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),j=p(P);if(j)return j}return null}function u(c){let v=e.sourceCode.ast,d=null;return Me(v,T=>{if(T.type===ae.AST_NODE_TYPES.VariableDeclarator&&T.id.type===ae.AST_NODE_TYPES.Identifier&&T.id.name===c.name&&T.id.typeAnnotation){let F=T.id.typeAnnotation.typeAnnotation;if(F.type===ae.AST_NODE_TYPES.TSUnionType){let P=[];for(let j of F.types)if(j.type===ae.AST_NODE_TYPES.TSLiteralType&&j.literal.type===ae.AST_NODE_TYPES.Literal&&typeof j.literal.value=="string")P.push(j.literal.value);else return!0;return d=P,!0}if(F.type===ae.AST_NODE_TYPES.TSLiteralType&&F.literal.type===ae.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 x(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":x(c)?"alwaysFalse":"unknown"}function h(c){return!c.computed&&c.object.type===ae.AST_NODE_TYPES.Identifier&&c.object.name===xr.object&&c.property.type===ae.AST_NODE_TYPES.Identifier&&c.property.name===xr.property}function C(c){if(!n||c.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!h(c.callee)||c.arguments.length===0)return;let[v]=c.arguments;if(!v||v.type===ae.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!==ae.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==ae.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!==ae.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let T=c.callee.object,F=l(T);if(!F&&T.type===ae.AST_NODE_TYPES.Identifier&&(F=u(T)),!F||F.length===0)return;let P=d.value;if(v==="includes"&&F.length>1)return;let j=0,X=0;for(let G of F)if((v==="startsWith"?G.startsWith(P):v==="endsWith"?G.endsWith(P):G.includes(P))?j++:X++,j>0&&X>0)return;if(j>0&&X===0){let G=v==="startsWith"?"unnecessaryStartsWithCondition":v==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&j===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!==ae.AST_NODE_TYPES.MemberExpression||q.computed||q.property.type!==ae.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,j=null;if(T?c.right.type===ae.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(P=T.values,j=c.right.value):F&&c.left.type===ae.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(P=F.values,j=c.left.value),!P||j===null)return;let X=0,G=0;for(let q of P){let D=!1;if(c.operator==="==="?D=q===j:c.operator==="!=="?D=q!==j:c.operator===">"?D=q>j:c.operator===">="?D=q>=j:c.operator==="<"?D=q<j:c.operator==="<="&&(D=q<=j),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===ae.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 b(c){return!n||n.getIndexTypeOfType(c,H.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,H.default.IndexKind.Number)}function w(c,v){if(!n||b(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 j=k(P,v);if(j==="unknown")return"unknown";j==="required"?T=!0:j==="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===ae.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===ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function po(e,t){return t.has(e)}var yt=require("@typescript-eslint/utils"),Qe=require("zod/v4");var co=Qe.z.object({functions:Qe.z.array(Qe.z.string().or(Qe.z.object({name:Qe.z.string(),message:Qe.z.string()})))});function uo(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=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:[z(co)]},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=uo(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"),fo=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-call-with-inferred-generics",mo=fo({name:Cr,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:Cr,rule:mo};var wr=require("@typescript-eslint/utils"),yo=wr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="no-commented-out-code",go=["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:"],So=/^\s*return\s+/,To=/\w=("|'|`)/,Eo=/\w+:\s*('|"|`)/,ho=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,bo=/\w+-\w+:/,xo=/\w+_\w+:/,Co=/\?\s+\w/,Io=/:\s+\w/,Ao=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,wo=/^\s*\d+[,}]/,Fo=/^\s*\[[^\]]*\][,}]/,vo=/^\s*\{[^}]*\}[,}]/,Ro=/\.\w+\(/,ko=/\[\w+\]/,Po=/^\s*(['"`]).+?\1\s*:/,No=/^<[A-Z]\w*(\s|>|\/)/,Oo=/^<[a-z]+(\s|>|\/)/,Do=/<[A-Z]\w*(\s.*)?>/,Lo=/<\/[A-Z]\w*>/,jo=/<[a-z]+(\s.*)?>/,Mo=/<\/[a-z]+>/,_o=/^\s*[*\s]*$/,$o=/^[a-zA-Z]/,Uo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,zo=/```[\s\S]*?```/g,Vo=/`[^`]*`/g,Ir=/[a-zA-Z0-9]/,Wo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Jo=/[{}[\]()`=<>]/,Xo=/:\s*(['"`[{(]|\w+\s*=>)/,Bo=/\bif\s*\(|\belse\b|=>/,de={returnStatement:So,stringAssignment:To,objectPropertyWithQuotes:Eo,computedPropertyAssignment:ho,kebabCaseProperty:bo,snakeCaseProperty:xo,ternaryOperator:Co,colonWithWord:Io,quotedString:Ao,numberWithComma:wo,arrayWithComma:Fo,objectWithComma:vo,methodCall:Ro,arrayAccess:ko,quotedPropertyKey:Po,jsxSelfClosing:No,jsxElement:Oo,jsxOpeningTag:Do,jsxClosingTag:Lo,htmlOpeningTag:jo,htmlClosingTag:Mo,jsdocComment:_o};function Ho(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&$o.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Wo.test(t)||Jo.test(t)||Xo.test(t)||Bo.test(t)?!1:!!(t.includes(":")&&Uo.test(t))}var Yo=[") {","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],qo=["/>","</",de.jsxSelfClosing,de.jsxElement,de.jsxOpeningTag,de.jsxClosingTag,de.htmlOpeningTag,de.htmlClosingTag],Ar=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint","cspell:","spell-checker:"],Zo=yo({name:Fr,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 Ar)if(s.startsWith(i))return!1;if(n.includes("https://")||Ho(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 go)if(s.startsWith(i))return{wrongPattern:i};for(let i of Yo)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(zo);l.some(f=>Ir.test(f))&&(s=l.join(""))}if(!s.includes("`"))return s;let a=s.split(Vo);return a.some(l=>Ir.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:Ar.join(", ")}})}}}}}),en={name:Fr,rule:Zo};var It=require("@typescript-eslint/utils"),Go=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="no-default-export",Ko=Go({name:vr,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:vr,rule:Ko};var Rr=require("@typescript-eslint/utils"),Qo=Rr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kr="no-leaked-text-in-jsx",es=[",",";","[","]","(",")"],ts=Qo({name:kr,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="";es.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:kr,rule:ts};var Ze=require("@typescript-eslint/utils"),ns=Ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="no-non-camel-case-functions",rs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Pr(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 is=ns({name:Nr,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&&!rs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Ze.AST_NODE_TYPES.TSTypeReference?Pr(r):r.type===Ze.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===Ze.AST_NODE_TYPES.TSTypeReference&&Pr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),rn={name:Nr,rule:is};var se=require("@typescript-eslint/utils");var os=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="no-optional-root-props",ss=os({name:Or,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===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let p=a.parent;if(!p)return!1;if(p.type===se.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&p.parent.type===se.TSESTree.AST_NODE_TYPES.TSTypeReference&&p.parent.typeName.type===se.TSESTree.AST_NODE_TYPES.Identifier&&p.parent.typeName.name==="FC"){let u=it(p.parent.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=At(u,e.sourceCode);return f?!(f.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(a.type===se.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(p.type===se.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let l=it(p,se.TSESTree.AST_NODE_TYPES.VariableDeclaration);return l?!!At(l,e.sourceCode):!1}if(p.type===se.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!At(p,e.sourceCode)}return!1}function r(n){n.key.type!==se.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,se.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===se.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(wt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(wt(n)||!t(n)))for(let o of n.body.body)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==se.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==se.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=it(n.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=At(s,e.sourceCode);if(!(!i||i.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let p of o.members)p.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(p)}}}});function wt(e){return e?e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function At(e,t){if(wt(e))return;let r;if(e.type===se.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===se.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===se.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:Or,rule:ss};var dt=require("@typescript-eslint/utils");var gt=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===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 Dr=require("@typescript-eslint/utils"),Ft=Ne(require("path")),Je=require("zod/v4");var as=Dr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Lr="no-relative-imports",ls=Je.z.object({find:Je.z.string(),replacement:Je.z.string()}),ps=Je.z.object({aliases:Je.z.array(ls),rootDir:Je.z.string().optional(),allowNotFoundAliases:Je.z.boolean().optional(),_dev_simulateFileName:Je.z.string().optional()}),cs=as({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:[z(ps)]},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:cs};var ge=require("@typescript-eslint/utils"),an=require("zod/v4");var us=an.z.object({customMessage:an.z.string().optional()}),ln=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:[z(us)],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 fs=et.object({alternativeMsgs:et.object({inArrayFind:et.string().optional(),inArrayFilter:et.string().optional()}).optional(),__dev_simulateFileName:et.string().optional()});function ms(e){return e.typeAnnotation.type!==St.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var ys=/(typeGuards|type-guards)\.(ts|tsx)$/;function ds(e){return ys.test(e)}function gs(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=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:[z(fs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ds(r))return{};function n(o){if(!ms(o))return;let s=gs(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 Ss="no-unnecessary-async-on-jsx-props";function Ts(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=U({name:Ss,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){Ts(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 Es=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jr="no-unnecessary-casting",hs=st.default.object({additionalCastFunctions:st.default.array(st.default.object({name:st.default.string(),expectedType:st.default.enum(["string","number"])})).optional()}),fn={name:jr,rule:Es({name:jr,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:[z(hs)],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 x=y.name,m=n.find(C=>C.name===x);if(!m)return;if(i(f,m.expectedType)||a(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,S;x==="Number"?C="unnecessaryNumberCasting":x==="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 bs=vt.object({ignoreWithDescription:vt.string().optional()}),mn=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:[z(bs)]},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&&(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(`
|
|
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 x=a(l);return x?y.replaceText(f,x):null}}]})}}}});var Tt=require("@typescript-eslint/utils"),_e=Ne(require("zod/v4"));var xs=_e.object({methods:_e.union([_e.array(_e.string()),_e.literal("array")])}),yn=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:[z(xs)]},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=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=Cs(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 Cs(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 Is=gn.z.object({ignoreArgsMatching:gn.z.string().optional()}),Sn=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:[z(Is)]},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 x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.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 x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.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 x of f.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.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 x=y.identifier.parent;if(x.type===te.AST_NODE_TYPES.CallExpression&&y.identifier.type===te.AST_NODE_TYPES.Identifier&&x.arguments.includes(y.identifier)){u=!0;break}if(x.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.Property&&x.parent.type===te.AST_NODE_TYPES.ObjectExpression&&x.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let f=[];for(let y of l){let x=y.identifier.parent;if(x.type===te.AST_NODE_TYPES.CallExpression&&x.callee===y.identifier){let m=x.arguments.length,h=x.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=x.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(x.type===te.AST_NODE_TYPES.JSXOpeningElement&&x.name===y.identifier){let m=x.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 x.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 x of y.objectProps){if(!x.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[x.name]){m=!0;break}}m||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:x.name}})}else{let x=!1;for(let m of f)if(m.argCount>y.index){x=!0;break}x||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});var le=require("@typescript-eslint/utils"),Ge=require("zod/v4");var As=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()}))}),ws=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="no-unused-selected-values",Tn={name:Mr,rule:ws({name:Mr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[z(As)]},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===le.AST_NODE_TYPES.CallExpression&&(s=o.init),!s)return;let i=vs(s);if(!i)return;let a=n.get(i);if(!a)return;let p=Fs(s,a.selectorArgPos??0,a.selectorProp);if(!p)return;let l=Rs(p);if(!l)return;let u=_r(l.properties,void 0);if(!u)return;if(o.id.type===le.AST_NODE_TYPES.ObjectPattern){let x=_r(o.id.properties,a.returnProp);if(!x)return;for(let[m,h]of u)x.has(m)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==le.AST_NODE_TYPES.Identifier||a.returnProp)return;let f=ks(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let x of f){if(x.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let m=x.identifier.parent.property;if(m.type!==le.AST_NODE_TYPES.Identifier)return;y.add(m.name)}for(let[x,m]of u)y.has(x)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:x}})}}}})};function Fs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===le.AST_NODE_TYPES.ArrowFunctionExpression||n.type===le.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===le.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==le.AST_NODE_TYPES.Property)return null;let s=o.value;if(s.type===le.AST_NODE_TYPES.ArrowFunctionExpression||s.type===le.AST_NODE_TYPES.FunctionExpression)return s}return null}function vs(e){return e.callee.type===le.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===le.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===le.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Rs(e){if(e.body.type===le.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===le.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===le.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==le.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===le.AST_NODE_TYPES.Property&&s.key.type===le.AST_NODE_TYPES.Identifier&&s.key.name===t);if(o?.type!==le.AST_NODE_TYPES.Property||o.value.type!==le.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==le.AST_NODE_TYPES.Property||o.key.type!==le.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ks(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=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=Ps(s);a&&(n=a);return}let i=Ns(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 Ps(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?Os(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 Ns(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=hr(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 Os(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 Ds=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $r(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 Ur(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()}),zr="no-unused-type-props-in-args",hn=null,js=Ds({name:zr,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:[z(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,x=!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=x&&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,x);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(p,l,f,I.body,!0,x);return}}}function s(p,l,u,f,y,x=!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){Ur(u,...$r(f));return}if(f.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let m of f.types)s(p,l,u,m,!0,x);return}y||f.type===oe.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(p,l,f.typeName,u,!0,x)}function i(p,l,u,f=!1){for(let y of u)if(y.type===oe.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let x=new Map;if(s(p,l,x,y.typeAnnotation.typeAnnotation,!1,f),x.size===0)continue;a(y,x)}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=[],x=[];for(let[m,h]of l)u.includes(m)||(x.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=x.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)Ur(u,...$r(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:zr,rule:js};var De=require("@typescript-eslint/utils");var xn=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 at=require("@typescript-eslint/utils"),Ms=at.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wr="prefer-named-functions",Vr=new Map,_s=Ms({name:Wr,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=Vr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Vr.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:Wr,rule:_s};var Q=require("@typescript-eslint/utils"),$e=require("zod/v4");var $s=$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()}))}),Us=/^use[A-Z]/,zs=/^[A-Z]/;function Rt(e){return Us.test(e)}function Jr(e){return zs.test(e)}function Vs(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 Xr(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 Br(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Xr(e.parent.callee,"forwardRef"))}function Hr(e){return!!(e.parent&&e.parent.type===Q.AST_NODE_TYPES.CallExpression&&Xr(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 Ws(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(Jr(n.name)||Rt(n.name))return!r;r=!0}else{if(Br(t)||Hr(t))return!r;if(t.parent.type===Q.AST_NODE_TYPES.CallExpression){let o=t.parent;Vs(o.callee)||(r=!0)}else t.parent.type===Q.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Yr(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 Js(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=Yr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Xs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Bs(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(Jr(o.name)||Rt(o.name)){r=!0;break}}else if(Br(n)||Hr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Ws(e):!Js(e,t):!1}var An=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:[z($s)],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=Yr(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&Xs(o))return;let a=i.allowUseInside||[];Bs(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 Hs=fe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Zr="prefer-single-line-if",Ys=kt.default.object({maxLineLength:kt.default.number().optional(),maxNonSimpleConditionLength:kt.default.number().optional()}),qs=Hs({name:Zr,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:[z(Ys)]},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(!Kr(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=qr(n.test);if(!f&&n.test.type===fe.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;qr(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 f=r.getTokenAfter(p);if(f&&f.type===fe.AST_TOKEN_TYPES.Keyword&&(f.value==="else"||f.value==="catch"))return}let l=
|
|
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 f=r.getTokenAfter(p);if(f&&f.type===fe.AST_TOKEN_TYPES.Keyword&&(f.value==="else"||f.value==="catch"))return}let l=Gs(r,n),u=`if (${i}) ${a}`;t.maxLineLength&&u.length+l.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,u)})}}}});function Zr(e){return e.type===fe.AST_NODE_TYPES.CallExpression||e.type===fe.AST_NODE_TYPES.BinaryExpression||e.type===fe.AST_NODE_TYPES.MemberExpression&&Kr(e)}function Kr(e){return e.object.type===fe.AST_NODE_TYPES.MemberExpression?Kr(e.object):e.object.type!==fe.AST_NODE_TYPES.Identifier}function Gs(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Qr(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?Qr(t):!1}var wn={name:Gr,rule:Zs};var j=require("@typescript-eslint/utils"),vn=require("zod/v4");var Ks=j.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ii="react-compiler-extra",Qs=vn.z.object({runOnlyWithEnableCompilerDirective:vn.z.boolean().optional()}),ea=/eslint +react-compiler\/react-compiler: +\["error/;function lt(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 ei(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 ta(e){return e.type===j.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function oi(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 na(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 ra=/^[A-Z][a-zA-Z0-9]*$/;function bt(e){return ra.test(e)}function Pt(e){return e.startsWith("use")&&e.length>3}function Rn(e,t,r,n){if(r&&na(r))return t?bt(t.name):e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?bt(e.id.name):!0;if(t&&Pt(t.name)||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id&&Pt(e.id.name))return!0;if(n){let o=t?.name||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(o&&bt(o)&&si(e.body,n).containsJSX)return!0}return!1}function ht(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 si(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:ta(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 ti(e,t){let r=e.body,n=si(r,t);return n.containsJSX||n.containsHookCalls}var ia=/\bthis[.[]/;function ni(e){return ia.test(e)}function oa(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&&oi(n.callee)&&(r.containsHookCalls=!0)},t),r}function ri(e){return bt(e)||Pt(e)}function Fn(e,t,r,n){if(!oa(e.body,t).containsHookCalls)return!1;let s=Rn(e,r,n,t);if(!s&&n){let i=r?.name||e.type===j.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&bt(i)&&(s=!0)}return!s}var sa=Ks({name:ii,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:[$(Qs)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(ea.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),u=a.value,f=p.getText(u.body);if(ni(f))e.report({node:a,messageId:"thisKeywordInMethod"});else{let y=u.params.map(m=>p.getText(m)).join(", "),b="";u.generator?b=`${l}: function* (${y}) ${f}`:u.async?b=`${l}: async (${y}) => ${f}`:b=`${l}: (${y}) => ${f}`,e.report({node:a,messageId:"objectMethodIsNotSupported",fix:m=>m.replaceText(a,b)})}}}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 u=e.sourceCode.getText(p.value.body);ni(u)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}function s(i){let a=ei(i);return a!==null&<(a)}return{CallExpression(i){if(oi(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(ht(a)&&!ri(p.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(Fn(a,e.sourceCode,p,l)){if(lt(a))return;e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(Rn(a,p,l,e.sourceCode)){let u=ti(a,e.sourceCode),f=ht(a);if(!u&&!f){if(lt(a))return;e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(y){if(a.body.type===j.AST_NODE_TYPES.BlockStatement){let b=a.body.range[0]+1;return y.insertTextAfterRange([b,b],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&ht(i)&&!
|
|
20
|
+
`)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&ht(i)&&!ri(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Fn(i,e.sourceCode)){if(lt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(Rn(i,void 0,void 0,e.sourceCode)){let a=ti(i,e.sourceCode),p=ht(i);if(!a&&!p){if(lt(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let u=i.body.range[0]+1;return l.insertTextAfterRange([u,u],`
|
|
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!==L.AST_NODE_TYPES.ObjectExpression)return;let a=Qr(i);if(!a)return;let p;a.type===L.AST_NODE_TYPES.FunctionDeclaration&&a.id?p=a.id.name:(a.type===L.AST_NODE_TYPES.ArrowFunctionExpression||a.type===L.AST_NODE_TYPES.FunctionExpression)&&a.parent.type===L.AST_NODE_TYPES.VariableDeclarator&&a.parent.id.type===L.AST_NODE_TYPES.Identifier&&(p=a.parent.id.name),p&&Pt(p)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),kn={name:ri,rule:oa};var me=require("@typescript-eslint/utils"),Le=require("zod/v4");var sa=me.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),si="react-compiler-migration",aa=Le.z.object({disallowHooks:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string()})).optional(),disallowMethods:Le.z.array(Le.z.object({name:Le.z.string(),replacement:Le.z.string().optional(),requireTrueProp:Le.z.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Le.z.boolean().optional()}),la=/eslint +react-compiler\/react-compiler: +\["error/;function pa(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 ca(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 ua(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 fa=sa({name:si,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:[z(aa)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(la.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ca(o);return s!==null&&pa(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&&ua(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:si,rule:fa};var pe=require("@typescript-eslint/utils");var ma=/\.(tsx|jsx)$/,ya=/^[A-Z][A-Za-z0-9]*$/,ai=80,On=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"},schema:[],messages:{moveValueInsideComponent:'Module-level "{{valueName}}" is only used in React component "{{componentName}}". Move it inside the component to improve memory usage.'}},defaultOptions:[],create(e){if(!ma.test(e.filename))return{};let t=e.sourceCode,r=da(t.ast.body);return r.length===0?{}:{VariableDeclarator(n){if(n.id.type!==pe.AST_NODE_TYPES.Identifier||!ga(n)||!Ea(n.init))return;let o=n.id.name,i=t.getDeclaredVariables(n).find(f=>f.name===o);if(!i)return;let a=new Set,p=!1,l=0;for(let f of i.references){if(f.init)continue;if(l++,l>1)break;let y=Sa(f.identifier,r);if(!y){p=!0;break}if(a.add(y),a.size>1)break}if(l!==1||p||a.size!==1)return;let[u]=Array.from(a);u&&e.report({node:n.id,messageId:"moveValueInsideComponent",data:{valueName:o,componentName:u}})}}}});function da(e){let t=[],r=new Set;function n(s,i){ya.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!==pe.AST_NODE_TYPES.Identifier)continue;let a=li(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===pe.AST_NODE_TYPES.VariableDeclaration){o(s);continue}if(s.type===pe.AST_NODE_TYPES.FunctionDeclaration){n(s.id.name,s);continue}s.type===pe.AST_NODE_TYPES.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===pe.AST_NODE_TYPES.VariableDeclaration?o(s.declaration):s.declaration.type===pe.AST_NODE_TYPES.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function ga(e){return e.parent.parent.type===pe.AST_NODE_TYPES.Program}function Sa(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 li(e){if(!e)return null;let t=Nn(e);if(t.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||t.type===pe.AST_NODE_TYPES.FunctionExpression)return t;if(t.type!==pe.AST_NODE_TYPES.CallExpression||!Ta(t.callee))return null;let r=t.arguments[0];if(!r||r.type===pe.AST_NODE_TYPES.SpreadElement)return null;if(r.type===pe.AST_NODE_TYPES.CallExpression)return li(r);let n=Nn(r);return n.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||n.type===pe.AST_NODE_TYPES.FunctionExpression?n:null}function Ta(e){return e.type===pe.AST_NODE_TYPES.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===pe.AST_NODE_TYPES.MemberExpression?e.property.type===pe.AST_NODE_TYPES.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function Nn(e){let t=e;for(;;){if(t.type===pe.AST_NODE_TYPES.TSAsExpression){t=t.expression;continue}if(t.type===pe.AST_NODE_TYPES.TSSatisfiesExpression){t=t.expression;continue}if(t.type===pe.AST_NODE_TYPES.TSNonNullExpression){t=t.expression;continue}return t}}function Ea(e){if(!e)return!1;let t=Nn(e);return ha(t)?!1:ba(t)?!0:xa(t)}function ha(e){return e.type===pe.AST_NODE_TYPES.Identifier||e.type===pe.AST_NODE_TYPES.MemberExpression}function ba(e){if(e.type===pe.AST_NODE_TYPES.Literal)return typeof e.value=="string"&&e.value.length>=ai;if(e.type===pe.AST_NODE_TYPES.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=ai:!1}return!1}function xa(e){return e.type===pe.AST_NODE_TYPES.ArrayExpression||e.type===pe.AST_NODE_TYPES.ObjectExpression||e.type===pe.AST_NODE_TYPES.ClassExpression}var $=require("@typescript-eslint/utils"),Ln=require("zod");var Ca=Ln.z.object({runOnlyWithEnableCompilerDirective:Ln.z.boolean().optional()}),Ia=/eslint +react-compiler\/react-compiler: +\["error/,Aa=/^\d+$/,wa=/[\s_-]+/,Fa=/[a-z][A-Z]/,va=/^(.+?)([A-Z][a-z]+s?)$/,Ra=/^[a-z][a-zA-Z]*$/;function pi(e,t){let r=[];if(e.type===$.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===$.AST_NODE_TYPES.JSXAttribute&&n.name.type===$.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===$.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Me(s,a=>{switch(a.type){case $.AST_NODE_TYPES.ObjectExpression:case $.AST_NODE_TYPES.ArrowFunctionExpression:case $.AST_NODE_TYPES.FunctionExpression:case $.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function ka(e){if(e.body.type===$.AST_NODE_TYPES.JSXElement||e.body.type===$.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===$.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===$.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===$.AST_NODE_TYPES.JSXElement||t.argument.type===$.AST_NODE_TYPES.JSXFragment))return!0}return!1}function Pa(e,t){let r=e.callee;if(r.type===$.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===$.AST_NODE_TYPES.Identifier){let o=n.name,s=Na(o);if(s!==o)return jn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===$.AST_NODE_TYPES.Identifier)return jn(n.name)}return"ListItem"}function Na(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(Fa)){let n=e.match(va);if(n){let o=n[1],s=n[2];if(!o||!s)return Dn(e);let i=Dn(s);if(i!==s)return o+i}}return Dn(e)}function Dn(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 jn(e){return e.match(Ra)?e.charAt(0).toUpperCase()+e.slice(1):e.split(wa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ci(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===$.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Aa.test(i.name)){let a=i.parent;if(a.type===$.AST_NODE_TYPES.Property&&a.key===i||a.type===$.AST_NODE_TYPES.MemberExpression&&a.property===i&&!a.computed||a.type===$.AST_NODE_TYPES.JSXOpeningElement||a.type===$.AST_NODE_TYPES.JSXClosingElement||a.type===$.AST_NODE_TYPES.JSXAttribute&&a.name.type===$.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 ui(e,t,r,n,o){let i=[...r.map(f=>f.type===$.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(`
|
|
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
23
|
`),p=i.map(f=>f.name).join(", "),l=o.getText(t),u=`${e}Props`;return`type ${u} = {
|
|
24
24
|
${a}
|
|
25
25
|
};
|
|
@@ -28,22 +28,22 @@ const ${e}: FC<${u}> = ({ ${p} }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
${l}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Ua(e,t,r,n){let o=t.map(i=>i.type===U.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 za(e){if(e.type===U.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===U.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Mn(t)}return"ListItem"}function Va(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 mi(e,t){for(let r of e.openingElement.attributes)if(r.type===U.AST_NODE_TYPES.JSXAttribute&&r.name.type===U.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===U.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==U.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var _n=z({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:[$(ka)],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(Pa.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===U.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===U.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Wa(n,r,e):Ja(n,r,e))}}}});function Wa(e,t,r){let n=e.arguments[0];if(!n||n.type!==U.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==U.AST_NODE_TYPES.FunctionExpression||!Ma(n))return;let o=null;if(n.body.type===U.AST_NODE_TYPES.JSXElement||n.body.type===U.AST_NODE_TYPES.JSXFragment?o=n.body:n.body.type===U.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===U.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===U.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===U.AST_NODE_TYPES.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=ci(o,t);if(!s.hasUnstable)return;let i=_a(e,n.params),a=n.params.map(f=>f.type===U.AST_NODE_TYPES.Identifier?f.name:"item"),p=ui(o,a,t),l=o.type===U.AST_NODE_TYPES.JSXElement?mi(o,t):null,u=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:f=>{let y=fi(i,o,n.params,p,t),b=Ua(i,n.params,p,l),m=e;for(;m.parent.type!==U.AST_NODE_TYPES.Program&&!(m.type===U.AST_NODE_TYPES.FunctionDeclaration||m.type===U.AST_NODE_TYPES.VariableDeclarator&&m.init&&(m.init.type===U.AST_NODE_TYPES.ArrowFunctionExpression||m.init.type===U.AST_NODE_TYPES.FunctionExpression));)m=m.parent;let h=[];return h.push(f.insertTextAfter(m,`
|
|
32
32
|
|
|
33
|
-
${y}`)),h.push(f.replaceText(o,
|
|
33
|
+
${y}`)),h.push(f.replaceText(o,b)),h}}]})}function Ja(e,t,r){let n=e.arguments[0];if(!n||n.type!==U.AST_NODE_TYPES.JSXElement&&n.type!==U.AST_NODE_TYPES.JSXFragment)return;let o=n,s=ci(o,t);if(!s.hasUnstable)return;let i=za(o),a=ui(o,[],t),p=o.type===U.AST_NODE_TYPES.JSXElement?mi(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:u=>{let f=fi(i,o,[],a,t),y=Va(i,a,p),b=e;for(;b.parent.type!==U.AST_NODE_TYPES.Program&&!(b.type===U.AST_NODE_TYPES.FunctionDeclaration||b.type===U.AST_NODE_TYPES.VariableDeclarator&&b.init&&(b.init.type===U.AST_NODE_TYPES.ArrowFunctionExpression||b.init.type===U.AST_NODE_TYPES.FunctionExpression));)b=b.parent;let m=[];return m.push(u.insertTextAfter(b,`
|
|
34
34
|
|
|
35
|
-
${f}`)),m.push(u.replaceText(o,y)),m}}]})}var Nt=require("@typescript-eslint/utils"),_a=Nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mi="require-description",$a=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ua=/^eslint-disable-(next-)?line$/u,za=_a({name:mi,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=Va(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Xa(o.loc),messageId:"missingDescription"}))}}}}}),yi={name:mi,rule:za};function Va(e){let{text:t,description:r}=Ja(e.value);if(!t)return null;let n=$a.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Ua.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 Wa=/\s-{2,}\s/u;function Ja(e){let t=e.split(Wa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Xa(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),ze=require("zod/v4");var Ba=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=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:[z(Ba)]},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(x=>`"${x}"`).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 x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,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 x=y.parent;if(x.id.type===ne.AST_NODE_TYPES.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.AST_NODE_TYPES.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.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 x=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&&x.has(C.property.name)){if(x.delete(C.property.name),x.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&&x.has(S.key.name)&&x.delete(S.key.name);if(x.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))){x.clear();break}}}if(x.size>0){let m=Array.from(x);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 Ei(e){return/^use[A-Z0-9]/.test(e)}function Ot(e){return e.type==="Identifier"?Ei(e.name):e.type==="MemberExpression"&&!e.computed&&Ot(e.property)?e.object.type==="Identifier":!1}function hi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function bi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function xi(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"forwardRef"))}function Ci(e){return!!(e.parent&&e.parent.callee&&bi(e.parent.callee,"memo"))}function $n(e){for(;e;){let t=Ai(e);if(t&&(hi(t)||Ot(t))||xi(e)||Ci(e))return!0;e=e.parent}return!1}function di(e){return!1}function Un(e){return!1}var Ha=/eslint +react-compiler\/react-compiler: +\["error/;function gi(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 Si(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 Ii={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=Si(l);if(f&&gi(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(Ha.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=Si(u);if(y&&gi(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&&di(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 x(E,b){let{cache:w}=x,k=w.get(E.id),N=new Set(b);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+=x(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),N=new Set(b);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:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.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 b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(l.initialSegment),S=Ai(u),I=$n(u),A=S?hi(S)||Ot(S):xi(u)||Ci(u),g=1/0;for(let E of l.finalSegments){if(!E.reachable)continue;let b=h(E);b<g&&(g=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=x(E)*m(E),N=y.has(E.id);for(let c of b)if(N&&!Un(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&&!Un(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&&!Un(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"&&Ei(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=Ti(s),f=Ti(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||di(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){$n(l)&&p(n(l))},ArrowFunctionExpression(l){$n(l)&&p(n(l))}}}};function Ai(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 Ti(e){return e[e.length-1]}var Te=require("@typescript-eslint/utils"),Ce=Ne(require("zod/v4"));var Ya=/^\s+$/,zn=/\r?\n/,qa=/^(\s*)/,Za=/^(\s*)\S/,Ga=/\r?\n/,Ka=Ce.object({indent:Ce.union([Ce.string().regex(Ya),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),Vn=U({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[z(Ka)],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(zn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(qa);b&&(g=Math.min(g,b[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
|
|
36
|
-
`)}function p(S,I,A){return S.split(
|
|
37
|
-
`)}function l(S){if(S.type===Te.AST_NODE_TYPES.Identifier)return S.name;if(S.type===Te.AST_NODE_TYPES.MemberExpression){let I=S.object.type===Te.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===Te.AST_NODE_TYPES.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Te.AST_NODE_TYPES.MemberExpression&&S.object.type===Te.AST_NODE_TYPES.Identifier&&S.property.type===Te.AST_NODE_TYPES.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Te.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Te.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=l(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:
|
|
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(S,I,A){return S.split(Vn).map(E=>E.trim()===""?E:A.repeat(I)+E).join(`
|
|
37
|
+
`)}function l(S){if(S.type===Te.AST_NODE_TYPES.Identifier)return S.name;if(S.type===Te.AST_NODE_TYPES.MemberExpression){let I=S.object.type===Te.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===Te.AST_NODE_TYPES.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Te.AST_NODE_TYPES.MemberExpression&&S.object.type===Te.AST_NODE_TYPES.Identifier&&S.property.type===Te.AST_NODE_TYPES.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Te.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Te.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=l(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:x=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.MemberExpression||!x&&S.callee.optional||S.callee.property.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function b(S,I){if(!S||S.type!==Te.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:g,optionalCall:E=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Te.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&b(S.parent.callee.type===Te.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===Te.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===Te.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),g=A.match(il);if(!g)return;let E=g[0],x=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!x)return;let k=x.match(rl)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let v=a(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+p(v,1,k+N)+E+k,T=A.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,F=A.split(
|
|
40
|
+
`,F=A.split(Vn),P=F.map((L,X)=>X!==F.length-1&&L===N+k?"":L).join(T);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:L=>d.split(I).map((X,G)=>{let q=S.quasis[G];return q?L.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(S){if(!h(S))return;let I=C(S);if(I)return e.report(I)}}}});var Jn=require("@typescript-eslint/utils");function sl(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function al(e){let t=e.parent;return t?.type===Jn.AST_NODE_TYPES.NewExpression&&t.callee.type===Jn.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Xn=z({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){sl(r)||al(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"),pt=require("zod/v4");var ll=pt.z.object({checkOnly:pt.z.array(pt.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:pt.z.array(pt.z.string()).optional()}),Bn=z({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:[$(ll)],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 h of o)if(m.range[0]>=h.range[0]&&m.range[1]<=h.range[1])return h;return null}function i(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.FunctionDeclaration||h.type===he.AST_NODE_TYPES.FunctionExpression||h.type===he.AST_NODE_TYPES.ArrowFunctionExpression){let C=h.params;for(let S of C)if(m.range[0]>=S.range[0]&&m.range[1]<=S.range[1])return!0;break}h=h.parent}return!1}function a(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=h.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}h=h.parent}return!1}function p(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.AST_NODE_TYPES.CallExpression||C.type===he.AST_NODE_TYPES.NewExpression)return!0}h=h.parent}return!1}function l(m){let h=m.parent;for(;h;){if(h.type===he.AST_NODE_TYPES.TSTypeAliasDeclaration||h.type===he.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;h=h.parent}return!1}function u(m){return m.parent.type===he.AST_NODE_TYPES.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let h=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let g=C.get(A)||[];g.push(I),C.set(A,g)}for(let{typeName:I,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E}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")&&E),v=(C.get(A)||[]).length>1;(N||v?w>k:w>k||w!==k-1)&&h.push({typeName:I,typeDef:x,targetStatement:A,firstUsagePosition:g})}if(h.length===0)return;h.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return E-x});let S=h[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:b(h)})}function b(m){return function*(h){let C=new Map;for(let S of m){let I=C.get(S.targetStatement)||[];I.push(S),C.set(S.targetStatement,I)}for(let[,S]of C)S.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return E-x});for(let S of m){let{typeDef:I}=S,A=I.statement,g=r.getCommentsBefore(A),E=A.range[0],x=A.range[1];g.length>0&&g[0]&&(E=g[0].range[0]),yield h.removeRange([E,x])}for(let[S,I]of C){let A=r.getCommentsBefore(S),g=A.length>0&&A[0]?A[0].range[0]:S.range[0],E=[];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(d=>r.getText(d)).join(`
|
|
41
41
|
`)}
|
|
42
42
|
${k}`),E.push(c)}yield h.insertTextBeforeRange([g,g],`${E.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 b=m.get(I);if(!b)return;b.includes(g)||b.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 nl=["tsx"],rl=/^[A-Z][A-Za-z0-9]*$/,il=ct.object({extensions:ct.array(ct.string()).optional()}),Bn=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:[z(il)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??nl,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 rl.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 b=E.body;if(u(b))return!0}return!1}function y(g){if(g.id.type!==ie.AST_NODE_TYPES.Identifier)return;let E=g.id.name,b=g.init;if(b){if(p(E)&&(b.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||b.type===ie.AST_NODE_TYPES.FunctionExpression||l(b))){i.add(E);return}b.type===ie.AST_NODE_TYPES.Identifier&&a.set(E,b.name),p(E)||f(b)&&i.add(E)}}function x(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 b of E.declarations)y(b);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)x(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let b=a.get(g);return b?m(b,E):!1}let h=[];function C(g,E,b){h.push({node:g,isType:E,isComponent:b})}for(let g of s.ast.body){if(g.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let b=g.declaration;if(b.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){C(b,!0,!1);continue}if(b.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of b.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(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||p(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(g.specifiers.length>0)for(let b of g.specifiers){if(b.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(g.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let E=g.declaration;if(E.type===ie.AST_NODE_TYPES.Identifier){let b=m(E.name)||p(E.name);C(g,!1,b);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 Lt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ol(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 sl=Dt.z.object({ignorePrefixes:Dt.z.array(Dt.z.string()).optional()});function wi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function al(e){return`set${Lt(e)}`}var Hn=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:[z(sl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.AST_NODE_TYPES.CallExpression||!ol(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=wi(s,a),l=wi(i,a);if(p===""){if(!l.startsWith("set")){let f=`set${Lt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=al(p);l!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Lt(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 ll=nt.z.object({name:nt.z.string(),defaults:nt.z.array(nt.z.unknown())}),pl=nt.z.object({functions:nt.z.array(ll)});function jt(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)=>jt(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(!jt(a,p))return!1}return!0}function cl(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&&jt(o.value,s.value)&&r.add(n)}return r}function Fi(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]=Fi(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 ul(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 Yn=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:[z(pl)]},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=ul(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=Fi(C);if(h===void 0){a=m;continue}if(jt(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=cl(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 b=Object.getOwnPropertyDescriptor(g,E);b&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=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 b=[];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)||b.push(k);let w=b.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 fl(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 ml(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 qn=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){fl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ml(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var M=require("@typescript-eslint/utils"),Mt=require("zod/v4");var yl=Mt.z.object({mainComponentRegex:Mt.z.string().optional(),mainComponentSelector:Mt.z.string().optional()}),dl=/^[A-Z][A-Za-z0-9]*$/,Zn=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:[z(yl)],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 x(d){return dl.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((x(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),x(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 b(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 j of l)j.name===P.name.name&&(T.add(j.name),(j.firstUsagePosition===void 0||P.name.range[0]<j.firstUsagePosition)&&(j.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){x(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){x(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=b(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 j=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)}j.set(D.name,B)}let X=new Map;for(let D of l){let Z=j.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=j.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 j=new Map;for(let X of d){let G=j.get(X.targetPosition)||[];G.push(X),j.set(X.targetPosition,G)}for(let[X,G]of j){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(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(`
|
|
47
47
|
`)}
|
|
48
48
|
${Pe}`),B.push(Pe)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
|
|
49
49
|
|
|
@@ -52,4 +52,4 @@ ${Pe}`),B.push(Pe)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
|
|
|
52
52
|
`)}if(T){let{component:X,targetBefore:G}=T,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],ye=(()=>{let Pe=r.getText(X.node);return q.length>0&&(Pe=`${q.map(Ee=>r.getText(Ee)).join(`
|
|
53
53
|
`)}
|
|
54
54
|
${Pe}`),Pe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${ye}
|
|
55
|
-
`)}}}}});var _t=require("@typescript-eslint/utils"),
|
|
55
|
+
`)}}}}});var _t=require("@typescript-eslint/utils"),Kn=Ne(require("typescript")),Ri=require("zod/v4");var Cl=Ri.z.object({}),Qn=z({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:[$(Cl)]},defaultOptions:[{}],create(e){let t=_t.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&Kn.default.TypeFlags.Any||o.flags&Kn.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!==_t.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"),ut=require("zod/v4");var Il=ut.z.object({functions:ut.z.array(ut.z.string()).optional(),selectors:ut.z.array(ut.z.string()).optional()});function ki(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 Pi(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 er=z({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:[$(Il)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(ki(i))return;let a=Pi(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||ki(a))return;let p=Pi(a);p&&e.report({node:a,messageId:"moduleLevel",data:{functionName:p}})};return s}});var ke=require("@typescript-eslint/utils");function Al(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 wl(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 tr=z({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=wl(r);if(l){if(t.getCommentsInside(n).length>0)return;let f=t.getText(s);e.report({node:r,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:b}=l;return b.body.type!==ke.AST_NODE_TYPES.BlockStatement?null:y.replaceText(b.body,f)}})}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=Al(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:p=>p.replaceText(r,a)})}}}});var Ke=require("zod/v4");var Fl="no-restricted-comments",vl=Ke.z.object({regex:Ke.z.string().optional(),includes:Ke.z.string().optional(),message:Ke.z.string().optional(),autoFix:Ke.z.boolean().optional()}),Rl=Ke.z.object({patterns:Ke.z.array(vl)}),nr=z({name:Fl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[$(Rl)],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 f=function(y){return y.remove(p)};var a=f;let u=l.regex??l.includes??"";l.message?e.report({loc:p.loc,messageId:"restrictedCommentWithMessage",data:{message:l.message},fix:l.autoFix?f:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:f}]}):e.report({loc:p.loc,messageId:"restrictedComment",data:{pattern:u},fix:l.autoFix?f:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:f}]});break}}}}});var $t=require("@typescript-eslint/utils"),ft=require("zod/v4");var kl=ft.z.object({allow:ft.z.record(ft.z.string(),ft.z.array(ft.z.string())).optional()}),rr=z({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[$(kl)],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===$t.AST_NODE_TYPES.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===$t.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!==$t.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 Ni={[bn.name]:bn.rule,[en.name]:en.rule,[Qt.name]:Qt.rule,"rules-of-hooks":Ai,"exhaustive-deps":gr,"require-description":di.rule,[tn.name]:tn.rule,[rn.name]:rn.rule,[Cn.name]:Cn.rule,[zt.name]:zt.rule,[Kt.name]:Kt.rule,[sn.name]:sn.rule,[gt.name]:gt.rule,[wn.name]:wn.rule,[on.name]:on.rule,[nn.name]:nn.rule,[ln.name]:ln.rule,[Wt.name]:Wt.rule,[Pn.name]:Pn.rule,[kn.name]:kn.rule,[Dn.name]:Dn.rule,[_n.name]:_n.rule,[Gt.name]:Gt.rule,[fn.name]:fn.rule,[mn.name]:mn.rule,[yn.name]:yn.rule,[Tn.name]:Tn.rule,[En.name]:En.rule,[dn.name]:dn.rule,[Sn.name]:Sn.rule,[An.name]:An.rule,[cn.name]:cn.rule,[pn.name]:pn.rule,[Xn.name]:Xn.rule,[xn.name]:xn.rule,[$n.name]:$n.rule,[Wn.name]:Wn.rule,[Bn.name]:Bn.rule,[Hn.name]:Hn.rule,[Yn.name]:Yn.rule,[qn.name]:qn.rule,[Zn.name]:Zn.rule,[Gn.name]:Gn.rule,[Qn.name]:Qn.rule,[er.name]:er.rule,[gt.name]:gt.rule,[tr.name]:tr.rule,[nr.name]:nr.rule,[rr.name]:rr.rule};var Oi={rules:Ni},Pl=Oi;0&&(module.exports={extendedLintPlugin});
|