@ls-stack/extended-lint 0.76.1 → 0.77.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 +19 -19
- package/dist/extended-lint.mjs +19 -19
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var pi=Object.create;var mt=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var fi=Object.getPrototypeOf,mi=Object.prototype.hasOwnProperty;var yi=(e,n)=>{for(var r in n)mt(e,r,{get:n[r],enumerable:!0})},Wn=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of ui(n))!mi.call(e,s)&&s!==r&&mt(e,s,{get:()=>n[s],enumerable:!(t=ci(n,s))||t.enumerable});return e};var ve=(e,n,r)=>(r=e!=null?pi(fi(e)):{},Wn(n||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e)),di=e=>Wn(mt({},"__esModule",{value:!0}),e);var va={};yi(va,{extendedLintPlugin:()=>Pa});module.exports=di(va);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var Jn=require("@typescript-eslint/utils"),Vn=ve(require("zod/v4"));function q(e){let r=Jn.ESLintUtils.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:r}}function B(e){return Vn.toJSONSchema(e)}var gi=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()})))})))}),vt=q({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[B(gi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[n]){let r={},{mustMatchSyntax:t,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=n,p=s??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 P of Array.from(y)){let[N,l]=P.split(":");N===w&&(l==="function"||l==="any")&&y.delete(P)}}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 P=w.id.name;for(let N of Array.from(y)){let[l,R]=N.split(":");l===P&&(R==="variable"||R==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.AST_NODE_TYPES.Identifier){let P=w.exported.name;for(let N of Array.from(y)){let[l,R]=N.split(":");l===P&&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:P,mustHaveExport:N}of t??[]){let R=function(d){let g=d;for(let{name:F,value:v}of l??[])g=g.replaceAll(F,v);return g};var h=R;let l=Si(p,new RegExp(b));if(l){for(let{anyCall:d,message:g}of w??[]){let F=`Expected file to call the function: ${d.map(({fn:v})=>v).join(" or ")}`;u.add(F),c.push(v=>{let{callee:j}=v;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=v.arguments[H.atIndex],Z=typeof H.literal=="string"?R(H.literal):H.literal;if(!D){e.report({node:v,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:Y=>Y.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of P??[])m.set(d,R(g)),a.set(R(d),()=>{m.delete(d)});for(let{name:d,type:g,message:F}of N??[]){let v=R(d),j=R(F);y.add(`${v}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:P,replaceWith:N,ignoreRegex:l}of i??[])l&&new RegExp(l).test(p)||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 v=R.arguments[F.atIndex];if(!v){e.report({node:R,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${P}`}});return}if(v.type!==he.AST_NODE_TYPES.Literal||v.value!==F.value)return}let g=F=>N?F.replaceText(R,N):null;e.report({node:R,messageId:"default",data:{message:P},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]:void 0})});function A(b,w){let P=r[b];P?r[b]=N=>{P(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:P,replaceType:N="suggestion"}of o??[]){if(b==="CallExpression"){c.push(l=>{T(P,l,w,N)});continue}r[b]=l=>{T(P,l,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[P,N,l]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${P}" of type ${N}: ${l}`}})}},r;function T(b,w,P,N){let l=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:P},fix:b&&N==="autofix"?l:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:l}]:void 0})}}});function Si(e,n){let r=[],t=n.exec(e);if(!t)return null;let[s,...o]=t;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Xn(s)}),r.push({name:"$0_uncapitalize",value:Bn(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,c=o[i];c!==void 0&&(r.push({name:`${p}_lowercase`,value:c.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Xn(c)}),r.push({name:`${p}_uncapitalize`,value:Bn(c)}),r.push({name:p,value:c}))}return r}function Xn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ve=require("zod/v4");var Ti=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yn="collapse-simple-objs-in-one-line",hi=Ve.z.object({maxLineLength:Ve.z.number().optional(),maxProperties:Ve.z.number().optional(),nestedObjMaxLineLength:Ve.z.number().optional(),nestedObjMaxProperties:Ve.z.number().optional(),ignoreTypesWithSuffix:Ve.z.array(Ve.z.string()).optional()}),Ei=Ti({name:Yn,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:[B(hi)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.ignoreTypesWithSuffix??[],s=n.maxProperties??2,o=n.nestedObjMaxLineLength??n.maxLineLength,i=n.nestedObjMaxProperties??3;function p(a){if(a.type===re.AST_NODE_TYPES.ObjectExpression){let u=a.parent.type===re.AST_NODE_TYPES.Property,m=u?i:s,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&&Ot(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&&!Ot(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:s,y=a.members.length;if(y>m)return!1;if(t.length>0&&a.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=a.parent.id.name;if(t.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||!Hn(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||!Hn(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 mi=Object.create;var mt=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var Ti=(e,n)=>{for(var r in n)mt(e,r,{get:n[r],enumerable:!0})},Xn=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of di(n))!Si.call(e,s)&&s!==r&&mt(e,s,{get:()=>n[s],enumerable:!(t=yi(n,s))||t.enumerable});return e};var ve=(e,n,r)=>(r=e!=null?mi(gi(e)):{},Xn(n||!e||!e.__esModule?mt(r,"default",{value:e,enumerable:!0}):r,e)),hi=e=>Xn(mt({},"__esModule",{value:!0}),e);var La={};Ti(La,{extendedLintPlugin:()=>ja});module.exports=hi(La);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var Bn=require("@typescript-eslint/utils"),Hn=ve(require("zod/v4"));function q(e){let r=Bn.ESLintUtils.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:r}}function J(e){return Hn.toJSONSchema(e)}var Ei=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()})))})))}),Ot=q({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[J(Ei)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[n]){let r={},{mustMatchSyntax:t,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=n,p=s??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,l]=k.split(":");N===w&&(l==="function"||l==="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[l,R]=N.split(":");l===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[l,R]=N.split(":");l===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 t??[]){let R=function(d){let g=d;for(let{name:F,value:P}of l??[])g=g.replaceAll(F,P);return g};var h=R;let l=bi(p,new RegExp(b));if(l){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:V,withArgs:G}of d)if(j.name===V){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:Y=>Y.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:l}of i??[])l&&new RegExp(l).test(p)||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 o??[]){if(b==="CallExpression"){c.push(l=>{T(k,l,w,N)});continue}r[b]=l=>{T(k,l,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,l]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${l}`}})}},r;function T(b,w,k,N){let l=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"?l:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:l}]:void 0})}}});function bi(e,n){let r=[],t=n.exec(e);if(!t)return null;let[s,...o]=t;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Yn(s)}),r.push({name:"$0_uncapitalize",value:qn(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,c=o[i];c!==void 0&&(r.push({name:`${p}_lowercase`,value:c.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Yn(c)}),r.push({name:`${p}_uncapitalize`,value:qn(c)}),r.push({name:p,value:c}))}return r}function Yn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Je=require("zod/v4");var xi=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="collapse-simple-objs-in-one-line",Ci=Je.z.object({maxLineLength:Je.z.number().optional(),maxProperties:Je.z.number().optional(),nestedObjMaxLineLength:Je.z.number().optional(),nestedObjMaxProperties:Je.z.number().optional(),ignoreTypesWithSuffix:Je.z.array(Je.z.string()).optional()}),Ii=xi({name:Gn,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:[J(Ci)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.ignoreTypesWithSuffix??[],s=n.maxProperties??2,o=n.nestedObjMaxLineLength??n.maxLineLength,i=n.nestedObjMaxProperties??3;function p(a){if(a.type===re.AST_NODE_TYPES.ObjectExpression){let u=a.parent.type===re.AST_NODE_TYPES.Property,m=u?i:s,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&&Nt(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&&!Nt(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:s,y=a.members.length;if(y>m)return!1;if(t.length>0&&a.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=a.parent.id.name;if(t.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||!Zn(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||!Zn(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=p(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(t!==-1?t:n.text.length)-r.range[1]}function
|
|
3
|
+
`)||r.getCommentsInside(a).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let y=`{ ${m} }`,C=wi(r,a),f=u.isNested&&u.propsSize>2?o:n.maxLineLength;f&&y.length+C.length+Ai(a,r)>f||e.report({node:a,messageId:"singleLineProp",fix:E=>E.replaceText(a,y)})}return{TSTypeLiteral:c,ObjectExpression:c}}});function Zn(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 Nt(e,n){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||!n&&e.type===re.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&Nt(r,!0)))}function Ai(e,n){let r=n.getLastToken(e);if(!r)return 0;let t=n.text.indexOf(`
|
|
4
|
+
`,r.range[1]);return(t!==-1?t:n.text.length)-r.range[1]}function wi(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var Dt={name:Gn,rule:Ii};var Ri=/eslint +react-compiler\/react-compiler: +\["error/,Qn={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 n=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),t=typeof e.getScope=="function"?()=>t():I=>e.sourceCode.getScope(I),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,o=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:o};function p(I){o&&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&&p({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),P=new Set,N=null;{let k=w.upper;for(;k&&(P.add(k),k.type!=="function");)k=k.upper;if(!k)return;N=k}let l=Array.isArray;function R(k){if(!l(k.defs))return!1;let O=k.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&&(Lt(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 X=_.callee;if(X.type==="MemberExpression"&&X.object.name==="React"&&X.property!=null&&!X.computed&&(X=X.property),X.type!=="Identifier")return!1;let W=O.node.id,{name:Q}=X;if(Q==="useRef"&&W.type==="Identifier")return!0;if(Fi(X)&&W.type==="Identifier"){for(let ee of k.references)ee!==W&&C.add(ee.identifier);return!0}else if(Q==="useState"||Q==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&l(k.identifiers)){if(W.elements[1]===k.identifiers[0]){if(Q==="useState"){let ee=k.references,Fe=0;for(let $e=0;$e<ee.length;$e++){if(ee[$e].isWrite()&&Fe++,Fe>1)return!1;a.set(ee[$e].identifier,W.elements[0])}}return!0}else if(W.elements[0]===k.identifiers[0]){if(Q==="useState"){let ee=k.references;for(let Fe=0;Fe<ee.length;Fe++)u.add(ee[Fe].identifier)}return!1}}}else if(Q==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(k.identifiers)&&W.elements[1]===k.identifiers[0])return!0;return!1}function d(k){if(!l(k.defs))return!1;let O=k.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let _=O.node,z=N.childScopes,X=null,W;for(W=0;W<z.length;W++){let Q=z[W],ee=Q.block;if(_.type==="FunctionDeclaration"&&ee===_||_.type==="VariableDeclarator"&&ee.parent===_){X=Q;break}}if(X==null)return!1;for(W=0;W<X.through.length;W++){let Q=X.through[W];if(Q.resolved!=null&&P.has(Q.resolved.scope)&&!g(Q.resolved))return!1}return!0}let g=f(R,m),F=f(d,y),v=new Map;function j(k){let O=k.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(k){for(let O of k.references){if(!O.resolved||!P.has(O.resolved.scope))continue;let _=Lt(I,O.identifier),z=Gn(_),X=_e(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)&&v.set(X,{reference:O,dependencyNode:z}),z.parent.type==="TSTypeQuery"||z.parent.type==="TSTypeReference")continue;let W=O.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===I.parent)&&W.type!=="TypeParameter")if(J.has(X))J.get(X).references.push(O);else{let Q=O.resolved,ee=g(Q)||F(Q);J.set(X,{isStable:ee,references:[O]})}}for(let O of k.childScopes)H(O)}v.forEach(({reference:k,dependencyNode:O},_)=>{let z=k.resolved.references,X=!1;for(let W=0;W<z.length;W++){let{identifier:Q}=z[W],{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){X=!0;break}}X||p({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(k,O){D.has(O)||(D.add(O),p({node:k,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 Y=new Set;if(J.forEach(({isStable:k,references:O},_)=>{k&&Y.add(_),O.forEach(z=>{z.writeExpr&&Z(z.writeExpr,_)})}),D.size>0)return;if(!A){let k=null;if(J.forEach(({isStable:O,references:_},z)=>{k||_.forEach(X=>{if(k)return;let W=X.identifier;if(!a.has(W))return;let ee=X.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(k=z)})}),k){let{suggestedDependencies:O}=Dt({dependencies:J,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});p({node:T,message:`React Hook ${h} contains a call to '${k}'. 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"?p({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(k=>{if(k===null)return;if(k.type==="SpreadElement"){p({node:k,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(k)&&p({node:k,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(k)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(k)}\``,fix(X){return X.removeRange(k.range)}}]});let O;try{O=_e(k,G)}catch(X){if(/Unsupported node type/.test(X.message)){k.type==="Literal"?J.has(k.value)?p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. Did you mean to include ${k.value} in the array instead?`}):p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:k,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 X}let _=k;for(;_.type==="MemberExpression"||_.type==="OptionalMemberExpression"||_.type==="ChainExpression";)_=_.object||_.expression.object;let z=!N.through.some(X=>X.identifier===_);ue.push({key:O,node:k}),z||fe.add(O)});let{suggestedDependencies:Re,unnecessaryDependencies:Je,missingDependencies:Se,duplicateDependencies:st}=Dt({dependencies:J,declaredDependencies:ue,stableDependencies:Y,externalDependencies:fe,isEffect:b}),Ke=Re;if(st.size+Se.size+Je.size===0){if(n)return;Ii({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:O,isUsedOutsideOfHook:_,depType:z})=>{let X=z==="function"?"useCallback":"useMemo",W=z==="function"?"definition":"initialization",Q=`wrap the ${W} of '${O.name.name}' in its own ${X}() Hook.`,ee=_?`To fix this, ${Q}`:`Move it inside the ${h} callback. Alternatively, ${Q}`,Fe=z==="conditional"||z==="logical expression"?"could make":"makes",$e=`The '${O.name.name}' ${z} ${Fe} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Un;_&&O.type==="Variable"&&z==="function"&&(Un=[{desc:`Wrap the ${W} of '${O.name.name}' in its own ${X}() Hook.`,fix(zn){let[ai,li]=X==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[zn.insertTextBefore(O.node.init,ai),zn.insertTextAfter(O.node.init,li)]}}]),p({node:O.node,message:$e,suggest:Un})});return}!b&&Se.size>0&&(Ke=Dt({dependencies:J,declaredDependencies:[],stableDependencies:Y,externalDependencies:fe,isEffect:b}).suggestedDependencies);function Ee(){if(ue.length===0)return!0;let k=ue.map(_=>_.key),O=k.slice().sort();return k.join(",")===O.join(",")}Ee()&&Ke.sort();function Ce(k){let O=k.split("."),_="";for(let z=0;z<O.length;z++){if(z!==0){let X=O.slice(0,z+1).join("."),W=G.get(X)===!0;_+=W?"?.":"."}_+=O[z]}return _}function Pt(k,O,_,z){return k.size===0?null:(k.size>1?"":O+" ")+_+" "+(k.size>1?"dependencies":"dependency")+": "+wi(Array.from(k).sort().map(X=>"'"+Ce(X)+"'"))+`. Either ${z} ${k.size>1?"them":"it"} or remove the dependency array.`}let Pe="";if(Je.size>0){let k=null;if(Array.from(Je.keys()).forEach(O=>{k===null&&O.endsWith(".current")&&(k=O)}),k!==null)Pe=` Mutable values like '${k}' 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)||(Pe=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Pe&&Se.has("props")){let k=J.get("props");if(k==null)return;let O=k.references;if(!Array.isArray(O))return;let _=!0;for(let z=0;z<O.length;z++){let X=O[z],W=Lt(N.block,X.identifier);if(!W){_=!1;break}let Q=W.parent;if(Q==null){_=!1;break}if(Q.type!=="MemberExpression"&&Q.type!=="OptionalMemberExpression"){_=!1;break}}_&&(Pe=` 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(!Pe&&Se.size>0){let k=null;Se.forEach(O=>{if(k)return;let _=N.set.get(O),z=J.get(O);if(z.references[0].resolved!==_)return;let X=_.defs[0];if(X==null||X.name==null||X.type!=="Parameter")return;let W=!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){W=!0;break}W&&(k=O)}),k!==null&&(Pe=` If '${k}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Pe&&Se.size>0){let k=null;if(Se.forEach(O=>{if(k!==null)return;let z=J.get(O).references,X,W;for(let Q=0;Q<z.length;Q++){for(X=z[Q].identifier,W=X.parent;W!=null&&W!==N.block;){if(W.type==="CallExpression"){let ee=a.get(W.callee);if(ee!=null){if(ee.name===O)k={missingDep:O,setter:W.callee.name,form:"updater"};else if(u.has(X))k={missingDep:O,setter:W.callee.name,form:"reducer"};else{let Fe=z[Q].resolved;if(Fe!=null){let $e=Fe.defs[0];$e!=null&&$e.type==="Parameter"&&(k={missingDep:O,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(k!==null)break}}),k!==null)switch(k.form){case"reducer":Pe=` You can also replace multiple useState variables with useReducer if '${k.setter}' needs the current value of '${k.missingDep}'.`;break;case"inlineReducer":Pe=` If '${k.setter}' needs the current value of '${k.missingDep}', you can also switch to useReducer instead of useState and read '${k.missingDep}' in the reducer.`;break;case"updater":Pe=` You can also do a functional update '${k.setter}(${k.missingDep.slice(0,1)} => ...)' if you only need '${k.missingDep}' in the '${k.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:A,message:`React Hook ${r(T)} has `+(Pt(Se,"a","missing","include")||Pt(Je,"an","unnecessary","exclude")||Pt(st,"a","duplicate","omit"))+Pe,suggest:[{desc:`Update the dependencies array to be: [${Ke.map(Ce).join(", ")}]`,fix(k){return k.replaceText(A,`[${Ke.map(Ce).join(", ")}]`)}}]})}function x(I){let A=Ai(I.callee,i);if(A===-1)return;let T=I.arguments[A],h=I.callee,b=Kn(h).name,w=I.arguments[A+1],P=/Effect($|[^a-z])/g.test(b);if(!T){p({node:h,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!P)){if(!w&&!P){(b==="useMemo"||b==="useCallback")&&p({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,P);return;case"Identifier":if(!w||w.elements&&w.elements.some(R=>R&&R.type==="Identifier"&&R.name===T.name))return;let N=t(I).set.get(T.name);if(N==null||N.defs==null)return;let l=N.defs[0];if(!l||!l.node||l.type!=="Variable"&&l.type!=="FunctionName")break;switch(l.node.type){case"FunctionDeclaration":E(l.node,w,h,b,P);return;case"VariableDeclarator":let R=l.node.init;if(!R)break;switch(R.type){case"ArrowFunctionExpression":case"FunctionExpression":E(R,w,h,b,P);return}break}break;default:p({node:h,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({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||Ci.test(I.value))return n=!0,{CallExpression:A=>x(A,!0)}}return{CallExpression:I=>x(I)}}};function Dt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,x)=>{let S=p(o,x);S.isUsed=!0,c(o,x,I=>{I.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let x=p(o,E);x.isSatisfiedRecursively=!0}),r.forEach(E=>{let x=p(o,E);x.isSatisfiedRecursively=!0});function p(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(o,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 n.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 Xe(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 Xe(e.consequent)!=null||Xe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Xe(e.left)!=null||Xe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Xe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Xe(e.expression);case"TSAsExpression":return Xe(e.expression)}return null}function Ii({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let s=e.map(({key:i})=>{let p=r.variables.find(a=>a.name===i);if(p==null)return null;let c=p.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=Xe(c.node.init);if(a!=null)return[p,a]}return c.type==="FunctionName"&&c.node.type==="FunctionDeclaration"?[p,"function"]:c.type==="ClassName"&&c.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let c=0;c<i.references.length;c++){let a=i.references[c];if(a.writeExpr){if(p)return!0;p=!0;continue}let u=a.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!Qn(n,a.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function Gn(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)?Gn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function jt(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function _e(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=_e(e.object,n),t=_e(e.property,null),s=`${r}.${t}`;return jt(e,n,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=_e(e.object,n),t=_e(e.property,null),s=`${r}.${t}`;return jt(e,n,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=_e(r.object,n),s=_e(r.property,null),o=`${t}.${s}`;return jt(r,n,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Kn(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ai(e,n){let r=Kn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=_e(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return n.additionalHooks.test(t)?0:-1}else return-1}}function Lt(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),Ri(t,n))return t;if(Qn(t,n))for(let[s,o]of Object.entries(t))s!=="parent"&&(qn(o)?(o.parent=t,r.push(o)):Array.isArray(o)&&o.forEach(i=>{qn(i)&&(i.parent=t,r.push(i))}))}return null}function wi(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ri(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function Qn(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function Fi(e){return!1}var ae=require("@typescript-eslint/utils"),V=ve(require("typescript")),Ut=require("zod/v4");var Mt=require("@typescript-eslint/utils");function Qe(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:Qe(e.parent,n,r===1/0?r:r-1)}function*$t(e){yield e,e.parent&&(yield*$t(e.parent))}function _t(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function tr(e,n,r){let s=r.getDeclaredVariables(e).find(o=>o.name===n||o.identifiers[0]?.parent.type===Mt.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===Mt.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===n);return s?s.references.filter(o=>!o.init):[]}function er(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function ki(e,n){return e[n]}function Oe(e,n,r){let t=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),n(i)===!0)return!0;let c=t[i.type];if(c)for(let a of c){let u=ki(i,a);if(u){if(Array.isArray(u)){for(let m of u)if(er(m)&&o(m))return!0}else if(er(u)&&o(u))return!0}}return!1}o(e)}var Pi=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="improved-no-unnecessary-condition",vi=Ut.z.object({alternativeForInCondition:Ut.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),rr={object:"Array",property:"isArray"},Oi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Ni=new Set(Oi),zt={name:nr,rule:Pi({name:nr,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:[B(vi)]},defaultOptions:[{}],create(e,[n]){let r=ae.ESLintUtils.getParserServices(e,!0),t=r.program?.getTypeChecker();if(!t||!r.program)throw new Error("TypeScript services or program not available");function s(l){return l.type===ae.AST_NODE_TYPES.UnaryExpression&&l.operator==="typeof"}function o(l){return l.flags&V.default.TypeFlags.Any||l.flags&V.default.TypeFlags.Unknown?null:l.flags&V.default.TypeFlags.StringLike?["string"]:l.flags&V.default.TypeFlags.NumberLike?["number"]:l.flags&V.default.TypeFlags.BigIntLike?["bigint"]:l.flags&V.default.TypeFlags.BooleanLike?["boolean"]:l.flags&V.default.TypeFlags.ESSymbolLike?["symbol"]:l.flags&V.default.TypeFlags.Undefined||l.flags&V.default.TypeFlags.Void?["undefined"]:l.flags&V.default.TypeFlags.Null?["object"]:l.getCallSignatures().length>0?["function"]:l.flags&V.default.TypeFlags.Object?l.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:l.flags&V.default.TypeFlags.NonPrimitive?["object"]:l.flags&V.default.TypeFlags.Never?["never"]:null}function i(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.getTypeAtLocation(R.expression);if(d.flags&V.default.TypeFlags.Any||d.flags&V.default.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let v of d.types){let j=o(v);if(j)g.push(...j);else return null}return g}let F=o(d);return F?(g.push(...F),g):null}function p(l){if(!(l.operator==="==="||l.operator==="!=="))return;let d=null,g=null;if(s(l.left)?(d=l.left,g=l.right.type===ae.AST_NODE_TYPES.Literal&&typeof l.right.value=="string"?l.right.value:null):s(l.right)&&(d=l.right,g=l.left.type===ae.AST_NODE_TYPES.Literal&&typeof l.left.value=="string"?l.left.value:null),!d||!g||!Di(g,Ni))return;let F=i(d);if(!F)return;let v=l.operator==="!==",j=F.includes(g);F.length===1?j&&!v?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:g}}):!j&&v?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:Array.from(F)[0]}}):!j&&!v?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):j&&v&&e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):!j&&!v?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):!j&&v&&e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:yt(F)}})}function c(l){if(l.flags&V.default.TypeFlags.Any||l.flags&V.default.TypeFlags.Unknown)return null;if(l.isUnion()){let R=[];for(let d of l.types)if(d.flags&V.default.TypeFlags.StringLiteral){let g=d.value;R.push(g)}else return null;return R}return l.flags&V.default.TypeFlags.StringLiteral?[l.value]:null}function a(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.getTypeAtLocation(R),g=c(d);if(g)return g;let F=t.getSymbolAtLocation(R);if(F){let v=t.getTypeOfSymbolAtLocation(F,R),j=c(v);if(j)return j}return null}function u(l){let R=e.sourceCode.ast,d=null;return Oe(R,g=>{if(g.type===ae.AST_NODE_TYPES.VariableDeclarator&&g.id.type===ae.AST_NODE_TYPES.Identifier&&g.id.name===l.name&&g.id.typeAnnotation){let F=g.id.typeAnnotation.typeAnnotation;if(F.type===ae.AST_NODE_TYPES.TSUnionType){let v=[];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")v.push(j.literal.value);else return!0;return d=v,!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(l){return l==="Array"||l==="ReadonlyArray"?!0:l.endsWith(".Array")||l.endsWith(".ReadonlyArray")}function y(l){if(!t)return!1;if(t.isArrayType(l)||t.isTupleType(l))return!0;let R=t.getApparentType(l);if(R!==l&&(t.isArrayType(R)||t.isTupleType(R)))return!0;if(l.aliasSymbol){let g=t.getFullyQualifiedName(l.aliasSymbol);if(m(g))return!0}let d=l.getSymbol();if(d){let g=t.getFullyQualifiedName(d);if(m(g))return!0}return!1}function C(l){if(!t)return!1;if(l.flags&V.default.TypeFlags.StringLike||l.flags&V.default.TypeFlags.NumberLike||l.flags&V.default.TypeFlags.BigIntLike||l.flags&V.default.TypeFlags.BooleanLike||l.flags&V.default.TypeFlags.ESSymbolLike||l.flags&V.default.TypeFlags.EnumLike||l.flags&V.default.TypeFlags.Null||l.flags&V.default.TypeFlags.Undefined||l.flags&V.default.TypeFlags.Void||l.flags&V.default.TypeFlags.Never)return!0;let R=l.getSymbol();if(R){let d=t.getFullyQualifiedName(R);if(d==="__function"||d==="__object"&&!y(l))return!0}return!1}function f(l){if(l.flags&V.default.TypeFlags.Any||l.flags&V.default.TypeFlags.Unknown)return"unknown";if(l.isUnion()){let R=!0,d=!0;for(let g of l.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(l)?"alwaysTrue":C(l)?"alwaysFalse":"unknown"}function E(l){return!l.computed&&l.object.type===ae.AST_NODE_TYPES.Identifier&&l.object.name===rr.object&&l.property.type===ae.AST_NODE_TYPES.Identifier&&l.property.name===rr.property}function x(l){if(!t||l.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!E(l.callee)||l.arguments.length===0)return;let[R]=l.arguments;if(!R||R.type===ae.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(R),g=t.getTypeAtLocation(d),F=f(g);F==="alwaysTrue"?e.report({node:l,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:l,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(l){if(l.callee.type!==ae.AST_NODE_TYPES.MemberExpression||l.callee.property.type!==ae.AST_NODE_TYPES.Identifier||l.callee.computed)return;let R=l.callee.property.name;if(R!=="startsWith"&&R!=="endsWith"&&R!=="includes"||l.arguments.length!==1)return;let[d]=l.arguments;if(!d||d.type!==ae.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let g=l.callee.object,F=a(g);if(!F&&g.type===ae.AST_NODE_TYPES.Identifier&&(F=u(g)),!F||F.length===0)return;let v=d.value;if(R==="includes"&&F.length>1)return;let j=0,J=0;for(let G of F)if((R==="startsWith"?G.startsWith(v):R==="endsWith"?G.endsWith(v):G.includes(v))?j++:J++,j>0&&J>0)return;if(j>0&&J===0){let G=R==="startsWith"?"unnecessaryStartsWithCondition":R==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:l,messageId:G})}else if(J>0&&j===0){let G=R==="startsWith"?"alwaysFalseStartsWithCondition":R==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:l,messageId:G})}}function I(l){if(!new Set(["===","!==",">",">=","<","<="]).has(l.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 Y=[];for(let ue of Z)Y.push(ue.length);return{values:Y}}let g=d(l.left),F=d(l.right),v=null,j=null;if(g?l.right.type===ae.AST_NODE_TYPES.Literal&&typeof l.right.value=="number"&&(v=g.values,j=l.right.value):F&&l.left.type===ae.AST_NODE_TYPES.Literal&&typeof l.left.value=="number"&&(v=F.values,j=l.left.value),!v||j===null)return;let J=0,G=0;for(let H of v){let D=!1;if(l.operator==="==="?D=H===j:l.operator==="!=="?D=H!==j:l.operator===">"?D=H>j:l.operator===">="?D=H>=j:l.operator==="<"?D=H<j:l.operator==="<="&&(D=H<=j),D?J++:G++,J>0&&G>0)return}J>0&&G===0?e.report({node:l,messageId:"unnecessaryLengthCondition"}):G>0&&J===0&&e.report({node:l,messageId:"alwaysFalseLengthCondition"})}function A(l){if(l.type===ae.AST_NODE_TYPES.Literal&&typeof l.value=="string")return l.value;let R=a(l);if(!R||R.length!==1)return null;let[d]=R;return d??null}function T(l){return(l.flags&V.default.TypeFlags.Intersection)!==0}function h(l){return(l.flags&V.default.TypeFlags.Object)!==0}function b(l){return!t||t.getIndexTypeOfType(l,V.default.IndexKind.String)?!0:!!t.getIndexTypeOfType(l,V.default.IndexKind.Number)}function w(l,R){if(!t||b(l)||l.getProperties().length===0)return"unknown";let d=t.getPropertyOfType(l,R);return d?d.flags&V.default.SymbolFlags.Optional?"optional":"required":"absent"}function P(l,R){if(l.flags&V.default.TypeFlags.Any||l.flags&V.default.TypeFlags.Unknown||l.flags&V.default.TypeFlags.Never||l.flags&V.default.TypeFlags.TypeParameter||l.flags&V.default.TypeFlags.IndexedAccess||l.flags&V.default.TypeFlags.StringLike||l.flags&V.default.TypeFlags.NumberLike||l.flags&V.default.TypeFlags.BigIntLike||l.flags&V.default.TypeFlags.BooleanLike||l.flags&V.default.TypeFlags.EnumLike||l.flags&V.default.TypeFlags.ESSymbolLike||l.flags&V.default.TypeFlags.NonPrimitive||l.flags&V.default.TypeFlags.Null||l.flags&V.default.TypeFlags.Undefined||l.flags&V.default.TypeFlags.Void)return"unknown";if(l.isUnion()){let d=!0,g=!0;for(let F of l.types){let v=P(F,R);if(v==="unknown"||(v!=="required"&&(d=!1),v!=="absent"&&(g=!1),v==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(T(l)){let d=l,g=!1,F=!1;for(let v of d.types){let j=P(v,R);if(j==="unknown")return"unknown";j==="required"?g=!0:j==="optional"&&(F=!0)}return g?"required":F?"optional":"absent"}return h(l)?w(l,R):"unknown"}function N(l){if(l.operator!=="in"||l.left.type===ae.AST_NODE_TYPES.PrivateIdentifier)return;let R=A(l.left);if(!R)return;let d=l.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!t)return;let F=t.getTypeAtLocation(g),v=P(F,R);v==="required"?e.report({node:l,messageId:"unnecessaryInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}}):v==="absent"&&e.report({node:l,messageId:"alwaysFalseInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}})}return{BinaryExpression(l){p(l),I(l),N(l)},CallExpression(l){S(l),x(l)}}}})};function yt(e){return Array.from(new Set(e)).join(" | ")||"never"}function et(e,n){let r=e.argument;return r.type===ae.AST_NODE_TYPES.Identifier?r.name:n.sourceCode.getText(r)}function Di(e,n){return n.has(e)}var gt=require("@typescript-eslint/utils"),dt=require("zod/v4");var ji=gt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="no-call-with-explicit-generics",Li=dt.z.object({functions:dt.z.array(dt.z.string())}),Mi=ji({name:ir,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:[B(Li)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:s}=t;s.type===gt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Wt={name:ir,rule:Mi};var Ye=require("@typescript-eslint/utils"),$i=Ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-call-with-inferred-generics",_i=$i({name:sr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:s}=t;if(s.type!==Ye.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:c=n.disallowTypes}=o;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!c)&&t.typeArguments?.params.some(u=>!p&&u.type===Ye.AST_NODE_TYPES.TSAnyKeyword||c&&u.type===Ye.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===Ye.AST_NODE_TYPES.Identifier&&c.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),Jt={name:sr,rule:_i};var lr=require("@typescript-eslint/utils"),Ui=lr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="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:"],Wi=/^\s*return\s+/,Ji=/\w=("|'|`)/,Vi=/\w+:\s*('|"|`)/,Xi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Bi=/\w+-\w+:/,Hi=/\w+_\w+:/,Yi=/\?\s+\w/,qi=/:\s+\w/,Zi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Gi=/^\s*\d+[,}]/,Ki=/^\s*\[[^\]]*\][,}]/,Qi=/^\s*\{[^}]*\}[,}]/,es=/\.\w+\(/,ts=/\[\w+\]/,ns=/^\s*(['"`]).+?\1\s*:/,rs=/^<[A-Z]\w*(\s|>|\/)/,is=/^<[a-z]+(\s|>|\/)/,ss=/<[A-Z]\w*(\s.*)?>/,os=/<\/[A-Z]\w*>/,as=/<[a-z]+(\s.*)?>/,ls=/<\/[a-z]+>/,ps=/^\s*[*\s]*$/,cs=/^[a-zA-Z]/,us=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,fs=/```[\s\S]*?```/g,ms=/`[^`]*`/g,or=/[a-zA-Z0-9]/,ys=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ds=/[{}[\]()`=<>]/,gs=/:\s*(['"`[{(]|\w+\s*=>)/,Ss=/\bif\s*\(|\belse\b|=>/,me={returnStatement:Wi,stringAssignment:Ji,objectPropertyWithQuotes:Vi,computedPropertyAssignment:Xi,kebabCaseProperty:Bi,snakeCaseProperty:Hi,ternaryOperator:Yi,colonWithWord:qi,quotedString:Zi,numberWithComma:Gi,arrayWithComma:Ki,objectWithComma:Qi,methodCall:es,arrayAccess:ts,quotedPropertyKey:ns,jsxSelfClosing:rs,jsxElement:is,jsxOpeningTag:ss,jsxClosingTag:os,htmlOpeningTag:as,htmlClosingTag:ls,jsdocComment:ps};function Ts(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&cs.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||ys.test(n)||ds.test(n)||gs.test(n)||Ss.test(n)?!1:!!(n.includes(":")&&us.test(n))}var hs=[") {","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],Es=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],ar=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],bs=Ui({name:pr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,s){if(t.startsWith("/"))return!1;let o=t.trimStart();if(t.startsWith("*")||o.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||me.jsdocComment.test(t))return!1;for(let i of ar)if(o.startsWith(i))return!1;if(t.includes("https://")||Ts(o))return!1;if(s==="Block"){for(let i of Es)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of zi)if(o.startsWith(i))return{wrongPattern:i};for(let i of hs)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,s){let o=t,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let a=o.split(fs);a.some(m=>or.test(m))&&(o=a.join(""))}if(!o.includes("`"))return o;let p=o.split(ms);return p.some(a=>or.test(a))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=n(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:ar.join(", ")}})}}}}}),Vt={name:pr,rule:bs};var St=require("@typescript-eslint/utils"),xs=St.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-default-export",Cs=xs({name:cr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===St.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Xt={name:cr,rule:Cs};var ur=require("@typescript-eslint/utils"),Is=ur.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-leaked-text-in-jsx",As=[",",";","[","]","(",")"],ws=Is({name:fr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";As.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),Bt={name:fr,rule:ws};var Be=require("@typescript-eslint/utils"),Rs=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-non-camel-case-functions",Fs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function mr(e){if(e.typeName.type!==Be.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Be.AST_NODE_TYPES.Identifier&&n.name==="JSX"&&r.name==="Element"}var ks=Rs({name:yr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(n){if(n.id&&!Fs.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Be.AST_NODE_TYPES.TSTypeReference?mr(r):r.type===Be.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Be.AST_NODE_TYPES.TSTypeReference&&mr(s))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),Ht={name:yr,rule:ks};var oe=require("@typescript-eslint/utils");var Ps=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-optional-root-props",vs=Ps({name:dr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let o=e.sourceCode.getDeclaredVariables(t)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of $t(i.identifier)){if("returnType"in p||p.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let c=p.parent;if(!c)return!1;if(c.type===oe.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&c.parent.type===oe.TSESTree.AST_NODE_TYPES.TSTypeReference&&c.parent.typeName.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&c.parent.typeName.name==="FC"){let u=Qe(c.parent.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Tt(u,e.sourceCode);return m?!(m.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(p.type===oe.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(c.type===oe.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let a=Qe(c,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration);return a?!!Tt(a,e.sourceCode):!1}if(c.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Tt(c,e.sourceCode)}return!1}function r(t){t.key.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=Qe(t,oe.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(ht(t)||!n(t)))for(let s of t.typeAnnotation.members)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(t){if(!(ht(t)||!n(t)))for(let s of t.body.body)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(t){if(t.typeName.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let s=t.typeArguments.params[0];if(s.type!==oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Qe(t.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=Tt(o,e.sourceCode);if(!(!i||i.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let c of s.members)c.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(c)}}}});function ht(e){return e?e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Tt(e,n){if(ht(e))return;let r;if(e.type===oe.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let s=t.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!ht(o[0].identifier.parent.parent))return o[0].identifier}var Yt={name:dr,rule:vs};var ot=require("@typescript-eslint/utils");var at=q({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===ot.AST_NODE_TYPES.Identifier?n.has(t.name):t.type===ot.AST_NODE_TYPES.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let s of t.specifiers)n.add(s.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===ot.AST_NODE_TYPES.VariableDeclaration)for(let s of t.declaration.declarations)r(s.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===ot.AST_NODE_TYPES.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var gr=require("@typescript-eslint/utils"),Et=ve(require("path")),Ue=require("zod/v4");var Os=gr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-relative-imports",Ns=Ue.z.object({find:Ue.z.string(),replacement:Ue.z.string()}),Ds=Ue.z.object({aliases:Ue.z.array(Ns),rootDir:Ue.z.string().optional(),allowNotFoundAliases:Ue.z.boolean().optional(),_dev_simulateFileName:Ue.z.string().optional()}),js=Os({name:Sr,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:[B(Ds)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let c=Et.default.dirname(p);return Et.default.resolve(c,i)}function o(i){let p=n.rootDir??process.cwd(),c=Et.default.relative(p,i);if(c.startsWith("."))return null;c.startsWith("/")||(c=`/${c}`);for(let{find:a,replacement:u}of n.aliases)if(c.startsWith(u)){let m=c.replace(u,a);return{alias:a,newPath:m}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!t(p))return;let c=s(p,r),a=o(c);!a&&n.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:Sr,rule:js};var ye=require("@typescript-eslint/utils"),Zt=require("zod/v4");var Ls=Zt.z.object({customMessage:Zt.z.string().optional()}),Gt=q({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[B(Ls)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case ye.AST_NODE_TYPES.Literal:return!0;case ye.AST_NODE_TYPES.ObjectExpression:return t.properties.every(s=>s.type===ye.AST_NODE_TYPES.Property?s.computed||s.value.type===ye.AST_NODE_TYPES.Identifier&&s.key.type===ye.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case ye.AST_NODE_TYPES.ArrayExpression:return t.elements.every(s=>s?s.type===ye.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case ye.AST_NODE_TYPES.TemplateLiteral:return t.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(t){if(t.name.type===ye.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let s=null;t.value.type===ye.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==ye.AST_NODE_TYPES.JSXEmptyExpression&&(s=t.value.expression):t.value.type===ye.AST_NODE_TYPES.Literal&&(s=t.value),s&&r(s)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});var lt=require("@typescript-eslint/utils"),qe=ve(require("zod/v4"));var Ms=qe.object({alternativeMsgs:qe.object({inArrayFind:qe.string().optional(),inArrayFilter:qe.string().optional()}).optional(),__dev_simulateFileName:qe.string().optional()});function $s(e){return e.typeAnnotation.type!==lt.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var _s=/(typeGuards|type-guards)\.(ts|tsx)$/;function Us(e){return _s.test(e)}function zs(e){let n=e.parent;for(;n;){if(n.type===lt.AST_NODE_TYPES.CallExpression&&n.callee.type===lt.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===lt.AST_NODE_TYPES.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Kt=q({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:[B(Ms)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Us(r))return{};function t(s){if(!$s(s))return;let o=zs(s);if(n.alternativeMsgs&&o){let i=o.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});var Ze=require("@typescript-eslint/utils");var Ws="no-unnecessary-async-on-jsx-props";function Js(e){if(e.body.type!==Ze.AST_NODE_TYPES.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Ze.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ze.AST_NODE_TYPES.AwaitExpression}var Qt=q({name:Ws,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){Js(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let s=e.sourceCode,o=[],i=s.getFirstToken(r,c=>c.value==="async");if(i){let c=s.getTokenAfter(i);c?o.push(t.replaceTextRange([i.range[0],c.range[0]],"")):o.push(t.remove(i))}function p(c){if(c.type===Ze.AST_NODE_TYPES.AwaitExpression){let a=s.getFirstToken(c);if(a&&a.value==="await"){let u=s.getTokenAfter(a);u?o.push(t.replaceTextRange([a.range[0],u.range[0]],"")):o.push(t.remove(a))}}if(c.type===Ze.AST_NODE_TYPES.BlockStatement)for(let a of c.body)p(a);else c.type===Ze.AST_NODE_TYPES.ExpressionStatement&&p(c.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});var ze=require("@typescript-eslint/utils"),en=ve(require("typescript")),tt=ve(require("zod/v4"));var Vs=ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-unnecessary-casting",Xs=tt.default.object({additionalCastFunctions:tt.default.array(tt.default.object({name:tt.default.string(),expectedType:tt.default.enum(["string","number"])})).optional()}),tn={name:Tr,rule:Vs({name:Tr,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:[B(Xs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ze.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case ze.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case ze.AST_NODE_TYPES.TemplateLiteral:return m==="string";case ze.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function p(u,m){return m==="number"?!!(u.flags&en.TypeFlags.NumberLike):!!(u.flags&en.TypeFlags.StringLike)}function c(u,m){return y=>y.replaceText(u,e.sourceCode.getText(m))}function a(u){if(!o||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===ze.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==ze.AST_NODE_TYPES.Identifier)return;let C=y.name,f=t.find(x=>x.name===C);if(!f)return;if(i(m,f.expectedType)||p(o.getTypeAtLocation(s.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 Ae=require("@typescript-eslint/utils"),bt=ve(require("zod/v4"));var Bs=bt.object({ignoreWithDescription:bt.string().optional()}),nn=q({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:[B(Bs)]},defaultOptions:[{}],create(e,[n]){let r=e.getSourceCode(),t=r.ast;function s(c){let a=c.arguments[0];return a&&a.type===Ae.AST_NODE_TYPES.Literal&&typeof a.value=="string"?a.value:null}function o(c){return!c||!n.ignoreWithDescription?!1:new RegExp(n.ignoreWithDescription).test(c)}function i(c){return c.length!==1?!1:t.body.filter(u=>{if(u.type===Ae.AST_NODE_TYPES.ExpressionStatement){let m=u.expression;if(m.type===Ae.AST_NODE_TYPES.CallExpression&&m.callee.type===Ae.AST_NODE_TYPES.Identifier){let y=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function p(c){let a=c.arguments[1];if(a&&(a.type===Ae.AST_NODE_TYPES.FunctionExpression||a.type===Ae.AST_NODE_TYPES.ArrowFunctionExpression)&&a.body.type===Ae.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 l=Array.isArray;function R(v){if(!l(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&&(Mt(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 W=O.node.id,{name:Q}=B;if(Q==="useRef"&&W.type==="Identifier")return!0;if(Oi(B)&&W.type==="Identifier"){for(let ee of v.references)ee!==W&&C.add(ee.identifier);return!0}else if(Q==="useState"||Q==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&l(v.identifiers)){if(W.elements[1]===v.identifiers[0]){if(Q==="useState"){let ee=v.references,Fe=0;for(let $e=0;$e<ee.length;$e++){if(ee[$e].isWrite()&&Fe++,Fe>1)return!1;a.set(ee[$e].identifier,W.elements[0])}}return!0}else if(W.elements[0]===v.identifiers[0]){if(Q==="useState"){let ee=v.references;for(let Fe=0;Fe<ee.length;Fe++)u.add(ee[Fe].identifier)}return!1}}}else if(Q==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(v.identifiers)&&W.elements[1]===v.identifiers[0])return!0;return!1}function d(v){if(!l(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,W;for(W=0;W<z.length;W++){let Q=z[W],ee=Q.block;if(_.type==="FunctionDeclaration"&&ee===_||_.type==="VariableDeclarator"&&ee.parent===_){B=Q;break}}if(B==null)return!1;for(W=0;W<B.through.length;W++){let Q=B.through[W];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 V=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 _=Mt(I,O.identifier),z=er(_),B=_e(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 W=O.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===I.parent)&&W.type!=="TypeParameter")if(V.has(B))V.get(B).references.push(O);else{let Q=O.resolved,ee=g(Q)||F(Q);V.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 W=0;W<z.length;W++){let{identifier:Q}=z[W],{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||p({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),p({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 Y=new Set;if(V.forEach(({isStable:v,references:O},_)=>{v&&Y.add(_),O.forEach(z=>{z.writeExpr&&Z(z.writeExpr,_)})}),D.size>0)return;if(!A){let v=null;if(V.forEach(({isStable:O,references:_},z)=>{v||_.forEach(B=>{if(v)return;let W=B.identifier;if(!a.has(W))return;let ee=B.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(v=z)})}),v){let{suggestedDependencies:O}=jt({dependencies:V,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});p({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"?p({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"){p({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)&&p({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=_e(v,G)}catch(B){if(/Unsupported node type/.test(B.message)){v.type==="Literal"?V.has(v.value)?p({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?`}):p({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({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:Re,unnecessaryDependencies:Ve,missingDependencies:Se,duplicateDependencies:st}=jt({dependencies:V,declaredDependencies:ue,stableDependencies:Y,externalDependencies:fe,isEffect:b}),Ke=Re;if(st.size+Se.size+Ve.size===0){if(n)return;Fi({declaredDependencies:ue,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:O,isUsedOutsideOfHook:_,depType:z})=>{let B=z==="function"?"useCallback":"useMemo",W=z==="function"?"definition":"initialization",Q=`wrap the ${W} of '${O.name.name}' in its own ${B}() Hook.`,ee=_?`To fix this, ${Q}`:`Move it inside the ${h} callback. Alternatively, ${Q}`,Fe=z==="conditional"||z==="logical expression"?"could make":"makes",$e=`The '${O.name.name}' ${z} ${Fe} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Vn;_&&O.type==="Variable"&&z==="function"&&(Vn=[{desc:`Wrap the ${W} of '${O.name.name}' in its own ${B}() Hook.`,fix(Jn){let[ui,fi]=B==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Jn.insertTextBefore(O.node.init,ui),Jn.insertTextAfter(O.node.init,fi)]}}]),p({node:O.node,message:$e,suggest:Vn})});return}!b&&Se.size>0&&(Ke=jt({dependencies:V,declaredDependencies:[],stableDependencies:Y,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()&&Ke.sort();function Ce(v){let O=v.split("."),_="";for(let z=0;z<O.length;z++){if(z!==0){let B=O.slice(0,z+1).join("."),W=G.get(B)===!0;_+=W?"?.":"."}_+=O[z]}return _}function Pt(v,O,_,z){return v.size===0?null:(v.size>1?"":O+" ")+_+" "+(v.size>1?"dependencies":"dependency")+": "+ki(Array.from(v).sort().map(B=>"'"+Ce(B)+"'"))+`. Either ${z} ${v.size>1?"them":"it"} or remove the dependency array.`}let Pe="";if(Ve.size>0){let v=null;if(Array.from(Ve.keys()).forEach(O=>{v===null&&O.endsWith(".current")&&(v=O)}),v!==null)Pe=` 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)||(Pe=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Pe&&Se.has("props")){let v=V.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],W=Mt(N.block,B.identifier);if(!W){_=!1;break}let Q=W.parent;if(Q==null){_=!1;break}if(Q.type!=="MemberExpression"&&Q.type!=="OptionalMemberExpression"){_=!1;break}}_&&(Pe=` 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(!Pe&&Se.size>0){let v=null;Se.forEach(O=>{if(v)return;let _=N.set.get(O),z=V.get(O);if(z.references[0].resolved!==_)return;let B=_.defs[0];if(B==null||B.name==null||B.type!=="Parameter")return;let W=!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){W=!0;break}W&&(v=O)}),v!==null&&(Pe=` If '${v}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Pe&&Se.size>0){let v=null;if(Se.forEach(O=>{if(v!==null)return;let z=V.get(O).references,B,W;for(let Q=0;Q<z.length;Q++){for(B=z[Q].identifier,W=B.parent;W!=null&&W!==N.block;){if(W.type==="CallExpression"){let ee=a.get(W.callee);if(ee!=null){if(ee.name===O)v={missingDep:O,setter:W.callee.name,form:"updater"};else if(u.has(B))v={missingDep:O,setter:W.callee.name,form:"reducer"};else{let Fe=z[Q].resolved;if(Fe!=null){let $e=Fe.defs[0];$e!=null&&$e.type==="Parameter"&&(v={missingDep:O,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(v!==null)break}}),v!==null)switch(v.form){case"reducer":Pe=` You can also replace multiple useState variables with useReducer if '${v.setter}' needs the current value of '${v.missingDep}'.`;break;case"inlineReducer":Pe=` 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":Pe=` 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.")}}p({node:A,message:`React Hook ${r(T)} has `+(Pt(Se,"a","missing","include")||Pt(Ve,"an","unnecessary","exclude")||Pt(st,"a","duplicate","omit"))+Pe,suggest:[{desc:`Update the dependencies array to be: [${Ke.map(Ce).join(", ")}]`,fix(v){return v.replaceText(A,`[${Ke.map(Ce).join(", ")}]`)}}]})}function x(I){let A=vi(I.callee,i);if(A===-1)return;let T=I.arguments[A],h=I.callee,b=tr(h).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!T){p({node:h,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!k)){if(!w&&!k){(b==="useMemo"||b==="useCallback")&&p({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=t(I).set.get(T.name);if(N==null||N.defs==null)return;let l=N.defs[0];if(!l||!l.node||l.type!=="Variable"&&l.type!=="FunctionName")break;switch(l.node.type){case"FunctionDeclaration":E(l.node,w,h,b,k);return;case"VariableDeclarator":let R=l.node.init;if(!R)break;switch(R.type){case"ArrowFunctionExpression":case"FunctionExpression":E(R,w,h,b,k);return}break}break;default:p({node:h,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({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||Ri.test(I.value))return n=!0,{CallExpression:A=>x(A,!0)}}return{CallExpression:I=>x(I)}}};function jt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,x)=>{let S=p(o,x);S.isUsed=!0,c(o,x,I=>{I.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let x=p(o,E);x.isSatisfiedRecursively=!0}),r.forEach(E=>{let x=p(o,E);x.isSatisfiedRecursively=!0});function p(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(o,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 n.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 Xe(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 Xe(e.consequent)!=null||Xe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Xe(e.left)!=null||Xe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Xe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Xe(e.expression);case"TSAsExpression":return Xe(e.expression)}return null}function Fi({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let s=e.map(({key:i})=>{let p=r.variables.find(a=>a.name===i);if(p==null)return null;let c=p.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=Xe(c.node.init);if(a!=null)return[p,a]}return c.type==="FunctionName"&&c.node.type==="FunctionDeclaration"?[p,"function"]:c.type==="ClassName"&&c.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let c=0;c<i.references.length;c++){let a=i.references[c];if(a.writeExpr){if(p)return!0;p=!0;continue}let u=a.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!nr(n,a.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function er(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)?er(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Lt(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function _e(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=_e(e.object,n),t=_e(e.property,null),s=`${r}.${t}`;return Lt(e,n,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=_e(e.object,n),t=_e(e.property,null),s=`${r}.${t}`;return Lt(e,n,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=_e(r.object,n),s=_e(r.property,null),o=`${t}.${s}`;return Lt(r,n,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function tr(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function vi(e,n){let r=tr(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=_e(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return n.additionalHooks.test(t)?0:-1}else return-1}}function Mt(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),Pi(t,n))return t;if(nr(t,n))for(let[s,o]of Object.entries(t))s!=="parent"&&(Kn(o)?(o.parent=t,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Kn(i)&&(i.parent=t,r.push(i))}))}return null}function ki(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Pi(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function nr(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function Oi(e){return!1}var ae=require("@typescript-eslint/utils"),X=ve(require("typescript")),zt=require("zod/v4");var $t=require("@typescript-eslint/utils");function Qe(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:Qe(e.parent,n,r===1/0?r:r-1)}function*_t(e){yield e,e.parent&&(yield*_t(e.parent))}function Ut(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function ir(e,n,r){let s=r.getDeclaredVariables(e).find(o=>o.name===n||o.identifiers[0]?.parent.type===$t.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===$t.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===n);return s?s.references.filter(o=>!o.init):[]}function rr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ni(e,n){return e[n]}function Oe(e,n,r){let t=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),n(i)===!0)return!0;let c=t[i.type];if(c)for(let a of c){let u=Ni(i,a);if(u){if(Array.isArray(u)){for(let m of u)if(rr(m)&&o(m))return!0}else if(rr(u)&&o(u))return!0}}return!1}o(e)}var Di=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="improved-no-unnecessary-condition",ji=zt.z.object({alternativeForInCondition:zt.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),or={object:"Array",property:"isArray"},Li=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Mi=new Set(Li),Wt={name:sr,rule:Di({name:sr,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:[J(ji)]},defaultOptions:[{}],create(e,[n]){let r=ae.ESLintUtils.getParserServices(e,!0),t=r.program?.getTypeChecker();if(!t||!r.program)throw new Error("TypeScript services or program not available");function s(l){return l.type===ae.AST_NODE_TYPES.UnaryExpression&&l.operator==="typeof"}function o(l){return l.flags&X.default.TypeFlags.Any||l.flags&X.default.TypeFlags.Unknown?null:l.flags&X.default.TypeFlags.StringLike?["string"]:l.flags&X.default.TypeFlags.NumberLike?["number"]:l.flags&X.default.TypeFlags.BigIntLike?["bigint"]:l.flags&X.default.TypeFlags.BooleanLike?["boolean"]:l.flags&X.default.TypeFlags.ESSymbolLike?["symbol"]:l.flags&X.default.TypeFlags.Undefined||l.flags&X.default.TypeFlags.Void?["undefined"]:l.flags&X.default.TypeFlags.Null?["object"]:l.getCallSignatures().length>0?["function"]:l.flags&X.default.TypeFlags.Object?l.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:l.flags&X.default.TypeFlags.NonPrimitive?["object"]:l.flags&X.default.TypeFlags.Never?["never"]:null}function i(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.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=o(P);if(j)g.push(...j);else return null}return g}let F=o(d);return F?(g.push(...F),g):null}function p(l){if(!(l.operator==="==="||l.operator==="!=="))return;let d=null,g=null;if(s(l.left)?(d=l.left,g=l.right.type===ae.AST_NODE_TYPES.Literal&&typeof l.right.value=="string"?l.right.value:null):s(l.right)&&(d=l.right,g=l.left.type===ae.AST_NODE_TYPES.Literal&&typeof l.left.value=="string"?l.left.value:null),!d||!g||!$i(g,Mi))return;let F=i(d);if(!F)return;let P=l.operator==="!==",j=F.includes(g);F.length===1?j&&!P?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:g}}):!j&&P?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:Array.from(F)[0]}}):!j&&!P?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):j&&P&&e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):!j&&!P?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:et(d,e),actualType:yt(F),conditionType:g}}):!j&&P&&e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:et(d,e),type:yt(F)}})}function c(l){if(l.flags&X.default.TypeFlags.Any||l.flags&X.default.TypeFlags.Unknown)return null;if(l.isUnion()){let R=[];for(let d of l.types)if(d.flags&X.default.TypeFlags.StringLiteral){let g=d.value;R.push(g)}else return null;return R}return l.flags&X.default.TypeFlags.StringLiteral?[l.value]:null}function a(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.getTypeAtLocation(R),g=c(d);if(g)return g;let F=t.getSymbolAtLocation(R);if(F){let P=t.getTypeOfSymbolAtLocation(F,R),j=c(P);if(j)return j}return null}function u(l){let R=e.sourceCode.ast,d=null;return Oe(R,g=>{if(g.type===ae.AST_NODE_TYPES.VariableDeclarator&&g.id.type===ae.AST_NODE_TYPES.Identifier&&g.id.name===l.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(l){return l==="Array"||l==="ReadonlyArray"?!0:l.endsWith(".Array")||l.endsWith(".ReadonlyArray")}function y(l){if(!t)return!1;if(t.isArrayType(l)||t.isTupleType(l))return!0;let R=t.getApparentType(l);if(R!==l&&(t.isArrayType(R)||t.isTupleType(R)))return!0;if(l.aliasSymbol){let g=t.getFullyQualifiedName(l.aliasSymbol);if(m(g))return!0}let d=l.getSymbol();if(d){let g=t.getFullyQualifiedName(d);if(m(g))return!0}return!1}function C(l){if(!t)return!1;if(l.flags&X.default.TypeFlags.StringLike||l.flags&X.default.TypeFlags.NumberLike||l.flags&X.default.TypeFlags.BigIntLike||l.flags&X.default.TypeFlags.BooleanLike||l.flags&X.default.TypeFlags.ESSymbolLike||l.flags&X.default.TypeFlags.EnumLike||l.flags&X.default.TypeFlags.Null||l.flags&X.default.TypeFlags.Undefined||l.flags&X.default.TypeFlags.Void||l.flags&X.default.TypeFlags.Never)return!0;let R=l.getSymbol();if(R){let d=t.getFullyQualifiedName(R);if(d==="__function"||d==="__object"&&!y(l))return!0}return!1}function f(l){if(l.flags&X.default.TypeFlags.Any||l.flags&X.default.TypeFlags.Unknown)return"unknown";if(l.isUnion()){let R=!0,d=!0;for(let g of l.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(l)?"alwaysTrue":C(l)?"alwaysFalse":"unknown"}function E(l){return!l.computed&&l.object.type===ae.AST_NODE_TYPES.Identifier&&l.object.name===or.object&&l.property.type===ae.AST_NODE_TYPES.Identifier&&l.property.name===or.property}function x(l){if(!t||l.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!E(l.callee)||l.arguments.length===0)return;let[R]=l.arguments;if(!R||R.type===ae.AST_NODE_TYPES.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(R),g=t.getTypeAtLocation(d),F=f(g);F==="alwaysTrue"?e.report({node:l,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:l,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(l){if(l.callee.type!==ae.AST_NODE_TYPES.MemberExpression||l.callee.property.type!==ae.AST_NODE_TYPES.Identifier||l.callee.computed)return;let R=l.callee.property.name;if(R!=="startsWith"&&R!=="endsWith"&&R!=="includes"||l.arguments.length!==1)return;let[d]=l.arguments;if(!d||d.type!==ae.AST_NODE_TYPES.Literal||typeof d.value!="string")return;let g=l.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,V=0;for(let G of F)if((R==="startsWith"?G.startsWith(P):R==="endsWith"?G.endsWith(P):G.includes(P))?j++:V++,j>0&&V>0)return;if(j>0&&V===0){let G=R==="startsWith"?"unnecessaryStartsWithCondition":R==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:l,messageId:G})}else if(V>0&&j===0){let G=R==="startsWith"?"alwaysFalseStartsWithCondition":R==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:l,messageId:G})}}function I(l){if(!new Set(["===","!==",">",">=","<","<="]).has(l.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 Y=[];for(let ue of Z)Y.push(ue.length);return{values:Y}}let g=d(l.left),F=d(l.right),P=null,j=null;if(g?l.right.type===ae.AST_NODE_TYPES.Literal&&typeof l.right.value=="number"&&(P=g.values,j=l.right.value):F&&l.left.type===ae.AST_NODE_TYPES.Literal&&typeof l.left.value=="number"&&(P=F.values,j=l.left.value),!P||j===null)return;let V=0,G=0;for(let H of P){let D=!1;if(l.operator==="==="?D=H===j:l.operator==="!=="?D=H!==j:l.operator===">"?D=H>j:l.operator===">="?D=H>=j:l.operator==="<"?D=H<j:l.operator==="<="&&(D=H<=j),D?V++:G++,V>0&&G>0)return}V>0&&G===0?e.report({node:l,messageId:"unnecessaryLengthCondition"}):G>0&&V===0&&e.report({node:l,messageId:"alwaysFalseLengthCondition"})}function A(l){if(l.type===ae.AST_NODE_TYPES.Literal&&typeof l.value=="string")return l.value;let R=a(l);if(!R||R.length!==1)return null;let[d]=R;return d??null}function T(l){return(l.flags&X.default.TypeFlags.Intersection)!==0}function h(l){return(l.flags&X.default.TypeFlags.Object)!==0}function b(l){return!t||t.getIndexTypeOfType(l,X.default.IndexKind.String)?!0:!!t.getIndexTypeOfType(l,X.default.IndexKind.Number)}function w(l,R){if(!t||b(l)||l.getProperties().length===0)return"unknown";let d=t.getPropertyOfType(l,R);return d?d.flags&X.default.SymbolFlags.Optional?"optional":"required":"absent"}function k(l,R){if(l.flags&X.default.TypeFlags.Any||l.flags&X.default.TypeFlags.Unknown||l.flags&X.default.TypeFlags.Never||l.flags&X.default.TypeFlags.TypeParameter||l.flags&X.default.TypeFlags.IndexedAccess||l.flags&X.default.TypeFlags.StringLike||l.flags&X.default.TypeFlags.NumberLike||l.flags&X.default.TypeFlags.BigIntLike||l.flags&X.default.TypeFlags.BooleanLike||l.flags&X.default.TypeFlags.EnumLike||l.flags&X.default.TypeFlags.ESSymbolLike||l.flags&X.default.TypeFlags.NonPrimitive||l.flags&X.default.TypeFlags.Null||l.flags&X.default.TypeFlags.Undefined||l.flags&X.default.TypeFlags.Void)return"unknown";if(l.isUnion()){let d=!0,g=!0;for(let F of l.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(l)){let d=l,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(l)?w(l,R):"unknown"}function N(l){if(l.operator!=="in"||l.left.type===ae.AST_NODE_TYPES.PrivateIdentifier)return;let R=A(l.left);if(!R)return;let d=l.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!t)return;let F=t.getTypeAtLocation(g),P=k(F,R);P==="required"?e.report({node:l,messageId:"unnecessaryInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:l,messageId:"alwaysFalseInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}})}return{BinaryExpression(l){p(l),I(l),N(l)},CallExpression(l){S(l),x(l)}}}})};function yt(e){return Array.from(new Set(e)).join(" | ")||"never"}function et(e,n){let r=e.argument;return r.type===ae.AST_NODE_TYPES.Identifier?r.name:n.sourceCode.getText(r)}function $i(e,n){return n.has(e)}var gt=require("@typescript-eslint/utils"),dt=require("zod/v4");var _i=gt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="no-call-with-explicit-generics",Ui=dt.z.object({functions:dt.z.array(dt.z.string())}),zi=_i({name:ar,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:[J(Ui)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:s}=t;s.type===gt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Vt={name:ar,rule:zi};var Ye=require("@typescript-eslint/utils"),Wi=Ye.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-call-with-inferred-generics",Vi=Wi({name:lr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:s}=t;if(s.type!==Ye.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:c=n.disallowTypes}=o;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!c)&&t.typeArguments?.params.some(u=>!p&&u.type===Ye.AST_NODE_TYPES.TSAnyKeyword||c&&u.type===Ye.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===Ye.AST_NODE_TYPES.Identifier&&c.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),Jt={name:lr,rule:Vi};var ur=require("@typescript-eslint/utils"),Ji=ur.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-commented-out-code",Xi=["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:"],Bi=/^\s*return\s+/,Hi=/\w=("|'|`)/,Yi=/\w+:\s*('|"|`)/,qi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Zi=/\w+-\w+:/,Gi=/\w+_\w+:/,Ki=/\?\s+\w/,Qi=/:\s+\w/,es=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ts=/^\s*\d+[,}]/,ns=/^\s*\[[^\]]*\][,}]/,rs=/^\s*\{[^}]*\}[,}]/,is=/\.\w+\(/,ss=/\[\w+\]/,os=/^\s*(['"`]).+?\1\s*:/,as=/^<[A-Z]\w*(\s|>|\/)/,ls=/^<[a-z]+(\s|>|\/)/,ps=/<[A-Z]\w*(\s.*)?>/,cs=/<\/[A-Z]\w*>/,us=/<[a-z]+(\s.*)?>/,fs=/<\/[a-z]+>/,ms=/^\s*[*\s]*$/,ys=/^[a-zA-Z]/,ds=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,gs=/```[\s\S]*?```/g,Ss=/`[^`]*`/g,pr=/[a-zA-Z0-9]/,Ts=/\.[A-Za-z_][A-Za-z0-9_]*\(/,hs=/[{}[\]()`=<>]/,Es=/:\s*(['"`[{(]|\w+\s*=>)/,bs=/\bif\s*\(|\belse\b|=>/,me={returnStatement:Bi,stringAssignment:Hi,objectPropertyWithQuotes:Yi,computedPropertyAssignment:qi,kebabCaseProperty:Zi,snakeCaseProperty:Gi,ternaryOperator:Ki,colonWithWord:Qi,quotedString:es,numberWithComma:ts,arrayWithComma:ns,objectWithComma:rs,methodCall:is,arrayAccess:ss,quotedPropertyKey:os,jsxSelfClosing:as,jsxElement:ls,jsxOpeningTag:ps,jsxClosingTag:cs,htmlOpeningTag:us,htmlClosingTag:fs,jsdocComment:ms};function xs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&ys.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||Ts.test(n)||hs.test(n)||Es.test(n)||bs.test(n)?!1:!!(n.includes(":")&&ds.test(n))}var Cs=[") {","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],Is=["/>","</",me.jsxSelfClosing,me.jsxElement,me.jsxOpeningTag,me.jsxClosingTag,me.htmlOpeningTag,me.htmlClosingTag],cr=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],As=Ji({name:fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,s){if(t.startsWith("/"))return!1;let o=t.trimStart();if(t.startsWith("*")||o.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||me.jsdocComment.test(t))return!1;for(let i of cr)if(o.startsWith(i))return!1;if(t.includes("https://")||xs(o))return!1;if(s==="Block"){for(let i of Is)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Xi)if(o.startsWith(i))return{wrongPattern:i};for(let i of Cs)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,s){let o=t,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let a=o.split(gs);a.some(m=>pr.test(m))&&(o=a.join(""))}if(!o.includes("`"))return o;let p=o.split(Ss);return p.some(a=>pr.test(a))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=n(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:cr.join(", ")}})}}}}}),Xt={name:fr,rule:As};var St=require("@typescript-eslint/utils"),ws=St.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",Rs=ws({name:mr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===St.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Bt={name:mr,rule:Rs};var yr=require("@typescript-eslint/utils"),Fs=yr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-leaked-text-in-jsx",vs=[",",";","[","]","(",")"],ks=Fs({name:dr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";vs.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),Ht={name:dr,rule:ks};var Be=require("@typescript-eslint/utils"),Ps=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-non-camel-case-functions",Os=/^(\$?[a-z][a-zA-Z0-9]*)$/;function gr(e){if(e.typeName.type!==Be.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Be.AST_NODE_TYPES.Identifier&&n.name==="JSX"&&r.name==="Element"}var Ns=Ps({name:Sr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(n){if(n.id&&!Os.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Be.AST_NODE_TYPES.TSTypeReference?gr(r):r.type===Be.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Be.AST_NODE_TYPES.TSTypeReference&&gr(s))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),Yt={name:Sr,rule:Ns};var oe=require("@typescript-eslint/utils");var Ds=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-optional-root-props",js=Ds({name:Tr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let o=e.sourceCode.getDeclaredVariables(t)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of _t(i.identifier)){if("returnType"in p||p.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let c=p.parent;if(!c)return!1;if(c.type===oe.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&c.parent.type===oe.TSESTree.AST_NODE_TYPES.TSTypeReference&&c.parent.typeName.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&c.parent.typeName.name==="FC"){let u=Qe(c.parent.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=Tt(u,e.sourceCode);return m?!(m.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(p.type===oe.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(c.type===oe.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let a=Qe(c,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration);return a?!!Tt(a,e.sourceCode):!1}if(c.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!Tt(c,e.sourceCode)}return!1}function r(t){t.key.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=Qe(t,oe.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(ht(t)||!n(t)))for(let s of t.typeAnnotation.members)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(t){if(!(ht(t)||!n(t)))for(let s of t.body.body)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(t){if(t.typeName.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let s=t.typeArguments.params[0];if(s.type!==oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Qe(t.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=Tt(o,e.sourceCode);if(!(!i||i.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let c of s.members)c.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(c)}}}});function ht(e){return e?e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function Tt(e,n){if(ht(e))return;let r;if(e.type===oe.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let s=t.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!ht(o[0].identifier.parent.parent))return o[0].identifier}var qt={name:Tr,rule:js};var ot=require("@typescript-eslint/utils");var at=q({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===ot.AST_NODE_TYPES.Identifier?n.has(t.name):t.type===ot.AST_NODE_TYPES.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let s of t.specifiers)n.add(s.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===ot.AST_NODE_TYPES.VariableDeclaration)for(let s of t.declaration.declarations)r(s.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===ot.AST_NODE_TYPES.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});var hr=require("@typescript-eslint/utils"),Et=ve(require("path")),Ue=require("zod/v4");var Ls=hr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Er="no-relative-imports",Ms=Ue.z.object({find:Ue.z.string(),replacement:Ue.z.string()}),$s=Ue.z.object({aliases:Ue.z.array(Ms),rootDir:Ue.z.string().optional(),allowNotFoundAliases:Ue.z.boolean().optional(),_dev_simulateFileName:Ue.z.string().optional()}),_s=Ls({name:Er,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:[J($s)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let c=Et.default.dirname(p);return Et.default.resolve(c,i)}function o(i){let p=n.rootDir??process.cwd(),c=Et.default.relative(p,i);if(c.startsWith("."))return null;c.startsWith("/")||(c=`/${c}`);for(let{find:a,replacement:u}of n.aliases)if(c.startsWith(u)){let m=c.replace(u,a);return{alias:a,newPath:m}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!t(p))return;let c=s(p,r),a=o(c);!a&&n.allowNotFoundAliases||e.report({node:i,messageId:a?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:a?.alias},fix:a?u=>u.replaceText(i.source,`'${a.newPath}'`):void 0})}}}}),Zt={name:Er,rule:_s};var ye=require("@typescript-eslint/utils"),Gt=require("zod/v4");var Us=Gt.z.object({customMessage:Gt.z.string().optional()}),Kt=q({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[J(Us)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case ye.AST_NODE_TYPES.Literal:return!0;case ye.AST_NODE_TYPES.ObjectExpression:return t.properties.every(s=>s.type===ye.AST_NODE_TYPES.Property?s.computed||s.value.type===ye.AST_NODE_TYPES.Identifier&&s.key.type===ye.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case ye.AST_NODE_TYPES.ArrayExpression:return t.elements.every(s=>s?s.type===ye.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case ye.AST_NODE_TYPES.TemplateLiteral:return t.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(t){if(t.name.type===ye.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let s=null;t.value.type===ye.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==ye.AST_NODE_TYPES.JSXEmptyExpression&&(s=t.value.expression):t.value.type===ye.AST_NODE_TYPES.Literal&&(s=t.value),s&&r(s)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});var lt=require("@typescript-eslint/utils"),qe=ve(require("zod/v4"));var zs=qe.object({alternativeMsgs:qe.object({inArrayFind:qe.string().optional(),inArrayFilter:qe.string().optional()}).optional(),__dev_simulateFileName:qe.string().optional()});function Ws(e){return e.typeAnnotation.type!==lt.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Vs=/(typeGuards|type-guards)\.(ts|tsx)$/;function Js(e){return Vs.test(e)}function Xs(e){let n=e.parent;for(;n;){if(n.type===lt.AST_NODE_TYPES.CallExpression&&n.callee.type===lt.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===lt.AST_NODE_TYPES.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Qt=q({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:[J(zs)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(Js(r))return{};function t(s){if(!Ws(s))return;let o=Xs(s);if(n.alternativeMsgs&&o){let i=o.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});var Ze=require("@typescript-eslint/utils");var Bs="no-unnecessary-async-on-jsx-props";function Hs(e){if(e.body.type!==Ze.AST_NODE_TYPES.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==Ze.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ze.AST_NODE_TYPES.AwaitExpression}var en=q({name:Bs,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){Hs(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let s=e.sourceCode,o=[],i=s.getFirstToken(r,c=>c.value==="async");if(i){let c=s.getTokenAfter(i);c?o.push(t.replaceTextRange([i.range[0],c.range[0]],"")):o.push(t.remove(i))}function p(c){if(c.type===Ze.AST_NODE_TYPES.AwaitExpression){let a=s.getFirstToken(c);if(a&&a.value==="await"){let u=s.getTokenAfter(a);u?o.push(t.replaceTextRange([a.range[0],u.range[0]],"")):o.push(t.remove(a))}}if(c.type===Ze.AST_NODE_TYPES.BlockStatement)for(let a of c.body)p(a);else c.type===Ze.AST_NODE_TYPES.ExpressionStatement&&p(c.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});var ze=require("@typescript-eslint/utils"),tn=ve(require("typescript")),tt=ve(require("zod/v4"));var Ys=ze.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="no-unnecessary-casting",qs=tt.default.object({additionalCastFunctions:tt.default.array(tt.default.object({name:tt.default.string(),expectedType:tt.default.enum(["string","number"])})).optional()}),nn={name:br,rule:Ys({name:br,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:[J(qs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ze.ESLintUtils.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case ze.AST_NODE_TYPES.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case ze.AST_NODE_TYPES.TemplateLiteral:return m==="string";case ze.AST_NODE_TYPES.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function p(u,m){return m==="number"?!!(u.flags&tn.TypeFlags.NumberLike):!!(u.flags&tn.TypeFlags.StringLike)}function c(u,m){return y=>y.replaceText(u,e.sourceCode.getText(m))}function a(u){if(!o||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===ze.AST_NODE_TYPES.SpreadElement)return;let{callee:y}=u;if(y.type!==ze.AST_NODE_TYPES.Identifier)return;let C=y.name,f=t.find(x=>x.name===C);if(!f)return;if(i(m,f.expectedType)||p(o.getTypeAtLocation(s.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 Ae=require("@typescript-eslint/utils"),bt=ve(require("zod/v4"));var Zs=bt.object({ignoreWithDescription:bt.string().optional()}),rn=q({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:[J(Zs)]},defaultOptions:[{}],create(e,[n]){let r=e.getSourceCode(),t=r.ast;function s(c){let a=c.arguments[0];return a&&a.type===Ae.AST_NODE_TYPES.Literal&&typeof a.value=="string"?a.value:null}function o(c){return!c||!n.ignoreWithDescription?!1:new RegExp(n.ignoreWithDescription).test(c)}function i(c){return c.length!==1?!1:t.body.filter(u=>{if(u.type===Ae.AST_NODE_TYPES.ExpressionStatement){let m=u.expression;if(m.type===Ae.AST_NODE_TYPES.CallExpression&&m.callee.type===Ae.AST_NODE_TYPES.Identifier){let y=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function p(c){let a=c.arguments[1];if(a&&(a.type===Ae.AST_NODE_TYPES.FunctionExpression||a.type===Ae.AST_NODE_TYPES.ArrowFunctionExpression)&&a.body.type===Ae.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 t.body)y.type===Ae.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===Ae.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===Ae.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=s(a);if(o(u))return;let m=t.body.find(y=>y.type===Ae.AST_NODE_TYPES.ExpressionStatement&&y.expression===a);!m||m.type!==Ae.AST_NODE_TYPES.ExpressionStatement||e.report({node:a,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let C=p(a);return C?y.replaceText(m,C):null}}]})}}}});var pt=require("@typescript-eslint/utils"),De=ve(require("zod/v4"));var Hs=De.object({methods:De.union([De.array(De.string()),De.literal("array")])}),rn=q({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:[B(Hs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):t.has(p)}function o(p){let{callee:c}=p;if(c.type===pt.AST_NODE_TYPES.MemberExpression){let a=c.property;if(a.type===pt.AST_NODE_TYPES.Identifier)return a.name}return null}function i(p,c){if(p.type!==pt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let a=c.parent;if(a.type===pt.AST_NODE_TYPES.CallExpression){let u=o(a);u&&s(u)&&a.arguments.indexOf(c)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return p.typeAnnotation?y.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let c of p.params)i(c,p)},FunctionExpression(p){for(let c of p.params)i(c,p)}}}});var Ie=require("@typescript-eslint/utils");var sn=q({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===Ie.AST_NODE_TYPES.ObjectPattern||!n.init||n.init.type!==Ie.AST_NODE_TYPES.ObjectExpression||n.id.type===Ie.AST_NODE_TYPES.Identifier&&n.id.typeAnnotation||n.parent.parent.type===Ie.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===Ie.AST_NODE_TYPES.Property&&i.key.type===Ie.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==Ie.AST_NODE_TYPES.Identifier)return;let t=Ys(n,e.sourceCode);if(t.length===0)return;let s=n.init.properties.some(i=>i.type!==Ie.AST_NODE_TYPES.Property?!1:i.value.type===Ie.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of t){if(i.identifier.parent.type!==Ie.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ie.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==Ie.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===Ie.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Ys(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}var te=require("@typescript-eslint/utils"),on=require("zod/v4");var qs=on.z.object({ignoreArgsMatching:on.z.string().optional()}),an=q({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:[B(qs)]},defaultOptions:[{}],create(e,[n]){let r=[];function t(i){return n.ignoreArgsMatching?new RegExp(n.ignoreArgsMatching).test(i):!1}function s(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 o(i){let p=[];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(!t(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)?p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y}):p.push({param:a,index:c,name:u,isObjectParam:!1})}else if(a.optional)p.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)&&p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},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||s(i.parent.parent))return;let c=[...o(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"),He=require("zod/v4");var Zs=He.z.object({selectors:He.z.array(He.z.object({name:He.z.string(),selectorProp:He.z.string().optional(),selectorArgPos:He.z.number().optional(),returnProp:He.z.string().optional()}))}),Gs=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-unused-selected-values",ln={name:hr,rule:Gs({name:hr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[B(Zs)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===le.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Qs(o);if(!i)return;let p=t.get(i);if(!p)return;let c=Ks(o,p.selectorArgPos??0,p.selectorProp);if(!c)return;let a=eo(c);if(!a)return;let u=Er(a.properties,void 0);if(!u)return;if(s.id.type===le.AST_NODE_TYPES.ObjectPattern){let C=Er(s.id.properties,p.returnProp);if(!C)return;for(let[f,E]of u)C.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==le.AST_NODE_TYPES.Identifier||p.returnProp)return;let m=to(s,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 Ks(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===le.AST_NODE_TYPES.ArrowFunctionExpression||t.type===le.AST_NODE_TYPES.FunctionExpression)return t;if(r&&t.type===le.AST_NODE_TYPES.ObjectExpression){let s=t.properties.find(i=>i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==le.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===le.AST_NODE_TYPES.ArrowFunctionExpression||o.type===le.AST_NODE_TYPES.FunctionExpression)return o}return null}function Qs(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 eo(e){if(e.body.type===le.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===le.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===le.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==le.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}function Er(e,n){let r=e;if(n){let s=e.find(o=>o.type===le.AST_NODE_TYPES.Property&&o.key.type===le.AST_NODE_TYPES.Identifier&&o.key.name===n);if(s?.type!==le.AST_NODE_TYPES.Property||s.value.type!==le.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let t=new Map;for(let s of r){if(s.type!==le.AST_NODE_TYPES.Property||s.key.type!==le.AST_NODE_TYPES.Identifier)return null;t.set(s.key.name,s)}return t.size>0?t:null}function to(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}var pe=require("@typescript-eslint/utils");var pn=q({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(o=>o.type===pe.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let t=null,s=!1;return{CallExpression(o){if(s)return;if(!t){let p=no(o);p&&(t=p);return}let i=ro(o,e.sourceCode);if(i){s=!0;for(let p of i)t.delete(p);if(t.size!==0)for(let[p,c]of t)e.report({node:c,messageId:"unusedField",data:{name:p}})}}}}});function no(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 t=_t(r.properties,o=>o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===pe.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===pe.AST_NODE_TYPES.FunctionExpression?io(o.value):null);if(!t)return null;let s=new Map;for(let o of t.properties)o.type===pe.AST_NODE_TYPES.Property&&o.key.type===pe.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function ro(e,n){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||!_t(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 s=tr(e.parent,"formFields",n),o=new Set;for(let{identifier:i}of s){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;o.add(i.parent.property.name)}}return o}function io(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}var se=require("@typescript-eslint/utils"),ct=require("zod/v4");var so=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function br(e){let n=[];for(let r of e.members)r.type===se.AST_NODE_TYPES.TSPropertySignature&&r.key.type===se.AST_NODE_TYPES.Identifier&&n.push([r.key.name,r]);return n}function xr(e,...n){for(let r of n)e.set(...r);return e}var oo=ct.z.object({forceCheckOnFCPropTypesWithName:ct.z.array(ct.z.string()).optional(),alwaysCheckFunctionOptionTypes:ct.z.boolean().optional()}),Cr="no-unused-type-props-in-args",cn=null,ao=so({name:Cr,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:[B(oo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!cn&&(cn=r.map(c=>new RegExp(c)));function s(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&&cn?.some(T=>T.test(f)),S=C&&t;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===se.AST_NODE_TYPES.ExportNamedDeclaration;if(!(y&&A&&!S)){if(I.type===se.AST_NODE_TYPES.TSTypeAliasDeclaration){o(c,a,m,I.typeAnnotation,!0,C);return}if(I.type===se.AST_NODE_TYPES.TSInterfaceDeclaration){o(c,a,m,I.body,!0,C);return}}}function o(c,a,u,m,y,C=!1){if(m.type===se.AST_NODE_TYPES.TSInterfaceBody){for(let f of m.body)f.type===se.AST_NODE_TYPES.TSPropertySignature&&f.key.type===se.AST_NODE_TYPES.Identifier&&u.set(f.key.name,f);return}if(m.type===se.AST_NODE_TYPES.TSTypeLiteral){xr(u,...br(m));return}if(m.type===se.AST_NODE_TYPES.TSIntersectionType){for(let f of m.types)o(c,a,u,f,!0,C);return}y||m.type===se.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===se.AST_NODE_TYPES.Identifier&&s(c,a,m.typeName,u,!0,C)}function i(c,a,u,m=!1){for(let y of u)if(y.type===se.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let C=new Map;if(o(c,a,C,y.typeAnnotation.typeAnnotation,!1,m),C.size===0)continue;p(y,C)}else y.type===se.AST_NODE_TYPES.AssignmentPattern&&y.left.type===se.AST_NODE_TYPES.ObjectPattern&&i(c,a,[y.left],m)}function p(c,a){let u=[];if(c.properties.at(-1)?.type===se.AST_NODE_TYPES.RestElement)return;for(let f of c.properties)f.type===se.AST_NODE_TYPES.Property&&f.key.type===se.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===se.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===se.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation?.typeAnnotation.type===se.AST_NODE_TYPES.TSTypeReference&&a.id.typeAnnotation.typeAnnotation.typeName.type===se.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&a.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===se.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===se.AST_NODE_TYPES.Identifier)s(!0,c,m.typeName,u,!1);else if(m.type===se.AST_NODE_TYPES.TSTypeLiteral)xr(u,...br(m));else if(m.type===se.AST_NODE_TYPES.TSIntersectionType)for(let y of m.types)y.type===se.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===se.AST_NODE_TYPES.Identifier?s(!0,c,y.typeName,u,!1):o(!0,c,u,y,!0);if(u.size!==0&&a.init?.type===se.AST_NODE_TYPES.ArrowFunctionExpression){let y=a.init.params[0];if(!y){e.report({node:a.init,messageId:"missingComponentParam"});return}y.type===se.AST_NODE_TYPES.ObjectPattern&&p(y,u)}}},FunctionDeclaration(c){i(!1,c,c.params,t)},ArrowFunctionExpression(c){i(!1,c,c.params,t)}}}}),un={name:Cr,rule:ao};var ke=require("@typescript-eslint/utils");var fn=q({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===ke.AST_NODE_TYPES.Identifier?n.has(t.callee.name):t.callee.type===ke.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===ke.AST_NODE_TYPES.Identifier&&t.callee.property.type===ke.AST_NODE_TYPES.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let s of t.specifiers)s.type===ke.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===ke.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&n.add(s.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ke.AST_NODE_TYPES.CallExpression&&r(t.init)&&t.id.type===ke.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(t).set.get(t.id.name);if(o){let i=!1;for(let p of o.references){let a=p.identifier.parent;if(a!==t&&!(a.type===ke.AST_NODE_TYPES.JSXExpressionContainer&&a.parent.type===ke.AST_NODE_TYPES.JSXAttribute&&a.parent.name.type===ke.AST_NODE_TYPES.JSXIdentifier&&a.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var nt=require("@typescript-eslint/utils"),lo=nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="prefer-named-functions",Ir=new Map,po=lo({name:Ar,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[n]){let r=null;if(n.ignoreRegex){let t=Ir.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),Ir.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===nt.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===nt.AST_NODE_TYPES.Identifier){let s=t.id.name;if(t.id.typeAnnotation||r&&r.test(s)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==nt.AST_NODE_TYPES.BlockStatement)return;let o=t.parent,i=t.init.params,p=t.init.body,c=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:a=>a.replaceText(o,`${c.async?"async ":""}function ${s}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),mn={name:Ar,rule:po};var K=require("@typescript-eslint/utils"),je=require("zod/v4");var co=je.z.object({disallowedFunctions:je.z.array(je.z.object({name:je.z.string(),allowUsingWithArgs:je.z.boolean().optional(),hookAlternative:je.z.string().optional(),message:je.z.string().optional(),allowUseInside:je.z.array(je.z.string()).optional()}))}),uo=/^use[A-Z]/,fo=/^[A-Z]/;function xt(e){return uo.test(e)}function wr(e){return fo.test(e)}function mo(e){return e.type===K.AST_NODE_TYPES.Identifier?xt(e.name):e.type===K.AST_NODE_TYPES.MemberExpression&&e.property.type===K.AST_NODE_TYPES.Identifier?xt(e.property.name):!1}function Rr(e,n){return e.type===K.AST_NODE_TYPES.Identifier?e.name===n: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===n:!1}function Fr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&Rr(e.parent.callee,"forwardRef"))}function kr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&Rr(e.parent.callee,"memo"))}function yn(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 yo(e){let n=e.parent,r=!1;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 t=yn(n);if(t&&t.type===K.AST_NODE_TYPES.Identifier){if(wr(t.name)||xt(t.name))return!r;r=!0}else{if(Fr(n)||kr(n))return!r;if(n.parent.type===K.AST_NODE_TYPES.CallExpression){let s=n.parent;mo(s.callee)||(r=!0)}else n.parent.type===K.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Pr(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 go(e,n){if(!n.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 t=yn(r);if(t&&t.type===K.AST_NODE_TYPES.Identifier&&n.includes(t.name))return!0}else if(r.type===K.AST_NODE_TYPES.CallExpression){let t=Pr(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function So(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===K.AST_NODE_TYPES.Identifier&&n.name==="undefined")}function To(e,n){let r=!1,t=e.parent;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 s=yn(t);if(s&&s.type===K.AST_NODE_TYPES.Identifier){if(wr(s.name)||xt(s.name)){r=!0;break}}else if(Fr(t)||kr(t)){r=!0;break}}t=t.parent}return r?n.length===0?yo(e):!go(e,n):!1}var dn=q({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:[B(co)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Pr(s);if(!o)return;let i=t.get(o);if(!i||i.allowUsingWithArgs&&So(s))return;let p=i.allowUseInside||[];To(s,p)&&e.report({node:s,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?s.callee.type===K.AST_NODE_TYPES.Identifier?c.replaceText(s.callee,a):s.callee.type===K.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===K.AST_NODE_TYPES.Identifier?c.replaceText(s.callee.property,a):null:null}}]:[]})}}}});var ce=require("@typescript-eslint/utils"),Ct=ve(require("zod/v4"));var ho=ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="prefer-single-line-if",Eo=Ct.default.object({maxLineLength:Ct.default.number().optional(),maxNonSimpleConditionLength:Ct.default.number().optional()}),bo=ho({name:Or,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:[B(Eo)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==ce.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let o=t.consequent.body[0];if(!o)return;if(o.type===ce.AST_NODE_TYPES.ReturnStatement){if(!Dr(o))return}else if(!(o.type===ce.AST_NODE_TYPES.ContinueStatement||o.type===ce.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===ce.AST_NODE_TYPES.LogicalExpression||t.test.type===ce.AST_NODE_TYPES.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=vr(t.test);if(!m&&t.test.type===ce.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let y=t.test.argument;vr(y)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
-
`))return;let c=r.getTokenAfter(t);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 t.body)y.type===Ae.AST_NODE_TYPES.ExpressionStatement&&y.expression.type===Ae.AST_NODE_TYPES.CallExpression&&y.expression.callee.type===Ae.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=s(a);if(o(u))return;let m=t.body.find(y=>y.type===Ae.AST_NODE_TYPES.ExpressionStatement&&y.expression===a);!m||m.type!==Ae.AST_NODE_TYPES.ExpressionStatement||e.report({node:a,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let C=p(a);return C?y.replaceText(m,C):null}}]})}}}});var pt=require("@typescript-eslint/utils"),De=ve(require("zod/v4"));var Gs=De.object({methods:De.union([De.array(De.string()),De.literal("array")])}),sn=q({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:[J(Gs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):t.has(p)}function o(p){let{callee:c}=p;if(c.type===pt.AST_NODE_TYPES.MemberExpression){let a=c.property;if(a.type===pt.AST_NODE_TYPES.Identifier)return a.name}return null}function i(p,c){if(p.type!==pt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let a=c.parent;if(a.type===pt.AST_NODE_TYPES.CallExpression){let u=o(a);u&&s(u)&&a.arguments.indexOf(c)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return p.typeAnnotation?y.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let c of p.params)i(c,p)},FunctionExpression(p){for(let c of p.params)i(c,p)}}}});var Ie=require("@typescript-eslint/utils");var on=q({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===Ie.AST_NODE_TYPES.ObjectPattern||!n.init||n.init.type!==Ie.AST_NODE_TYPES.ObjectExpression||n.id.type===Ie.AST_NODE_TYPES.Identifier&&n.id.typeAnnotation||n.parent.parent.type===Ie.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===Ie.AST_NODE_TYPES.Property&&i.key.type===Ie.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==Ie.AST_NODE_TYPES.Identifier)return;let t=Ks(n,e.sourceCode);if(t.length===0)return;let s=n.init.properties.some(i=>i.type!==Ie.AST_NODE_TYPES.Property?!1:i.value.type===Ie.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of t){if(i.identifier.parent.type!==Ie.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ie.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==Ie.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===Ie.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Ks(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}var te=require("@typescript-eslint/utils"),an=require("zod/v4");var Qs=an.z.object({ignoreArgsMatching:an.z.string().optional()}),ln=q({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:[J(Qs)]},defaultOptions:[{}],create(e,[n]){let r=[];function t(i){return n.ignoreArgsMatching?new RegExp(n.ignoreArgsMatching).test(i):!1}function s(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 o(i){let p=[];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(!t(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)?p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y}):p.push({param:a,index:c,name:u,isObjectParam:!1})}else if(a.optional)p.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)&&p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},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||s(i.parent.parent))return;let c=[...o(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"),He=require("zod/v4");var eo=He.z.object({selectors:He.z.array(He.z.object({name:He.z.string(),selectorProp:He.z.string().optional(),selectorArgPos:He.z.number().optional(),returnProp:He.z.string().optional()}))}),to=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),xr="no-unused-selected-values",pn={name:xr,rule:to({name:xr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[J(eo)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===le.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=ro(o);if(!i)return;let p=t.get(i);if(!p)return;let c=no(o,p.selectorArgPos??0,p.selectorProp);if(!c)return;let a=io(c);if(!a)return;let u=Cr(a.properties,void 0);if(!u)return;if(s.id.type===le.AST_NODE_TYPES.ObjectPattern){let C=Cr(s.id.properties,p.returnProp);if(!C)return;for(let[f,E]of u)C.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==le.AST_NODE_TYPES.Identifier||p.returnProp)return;let m=so(s,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 no(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===le.AST_NODE_TYPES.ArrowFunctionExpression||t.type===le.AST_NODE_TYPES.FunctionExpression)return t;if(r&&t.type===le.AST_NODE_TYPES.ObjectExpression){let s=t.properties.find(i=>i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==le.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===le.AST_NODE_TYPES.ArrowFunctionExpression||o.type===le.AST_NODE_TYPES.FunctionExpression)return o}return null}function ro(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 io(e){if(e.body.type===le.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===le.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===le.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==le.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}function Cr(e,n){let r=e;if(n){let s=e.find(o=>o.type===le.AST_NODE_TYPES.Property&&o.key.type===le.AST_NODE_TYPES.Identifier&&o.key.name===n);if(s?.type!==le.AST_NODE_TYPES.Property||s.value.type!==le.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let t=new Map;for(let s of r){if(s.type!==le.AST_NODE_TYPES.Property||s.key.type!==le.AST_NODE_TYPES.Identifier)return null;t.set(s.key.name,s)}return t.size>0?t:null}function so(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}var pe=require("@typescript-eslint/utils");var cn=q({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(o=>o.type===pe.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let t=null,s=!1;return{CallExpression(o){if(s)return;if(!t){let p=oo(o);p&&(t=p);return}let i=ao(o,e.sourceCode);if(i){s=!0;for(let p of i)t.delete(p);if(t.size!==0)for(let[p,c]of t)e.report({node:c,messageId:"unusedField",data:{name:p}})}}}}});function oo(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 t=Ut(r.properties,o=>o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===pe.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===pe.AST_NODE_TYPES.FunctionExpression?lo(o.value):null);if(!t)return null;let s=new Map;for(let o of t.properties)o.type===pe.AST_NODE_TYPES.Property&&o.key.type===pe.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function ao(e,n){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||!Ut(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 s=ir(e.parent,"formFields",n),o=new Set;for(let{identifier:i}of s){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;o.add(i.parent.property.name)}}return o}function lo(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}var se=require("@typescript-eslint/utils"),ct=require("zod/v4");var po=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ir(e){let n=[];for(let r of e.members)r.type===se.AST_NODE_TYPES.TSPropertySignature&&r.key.type===se.AST_NODE_TYPES.Identifier&&n.push([r.key.name,r]);return n}function Ar(e,...n){for(let r of n)e.set(...r);return e}var co=ct.z.object({forceCheckOnFCPropTypesWithName:ct.z.array(ct.z.string()).optional(),alwaysCheckFunctionOptionTypes:ct.z.boolean().optional()}),wr="no-unused-type-props-in-args",un=null,uo=po({name:wr,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:[J(co)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!un&&(un=r.map(c=>new RegExp(c)));function s(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&&un?.some(T=>T.test(f)),S=C&&t;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===se.AST_NODE_TYPES.ExportNamedDeclaration;if(!(y&&A&&!S)){if(I.type===se.AST_NODE_TYPES.TSTypeAliasDeclaration){o(c,a,m,I.typeAnnotation,!0,C);return}if(I.type===se.AST_NODE_TYPES.TSInterfaceDeclaration){o(c,a,m,I.body,!0,C);return}}}function o(c,a,u,m,y,C=!1){if(m.type===se.AST_NODE_TYPES.TSInterfaceBody){for(let f of m.body)f.type===se.AST_NODE_TYPES.TSPropertySignature&&f.key.type===se.AST_NODE_TYPES.Identifier&&u.set(f.key.name,f);return}if(m.type===se.AST_NODE_TYPES.TSTypeLiteral){Ar(u,...Ir(m));return}if(m.type===se.AST_NODE_TYPES.TSIntersectionType){for(let f of m.types)o(c,a,u,f,!0,C);return}y||m.type===se.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===se.AST_NODE_TYPES.Identifier&&s(c,a,m.typeName,u,!0,C)}function i(c,a,u,m=!1){for(let y of u)if(y.type===se.AST_NODE_TYPES.ObjectPattern&&y.typeAnnotation){let C=new Map;if(o(c,a,C,y.typeAnnotation.typeAnnotation,!1,m),C.size===0)continue;p(y,C)}else y.type===se.AST_NODE_TYPES.AssignmentPattern&&y.left.type===se.AST_NODE_TYPES.ObjectPattern&&i(c,a,[y.left],m)}function p(c,a){let u=[];if(c.properties.at(-1)?.type===se.AST_NODE_TYPES.RestElement)return;for(let f of c.properties)f.type===se.AST_NODE_TYPES.Property&&f.key.type===se.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===se.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===se.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation?.typeAnnotation.type===se.AST_NODE_TYPES.TSTypeReference&&a.id.typeAnnotation.typeAnnotation.typeName.type===se.AST_NODE_TYPES.Identifier&&a.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&a.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===se.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===se.AST_NODE_TYPES.Identifier)s(!0,c,m.typeName,u,!1);else if(m.type===se.AST_NODE_TYPES.TSTypeLiteral)Ar(u,...Ir(m));else if(m.type===se.AST_NODE_TYPES.TSIntersectionType)for(let y of m.types)y.type===se.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===se.AST_NODE_TYPES.Identifier?s(!0,c,y.typeName,u,!1):o(!0,c,u,y,!0);if(u.size!==0&&a.init?.type===se.AST_NODE_TYPES.ArrowFunctionExpression){let y=a.init.params[0];if(!y){e.report({node:a.init,messageId:"missingComponentParam"});return}y.type===se.AST_NODE_TYPES.ObjectPattern&&p(y,u)}}},FunctionDeclaration(c){i(!1,c,c.params,t)},ArrowFunctionExpression(c){i(!1,c,c.params,t)}}}}),fn={name:wr,rule:uo};var ke=require("@typescript-eslint/utils");var mn=q({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===ke.AST_NODE_TYPES.Identifier?n.has(t.callee.name):t.callee.type===ke.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===ke.AST_NODE_TYPES.Identifier&&t.callee.property.type===ke.AST_NODE_TYPES.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let s of t.specifiers)s.type===ke.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===ke.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&n.add(s.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ke.AST_NODE_TYPES.CallExpression&&r(t.init)&&t.id.type===ke.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(t).set.get(t.id.name);if(o){let i=!1;for(let p of o.references){let a=p.identifier.parent;if(a!==t&&!(a.type===ke.AST_NODE_TYPES.JSXExpressionContainer&&a.parent.type===ke.AST_NODE_TYPES.JSXAttribute&&a.parent.name.type===ke.AST_NODE_TYPES.JSXIdentifier&&a.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var nt=require("@typescript-eslint/utils"),fo=nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="prefer-named-functions",Rr=new Map,mo=fo({name:Fr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[n]){let r=null;if(n.ignoreRegex){let t=Rr.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),Rr.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===nt.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===nt.AST_NODE_TYPES.Identifier){let s=t.id.name;if(t.id.typeAnnotation||r&&r.test(s)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==nt.AST_NODE_TYPES.BlockStatement)return;let o=t.parent,i=t.init.params,p=t.init.body,c=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:a=>a.replaceText(o,`${c.async?"async ":""}function ${s}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),yn={name:Fr,rule:mo};var K=require("@typescript-eslint/utils"),je=require("zod/v4");var yo=je.z.object({disallowedFunctions:je.z.array(je.z.object({name:je.z.string(),allowUsingWithArgs:je.z.boolean().optional(),hookAlternative:je.z.string().optional(),message:je.z.string().optional(),allowUseInside:je.z.array(je.z.string()).optional()}))}),go=/^use[A-Z]/,So=/^[A-Z]/;function xt(e){return go.test(e)}function vr(e){return So.test(e)}function To(e){return e.type===K.AST_NODE_TYPES.Identifier?xt(e.name):e.type===K.AST_NODE_TYPES.MemberExpression&&e.property.type===K.AST_NODE_TYPES.Identifier?xt(e.property.name):!1}function kr(e,n){return e.type===K.AST_NODE_TYPES.Identifier?e.name===n: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===n:!1}function Pr(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&kr(e.parent.callee,"forwardRef"))}function Or(e){return!!(e.parent&&e.parent.type===K.AST_NODE_TYPES.CallExpression&&kr(e.parent.callee,"memo"))}function dn(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 ho(e){let n=e.parent,r=!1;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 t=dn(n);if(t&&t.type===K.AST_NODE_TYPES.Identifier){if(vr(t.name)||xt(t.name))return!r;r=!0}else{if(Pr(n)||Or(n))return!r;if(n.parent.type===K.AST_NODE_TYPES.CallExpression){let s=n.parent;To(s.callee)||(r=!0)}else n.parent.type===K.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Nr(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 Eo(e,n){if(!n.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 t=dn(r);if(t&&t.type===K.AST_NODE_TYPES.Identifier&&n.includes(t.name))return!0}else if(r.type===K.AST_NODE_TYPES.CallExpression){let t=Nr(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function bo(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===K.AST_NODE_TYPES.Identifier&&n.name==="undefined")}function xo(e,n){let r=!1,t=e.parent;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 s=dn(t);if(s&&s.type===K.AST_NODE_TYPES.Identifier){if(vr(s.name)||xt(s.name)){r=!0;break}}else if(Pr(t)||Or(t)){r=!0;break}}t=t.parent}return r?n.length===0?ho(e):!Eo(e,n):!1}var gn=q({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:[J(yo)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Nr(s);if(!o)return;let i=t.get(o);if(!i||i.allowUsingWithArgs&&bo(s))return;let p=i.allowUseInside||[];xo(s,p)&&e.report({node:s,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?s.callee.type===K.AST_NODE_TYPES.Identifier?c.replaceText(s.callee,a):s.callee.type===K.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===K.AST_NODE_TYPES.Identifier?c.replaceText(s.callee.property,a):null:null}}]:[]})}}}});var ce=require("@typescript-eslint/utils"),Ct=ve(require("zod/v4"));var Co=ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jr="prefer-single-line-if",Io=Ct.default.object({maxLineLength:Ct.default.number().optional(),maxNonSimpleConditionLength:Ct.default.number().optional()}),Ao=Co({name:jr,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:[J(Io)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==ce.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let o=t.consequent.body[0];if(!o)return;if(o.type===ce.AST_NODE_TYPES.ReturnStatement){if(!Mr(o))return}else if(!(o.type===ce.AST_NODE_TYPES.ContinueStatement||o.type===ce.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===ce.AST_NODE_TYPES.LogicalExpression||t.test.type===ce.AST_NODE_TYPES.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=Dr(t.test);if(!m&&t.test.type===ce.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let y=t.test.argument;Dr(y)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
+
`))return;let c=r.getTokenAfter(t);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=wo(r,t),u=`if (${i}) ${p}`;n.maxLineLength&&u.length+a.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,u)})}}}});function Dr(e){return e.type===ce.AST_NODE_TYPES.CallExpression||e.type===ce.AST_NODE_TYPES.BinaryExpression||e.type===ce.AST_NODE_TYPES.MemberExpression&&Lr(e)}function Lr(e){return e.object.type===ce.AST_NODE_TYPES.MemberExpression?Lr(e.object):e.object.type!==ce.AST_NODE_TYPES.Identifier}function wo(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}function Mr(e){if(!e.argument)return!0;let n=e.argument;return n.type===ce.AST_NODE_TYPES.ArrayExpression&&n.elements.length===0||n.type===ce.AST_NODE_TYPES.ObjectExpression&&n.properties.length===0||n.type===ce.AST_NODE_TYPES.Literal||n.type===ce.AST_NODE_TYPES.Identifier||n.type===ce.AST_NODE_TYPES.TemplateLiteral||n.type===ce.AST_NODE_TYPES.TaggedTemplateExpression?!0:n.type===ce.AST_NODE_TYPES.CallExpression?n.arguments.length===0:n.type===ce.AST_NODE_TYPES.UnaryExpression?Mr(n):!1}var Sn={name:jr,rule:Ao};var U=require("@typescript-eslint/utils"),hn=require("zod/v4");var Ro=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zr="react-compiler-extra",Fo=hn.z.object({runOnlyWithEnableCompilerDirective:hn.z.boolean().optional()}),vo=/eslint +react-compiler\/react-compiler: +\["error/;function Wr(e){return e.type===U.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function ko(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 Le(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 Le(e.consequent)||Le(e.alternate);case U.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Le(e.right):e.operator==="||"?Le(e.left)||Le(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 n of e.arguments)if(n.type!==U.AST_NODE_TYPES.SpreadElement&&Le(n))return!0;return!1;default:return!1}}function Po(e){let n=e.typeAnnotation;if(n.type===U.AST_NODE_TYPES.TSTypeReference){if(n.typeName.type===U.AST_NODE_TYPES.Identifier)return n.typeName.name==="FC";if(n.typeName.type===U.AST_NODE_TYPES.TSQualifiedName&&n.typeName.left.type===U.AST_NODE_TYPES.Identifier&&n.typeName.right.type===U.AST_NODE_TYPES.Identifier)return n.typeName.left.name==="React"&&n.typeName.right.name==="FC"}return!1}var Oo=/^[A-Z][a-zA-Z0-9]*$/;function ft(e){return Oo.test(e)}function En(e){return e.startsWith("use")&&e.length>3}function bn(e,n,r,t){if(r&&Po(r))return n?ft(n.name):e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?ft(e.id.name):!0;if(n&&En(n.name)||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id&&En(e.id.name))return!0;if(t){let s=n?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(s&&ft(s)&&Vr(e.body,t).containsJSX)return!0}return!1}function ut(e){if(e.body.type===U.AST_NODE_TYPES.BlockStatement){for(let n of e.body.body)if(n.type===U.AST_NODE_TYPES.ExpressionStatement&&n.expression.type===U.AST_NODE_TYPES.Literal&&typeof n.expression.value=="string"&&n.expression.value==="use memo")return!0}return!1}function Vr(e,n){let r={containsJSX:!1,containsHookCalls:!1};return Oe(e,t=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(t.type){case U.AST_NODE_TYPES.JSXElement:case U.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case U.AST_NODE_TYPES.CallExpression:Wr(t.callee)&&(r.containsHookCalls=!0),Le(t)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.ReturnStatement:t.argument&&Le(t.argument)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.VariableDeclarator:t.init&&Le(t.init)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.AssignmentExpression:Le(t.right)&&(r.containsJSX=!0);break}},n),r}function $r(e,n){let r=e.body,t=Vr(r,n);return t.containsJSX||t.containsHookCalls}var No=/\bthis[.[]/;function _r(e){return No.test(e)}function Do(e,n){let r={containsJSX:!1,containsHookCalls:!1};return Oe(e,t=>{if(r.containsHookCalls||(t.type===U.AST_NODE_TYPES.FunctionDeclaration||t.type===U.AST_NODE_TYPES.FunctionExpression||t.type===U.AST_NODE_TYPES.ArrowFunctionExpression)&&t!==e)return!0;t.type===U.AST_NODE_TYPES.CallExpression&&ko(t.callee)&&(r.containsHookCalls=!0)},n),r}function Ur(e){return ft(e)||En(e)}function Tn(e,n,r,t){if(!Do(e.body,n).containsHookCalls)return!1;let o=bn(e,r,t,n);if(!o&&t){let i=r?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&ft(i)&&(o=!0)}return!o}var jo=Ro({name:zr,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:[J(Fo)]},defaultOptions:[{}],create(e,[n]){let r=!1;if(n.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(vo.test(o.value)){r=!0;break}if(!r)return{}}function t(o){for(let i of o.properties)if(i.type===U.AST_NODE_TYPES.Property&&i.method&&i.value.type===U.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode,c=p.getText(i.key),a=i.value,u=p.getText(a.body);if(_r(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=a.params.map(C=>p.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 s(o){for(let i of o.properties)if(i.type===U.AST_NODE_TYPES.Property&&i.value.type===U.AST_NODE_TYPES.ObjectExpression){for(let p of i.value.properties)if(p.type===U.AST_NODE_TYPES.Property&&p.method&&p.value.type===U.AST_NODE_TYPES.FunctionExpression){let a=e.sourceCode.getText(p.value.body);_r(a)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(Wr(o.callee))for(let i of o.arguments){if(i.type===U.AST_NODE_TYPES.ObjectExpression&&(t(i),s(i)),i.type===U.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===U.AST_NODE_TYPES.ObjectExpression&&(t(i.body),s(i.body)),i.body.type===U.AST_NODE_TYPES.BlockStatement))for(let p of i.body.body)p.type===U.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(t(p.argument),s(p.argument));if(i.type===U.AST_NODE_TYPES.FunctionExpression)for(let p of i.body.body)p.type===U.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(t(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===U.AST_NODE_TYPES.Identifier&&o.init&&(o.init.type===U.AST_NODE_TYPES.ArrowFunctionExpression||o.init.type===U.AST_NODE_TYPES.FunctionExpression)){let i=o.init,p=o.id,c=o.id.typeAnnotation;if(ut(i)&&!Ur(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Tn(i,e.sourceCode,p,c)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(bn(i,p,c,e.sourceCode)){let a=$r(i,e.sourceCode),u=ut(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(o){if(o.id&&ut(o)&&!
|
|
20
|
+
`)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&ut(o)&&!Ur(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(Tn(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(bn(o,void 0,void 0,e.sourceCode)){let i=$r(o,e.sourceCode),p=ut(o);!i&&!p&&e.report({node:o,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(c){let a=o.body.range[0]+1;return c.insertTextAfterRange([a,a],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(o){if(ut(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}
|
|
22
|
+
`)}}]})}},FunctionExpression(o){if(ut(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}Tn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),xn={name:zr,rule:jo};var be=require("@typescript-eslint/utils"),Ne=require("zod/v4");var Lo=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Jr="react-compiler-migration",Mo=Ne.z.object({disallowHooks:Ne.z.array(Ne.z.object({name:Ne.z.string(),replacement:Ne.z.string()})).optional(),disallowMethods:Ne.z.array(Ne.z.object({name:Ne.z.string(),replacement:Ne.z.string().optional(),requireTrueProp:Ne.z.string().optional()})).optional()}),$o=/eslint +react-compiler\/react-compiler: +\["error/;function _o(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 Uo=Lo({name:Jr,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:[J(Mo)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[n]){let r=!1;for(let t of e.sourceCode.getAllComments())if($o.test(t.value)){r=!0;break}return r?{CallExpression(t){if(n.disallowHooks?.length){let s=null,o=null;if(t.callee.type===be.AST_NODE_TYPES.Identifier?(s=t.callee.name,o=t.callee):t.callee.type===be.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===be.AST_NODE_TYPES.Identifier&&(s=t.callee.property.name,o=t.callee.property),s){let i=n.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(n.disallowMethods?.length&&_o(t.callee)){for(let s of t.arguments)if(s.type===be.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===be.AST_NODE_TYPES.Property&&o.key.type===be.AST_NODE_TYPES.Identifier){let i=o.key.name,p=n.disallowMethods.find(c=>c.name===i);if(p){if(p.requireTrueProp){let c=p.requireTrueProp,a=!1;for(let u of s.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:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:c}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:c=>p.replacement?c.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),Cn={name:Jr,rule:Uo};var $=require("@typescript-eslint/utils"),An=require("zod");var zo=An.z.object({runOnlyWithEnableCompilerDirective:An.z.boolean().optional()}),Wo=/eslint +react-compiler\/react-compiler: +\["error/,Vo=/^\d+$/,Jo=/[\s_-]+/,Xo=/[a-z][A-Z]/,Bo=/^(.+?)([A-Z][a-z]+s?)$/,Ho=/^[a-z][a-zA-Z]*$/;function Xr(e,n){let r=[];if(e.type===$.AST_NODE_TYPES.JSXElement){for(let t of e.openingElement.attributes)if(t.type===$.AST_NODE_TYPES.JSXAttribute&&t.name.type===$.AST_NODE_TYPES.JSXIdentifier&&t.value?.type===$.AST_NODE_TYPES.JSXExpressionContainer&&t.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression){let s=t.name.name,o=t.value.expression,i=!1;Oe(o,p=>{switch(p.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},n),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Yo(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 n of e.body.body)if(n.type===$.AST_NODE_TYPES.ReturnStatement&&n.argument&&(n.argument.type===$.AST_NODE_TYPES.JSXElement||n.argument.type===$.AST_NODE_TYPES.JSXFragment))return!0}return!1}function qo(e,n){let r=e.callee;if(r.type===$.AST_NODE_TYPES.MemberExpression){let t=r.object;if(t.type===$.AST_NODE_TYPES.Identifier){let s=t.name,o=Zo(s);if(o!==s)return wn(o)}}if(n.length>0){let t=n[0];if(t&&t.type===$.AST_NODE_TYPES.Identifier)return wn(t.name)}return"ListItem"}function Zo(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(Xo)){let t=e.match(Bo);if(t){let s=t[1],o=t[2];if(!s||!o)return In(e);let i=In(o);if(i!==o)return s+i}}return In(e)}function In(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 wn(e){return e.match(Ho)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Jo).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join("")}function Br(e,n,r){let t=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Oe(e,i=>{if(i.type===$.AST_NODE_TYPES.Identifier&&!n.includes(i.name)&&!o.has(i.name)&&!Vo.test(i.name)){let p=i.parent;if(p.type===$.AST_NODE_TYPES.Property&&p.key===i||p.type===$.AST_NODE_TYPES.MemberExpression&&p.property===i&&!p.computed||p.type===$.AST_NODE_TYPES.JSXOpeningElement||p.type===$.AST_NODE_TYPES.JSXClosingElement||p.type===$.AST_NODE_TYPES.JSXAttribute&&p.name.type===$.AST_NODE_TYPES.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)n.includes(i)||t.push({name:i,type:"unknown"});return t}function Hr(e,n,r,t,s){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"})),...t],p=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=s.getText(n),u=`${e}Props`;return`type ${u} = {
|
|
24
24
|
${p}
|
|
25
25
|
};
|
|
@@ -28,28 +28,28 @@ const ${e}: FC<${u}> = ({ ${c} }) => {
|
|
|
28
28
|
return (
|
|
29
29
|
${a}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Go(e,n,r,t){let s=n.map(i=>i.type===$.AST_NODE_TYPES.Identifier?i.name:"item"),o=[t?`key={${t}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Ko(e){if(e.type===$.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===$.AST_NODE_TYPES.JSXIdentifier){let n=e.openingElement.name.name;if(n!=="div"&&n!=="span")return wn(n)}return"ListItem"}function Qo(e,n,r){let t=[r?`key={${r}}`:"",...n.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${t.length>0?` ${t.join(" ")}`:""} />`}function Yr(e,n){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 n.getText(r.value.expression);return null}var Rn=q({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:[J(zo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[n]){let{sourceCode:r}=e;if(n.runOnlyWithEnableCompilerDirective){let t=!1;for(let s of r.getAllComments())if(Wo.test(s.value)){t=!0;break}if(!t)return{}}return{CallExpression(t){t.callee.type===$.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===$.AST_NODE_TYPES.Identifier&&(t.callee.property.name==="map"||t.callee.property.name==="push")&&(t.callee.property.name==="map"?ea(t,r,e):ta(t,r,e))}}}});function ea(e,n,r){let t=e.arguments[0];if(!t||t.type!==$.AST_NODE_TYPES.ArrowFunctionExpression&&t.type!==$.AST_NODE_TYPES.FunctionExpression||!Yo(t))return;let s=null;if(t.body.type===$.AST_NODE_TYPES.JSXElement||t.body.type===$.AST_NODE_TYPES.JSXFragment?s=t.body:t.body.type===$.AST_NODE_TYPES.BlockStatement&&t.body.body[0]?.type===$.AST_NODE_TYPES.ReturnStatement&&t.body.body[0].argument&&(t.body.body[0].argument.type===$.AST_NODE_TYPES.JSXElement||t.body.body[0].argument.type===$.AST_NODE_TYPES.JSXFragment)&&(s=t.body.body[0].argument),!s)return;let o=Xr(s,n);if(!o.hasUnstable)return;let i=qo(e,t.params),p=t.params.map(m=>m.type===$.AST_NODE_TYPES.Identifier?m.name:"item"),c=Br(s,p,n),a=s.type===$.AST_NODE_TYPES.JSXElement?Yr(s,n):null,u=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:m=>{let y=Hr(i,s,t.params,c,n),C=Go(i,t.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(s,C)),E}}]})}function
|
|
33
|
+
${y}`)),E.push(m.replaceText(s,C)),E}}]})}function ta(e,n,r){let t=e.arguments[0];if(!t||t.type!==$.AST_NODE_TYPES.JSXElement&&t.type!==$.AST_NODE_TYPES.JSXFragment)return;let s=t,o=Xr(s,n);if(!o.hasUnstable)return;let i=Ko(s),p=Br(s,[],n),c=s.type===$.AST_NODE_TYPES.JSXElement?Yr(s,n):null,a=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:a},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let m=Hr(i,s,[],p,n),y=Qo(i,p,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(s,y)),f}}]})}var It=require("@typescript-eslint/utils"),Ko=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Br="require-description",Qo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ea=/^eslint-disable-(next-)?line$/u,ta=Ko({name:Br,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=na(s);o!=null&&(t.has(o.kind)||o.description||e.report({loc:sa(s.loc),messageId:"missingDescription"}))}}}}}),Hr={name:Br,rule:ta};function na(e){let{text:n,description:r}=ia(e.value);if(!n)return null;let t=Qo.exec(n);if(!t)return null;let s=t[1];if(!s)return null;let o=ea.test(s);if(e.type===It.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+s.length);return{kind:s,value:i.trim(),description:r}}var ra=/\s-{2,}\s/u;function ia(e){let n=e.split(ra);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function sa(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),Me=require("zod/v4");var oa=Me.z.object({varsToCheck:Me.z.array(Me.z.object({selector:Me.z.string().optional(),fromFnCall:Me.z.string().optional(),prop:Me.z.string().or(Me.z.array(Me.z.string())),errorMsg:Me.z.string().optional()}))}),Rn=q({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:[B(oa)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,p,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=p.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 s(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 o={};for(let i of n.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];t(p.id,c,i.errorMsg,s(p))}});for(let i of n.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[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];t(y.id,C,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[c,a]=p.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;o[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];t(C.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[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];t(m.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let C=new Set(p);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&&!p.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 Zr(e){return/^use[A-Z0-9]/.test(e)}function At(e){return e.type==="Identifier"?Zr(e.name):e.type==="MemberExpression"&&!e.computed&&At(e.property)?e.object.type==="Identifier":!1}function Gr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Kr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function Qr(e){return!!(e.parent&&e.parent.callee&&Kr(e.parent.callee,"forwardRef"))}function ei(e){return!!(e.parent&&e.parent.callee&&Kr(e.parent.callee,"memo"))}function Fn(e){for(;e;){let n=ni(e);if(n&&(Gr(n)||At(n))||Qr(e)||ei(e))return!0;e=e.parent}return!1}function Yr(e){return!1}function kn(e){return!1}var aa=/eslint +react-compiler\/react-compiler: +\["error/,ti={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 n=!!e.options[0]?.reactCompilerIsEnabled;if(e.options[0]?.ignoreIfReactCompilerIsEnabled||n){for(let a of e.sourceCode.getAllComments())if(n||aa.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),t=typeof e.getScope=="function"?()=>t():a=>e.sourceCode.getScope(a),s=null,o=[],i=[],p=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&&Yr(m.init.callee))for(let y of u.resolved.references)y!==u&&p.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,u){let m=o.pop();if(m.size===0)return;let y=new Set;function C(h,b){let{cache:w}=C,P=w.get(h.id),N=new Set(b);if(N.has(h.id)){let l=[...N],R=l.slice(l.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),P!==void 0)return P;if(a.thrownSegments.includes(h))P=BigInt("0");else if(h.prevSegments.length===0)P=BigInt("1");else{P=BigInt("0");for(let l of h.prevSegments)P+=C(l,N)}return h.reachable&&P===BigInt("0")?w.delete(h.id):w.set(h.id,P),P}function f(h,b){let{cache:w}=f,P=w.get(h.id),N=new Set(b);if(N.has(h.id)){let l=Array.from(N),R=l.slice(l.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),P!==void 0)return P;if(a.thrownSegments.includes(h))P=BigInt("0");else if(h.nextSegments.length===0)P=BigInt("1");else{P=BigInt("0");for(let l of h.nextSegments)P+=f(l,N)}return w.set(h.id,P),P}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 P of h.prevSegments){let N=E(P);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=ni(u),I=Fn(u),A=S?Gr(S)||At(S):Qr(u)||ei(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),P=C(h)*f(h),N=y.has(h.id);for(let l of b)if(N&&!kn(l)&&e.report({node:l,message:`React Hook "${r(l)}" 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:l,message:`React Hook "${r(l)}" cannot be called in an async function.`}),!N&&P!==x&&!kn(l)){let d=`React Hook "${r(l)}" 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:l,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(S){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(u.type==="Program"){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(I&&!kn(l)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Zr(d.parent.id.name))return}let R=`React Hook "${r(l)}" 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:l,message:R})}}},CallExpression(a){if(At(a.callee)){let u=qr(o),m=qr(i),y=u.get(m);y||(y=[],u.set(m,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Yr(a.callee))&&a.arguments.length>0&&(s=a)},Identifier(a){s==null&&p.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===s&&(s=null)},FunctionDeclaration(a){Fn(a)&&c(t(a))},ArrowFunctionExpression(a){Fn(a)&&c(t(a))}}}};function ni(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 qr(e){return e[e.length-1]}var ge=require("@typescript-eslint/utils"),xe=ve(require("zod/v4"));var la=/^\s+$/,Pn=/\r?\n/,pa=/^(\s*)/,ca=/^(\s*)\S/,ua=/\r?\n/,fa=xe.object({indent:xe.union([xe.string().regex(la),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),vn=q({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[B(fa)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(S=>S.toLowerCase());function p(S){let I=S.split(Pn),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(pa);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
|
|
35
|
+
${m}`)),f.push(u.replaceText(s,y)),f}}]})}var It=require("@typescript-eslint/utils"),na=It.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qr="require-description",ra=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,ia=/^eslint-disable-(next-)?line$/u,sa=na({name:qr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=oa(s);o!=null&&(t.has(o.kind)||o.description||e.report({loc:pa(s.loc),messageId:"missingDescription"}))}}}}}),Zr={name:qr,rule:sa};function oa(e){let{text:n,description:r}=la(e.value);if(!n)return null;let t=ra.exec(n);if(!t)return null;let s=t[1];if(!s)return null;let o=ia.test(s);if(e.type===It.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+s.length);return{kind:s,value:i.trim(),description:r}}var aa=/\s-{2,}\s/u;function la(e){let n=e.split(aa);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function pa(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),Me=require("zod/v4");var ca=Me.z.object({varsToCheck:Me.z.array(Me.z.object({selector:Me.z.string().optional(),fromFnCall:Me.z.string().optional(),prop:Me.z.string().or(Me.z.array(Me.z.string())),errorMsg:Me.z.string().optional()}))}),Fn=q({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:[J(ca)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,p,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=p.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 s(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 o={};for(let i of n.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];t(p.id,c,i.errorMsg,s(p))}});for(let i of n.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[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];t(y.id,C,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[c,a]=p.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;o[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];t(C.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[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];t(m.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let C=new Set(p);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&&!p.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 Qr(e){return/^use[A-Z0-9]/.test(e)}function At(e){return e.type==="Identifier"?Qr(e.name):e.type==="MemberExpression"&&!e.computed&&At(e.property)?e.object.type==="Identifier":!1}function ei(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function ti(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function ni(e){return!!(e.parent&&e.parent.callee&&ti(e.parent.callee,"forwardRef"))}function ri(e){return!!(e.parent&&e.parent.callee&&ti(e.parent.callee,"memo"))}function vn(e){for(;e;){let n=si(e);if(n&&(ei(n)||At(n))||ni(e)||ri(e))return!0;e=e.parent}return!1}function Gr(e){return!1}function kn(e){return!1}var ua=/eslint +react-compiler\/react-compiler: +\["error/,ii={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let n=!!e.options[0]?.reactCompilerIsEnabled;if(n)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||n){for(let a of e.sourceCode.getAllComments())if(ua.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),t=typeof e.getScope=="function"?()=>t():a=>e.sourceCode.getScope(a),s=null,o=[],i=[],p=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&&Gr(m.init.callee))for(let y of u.resolved.references)y!==u&&p.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,u){let m=o.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 l=[...N],R=l.slice(l.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 l of h.prevSegments)k+=C(l,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 l=Array.from(N),R=l.slice(l.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 l of h.nextSegments)k+=f(l,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=si(u),I=vn(u),A=S?ei(S)||At(S):ni(u)||ri(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 l of b)if(N&&!kn(l)&&e.report({node:l,message:`React Hook "${r(l)}" 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:l,message:`React Hook "${r(l)}" cannot be called in an async function.`}),!N&&k!==x&&!kn(l)){let d=`React Hook "${r(l)}" 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:l,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(S){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(u.type==="Program"){let R=`React Hook "${r(l)}" 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:l,message:R})}else if(I&&!kn(l)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Qr(d.parent.id.name))return}let R=`React Hook "${r(l)}" 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:l,message:R})}}},CallExpression(a){if(At(a.callee)){let u=Kr(o),m=Kr(i),y=u.get(m);y||(y=[],u.set(m,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Gr(a.callee))&&a.arguments.length>0&&(s=a)},Identifier(a){s==null&&p.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===s&&(s=null)},FunctionDeclaration(a){vn(a)&&c(t(a))},ArrowFunctionExpression(a){vn(a)&&c(t(a))}}}};function si(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 Kr(e){return e[e.length-1]}var ge=require("@typescript-eslint/utils"),xe=ve(require("zod/v4"));var fa=/^\s+$/,Pn=/\r?\n/,ma=/^(\s*)/,ya=/^(\s*)\S/,da=/\r?\n/,ga=xe.object({indent:xe.union([xe.string().regex(fa),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),On=q({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[J(ga)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(S=>S.toLowerCase());function p(S){let I=S.split(Pn),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(ma);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
|
|
36
36
|
`)}function c(S,I,A){return S.split(Pn).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=n.getTokenBefore(S,{includeComments:!0});if(I?.type===ge.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(f(S)||s.length>0&&m(S,s)||t.length>0&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,t))}function x(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>n.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(
|
|
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=n.getTokenBefore(S,{includeComments:!0});if(I?.type===ge.AST_TOKEN_TYPES.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(f(S)||s.length>0&&m(S,s)||t.length>0&&S.parent.type===ge.AST_NODE_TYPES.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,t))}function x(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>n.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(da);if(!T)return;let h=T[0],b=n.lines[n.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(ya)?.[1]??"",N;typeof o=="string"?N=o:typeof o=="number"?N=" ".repeat(o):N=k.startsWith(" ")?" ":" ";let R=p(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(Pn),
|
|
40
|
+
`,F=A.split(Pn),P=F.map((j,V)=>V!==F.length-1&&j===N+k?"":j).join(g);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:j=>d.split(I).map((V,G)=>{let H=S.quasis[G];return H?j.replaceTextRange([H.range[0]+1,H.range[1]-(H.tail?1:2)],V):[]}).flat()}}return{TemplateLiteral(S){if(!E(S))return;let I=x(S);if(I)return e.report(I)}}}});var Nn=require("@typescript-eslint/utils");function Sa(e){if(!("regex"in e))return!1;let n=e.regex.flags;return n.includes("g")||n.includes("y")}function Ta(e){let n=e.parent;return n?.type===Nn.AST_NODE_TYPES.NewExpression&&n.callee.type===Nn.AST_NODE_TYPES.Identifier&&n.callee.name==="RegExp"}var Dn=q({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 n(r){Sa(r)||Ta(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":n}}});var Te=require("@typescript-eslint/utils"),rt=require("zod/v4");var ha=rt.z.object({checkOnly:rt.z.array(rt.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:rt.z.array(rt.z.string()).optional()}),jn=q({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:[J(ha)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=new Map,s=[];function o(f){for(let E of s)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 p(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=t.get(I);if(!b||b.statement===A)continue;let w=s.indexOf(b.statement),k=s.indexOf(A);if(w===-1||k===-1)continue;let N=!!(n.checkOnly&&n.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=s.indexOf(I.typeDef.statement),b=s.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=s.indexOf(I.typeDef.statement),b=s.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),l=k;N.length>0&&(l=`${N.map(d=>r.getText(d)).join(`
|
|
41
41
|
`)}
|
|
42
|
-
${
|
|
42
|
+
${k}`),h.push(l)}yield E.insertTextBeforeRange([T,T],`${h.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(f){s.push(...f.body)},TSTypeAliasDeclaration(f){if(s.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSInterfaceDeclaration(f){if(s.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.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=p(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(!n.checkOnly||n.checkOnly.length===0)return!0;for(let I of n.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(!t.has(I)||!E(S))continue;let T=o(A),h=t.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&&o(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,h=w.inFunctionArgs);if(!!(n.checkOnly&&n.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S)continue;let l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let P=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S||a(N.node))continue;let l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let P=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}x.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h})}x.length>0&&y(x)}}}});var ie=require("@typescript-eslint/utils"),it=ve(require("zod/v4"));var ga=["tsx"],Sa=/^[A-Z][A-Za-z0-9]*$/,Ta=it.object({extensions:it.array(it.string()).optional()}),jn=q({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:[B(Ta)]},defaultOptions:[{}],create(e,[n]){let r=e.getFilename(),t=n.extensions??ga,s=!1;for(let T of t)if(r.endsWith(T)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function c(T){return Sa.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&&p.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 o.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=p.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 o.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 P=w.id.name,N=f(P);x(w,h,N)}continue}if(b.type===ie.AST_NODE_TYPES.FunctionDeclaration){let w=b.id?.name,P=w?f(w)||c(w):!1;x(b,h,P);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,P=f(w);x(b,h,P)}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 We=require("@typescript-eslint/utils"),wt=require("zod/v4");function Rt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ha(e){return e.callee.type===We.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===We.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===We.AST_NODE_TYPES.Identifier&&e.callee.property.type===We.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ea=wt.z.object({ignorePrefixes:wt.z.array(wt.z.string()).optional()});function ri(e,n){for(let r of n)if(e.startsWith(r))return e.slice(r.length);return e}function ba(e){return`set${Rt(e)}`}var Ln=q({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:[B(Ea)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[n]){return{VariableDeclarator(r){if(!r.init||r.init.type!==We.AST_NODE_TYPES.CallExpression||!ha(r.init)||r.id.type!==We.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[t,s]=r.id.elements;if(!t||!s||t.type!==We.AST_NODE_TYPES.Identifier||s.type!==We.AST_NODE_TYPES.Identifier)return;let o=t.name,i=s.name,p=n.ignorePrefixes||[],c=ri(o,p),a=ri(i,p);if(c===""){if(!a.startsWith("set")){let m=`set${Rt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Rt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(s,m)}]})}return}let u=ba(c);a!==u&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Rt(c),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:m=>m.replaceText(s,u)}]})}}}});var de=require("@typescript-eslint/utils"),Ge=require("zod/v4");var xa=Ge.z.object({name:Ge.z.string(),defaults:Ge.z.array(Ge.z.unknown())}),Ca=Ge.z.object({functions:Ge.z.array(xa)});function Ft(e,n){if(e===n)return!0;if(e===null||n===null||e===void 0||n===void 0)return e===n;if(typeof e!=typeof n||typeof e!="object"||Array.isArray(e)!==Array.isArray(n))return!1;if(Array.isArray(e)&&Array.isArray(n))return e.length!==n.length?!1:e.every((s,o)=>Ft(s,n[o]));let r=Object.keys(e),t=Object.keys(n);if(r.length!==t.length)return!1;for(let s of r){if(!t.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(n,s);if(!o||!i)return!1;let p=o.value,c=i.value;if(!Ft(p,c))return!1}return!0}function Ia(e,n){let r=new Set;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return r;for(let t in e){if(!(t in n))continue;let s=Object.getOwnPropertyDescriptor(e,t),o=Object.getOwnPropertyDescriptor(n,t);s&&o&&Ft(s.value,o.value)&&r.add(t)}return r}function ii(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 n={};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?n[r.key.name]=r.value.value:r.value.type===de.AST_NODE_TYPES.ObjectExpression?n[r.key.name]=ii(r.value):n[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return n}case de.AST_NODE_TYPES.ArrayExpression:return e.elements.map(n=>{if(!(!n||n.type===de.AST_NODE_TYPES.SpreadElement))return n.type===de.AST_NODE_TYPES.Literal?n.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Aa(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 Mn=q({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:[B(Ca)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map;for(let t of n.functions)r.set(t.name,t.defaults);return{CallExpression(t){let s=Aa(t.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=t.arguments;if(i.length===0)return;let p=-1,c=!1,a=new Map,u=new Set,m=new Map,y=[];for(let f=0;f<i.length;f++){if(f>=o.length){p=f;continue}let E=o[f],x=i[f];if(!x||x.type===de.AST_NODE_TYPES.SpreadElement){p=f;continue}let S=ii(x);if(E===void 0){p=f;continue}if(Ft(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=Ia(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)}),p=f}else p=f}if(p<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=o?o[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:t,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 P of h.properties)P.type===de.AST_NODE_TYPES.Property&&P.key.type===de.AST_NODE_TYPES.Identifier&&!P.computed&&T.has(P.key.name)||b.push(P);let w=b.map(P=>e.sourceCode.getText(P));S.push(x.replaceText(h,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=p){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(t.callee),T=e.sourceCode.getLastToken(t);A&&T&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(t);T&&A&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});var we=require("@typescript-eslint/utils");function wa(e){let n=e.parent;for(;n;){if(n.type===we.AST_NODE_TYPES.AwaitExpression||n.type===we.AST_NODE_TYPES.MemberExpression&&n.object===e&&n.property.type===we.AST_NODE_TYPES.Identifier&&n.property.name==="then"||n.type===we.AST_NODE_TYPES.ArrowFunctionExpression&&n.body===e)return!0;if(n.type===we.AST_NODE_TYPES.ArrayExpression&&n.parent.type===we.AST_NODE_TYPES.CallExpression){let r=n.parent;if(r.callee.type===we.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===we.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===we.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(n.parent)n=n.parent;else break}return!1}function Ra(e){let{callee:n}=e;return n.type===we.AST_NODE_TYPES.Identifier&&n.name==="require"||n.type===we.AST_NODE_TYPES.MemberExpression&&n.object.type===we.AST_NODE_TYPES.Identifier&&n.object.name==="require"}var $n=q({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(n){wa(n)||e.report({node:n,messageId:"syncDynamicImport"})},TSImportType(n){e.report({node:n,messageId:"syncDynamicImport"})},CallExpression(n){Ra(n)&&e.report({node:n,messageId:"requireNotAllowed"})}}}});var L=require("@typescript-eslint/utils"),kt=require("zod/v4");var Fa=kt.z.object({mainComponentRegex:kt.z.string().optional(),mainComponentSelector:kt.z.string().optional()}),ka=/^[A-Z][A-Za-z0-9]*$/,_n=q({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:[B(Fa)],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,[n]){let r=e.sourceCode,t=n.mainComponentRegex?new RegExp(n.mainComponentRegex):void 0,s=n.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,p=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 v of F.declarations)if(v.id.type===L.AST_NODE_TYPES.Identifier&&v.id.name===d.name&&v.init)return v.init}}return null}function y(d){let g=new Set;return Oe(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 ka.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,v=d.init;if(v){if(S(v)||I(v)){a.push({node:g,name:F});return}if((C(F)||v.type===L.AST_NODE_TYPES.ArrowFunctionExpression)&&(v.type===L.AST_NODE_TYPES.ArrowFunctionExpression||v.type===L.AST_NODE_TYPES.FunctionExpression||f(v))){if(v.type===L.AST_NODE_TYPES.ArrowFunctionExpression||v.type===L.AST_NODE_TYPES.FunctionExpression){if(E(v.body)){i.add(F);return}}else if(f(v)){i.add(F);return}}v.type===L.AST_NODE_TYPES.Identifier&&p.set(F,v.name),C(F)||x(v)&&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 s?u.has(d):t?t.test(g):T(d)}function w(d){let g=new Set;Oe(d.node,F=>{if(F.type===L.AST_NODE_TYPES.Identifier)for(let v of a)v.name===F.name&&(g.add(v.name),(v.firstUsagePosition===void 0||F.range[0]<v.firstUsagePosition)&&(v.firstUsagePosition=F.range[0]));if(F.type===L.AST_NODE_TYPES.JSXElement){let v=F.openingElement;if(v.name.type===L.AST_NODE_TYPES.JSXIdentifier)for(let j of a)j.name===v.name.name&&(g.add(j.name),(j.firstUsagePosition===void 0||v.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=v.name.range[0]))}return!1},r),d.usedStyles=g}function P(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=p.get(d);return F?N(F,g):!1}let l={};return s&&(l[s]=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)}),l["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)P(D);for(let D of d.body){let Z=h(D);if(Z&&N(Z)){let Y=b(D,Z);c.push({node:D,name:Z,isMainComponent:Y,usedStyles:new Set,isExported:T(D)})}}if(!s&&t&&!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 v=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let Y of a)Y.node===Z&&v.set(Y.name,D)}let j=new Map;for(let D of a){let Z=m(D),Y=new Set;if(Z){let ue=y(Z);for(let fe of ue)F.has(fe)&&fe!==D.name&&Y.add(fe)}j.set(D.name,Y)}let J=new Map;for(let D of a){let Z=j.get(D.name);if(!Z)continue;let Y=v.get(D.name);if(Y!==void 0)for(let ue of Z){let fe=J.get(ue);(fe===void 0||Y<fe)&&J.set(ue,Y)}}let G=[];for(let D of a){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),Y=-1;for(let Ee of c){if(!Ee.usedStyles.has(D.name))continue;let Ce=d.body.indexOf(Ee.node);(Y===-1||Ce<Y)&&(Y=Ce)}let ue=J.get(D.name);if(ue!==void 0&&(Y===-1||ue<Y)&&(Y=ue),Y===-1)continue;let fe=-1;for(let Ee of c){let Ce=d.body.indexOf(Ee.node);Ce<Y&&Ce>fe&&(fe=Ce)}let Re=Z<Y,Je=Z>fe,Se=-1,st=j.get(D.name);if(st)for(let Ee of st){let Ce=v.get(Ee);Ce!==void 0&&Ce>Se&&(Se=Ce)}let Ke=Z>Se;if(!(Re&&Je&&Ke)){let Ee=fe+1;if(Se+1>Ee&&(Ee=Se+1),Ee<g&&(Ee=g),Ee>Y)continue;G.push({style:D,targetPosition:Ee})}}let H=null;if(c.length>1){let D=c.map(Y=>({c:Y,idx:d.body.indexOf(Y.node)})).sort((Y,ue)=>Y.idx-ue.idx)[0]?.c,Z=c.find(Y=>Y.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)})}},l;function R(d,g,F){return function*(v){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 v.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],Y=[];for(let{style:ue}of G){let fe=r.getCommentsBefore(ue.node),Re=r.getText(ue.node);fe.length>0&&(Re=`${fe.map(Se=>r.getText(Se)).join(`
|
|
46
|
+
`)}}}return{Program(f){s.push(...f.body)},TSTypeAliasDeclaration(f){if(s.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSInterfaceDeclaration(f){if(s.some(x=>x.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.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=p(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(!n.checkOnly||n.checkOnly.length===0)return!0;for(let I of n.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(!t.has(I)||!E(S))continue;let T=o(A),h=t.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&&o(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,h=w.inFunctionArgs);if(!!(n.checkOnly&&n.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S)continue;let l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let k=s.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 l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let k=s.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"),it=ve(require("zod/v4"));var Ea=["tsx"],ba=/^[A-Z][A-Za-z0-9]*$/,xa=it.object({extensions:it.array(it.string()).optional()}),Ln=q({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:[J(xa)]},defaultOptions:[{}],create(e,[n]){let r=e.getFilename(),t=n.extensions??Ea,s=!1;for(let T of t)if(r.endsWith(T)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function c(T){return ba.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&&p.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 o.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=p.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 o.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 We=require("@typescript-eslint/utils"),wt=require("zod/v4");function Rt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ca(e){return e.callee.type===We.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===We.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===We.AST_NODE_TYPES.Identifier&&e.callee.property.type===We.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ia=wt.z.object({ignorePrefixes:wt.z.array(wt.z.string()).optional()});function oi(e,n){for(let r of n)if(e.startsWith(r))return e.slice(r.length);return e}function Aa(e){return`set${Rt(e)}`}var Mn=q({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:[J(Ia)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[n]){return{VariableDeclarator(r){if(!r.init||r.init.type!==We.AST_NODE_TYPES.CallExpression||!Ca(r.init)||r.id.type!==We.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[t,s]=r.id.elements;if(!t||!s||t.type!==We.AST_NODE_TYPES.Identifier||s.type!==We.AST_NODE_TYPES.Identifier)return;let o=t.name,i=s.name,p=n.ignorePrefixes||[],c=oi(o,p),a=oi(i,p);if(c===""){if(!a.startsWith("set")){let m=`set${Rt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Rt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(s,m)}]})}return}let u=Aa(c);a!==u&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:Rt(c),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:m=>m.replaceText(s,u)}]})}}}});var de=require("@typescript-eslint/utils"),Ge=require("zod/v4");var wa=Ge.z.object({name:Ge.z.string(),defaults:Ge.z.array(Ge.z.unknown())}),Ra=Ge.z.object({functions:Ge.z.array(wa)});function Ft(e,n){if(e===n)return!0;if(e===null||n===null||e===void 0||n===void 0)return e===n;if(typeof e!=typeof n||typeof e!="object"||Array.isArray(e)!==Array.isArray(n))return!1;if(Array.isArray(e)&&Array.isArray(n))return e.length!==n.length?!1:e.every((s,o)=>Ft(s,n[o]));let r=Object.keys(e),t=Object.keys(n);if(r.length!==t.length)return!1;for(let s of r){if(!t.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(n,s);if(!o||!i)return!1;let p=o.value,c=i.value;if(!Ft(p,c))return!1}return!0}function Fa(e,n){let r=new Set;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return r;for(let t in e){if(!(t in n))continue;let s=Object.getOwnPropertyDescriptor(e,t),o=Object.getOwnPropertyDescriptor(n,t);s&&o&&Ft(s.value,o.value)&&r.add(t)}return r}function ai(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 n={};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?n[r.key.name]=r.value.value:r.value.type===de.AST_NODE_TYPES.ObjectExpression?n[r.key.name]=ai(r.value):n[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return n}case de.AST_NODE_TYPES.ArrayExpression:return e.elements.map(n=>{if(!(!n||n.type===de.AST_NODE_TYPES.SpreadElement))return n.type===de.AST_NODE_TYPES.Literal?n.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function va(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 $n=q({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:[J(Ra)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map;for(let t of n.functions)r.set(t.name,t.defaults);return{CallExpression(t){let s=va(t.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=t.arguments;if(i.length===0)return;let p=-1,c=!1,a=new Map,u=new Set,m=new Map,y=[];for(let f=0;f<i.length;f++){if(f>=o.length){p=f;continue}let E=o[f],x=i[f];if(!x||x.type===de.AST_NODE_TYPES.SpreadElement){p=f;continue}let S=ai(x);if(E===void 0){p=f;continue}if(Ft(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=Fa(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)}),p=f}else p=f}if(p<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=o?o[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:t,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<=p){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(t.callee),T=e.sourceCode.getLastToken(t);A&&T&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(t);T&&A&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});var we=require("@typescript-eslint/utils");function ka(e){let n=e.parent;for(;n;){if(n.type===we.AST_NODE_TYPES.AwaitExpression||n.type===we.AST_NODE_TYPES.MemberExpression&&n.object===e&&n.property.type===we.AST_NODE_TYPES.Identifier&&n.property.name==="then"||n.type===we.AST_NODE_TYPES.ArrowFunctionExpression&&n.body===e)return!0;if(n.type===we.AST_NODE_TYPES.ArrayExpression&&n.parent.type===we.AST_NODE_TYPES.CallExpression){let r=n.parent;if(r.callee.type===we.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===we.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===we.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(n.parent)n=n.parent;else break}return!1}function Pa(e){let{callee:n}=e;return n.type===we.AST_NODE_TYPES.Identifier&&n.name==="require"||n.type===we.AST_NODE_TYPES.MemberExpression&&n.object.type===we.AST_NODE_TYPES.Identifier&&n.object.name==="require"}var _n=q({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(n){ka(n)||e.report({node:n,messageId:"syncDynamicImport"})},TSImportType(n){e.report({node:n,messageId:"syncDynamicImport"})},CallExpression(n){Pa(n)&&e.report({node:n,messageId:"requireNotAllowed"})}}}});var L=require("@typescript-eslint/utils"),vt=require("zod/v4");var Oa=vt.z.object({mainComponentRegex:vt.z.string().optional(),mainComponentSelector:vt.z.string().optional()}),Na=/^[A-Z][A-Za-z0-9]*$/,Un=q({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:[J(Oa)],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,[n]){let r=e.sourceCode,t=n.mainComponentRegex?new RegExp(n.mainComponentRegex):void 0,s=n.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,p=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 Oe(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 Na.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&&p.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 s?u.has(d):t?t.test(g):T(d)}function w(d){let g=new Set;Oe(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=p.get(d);return F?N(F,g):!1}let l={};return s&&(l[s]=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)}),l["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 Y=b(D,Z);c.push({node:D,name:Z,isMainComponent:Y,usedStyles:new Set,isExported:T(D)})}}if(!s&&t&&!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 Y of a)Y.node===Z&&P.set(Y.name,D)}let j=new Map;for(let D of a){let Z=m(D),Y=new Set;if(Z){let ue=y(Z);for(let fe of ue)F.has(fe)&&fe!==D.name&&Y.add(fe)}j.set(D.name,Y)}let V=new Map;for(let D of a){let Z=j.get(D.name);if(!Z)continue;let Y=P.get(D.name);if(Y!==void 0)for(let ue of Z){let fe=V.get(ue);(fe===void 0||Y<fe)&&V.set(ue,Y)}}let G=[];for(let D of a){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),Y=-1;for(let Ee of c){if(!Ee.usedStyles.has(D.name))continue;let Ce=d.body.indexOf(Ee.node);(Y===-1||Ce<Y)&&(Y=Ce)}let ue=V.get(D.name);if(ue!==void 0&&(Y===-1||ue<Y)&&(Y=ue),Y===-1)continue;let fe=-1;for(let Ee of c){let Ce=d.body.indexOf(Ee.node);Ce<Y&&Ce>fe&&(fe=Ce)}let Re=Z<Y,Ve=Z>fe,Se=-1,st=j.get(D.name);if(st)for(let Ee of st){let Ce=P.get(Ee);Ce!==void 0&&Ce>Se&&(Se=Ce)}let Ke=Z>Se;if(!(Re&&Ve&&Ke)){let Ee=fe+1;if(Se+1>Ee&&(Ee=Se+1),Ee<g&&(Ee=g),Ee>Y)continue;G.push({style:D,targetPosition:Ee})}}let H=null;if(c.length>1){let D=c.map(Y=>({c:Y,idx:d.body.indexOf(Y.node)})).sort((Y,ue)=>Y.idx-ue.idx)[0]?.c,Z=c.find(Y=>Y.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)})}},l;function R(d,g,F){return function*(P){d.sort((V,G)=>V.targetPosition-G.targetPosition);for(let{style:V}of d){let G=r.getCommentsBefore(V.node),H=V.node.range[0],D=V.node.range[1];G.length>0&&G[0]&&(H=G[0].range[0]),H===V.node.range[0]&&r.text.slice(0,H).trim().length===0&&(H=0),yield P.removeRange([H,D])}let j=new Map;for(let V of d){let G=j.get(V.targetPosition)||[];G.push(V),j.set(V.targetPosition,G)}for(let[V,G]of j){let H=F[V];if(!H)continue;let D=r.getCommentsBefore(H),Z=D.length>0&&D[0]?D[0].range[0]:H.range[0],Y=[];for(let{style:ue}of G){let fe=r.getCommentsBefore(ue.node),Re=r.getText(ue.node);fe.length>0&&(Re=`${fe.map(Se=>r.getText(Se)).join(`
|
|
47
47
|
`)}
|
|
48
|
-
${Re}`),Y.push(Re)}yield
|
|
48
|
+
${Re}`),Y.push(Re)}yield P.insertTextBeforeRange([Z,Z],`${Y.join(`
|
|
49
49
|
|
|
50
50
|
`)}
|
|
51
51
|
|
|
52
|
-
`)}if(g){let{component:
|
|
52
|
+
`)}if(g){let{component:V,targetBefore:G}=g,H=r.getCommentsBefore(V.node),D=V.node.range[0],Z=V.node.range[1];H.length>0&&H[0]&&(D=H[0].range[0]),D===V.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let Y=r.getCommentsBefore(G),ue=Y.length>0&&Y[0]?Y[0].range[0]:G.range[0],fe=(()=>{let Re=r.getText(V.node);return H.length>0&&(Re=`${H.map(Se=>r.getText(Se)).join(`
|
|
53
53
|
`)}
|
|
54
|
-
${Re}`),Re})();yield
|
|
55
|
-
`)}}}}});var
|
|
54
|
+
${Re}`),Re})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ue,ue],`${fe}
|
|
55
|
+
`)}}}}});var kt=require("@typescript-eslint/utils"),zn=ve(require("typescript")),li=require("zod/v4");var Da=li.z.object({}),Wn=q({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:[J(Da)]},defaultOptions:[{}],create(e){let n=kt.ESLintUtils.getParserServices(e,!0),r=n.program?.getTypeChecker();if(!r||!n.program)throw new Error("TypeScript services or program not available");function t(s,o){if(s.flags&zn.default.TypeFlags.Any||s.flags&zn.default.TypeFlags.Unknown)return!1;let i=s.getProperty("then");return i?o.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(s){if(s.operator!=="void"||s.argument.type!==kt.AST_NODE_TYPES.CallExpression)return;let o=n.esTreeNodeToTSNodeMap.get(s.argument),i=r.getTypeAtLocation(o);if(!t(i,r)){let c=e.sourceCode.getText(s.argument);e.report({node:s,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(a){return a.replaceText(s,c)}}]})}}}}});var pi={[fn.name]:fn.rule,[Xt.name]:Xt.rule,[Jt.name]:Jt.rule,"rules-of-hooks":ii,"exhaustive-deps":Qn,"require-description":Zr.rule,[Bt.name]:Bt.rule,[Yt.name]:Yt.rule,[yn.name]:yn.rule,[Ot.name]:Ot.rule,[Vt.name]:Vt.rule,[Zt.name]:Zt.rule,[at.name]:at.rule,[Sn.name]:Sn.rule,[qt.name]:qt.rule,[Ht.name]:Ht.rule,[Kt.name]:Kt.rule,[Dt.name]:Dt.rule,[Cn.name]:Cn.rule,[xn.name]:xn.rule,[Rn.name]:Rn.rule,[Wt.name]:Wt.rule,[nn.name]:nn.rule,[rn.name]:rn.rule,[sn.name]:sn.rule,[pn.name]:pn.rule,[cn.name]:cn.rule,[on.name]:on.rule,[ln.name]:ln.rule,[gn.name]:gn.rule,[en.name]:en.rule,[Qt.name]:Qt.rule,[Dn.name]:Dn.rule,[mn.name]:mn.rule,[Fn.name]:Fn.rule,[On.name]:On.rule,[jn.name]:jn.rule,[Ln.name]:Ln.rule,[Mn.name]:Mn.rule,[$n.name]:$n.rule,[_n.name]:_n.rule,[Un.name]:Un.rule,[Wn.name]:Wn.rule,[at.name]:at.rule};var ja={rules:pi};0&&(module.exports={extendedLintPlugin});
|