@ls-stack/extended-lint 0.78.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extended-lint.js +17 -17
- package/dist/extended-lint.mjs +18 -18
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Ti=Object.create;var dt=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var Ei=Object.getOwnPropertyNames;var bi=Object.getPrototypeOf,xi=Object.prototype.hasOwnProperty;var Ci=(e,t)=>{for(var r in t)dt(e,r,{get:t[r],enumerable:!0})},Yn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ei(t))!xi.call(e,o)&&o!==r&&dt(e,o,{get:()=>t[o],enumerable:!(n=hi(t,o))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Ti(bi(e)):{},Yn(t||!e||!e.__esModule?dt(r,"default",{value:e,enumerable:!0}):r,e)),Ii=e=>Yn(dt({},"__esModule",{value:!0}),e);var Wa={};Ci(Wa,{extendedLintPlugin:()=>za});module.exports=Ii(Wa);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var qn=require("@typescript-eslint/utils"),Zn=ke(require("zod/v4"));function Y(e){let r=qn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function W(e){return Zn.toJSONSchema(e)}var Ai=M.z.object({disallow:M.z.array(M.z.object({selector:M.z.string(),message:M.z.string(),replace:M.z.optional(M.z.union([M.z.string(),M.z.object({regex:M.z.string(),with:M.z.string()})])),replaceType:M.z.optional(M.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.z.optional(M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.optional(M.z.array(M.z.object({atIndex:M.z.number(),value:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))),message:M.z.string(),replaceWith:M.z.optional(M.z.string()),ignoreRegex:M.z.optional(M.z.string())}))),__dev_simulateFileName:M.z.optional(M.z.string()),mustMatchSyntax:M.z.optional(M.z.array(M.z.object({includeRegex:M.z.string(),mustCallFn:M.z.optional(M.z.array(M.z.object({anyCall:M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.array(M.z.object({atIndex:M.z.number(),literal:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))})),message:M.z.optional(M.z.string())}))),mustMatchSelector:M.z.optional(M.z.array(M.z.object({selector:M.z.string(),message:M.z.string()}))),mustHaveExport:M.z.optional(M.z.array(M.z.object({name:M.z.string(),type:M.z.enum(["function","variable","any"]).default("any"),message:M.z.string()})))})))}),Dt=Y({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[W(Ai)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,l=o??e.filename,c=[],a=new Map,u=new Set,m=new Map,y=new Set,C=new Map;function f(b){for(let w of b.specifiers)w.type===he.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===he.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&C.set(w.local.name,w.imported.name)}function E(b){if(b.declaration){if(b.declaration.type===he.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,p]=k.split(":");N===w&&(p==="function"||p==="any")&&y.delete(k)}}else if(b.declaration.type===he.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[p,R]=N.split(":");p===k&&(R==="variable"||R==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[p,R]=N.split(":");p===k&&R==="any"&&y.delete(N)}}}function x(b){b.id.type===he.AST_NODE_TYPES.Identifier&&b.init?.type===he.AST_NODE_TYPES.Identifier&&C.set(b.id.name,b.init.name)}function S(b){return C.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:k,mustHaveExport:N}of n??[]){let R=function(d){let g=d;for(let{name:F,value:P}of p??[])g=g.replaceAll(F,P);return g};var h=R;let p=wi(l,new RegExp(b));if(p){for(let{anyCall:d,message:g}of w??[]){let F=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(F),c.push(P=>{let{callee:j}=P;if(j.type===he.AST_NODE_TYPES.Identifier){for(let{fn:J,withArgs:G}of d)if(j.name===J){u.delete(F);for(let H of G){let D=P.arguments[H.atIndex],Z=typeof H.literal=="string"?R(H.literal):H.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${H.atIndex}${g?`: ${R(g)}`:""}`}});continue}if(D.type!==he.AST_NODE_TYPES.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${H.atIndex} should the literal "${Z}"${g?`: ${R(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${R(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])m.set(d,R(g)),a.set(R(d),()=>{m.delete(d)});for(let{name:d,type:g,message:F}of N??[]){let P=R(d),j=R(F);y.add(`${P}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:p}of i??[])p&&new RegExp(p).test(l)||c.push(R=>{let{callee:d}=R;if(d.type!==he.AST_NODE_TYPES.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=R.arguments[F.atIndex];if(!P){e.report({node:R,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==he.AST_NODE_TYPES.Literal||P.value!==F.value)return}let g=F=>N?F.replaceText(R,N):null;e.report({node:R,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]: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"){c.push(p=>{T(k,p,w,N)});continue}r[b]=p=>{T(k,p,w,N)}}if(a.size>0)for(let[b,w]of a)A(b,w);return c.length>0&&(r.CallExpression=b=>{if(b.type===he.AST_NODE_TYPES.CallExpression)for(let w of c)w(b)}),r.ImportDeclaration=b=>{b.type===he.AST_NODE_TYPES.ImportDeclaration&&f(b)},r.ExportNamedDeclaration=b=>{b.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&E(b)},r.VariableDeclarator=b=>{b.type===he.AST_NODE_TYPES.VariableDeclarator&&x(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of m)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,p]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${p}`}})}},r;function T(b,w,k,N){let p=R=>{if(!b)return null;if(typeof b=="string")return R.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return R.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?p:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:p}]:void 0})}}});function wi(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:Gn(o)}),r.push({name:"$0_uncapitalize",value:Kn(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let l=`$${i+1}`,c=s[i];c!==void 0&&(r.push({name:`${l}_lowercase`,value:c.toLowerCase()}),r.push({name:`${l}_capitalize`,value:Gn(c)}),r.push({name:`${l}_uncapitalize`,value:Kn(c)}),r.push({name:l,value:c}))}return r}function Gn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Kn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Xe=require("zod/v4");var Ri=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="collapse-simple-objs-in-one-line",Fi=Xe.z.object({maxLineLength:Xe.z.number().optional(),maxProperties:Xe.z.number().optional(),nestedObjMaxLineLength:Xe.z.number().optional(),nestedObjMaxProperties:Xe.z.number().optional(),ignoreTypesWithSuffix:Xe.z.array(Xe.z.string()).optional()}),vi=Ri({name:er,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:[W(Fi)]},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 l(a){if(a.type===re.AST_NODE_TYPES.ObjectExpression){let u=a.parent.type===re.AST_NODE_TYPES.Property,m=u?i:o,y=a.properties.length;if(y>m)return!1;if(y===1){let f=a.properties[0];return!f||f.type===re.AST_NODE_TYPES.Property&&f.value.type===re.AST_NODE_TYPES.ObjectExpression||f.type===re.AST_NODE_TYPES.Property&&f.value.type===re.AST_NODE_TYPES.ArrayExpression&&!f.value.elements.every(x=>x&&jt(x))?!1:{text:r.getText(f),isNested:u,propsSize:y}}let C=[];for(let f of a.properties){if(f.type===re.AST_NODE_TYPES.Property&&!jt(f.value))return!1;C.push(r.getText(f))}return{text:C.join(", "),isNested:u,propsSize:y}}else{let u=a.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,m=u?i:o,y=a.members.length;if(y>m)return!1;if(n.length>0&&a.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=a.parent.id.name;if(n.some(E=>f.endsWith(E)))return!1}if(y===1){let f=a.members[0];return!f||f.type===re.AST_NODE_TYPES.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(f),isNested:u,propsSize:1}}if(a.parent.type===re.AST_NODE_TYPES.TSIntersectionType||a.parent.type===re.AST_NODE_TYPES.TSUnionType&&a.parent.types[0]!==a)return!1;let C=[];for(let f of a.members){if(f.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let E=f.typeAnnotation?.typeAnnotation;if(!E||E.type===re.AST_NODE_TYPES.TSTypeLiteral||!Qn(E))return!1;if(E.type===re.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let S=E.typeArguments.params[0];if(!S||!Qn(S))return!1}let x=r.getText(f).trim();(x.endsWith(";")||x.endsWith(","))&&(x=x.slice(0,-1)),C.push(x)}return{text:C.join("; "),isNested:u,propsSize:y}}}function c(a){if(a.loc.start.line===a.loc.end.line)return;if(a.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let E=0,x=!1,S=r.getTokenAfter(a,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||x?!0:A.value===","?(E++,!1):A.value===";"?(E++,x=!0,!1):A.value===")"||A.value==="}"?(E++,!1):!0});if(E>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
|
|
1
|
+
"use strict";var Ei=Object.create;var gt=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var Ci=Object.getPrototypeOf,Ii=Object.prototype.hasOwnProperty;var Ai=(e,t)=>{for(var r in t)gt(e,r,{get:t[r],enumerable:!0})},Zn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xi(t))!Ii.call(e,o)&&o!==r&>(e,o,{get:()=>t[o],enumerable:!(n=bi(t,o))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Ei(Ci(e)):{},Zn(t||!e||!e.__esModule?gt(r,"default",{value:e,enumerable:!0}):r,e)),wi=e=>Zn(gt({},"__esModule",{value:!0}),e);var Xa={};Ai(Xa,{extendedLintPlugin:()=>Ja});module.exports=wi(Xa);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var Gn=require("@typescript-eslint/utils"),Kn=ke(require("zod/v4"));function H(e){let r=Gn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function W(e){return Kn.toJSONSchema(e)}var Ri=M.z.object({disallow:M.z.array(M.z.object({selector:M.z.string(),message:M.z.string(),replace:M.z.optional(M.z.union([M.z.string(),M.z.object({regex:M.z.string(),with:M.z.string()})])),replaceType:M.z.optional(M.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.z.optional(M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.optional(M.z.array(M.z.object({atIndex:M.z.number(),value:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))),message:M.z.string(),replaceWith:M.z.optional(M.z.string()),ignoreRegex:M.z.optional(M.z.string())}))),__dev_simulateFileName:M.z.optional(M.z.string()),mustMatchSyntax:M.z.optional(M.z.array(M.z.object({includeRegex:M.z.string(),mustCallFn:M.z.optional(M.z.array(M.z.object({anyCall:M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.array(M.z.object({atIndex:M.z.number(),literal:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))})),message:M.z.optional(M.z.string())}))),mustMatchSelector:M.z.optional(M.z.array(M.z.object({selector:M.z.string(),message:M.z.string()}))),mustHaveExport:M.z.optional(M.z.array(M.z.object({name:M.z.string(),type:M.z.enum(["function","variable","any"]).default("any"),message:M.z.string()})))})))}),jt=H({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[W(Ri)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,l=o??e.filename,c=[],a=new Map,u=new Set,m=new Map,y=new Set,C=new Map;function f(b){for(let w of b.specifiers)w.type===he.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===he.AST_NODE_TYPES.Identifier&&w.imported.name!==w.local.name&&C.set(w.local.name,w.imported.name)}function E(b){if(b.declaration){if(b.declaration.type===he.AST_NODE_TYPES.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,p]=k.split(":");N===w&&(p==="function"||p==="any")&&y.delete(k)}}else if(b.declaration.type===he.AST_NODE_TYPES.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.AST_NODE_TYPES.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[p,R]=N.split(":");p===k&&(R==="variable"||R==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.AST_NODE_TYPES.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[p,R]=N.split(":");p===k&&R==="any"&&y.delete(N)}}}function x(b){b.id.type===he.AST_NODE_TYPES.Identifier&&b.init?.type===he.AST_NODE_TYPES.Identifier&&C.set(b.id.name,b.init.name)}function S(b){return C.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:k,mustHaveExport:N}of n??[]){let R=function(d){let g=d;for(let{name:F,value:P}of p??[])g=g.replaceAll(F,P);return g};var h=R;let p=Fi(l,new RegExp(b));if(p){for(let{anyCall:d,message:g}of w??[]){let F=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(F),c.push(P=>{let{callee:j}=P;if(j.type===he.AST_NODE_TYPES.Identifier){for(let{fn:J,withArgs:G}of d)if(j.name===J){u.delete(F);for(let Y of G){let D=P.arguments[Y.atIndex],Z=typeof Y.literal=="string"?R(Y.literal):Y.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${Y.atIndex}${g?`: ${R(g)}`:""}`}});continue}if(D.type!==he.AST_NODE_TYPES.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${Y.atIndex} should the literal "${Z}"${g?`: ${R(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${R(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])m.set(d,R(g)),a.set(R(d),()=>{m.delete(d)});for(let{name:d,type:g,message:F}of N??[]){let P=R(d),j=R(F);y.add(`${P}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:p}of i??[])p&&new RegExp(p).test(l)||c.push(R=>{let{callee:d}=R;if(d.type!==he.AST_NODE_TYPES.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=R.arguments[F.atIndex];if(!P){e.report({node:R,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==he.AST_NODE_TYPES.Literal||P.value!==F.value)return}let g=F=>N?F.replaceText(R,N):null;e.report({node:R,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]: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"){c.push(p=>{T(k,p,w,N)});continue}r[b]=p=>{T(k,p,w,N)}}if(a.size>0)for(let[b,w]of a)A(b,w);return c.length>0&&(r.CallExpression=b=>{if(b.type===he.AST_NODE_TYPES.CallExpression)for(let w of c)w(b)}),r.ImportDeclaration=b=>{b.type===he.AST_NODE_TYPES.ImportDeclaration&&f(b)},r.ExportNamedDeclaration=b=>{b.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&E(b)},r.VariableDeclarator=b=>{b.type===he.AST_NODE_TYPES.VariableDeclarator&&x(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of m)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,p]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${p}`}})}},r;function T(b,w,k,N){let p=R=>{if(!b)return null;if(typeof b=="string")return R.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return R.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?p:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:p}]:void 0})}}});function Fi(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:Qn(o)}),r.push({name:"$0_uncapitalize",value:er(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let l=`$${i+1}`,c=s[i];c!==void 0&&(r.push({name:`${l}_lowercase`,value:c.toLowerCase()}),r.push({name:`${l}_capitalize`,value:Qn(c)}),r.push({name:`${l}_uncapitalize`,value:er(c)}),r.push({name:l,value:c}))}return r}function Qn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function er(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Xe=require("zod/v4");var vi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="collapse-simple-objs-in-one-line",ki=Xe.z.object({maxLineLength:Xe.z.number().optional(),maxProperties:Xe.z.number().optional(),nestedObjMaxLineLength:Xe.z.number().optional(),nestedObjMaxProperties:Xe.z.number().optional(),ignoreTypesWithSuffix:Xe.z.array(Xe.z.string()).optional()}),Pi=vi({name:nr,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:[W(ki)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function l(a){if(a.type===re.AST_NODE_TYPES.ObjectExpression){let u=a.parent.type===re.AST_NODE_TYPES.Property,m=u?i:o,y=a.properties.length;if(y>m)return!1;if(y===1){let f=a.properties[0];return!f||f.type===re.AST_NODE_TYPES.Property&&f.value.type===re.AST_NODE_TYPES.ObjectExpression||f.type===re.AST_NODE_TYPES.Property&&f.value.type===re.AST_NODE_TYPES.ArrayExpression&&!f.value.elements.every(x=>x&&Lt(x))?!1:{text:r.getText(f),isNested:u,propsSize:y}}let C=[];for(let f of a.properties){if(f.type===re.AST_NODE_TYPES.Property&&!Lt(f.value))return!1;C.push(r.getText(f))}return{text:C.join(", "),isNested:u,propsSize:y}}else{let u=a.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,m=u?i:o,y=a.members.length;if(y>m)return!1;if(n.length>0&&a.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=a.parent.id.name;if(n.some(E=>f.endsWith(E)))return!1}if(y===1){let f=a.members[0];return!f||f.type===re.AST_NODE_TYPES.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(f),isNested:u,propsSize:1}}if(a.parent.type===re.AST_NODE_TYPES.TSIntersectionType||a.parent.type===re.AST_NODE_TYPES.TSUnionType&&a.parent.types[0]!==a)return!1;let C=[];for(let f of a.members){if(f.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let E=f.typeAnnotation?.typeAnnotation;if(!E||E.type===re.AST_NODE_TYPES.TSTypeLiteral||!tr(E))return!1;if(E.type===re.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let S=E.typeArguments.params[0];if(!S||!tr(S))return!1}let x=r.getText(f).trim();(x.endsWith(";")||x.endsWith(","))&&(x=x.slice(0,-1)),C.push(x)}return{text:C.join("; "),isNested:u,propsSize:y}}}function c(a){if(a.loc.start.line===a.loc.end.line)return;if(a.parent.type!==re.AST_NODE_TYPES.JSXExpressionContainer){let E=0,x=!1,S=r.getTokenAfter(a,{filter:A=>A.type!==re.AST_TOKEN_TYPES.Punctuator||x?!0:A.value===","?(E++,!1):A.value===";"?(E++,x=!0,!1):A.value===")"||A.value==="}"?(E++,!1):!0});if(E>4)return;let I=S?.type===re.AST_TOKEN_TYPES.Template&&S.value.startsWith(`}
|
|
2
2
|
`);if(S?.loc.start.line===a.loc.end.line&&!I)return}let u=l(a);if(!u)return;let m=u.text;if(m.includes(`
|
|
3
|
-
`)||r.getCommentsInside(a).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let y=`{ ${m} }`,C=
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function
|
|
3
|
+
`)||r.getCommentsInside(a).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let y=`{ ${m} }`,C=Ni(r,a),f=u.isNested&&u.propsSize>2?s:t.maxLineLength;f&&y.length+C.length+Oi(a,r)>f||e.report({node:a,messageId:"singleLineProp",fix:E=>E.replaceText(a,y)})}return{TSTypeLiteral:c,ObjectExpression:c}}});function tr(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 Lt(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&&Lt(r,!0)))}function Oi(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 Ni(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Mt={name:nr,rule:Pi};var Di=/eslint +react-compiler\/react-compiler: +\["error/,ir={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 l(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,m=new WeakMap,y=new WeakMap,C=new WeakSet;function f(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&l({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=c.acquire(I),k=new Set,N=null;{let v=w.upper;for(;v&&(k.add(v),v.type!=="function");)v=v.upper;if(!v)return;N=v}let p=Array.isArray;function R(v){if(!p(v.defs))return!1;let O=v.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let $=O.node.init;if($==null)return!1;for(;$.type==="TSAsExpression";)$=$.expression;let z=O.node.parent;if(z==null&&($t(N.block,O.node.id),z=O.node.parent,z==null))return!1;if(z.kind==="const"&&$.type==="Literal"&&(typeof $.value=="string"||typeof $.value=="number"||$.value===null))return!0;if($.type!=="CallExpression")return!1;let B=$.callee;if(B.type==="MemberExpression"&&B.object.name==="React"&&B.property!=null&&!B.computed&&(B=B.property),B.type!=="Identifier")return!1;let V=O.node.id,{name:Q}=B;if(Q==="useRef"&&V.type==="Identifier")return!0;if(Mi(B)&&V.type==="Identifier"){for(let ee of v.references)ee!==V&&C.add(ee.identifier);return!0}else if(Q==="useState"||Q==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&p(v.identifiers)){if(V.elements[1]===v.identifiers[0]){if(Q==="useState"){let ee=v.references,ve=0;for(let $e=0;$e<ee.length;$e++){if(ee[$e].isWrite()&&ve++,ve>1)return!1;a.set(ee[$e].identifier,V.elements[0])}}return!0}else if(V.elements[0]===v.identifiers[0]){if(Q==="useState"){let ee=v.references;for(let ve=0;ve<ee.length;ve++)u.add(ee[ve].identifier)}return!1}}}else if(Q==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(v.identifiers)&&V.elements[1]===v.identifiers[0])return!0;return!1}function d(v){if(!p(v.defs))return!1;let O=v.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let $=O.node,z=N.childScopes,B=null,V;for(V=0;V<z.length;V++){let Q=z[V],ee=Q.block;if($.type==="FunctionDeclaration"&&ee===$||$.type==="VariableDeclarator"&&ee.parent===$){B=Q;break}}if(B==null)return!1;for(V=0;V<B.through.length;V++){let Q=B.through[V];if(Q.resolved!=null&&k.has(Q.resolved.scope)&&!g(Q.resolved))return!1}return!0}let g=f(R,m),F=f(d,y),P=new Map;function j(v){let O=v.from,$=!1;for(;O.block!==I;)O.type==="function"&&($=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return $}let J=new Map,G=new Map;H(w);function H(v){for(let O of v.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let $=$t(I,O.identifier),z=rr($),B=Ue(z,G);if(b&&z.type==="Identifier"&&(z.parent.type==="MemberExpression"||z.parent.type==="OptionalMemberExpression")&&!z.parent.computed&&z.parent.property.type==="Identifier"&&z.parent.property.name==="current"&&j(O)&&P.set(B,{reference:O,dependencyNode:z}),z.parent.type==="TSTypeQuery"||z.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(J.has(B))J.get(B).references.push(O);else{let Q=O.resolved,ee=g(Q)||F(Q);J.set(B,{isStable:ee,references:[O]})}}for(let O of v.childScopes)H(O)}P.forEach(({reference:v,dependencyNode:O},$)=>{let z=v.resolved.references,B=!1;for(let V=0;V<z.length;V++){let{identifier:Q}=z[V],{parent:ee}=Q;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){B=!0;break}}B||l({node:O.parent.property,message:`The ref value '${$}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${$}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(v,O){D.has(O)||(D.add(O),l({node:v,message:`Assignments to the '${O}' variable from inside React Hook ${r(T)} 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(T)}.`}))}let q=new Set;if(J.forEach(({isStable:v,references:O},$)=>{v&&q.add($),O.forEach(z=>{z.writeExpr&&Z(z.writeExpr,$)})}),D.size>0)return;if(!A){let v=null;if(J.forEach(({isStable:O,references:$},z)=>{v||$.forEach(B=>{if(v)return;let V=B.identifier;if(!a.has(V))return;let ee=B.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(v=z)})}),v){let{suggestedDependencies:O}=Mt({dependencies:J,declaredDependencies:[],stableDependencies:q,externalDependencies:new Set,isEffect:!0});l({node:T,message:`React Hook ${h} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${h} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix($){return $.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],fe=new Set;A.type!=="ArrayExpression"?l({node:A,message:`React Hook ${r(T)} 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(v=>{if(v===null)return;if(v.type==="SpreadElement"){l({node:v,message:`React Hook ${r(T)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}C.has(v)&&l({node:v,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(v)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(v)}\``,fix(B){return B.removeRange(v.range)}}]});let O;try{O=Ue(v,G)}catch(B){if(/Unsupported node type/.test(B.message)){v.type==="Literal"?J.has(v.value)?l({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. Did you mean to include ${v.value} in the array instead?`}):l({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):l({node:v,message:`React Hook ${r(T)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw B}let $=v;for(;$.type==="MemberExpression"||$.type==="OptionalMemberExpression"||$.type==="ChainExpression";)$=$.object||$.expression.object;let z=!N.through.some(B=>B.identifier===$);ue.push({key:O,node:v}),z||fe.add(O)});let{suggestedDependencies:Fe,unnecessaryDependencies:Je,missingDependencies:Se,duplicateDependencies:at}=Mt({dependencies:J,declaredDependencies:ue,stableDependencies:q,externalDependencies:fe,isEffect:b}),Qe=Fe;if(at.size+Se.size+Je.size===0){if(t)return;Ni({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:O,isUsedOutsideOfHook:$,depType:z})=>{let B=z==="function"?"useCallback":"useMemo",V=z==="function"?"definition":"initialization",Q=`wrap the ${V} of '${O.name.name}' in its own ${B}() Hook.`,ee=$?`To fix this, ${Q}`:`Move it inside the ${h} callback. Alternatively, ${Q}`,ve=z==="conditional"||z==="logical expression"?"could make":"makes",$e=`The '${O.name.name}' ${z} ${ve} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Bn;$&&O.type==="Variable"&&z==="function"&&(Bn=[{desc:`Wrap the ${V} of '${O.name.name}' in its own ${B}() Hook.`,fix(Hn){let[gi,Si]=B==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Hn.insertTextBefore(O.node.init,gi),Hn.insertTextAfter(O.node.init,Si)]}}]),l({node:O.node,message:$e,suggest:Bn})});return}!b&&Se.size>0&&(Qe=Mt({dependencies:J,declaredDependencies:[],stableDependencies:q,externalDependencies:fe,isEffect:b}).suggestedDependencies);function Ee(){if(ue.length===0)return!0;let v=ue.map($=>$.key),O=v.slice().sort();return v.join(",")===O.join(",")}Ee()&&Qe.sort();function Ie(v){let O=v.split("."),$="";for(let z=0;z<O.length;z++){if(z!==0){let B=O.slice(0,z+1).join("."),V=G.get(B)===!0;$+=V?"?.":"."}$+=O[z]}return $}function Nt(v,O,$,z){return v.size===0?null:(v.size>1?"":O+" ")+$+" "+(v.size>1?"dependencies":"dependency")+": "+ji(Array.from(v).sort().map(B=>"'"+Ie(B)+"'"))+`. Either ${z} ${v.size>1?"them":"it"} or remove the dependency array.`}let Oe="";if(Je.size>0){let v=null;if(Array.from(Je.keys()).forEach(O=>{v===null&&O.endsWith(".current")&&(v=O)}),v!==null)Oe=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(fe.size>0){let O=Array.from(fe)[0];w.set.has(O)||(Oe=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Oe&&Se.has("props")){let v=J.get("props");if(v==null)return;let O=v.references;if(!Array.isArray(O))return;let $=!0;for(let z=0;z<O.length;z++){let B=O[z],V=$t(N.block,B.identifier);if(!V){$=!1;break}let Q=V.parent;if(Q==null){$=!1;break}if(Q.type!=="MemberExpression"&&Q.type!=="OptionalMemberExpression"){$=!1;break}}$&&(Oe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${h} call and refer to those specific props inside ${r(T)}.`)}if(!Oe&&Se.size>0){let v=null;Se.forEach(O=>{if(v)return;let $=N.set.get(O),z=J.get(O);if(z.references[0].resolved!==$)return;let B=$.defs[0];if(B==null||B.name==null||B.type!=="Parameter")return;let V=!1,Q;for(let ee=0;ee<z.references.length;ee++)if(Q=z.references[ee].identifier,Q!=null&&Q.parent!=null&&(Q.parent.type==="CallExpression"||Q.parent.type==="OptionalCallExpression")&&Q.parent.callee===Q){V=!0;break}V&&(v=O)}),v!==null&&(Oe=` If '${v}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Oe&&Se.size>0){let v=null;if(Se.forEach(O=>{if(v!==null)return;let z=J.get(O).references,B,V;for(let Q=0;Q<z.length;Q++){for(B=z[Q].identifier,V=B.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=a.get(V.callee);if(ee!=null){if(ee.name===O)v={missingDep:O,setter:V.callee.name,form:"updater"};else if(u.has(B))v={missingDep:O,setter:V.callee.name,form:"reducer"};else{let ve=z[Q].resolved;if(ve!=null){let $e=ve.defs[0];$e!=null&&$e.type==="Parameter"&&(v={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(v!==null)break}}),v!==null)switch(v.form){case"reducer":Oe=` You can also replace multiple useState variables with useReducer if '${v.setter}' needs the current value of '${v.missingDep}'.`;break;case"inlineReducer":Oe=` If '${v.setter}' needs the current value of '${v.missingDep}', you can also switch to useReducer instead of useState and read '${v.missingDep}' in the reducer.`;break;case"updater":Oe=` You can also do a functional update '${v.setter}(${v.missingDep.slice(0,1)} => ...)' if you only need '${v.missingDep}' in the '${v.setter}' call.`;break;default:throw new Error("Unknown case.")}}l({node:A,message:`React Hook ${r(T)} has `+(Nt(Se,"a","missing","include")||Nt(Je,"an","unnecessary","exclude")||Nt(at,"a","duplicate","omit"))+Oe,suggest:[{desc:`Update the dependencies array to be: [${Qe.map(Ie).join(", ")}]`,fix(v){return v.replaceText(A,`[${Qe.map(Ie).join(", ")}]`)}}]})}function x(I){let A=Di(I.callee,i);if(A===-1)return;let T=I.arguments[A],h=I.callee,b=ir(h).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!T){l({node:h,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!w&&!k){(b==="useMemo"||b==="useCallback")&&l({node:h,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(T.type){case"FunctionExpression":case"ArrowFunctionExpression":E(T,w,h,b,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(R=>R&&R.type==="Identifier"&&R.name===T.name))return;let N=n(I).set.get(T.name);if(N==null||N.defs==null)return;let p=N.defs[0];if(!p||!p.node||p.type!=="Variable"&&p.type!=="FunctionName")break;switch(p.node.type){case"FunctionDeclaration":E(p.node,w,h,b,k);return;case"VariableDeclarator":let R=p.node.init;if(!R)break;switch(R.type){case"ArrowFunctionExpression":case"FunctionExpression":E(R,w,h,b,k);return}break}break;default:l({node:h,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}l({node:h,message:`React Hook ${b} has a missing dependency: '${T.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${T.name}]`,fix(N){return N.replaceText(w,`[${T.name}]`)}}]})}}let S=!!e.options[0]?.reactCompilerIsEnabled;if(e.options[0]?.ignoreIfReactCompilerIsEnabled||S){for(let I of e.sourceCode.getAllComments())if(S||Oi.test(I.value))return t=!0,{CallExpression:A=>x(A,!0)}}return{CallExpression:I=>x(I)}}};function Mt({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((E,x)=>{let S=l(s,x);S.isUsed=!0,c(s,x,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:E})=>{let x=l(s,E);x.isSatisfiedRecursively=!0}),r.forEach(E=>{let x=l(s,E);x.isSatisfiedRecursively=!0});function l(E,x){let S=x.split("."),I=E;for(let A of S){let T=I.children.get(A);T||(T=i(),I.children.set(A,T)),I=T}return I}function c(E,x,S){let I=x.split("."),A=E;for(let T of I){let h=A.children.get(T);if(!h)return;S(h),A=h}}let a=new Set,u=new Set;m(s,a,u,E=>E);function m(E,x,S,I){E.children.forEach((A,T)=>{let h=I(T);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(h);return}if(A.isUsed){x.add(h);return}m(A,x,S,b=>h+"."+b)})}let y=[],C=new Set,f=new Set;return t.forEach(({key:E})=>{u.has(E)?y.indexOf(E)===-1?y.push(E):f.add(E):C.add(E)}),a.forEach(E=>{y.push(E)}),{suggestedDependencies:y,unnecessaryDependencies:C,duplicateDependencies:f,missingDependencies:a}}function Be(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return Be(e.consequent)!=null||Be(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Be(e.left)!=null||Be(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Be(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Be(e.expression);case"TSAsExpression":return Be(e.expression)}return null}function Ni({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let l=r.variables.find(a=>a.name===i);if(l==null)return null;let c=l.defs[0];if(c==null)return null;if(c.type==="Variable"&&c.node.type==="VariableDeclarator"&&c.node.id.type==="Identifier"&&c.node.init!=null){let a=Be(c.node.init);if(a!=null)return[l,a]}return c.type==="FunctionName"&&c.node.type==="FunctionDeclaration"?[l,"function"]:c.type==="ClassName"&&c.node.type==="ClassDeclaration"?[l,"class"]:null}).filter(Boolean);function s(i){let l=!1;for(let c=0;c<i.references.length;c++){let a=i.references[c];if(a.writeExpr){if(l)return!0;l=!0;continue}let u=a.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!or(t,a.identifier))return!0}return!1}return o.map(([i,l])=>({construction:i.defs[0],depType:l,isUsedOutsideOfHook:s(i)}))}function rr(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)?rr(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function _t(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Ue(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=Ue(e.object,t),n=Ue(e.property,null),o=`${r}.${n}`;return _t(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ue(e.object,t),n=Ue(e.property,null),o=`${r}.${n}`;return _t(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=Ue(r.object,t),o=Ue(r.property,null),s=`${n}.${o}`;return _t(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function ir(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Di(e,t){let r=ir(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=Ue(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 $t(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Li(n,t))return n;if(or(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(tr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{tr(i)&&(i.parent=n,r.push(i))}))}return null}function ji(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function tr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Li(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 or(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Mi(e){return!1}var ae=require("@typescript-eslint/utils"),X=ke(require("typescript")),Vt=require("zod/v4");var Ut=require("@typescript-eslint/utils");function et(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:et(e.parent,t,r===1/0?r:r-1)}function*zt(e){yield e,e.parent&&(yield*zt(e.parent))}function Wt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function ar(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===Ut.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===Ut.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function sr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function _i(e,t){return e[t]}function Ne(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 c=n[i.type];if(c)for(let a of c){let u=_i(i,a);if(u){if(Array.isArray(u)){for(let m of u)if(sr(m)&&s(m))return!0}else if(sr(u)&&s(u))return!0}}return!1}s(e)}var $i=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="improved-no-unnecessary-condition",Ui=Vt.z.object({alternativeForInCondition:Vt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),pr={object:"Array",property:"isArray"},zi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Wi=new Set(zi),Jt={name:lr,rule:$i({name:lr,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:[W(Ui)]},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(p){return p.type===ae.AST_NODE_TYPES.UnaryExpression&&p.operator==="typeof"}function s(p){return p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown?null:p.flags&X.default.TypeFlags.StringLike?["string"]:p.flags&X.default.TypeFlags.NumberLike?["number"]:p.flags&X.default.TypeFlags.BigIntLike?["bigint"]:p.flags&X.default.TypeFlags.BooleanLike?["boolean"]:p.flags&X.default.TypeFlags.ESSymbolLike?["symbol"]:p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void?["undefined"]:p.flags&X.default.TypeFlags.Null?["object"]:p.getCallSignatures().length>0?["function"]:p.flags&X.default.TypeFlags.Object?p.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:p.flags&X.default.TypeFlags.NonPrimitive?["object"]:p.flags&X.default.TypeFlags.Never?["never"]:null}function i(p){if(!n)return null;let R=r.esTreeNodeToTSNodeMap.get(p),d=n.getTypeAtLocation(R.expression);if(d.flags&X.default.TypeFlags.Any||d.flags&X.default.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let P of d.types){let j=s(P);if(j)g.push(...j);else return null}return g}let F=s(d);return F?(g.push(...F),g):null}function l(p){if(!(p.operator==="==="||p.operator==="!=="))return;let d=null,g=null;if(o(p.left)?(d=p.left,g=p.right.type===ae.AST_NODE_TYPES.Literal&&typeof p.right.value=="string"?p.right.value:null):o(p.right)&&(d=p.right,g=p.left.type===ae.AST_NODE_TYPES.Literal&&typeof p.left.value=="string"?p.left.value:null),!d||!g||!Vi(g,Wi))return;let F=i(d);if(!F)return;let P=p.operator==="!==",j=F.includes(g);F.length===1?j&&!P?e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:tt(d,e),type:g}}):!j&&P?e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:tt(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:tt(d,e),actualType:gt(F),conditionType:g}}):j&&P&&e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:tt(d,e),actualType:gt(F),conditionType:g}}):!j&&!P?e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:tt(d,e),actualType:gt(F),conditionType:g}}):!j&&P&&e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:tt(d,e),type:gt(F)}})}function c(p){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown)return null;if(p.isUnion()){let R=[];for(let d of p.types)if(d.flags&X.default.TypeFlags.StringLiteral){let g=d.value;R.push(g)}else return null;return R}return p.flags&X.default.TypeFlags.StringLiteral?[p.value]:null}function a(p){if(!n)return null;let R=r.esTreeNodeToTSNodeMap.get(p),d=n.getTypeAtLocation(R),g=c(d);if(g)return g;let F=n.getSymbolAtLocation(R);if(F){let P=n.getTypeOfSymbolAtLocation(F,R),j=c(P);if(j)return j}return null}function u(p){let R=e.sourceCode.ast,d=null;return Ne(R,g=>{if(g.type===ae.AST_NODE_TYPES.VariableDeclarator&&g.id.type===ae.AST_NODE_TYPES.Identifier&&g.id.name===p.name&&g.id.typeAnnotation){let F=g.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 m(p){return p==="Array"||p==="ReadonlyArray"?!0:p.endsWith(".Array")||p.endsWith(".ReadonlyArray")}function y(p){if(!n)return!1;if(n.isArrayType(p)||n.isTupleType(p))return!0;let R=n.getApparentType(p);if(R!==p&&(n.isArrayType(R)||n.isTupleType(R)))return!0;if(p.aliasSymbol){let g=n.getFullyQualifiedName(p.aliasSymbol);if(m(g))return!0}let d=p.getSymbol();if(d){let g=n.getFullyQualifiedName(d);if(m(g))return!0}return!1}function C(p){if(!n)return!1;if(p.flags&X.default.TypeFlags.StringLike||p.flags&X.default.TypeFlags.NumberLike||p.flags&X.default.TypeFlags.BigIntLike||p.flags&X.default.TypeFlags.BooleanLike||p.flags&X.default.TypeFlags.ESSymbolLike||p.flags&X.default.TypeFlags.EnumLike||p.flags&X.default.TypeFlags.Null||p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void||p.flags&X.default.TypeFlags.Never)return!0;let R=p.getSymbol();if(R){let d=n.getFullyQualifiedName(R);if(d==="__function"||d==="__object"&&!y(p))return!0}return!1}function f(p){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown)return"unknown";if(p.isUnion()){let R=!0,d=!0;for(let g of p.types){let F=f(g);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(R=!1),F!=="alwaysFalse"&&(d=!1)}return R?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(p)?"alwaysTrue":C(p)?"alwaysFalse":"unknown"}function E(p){return!p.computed&&p.object.type===ae.AST_NODE_TYPES.Identifier&&p.object.name===pr.object&&p.property.type===ae.AST_NODE_TYPES.Identifier&&p.property.name===pr.property}function x(p){if(!n||p.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!E(p.callee)||p.arguments.length===0)return;let[R]=p.arguments;if(!R||R.type===ae.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(R),g=n.getTypeAtLocation(d),F=f(g);F==="alwaysTrue"?e.report({node:p,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:p,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(p){if(p.callee.type!==ae.AST_NODE_TYPES.MemberExpression||p.callee.property.type!==ae.AST_NODE_TYPES.Identifier||p.callee.computed)return;let R=p.callee.property.name;if(R!=="startsWith"&&R!=="endsWith"&&R!=="includes"||p.arguments.length!==1)return;let[d]=p.arguments;if(!d||d.type!==ae.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let g=p.callee.object,F=a(g);if(!F&&g.type===ae.AST_NODE_TYPES.Identifier&&(F=u(g)),!F||F.length===0)return;let P=d.value;if(R==="includes"&&F.length>1)return;let j=0,J=0;for(let G of F)if((R==="startsWith"?G.startsWith(P):R==="endsWith"?G.endsWith(P):G.includes(P))?j++:J++,j>0&&J>0)return;if(j>0&&J===0){let G=R==="startsWith"?"unnecessaryStartsWithCondition":R==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:p,messageId:G})}else if(J>0&&j===0){let G=R==="startsWith"?"alwaysFalseStartsWithCondition":R==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:p,messageId:G})}}function I(p){if(!new Set(["===","!==",">",">=","<","<="]).has(p.operator))return;function d(H){if(H.type!==ae.AST_NODE_TYPES.MemberExpression||H.computed||H.property.type!==ae.AST_NODE_TYPES.Identifier||H.property.name!=="length")return null;let D=H.object,Z=a(D);if(!Z||Z.length===0)return null;let q=[];for(let ue of Z)q.push(ue.length);return{values:q}}let g=d(p.left),F=d(p.right),P=null,j=null;if(g?p.right.type===ae.AST_NODE_TYPES.Literal&&typeof p.right.value=="number"&&(P=g.values,j=p.right.value):F&&p.left.type===ae.AST_NODE_TYPES.Literal&&typeof p.left.value=="number"&&(P=F.values,j=p.left.value),!P||j===null)return;let J=0,G=0;for(let H of P){let D=!1;if(p.operator==="==="?D=H===j:p.operator==="!=="?D=H!==j:p.operator===">"?D=H>j:p.operator===">="?D=H>=j:p.operator==="<"?D=H<j:p.operator==="<="&&(D=H<=j),D?J++:G++,J>0&&G>0)return}J>0&&G===0?e.report({node:p,messageId:"unnecessaryLengthCondition"}):G>0&&J===0&&e.report({node:p,messageId:"alwaysFalseLengthCondition"})}function A(p){if(p.type===ae.AST_NODE_TYPES.Literal&&typeof p.value=="string")return p.value;let R=a(p);if(!R||R.length!==1)return null;let[d]=R;return d??null}function T(p){return(p.flags&X.default.TypeFlags.Intersection)!==0}function h(p){return(p.flags&X.default.TypeFlags.Object)!==0}function b(p){return!n||n.getIndexTypeOfType(p,X.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(p,X.default.IndexKind.Number)}function w(p,R){if(!n||b(p)||p.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(p,R);return d?d.flags&X.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(p,R){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown||p.flags&X.default.TypeFlags.Never||p.flags&X.default.TypeFlags.TypeParameter||p.flags&X.default.TypeFlags.IndexedAccess||p.flags&X.default.TypeFlags.StringLike||p.flags&X.default.TypeFlags.NumberLike||p.flags&X.default.TypeFlags.BigIntLike||p.flags&X.default.TypeFlags.BooleanLike||p.flags&X.default.TypeFlags.EnumLike||p.flags&X.default.TypeFlags.ESSymbolLike||p.flags&X.default.TypeFlags.NonPrimitive||p.flags&X.default.TypeFlags.Null||p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void)return"unknown";if(p.isUnion()){let d=!0,g=!0;for(let F of p.types){let P=k(F,R);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(g=!1),P==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(T(p)){let d=p,g=!1,F=!1;for(let P of d.types){let j=k(P,R);if(j==="unknown")return"unknown";j==="required"?g=!0:j==="optional"&&(F=!0)}return g?"required":F?"optional":"absent"}return h(p)?w(p,R):"unknown"}function N(p){if(p.operator!=="in"||p.left.type===ae.AST_NODE_TYPES.PrivateIdentifier)return;let R=A(p.left);if(!R)return;let d=p.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let F=n.getTypeAtLocation(g),P=k(F,R);P==="required"?e.report({node:p,messageId:"unnecessaryInCondition",data:{property:R,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:p,messageId:"alwaysFalseInCondition",data:{property:R,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(p){l(p),I(p),N(p)},CallExpression(p){S(p),x(p)}}}})};function gt(e){return Array.from(new Set(e)).join(" | ")||"never"}function tt(e,t){let r=e.argument;return r.type===ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Vi(e,t){return t.has(e)}var Tt=require("@typescript-eslint/utils"),St=require("zod/v4");var Ji=Tt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-call-with-explicit-generics",Xi=St.z.object({functions:St.z.array(St.z.string())}),Bi=Ji({name:cr,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[W(Xi)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Tt.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),Xt={name:cr,rule:Bi};var qe=require("@typescript-eslint/utils"),Hi=qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="no-call-with-inferred-generics",Yi=Hi({name:ur,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==qe.AST_NODE_TYPES.Identifier)return;let s=r.get(o.name);if(!s)return;let{minGenerics:i=1,allowAny:l,disallowTypes:c=t.disallowTypes}=s;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(l&&!c)&&n.typeArguments?.params.some(u=>!l&&u.type===qe.AST_NODE_TYPES.TSAnyKeyword||c&&u.type===qe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===qe.AST_NODE_TYPES.Identifier&&c.includes(u.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Bt={name:ur,rule:Yi};var yr=require("@typescript-eslint/utils"),qi=yr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-commented-out-code",Zi=["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:"],Gi=/^\s*return\s+/,Ki=/\w=("|'|`)/,Qi=/\w+:\s*('|"|`)/,eo=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,to=/\w+-\w+:/,no=/\w+_\w+:/,ro=/\?\s+\w/,io=/:\s+\w/,oo=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,so=/^\s*\d+[,}]/,ao=/^\s*\[[^\]]*\][,}]/,lo=/^\s*\{[^}]*\}[,}]/,po=/\.\w+\(/,co=/\[\w+\]/,uo=/^\s*(['"`]).+?\1\s*:/,fo=/^<[A-Z]\w*(\s|>|\/)/,mo=/^<[a-z]+(\s|>|\/)/,yo=/<[A-Z]\w*(\s.*)?>/,go=/<\/[A-Z]\w*>/,So=/<[a-z]+(\s.*)?>/,To=/<\/[a-z]+>/,ho=/^\s*[*\s]*$/,Eo=/^[a-zA-Z]/,bo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,xo=/```[\s\S]*?```/g,Co=/`[^`]*`/g,fr=/[a-zA-Z0-9]/,Io=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Ao=/[{}[\]()`=<>]/,wo=/:\s*(['"`[{(]|\w+\s*=>)/,Ro=/\bif\s*\(|\belse\b|=>/,me={returnStatement:Gi,stringAssignment:Ki,objectPropertyWithQuotes:Qi,computedPropertyAssignment:eo,kebabCaseProperty:to,snakeCaseProperty:no,ternaryOperator:ro,colonWithWord:io,quotedString:oo,numberWithComma:so,arrayWithComma:ao,objectWithComma:lo,methodCall:po,arrayAccess:co,quotedPropertyKey:uo,jsxSelfClosing:fo,jsxElement:mo,jsxOpeningTag:yo,jsxClosingTag:go,htmlOpeningTag:So,htmlClosingTag:To,jsdocComment:ho};function Fo(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Eo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Io.test(t)||Ao.test(t)||wo.test(t)||Ro.test(t)?!1:!!(t.includes(":")&&bo.test(t))}var vo=[") {","return;",me.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",me.stringAssignment,");",me.objectPropertyWithQuotes,me.computedPropertyAssignment,me.kebabCaseProperty,me.snakeCaseProperty,"&&","||","()",me.ternaryOperator,me.colonWithWord,me.quotedString,me.numberWithComma,me.arrayWithComma,me.objectWithComma,me.methodCall,me.arrayAccess,"?.(","??","=>",me.quotedPropertyKey],ko=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],mr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Po=qi({name:dr,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")||me.jsdocComment.test(n))return!1;for(let i of mr)if(s.startsWith(i))return!1;if(n.includes("https://")||Fo(s))return!1;if(o==="Block"){for(let i of ko)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Zi)if(s.startsWith(i))return{wrongPattern:i};for(let i of vo)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 a=s.split(xo);a.some(m=>fr.test(m))&&(s=a.join(""))}if(!s.includes("`"))return s;let l=s.split(Co);return l.some(a=>fr.test(a))?l.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),l=t(i,s.type);l&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:l.wrongPattern,allowedPrefixes:mr.join(", ")}})}}}}}),Ht={name:dr,rule:Po};var ht=require("@typescript-eslint/utils"),Oo=ht.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="no-default-export",No=Oo({name:gr,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===ht.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Yt={name:gr,rule:No};var Sr=require("@typescript-eslint/utils"),Do=Sr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-leaked-text-in-jsx",jo=[",",";","[","]","(",")"],Lo=Do({name:Tr,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="";jo.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),qt={name:Tr,rule:Lo};var He=require("@typescript-eslint/utils"),Mo=He.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-non-camel-case-functions",_o=/^(\$?[a-z][a-zA-Z0-9]*)$/;function hr(e){if(e.typeName.type!==He.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===He.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var $o=Mo({name:Er,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&&!_o.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===He.AST_NODE_TYPES.TSTypeReference?hr(r):r.type===He.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===He.AST_NODE_TYPES.TSTypeReference&&hr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Zt={name:Er,rule:$o};var se=require("@typescript-eslint/utils");var Uo=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="no-optional-root-props",zo=Uo({name:br,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 l of zt(i.identifier)){if("returnType"in l||l.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let c=l.parent;if(!c)return!1;if(c.type===se.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&c.parent.type===se.TSESTree.AST_NODE_TYPES.TSTypeReference&&c.parent.typeName.type===se.TSESTree.AST_NODE_TYPES.Identifier&&c.parent.typeName.name==="FC"){let u=et(c.parent.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Et(u,e.sourceCode);return m?!(m.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(l.type===se.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(c.type===se.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let a=et(c,se.TSESTree.AST_NODE_TYPES.VariableDeclaration);return a?!!Et(a,e.sourceCode):!1}if(c.type===se.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Et(c,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=et(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&&!(bt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(bt(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=et(n.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=Et(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 c of o.members)c.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(c)}}}});function bt(e){return e?e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Et(e,t){if(bt(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])&&!bt(s[0].identifier.parent.parent))return s[0].identifier}var Gt={name:br,rule:zo};var lt=require("@typescript-eslint/utils");var pt=Y({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===lt.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===lt.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===lt.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===lt.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var xr=require("@typescript-eslint/utils"),xt=ke(require("path")),ze=require("zod/v4");var Wo=xr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-relative-imports",Vo=ze.z.object({find:ze.z.string(),replacement:ze.z.string()}),Jo=ze.z.object({aliases:ze.z.array(Vo),rootDir:ze.z.string().optional(),allowNotFoundAliases:ze.z.boolean().optional(),_dev_simulateFileName:ze.z.string().optional()}),Xo=Wo({name:Cr,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:[W(Jo)]},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,l){let c=xt.default.dirname(l);return xt.default.resolve(c,i)}function s(i){let l=t.rootDir??process.cwd(),c=xt.default.relative(l,i);if(c.startsWith("."))return null;c.startsWith("/")||(c=`/${c}`);for(let{find:a,replacement:u}of t.aliases)if(c.startsWith(u)){let m=c.replace(u,a);return{alias:a,newPath:m}}return null}return{ImportDeclaration(i){let l=i.source.value;if(!n(l))return;let c=o(l,r),a=s(c);!a&&t.allowNotFoundAliases||e.report({node:i,messageId:a?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:a?.alias},fix:a?u=>u.replaceText(i.source,`'${a.newPath}'`):void 0})}}}}),Kt={name:Cr,rule:Xo};var ye=require("@typescript-eslint/utils"),Qt=require("zod/v4");var Bo=Qt.z.object({customMessage:Qt.z.string().optional()}),en=Y({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[W(Bo)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ye.AST_NODE_TYPES.Literal:return!0;case ye.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ye.AST_NODE_TYPES.Property?o.computed||o.value.type===ye.AST_NODE_TYPES.Identifier&&o.key.type===ye.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ye.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ye.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ye.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ye.AST_NODE_TYPES.ConditionalExpression:case ye.AST_NODE_TYPES.LogicalExpression:case ye.AST_NODE_TYPES.BinaryExpression:case ye.AST_NODE_TYPES.UnaryExpression:case ye.AST_NODE_TYPES.CallExpression:case ye.AST_NODE_TYPES.MemberExpression:case ye.AST_NODE_TYPES.Identifier:case ye.AST_NODE_TYPES.ArrowFunctionExpression:case ye.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ye.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ye.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ye.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ye.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var ct=require("@typescript-eslint/utils"),Ze=ke(require("zod/v4"));var Ho=Ze.object({alternativeMsgs:Ze.object({inArrayFind:Ze.string().optional(),inArrayFilter:Ze.string().optional()}).optional(),__dev_simulateFileName:Ze.string().optional()});function Yo(e){return e.typeAnnotation.type!==ct.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var qo=/(typeGuards|type-guards)\.(ts|tsx)$/;function Zo(e){return qo.test(e)}function Go(e){let t=e.parent;for(;t;){if(t.type===ct.AST_NODE_TYPES.CallExpression&&t.callee.type===ct.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===ct.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var tn=Y({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:[W(Ho)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Zo(r))return{};function n(o){if(!Yo(o))return;let s=Go(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,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 Ge=require("@typescript-eslint/utils");var Ko="no-unnecessary-async-on-jsx-props";function Qo(e){if(e.body.type!==Ge.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!==Ge.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ge.AST_NODE_TYPES.AwaitExpression}var nn=Y({name:Ko,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){Qo(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,s=[],i=o.getFirstToken(r,c=>c.value==="async");if(i){let c=o.getTokenAfter(i);c?s.push(n.replaceTextRange([i.range[0],c.range[0]],"")):s.push(n.remove(i))}function l(c){if(c.type===Ge.AST_NODE_TYPES.AwaitExpression){let a=o.getFirstToken(c);if(a&&a.value==="await"){let u=o.getTokenAfter(a);u?s.push(n.replaceTextRange([a.range[0],u.range[0]],"")):s.push(n.remove(a))}}if(c.type===Ge.AST_NODE_TYPES.BlockStatement)for(let a of c.body)l(a);else c.type===Ge.AST_NODE_TYPES.ExpressionStatement&&l(c.expression)}return l(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var We=require("@typescript-eslint/utils"),rn=ke(require("typescript")),nt=ke(require("zod/v4"));var es=We.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ir="no-unnecessary-casting",ts=nt.default.object({additionalCastFunctions:nt.default.array(nt.default.object({name:nt.default.string(),expectedType:nt.default.enum(["string","number"])})).optional()}),on={name:Ir,rule:es({name:Ir,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:[W(ts)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=We.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case We.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case We.AST_NODE_TYPES.TemplateLiteral:return m==="string";case We.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function l(u,m){return m==="number"?!!(u.flags&rn.TypeFlags.NumberLike):!!(u.flags&rn.TypeFlags.StringLike)}function c(u,m){return y=>y.replaceText(u,e.sourceCode.getText(m))}function a(u){if(!s||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===We.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==We.AST_NODE_TYPES.Identifier)return;let C=y.name,f=n.find(x=>x.name===C);if(!f)return;if(i(m,f.expectedType)||l(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),f.expectedType)){let x,S;C==="Number"?x="unnecessaryNumberCasting":C==="String"?x="unnecessaryStringCasting":(x="unnecessaryCustomCasting",S={name:f.name,type:f.expectedType}),e.report({node:u,messageId:x,...S?{data:S}:{},fix:c(u,m)})}}return{CallExpression:a}}})};var we=require("@typescript-eslint/utils"),Ct=ke(require("zod/v4"));var ns=Ct.object({ignoreWithDescription:Ct.string().optional()}),sn=Y({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:[W(ns)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(c){let a=c.arguments[0];return a&&a.type===we.AST_NODE_TYPES.Literal&&typeof a.value=="string"?a.value:null}function s(c){return!c||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(c)}function i(c){return c.length!==1?!1:n.body.filter(u=>{if(u.type===we.AST_NODE_TYPES.ExpressionStatement){let m=u.expression;if(m.type===we.AST_NODE_TYPES.CallExpression&&m.callee.type===we.AST_NODE_TYPES.Identifier){let y=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function l(c){let a=c.arguments[1];if(a&&(a.type===we.AST_NODE_TYPES.FunctionExpression||a.type===we.AST_NODE_TYPES.ArrowFunctionExpression)&&a.body.type===we.AST_NODE_TYPES.BlockStatement){let u=a.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=c.acquire(I),k=new Set,N=null;{let v=w.upper;for(;v&&(k.add(v),v.type!=="function");)v=v.upper;if(!v)return;N=v}let p=Array.isArray;function R(v){if(!p(v.defs))return!1;let O=v.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let $=O.node.init;if($==null)return!1;for(;$.type==="TSAsExpression";)$=$.expression;let z=O.node.parent;if(z==null&&(Ut(N.block,O.node.id),z=O.node.parent,z==null))return!1;if(z.kind==="const"&&$.type==="Literal"&&(typeof $.value=="string"||typeof $.value=="number"||$.value===null))return!0;if($.type!=="CallExpression")return!1;let B=$.callee;if(B.type==="MemberExpression"&&B.object.name==="React"&&B.property!=null&&!B.computed&&(B=B.property),B.type!=="Identifier")return!1;let V=O.node.id,{name:Q}=B;if(Q==="useRef"&&V.type==="Identifier")return!0;if($i(B)&&V.type==="Identifier"){for(let ee of v.references)ee!==V&&C.add(ee.identifier);return!0}else if(Q==="useState"||Q==="useReducer"){if(V.type==="ArrayPattern"&&V.elements.length===2&&p(v.identifiers)){if(V.elements[1]===v.identifiers[0]){if(Q==="useState"){let ee=v.references,ve=0;for(let $e=0;$e<ee.length;$e++){if(ee[$e].isWrite()&&ve++,ve>1)return!1;a.set(ee[$e].identifier,V.elements[0])}}return!0}else if(V.elements[0]===v.identifiers[0]){if(Q==="useState"){let ee=v.references;for(let ve=0;ve<ee.length;ve++)u.add(ee[ve].identifier)}return!1}}}else if(Q==="useTransition"&&V.type==="ArrayPattern"&&V.elements.length===2&&Array.isArray(v.identifiers)&&V.elements[1]===v.identifiers[0])return!0;return!1}function d(v){if(!p(v.defs))return!1;let O=v.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let $=O.node,z=N.childScopes,B=null,V;for(V=0;V<z.length;V++){let Q=z[V],ee=Q.block;if($.type==="FunctionDeclaration"&&ee===$||$.type==="VariableDeclarator"&&ee.parent===$){B=Q;break}}if(B==null)return!1;for(V=0;V<B.through.length;V++){let Q=B.through[V];if(Q.resolved!=null&&k.has(Q.resolved.scope)&&!g(Q.resolved))return!1}return!0}let g=f(R,m),F=f(d,y),P=new Map;function j(v){let O=v.from,$=!1;for(;O.block!==I;)O.type==="function"&&($=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return $}let J=new Map,G=new Map;Y(w);function Y(v){for(let O of v.references){if(!O.resolved||!k.has(O.resolved.scope))continue;let $=Ut(I,O.identifier),z=or($),B=Ue(z,G);if(b&&z.type==="Identifier"&&(z.parent.type==="MemberExpression"||z.parent.type==="OptionalMemberExpression")&&!z.parent.computed&&z.parent.property.type==="Identifier"&&z.parent.property.name==="current"&&j(O)&&P.set(B,{reference:O,dependencyNode:z}),z.parent.type==="TSTypeQuery"||z.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(J.has(B))J.get(B).references.push(O);else{let Q=O.resolved,ee=g(Q)||F(Q);J.set(B,{isStable:ee,references:[O]})}}for(let O of v.childScopes)Y(O)}P.forEach(({reference:v,dependencyNode:O},$)=>{let z=v.resolved.references,B=!1;for(let V=0;V<z.length;V++){let{identifier:Q}=z[V],{parent:ee}=Q;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){B=!0;break}}B||l({node:O.parent.property,message:`The ref value '${$}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${$}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(v,O){D.has(O)||(D.add(O),l({node:v,message:`Assignments to the '${O}' variable from inside React Hook ${r(T)} 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(T)}.`}))}let q=new Set;if(J.forEach(({isStable:v,references:O},$)=>{v&&q.add($),O.forEach(z=>{z.writeExpr&&Z(z.writeExpr,$)})}),D.size>0)return;if(!A){let v=null;if(J.forEach(({isStable:O,references:$},z)=>{v||$.forEach(B=>{if(v)return;let V=B.identifier;if(!a.has(V))return;let ee=B.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(v=z)})}),v){let{suggestedDependencies:O}=_t({dependencies:J,declaredDependencies:[],stableDependencies:q,externalDependencies:new Set,isEffect:!0});l({node:T,message:`React Hook ${h} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${h} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix($){return $.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ue=[],fe=new Set;A.type!=="ArrayExpression"?l({node:A,message:`React Hook ${r(T)} 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(v=>{if(v===null)return;if(v.type==="SpreadElement"){l({node:v,message:`React Hook ${r(T)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}C.has(v)&&l({node:v,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(v)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(v)}\``,fix(B){return B.removeRange(v.range)}}]});let O;try{O=Ue(v,G)}catch(B){if(/Unsupported node type/.test(B.message)){v.type==="Literal"?J.has(v.value)?l({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. Did you mean to include ${v.value} in the array instead?`}):l({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):l({node:v,message:`React Hook ${r(T)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw B}let $=v;for(;$.type==="MemberExpression"||$.type==="OptionalMemberExpression"||$.type==="ChainExpression";)$=$.object||$.expression.object;let z=!N.through.some(B=>B.identifier===$);ue.push({key:O,node:v}),z||fe.add(O)});let{suggestedDependencies:Fe,unnecessaryDependencies:Je,missingDependencies:Se,duplicateDependencies:lt}=_t({dependencies:J,declaredDependencies:ue,stableDependencies:q,externalDependencies:fe,isEffect:b}),et=Fe;if(lt.size+Se.size+Je.size===0){if(t)return;ji({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:O,isUsedOutsideOfHook:$,depType:z})=>{let B=z==="function"?"useCallback":"useMemo",V=z==="function"?"definition":"initialization",Q=`wrap the ${V} of '${O.name.name}' in its own ${B}() Hook.`,ee=$?`To fix this, ${Q}`:`Move it inside the ${h} callback. Alternatively, ${Q}`,ve=z==="conditional"||z==="logical expression"?"could make":"makes",$e=`The '${O.name.name}' ${z} ${ve} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Yn;$&&O.type==="Variable"&&z==="function"&&(Yn=[{desc:`Wrap the ${V} of '${O.name.name}' in its own ${B}() Hook.`,fix(qn){let[Ti,hi]=B==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[qn.insertTextBefore(O.node.init,Ti),qn.insertTextAfter(O.node.init,hi)]}}]),l({node:O.node,message:$e,suggest:Yn})});return}!b&&Se.size>0&&(et=_t({dependencies:J,declaredDependencies:[],stableDependencies:q,externalDependencies:fe,isEffect:b}).suggestedDependencies);function Ee(){if(ue.length===0)return!0;let v=ue.map($=>$.key),O=v.slice().sort();return v.join(",")===O.join(",")}Ee()&&et.sort();function Ie(v){let O=v.split("."),$="";for(let z=0;z<O.length;z++){if(z!==0){let B=O.slice(0,z+1).join("."),V=G.get(B)===!0;$+=V?"?.":"."}$+=O[z]}return $}function Dt(v,O,$,z){return v.size===0?null:(v.size>1?"":O+" ")+$+" "+(v.size>1?"dependencies":"dependency")+": "+Mi(Array.from(v).sort().map(B=>"'"+Ie(B)+"'"))+`. Either ${z} ${v.size>1?"them":"it"} or remove the dependency array.`}let Oe="";if(Je.size>0){let v=null;if(Array.from(Je.keys()).forEach(O=>{v===null&&O.endsWith(".current")&&(v=O)}),v!==null)Oe=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(fe.size>0){let O=Array.from(fe)[0];w.set.has(O)||(Oe=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Oe&&Se.has("props")){let v=J.get("props");if(v==null)return;let O=v.references;if(!Array.isArray(O))return;let $=!0;for(let z=0;z<O.length;z++){let B=O[z],V=Ut(N.block,B.identifier);if(!V){$=!1;break}let Q=V.parent;if(Q==null){$=!1;break}if(Q.type!=="MemberExpression"&&Q.type!=="OptionalMemberExpression"){$=!1;break}}$&&(Oe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${h} call and refer to those specific props inside ${r(T)}.`)}if(!Oe&&Se.size>0){let v=null;Se.forEach(O=>{if(v)return;let $=N.set.get(O),z=J.get(O);if(z.references[0].resolved!==$)return;let B=$.defs[0];if(B==null||B.name==null||B.type!=="Parameter")return;let V=!1,Q;for(let ee=0;ee<z.references.length;ee++)if(Q=z.references[ee].identifier,Q!=null&&Q.parent!=null&&(Q.parent.type==="CallExpression"||Q.parent.type==="OptionalCallExpression")&&Q.parent.callee===Q){V=!0;break}V&&(v=O)}),v!==null&&(Oe=` If '${v}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Oe&&Se.size>0){let v=null;if(Se.forEach(O=>{if(v!==null)return;let z=J.get(O).references,B,V;for(let Q=0;Q<z.length;Q++){for(B=z[Q].identifier,V=B.parent;V!=null&&V!==N.block;){if(V.type==="CallExpression"){let ee=a.get(V.callee);if(ee!=null){if(ee.name===O)v={missingDep:O,setter:V.callee.name,form:"updater"};else if(u.has(B))v={missingDep:O,setter:V.callee.name,form:"reducer"};else{let ve=z[Q].resolved;if(ve!=null){let $e=ve.defs[0];$e!=null&&$e.type==="Parameter"&&(v={missingDep:O,setter:V.callee.name,form:"inlineReducer"})}}break}}V=V.parent}if(v!==null)break}}),v!==null)switch(v.form){case"reducer":Oe=` You can also replace multiple useState variables with useReducer if '${v.setter}' needs the current value of '${v.missingDep}'.`;break;case"inlineReducer":Oe=` If '${v.setter}' needs the current value of '${v.missingDep}', you can also switch to useReducer instead of useState and read '${v.missingDep}' in the reducer.`;break;case"updater":Oe=` You can also do a functional update '${v.setter}(${v.missingDep.slice(0,1)} => ...)' if you only need '${v.missingDep}' in the '${v.setter}' call.`;break;default:throw new Error("Unknown case.")}}l({node:A,message:`React Hook ${r(T)} has `+(Dt(Se,"a","missing","include")||Dt(Je,"an","unnecessary","exclude")||Dt(lt,"a","duplicate","omit"))+Oe,suggest:[{desc:`Update the dependencies array to be: [${et.map(Ie).join(", ")}]`,fix(v){return v.replaceText(A,`[${et.map(Ie).join(", ")}]`)}}]})}function x(I){let A=Li(I.callee,i);if(A===-1)return;let T=I.arguments[A],h=I.callee,b=sr(h).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!T){l({node:h,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!k)){if(!w&&!k){(b==="useMemo"||b==="useCallback")&&l({node:h,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(T.type){case"FunctionExpression":case"ArrowFunctionExpression":E(T,w,h,b,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(R=>R&&R.type==="Identifier"&&R.name===T.name))return;let N=n(I).set.get(T.name);if(N==null||N.defs==null)return;let p=N.defs[0];if(!p||!p.node||p.type!=="Variable"&&p.type!=="FunctionName")break;switch(p.node.type){case"FunctionDeclaration":E(p.node,w,h,b,k);return;case"VariableDeclarator":let R=p.node.init;if(!R)break;switch(R.type){case"ArrowFunctionExpression":case"FunctionExpression":E(R,w,h,b,k);return}break}break;default:l({node:h,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}l({node:h,message:`React Hook ${b} has a missing dependency: '${T.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${T.name}]`,fix(N){return N.replaceText(w,`[${T.name}]`)}}]})}}let S=!!e.options[0]?.reactCompilerIsEnabled;if(e.options[0]?.ignoreIfReactCompilerIsEnabled||S){for(let I of e.sourceCode.getAllComments())if(S||Di.test(I.value))return t=!0,{CallExpression:A=>x(A,!0)}}return{CallExpression:I=>x(I)}}};function _t({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((E,x)=>{let S=l(s,x);S.isUsed=!0,c(s,x,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:E})=>{let x=l(s,E);x.isSatisfiedRecursively=!0}),r.forEach(E=>{let x=l(s,E);x.isSatisfiedRecursively=!0});function l(E,x){let S=x.split("."),I=E;for(let A of S){let T=I.children.get(A);T||(T=i(),I.children.set(A,T)),I=T}return I}function c(E,x,S){let I=x.split("."),A=E;for(let T of I){let h=A.children.get(T);if(!h)return;S(h),A=h}}let a=new Set,u=new Set;m(s,a,u,E=>E);function m(E,x,S,I){E.children.forEach((A,T)=>{let h=I(T);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(h);return}if(A.isUsed){x.add(h);return}m(A,x,S,b=>h+"."+b)})}let y=[],C=new Set,f=new Set;return t.forEach(({key:E})=>{u.has(E)?y.indexOf(E)===-1?y.push(E):f.add(E):C.add(E)}),a.forEach(E=>{y.push(E)}),{suggestedDependencies:y,unnecessaryDependencies:C,duplicateDependencies:f,missingDependencies:a}}function Be(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return Be(e.consequent)!=null||Be(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Be(e.left)!=null||Be(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Be(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Be(e.expression);case"TSAsExpression":return Be(e.expression)}return null}function ji({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let l=r.variables.find(a=>a.name===i);if(l==null)return null;let c=l.defs[0];if(c==null)return null;if(c.type==="Variable"&&c.node.type==="VariableDeclarator"&&c.node.id.type==="Identifier"&&c.node.init!=null){let a=Be(c.node.init);if(a!=null)return[l,a]}return c.type==="FunctionName"&&c.node.type==="FunctionDeclaration"?[l,"function"]:c.type==="ClassName"&&c.node.type==="ClassDeclaration"?[l,"class"]:null}).filter(Boolean);function s(i){let l=!1;for(let c=0;c<i.references.length;c++){let a=i.references[c];if(a.writeExpr){if(l)return!0;l=!0;continue}let u=a.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!ar(t,a.identifier))return!0}return!1}return o.map(([i,l])=>({construction:i.defs[0],depType:l,isUsedOutsideOfHook:s(i)}))}function or(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)?or(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function $t(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Ue(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=Ue(e.object,t),n=Ue(e.property,null),o=`${r}.${n}`;return $t(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ue(e.object,t),n=Ue(e.property,null),o=`${r}.${n}`;return $t(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=Ue(r.object,t),o=Ue(r.property,null),s=`${n}.${o}`;return $t(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 Li(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=Ue(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 Ut(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),_i(n,t))return n;if(ar(n,t))for(let[o,s]of Object.entries(n))o!=="parent"&&(rr(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{rr(i)&&(i.parent=n,r.push(i))}))}return null}function Mi(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 rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function _i(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 ar(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function $i(e){return!1}var ae=require("@typescript-eslint/utils"),X=ke(require("typescript")),Jt=require("zod/v4");var zt=require("@typescript-eslint/utils");function tt(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:tt(e.parent,t,r===1/0?r:r-1)}function*Wt(e){yield e,e.parent&&(yield*Wt(e.parent))}function Vt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function pr(e,t,r){let o=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===zt.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===zt.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return o?o.references.filter(s=>!s.init):[]}function lr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ui(e,t){return e[t]}function Ne(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 c=n[i.type];if(c)for(let a of c){let u=Ui(i,a);if(u){if(Array.isArray(u)){for(let m of u)if(lr(m)&&s(m))return!0}else if(lr(u)&&s(u))return!0}}return!1}s(e)}var zi=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="improved-no-unnecessary-condition",Wi=Jt.z.object({alternativeForInCondition:Jt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),ur={object:"Array",property:"isArray"},Vi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ji=new Set(Vi),Xt={name:cr,rule:zi({name:cr,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:[W(Wi)]},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(p){return p.type===ae.AST_NODE_TYPES.UnaryExpression&&p.operator==="typeof"}function s(p){return p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown?null:p.flags&X.default.TypeFlags.StringLike?["string"]:p.flags&X.default.TypeFlags.NumberLike?["number"]:p.flags&X.default.TypeFlags.BigIntLike?["bigint"]:p.flags&X.default.TypeFlags.BooleanLike?["boolean"]:p.flags&X.default.TypeFlags.ESSymbolLike?["symbol"]:p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void?["undefined"]:p.flags&X.default.TypeFlags.Null?["object"]:p.getCallSignatures().length>0?["function"]:p.flags&X.default.TypeFlags.Object?p.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:p.flags&X.default.TypeFlags.NonPrimitive?["object"]:p.flags&X.default.TypeFlags.Never?["never"]:null}function i(p){if(!n)return null;let R=r.esTreeNodeToTSNodeMap.get(p),d=n.getTypeAtLocation(R.expression);if(d.flags&X.default.TypeFlags.Any||d.flags&X.default.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let P of d.types){let j=s(P);if(j)g.push(...j);else return null}return g}let F=s(d);return F?(g.push(...F),g):null}function l(p){if(!(p.operator==="==="||p.operator==="!=="))return;let d=null,g=null;if(o(p.left)?(d=p.left,g=p.right.type===ae.AST_NODE_TYPES.Literal&&typeof p.right.value=="string"?p.right.value:null):o(p.right)&&(d=p.right,g=p.left.type===ae.AST_NODE_TYPES.Literal&&typeof p.left.value=="string"?p.left.value:null),!d||!g||!Xi(g,Ji))return;let F=i(d);if(!F)return;let P=p.operator==="!==",j=F.includes(g);F.length===1?j&&!P?e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:nt(d,e),type:g}}):!j&&P?e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:nt(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:nt(d,e),actualType:St(F),conditionType:g}}):j&&P&&e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:nt(d,e),actualType:St(F),conditionType:g}}):!j&&!P?e.report({node:p,messageId:"alwaysFalseTypeofCondition",data:{name:nt(d,e),actualType:St(F),conditionType:g}}):!j&&P&&e.report({node:p,messageId:"unnecessaryTypeofCondition",data:{name:nt(d,e),type:St(F)}})}function c(p){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown)return null;if(p.isUnion()){let R=[];for(let d of p.types)if(d.flags&X.default.TypeFlags.StringLiteral){let g=d.value;R.push(g)}else return null;return R}return p.flags&X.default.TypeFlags.StringLiteral?[p.value]:null}function a(p){if(!n)return null;let R=r.esTreeNodeToTSNodeMap.get(p),d=n.getTypeAtLocation(R),g=c(d);if(g)return g;let F=n.getSymbolAtLocation(R);if(F){let P=n.getTypeOfSymbolAtLocation(F,R),j=c(P);if(j)return j}return null}function u(p){let R=e.sourceCode.ast,d=null;return Ne(R,g=>{if(g.type===ae.AST_NODE_TYPES.VariableDeclarator&&g.id.type===ae.AST_NODE_TYPES.Identifier&&g.id.name===p.name&&g.id.typeAnnotation){let F=g.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 m(p){return p==="Array"||p==="ReadonlyArray"?!0:p.endsWith(".Array")||p.endsWith(".ReadonlyArray")}function y(p){if(!n)return!1;if(n.isArrayType(p)||n.isTupleType(p))return!0;let R=n.getApparentType(p);if(R!==p&&(n.isArrayType(R)||n.isTupleType(R)))return!0;if(p.aliasSymbol){let g=n.getFullyQualifiedName(p.aliasSymbol);if(m(g))return!0}let d=p.getSymbol();if(d){let g=n.getFullyQualifiedName(d);if(m(g))return!0}return!1}function C(p){if(!n)return!1;if(p.flags&X.default.TypeFlags.StringLike||p.flags&X.default.TypeFlags.NumberLike||p.flags&X.default.TypeFlags.BigIntLike||p.flags&X.default.TypeFlags.BooleanLike||p.flags&X.default.TypeFlags.ESSymbolLike||p.flags&X.default.TypeFlags.EnumLike||p.flags&X.default.TypeFlags.Null||p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void||p.flags&X.default.TypeFlags.Never)return!0;let R=p.getSymbol();if(R){let d=n.getFullyQualifiedName(R);if(d==="__function"||d==="__object"&&!y(p))return!0}return!1}function f(p){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown)return"unknown";if(p.isUnion()){let R=!0,d=!0;for(let g of p.types){let F=f(g);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(R=!1),F!=="alwaysFalse"&&(d=!1)}return R?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(p)?"alwaysTrue":C(p)?"alwaysFalse":"unknown"}function E(p){return!p.computed&&p.object.type===ae.AST_NODE_TYPES.Identifier&&p.object.name===ur.object&&p.property.type===ae.AST_NODE_TYPES.Identifier&&p.property.name===ur.property}function x(p){if(!n||p.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!E(p.callee)||p.arguments.length===0)return;let[R]=p.arguments;if(!R||R.type===ae.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(R),g=n.getTypeAtLocation(d),F=f(g);F==="alwaysTrue"?e.report({node:p,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:p,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(p){if(p.callee.type!==ae.AST_NODE_TYPES.MemberExpression||p.callee.property.type!==ae.AST_NODE_TYPES.Identifier||p.callee.computed)return;let R=p.callee.property.name;if(R!=="startsWith"&&R!=="endsWith"&&R!=="includes"||p.arguments.length!==1)return;let[d]=p.arguments;if(!d||d.type!==ae.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let g=p.callee.object,F=a(g);if(!F&&g.type===ae.AST_NODE_TYPES.Identifier&&(F=u(g)),!F||F.length===0)return;let P=d.value;if(R==="includes"&&F.length>1)return;let j=0,J=0;for(let G of F)if((R==="startsWith"?G.startsWith(P):R==="endsWith"?G.endsWith(P):G.includes(P))?j++:J++,j>0&&J>0)return;if(j>0&&J===0){let G=R==="startsWith"?"unnecessaryStartsWithCondition":R==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:p,messageId:G})}else if(J>0&&j===0){let G=R==="startsWith"?"alwaysFalseStartsWithCondition":R==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:p,messageId:G})}}function I(p){if(!new Set(["===","!==",">",">=","<","<="]).has(p.operator))return;function d(Y){if(Y.type!==ae.AST_NODE_TYPES.MemberExpression||Y.computed||Y.property.type!==ae.AST_NODE_TYPES.Identifier||Y.property.name!=="length")return null;let D=Y.object,Z=a(D);if(!Z||Z.length===0)return null;let q=[];for(let ue of Z)q.push(ue.length);return{values:q}}let g=d(p.left),F=d(p.right),P=null,j=null;if(g?p.right.type===ae.AST_NODE_TYPES.Literal&&typeof p.right.value=="number"&&(P=g.values,j=p.right.value):F&&p.left.type===ae.AST_NODE_TYPES.Literal&&typeof p.left.value=="number"&&(P=F.values,j=p.left.value),!P||j===null)return;let J=0,G=0;for(let Y of P){let D=!1;if(p.operator==="==="?D=Y===j:p.operator==="!=="?D=Y!==j:p.operator===">"?D=Y>j:p.operator===">="?D=Y>=j:p.operator==="<"?D=Y<j:p.operator==="<="&&(D=Y<=j),D?J++:G++,J>0&&G>0)return}J>0&&G===0?e.report({node:p,messageId:"unnecessaryLengthCondition"}):G>0&&J===0&&e.report({node:p,messageId:"alwaysFalseLengthCondition"})}function A(p){if(p.type===ae.AST_NODE_TYPES.Literal&&typeof p.value=="string")return p.value;let R=a(p);if(!R||R.length!==1)return null;let[d]=R;return d??null}function T(p){return(p.flags&X.default.TypeFlags.Intersection)!==0}function h(p){return(p.flags&X.default.TypeFlags.Object)!==0}function b(p){return!n||n.getIndexTypeOfType(p,X.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(p,X.default.IndexKind.Number)}function w(p,R){if(!n||b(p)||p.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(p,R);return d?d.flags&X.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(p,R){if(p.flags&X.default.TypeFlags.Any||p.flags&X.default.TypeFlags.Unknown||p.flags&X.default.TypeFlags.Never||p.flags&X.default.TypeFlags.TypeParameter||p.flags&X.default.TypeFlags.IndexedAccess||p.flags&X.default.TypeFlags.StringLike||p.flags&X.default.TypeFlags.NumberLike||p.flags&X.default.TypeFlags.BigIntLike||p.flags&X.default.TypeFlags.BooleanLike||p.flags&X.default.TypeFlags.EnumLike||p.flags&X.default.TypeFlags.ESSymbolLike||p.flags&X.default.TypeFlags.NonPrimitive||p.flags&X.default.TypeFlags.Null||p.flags&X.default.TypeFlags.Undefined||p.flags&X.default.TypeFlags.Void)return"unknown";if(p.isUnion()){let d=!0,g=!0;for(let F of p.types){let P=k(F,R);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(g=!1),P==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(T(p)){let d=p,g=!1,F=!1;for(let P of d.types){let j=k(P,R);if(j==="unknown")return"unknown";j==="required"?g=!0:j==="optional"&&(F=!0)}return g?"required":F?"optional":"absent"}return h(p)?w(p,R):"unknown"}function N(p){if(p.operator!=="in"||p.left.type===ae.AST_NODE_TYPES.PrivateIdentifier)return;let R=A(p.left);if(!R)return;let d=p.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let F=n.getTypeAtLocation(g),P=k(F,R);P==="required"?e.report({node:p,messageId:"unnecessaryInCondition",data:{property:R,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:p,messageId:"alwaysFalseInCondition",data:{property:R,type:n.typeToString(F),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(p){l(p),I(p),N(p)},CallExpression(p){S(p),x(p)}}}})};function St(e){return Array.from(new Set(e)).join(" | ")||"never"}function nt(e,t){let r=e.argument;return r.type===ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Xi(e,t){return t.has(e)}var ht=require("@typescript-eslint/utils"),Tt=require("zod/v4");var Bi=ht.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-call-with-explicit-generics",Hi=Tt.z.object({functions:Tt.z.array(Tt.z.string())}),Yi=Bi({name:fr,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[W(Hi)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===ht.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),Bt={name:fr,rule:Yi};var qe=require("@typescript-eslint/utils"),qi=qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-call-with-inferred-generics",Zi=qi({name:mr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==qe.AST_NODE_TYPES.Identifier)return;let s=r.get(o.name);if(!s)return;let{minGenerics:i=1,allowAny:l,disallowTypes:c=t.disallowTypes}=s;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(l&&!c)&&n.typeArguments?.params.some(u=>!l&&u.type===qe.AST_NODE_TYPES.TSAnyKeyword||c&&u.type===qe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===qe.AST_NODE_TYPES.Identifier&&c.includes(u.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Ht={name:mr,rule:Zi};var gr=require("@typescript-eslint/utils"),Gi=gr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-commented-out-code",Ki=["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:"],Qi=/^\s*return\s+/,eo=/\w=("|'|`)/,to=/\w+:\s*('|"|`)/,no=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,ro=/\w+-\w+:/,io=/\w+_\w+:/,oo=/\?\s+\w/,so=/:\s+\w/,ao=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,lo=/^\s*\d+[,}]/,po=/^\s*\[[^\]]*\][,}]/,co=/^\s*\{[^}]*\}[,}]/,uo=/\.\w+\(/,fo=/\[\w+\]/,mo=/^\s*(['"`]).+?\1\s*:/,yo=/^<[A-Z]\w*(\s|>|\/)/,go=/^<[a-z]+(\s|>|\/)/,So=/<[A-Z]\w*(\s.*)?>/,To=/<\/[A-Z]\w*>/,ho=/<[a-z]+(\s.*)?>/,Eo=/<\/[a-z]+>/,bo=/^\s*[*\s]*$/,xo=/^[a-zA-Z]/,Co=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Io=/```[\s\S]*?```/g,Ao=/`[^`]*`/g,yr=/[a-zA-Z0-9]/,wo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Ro=/[{}[\]()`=<>]/,Fo=/:\s*(['"`[{(]|\w+\s*=>)/,vo=/\bif\s*\(|\belse\b|=>/,me={returnStatement:Qi,stringAssignment:eo,objectPropertyWithQuotes:to,computedPropertyAssignment:no,kebabCaseProperty:ro,snakeCaseProperty:io,ternaryOperator:oo,colonWithWord:so,quotedString:ao,numberWithComma:lo,arrayWithComma:po,objectWithComma:co,methodCall:uo,arrayAccess:fo,quotedPropertyKey:mo,jsxSelfClosing:yo,jsxElement:go,jsxOpeningTag:So,jsxClosingTag:To,htmlOpeningTag:ho,htmlClosingTag:Eo,jsdocComment:bo};function ko(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&xo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||wo.test(t)||Ro.test(t)||Fo.test(t)||vo.test(t)?!1:!!(t.includes(":")&&Co.test(t))}var Po=[") {","return;",me.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",me.stringAssignment,");",me.objectPropertyWithQuotes,me.computedPropertyAssignment,me.kebabCaseProperty,me.snakeCaseProperty,"&&","||","()",me.ternaryOperator,me.colonWithWord,me.quotedString,me.numberWithComma,me.arrayWithComma,me.objectWithComma,me.methodCall,me.arrayAccess,"?.(","??","=>",me.quotedPropertyKey],Oo=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],dr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],No=Gi({name:Sr,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")||me.jsdocComment.test(n))return!1;for(let i of dr)if(s.startsWith(i))return!1;if(n.includes("https://")||ko(s))return!1;if(o==="Block"){for(let i of Oo)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 Ki)if(s.startsWith(i))return{wrongPattern:i};for(let i of Po)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 a=s.split(Io);a.some(m=>yr.test(m))&&(s=a.join(""))}if(!s.includes("`"))return s;let l=s.split(Ao);return l.some(a=>yr.test(a))?l.join(""):s}return{Program(){let o=e.sourceCode.getAllComments();for(let s of o){let i=r(s.value,s.type),l=t(i,s.type);l&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:l.wrongPattern,allowedPrefixes:dr.join(", ")}})}}}}}),Yt={name:Sr,rule:No};var Et=require("@typescript-eslint/utils"),Do=Et.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-default-export",jo=Do({name:Tr,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===Et.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),qt={name:Tr,rule:jo};var hr=require("@typescript-eslint/utils"),Lo=hr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-leaked-text-in-jsx",Mo=[",",";","[","]","(",")"],_o=Lo({name:Er,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="";Mo.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Zt={name:Er,rule:_o};var He=require("@typescript-eslint/utils"),$o=He.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-non-camel-case-functions",Uo=/^(\$?[a-z][a-zA-Z0-9]*)$/;function br(e){if(e.typeName.type!==He.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===He.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var zo=$o({name:xr,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&&!Uo.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===He.AST_NODE_TYPES.TSTypeReference?br(r):r.type===He.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===He.AST_NODE_TYPES.TSTypeReference&&br(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Gt={name:xr,rule:zo};var se=require("@typescript-eslint/utils");var Wo=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-optional-root-props",Vo=Wo({name:Cr,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 l of Wt(i.identifier)){if("returnType"in l||l.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let c=l.parent;if(!c)return!1;if(c.type===se.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&c.parent.type===se.TSESTree.AST_NODE_TYPES.TSTypeReference&&c.parent.typeName.type===se.TSESTree.AST_NODE_TYPES.Identifier&&c.parent.typeName.name==="FC"){let u=tt(c.parent.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=bt(u,e.sourceCode);return m?!(m.parent.type===se.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===se.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(l.type===se.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(c.type===se.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let a=tt(c,se.TSESTree.AST_NODE_TYPES.VariableDeclaration);return a?!!bt(a,e.sourceCode):!1}if(c.type===se.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!bt(c,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=tt(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&&!(xt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(xt(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=tt(n.parent,se.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=bt(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 c of o.members)c.type===se.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(c)}}}});function xt(e){return e?e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function bt(e,t){if(xt(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])&&!xt(s[0].identifier.parent.parent))return s[0].identifier}var Kt={name:Cr,rule:Vo};var pt=require("@typescript-eslint/utils");var ct=H({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===pt.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===pt.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===pt.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===pt.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Ir=require("@typescript-eslint/utils"),Ct=ke(require("path")),ze=require("zod/v4");var Jo=Ir.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="no-relative-imports",Xo=ze.z.object({find:ze.z.string(),replacement:ze.z.string()}),Bo=ze.z.object({aliases:ze.z.array(Xo),rootDir:ze.z.string().optional(),allowNotFoundAliases:ze.z.boolean().optional(),_dev_simulateFileName:ze.z.string().optional()}),Ho=Jo({name:Ar,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:[W(Bo)]},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,l){let c=Ct.default.dirname(l);return Ct.default.resolve(c,i)}function s(i){let l=t.rootDir??process.cwd(),c=Ct.default.relative(l,i);if(c.startsWith("."))return null;c.startsWith("/")||(c=`/${c}`);for(let{find:a,replacement:u}of t.aliases)if(c.startsWith(u)){let m=c.replace(u,a);return{alias:a,newPath:m}}return null}return{ImportDeclaration(i){let l=i.source.value;if(!n(l))return;let c=o(l,r),a=s(c);!a&&t.allowNotFoundAliases||e.report({node:i,messageId:a?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:a?.alias},fix:a?u=>u.replaceText(i.source,`'${a.newPath}'`):void 0})}}}}),Qt={name:Ar,rule:Ho};var ye=require("@typescript-eslint/utils"),en=require("zod/v4");var Yo=en.z.object({customMessage:en.z.string().optional()}),tn=H({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[W(Yo)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case ye.AST_NODE_TYPES.Literal:return!0;case ye.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===ye.AST_NODE_TYPES.Property?o.computed||o.value.type===ye.AST_NODE_TYPES.Identifier&&o.key.type===ye.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case ye.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===ye.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case ye.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case ye.AST_NODE_TYPES.ConditionalExpression:case ye.AST_NODE_TYPES.LogicalExpression:case ye.AST_NODE_TYPES.BinaryExpression:case ye.AST_NODE_TYPES.UnaryExpression:case ye.AST_NODE_TYPES.CallExpression:case ye.AST_NODE_TYPES.MemberExpression:case ye.AST_NODE_TYPES.Identifier:case ye.AST_NODE_TYPES.ArrowFunctionExpression:case ye.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===ye.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===ye.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==ye.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===ye.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var ut=require("@typescript-eslint/utils"),Ze=ke(require("zod/v4"));var qo=Ze.object({alternativeMsgs:Ze.object({inArrayFind:Ze.string().optional(),inArrayFilter:Ze.string().optional()}).optional(),__dev_simulateFileName:Ze.string().optional()});function Zo(e){return e.typeAnnotation.type!==ut.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Go=/(typeGuards|type-guards)\.(ts|tsx)$/;function Ko(e){return Go.test(e)}function Qo(e){let t=e.parent;for(;t;){if(t.type===ut.AST_NODE_TYPES.CallExpression&&t.callee.type===ut.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===ut.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var nn=H({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[W(qo)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(Ko(r))return{};function n(o){if(!Zo(o))return;let s=Qo(o);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let l=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:l,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 Ge=require("@typescript-eslint/utils");var es="no-unnecessary-async-on-jsx-props";function ts(e){if(e.body.type!==Ge.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!==Ge.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ge.AST_NODE_TYPES.AwaitExpression}var rn=H({name:es,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,c=>c.value==="async");if(i){let c=o.getTokenAfter(i);c?s.push(n.replaceTextRange([i.range[0],c.range[0]],"")):s.push(n.remove(i))}function l(c){if(c.type===Ge.AST_NODE_TYPES.AwaitExpression){let a=o.getFirstToken(c);if(a&&a.value==="await"){let u=o.getTokenAfter(a);u?s.push(n.replaceTextRange([a.range[0],u.range[0]],"")):s.push(n.remove(a))}}if(c.type===Ge.AST_NODE_TYPES.BlockStatement)for(let a of c.body)l(a);else c.type===Ge.AST_NODE_TYPES.ExpressionStatement&&l(c.expression)}return l(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var We=require("@typescript-eslint/utils"),on=ke(require("typescript")),rt=ke(require("zod/v4"));var ns=We.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wr="no-unnecessary-casting",rs=rt.default.object({additionalCastFunctions:rt.default.array(rt.default.object({name:rt.default.string(),expectedType:rt.default.enum(["string","number"])})).optional()}),sn={name:wr,rule:ns({name:wr,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:[W(rs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=We.ESLintUtils.getParserServices(e,!0),s=o.program?.getTypeChecker();if(!s||!o.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case We.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case We.AST_NODE_TYPES.TemplateLiteral:return m==="string";case We.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function l(u,m){return m==="number"?!!(u.flags&on.TypeFlags.NumberLike):!!(u.flags&on.TypeFlags.StringLike)}function c(u,m){return y=>y.replaceText(u,e.sourceCode.getText(m))}function a(u){if(!s||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===We.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==We.AST_NODE_TYPES.Identifier)return;let C=y.name,f=n.find(x=>x.name===C);if(!f)return;if(i(m,f.expectedType)||l(s.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),f.expectedType)){let x,S;C==="Number"?x="unnecessaryNumberCasting":C==="String"?x="unnecessaryStringCasting":(x="unnecessaryCustomCasting",S={name:f.name,type:f.expectedType}),e.report({node:u,messageId:x,...S?{data:S}:{},fix:c(u,m)})}}return{CallExpression:a}}})};var we=require("@typescript-eslint/utils"),It=ke(require("zod/v4"));var is=It.object({ignoreWithDescription:It.string().optional()}),an=H({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:[W(is)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(c){let a=c.arguments[0];return a&&a.type===we.AST_NODE_TYPES.Literal&&typeof a.value=="string"?a.value:null}function s(c){return!c||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(c)}function i(c){return c.length!==1?!1:n.body.filter(u=>{if(u.type===we.AST_NODE_TYPES.ExpressionStatement){let m=u.expression;if(m.type===we.AST_NODE_TYPES.CallExpression&&m.callee.type===we.AST_NODE_TYPES.Identifier){let y=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function l(c){let a=c.arguments[1];if(a&&(a.type===we.AST_NODE_TYPES.FunctionExpression||a.type===we.AST_NODE_TYPES.ArrowFunctionExpression)&&a.body.type===we.AST_NODE_TYPES.BlockStatement){let u=a.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 c=[];for(let y of n.body)y.type===we.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===we.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===we.AST_NODE_TYPES.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&c.push(y.expression);if(!i(c))return;let[a]=c;if(!a)return;let u=o(a);if(s(u))return;let m=n.body.find(y=>y.type===we.AST_NODE_TYPES.ExpressionStatement&&y.expression===a);!m||m.type!==we.AST_NODE_TYPES.ExpressionStatement||e.report({node:a,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let C=l(a);return C?y.replaceText(m,C):null}}]})}}}});var ut=require("@typescript-eslint/utils"),je=ke(require("zod/v4"));var rs=je.object({methods:je.union([je.array(je.string()),je.literal("array")])}),an=Y({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:[W(rs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(l){return Array.isArray(r)?r.includes(l):n.has(l)}function s(l){let{callee:c}=l;if(c.type===ut.AST_NODE_TYPES.MemberExpression){let a=c.property;if(a.type===ut.AST_NODE_TYPES.Identifier)return a.name}return null}function i(l,c){if(l.type!==ut.AST_NODE_TYPES.Identifier||!l.typeAnnotation)return;let a=c.parent;if(a.type===ut.AST_NODE_TYPES.CallExpression){let u=s(a);u&&o(u)&&a.arguments.indexOf(c)===0&&e.report({node:l.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return l.typeAnnotation?y.remove(l.typeAnnotation):null}})}}return{ArrowFunctionExpression(l){for(let c of l.params)i(c,l)},FunctionExpression(l){for(let c of l.params)i(c,l)}}}});var Ae=require("@typescript-eslint/utils");var ln=Y({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===Ae.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==Ae.AST_NODE_TYPES.ObjectExpression||t.id.type===Ae.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===Ae.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===Ae.AST_NODE_TYPES.Property&&i.key.type===Ae.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==Ae.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!==Ae.AST_NODE_TYPES.Property?!1:i.value.type===Ae.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==Ae.AST_NODE_TYPES.MemberExpression)return;let l=i.identifier.parent;if(l.object!==i.identifier)return;if(l.computed)if(l.property.type===Ae.AST_NODE_TYPES.Literal&&typeof l.property.value=="string")s.add(l.property.value);else return;else{if(l.property.type!==Ae.AST_NODE_TYPES.Identifier)return;s.add(l.property.name)}if(l.parent.type===Ae.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,l]of r)s.has(i)||e.report({node:l,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"),pn=require("zod/v4");var os=pn.z.object({ignoreArgsMatching:pn.z.string().optional()}),cn=Y({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:[W(os)]},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 l=[];for(let c=0;c<i.length;c++){let a=i[c];if(!a||a.type!==te.AST_NODE_TYPES.Identifier)continue;let u=a.name;if(!n(u)){if(a.optional&&a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)?l.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y}):l.push({param:a,index:c,name:u,isObjectParam:!1})}else if(a.optional)l.push({param:a,index:c,name:u,isObjectParam:!1});else if(a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&l.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y})}}}return l}return{FunctionDeclaration(i){if(o(i))return;let l=s(i.params);l.length!==0&&r.push({node:i,declarationNode:i,optionalParams:l})},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 c=[...s(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let a=i.id.typeAnnotation.typeAnnotation;if(a.typeName.type===te.AST_NODE_TYPES.Identifier&&a.typeName.name==="FC"){let u=a.typeArguments;if(u&&u.params.length===1){let m=u.params[0];if(m&&m.type===te.AST_NODE_TYPES.TSTypeLiteral){let y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&c.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}c.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:c})},"Program:exit"(){for(let i of r){let c=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!c)continue;let a=c.references.filter(y=>y.identifier!==c.identifiers[0]);if(a.length===0)continue;let u=!1;for(let y of a){let C=y.identifier.parent;if(C.type===te.AST_NODE_TYPES.CallExpression&&y.identifier.type===te.AST_NODE_TYPES.Identifier&&C.arguments.includes(y.identifier)){u=!0;break}if(C.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(C.type===te.AST_NODE_TYPES.Property&&C.parent.type===te.AST_NODE_TYPES.ObjectExpression&&C.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(C.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let m=[];for(let y of a){let C=y.identifier.parent;if(C.type===te.AST_NODE_TYPES.CallExpression&&C.callee===y.identifier){let f=C.arguments.length,E=C.arguments.some(S=>S.type===te.AST_NODE_TYPES.SpreadElement);if(E){u=!0;break}let x={argCount:f,hasSpread:E};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<f){let I=C.arguments[S.index];if(I?.type===te.AST_NODE_TYPES.ObjectExpression){let A={};for(let T of I.properties)T.type===te.AST_NODE_TYPES.Property&&T.key.type===te.AST_NODE_TYPES.Identifier&&(A[T.key.name]=!0);x.objectArgs||(x.objectArgs=[]),x.objectArgs[S.index]=A}else if(I){u=!0;break}}m.push(x)}else if(C.type===te.AST_NODE_TYPES.JSXOpeningElement&&C.name===y.identifier){let f=C.attributes.some(x=>x.type===te.AST_NODE_TYPES.JSXSpreadAttribute);if(f){u=!0;break}let E={argCount:1,hasSpread:f};for(let x of i.optionalParams)if(x.isObjectParam&&x.index===0){let S={};for(let I of C.attributes)I.type===te.AST_NODE_TYPES.JSXAttribute&&I.name.type===te.AST_NODE_TYPES.JSXIdentifier&&(S[I.name.name]=!0);E.objectArgs||(E.objectArgs=[]),E.objectArgs[0]=S}m.push(E)}}if(!(u||m.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let C of y.objectProps){if(!C.optional)continue;let f=!1;for(let E of m)if(E.objectArgs&&E.objectArgs[y.index]){let x=E.objectArgs[y.index];if(x&&x[C.name]){f=!0;break}}f||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:C.name}})}else{let C=!1;for(let f of m)if(f.argCount>y.index){C=!0;break}C||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});var le=require("@typescript-eslint/utils"),Ye=require("zod/v4");var ss=Ye.z.object({selectors:Ye.z.array(Ye.z.object({name:Ye.z.string(),selectorProp:Ye.z.string().optional(),selectorArgPos:Ye.z.number().optional(),returnProp:Ye.z.string().optional()}))}),as=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="no-unused-selected-values",un={name:Ar,rule:as({name:Ar,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[W(ss)]},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=ps(s);if(!i)return;let l=n.get(i);if(!l)return;let c=ls(s,l.selectorArgPos??0,l.selectorProp);if(!c)return;let a=cs(c);if(!a)return;let u=wr(a.properties,void 0);if(!u)return;if(o.id.type===le.AST_NODE_TYPES.ObjectPattern){let C=wr(o.id.properties,l.returnProp);if(!C)return;for(let[f,E]of u)C.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(o.id.type!==le.AST_NODE_TYPES.Identifier||l.returnProp)return;let m=us(o,e.sourceCode);if(m.length===0)return;let y=new Set;for(let C of m){if(C.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let f=C.identifier.parent.property;if(f.type!==le.AST_NODE_TYPES.Identifier)return;y.add(f.name)}for(let[C,f]of u)y.has(C)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:C}})}}}})};function ls(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 ps(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 cs(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 wr(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 us(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 pe=require("@typescript-eslint/utils");var fn=Y({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===pe.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 l=fs(s);l&&(n=l);return}let i=ms(s,e.sourceCode);if(i){o=!0;for(let l of i)n.delete(l);if(n.size!==0)for(let[l,c]of n)e.report({node:c,messageId:"unusedField",data:{name:l}})}}}}});function fs(e){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==pe.AST_NODE_TYPES.ObjectExpression)return null;let n=Wt(r.properties,s=>s.type!==pe.AST_NODE_TYPES.Property||s.key.type!==pe.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===pe.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===pe.AST_NODE_TYPES.FunctionExpression?ys(s.value):null);if(!n)return null;let o=new Map;for(let s of n.properties)s.type===pe.AST_NODE_TYPES.Property&&s.key.type===pe.AST_NODE_TYPES.Identifier&&o.set(s.key.name,s);return o}function ms(e,t){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==pe.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==pe.AST_NODE_TYPES.ObjectPattern||!Wt(e.parent.id.properties,i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=ar(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of o){if(i.type!==pe.AST_NODE_TYPES.Identifier||i.parent.type===pe.AST_NODE_TYPES.Property&&i.parent.parent.type===pe.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===pe.AST_NODE_TYPES.ReturnStatement||i.parent.type===pe.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===pe.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==pe.AST_NODE_TYPES.Identifier||i.parent.property.type!==pe.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function ys(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}var oe=require("@typescript-eslint/utils"),ft=require("zod/v4");var ds=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Rr(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 Fr(e,...t){for(let r of t)e.set(...r);return e}var gs=ft.z.object({forceCheckOnFCPropTypesWithName:ft.z.array(ft.z.string()).optional(),alwaysCheckFunctionOptionTypes:ft.z.boolean().optional()}),vr="no-unused-type-props-in-args",mn=null,Ss=ds({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:[W(gs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!mn&&(mn=r.map(c=>new RegExp(c)));function o(c,a,u,m,y=!0,C=!1){let f=u.name,E=e.sourceCode.getScope(a).references.find(T=>T.identifier.name===f)?.resolved,x=c&&mn?.some(T=>T.test(f)),S=C&&n;if(!E||!x&&E.references.filter(T=>T.isTypeReference).length>1||!E.defs[0])return;let I=E.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(c,a,m,I.typeAnnotation,!0,C);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(c,a,m,I.body,!0,C);return}}}function s(c,a,u,m,y,C=!1){if(m.type===oe.AST_NODE_TYPES.TSInterfaceBody){for(let f of m.body)f.type===oe.AST_NODE_TYPES.TSPropertySignature&&f.key.type===oe.AST_NODE_TYPES.Identifier&&u.set(f.key.name,f);return}if(m.type===oe.AST_NODE_TYPES.TSTypeLiteral){Fr(u,...Rr(m));return}if(m.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let f of m.types)s(c,a,u,f,!0,C);return}y||m.type===oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(c,a,m.typeName,u,!0,C)}function i(c,a,u,m=!1){for(let y of u)if(y.type===oe.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let C=new Map;if(s(c,a,C,y.typeAnnotation.typeAnnotation,!1,m),C.size===0)continue;l(y,C)}else y.type===oe.AST_NODE_TYPES.AssignmentPattern&&y.left.type===oe.AST_NODE_TYPES.ObjectPattern&&i(c,a,[y.left],m)}function l(c,a){let u=[];if(c.properties.at(-1)?.type===oe.AST_NODE_TYPES.RestElement)return;for(let f of c.properties)f.type===oe.AST_NODE_TYPES.Property&&f.key.type===oe.AST_NODE_TYPES.Identifier&&u.push(f.key.name);let y=[],C=[];for(let[f,E]of a)u.includes(f)||(C.push(f),y.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,E]of y.entries())e.report({...E,fix:f===y.length-1?x=>{let S=c.properties.at(-1),I=C.join(", ");return S?S.type===oe.AST_NODE_TYPES.RestElement?null:x.insertTextAfter(S,`, ${I}`):x.insertTextBeforeRange([c.range[0]+1,c.range[1]],I)}:void 0})}return{VariableDeclaration(c){let a=c.declarations[0],u=new Map,m=a.id.type===oe.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation?.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeReference&&a.id.typeAnnotation.typeAnnotation.typeName.type===oe.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&a.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===oe.AST_NODE_TYPES.Identifier)o(!0,c,m.typeName,u,!1);else if(m.type===oe.AST_NODE_TYPES.TSTypeLiteral)Fr(u,...Rr(m));else if(m.type===oe.AST_NODE_TYPES.TSIntersectionType)for(let y of m.types)y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.Identifier?o(!0,c,y.typeName,u,!1):s(!0,c,u,y,!0);if(u.size!==0&&a.init?.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let y=a.init.params[0];if(!y){e.report({node:a.init,messageId:"missingComponentParam"});return}y.type===oe.AST_NODE_TYPES.ObjectPattern&&l(y,u)}}},FunctionDeclaration(c){i(!1,c,c.params,n)},ArrowFunctionExpression(c){i(!1,c,c.params,n)}}}}),yn={name:vr,rule:Ss};var Pe=require("@typescript-eslint/utils");var dn=Y({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===Pe.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&n.callee.property.type===Pe.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===Pe.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===Pe.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Pe.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Pe.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let l of s.references){let a=l.identifier.parent;if(a!==n&&!(a.type===Pe.AST_NODE_TYPES.JSXExpressionContainer&&a.parent.type===Pe.AST_NODE_TYPES.JSXAttribute&&a.parent.name.type===Pe.AST_NODE_TYPES.JSXIdentifier&&a.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var rt=require("@typescript-eslint/utils"),Ts=rt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="prefer-named-functions",kr=new Map,hs=Ts({name:Pr,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=kr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),kr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===rt.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===rt.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==rt.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,l=n.init.body,c=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:a=>a.replaceText(s,`${c.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(l)}`)}]})}}}}}),gn={name:Pr,rule:hs};var K=require("@typescript-eslint/utils"),Le=require("zod/v4");var Es=Le.z.object({disallowedFunctions:Le.z.array(Le.z.object({name:Le.z.string(),allowUsingWithArgs:Le.z.boolean().optional(),hookAlternative:Le.z.string().optional(),message:Le.z.string().optional(),allowUseInside:Le.z.array(Le.z.string()).optional()}))}),bs=/^use[A-Z]/,xs=/^[A-Z]/;function It(e){return bs.test(e)}function Or(e){return xs.test(e)}function Cs(e){return e.type===K.AST_NODE_TYPES.Identifier?It(e.name):e.type===K.AST_NODE_TYPES.MemberExpression&&e.property.type===K.AST_NODE_TYPES.Identifier?It(e.property.name):!1}function Nr(e,t){return e.type===K.AST_NODE_TYPES.Identifier?e.name===t:e.type===K.AST_NODE_TYPES.MemberExpression&&e.object.type===K.AST_NODE_TYPES.Identifier&&e.property.type===K.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Dr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&Nr(e.parent.callee,"forwardRef"))}function jr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&Nr(e.parent.callee,"memo"))}function Sn(e){if(e.type===K.AST_NODE_TYPES.FunctionDeclaration||e.type===K.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===K.AST_NODE_TYPES.FunctionExpression||e.type===K.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===K.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===K.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===K.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===K.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Is(e){let t=e.parent,r=!1;for(;t;){if(t.type===K.AST_NODE_TYPES.FunctionDeclaration||t.type===K.AST_NODE_TYPES.FunctionExpression||t.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let n=Sn(t);if(n&&n.type===K.AST_NODE_TYPES.Identifier){if(Or(n.name)||It(n.name))return!r;r=!0}else{if(Dr(t)||jr(t))return!r;if(t.parent.type===K.AST_NODE_TYPES.CallExpression){let o=t.parent;Cs(o.callee)||(r=!0)}else t.parent.type===K.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Lr(e){return e.callee.type===K.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===K.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===K.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function As(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===K.AST_NODE_TYPES.FunctionDeclaration||r.type===K.AST_NODE_TYPES.FunctionExpression||r.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let n=Sn(r);if(n&&n.type===K.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===K.AST_NODE_TYPES.CallExpression){let n=Lr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ws(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===K.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Rs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===K.AST_NODE_TYPES.FunctionDeclaration||n.type===K.AST_NODE_TYPES.FunctionExpression||n.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let o=Sn(n);if(o&&o.type===K.AST_NODE_TYPES.Identifier){if(Or(o.name)||It(o.name)){r=!0;break}}else if(Dr(n)||jr(n)){r=!0;break}}n=n.parent}return r?t.length===0?Is(e):!As(e,t):!1}var Tn=Y({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:[W(Es)],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=Lr(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&ws(o))return;let l=i.allowUseInside||[];Rs(o,l)&&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:c=>{let a=i.hookAlternative;return a?o.callee.type===K.AST_NODE_TYPES.Identifier?c.replaceText(o.callee,a):o.callee.type===K.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===K.AST_NODE_TYPES.Identifier?c.replaceText(o.callee.property,a):null:null}}]:[]})}}}});var ce=require("@typescript-eslint/utils"),At=ke(require("zod/v4"));var Fs=ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="prefer-single-line-if",vs=At.default.object({maxLineLength:At.default.number().optional(),maxNonSimpleConditionLength:At.default.number().optional()}),ks=Fs({name:_r,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:[W(vs)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==ce.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===ce.AST_NODE_TYPES.ReturnStatement){if(!Ur(s))return}else if(!(s.type===ce.AST_NODE_TYPES.ContinueStatement||s.type===ce.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===ce.AST_NODE_TYPES.LogicalExpression||n.test.type===ce.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=Mr(n.test);if(!m&&n.test.type===ce.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Mr(y)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let l=r.getText(s);if(i.includes(`
|
|
18
|
-
`))return;let c=r.getTokenAfter(n);if(c&&c.type===ce.AST_TOKEN_TYPES.Punctuator&&c.value==="}"){let m=r.getTokenAfter(c);if(m&&m.type===ce.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let a=
|
|
17
|
+
`)}return""}return{Program(){let c=[];for(let y of n.body)y.type===we.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===we.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===we.AST_NODE_TYPES.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&c.push(y.expression);if(!i(c))return;let[a]=c;if(!a)return;let u=o(a);if(s(u))return;let m=n.body.find(y=>y.type===we.AST_NODE_TYPES.ExpressionStatement&&y.expression===a);!m||m.type!==we.AST_NODE_TYPES.ExpressionStatement||e.report({node:a,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let C=l(a);return C?y.replaceText(m,C):null}}]})}}}});var ft=require("@typescript-eslint/utils"),je=ke(require("zod/v4"));var os=je.object({methods:je.union([je.array(je.string()),je.literal("array")])}),ln=H({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[W(os)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(l){return Array.isArray(r)?r.includes(l):n.has(l)}function s(l){let{callee:c}=l;if(c.type===ft.AST_NODE_TYPES.MemberExpression){let a=c.property;if(a.type===ft.AST_NODE_TYPES.Identifier)return a.name}return null}function i(l,c){if(l.type!==ft.AST_NODE_TYPES.Identifier||!l.typeAnnotation)return;let a=c.parent;if(a.type===ft.AST_NODE_TYPES.CallExpression){let u=s(a);u&&o(u)&&a.arguments.indexOf(c)===0&&e.report({node:l.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return l.typeAnnotation?y.remove(l.typeAnnotation):null}})}}return{ArrowFunctionExpression(l){for(let c of l.params)i(c,l)},FunctionExpression(l){for(let c of l.params)i(c,l)}}}});var Ae=require("@typescript-eslint/utils");var pn=H({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===Ae.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==Ae.AST_NODE_TYPES.ObjectExpression||t.id.type===Ae.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===Ae.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===Ae.AST_NODE_TYPES.Property&&i.key.type===Ae.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==Ae.AST_NODE_TYPES.Identifier)return;let n=ss(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==Ae.AST_NODE_TYPES.Property?!1:i.value.type===Ae.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==Ae.AST_NODE_TYPES.MemberExpression)return;let l=i.identifier.parent;if(l.object!==i.identifier)return;if(l.computed)if(l.property.type===Ae.AST_NODE_TYPES.Literal&&typeof l.property.value=="string")s.add(l.property.value);else return;else{if(l.property.type!==Ae.AST_NODE_TYPES.Identifier)return;s.add(l.property.name)}if(l.parent.type===Ae.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,l]of r)s.has(i)||e.report({node:l,messageId:"unusedObjectProperty",data:{name:i}})}}}});function ss(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"),cn=require("zod/v4");var as=cn.z.object({ignoreArgsMatching:cn.z.string().optional()}),un=H({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:[W(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 l=[];for(let c=0;c<i.length;c++){let a=i[c];if(!a||a.type!==te.AST_NODE_TYPES.Identifier)continue;let u=a.name;if(!n(u)){if(a.optional&&a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)?l.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y}):l.push({param:a,index:c,name:u,isObjectParam:!1})}else if(a.optional)l.push({param:a,index:c,name:u,isObjectParam:!1});else if(a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&l.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y})}}}return l}return{FunctionDeclaration(i){if(o(i))return;let l=s(i.params);l.length!==0&&r.push({node:i,declarationNode:i,optionalParams:l})},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 c=[...s(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let a=i.id.typeAnnotation.typeAnnotation;if(a.typeName.type===te.AST_NODE_TYPES.Identifier&&a.typeName.name==="FC"){let u=a.typeArguments;if(u&&u.params.length===1){let m=u.params[0];if(m&&m.type===te.AST_NODE_TYPES.TSTypeLiteral){let y=[];for(let C of m.members)C.type===te.AST_NODE_TYPES.TSPropertySignature&&C.key.type===te.AST_NODE_TYPES.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&c.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}c.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:c})},"Program:exit"(){for(let i of r){let c=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!c)continue;let a=c.references.filter(y=>y.identifier!==c.identifiers[0]);if(a.length===0)continue;let u=!1;for(let y of a){let C=y.identifier.parent;if(C.type===te.AST_NODE_TYPES.CallExpression&&y.identifier.type===te.AST_NODE_TYPES.Identifier&&C.arguments.includes(y.identifier)){u=!0;break}if(C.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(C.type===te.AST_NODE_TYPES.Property&&C.parent.type===te.AST_NODE_TYPES.ObjectExpression&&C.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(C.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let m=[];for(let y of a){let C=y.identifier.parent;if(C.type===te.AST_NODE_TYPES.CallExpression&&C.callee===y.identifier){let f=C.arguments.length,E=C.arguments.some(S=>S.type===te.AST_NODE_TYPES.SpreadElement);if(E){u=!0;break}let x={argCount:f,hasSpread:E};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<f){let I=C.arguments[S.index];if(I?.type===te.AST_NODE_TYPES.ObjectExpression){let A={};for(let T of I.properties)T.type===te.AST_NODE_TYPES.Property&&T.key.type===te.AST_NODE_TYPES.Identifier&&(A[T.key.name]=!0);x.objectArgs||(x.objectArgs=[]),x.objectArgs[S.index]=A}else if(I){u=!0;break}}m.push(x)}else if(C.type===te.AST_NODE_TYPES.JSXOpeningElement&&C.name===y.identifier){let f=C.attributes.some(x=>x.type===te.AST_NODE_TYPES.JSXSpreadAttribute);if(f){u=!0;break}let E={argCount:1,hasSpread:f};for(let x of i.optionalParams)if(x.isObjectParam&&x.index===0){let S={};for(let I of C.attributes)I.type===te.AST_NODE_TYPES.JSXAttribute&&I.name.type===te.AST_NODE_TYPES.JSXIdentifier&&(S[I.name.name]=!0);E.objectArgs||(E.objectArgs=[]),E.objectArgs[0]=S}m.push(E)}}if(!(u||m.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let C of y.objectProps){if(!C.optional)continue;let f=!1;for(let E of m)if(E.objectArgs&&E.objectArgs[y.index]){let x=E.objectArgs[y.index];if(x&&x[C.name]){f=!0;break}}f||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:C.name}})}else{let C=!1;for(let f of m)if(f.argCount>y.index){C=!0;break}C||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});var le=require("@typescript-eslint/utils"),Ye=require("zod/v4");var ls=Ye.z.object({selectors:Ye.z.array(Ye.z.object({name:Ye.z.string(),selectorProp:Ye.z.string().optional(),selectorArgPos:Ye.z.number().optional(),returnProp:Ye.z.string().optional()}))}),ps=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rr="no-unused-selected-values",fn={name:Rr,rule:ps({name:Rr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[W(ls)]},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=us(s);if(!i)return;let l=n.get(i);if(!l)return;let c=cs(s,l.selectorArgPos??0,l.selectorProp);if(!c)return;let a=fs(c);if(!a)return;let u=Fr(a.properties,void 0);if(!u)return;if(o.id.type===le.AST_NODE_TYPES.ObjectPattern){let C=Fr(o.id.properties,l.returnProp);if(!C)return;for(let[f,E]of u)C.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(o.id.type!==le.AST_NODE_TYPES.Identifier||l.returnProp)return;let m=ms(o,e.sourceCode);if(m.length===0)return;let y=new Set;for(let C of m){if(C.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let f=C.identifier.parent.property;if(f.type!==le.AST_NODE_TYPES.Identifier)return;y.add(f.name)}for(let[C,f]of u)y.has(C)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:C}})}}}})};function cs(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 us(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 fs(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 Fr(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 ms(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 pe=require("@typescript-eslint/utils");var mn=H({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(s=>s.type===pe.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 l=ys(s);l&&(n=l);return}let i=ds(s,e.sourceCode);if(i){o=!0;for(let l of i)n.delete(l);if(n.size!==0)for(let[l,c]of n)e.report({node:c,messageId:"unusedField",data:{name:l}})}}}}});function ys(e){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==pe.AST_NODE_TYPES.ObjectExpression)return null;let n=Vt(r.properties,s=>s.type!==pe.AST_NODE_TYPES.Property||s.key.type!==pe.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===pe.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===pe.AST_NODE_TYPES.FunctionExpression?gs(s.value):null);if(!n)return null;let o=new Map;for(let s of n.properties)s.type===pe.AST_NODE_TYPES.Property&&s.key.type===pe.AST_NODE_TYPES.Identifier&&o.set(s.key.name,s);return o}function ds(e,t){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==pe.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==pe.AST_NODE_TYPES.ObjectPattern||!Vt(e.parent.id.properties,i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=pr(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of o){if(i.type!==pe.AST_NODE_TYPES.Identifier||i.parent.type===pe.AST_NODE_TYPES.Property&&i.parent.parent.type===pe.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===pe.AST_NODE_TYPES.ReturnStatement||i.parent.type===pe.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===pe.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==pe.AST_NODE_TYPES.Identifier||i.parent.property.type!==pe.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function gs(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}var oe=require("@typescript-eslint/utils"),mt=require("zod/v4");var Ss=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function vr(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 kr(e,...t){for(let r of t)e.set(...r);return e}var Ts=mt.z.object({forceCheckOnFCPropTypesWithName:mt.z.array(mt.z.string()).optional(),alwaysCheckFunctionOptionTypes:mt.z.boolean().optional()}),Pr="no-unused-type-props-in-args",yn=null,hs=Ss({name:Pr,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:[W(Ts)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!yn&&(yn=r.map(c=>new RegExp(c)));function o(c,a,u,m,y=!0,C=!1){let f=u.name,E=e.sourceCode.getScope(a).references.find(T=>T.identifier.name===f)?.resolved,x=c&&yn?.some(T=>T.test(f)),S=C&&n;if(!E||!x&&E.references.filter(T=>T.isTypeReference).length>1||!E.defs[0])return;let I=E.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(c,a,m,I.typeAnnotation,!0,C);return}if(I.type===oe.AST_NODE_TYPES.TSInterfaceDeclaration){s(c,a,m,I.body,!0,C);return}}}function s(c,a,u,m,y,C=!1){if(m.type===oe.AST_NODE_TYPES.TSInterfaceBody){for(let f of m.body)f.type===oe.AST_NODE_TYPES.TSPropertySignature&&f.key.type===oe.AST_NODE_TYPES.Identifier&&u.set(f.key.name,f);return}if(m.type===oe.AST_NODE_TYPES.TSTypeLiteral){kr(u,...vr(m));return}if(m.type===oe.AST_NODE_TYPES.TSIntersectionType){for(let f of m.types)s(c,a,u,f,!0,C);return}y||m.type===oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===oe.AST_NODE_TYPES.Identifier&&o(c,a,m.typeName,u,!0,C)}function i(c,a,u,m=!1){for(let y of u)if(y.type===oe.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let C=new Map;if(s(c,a,C,y.typeAnnotation.typeAnnotation,!1,m),C.size===0)continue;l(y,C)}else y.type===oe.AST_NODE_TYPES.AssignmentPattern&&y.left.type===oe.AST_NODE_TYPES.ObjectPattern&&i(c,a,[y.left],m)}function l(c,a){let u=[];if(c.properties.at(-1)?.type===oe.AST_NODE_TYPES.RestElement)return;for(let f of c.properties)f.type===oe.AST_NODE_TYPES.Property&&f.key.type===oe.AST_NODE_TYPES.Identifier&&u.push(f.key.name);let y=[],C=[];for(let[f,E]of a)u.includes(f)||(C.push(f),y.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,E]of y.entries())e.report({...E,fix:f===y.length-1?x=>{let S=c.properties.at(-1),I=C.join(", ");return S?S.type===oe.AST_NODE_TYPES.RestElement?null:x.insertTextAfter(S,`, ${I}`):x.insertTextBeforeRange([c.range[0]+1,c.range[1]],I)}:void 0})}return{VariableDeclaration(c){let a=c.declarations[0],u=new Map,m=a.id.type===oe.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation?.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeReference&&a.id.typeAnnotation.typeAnnotation.typeName.type===oe.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&a.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===oe.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===oe.AST_NODE_TYPES.Identifier)o(!0,c,m.typeName,u,!1);else if(m.type===oe.AST_NODE_TYPES.TSTypeLiteral)kr(u,...vr(m));else if(m.type===oe.AST_NODE_TYPES.TSIntersectionType)for(let y of m.types)y.type===oe.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===oe.AST_NODE_TYPES.Identifier?o(!0,c,y.typeName,u,!1):s(!0,c,u,y,!0);if(u.size!==0&&a.init?.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let y=a.init.params[0];if(!y){e.report({node:a.init,messageId:"missingComponentParam"});return}y.type===oe.AST_NODE_TYPES.ObjectPattern&&l(y,u)}}},FunctionDeclaration(c){i(!1,c,c.params,n)},ArrowFunctionExpression(c){i(!1,c,c.params,n)}}}}),dn={name:Pr,rule:hs};var Pe=require("@typescript-eslint/utils");var gn=H({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===Pe.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&n.callee.property.type===Pe.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===Pe.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===Pe.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Pe.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Pe.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let l of s.references){let a=l.identifier.parent;if(a!==n&&!(a.type===Pe.AST_NODE_TYPES.JSXExpressionContainer&&a.parent.type===Pe.AST_NODE_TYPES.JSXAttribute&&a.parent.name.type===Pe.AST_NODE_TYPES.JSXIdentifier&&a.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var it=require("@typescript-eslint/utils"),Es=it.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="prefer-named-functions",Or=new Map,bs=Es({name:Nr,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=Or.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Or.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===it.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===it.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==it.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,l=n.init.body,c=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:a=>a.replaceText(s,`${c.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(l)}`)}]})}}}}}),Sn={name:Nr,rule:bs};var K=require("@typescript-eslint/utils"),Le=require("zod/v4");var xs=Le.z.object({disallowedFunctions:Le.z.array(Le.z.object({name:Le.z.string(),allowUsingWithArgs:Le.z.boolean().optional(),hookAlternative:Le.z.string().optional(),message:Le.z.string().optional(),allowUseInside:Le.z.array(Le.z.string()).optional()}))}),Cs=/^use[A-Z]/,Is=/^[A-Z]/;function At(e){return Cs.test(e)}function Dr(e){return Is.test(e)}function As(e){return e.type===K.AST_NODE_TYPES.Identifier?At(e.name):e.type===K.AST_NODE_TYPES.MemberExpression&&e.property.type===K.AST_NODE_TYPES.Identifier?At(e.property.name):!1}function jr(e,t){return e.type===K.AST_NODE_TYPES.Identifier?e.name===t:e.type===K.AST_NODE_TYPES.MemberExpression&&e.object.type===K.AST_NODE_TYPES.Identifier&&e.property.type===K.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Lr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&jr(e.parent.callee,"forwardRef"))}function Mr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&jr(e.parent.callee,"memo"))}function Tn(e){if(e.type===K.AST_NODE_TYPES.FunctionDeclaration||e.type===K.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===K.AST_NODE_TYPES.FunctionExpression||e.type===K.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===K.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===K.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===K.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===K.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===K.AST_NODE_TYPES.FunctionDeclaration||t.type===K.AST_NODE_TYPES.FunctionExpression||t.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let n=Tn(t);if(n&&n.type===K.AST_NODE_TYPES.Identifier){if(Dr(n.name)||At(n.name))return!r;r=!0}else{if(Lr(t)||Mr(t))return!r;if(t.parent.type===K.AST_NODE_TYPES.CallExpression){let o=t.parent;As(o.callee)||(r=!0)}else t.parent.type===K.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function _r(e){return e.callee.type===K.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===K.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===K.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Rs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===K.AST_NODE_TYPES.FunctionDeclaration||r.type===K.AST_NODE_TYPES.FunctionExpression||r.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let n=Tn(r);if(n&&n.type===K.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===K.AST_NODE_TYPES.CallExpression){let n=_r(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Fs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===K.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function vs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===K.AST_NODE_TYPES.FunctionDeclaration||n.type===K.AST_NODE_TYPES.FunctionExpression||n.type===K.AST_NODE_TYPES.ArrowFunctionExpression){let o=Tn(n);if(o&&o.type===K.AST_NODE_TYPES.Identifier){if(Dr(o.name)||At(o.name)){r=!0;break}}else if(Lr(n)||Mr(n)){r=!0;break}}n=n.parent}return r?t.length===0?ws(e):!Rs(e,t):!1}var hn=H({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[W(xs)],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=_r(o);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&Fs(o))return;let l=i.allowUseInside||[];vs(o,l)&&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:c=>{let a=i.hookAlternative;return a?o.callee.type===K.AST_NODE_TYPES.Identifier?c.replaceText(o.callee,a):o.callee.type===K.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===K.AST_NODE_TYPES.Identifier?c.replaceText(o.callee.property,a):null:null}}]:[]})}}}});var ce=require("@typescript-eslint/utils"),wt=ke(require("zod/v4"));var ks=ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ur="prefer-single-line-if",Ps=wt.default.object({maxLineLength:wt.default.number().optional(),maxNonSimpleConditionLength:wt.default.number().optional()}),Os=ks({name:Ur,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:[W(Ps)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==ce.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===ce.AST_NODE_TYPES.ReturnStatement){if(!Wr(s))return}else if(!(s.type===ce.AST_NODE_TYPES.ContinueStatement||s.type===ce.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===ce.AST_NODE_TYPES.LogicalExpression||n.test.type===ce.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=$r(n.test);if(!m&&n.test.type===ce.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;$r(y)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let l=r.getText(s);if(i.includes(`
|
|
18
|
+
`))return;let c=r.getTokenAfter(n);if(c&&c.type===ce.AST_TOKEN_TYPES.Punctuator&&c.value==="}"){let m=r.getTokenAfter(c);if(m&&m.type===ce.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let a=Ns(r,n),u=`if (${i}) ${l}`;t.maxLineLength&&u.length+a.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,u)})}}}});function $r(e){return e.type===ce.AST_NODE_TYPES.CallExpression||e.type===ce.AST_NODE_TYPES.BinaryExpression||e.type===ce.AST_NODE_TYPES.MemberExpression&&zr(e)}function zr(e){return e.object.type===ce.AST_NODE_TYPES.MemberExpression?zr(e.object):e.object.type!==ce.AST_NODE_TYPES.Identifier}function Ns(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Wr(e){if(!e.argument)return!0;let t=e.argument;return t.type===ce.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===ce.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===ce.AST_NODE_TYPES.Literal||t.type===ce.AST_NODE_TYPES.Identifier||t.type===ce.AST_NODE_TYPES.TemplateLiteral||t.type===ce.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===ce.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===ce.AST_NODE_TYPES.UnaryExpression?Wr(t):!1}var En={name:Ur,rule:Os};var U=require("@typescript-eslint/utils"),xn=require("zod/v4");var Ds=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Br="react-compiler-extra",js=xn.z.object({runOnlyWithEnableCompilerDirective:xn.z.boolean().optional()}),Ls=/eslint +react-compiler\/react-compiler: +\["error/;function Hr(e){return e.type===U.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function Ms(e){return e.type===U.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===U.AST_NODE_TYPES.MemberExpression&&e.property.type===U.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Me(e){if(!e)return!1;switch(e.type){case U.AST_NODE_TYPES.JSXElement:case U.AST_NODE_TYPES.JSXFragment:return!0;case U.AST_NODE_TYPES.ConditionalExpression:return Me(e.consequent)||Me(e.alternate);case U.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Me(e.right):e.operator==="||"?Me(e.left)||Me(e.right):!1;case U.AST_NODE_TYPES.CallExpression:if(e.callee.type===U.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===U.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===U.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==U.AST_NODE_TYPES.SpreadElement&&Me(t))return!0;return!1;default:return!1}}function _s(e){let t=e.typeAnnotation;if(t.type===U.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===U.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===U.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===U.AST_NODE_TYPES.Identifier&&t.typeName.right.type===U.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var $s=/^[A-Z][a-zA-Z0-9]*$/;function dt(e){return $s.test(e)}function Cn(e){return e.startsWith("use")&&e.length>3}function In(e,t,r,n){if(r&&_s(r))return t?dt(t.name):e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?dt(e.id.name):!0;if(t&&Cn(t.name)||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id&&Cn(e.id.name))return!0;if(n){let o=t?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(o&&dt(o)&&Yr(e.body,n).containsJSX)return!0}return!1}function yt(e){if(e.body.type===U.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===U.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===U.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Yr(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Ne(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case U.AST_NODE_TYPES.JSXElement:case U.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case U.AST_NODE_TYPES.CallExpression:Hr(n.callee)&&(r.containsHookCalls=!0),Me(n)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.ReturnStatement:n.argument&&Me(n.argument)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.VariableDeclarator:n.init&&Me(n.init)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.AssignmentExpression:Me(n.right)&&(r.containsJSX=!0);break}},t),r}function Vr(e,t){let r=e.body,n=Yr(r,t);return n.containsJSX||n.containsHookCalls}var Us=/\bthis[.[]/;function Jr(e){return Us.test(e)}function zs(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Ne(e,n=>{if(r.containsHookCalls||(n.type===U.AST_NODE_TYPES.FunctionDeclaration||n.type===U.AST_NODE_TYPES.FunctionExpression||n.type===U.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===U.AST_NODE_TYPES.CallExpression&&Ms(n.callee)&&(r.containsHookCalls=!0)},t),r}function Xr(e){return dt(e)||Cn(e)}function bn(e,t,r,n){if(!zs(e.body,t).containsHookCalls)return!1;let s=In(e,r,n,t);if(!s&&n){let i=r?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&dt(i)&&(s=!0)}return!s}var Ws=Ds({name:Br,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:[W(js)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let s of e.sourceCode.getAllComments())if(Ls.test(s.value)){r=!0;break}if(!r)return{}}function n(s){for(let i of s.properties)if(i.type===U.AST_NODE_TYPES.Property&&i.method&&i.value.type===U.AST_NODE_TYPES.FunctionExpression){let l=e.sourceCode,c=l.getText(i.key),a=i.value,u=l.getText(a.body);if(Jr(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=a.params.map(C=>l.getText(C)).join(", "),y="";a.generator?y=`${c}: function* (${m}) ${u}`:y=`${c}: (${m}) => ${u}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:C=>C.replaceText(i,y)})}}}function o(s){for(let i of s.properties)if(i.type===U.AST_NODE_TYPES.Property&&i.value.type===U.AST_NODE_TYPES.ObjectExpression){for(let l of i.value.properties)if(l.type===U.AST_NODE_TYPES.Property&&l.method&&l.value.type===U.AST_NODE_TYPES.FunctionExpression){let a=e.sourceCode.getText(l.value.body);Jr(a)&&e.report({node:l,messageId:"thisKeywordInMethod"})}}}return{CallExpression(s){if(Hr(s.callee))for(let i of s.arguments){if(i.type===U.AST_NODE_TYPES.ObjectExpression&&(n(i),o(i)),i.type===U.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===U.AST_NODE_TYPES.ObjectExpression&&(n(i.body),o(i.body)),i.body.type===U.AST_NODE_TYPES.BlockStatement))for(let l of i.body.body)l.type===U.AST_NODE_TYPES.ReturnStatement&&l.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(n(l.argument),o(l.argument));if(i.type===U.AST_NODE_TYPES.FunctionExpression)for(let l of i.body.body)l.type===U.AST_NODE_TYPES.ReturnStatement&&l.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(n(l.argument),o(l.argument))}},VariableDeclarator(s){if(s.id.type===U.AST_NODE_TYPES.Identifier&&s.init&&(s.init.type===U.AST_NODE_TYPES.ArrowFunctionExpression||s.init.type===U.AST_NODE_TYPES.FunctionExpression)){let i=s.init,l=s.id,c=s.id.typeAnnotation;if(yt(i)&&!Xr(l.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(bn(i,e.sourceCode,l,c)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(In(i,l,c,e.sourceCode)){let a=Vr(i,e.sourceCode),u=yt(i);!a&&!u&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===U.AST_NODE_TYPES.BlockStatement){let y=i.body.range[0]+1;return m.insertTextAfterRange([y,y],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}return null}}]})}}},FunctionDeclaration(s){if(s.id&&
|
|
20
|
+
`)}return null}}]})}}},FunctionDeclaration(s){if(s.id&&yt(s)&&!Xr(s.id.name)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}if(bn(s,e.sourceCode)){e.report({node:s,messageId:"functionCallingHooksMustBeComponent"});return}if(In(s,void 0,void 0,e.sourceCode)){let i=Vr(s,e.sourceCode),l=yt(s);!i&&!l&&e.report({node:s,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(c){let a=s.body.range[0]+1;return c.insertTextAfterRange([a,a],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(s){if(
|
|
22
|
+
`)}}]})}},FunctionExpression(s){if(yt(s)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}bn(s,e.sourceCode)&&e.report({node:s,messageId:"functionCallingHooksMustBeComponent"})}}}}),An={name:Br,rule:Ws};var be=require("@typescript-eslint/utils"),De=require("zod/v4");var Vs=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qr="react-compiler-migration",Js=De.z.object({disallowHooks:De.z.array(De.z.object({name:De.z.string(),replacement:De.z.string()})).optional(),disallowMethods:De.z.array(De.z.object({name:De.z.string(),replacement:De.z.string().optional(),requireTrueProp:De.z.string().optional()})).optional()}),Xs=/eslint +react-compiler\/react-compiler: +\["error/;function Bs(e){return e.type===be.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===be.AST_NODE_TYPES.MemberExpression&&e.property.type===be.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Hs=Vs({name:qr,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:[W(Js)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Xs.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,s=null;if(n.callee.type===be.AST_NODE_TYPES.Identifier?(o=n.callee.name,s=n.callee):n.callee.type===be.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===be.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,s=n.callee.property),o){let i=t.disallowHooks.find(l=>l.name===o);i&&s&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:l=>l.replaceText(s,i.replacement)}]})}}if(t.disallowMethods?.length&&Bs(n.callee)){for(let o of n.arguments)if(o.type===be.AST_NODE_TYPES.ObjectExpression){for(let s of o.properties)if(s.type===be.AST_NODE_TYPES.Property&&s.key.type===be.AST_NODE_TYPES.Identifier){let i=s.key.name,l=t.disallowMethods.find(c=>c.name===i);if(l){if(l.requireTrueProp){let c=l.requireTrueProp,a=!1;for(let u of o.properties)if(u.type===be.AST_NODE_TYPES.Property&&u.key.type===be.AST_NODE_TYPES.Identifier&&u.key.name===c&&u.value.type===be.AST_NODE_TYPES.Literal&&u.value.value===!0){a=!0;break}if(!a){e.report({node:s,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:c}});continue}}l.replacement&&e.report({node:s,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:c=>l.replacement?c.replaceText(s.key,l.replacement):null}]})}}}}}}:{}}}),wn={name:qr,rule:Hs};var _=require("@typescript-eslint/utils"),Fn=require("zod");var Ys=Fn.z.object({runOnlyWithEnableCompilerDirective:Fn.z.boolean().optional()}),qs=/eslint +react-compiler\/react-compiler: +\["error/,Zs=/^\d+$/,Gs=/[\s_-]+/,Ks=/[a-z][A-Z]/,Qs=/^(.+?)([A-Z][a-z]+s?)$/,ea=/^[a-z][a-zA-Z]*$/;function Zr(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;Ne(s,l=>{switch(l.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 ta(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 na(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=ra(o);if(s!==o)return vn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===_.AST_NODE_TYPES.Identifier)return vn(n.name)}return"ListItem"}function ra(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(Ks)){let n=e.match(Qs);if(n){let o=n[1],s=n[2];if(!o||!s)return Rn(e);let i=Rn(s);if(i!==s)return o+i}}return Rn(e)}function Rn(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 vn(e){return e.match(ea)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Gs).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Gr(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Ne(e,i=>{if(i.type===_.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Zs.test(i.name)){let l=i.parent;if(l.type===_.AST_NODE_TYPES.Property&&l.key===i||l.type===_.AST_NODE_TYPES.MemberExpression&&l.property===i&&!l.computed||l.type===_.AST_NODE_TYPES.JSXOpeningElement||l.type===_.AST_NODE_TYPES.JSXClosingElement||l.type===_.AST_NODE_TYPES.JSXAttribute&&l.name.type===_.AST_NODE_TYPES.JSXIdentifier&&l.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 Kr(e,t,r,n,o){let i=[...r.map(m=>m.type===_.AST_NODE_TYPES.Identifier?m.name:"item").map((m,y)=>({name:m,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],l=i.map(m=>{let y=m.type;return m.name.includes("on")&&y==="any"&&(y="unknown"),` ${m.name}: ${y};`}).join(`
|
|
23
23
|
`),c=i.map(m=>m.name).join(", "),a=o.getText(t),u=`${e}Props`;return`type ${u} = {
|
|
24
24
|
${l}
|
|
25
25
|
};
|
|
@@ -28,28 +28,28 @@ const ${e}: FC<${u}> = ({ ${c} }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
${a}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function ia(e,t,r,n){let o=t.map(i=>i.type===_.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 oa(e){if(e.type===_.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===_.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return vn(t)}return"ListItem"}function sa(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 Qr(e,t){for(let r of e.openingElement.attributes)if(r.type===_.AST_NODE_TYPES.JSXAttribute&&r.name.type===_.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===_.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==_.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var kn=H({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:[W(Ys)],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(qs.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===_.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===_.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?aa(n,r,e):la(n,r,e))}}}});function aa(e,t,r){let n=e.arguments[0];if(!n||n.type!==_.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==_.AST_NODE_TYPES.FunctionExpression||!ta(n))return;let o=null;if(n.body.type===_.AST_NODE_TYPES.JSXElement||n.body.type===_.AST_NODE_TYPES.JSXFragment?o=n.body:n.body.type===_.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===_.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===_.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===_.AST_NODE_TYPES.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=Zr(o,t);if(!s.hasUnstable)return;let i=na(e,n.params),l=n.params.map(m=>m.type===_.AST_NODE_TYPES.Identifier?m.name:"item"),c=Gr(o,l,t),a=o.type===_.AST_NODE_TYPES.JSXElement?Qr(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:m=>{let y=Kr(i,o,n.params,c,t),C=ia(i,n.params,c,a),f=e;for(;f.parent.type!==_.AST_NODE_TYPES.Program&&!(f.type===_.AST_NODE_TYPES.FunctionDeclaration||f.type===_.AST_NODE_TYPES.VariableDeclarator&&f.init&&(f.init.type===_.AST_NODE_TYPES.ArrowFunctionExpression||f.init.type===_.AST_NODE_TYPES.FunctionExpression));)f=f.parent;let E=[];return E.push(m.insertTextAfter(f,`
|
|
32
32
|
|
|
33
|
-
${y}`)),E.push(m.replaceText(o,C)),E}}]})}function
|
|
33
|
+
${y}`)),E.push(m.replaceText(o,C)),E}}]})}function la(e,t,r){let n=e.arguments[0];if(!n||n.type!==_.AST_NODE_TYPES.JSXElement&&n.type!==_.AST_NODE_TYPES.JSXFragment)return;let o=n,s=Zr(o,t);if(!s.hasUnstable)return;let i=oa(o),l=Gr(o,[],t),c=o.type===_.AST_NODE_TYPES.JSXElement?Qr(o,t):null,a=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:a},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let m=Kr(i,o,[],l,t),y=sa(i,l,c),C=e;for(;C.parent.type!==_.AST_NODE_TYPES.Program&&!(C.type===_.AST_NODE_TYPES.FunctionDeclaration||C.type===_.AST_NODE_TYPES.VariableDeclarator&&C.init&&(C.init.type===_.AST_NODE_TYPES.ArrowFunctionExpression||C.init.type===_.AST_NODE_TYPES.FunctionExpression));)C=C.parent;let f=[];return f.push(u.insertTextAfter(C,`
|
|
34
34
|
|
|
35
|
-
${m}`)),f.push(u.replaceText(o,y)),f}}]})}var wt=require("@typescript-eslint/utils"),aa=wt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kr="require-description",la=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,pa=/^eslint-disable-(next-)?line$/u,ca=aa({name:Kr,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=ua(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:ya(o.loc),messageId:"missingDescription"}))}}}}}),Qr={name:Kr,rule:ca};function ua(e){let{text:t,description:r}=ma(e.value);if(!t)return null;let n=la.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=pa.test(o);if(e.type===wt.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 fa=/\s-{2,}\s/u;function ma(e){let t=e.split(fa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ya(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),_e=require("zod/v4");var da=_e.z.object({varsToCheck:_e.z.array(_e.z.object({selector:_e.z.string().optional(),fromFnCall:_e.z.string().optional(),prop:_e.z.string().or(_e.z.array(_e.z.string())),errorMsg:_e.z.string().optional()}))}),kn=Y({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:[W(da)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,l,c,a){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 m=l.filter(y=>!u.has(y));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:a,customMsg:c||""}});else{let y=m.map(C=>`"${C}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}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]=l=>{if(l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,c,i.errorMsg,o(l))}});for(let i of t.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let m=u.parent;if(m.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=m.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 C=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,C,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=m=>{if(m.type!==ne.AST_NODE_TYPES.MemberExpression||m.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=m.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let C=y.parent;if(C.id.type===ne.AST_NODE_TYPES.Identifier)r.set(C.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:C.id,fnName:i.fromFnCall||"unknown function"});else if(C.id.type===ne.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(C.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.AST_NODE_TYPES.Identifier||a.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let m=u.parent;if(m.id.type===ne.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let C=new Set(l);for(let f of y.references){let E=f.identifier,x=E.parent;if(!(x.type===ne.AST_NODE_TYPES.VariableDeclarator&&x.id===E)){if(x.type===ne.AST_NODE_TYPES.MemberExpression&&x.object===E&&x.property.type===ne.AST_NODE_TYPES.Identifier&&C.has(x.property.name)){if(C.delete(x.property.name),C.size===0)break;continue}if(x.type===ne.AST_NODE_TYPES.VariableDeclarator&&x.init===E&&x.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of x.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&C.has(S.key.name)&&C.delete(S.key.name);if(C.size===0)break;continue}if(!(x.type===ne.AST_NODE_TYPES.MemberExpression&&x.object===E&&x.property.type===ne.AST_NODE_TYPES.Identifier&&!l.includes(x.property.name))){C.clear();break}}}if(C.size>0){let f=Array.from(C);if(f.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:f[0],fnName:u,customMsg:c||""}});else{let E=f.map(x=>`"${x}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function ni(e){return/^use[A-Z0-9]/.test(e)}function Rt(e){return e.type==="Identifier"?ni(e.name):e.type==="MemberExpression"&&!e.computed&&Rt(e.property)?e.object.type==="Identifier":!1}function ri(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function ii(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function oi(e){return!!(e.parent&&e.parent.callee&&ii(e.parent.callee,"forwardRef"))}function si(e){return!!(e.parent&&e.parent.callee&&ii(e.parent.callee,"memo"))}function Pn(e){for(;e;){let t=li(e);if(t&&(ri(t)||Rt(t))||oi(e)||si(e))return!0;e=e.parent}return!1}function ei(e){return!1}function On(e){return!1}var ga=/eslint +react-compiler\/react-compiler: +\["error/,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(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let a of e.sourceCode.getAllComments())if(ga.test(a.value))return{CallExpression(u){let m=null;u.callee.name==="useMemo"?m="useMemo":u.callee.name==="useCallback"&&(m="useCallback"),m&&e.report({node:u,message:`"${m}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let m=u.identifier.parent;if(m.type==="VariableDeclarator"&&m.init&&m.init.type==="CallExpression"&&m.init.callee&&ei(m.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let m=s.pop();if(m.size===0)return;let y=new Set;function C(h,b){let{cache:w}=C,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],R=p.slice(p.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=C(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function f(h,b){let{cache:w}=f,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),R=p.slice(p.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=f(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}C.cache=new Map,f.cache=new Map,E.cache=new Map;let x=f(a.initialSegment),S=li(u),I=Pn(u),A=S?ri(S)||Rt(S):oi(u)||si(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of m){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=C(h)*f(h),N=y.has(h.id);for(let p of b)if(N&&!On(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==x&&!On(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(S){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(u.type==="Program"){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(I&&!On(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&ni(d.parent.id.name))return}let R=`React Hook "${r(p)}" 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:p,message:R})}}},CallExpression(a){if(Rt(a.callee)){let u=ti(s),m=ti(i),y=u.get(m);y||(y=[],u.set(m,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||ei(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` 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"(a){a===o&&(o=null)},FunctionDeclaration(a){Pn(a)&&c(n(a))},ArrowFunctionExpression(a){Pn(a)&&c(n(a))}}}};function li(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 ge=require("@typescript-eslint/utils"),xe=ke(require("zod/v4"));var Sa=/^\s+$/,Nn=/\r?\n/,Ta=/^(\s*)/,ha=/^(\s*)\S/,Ea=/\r?\n/,ba=xe.object({indent:xe.union([xe.string().regex(Sa),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),Dn=Y({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[W(ba)],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 l(S){let I=S.split(Nn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(Ta);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
|
|
36
|
-
`)}function c(S,I,A){return S.split(
|
|
37
|
-
`)}function a(S){if(S.type===ge.AST_NODE_TYPES.Identifier)return S.name;if(S.type===ge.AST_NODE_TYPES.MemberExpression){let I=S.object.type===ge.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===ge.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 T=A.split(".");if(S.type===ge.AST_NODE_TYPES.MemberExpression&&S.object.type===ge.AST_NODE_TYPES.Identifier&&S.property.type===ge.AST_NODE_TYPES.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===ge.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function m(S,I){let A=S.parent;if(A.type!==ge.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let T=a(A.tag);return T?I.includes(T):!1}function y(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:h=!0,optionalMember:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function C(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:h=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function f(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&C(S.parent.callee.type===ge.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===ge.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(f(S)||o.length>0&&m(S,o)||n.length>0&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function x(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>t.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(
|
|
35
|
+
${m}`)),f.push(u.replaceText(o,y)),f}}]})}var Rt=require("@typescript-eslint/utils"),pa=Rt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ei="require-description",ca=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ua=/^eslint-disable-(next-)?line$/u,fa=pa({name:ei,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=ma(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:ga(o.loc),messageId:"missingDescription"}))}}}}}),ti={name:ei,rule:fa};function ma(e){let{text:t,description:r}=da(e.value);if(!t)return null;let n=ca.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=ua.test(o);if(e.type===Rt.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 ya=/\s-{2,}\s/u;function da(e){let t=e.split(ya);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ga(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),_e=require("zod/v4");var Sa=_e.z.object({varsToCheck:_e.z.array(_e.z.object({selector:_e.z.string().optional(),fromFnCall:_e.z.string().optional(),prop:_e.z.string().or(_e.z.array(_e.z.string())),errorMsg:_e.z.string().optional()}))}),Pn=H({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[W(Sa)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,l,c,a){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 m=l.filter(y=>!u.has(y));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:a,customMsg:c||""}});else{let y=m.map(C=>`"${C}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}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]=l=>{if(l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(l.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:l.id,fnName:o(l)}),l.type===ne.AST_NODE_TYPES.VariableDeclarator&&l.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];n(l.id,c,i.errorMsg,o(l))}});for(let i of t.varsToCheck)if(i.fromFnCall){let l=i.fromFnCall;if(l.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${l.slice(2)}"]`;s[a]=u=>{if(u.type!==ne.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let m=u.parent;if(m.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let y=m.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 C=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,C,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(l.includes(".")){let[c,a]=l.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;s[u]=m=>{if(m.type!==ne.AST_NODE_TYPES.MemberExpression||m.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let y=m.parent;if(y.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let C=y.parent;if(C.id.type===ne.AST_NODE_TYPES.Identifier)r.set(C.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:C.id,fnName:i.fromFnCall||"unknown function"});else if(C.id.type===ne.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(C.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${l}"]`;s[c]=a=>{if(a.type!==ne.AST_NODE_TYPES.Identifier||a.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let m=u.parent;if(m.id.type===ne.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===ne.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:l,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let C=new Set(l);for(let f of y.references){let E=f.identifier,x=E.parent;if(!(x.type===ne.AST_NODE_TYPES.VariableDeclarator&&x.id===E)){if(x.type===ne.AST_NODE_TYPES.MemberExpression&&x.object===E&&x.property.type===ne.AST_NODE_TYPES.Identifier&&C.has(x.property.name)){if(C.delete(x.property.name),C.size===0)break;continue}if(x.type===ne.AST_NODE_TYPES.VariableDeclarator&&x.init===E&&x.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let S of x.id.properties)S.type===ne.AST_NODE_TYPES.Property&&S.key.type===ne.AST_NODE_TYPES.Identifier&&C.has(S.key.name)&&C.delete(S.key.name);if(C.size===0)break;continue}if(!(x.type===ne.AST_NODE_TYPES.MemberExpression&&x.object===E&&x.property.type===ne.AST_NODE_TYPES.Identifier&&!l.includes(x.property.name))){C.clear();break}}}if(C.size>0){let f=Array.from(C);if(f.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:f[0],fnName:u,customMsg:c||""}});else{let E=f.map(x=>`"${x}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function ii(e){return/^use[A-Z0-9]/.test(e)}function Ft(e){return e.type==="Identifier"?ii(e.name):e.type==="MemberExpression"&&!e.computed&&Ft(e.property)?e.object.type==="Identifier":!1}function oi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function si(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function ai(e){return!!(e.parent&&e.parent.callee&&si(e.parent.callee,"forwardRef"))}function li(e){return!!(e.parent&&e.parent.callee&&si(e.parent.callee,"memo"))}function On(e){for(;e;){let t=ci(e);if(t&&(oi(t)||Ft(t))||ai(e)||li(e))return!0;e=e.parent}return!1}function ni(e){return!1}function Nn(e){return!1}var Ta=/eslint +react-compiler\/react-compiler: +\["error/,pi={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(a){let u=null;a.callee.name==="useMemo"?u="useMemo":a.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:a,message:`"${u}" is not necessary when using React Compiler.`})}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let a of e.sourceCode.getAllComments())if(Ta.test(a.value))return{CallExpression(u){let m=null;u.callee.name==="useMemo"?m="useMemo":u.callee.name==="useCallback"&&(m="useCallback"),m&&e.report({node:u,message:`"${m}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),n=typeof e.getScope=="function"?()=>n():a=>e.sourceCode.getScope(a),o=null,s=[],i=[],l=new WeakSet;function c(a){for(let u of a.references){let m=u.identifier.parent;if(m.type==="VariableDeclarator"&&m.init&&m.init.type==="CallExpression"&&m.init.callee&&ni(m.init.callee))for(let y of u.resolved.references)y!==u&&l.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,u){let m=s.pop();if(m.size===0)return;let y=new Set;function C(h,b){let{cache:w}=C,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=[...N],R=p.slice(p.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.prevSegments)k+=C(p,N)}return h.reachable&&k===BigInt("0")?w.delete(h.id):w.set(h.id,k),k}function f(h,b){let{cache:w}=f,k=w.get(h.id),N=new Set(b);if(N.has(h.id)){let p=Array.from(N),R=p.slice(p.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),k!==void 0)return k;if(a.thrownSegments.includes(h))k=BigInt("0");else if(h.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let p of h.nextSegments)k+=f(p,N)}return w.set(h.id,k),k}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let k of h.prevSegments){let N=E(k);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}C.cache=new Map,f.cache=new Map,E.cache=new Map;let x=f(a.initialSegment),S=ci(u),I=On(u),A=S?oi(S)||Ft(S):ai(u)||li(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of m){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),k=C(h)*f(h),N=y.has(h.id);for(let p of b)if(N&&!Nn(p)&&e.report({node:p,message:`React Hook "${r(p)}" 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:p,message:`React Hook "${r(p)}" cannot be called in an async function.`}),!N&&k!==x&&!Nn(p)){let d=`React Hook "${r(p)}" 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:p,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(S){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(u.type==="Program"){let R=`React Hook "${r(p)}" 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:p,message:R})}else if(I&&!Nn(p)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&ii(d.parent.id.name))return}let R=`React Hook "${r(p)}" 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:p,message:R})}}},CallExpression(a){if(Ft(a.callee)){let u=ri(s),m=ri(i),y=u.get(m);y||(y=[],u.set(m,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||ni(a.callee))&&a.arguments.length>0&&(o=a)},Identifier(a){o==null&&l.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` 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"(a){a===o&&(o=null)},FunctionDeclaration(a){On(a)&&c(n(a))},ArrowFunctionExpression(a){On(a)&&c(n(a))}}}};function ci(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 ri(e){return e[e.length-1]}var ge=require("@typescript-eslint/utils"),xe=ke(require("zod/v4"));var ha=/^\s+$/,Dn=/\r?\n/,Ea=/^(\s*)/,ba=/^(\s*)\S/,xa=/\r?\n/,Ca=xe.object({indent:xe.union([xe.string().regex(ha),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),jn=H({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[W(Ca)],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 l(S){let I=S.split(Dn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(Ea);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
|
|
36
|
+
`)}function c(S,I,A){return S.split(Dn).map(h=>h.trim()===""?h:A.repeat(I)+h).join(`
|
|
37
|
+
`)}function a(S){if(S.type===ge.AST_NODE_TYPES.Identifier)return S.name;if(S.type===ge.AST_NODE_TYPES.MemberExpression){let I=S.object.type===ge.AST_NODE_TYPES.Identifier?S.object.name:null,A=S.property.type===ge.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 T=A.split(".");if(S.type===ge.AST_NODE_TYPES.MemberExpression&&S.object.type===ge.AST_NODE_TYPES.Identifier&&S.property.type===ge.AST_NODE_TYPES.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===ge.AST_NODE_TYPES.Identifier&&S.name===A)return!0;return!1}function m(S,I){let A=S.parent;if(A.type!==ge.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let T=a(A.tag);return T?I.includes(T):!1}function y(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:h=!0,optionalMember:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.property.name===A}function C(S,I){if(!S||S.type!==ge.AST_NODE_TYPES.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:h=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==ge.AST_NODE_TYPES.Identifier?!1:S.callee.name===A}function f(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments[0]===S&&C(S.parent.callee.type===ge.AST_NODE_TYPES.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===ge.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(f(S)||o.length>0&&m(S,o)||n.length>0&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function x(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>t.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(xa);if(!T)return;let h=T[0],b=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(ba)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let R=l(A).replace(new RegExp(`^${h}|${h}[ ]*$`,"g"),""),d=h+c(R,1,k+N)+h+k,g=A.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,F=A.split(
|
|
40
|
+
`,F=A.split(Dn),P=F.map((j,J)=>J!==F.length-1&&j===N+k?"":j).join(g);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:j=>d.split(I).map((J,G)=>{let Y=S.quasis[G];return Y?j.replaceTextRange([Y.range[0]+1,Y.range[1]-(Y.tail?1:2)],J):[]}).flat()}}return{TemplateLiteral(S){if(!E(S))return;let I=x(S);if(I)return e.report(I)}}}});var Ln=require("@typescript-eslint/utils");function Ia(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Aa(e){let t=e.parent;return t?.type===Ln.AST_NODE_TYPES.NewExpression&&t.callee.type===Ln.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var Mn=H({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){Ia(r)||Aa(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Te=require("@typescript-eslint/utils"),ot=require("zod/v4");var wa=ot.z.object({checkOnly:ot.z.array(ot.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:ot.z.array(ot.z.string()).optional()}),_n=H({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:[W(wa)],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(f){for(let E of o)if(f.range[0]>=E.range[0]&&f.range[1]<=E.range[1])return E;return null}function i(f){let E=f.parent;for(;E;){if(E.type===Te.AST_NODE_TYPES.FunctionDeclaration||E.type===Te.AST_NODE_TYPES.FunctionExpression||E.type===Te.AST_NODE_TYPES.ArrowFunctionExpression){let x=E.params;for(let S of x)if(f.range[0]>=S.range[0]&&f.range[1]<=S.range[1])return!0;break}E=E.parent}return!1}function l(f){let E=f.parent;for(;E;){if(E.type===Te.AST_NODE_TYPES.TSTypeParameterInstantiation){let x=E.parent;if(x.type===Te.AST_NODE_TYPES.TSTypeReference&&x.typeName.type===Te.AST_NODE_TYPES.Identifier&&(x.typeName.name==="FC"||x.typeName.name==="React.FC")||x.type===Te.AST_NODE_TYPES.TSTypeReference&&x.typeName.type===Te.AST_NODE_TYPES.TSQualifiedName&&x.typeName.right.name==="FC")return!0}E=E.parent}return!1}function c(f){let E=f.parent;for(;E;){if(E.type===Te.AST_NODE_TYPES.TSTypeParameterInstantiation){let x=E.parent;if(x.type===Te.AST_NODE_TYPES.CallExpression||x.type===Te.AST_NODE_TYPES.NewExpression)return!0}E=E.parent}return!1}function a(f){let E=f.parent;for(;E;){if(E.type===Te.AST_NODE_TYPES.TSTypeAliasDeclaration||E.type===Te.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;E=E.parent}return!1}function u(f){return f.parent.type===Te.AST_NODE_TYPES.TSIndexedAccessType&&f.parent.objectType===f}let m=[];function y(f){let E=[],x=new Map;for(let{typeName:I,firstUsage:A}of f){let T=x.get(A)||[];T.push(I),x.set(A,T)}for(let{typeName:I,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h}of f){let b=n.get(I);if(!b||b.statement===A)continue;let w=o.indexOf(b.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let N=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&h),R=(x.get(A)||[]).length>1;(N||R?w>k:w>k||w!==k-1)&&E.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:T})}if(E.length===0)return;E.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let h=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return h-b});let S=E[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:C(E)})}function C(f){return function*(E){let x=new Map;for(let S of f){let I=x.get(S.targetStatement)||[];I.push(S),x.set(S.targetStatement,I)}for(let[,S]of x)S.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let h=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return h-b});for(let S of f){let{typeDef:I}=S,A=I.statement,T=r.getCommentsBefore(A),h=A.range[0],b=A.range[1];T.length>0&&T[0]&&(h=T[0].range[0]),yield E.removeRange([h,b])}for(let[S,I]of x){let A=r.getCommentsBefore(S),T=A.length>0&&A[0]?A[0].range[0]:S.range[0],h=[];for(let b of I){let w=b.typeDef.statement,k=r.getText(w),N=r.getCommentsBefore(w),p=k;N.length>0&&(p=`${N.map(d=>r.getText(d)).join(`
|
|
41
41
|
`)}
|
|
42
42
|
${k}`),h.push(p)}yield E.insertTextBeforeRange([T,T],`${h.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(f){o.push(...f.body)},TSTypeAliasDeclaration(f){if(o.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=s(f);x&&n.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSInterfaceDeclaration(f){if(o.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=s(f);x&&n.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSTypeReference(f){if(f.typeName.type===Te.AST_NODE_TYPES.Identifier){if(u(f))return;let E=i(f),x=l(f),S=c(f);m.push({typeName:f.typeName.name,node:f,inFunctionArgs:E,inFCProps:x,inGenericArgAtFunctionCall:S,usagePosition:f.range[0]})}},"Program:exit"(){let f=new Map;function E(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 m){let{typeName:I,node:A}=S;if(!n.has(I)||!E(S))continue;let T=s(A),h=n.get(I);if(!T||!h||T===h.statement)continue;f.has(I)||f.set(I,[]);let b=f.get(I);if(!b)return;b.includes(T)||b.push(T)}let x=[];for(let[S,I]of f)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let T=Number.MAX_SAFE_INTEGER,h=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of m)E(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,h=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S)continue;let p=s(N.node);if(!p)continue;let R=o.indexOf(p);R!==-1&&R<w&&(w=R)}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 m){if(N.typeName!==S||a(N.node))continue;let p=s(N.node);if(!p)continue;let R=o.indexOf(p);R!==-1&&R<w&&(w=R)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}x.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h})}x.length>0&&y(x)}}}});var ie=require("@typescript-eslint/utils"),ot=ke(require("zod/v4"));var Aa=["tsx"],wa=/^[A-Z][A-Za-z0-9]*$/,Ra=ot.object({extensions:ot.array(ot.string()).optional()}),_n=Y({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:[W(Ra)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??Aa,o=!1;for(let T of n)if(r.endsWith(T)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,l=new Map;function c(T){return wa.test(T)}function a(T){if(T.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let h=T.callee;return h.type===ie.AST_NODE_TYPES.Identifier?h.name==="memo"||h.name==="forwardRef":h.type===ie.AST_NODE_TYPES.MemberExpression&&h.property.type===ie.AST_NODE_TYPES.Identifier?h.property.name==="memo"||h.property.name==="forwardRef":!1}function u(T){if(T.type===ie.AST_NODE_TYPES.JSXElement||T.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(T.type===ie.AST_NODE_TYPES.ArrayExpression){for(let h of T.elements)if(h&&(h.type===ie.AST_NODE_TYPES.JSXElement||h.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function m(T){if(T.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let h=T.body;if(h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let b=h.body;if(u(b))return!0}return!1}function y(T){if(T.id.type!==ie.AST_NODE_TYPES.Identifier)return;let h=T.id.name,b=T.init;if(b){if(c(h)&&(b.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||b.type===ie.AST_NODE_TYPES.FunctionExpression||a(b))){i.add(h);return}b.type===ie.AST_NODE_TYPES.Identifier&&l.set(h,b.name),c(h)||m(b)&&i.add(h)}}function C(T){if(T.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let h of T.declarations)y(h);return}if(T.type===ie.AST_NODE_TYPES.FunctionDeclaration&&T.id){c(T.id.name)&&i.add(T.id.name);return}if(T.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration){let h=T.declaration;if(h.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let b of h.declarations)y(b);return}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration&&h.id){c(h.id.name)&&i.add(h.id.name);return}}}for(let T of s.ast.body)C(T);function f(T,h=new Set){if(i.has(T))return!0;if(h.has(T))return!1;h.add(T);let b=l.get(T);return b?f(b,h):!1}let E=[];function x(T,h,b){E.push({node:T,isType:h,isComponent:b})}for(let T of s.ast.body){if(T.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let h=T.exportKind==="type";if(T.declaration){let b=T.declaration;if(b.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){x(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=f(k);x(w,h,N)}continue}if(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,k=w?f(w)||c(w):!1;x(b,h,k);continue}x(b,h,!1);continue}if(T.specifiers.length>0)for(let b of T.specifiers){if(b.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=b.local.name,k=f(w);x(b,h,k)}continue}if(T.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let h=T.declaration;if(h.type===ie.AST_NODE_TYPES.Identifier){let b=f(h.name)||c(h.name);x(T,!1,b);continue}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration||h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||h.type===ie.AST_NODE_TYPES.FunctionExpression||h.type===ie.AST_NODE_TYPES.CallExpression){x(T,!1,!0);continue}x(T,!1,!1);continue}}let S=!1;for(let T of E)if(!T.isType&&T.isComponent){S=!0;break}if(!S)return{};let I=[];for(let T of E)T.isType||I.push(T);let A=-1;for(let[T,h]of I.entries())if(h.isComponent){A=T;break}if(A===-1)return{};for(let[T,h]of I.entries())if(T!==A){e.report({node:h.node,messageId:"multipleExports"});break}return{}}});var Ve=require("@typescript-eslint/utils"),Ft=require("zod/v4");function vt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fa(e){return e.callee.type===Ve.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Ve.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Ve.AST_NODE_TYPES.Identifier&&e.callee.property.type===Ve.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var va=Ft.z.object({ignorePrefixes:Ft.z.array(Ft.z.string()).optional()});function pi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function ka(e){return`set${vt(e)}`}var $n=Y({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:[W(va)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Ve.AST_NODE_TYPES.CallExpression||!Fa(r.init)||r.id.type!==Ve.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Ve.AST_NODE_TYPES.Identifier||o.type!==Ve.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,l=t.ignorePrefixes||[],c=pi(s,l),a=pi(i,l);if(c===""){if(!a.startsWith("set")){let m=`set${vt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:vt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(o,m)}]})}return}let u=ka(c);a!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:vt(c),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:m=>m.replaceText(o,u)}]})}}}});var de=require("@typescript-eslint/utils"),Ke=require("zod/v4");var Pa=Ke.z.object({name:Ke.z.string(),defaults:Ke.z.array(Ke.z.unknown())}),Oa=Ke.z.object({functions:Ke.z.array(Pa)});function kt(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)=>kt(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 l=s.value,c=i.value;if(!kt(l,c))return!1}return!0}function Na(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&&kt(o.value,s.value)&&r.add(n)}return r}function ci(e){if(e.type===de.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case de.AST_NODE_TYPES.Literal:return e.value;case de.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===de.AST_NODE_TYPES.Property&&r.key.type===de.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===de.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===de.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=ci(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case de.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===de.AST_NODE_TYPES.SpreadElement))return t.type===de.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Da(e){return e.type===de.AST_NODE_TYPES.Identifier?e.name:e.type===de.AST_NODE_TYPES.MemberExpression&&e.property.type===de.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Un=Y({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:[W(Oa)]},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=Da(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let l=-1,c=!1,a=new Map,u=new Set,m=new Map,y=[];for(let f=0;f<i.length;f++){if(f>=s.length){l=f;continue}let E=s[f],x=i[f];if(!x||x.type===de.AST_NODE_TYPES.SpreadElement){l=f;continue}let S=ci(x);if(E===void 0){l=f;continue}if(kt(S,E)){x.type===de.AST_NODE_TYPES.ObjectExpression?(u.add(f),y.push({type:"object",position:f+1})):(m.set(f,S),y.push({type:"simple",position:f+1,value:S}));continue}if(x.type===de.AST_NODE_TYPES.ObjectExpression&&x.properties.length===0&&typeof E=="object"&&E!==null&&Object.keys(E).length>0){u.add(f),y.push({type:"object",position:f+1});continue}let I=Na(S,E);if(I.size>0){let A=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(x.type===de.AST_NODE_TYPES.ObjectExpression&&x.properties.length===I.size&&x.properties.length===A){u.add(f),y.push({type:"object",position:f+1});continue}else c=!0,a.set(f,I),y.push({type:"partialObject",position:f+1,redundantProperties:Array.from(I)}),l=f}else l=f}if(l<i.length-1||c||u.size>0){let f=function(){let x=[];for(let S of y)if(S.type==="simple")x.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")x.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 T=A;for(let h of I)if(h in T){let b=Object.getOwnPropertyDescriptor(T,h);b&&x.push(`Param ${S.position} property "${h}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:x.join(", ")}}};var C=f;let E=f();e.report({node:n,messageId:E.messageId,data:E.data,fix(x){let S=[];if(c)for(let[A,T]of a){let h=i[A];if(h&&h.type===de.AST_NODE_TYPES.ObjectExpression){let b=[];for(let k of h.properties)k.type===de.AST_NODE_TYPES.Property&&k.key.type===de.AST_NODE_TYPES.Identifier&&!k.computed&&T.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(x.replaceText(h,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=l){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),T=e.sourceCode.getLastToken(n);A&&T&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(n);T&&A&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});var Re=require("@typescript-eslint/utils");function ja(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 La(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=Y({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){ja(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){La(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var L=require("@typescript-eslint/utils"),Pt=require("zod/v4");var Ma=Pt.z.object({mainComponentRegex:Pt.z.string().optional(),mainComponentSelector:Pt.z.string().optional()}),_a=/^[A-Z][A-Za-z0-9]*$/,Wn=Y({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:[W(Ma)],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,l=new Map,c=[],a=[],u=new Set;function m(d){let g=d.node;if(g.type===L.AST_NODE_TYPES.VariableDeclaration){for(let F of g.declarations)if(F.id.type===L.AST_NODE_TYPES.Identifier&&F.id.name===d.name&&F.init)return F.init}if(g.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let F=g.declaration;if(F&&F.type===L.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===L.AST_NODE_TYPES.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let g=new Set;return Ne(d,F=>(F.type===L.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&g.add(F.name),!1),r),g}function C(d){return _a.test(d)}function f(d){if(d.type!==L.AST_NODE_TYPES.CallExpression)return!1;let g=d.callee;return g.type===L.AST_NODE_TYPES.Identifier?g.name==="memo"||g.name==="forwardRef":g.type===L.AST_NODE_TYPES.MemberExpression&&g.property.type===L.AST_NODE_TYPES.Identifier?g.property.name==="memo"||g.property.name==="forwardRef":!1}function E(d){if(d.type===L.AST_NODE_TYPES.JSXElement||d.type===L.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===L.AST_NODE_TYPES.BlockStatement){for(let g of d.body)if(g.type===L.AST_NODE_TYPES.ReturnStatement&&g.argument)return E(g.argument)}if(d.type===L.AST_NODE_TYPES.ArrayExpression){for(let g of d.elements)if(g&&(g.type===L.AST_NODE_TYPES.JSXElement||g.type===L.AST_NODE_TYPES.JSXFragment))return!0}return!1}function x(d){if(d.type!==L.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let g=d.body;if(g.type===L.AST_NODE_TYPES.ArrowFunctionExpression){let F=g.body;if(E(F))return!0}return!1}function S(d){if(d.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let g=d.tag;if(g.type===L.AST_NODE_TYPES.MemberExpression&&g.object.type===L.AST_NODE_TYPES.Identifier&&g.object.name==="styled")return!0;if(g.type===L.AST_NODE_TYPES.CallExpression){let F=g.callee;if(F.type===L.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let g=d.tag;if(g.type===L.AST_NODE_TYPES.Identifier&&g.name==="css")return!0}return!1}function A(d,g){if(d.id.type!==L.AST_NODE_TYPES.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){a.push({node:g,name:F});return}if((C(F)||P.type===L.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===L.AST_NODE_TYPES.ArrowFunctionExpression||P.type===L.AST_NODE_TYPES.FunctionExpression||f(P))){if(P.type===L.AST_NODE_TYPES.ArrowFunctionExpression||P.type===L.AST_NODE_TYPES.FunctionExpression){if(E(P.body)){i.add(F);return}}else if(f(P)){i.add(F);return}}P.type===L.AST_NODE_TYPES.Identifier&&l.set(F,P.name),C(F)||x(P)&&i.add(F)}}function T(d){return d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration||d.type===L.AST_NODE_TYPES.ExportNamedDeclaration}function h(d){if(d.type===L.AST_NODE_TYPES.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===L.AST_NODE_TYPES.VariableDeclaration){let g=d.declarations[0];if(g&&g.id.type===L.AST_NODE_TYPES.Identifier)return g.id.name}if(d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let g=d.declaration;if(g.type===L.AST_NODE_TYPES.FunctionDeclaration)return g.id?g.id.name:"default";if(g.type===L.AST_NODE_TYPES.Identifier)return g.name}if(d.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let g=d.declaration;if(g&&g.type===L.AST_NODE_TYPES.FunctionDeclaration)return g.id?g.id.name:null;if(g&&g.type===L.AST_NODE_TYPES.VariableDeclaration){let F=g.declarations[0];if(F&&F.id.type===L.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function b(d,g){return o?u.has(d):n?n.test(g):T(d)}function w(d){let g=new Set;Ne(d.node,F=>{if(F.type===L.AST_NODE_TYPES.Identifier)for(let P of a)P.name===F.name&&(g.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===L.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===L.AST_NODE_TYPES.JSXIdentifier)for(let j of a)j.name===P.name.name&&(g.add(j.name),(j.firstUsagePosition===void 0||P.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=g}function k(d){if(d.type===L.AST_NODE_TYPES.VariableDeclaration){for(let g of d.declarations)A(g,d);return}if(d.type===L.AST_NODE_TYPES.FunctionDeclaration){C(d.id.name)&&E(d.body)&&i.add(d.id.name);return}if(d.type===L.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let g=d.declaration;if(g.type===L.AST_NODE_TYPES.VariableDeclaration){for(let F of g.declarations)A(F,d);return}if(g.type===L.AST_NODE_TYPES.FunctionDeclaration&&g.id){C(g.id.name)&&E(g.body)&&i.add(g.id.name);return}}if(d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let g=d.declaration;g.type===L.AST_NODE_TYPES.Identifier&&i.add(g.name),(g.type===L.AST_NODE_TYPES.FunctionDeclaration||g.type===L.AST_NODE_TYPES.ArrowFunctionExpression||g.type===L.AST_NODE_TYPES.FunctionExpression)&&(g.type===L.AST_NODE_TYPES.FunctionDeclaration?g.id?i.add(g.id.name):i.add("default"):E(g.body)&&i.add("default"))}}function N(d,g=new Set){if(i.has(d))return!0;if(g.has(d))return!1;g.add(d);let F=l.get(d);return F?N(F,g):!1}let p={};return o&&(p[o]=d=>{let g=d;for(;g.parent&&g.parent.type!==L.AST_NODE_TYPES.Program;)g=g.parent;g.parent&&(g.type===L.AST_NODE_TYPES.VariableDeclaration||g.type===L.AST_NODE_TYPES.FunctionDeclaration||g.type===L.AST_NODE_TYPES.ExportNamedDeclaration||g.type===L.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(g)}),p["Program:exit"]=d=>{let g=0;for(let D of d.body){if(D.type===L.AST_NODE_TYPES.ImportDeclaration){g+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=h(D);if(Z&&N(Z)){let q=b(D,Z);c.push({node:D,name:Z,isMainComponent:q,usedStyles:new Set,isExported:T(D)})}}if(!o&&n&&!c.some(D=>D.isMainComponent))for(let D of c)D.isExported&&(D.isMainComponent=!0);for(let D of c)w(D);let F=new Set;for(let D of a)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 q of a)q.node===Z&&P.set(q.name,D)}let j=new Map;for(let D of a){let Z=m(D),q=new Set;if(Z){let ue=y(Z);for(let fe of ue)F.has(fe)&&fe!==D.name&&q.add(fe)}j.set(D.name,q)}let J=new Map;for(let D of a){let Z=j.get(D.name);if(!Z)continue;let q=P.get(D.name);if(q!==void 0)for(let ue of Z){let fe=J.get(ue);(fe===void 0||q<fe)&&J.set(ue,q)}}let G=[];for(let D of a){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),q=-1;for(let Ee of c){if(!Ee.usedStyles.has(D.name))continue;let Ie=d.body.indexOf(Ee.node);(q===-1||Ie<q)&&(q=Ie)}let ue=J.get(D.name);if(ue!==void 0&&(q===-1||ue<q)&&(q=ue),q===-1)continue;let fe=-1;for(let Ee of c){let Ie=d.body.indexOf(Ee.node);Ie<q&&Ie>fe&&(fe=Ie)}let Fe=Z<q,Je=Z>fe,Se=-1,at=j.get(D.name);if(at)for(let Ee of at){let Ie=P.get(Ee);Ie!==void 0&&Ie>Se&&(Se=Ie)}let Qe=Z>Se;if(!(Fe&&Je&&Qe)){let Ee=fe+1;if(Se+1>Ee&&(Ee=Se+1),Ee<g&&(Ee=g),Ee>q)continue;G.push({style:D,targetPosition:Ee})}}let H=null;if(c.length>1){let D=c.map(q=>({c:q,idx:d.body.indexOf(q.node)})).sort((q,ue)=>q.idx-ue.idx)[0]?.c,Z=c.find(q=>q.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(H={component:Z,targetBefore:D.node})}if(G.length>0||H){let D=G[0]?.style.node||H?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:R(G,H,d.body)})}},p;function R(d,g,F){return function*(P){d.sort((J,G)=>J.targetPosition-G.targetPosition);for(let{style:J}of d){let G=r.getCommentsBefore(J.node),H=J.node.range[0],D=J.node.range[1];G.length>0&&G[0]&&(H=G[0].range[0]),H===J.node.range[0]&&r.text.slice(0,H).trim().length===0&&(H=0),yield P.removeRange([H,D])}let j=new Map;for(let J of d){let G=j.get(J.targetPosition)||[];G.push(J),j.set(J.targetPosition,G)}for(let[J,G]of j){let H=F[J];if(!H)continue;let D=r.getCommentsBefore(H),Z=D.length>0&&D[0]?D[0].range[0]:H.range[0],q=[];for(let{style:ue}of G){let fe=r.getCommentsBefore(ue.node),Fe=r.getText(ue.node);fe.length>0&&(Fe=`${fe.map(Se=>r.getText(Se)).join(`
|
|
46
|
+
`)}}}return{Program(f){o.push(...f.body)},TSTypeAliasDeclaration(f){if(o.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=s(f);x&&n.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSInterfaceDeclaration(f){if(o.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=s(f);x&&n.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSTypeReference(f){if(f.typeName.type===Te.AST_NODE_TYPES.Identifier){if(u(f))return;let E=i(f),x=l(f),S=c(f);m.push({typeName:f.typeName.name,node:f,inFunctionArgs:E,inFCProps:x,inGenericArgAtFunctionCall:S,usagePosition:f.range[0]})}},"Program:exit"(){let f=new Map;function E(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 m){let{typeName:I,node:A}=S;if(!n.has(I)||!E(S))continue;let T=s(A),h=n.get(I);if(!T||!h||T===h.statement)continue;f.has(I)||f.set(I,[]);let b=f.get(I);if(!b)return;b.includes(T)||b.push(T)}let x=[];for(let[S,I]of f)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let T=Number.MAX_SAFE_INTEGER,h=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of m)E(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,h=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S)continue;let p=s(N.node);if(!p)continue;let R=o.indexOf(p);R!==-1&&R<w&&(w=R)}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 m){if(N.typeName!==S||a(N.node))continue;let p=s(N.node);if(!p)continue;let R=o.indexOf(p);R!==-1&&R<w&&(w=R)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}x.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h})}x.length>0&&y(x)}}}});var ie=require("@typescript-eslint/utils"),st=ke(require("zod/v4"));var Ra=["tsx"],Fa=/^[A-Z][A-Za-z0-9]*$/,va=st.object({extensions:st.array(st.string()).optional()}),$n=H({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:[W(va)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??Ra,o=!1;for(let T of n)if(r.endsWith(T)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,l=new Map;function c(T){return Fa.test(T)}function a(T){if(T.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let h=T.callee;return h.type===ie.AST_NODE_TYPES.Identifier?h.name==="memo"||h.name==="forwardRef":h.type===ie.AST_NODE_TYPES.MemberExpression&&h.property.type===ie.AST_NODE_TYPES.Identifier?h.property.name==="memo"||h.property.name==="forwardRef":!1}function u(T){if(T.type===ie.AST_NODE_TYPES.JSXElement||T.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(T.type===ie.AST_NODE_TYPES.ArrayExpression){for(let h of T.elements)if(h&&(h.type===ie.AST_NODE_TYPES.JSXElement||h.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function m(T){if(T.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let h=T.body;if(h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let b=h.body;if(u(b))return!0}return!1}function y(T){if(T.id.type!==ie.AST_NODE_TYPES.Identifier)return;let h=T.id.name,b=T.init;if(b){if(c(h)&&(b.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||b.type===ie.AST_NODE_TYPES.FunctionExpression||a(b))){i.add(h);return}b.type===ie.AST_NODE_TYPES.Identifier&&l.set(h,b.name),c(h)||m(b)&&i.add(h)}}function C(T){if(T.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let h of T.declarations)y(h);return}if(T.type===ie.AST_NODE_TYPES.FunctionDeclaration&&T.id){c(T.id.name)&&i.add(T.id.name);return}if(T.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration){let h=T.declaration;if(h.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let b of h.declarations)y(b);return}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration&&h.id){c(h.id.name)&&i.add(h.id.name);return}}}for(let T of s.ast.body)C(T);function f(T,h=new Set){if(i.has(T))return!0;if(h.has(T))return!1;h.add(T);let b=l.get(T);return b?f(b,h):!1}let E=[];function x(T,h,b){E.push({node:T,isType:h,isComponent:b})}for(let T of s.ast.body){if(T.type===ie.AST_NODE_TYPES.ExportNamedDeclaration){let h=T.exportKind==="type";if(T.declaration){let b=T.declaration;if(b.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||b.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){x(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=f(k);x(w,h,N)}continue}if(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,k=w?f(w)||c(w):!1;x(b,h,k);continue}x(b,h,!1);continue}if(T.specifiers.length>0)for(let b of T.specifiers){if(b.local.type!==ie.AST_NODE_TYPES.Identifier)continue;let w=b.local.name,k=f(w);x(b,h,k)}continue}if(T.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let h=T.declaration;if(h.type===ie.AST_NODE_TYPES.Identifier){let b=f(h.name)||c(h.name);x(T,!1,b);continue}if(h.type===ie.AST_NODE_TYPES.FunctionDeclaration||h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||h.type===ie.AST_NODE_TYPES.FunctionExpression||h.type===ie.AST_NODE_TYPES.CallExpression){x(T,!1,!0);continue}x(T,!1,!1);continue}}let S=!1;for(let T of E)if(!T.isType&&T.isComponent){S=!0;break}if(!S)return{};let I=[];for(let T of E)T.isType||I.push(T);let A=-1;for(let[T,h]of I.entries())if(h.isComponent){A=T;break}if(A===-1)return{};for(let[T,h]of I.entries())if(T!==A){e.report({node:h.node,messageId:"multipleExports"});break}return{}}});var Ve=require("@typescript-eslint/utils"),vt=require("zod/v4");function kt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ka(e){return e.callee.type===Ve.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Ve.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Ve.AST_NODE_TYPES.Identifier&&e.callee.property.type===Ve.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Pa=vt.z.object({ignorePrefixes:vt.z.array(vt.z.string()).optional()});function ui(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Oa(e){return`set${kt(e)}`}var Un=H({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:[W(Pa)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Ve.AST_NODE_TYPES.CallExpression||!ka(r.init)||r.id.type!==Ve.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Ve.AST_NODE_TYPES.Identifier||o.type!==Ve.AST_NODE_TYPES.Identifier)return;let s=n.name,i=o.name,l=t.ignorePrefixes||[],c=ui(s,l),a=ui(i,l);if(c===""){if(!a.startsWith("set")){let m=`set${kt(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:kt(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(o,m)}]})}return}let u=Oa(c);a!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:kt(c),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:m=>m.replaceText(o,u)}]})}}}});var de=require("@typescript-eslint/utils"),Ke=require("zod/v4");var Na=Ke.z.object({name:Ke.z.string(),defaults:Ke.z.array(Ke.z.unknown())}),Da=Ke.z.object({functions:Ke.z.array(Na)});function Pt(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)=>Pt(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 l=s.value,c=i.value;if(!Pt(l,c))return!1}return!0}function ja(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&&Pt(o.value,s.value)&&r.add(n)}return r}function fi(e){if(e.type===de.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case de.AST_NODE_TYPES.Literal:return e.value;case de.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===de.AST_NODE_TYPES.Property&&r.key.type===de.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===de.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===de.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=fi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case de.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===de.AST_NODE_TYPES.SpreadElement))return t.type===de.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function La(e){return e.type===de.AST_NODE_TYPES.Identifier?e.name:e.type===de.AST_NODE_TYPES.MemberExpression&&e.property.type===de.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var zn=H({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:[W(Da)]},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=La(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let l=-1,c=!1,a=new Map,u=new Set,m=new Map,y=[];for(let f=0;f<i.length;f++){if(f>=s.length){l=f;continue}let E=s[f],x=i[f];if(!x||x.type===de.AST_NODE_TYPES.SpreadElement){l=f;continue}let S=fi(x);if(E===void 0){l=f;continue}if(Pt(S,E)){x.type===de.AST_NODE_TYPES.ObjectExpression?(u.add(f),y.push({type:"object",position:f+1})):(m.set(f,S),y.push({type:"simple",position:f+1,value:S}));continue}if(x.type===de.AST_NODE_TYPES.ObjectExpression&&x.properties.length===0&&typeof E=="object"&&E!==null&&Object.keys(E).length>0){u.add(f),y.push({type:"object",position:f+1});continue}let I=ja(S,E);if(I.size>0){let A=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(x.type===de.AST_NODE_TYPES.ObjectExpression&&x.properties.length===I.size&&x.properties.length===A){u.add(f),y.push({type:"object",position:f+1});continue}else c=!0,a.set(f,I),y.push({type:"partialObject",position:f+1,redundantProperties:Array.from(I)}),l=f}else l=f}if(l<i.length-1||c||u.size>0){let f=function(){let x=[];for(let S of y)if(S.type==="simple")x.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")x.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 T=A;for(let h of I)if(h in T){let b=Object.getOwnPropertyDescriptor(T,h);b&&x.push(`Param ${S.position} property "${h}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:x.join(", ")}}};var C=f;let E=f();e.report({node:n,messageId:E.messageId,data:E.data,fix(x){let S=[];if(c)for(let[A,T]of a){let h=i[A];if(h&&h.type===de.AST_NODE_TYPES.ObjectExpression){let b=[];for(let k of h.properties)k.type===de.AST_NODE_TYPES.Property&&k.key.type===de.AST_NODE_TYPES.Identifier&&!k.computed&&T.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(x.replaceText(h,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=l){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),T=e.sourceCode.getLastToken(n);A&&T&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(n);T&&A&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});var Re=require("@typescript-eslint/utils");function Ma(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 _a(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 Wn=H({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){Ma(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){_a(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var L=require("@typescript-eslint/utils"),Ot=require("zod/v4");var $a=Ot.z.object({mainComponentRegex:Ot.z.string().optional(),mainComponentSelector:Ot.z.string().optional()}),Ua=/^[A-Z][A-Za-z0-9]*$/,Vn=H({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:[W($a)],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,l=new Map,c=[],a=[],u=new Set;function m(d){let g=d.node;if(g.type===L.AST_NODE_TYPES.VariableDeclaration){for(let F of g.declarations)if(F.id.type===L.AST_NODE_TYPES.Identifier&&F.id.name===d.name&&F.init)return F.init}if(g.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let F=g.declaration;if(F&&F.type===L.AST_NODE_TYPES.VariableDeclaration){for(let P of F.declarations)if(P.id.type===L.AST_NODE_TYPES.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let g=new Set;return Ne(d,F=>(F.type===L.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&g.add(F.name),!1),r),g}function C(d){return Ua.test(d)}function f(d){if(d.type!==L.AST_NODE_TYPES.CallExpression)return!1;let g=d.callee;return g.type===L.AST_NODE_TYPES.Identifier?g.name==="memo"||g.name==="forwardRef":g.type===L.AST_NODE_TYPES.MemberExpression&&g.property.type===L.AST_NODE_TYPES.Identifier?g.property.name==="memo"||g.property.name==="forwardRef":!1}function E(d){if(d.type===L.AST_NODE_TYPES.JSXElement||d.type===L.AST_NODE_TYPES.JSXFragment)return!0;if(d.type===L.AST_NODE_TYPES.BlockStatement){for(let g of d.body)if(g.type===L.AST_NODE_TYPES.ReturnStatement&&g.argument)return E(g.argument)}if(d.type===L.AST_NODE_TYPES.ArrayExpression){for(let g of d.elements)if(g&&(g.type===L.AST_NODE_TYPES.JSXElement||g.type===L.AST_NODE_TYPES.JSXFragment))return!0}return!1}function x(d){if(d.type!==L.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let g=d.body;if(g.type===L.AST_NODE_TYPES.ArrowFunctionExpression){let F=g.body;if(E(F))return!0}return!1}function S(d){if(d.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let g=d.tag;if(g.type===L.AST_NODE_TYPES.MemberExpression&&g.object.type===L.AST_NODE_TYPES.Identifier&&g.object.name==="styled")return!0;if(g.type===L.AST_NODE_TYPES.CallExpression){let F=g.callee;if(F.type===L.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let g=d.tag;if(g.type===L.AST_NODE_TYPES.Identifier&&g.name==="css")return!0}return!1}function A(d,g){if(d.id.type!==L.AST_NODE_TYPES.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){a.push({node:g,name:F});return}if((C(F)||P.type===L.AST_NODE_TYPES.ArrowFunctionExpression)&&(P.type===L.AST_NODE_TYPES.ArrowFunctionExpression||P.type===L.AST_NODE_TYPES.FunctionExpression||f(P))){if(P.type===L.AST_NODE_TYPES.ArrowFunctionExpression||P.type===L.AST_NODE_TYPES.FunctionExpression){if(E(P.body)){i.add(F);return}}else if(f(P)){i.add(F);return}}P.type===L.AST_NODE_TYPES.Identifier&&l.set(F,P.name),C(F)||x(P)&&i.add(F)}}function T(d){return d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration||d.type===L.AST_NODE_TYPES.ExportNamedDeclaration}function h(d){if(d.type===L.AST_NODE_TYPES.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===L.AST_NODE_TYPES.VariableDeclaration){let g=d.declarations[0];if(g&&g.id.type===L.AST_NODE_TYPES.Identifier)return g.id.name}if(d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let g=d.declaration;if(g.type===L.AST_NODE_TYPES.FunctionDeclaration)return g.id?g.id.name:"default";if(g.type===L.AST_NODE_TYPES.Identifier)return g.name}if(d.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let g=d.declaration;if(g&&g.type===L.AST_NODE_TYPES.FunctionDeclaration)return g.id?g.id.name:null;if(g&&g.type===L.AST_NODE_TYPES.VariableDeclaration){let F=g.declarations[0];if(F&&F.id.type===L.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function b(d,g){return o?u.has(d):n?n.test(g):T(d)}function w(d){let g=new Set;Ne(d.node,F=>{if(F.type===L.AST_NODE_TYPES.Identifier)for(let P of a)P.name===F.name&&(g.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===L.AST_NODE_TYPES.JSXElement){let P=F.openingElement;if(P.name.type===L.AST_NODE_TYPES.JSXIdentifier)for(let j of a)j.name===P.name.name&&(g.add(j.name),(j.firstUsagePosition===void 0||P.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=g}function k(d){if(d.type===L.AST_NODE_TYPES.VariableDeclaration){for(let g of d.declarations)A(g,d);return}if(d.type===L.AST_NODE_TYPES.FunctionDeclaration){C(d.id.name)&&E(d.body)&&i.add(d.id.name);return}if(d.type===L.AST_NODE_TYPES.ExportNamedDeclaration&&d.declaration){let g=d.declaration;if(g.type===L.AST_NODE_TYPES.VariableDeclaration){for(let F of g.declarations)A(F,d);return}if(g.type===L.AST_NODE_TYPES.FunctionDeclaration&&g.id){C(g.id.name)&&E(g.body)&&i.add(g.id.name);return}}if(d.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let g=d.declaration;g.type===L.AST_NODE_TYPES.Identifier&&i.add(g.name),(g.type===L.AST_NODE_TYPES.FunctionDeclaration||g.type===L.AST_NODE_TYPES.ArrowFunctionExpression||g.type===L.AST_NODE_TYPES.FunctionExpression)&&(g.type===L.AST_NODE_TYPES.FunctionDeclaration?g.id?i.add(g.id.name):i.add("default"):E(g.body)&&i.add("default"))}}function N(d,g=new Set){if(i.has(d))return!0;if(g.has(d))return!1;g.add(d);let F=l.get(d);return F?N(F,g):!1}let p={};return o&&(p[o]=d=>{let g=d;for(;g.parent&&g.parent.type!==L.AST_NODE_TYPES.Program;)g=g.parent;g.parent&&(g.type===L.AST_NODE_TYPES.VariableDeclaration||g.type===L.AST_NODE_TYPES.FunctionDeclaration||g.type===L.AST_NODE_TYPES.ExportNamedDeclaration||g.type===L.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(g)}),p["Program:exit"]=d=>{let g=0;for(let D of d.body){if(D.type===L.AST_NODE_TYPES.ImportDeclaration){g+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=h(D);if(Z&&N(Z)){let q=b(D,Z);c.push({node:D,name:Z,isMainComponent:q,usedStyles:new Set,isExported:T(D)})}}if(!o&&n&&!c.some(D=>D.isMainComponent))for(let D of c)D.isExported&&(D.isMainComponent=!0);for(let D of c)w(D);let F=new Set;for(let D of a)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 q of a)q.node===Z&&P.set(q.name,D)}let j=new Map;for(let D of a){let Z=m(D),q=new Set;if(Z){let ue=y(Z);for(let fe of ue)F.has(fe)&&fe!==D.name&&q.add(fe)}j.set(D.name,q)}let J=new Map;for(let D of a){let Z=j.get(D.name);if(!Z)continue;let q=P.get(D.name);if(q!==void 0)for(let ue of Z){let fe=J.get(ue);(fe===void 0||q<fe)&&J.set(ue,q)}}let G=[];for(let D of a){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),q=-1;for(let Ee of c){if(!Ee.usedStyles.has(D.name))continue;let Ie=d.body.indexOf(Ee.node);(q===-1||Ie<q)&&(q=Ie)}let ue=J.get(D.name);if(ue!==void 0&&(q===-1||ue<q)&&(q=ue),q===-1)continue;let fe=-1;for(let Ee of c){let Ie=d.body.indexOf(Ee.node);Ie<q&&Ie>fe&&(fe=Ie)}let Fe=Z<q,Je=Z>fe,Se=-1,lt=j.get(D.name);if(lt)for(let Ee of lt){let Ie=P.get(Ee);Ie!==void 0&&Ie>Se&&(Se=Ie)}let et=Z>Se;if(!(Fe&&Je&&et)){let Ee=fe+1;if(Se+1>Ee&&(Ee=Se+1),Ee<g&&(Ee=g),Ee>q)continue;G.push({style:D,targetPosition:Ee})}}let Y=null;if(c.length>1){let D=c.map(q=>({c:q,idx:d.body.indexOf(q.node)})).sort((q,ue)=>q.idx-ue.idx)[0]?.c,Z=c.find(q=>q.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(Y={component:Z,targetBefore:D.node})}if(G.length>0||Y){let D=G[0]?.style.node||Y?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:R(G,Y,d.body)})}},p;function R(d,g,F){return function*(P){d.sort((J,G)=>J.targetPosition-G.targetPosition);for(let{style:J}of d){let G=r.getCommentsBefore(J.node),Y=J.node.range[0],D=J.node.range[1];G.length>0&&G[0]&&(Y=G[0].range[0]),Y===J.node.range[0]&&r.text.slice(0,Y).trim().length===0&&(Y=0),yield P.removeRange([Y,D])}let j=new Map;for(let J of d){let G=j.get(J.targetPosition)||[];G.push(J),j.set(J.targetPosition,G)}for(let[J,G]of j){let Y=F[J];if(!Y)continue;let D=r.getCommentsBefore(Y),Z=D.length>0&&D[0]?D[0].range[0]:Y.range[0],q=[];for(let{style:ue}of G){let fe=r.getCommentsBefore(ue.node),Fe=r.getText(ue.node);fe.length>0&&(Fe=`${fe.map(Se=>r.getText(Se)).join(`
|
|
47
47
|
`)}
|
|
48
48
|
${Fe}`),q.push(Fe)}yield P.insertTextBeforeRange([Z,Z],`${q.join(`
|
|
49
49
|
|
|
50
50
|
`)}
|
|
51
51
|
|
|
52
|
-
`)}if(g){let{component:J,targetBefore:G}=g,
|
|
52
|
+
`)}if(g){let{component:J,targetBefore:G}=g,Y=r.getCommentsBefore(J.node),D=J.node.range[0],Z=J.node.range[1];Y.length>0&&Y[0]&&(D=Y[0].range[0]),D===J.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let q=r.getCommentsBefore(G),ue=q.length>0&&q[0]?q[0].range[0]:G.range[0],fe=(()=>{let Fe=r.getText(J.node);return Y.length>0&&(Fe=`${Y.map(Se=>r.getText(Se)).join(`
|
|
53
53
|
`)}
|
|
54
54
|
${Fe}`),Fe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${fe}
|
|
55
|
-
`)}}}}});var
|
|
55
|
+
`)}}}}});var Nt=require("@typescript-eslint/utils"),Jn=ke(require("typescript")),mi=require("zod/v4");var za=mi.z.object({}),Xn=H({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:[W(za)]},defaultOptions:[{}],create(e){let t=Nt.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&Jn.default.TypeFlags.Any||o.flags&Jn.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!==Nt.AST_NODE_TYPES.CallExpression)return;let s=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(s);if(!n(i,r)){let c=e.sourceCode.getText(o.argument);e.report({node:o,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(a){return a.replaceText(o,c)}}]})}}}}});var Ce=require("@typescript-eslint/utils"),at=require("zod/v4");var Wa=at.z.object({functions:at.z.array(at.z.string()).optional(),selectors:at.z.array(at.z.string()).optional()});function yi(e){let t=e.parent;for(;t;){if(t.type===Ce.AST_NODE_TYPES.FunctionDeclaration||t.type===Ce.AST_NODE_TYPES.FunctionExpression||t.type===Ce.AST_NODE_TYPES.ArrowFunctionExpression)return!0;t=t.parent}return!1}function di(e){if(e.type===Ce.AST_NODE_TYPES.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ce.AST_NODE_TYPES.Identifier?r.name:r.type===Ce.AST_NODE_TYPES.MemberExpression&&r.property.type===Ce.AST_NODE_TYPES.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ce.AST_NODE_TYPES.Identifier?t.name:t.type===Ce.AST_NODE_TYPES.MemberExpression&&t.property.type===Ce.AST_NODE_TYPES.Identifier?t.property.name:null}var Bn=H({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:[W(Wa)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(yi(i))return;let l=di(i);l&&r.has(l)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:l}})}let s={CallExpression(i){i.type===Ce.AST_NODE_TYPES.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ce.AST_NODE_TYPES.TaggedTemplateExpression&&o(i)}};for(let i of n)s[i]=l=>{if(l.type!==Ce.AST_NODE_TYPES.CallExpression&&l.type!==Ce.AST_NODE_TYPES.TaggedTemplateExpression||yi(l))return;let c=di(l);c&&e.report({node:l,messageId:"moduleLevel",data:{functionName:c}})};return s}});var Qe=require("@typescript-eslint/utils");function Va(e,t){let{body:r}=e;if(r.type!==Qe.AST_NODE_TYPES.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==Qe.AST_NODE_TYPES.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}var Hn=H({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!==Qe.AST_NODE_TYPES.FunctionExpression&&n.type!==Qe.AST_NODE_TYPES.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:s}=n;if(s.type===Qe.AST_NODE_TYPES.BlockStatement){if(s.body.length!==1)return;let c=s.body[0];if(!c||c.type!==Qe.AST_NODE_TYPES.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let l=Va(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:c=>c.replaceText(r,l)})}}}});var gi={[dn.name]:dn.rule,[Yt.name]:Yt.rule,[Ht.name]:Ht.rule,"rules-of-hooks":pi,"exhaustive-deps":ir,"require-description":ti.rule,[qt.name]:qt.rule,[Gt.name]:Gt.rule,[Sn.name]:Sn.rule,[jt.name]:jt.rule,[Bt.name]:Bt.rule,[Qt.name]:Qt.rule,[ct.name]:ct.rule,[En.name]:En.rule,[Kt.name]:Kt.rule,[Zt.name]:Zt.rule,[tn.name]:tn.rule,[Mt.name]:Mt.rule,[wn.name]:wn.rule,[An.name]:An.rule,[kn.name]:kn.rule,[Xt.name]:Xt.rule,[sn.name]:sn.rule,[an.name]:an.rule,[ln.name]:ln.rule,[fn.name]:fn.rule,[mn.name]:mn.rule,[pn.name]:pn.rule,[un.name]:un.rule,[hn.name]:hn.rule,[rn.name]:rn.rule,[nn.name]:nn.rule,[Mn.name]:Mn.rule,[gn.name]:gn.rule,[Pn.name]:Pn.rule,[jn.name]:jn.rule,[_n.name]:_n.rule,[$n.name]:$n.rule,[Un.name]:Un.rule,[zn.name]:zn.rule,[Wn.name]:Wn.rule,[Vn.name]:Vn.rule,[Xn.name]:Xn.rule,[Bn.name]:Bn.rule,[ct.name]:ct.rule,[Hn.name]:Hn.rule};var Ja={rules:gi};0&&(module.exports={extendedLintPlugin});
|