@ls-stack/extended-lint 0.83.0 → 0.84.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.
@@ -1,7 +1,7 @@
1
- import{AST_NODE_TYPES as he}from"@typescript-eslint/utils";import{z as _}from"zod/v4";import{ESLintUtils as Ai}from"@typescript-eslint/utils";import*as Wn from"zod/v4";function V(e){let r=Ai.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return Wn.toJSONSchema(e)}var wi=_.object({disallow:_.array(_.object({selector:_.string(),message:_.string(),replace:_.optional(_.union([_.string(),_.object({regex:_.string(),with:_.string()})])),replaceType:_.optional(_.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.optional(_.array(_.object({fn:_.string(),withArgs:_.optional(_.array(_.object({atIndex:_.number(),value:_.union([_.string(),_.number(),_.boolean()])}))),message:_.string(),replaceWith:_.optional(_.string()),ignoreRegex:_.optional(_.string())}))),__dev_simulateFileName:_.optional(_.string()),mustMatchSyntax:_.optional(_.array(_.object({includeRegex:_.string(),mustCallFn:_.optional(_.array(_.object({anyCall:_.array(_.object({fn:_.string(),withArgs:_.array(_.object({atIndex:_.number(),literal:_.union([_.string(),_.number(),_.boolean()])}))})),message:_.optional(_.string())}))),mustMatchSelector:_.optional(_.array(_.object({selector:_.string(),message:_.string()}))),mustHaveExport:_.optional(_.array(_.object({name:_.string(),type:_.enum(["function","variable","any"]).default("any"),message:_.string()})))})))}),Ft=V({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(wi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:p,disallowFnCalls:i}=t,s=o??e.filename,a=[],l=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===he.ImportSpecifier&&w.imported.type===he.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===he.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[O,c]=k.split(":");O===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(b.declaration.type===he.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.Identifier){let k=w.id.name;for(let O of Array.from(y)){let[c,F]=O.split(":");c===k&&(F==="variable"||F==="any")&&y.delete(O)}}}}for(let w of b.specifiers)if(w.exported.type===he.Identifier){let k=w.exported.name;for(let O of Array.from(y)){let[c,F]=O.split(":");c===k&&F==="any"&&y.delete(O)}}}function C(b){b.id.type===he.Identifier&&b.init?.type===he.Identifier&&x.set(b.id.name,b.init.name)}function T(b){return x.get(b)??b}function I(b,w){return T(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:k,mustHaveExport:O}of n??[]){let F=function(d){let g=d;for(let{name:R,value:P}of c??[])g=g.replaceAll(R,P);return g};var E=F;let c=Fi(s,new RegExp(b));if(c){for(let{anyCall:d,message:g}of w??[]){let R=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(R),a.push(P=>{let{callee:L}=P;if(L.type===he.Identifier){for(let{fn:X,withArgs:G}of d)if(L.name===X){u.delete(R);for(let H of G){let D=P.arguments[H.atIndex],Z=typeof H.literal=="string"?F(H.literal):H.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${H.atIndex}${g?`: ${F(g)}`:""}`}});continue}if(D.type!==he.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${H.atIndex} should the literal "${Z}"${g?`: ${F(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${F(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])f.set(d,F(g)),l.set(F(d),()=>{f.delete(d)});for(let{name:d,type:g,message:R}of O??[]){let P=F(d),L=F(R);y.add(`${P}:${g}:${L}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:O,ignoreRegex:c}of i??[])c&&new RegExp(c).test(s)||a.push(F=>{let{callee:d}=F;if(d.type!==he.Identifier||!I(d.name,b))return;if(w)for(let R of w){let P=F.arguments[R.atIndex];if(!P){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${R.value}" at index ${R.atIndex}: ${k}`}});return}if(P.type!==he.Literal||P.value!==R.value)return}let g=R=>O?R.replaceText(F,O):null;e.report({node:F,messageId:"default",data:{message:k},suggest:O?[{messageId:"default",data:{message:`Replace with "${O}"`},fix:g}]:void 0})});function A(b,w){let k=r[b];k?r[b]=O=>{k(O),w(O)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:O="suggestion"}of p??[]){if(b==="CallExpression"){a.push(c=>{S(k,c,w,O)});continue}r[b]=c=>{S(k,c,w,O)}}if(l.size>0)for(let[b,w]of l)A(b,w);return a.length>0&&(r.CallExpression=b=>{if(b.type===he.CallExpression)for(let w of a)w(b)}),r.ImportDeclaration=b=>{b.type===he.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===he.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===he.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,O,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${O}: ${c}`}})}},r;function S(b,w,k,O){let c=F=>{if(!b)return null;if(typeof b=="string")return F.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return F.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&O==="autofix"?c:void 0,suggest:b&&O==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Fi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...p]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Jn(o)}),r.push({name:"$0_uncapitalize",value:Vn(o)}),r.push({name:"$0",value:o});for(let i=0;i<p.length;i++){let s=`$${i+1}`,a=p[i];a!==void 0&&(r.push({name:`${s}_lowercase`,value:a.toLowerCase()}),r.push({name:`${s}_capitalize`,value:Jn(a)}),r.push({name:`${s}_uncapitalize`,value:Vn(a)}),r.push({name:s,value:a}))}return r}function Jn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vn(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as oe,AST_TOKEN_TYPES as Xn,ESLintUtils as Ri}from"@typescript-eslint/utils";import{z as Xe}from"zod/v4";var vi=Ri.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hn="collapse-simple-objs-in-one-line",ki=Xe.object({maxLineLength:Xe.number().optional(),maxProperties:Xe.number().optional(),nestedObjMaxLineLength:Xe.number().optional(),nestedObjMaxProperties:Xe.number().optional(),ignoreTypesWithSuffix:Xe.array(Xe.string()).optional()}),Pi=vi({name:Hn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[$(ki)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,p=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(l){if(l.type===oe.ObjectExpression){let u=l.parent.type===oe.Property,f=u?i:o,y=l.properties.length;if(y>f)return!1;if(y===1){let m=l.properties[0];return!m||m.type===oe.Property&&m.value.type===oe.ObjectExpression||m.type===oe.Property&&m.value.type===oe.ArrayExpression&&!m.value.elements.every(C=>C&&Rt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of l.properties){if(m.type===oe.Property&&!Rt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=l.parent.parent?.type===oe.TSPropertySignature,f=u?i:o,y=l.members.length;if(y>f)return!1;if(n.length>0&&l.parent.type===oe.TSTypeAliasDeclaration){let m=l.parent.id.name;if(n.some(h=>m.endsWith(h)))return!1}if(y===1){let m=l.members[0];return!m||m.type===oe.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===oe.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(l.parent.type===oe.TSIntersectionType||l.parent.type===oe.TSUnionType&&l.parent.types[0]!==l)return!1;let x=[];for(let m of l.members){if(m.type!==oe.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===oe.TSTypeLiteral||!Bn(h))return!1;if(h.type===oe.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let T=h.typeArguments.params[0];if(!T||!Bn(T))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function a(l){if(l.loc.start.line===l.loc.end.line)return;if(l.parent.type!==oe.JSXExpressionContainer){let h=0,C=!1,T=r.getTokenAfter(l,{filter:A=>A.type!==Xn.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=T?.type===Xn.Template&&T.value.startsWith(`}
2
- `);if(T?.loc.start.line===l.loc.end.line&&!I)return}let u=s(l);if(!u)return;let f=u.text;if(f.includes(`
3
- `)||r.getCommentsInside(l).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=Ni(r,l),m=u.isNested&&u.propsSize>2?p:t.maxLineLength;m&&y.length+x.length+Oi(l,r)>m||e.report({node:l,messageId:"singleLineProp",fix:h=>h.replaceText(l,y)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function Bn(e){return e.type===oe.TSLiteralType||e.type===oe.TSTypeReference||e.type===oe.TSNumberKeyword||e.type===oe.TSStringKeyword||e.type===oe.TSBooleanKeyword||e.type===oe.TSNullKeyword||e.type===oe.TSUndefinedKeyword}function Rt(e,t){return!!(e.type===oe.Literal||e.type===oe.Identifier||e.type===oe.TemplateLiteral||e.type===oe.TaggedTemplateExpression||!t&&e.type===oe.ArrayExpression&&e.elements.every(r=>r&&Rt(r,!0)))}function Oi(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
- `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function Ni(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var vt={name:Hn,rule:Pi};var Di=/eslint +react-compiler\/react-compiler: +\["error/;function Yn(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function qn(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Gn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,p=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:p};function s(I){p&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let a=e.getSourceCode().scopeManager,l=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(S){if(A.has(S))return A.get(S);let E=I(S);return A.set(S,E),E}}function h(I,A,S,E,b){b&&I.async&&s({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ import{AST_NODE_TYPES as he}from"@typescript-eslint/utils";import{z as _}from"zod/v4";import{ESLintUtils as Ai}from"@typescript-eslint/utils";import*as Jn from"zod/v4";function V(e){let i=Ai.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:i}}function $(e){return Jn.toJSONSchema(e)}var wi=_.object({disallow:_.array(_.object({selector:_.string(),message:_.string(),replace:_.optional(_.union([_.string(),_.object({regex:_.string(),with:_.string()})])),replaceType:_.optional(_.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:_.optional(_.array(_.object({fn:_.string(),withArgs:_.optional(_.array(_.object({atIndex:_.number(),value:_.union([_.string(),_.number(),_.boolean()])}))),message:_.string(),replaceWith:_.optional(_.string()),ignoreRegex:_.optional(_.string())}))),__dev_simulateFileName:_.optional(_.string()),mustMatchSyntax:_.optional(_.array(_.object({includeRegex:_.string(),mustCallFn:_.optional(_.array(_.object({anyCall:_.array(_.object({fn:_.string(),withArgs:_.array(_.object({atIndex:_.number(),literal:_.union([_.string(),_.number(),_.boolean()])}))})),message:_.optional(_.string())}))),mustMatchSelector:_.optional(_.array(_.object({selector:_.string(),message:_.string()}))),mustHaveExport:_.optional(_.array(_.object({name:_.string(),type:_.enum(["function","variable","any"]).default("any"),message:_.string()})))})))}),vt=V({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(wi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let i={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:r}=t,s=o??e.filename,l=[],p=new Map,u=new Set,f=new Map,y=new Set,h=new Map;function m(x){for(let w of x.specifiers)w.type===he.ImportSpecifier&&w.imported.type===he.Identifier&&w.imported.name!==w.local.name&&h.set(w.local.name,w.imported.name)}function b(x){if(x.declaration){if(x.declaration.type===he.FunctionDeclaration&&x.declaration.id){let w=x.declaration.id.name;for(let k of Array.from(y)){let[O,c]=k.split(":");O===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(x.declaration.type===he.VariableDeclaration){for(let w of x.declaration.declarations)if(w.id.type===he.Identifier){let k=w.id.name;for(let O of Array.from(y)){let[c,F]=O.split(":");c===k&&(F==="variable"||F==="any")&&y.delete(O)}}}}for(let w of x.specifiers)if(w.exported.type===he.Identifier){let k=w.exported.name;for(let O of Array.from(y)){let[c,F]=O.split(":");c===k&&F==="any"&&y.delete(O)}}}function C(x){x.id.type===he.Identifier&&x.init?.type===he.Identifier&&h.set(x.id.name,x.init.name)}function T(x){return h.get(x)??x}function I(x,w){return T(x)===w||x===w}for(let{includeRegex:x,mustCallFn:w,mustMatchSelector:k,mustHaveExport:O}of n??[]){let F=function(d){let g=d;for(let{name:R,value:P}of c??[])g=g.replaceAll(R,P);return g};var E=F;let c=Fi(s,new RegExp(x));if(c){for(let{anyCall:d,message:g}of w??[]){let R=`Expected file to call the function: ${d.map(({fn:P})=>P).join(" or ")}`;u.add(R),l.push(P=>{let{callee:L}=P;if(L.type===he.Identifier){for(let{fn:X,withArgs:G}of d)if(L.name===X){u.delete(R);for(let H of G){let D=P.arguments[H.atIndex],Z=typeof H.literal=="string"?F(H.literal):H.literal;if(!D){e.report({node:P,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${H.atIndex}${g?`: ${F(g)}`:""}`}});continue}if(D.type!==he.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${H.atIndex} should the literal "${Z}"${g?`: ${F(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${F(g)}`:""}`},fix:q=>q.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of k??[])f.set(d,F(g)),p.set(F(d),()=>{f.delete(d)});for(let{name:d,type:g,message:R}of O??[]){let P=F(d),L=F(R);y.add(`${P}:${g}:${L}`)}}}for(let{fn:x,withArgs:w,message:k,replaceWith:O,ignoreRegex:c}of r??[])c&&new RegExp(c).test(s)||l.push(F=>{let{callee:d}=F;if(d.type!==he.Identifier||!I(d.name,x))return;if(w)for(let R of w){let P=F.arguments[R.atIndex];if(!P){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${R.value}" at index ${R.atIndex}: ${k}`}});return}if(P.type!==he.Literal||P.value!==R.value)return}let g=R=>O?R.replaceText(F,O):null;e.report({node:F,messageId:"default",data:{message:k},suggest:O?[{messageId:"default",data:{message:`Replace with "${O}"`},fix:g}]:void 0})});function A(x,w){let k=i[x];k?i[x]=O=>{k(O),w(O)}:i[x]=w}for(let{selector:x,message:w,replace:k,replaceType:O="suggestion"}of a??[]){if(x==="CallExpression"){l.push(c=>{S(k,c,w,O)});continue}i[x]=c=>{S(k,c,w,O)}}if(p.size>0)for(let[x,w]of p)A(x,w);return l.length>0&&(i.CallExpression=x=>{if(x.type===he.CallExpression)for(let w of l)w(x)}),i.ImportDeclaration=x=>{x.type===he.ImportDeclaration&&m(x)},i.ExportNamedDeclaration=x=>{x.type===he.ExportNamedDeclaration&&b(x)},i.VariableDeclarator=x=>{x.type===he.VariableDeclarator&&C(x)},i["Program:exit"]=x=>{for(let w of u)e.report({node:x,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:x,messageId:"default",data:{message:w}});for(let w of y){let[k,O,c]=w.split(":");e.report({node:x,messageId:"default",data:{message:`Missing required export "${k}" of type ${O}: ${c}`}})}},i;function S(x,w,k,O){let c=F=>{if(!x)return null;if(typeof x=="string")return F.replaceText(w,x);{let d=new RegExp(x.regex),g=e.sourceCode.getText(w);return F.replaceText(w,g.replace(d,x.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:x&&O==="autofix"?c:void 0,suggest:x&&O==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof x=="string"?x:x.with}"`},fix:c}]:void 0})}}});function Fi(e,t){let i=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;i.push({name:"$0_lowercase",value:o.toLowerCase()}),i.push({name:"$0_capitalize",value:Vn(o)}),i.push({name:"$0_uncapitalize",value:Xn(o)}),i.push({name:"$0",value:o});for(let r=0;r<a.length;r++){let s=`$${r+1}`,l=a[r];l!==void 0&&(i.push({name:`${s}_lowercase`,value:l.toLowerCase()}),i.push({name:`${s}_capitalize`,value:Vn(l)}),i.push({name:`${s}_uncapitalize`,value:Xn(l)}),i.push({name:s,value:l}))}return i}function Vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xn(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as oe,AST_TOKEN_TYPES as Bn,ESLintUtils as Ri}from"@typescript-eslint/utils";import{z as Be}from"zod/v4";var vi=Ri.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yn="collapse-simple-objs-in-one-line",ki=Be.object({maxLineLength:Be.number().optional(),maxProperties:Be.number().optional(),nestedObjMaxLineLength:Be.number().optional(),nestedObjMaxProperties:Be.number().optional(),ignoreTypesWithSuffix:Be.array(Be.string()).optional()}),Pi=vi({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:[$(ki)]},defaultOptions:[{}],create(e,[t]){let i=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,r=t.nestedObjMaxProperties??3;function s(p){if(p.type===oe.ObjectExpression){let u=p.parent.type===oe.Property,f=u?r:o,y=p.properties.length;if(y>f)return!1;if(y===1){let m=p.properties[0];return!m||m.type===oe.Property&&m.value.type===oe.ObjectExpression||m.type===oe.Property&&m.value.type===oe.ArrayExpression&&!m.value.elements.every(C=>C&&kt(C))?!1:{text:i.getText(m),isNested:u,propsSize:y}}let h=[];for(let m of p.properties){if(m.type===oe.Property&&!kt(m.value))return!1;h.push(i.getText(m))}return{text:h.join(", "),isNested:u,propsSize:y}}else{let u=p.parent.parent?.type===oe.TSPropertySignature,f=u?r:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===oe.TSTypeAliasDeclaration){let m=p.parent.id.name;if(n.some(b=>m.endsWith(b)))return!1}if(y===1){let m=p.members[0];return!m||m.type===oe.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===oe.TSTypeLiteral?!1:{text:i.getText(m),isNested:u,propsSize:1}}if(p.parent.type===oe.TSIntersectionType||p.parent.type===oe.TSUnionType&&p.parent.types[0]!==p)return!1;let h=[];for(let m of p.members){if(m.type!==oe.TSPropertySignature)return!1;let b=m.typeAnnotation?.typeAnnotation;if(!b||b.type===oe.TSTypeLiteral||!Hn(b))return!1;if(b.type===oe.TSTypeReference&&b.typeArguments){if(b.typeArguments.params.length>1)return!1;let T=b.typeArguments.params[0];if(!T||!Hn(T))return!1}let C=i.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),h.push(C)}return{text:h.join("; "),isNested:u,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==oe.JSXExpressionContainer){let b=0,C=!1,T=i.getTokenAfter(p,{filter:A=>A.type!==Bn.Punctuator||C?!0:A.value===","?(b++,!1):A.value===";"?(b++,C=!0,!1):A.value===")"||A.value==="}"?(b++,!1):!0});if(b>4)return;let I=T?.type===Bn.Template&&T.value.startsWith(`}
2
+ `);if(T?.loc.start.line===p.loc.end.line&&!I)return}let u=s(p);if(!u)return;let f=u.text;if(f.includes(`
3
+ `)||i.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,h=Ni(i,p),m=u.isNested&&u.propsSize>2?a:t.maxLineLength;m&&y.length+h.length+Oi(p,i)>m||e.report({node:p,messageId:"singleLineProp",fix:b=>b.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Hn(e){return e.type===oe.TSLiteralType||e.type===oe.TSTypeReference||e.type===oe.TSNumberKeyword||e.type===oe.TSStringKeyword||e.type===oe.TSBooleanKeyword||e.type===oe.TSNullKeyword||e.type===oe.TSUndefinedKeyword}function kt(e,t){return!!(e.type===oe.Literal||e.type===oe.Identifier||e.type===oe.TemplateLiteral||e.type===oe.TaggedTemplateExpression||!t&&e.type===oe.ArrayExpression&&e.elements.every(i=>i&&kt(i,!0)))}function Oi(e,t){let i=t.getLastToken(e);if(!i)return 0;let n=t.text.indexOf(`
4
+ `,i.range[1]);return(n!==-1?n:t.text.length)-i.range[1]}function Ni(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Pt={name:Yn,rule:Pi};var Di=/eslint +react-compiler\/react-compiler: +\["error/;function qn(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let i=t.body[0];return i.type==="ExpressionStatement"&&i.expression.type==="Literal"&&i.expression.value==="use no memo"}function Zn(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var Kn={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,i=typeof e.getSource=="function"?I=>i(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,a=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,r={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function s(I){a&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let l=e.getSourceCode().scopeManager,p=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,h=new WeakSet;function m(I,A){return function(S){if(A.has(S))return A.get(S);let E=I(S);return A.set(S,E),E}}function b(I,A,S,E,x){x&&I.async&&s({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,44 +12,44 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=a.acquire(I),k=new Set,O=null;{let v=w.upper;for(;v&&(k.add(v),v.type!=="function");)v=v.upper;if(!v)return;O=v}let c=Array.isArray;function F(v){if(!c(v.defs))return!1;let N=v.defs[0];if(N==null||N.node.type!=="VariableDeclarator")return!1;let W=N.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=N.node.parent;if(J==null&&(Ot(O.block,N.node.id),J=N.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let z=N.node.id,{name:K}=Y;if(K==="useRef"&&z.type==="Identifier")return!0;if($i(Y)&&z.type==="Identifier"){for(let ee of v.references)ee!==z&&x.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(z.type==="ArrayPattern"&&z.elements.length===2&&c(v.identifiers)){if(z.elements[1]===v.identifiers[0]){if(K==="useState"){let ee=v.references,Ae=0;for(let Me=0;Me<ee.length;Me++){if(ee[Me].isWrite()&&Ae++,Ae>1)return!1;l.set(ee[Me].identifier,z.elements[0])}}return!0}else if(z.elements[0]===v.identifiers[0]){if(K==="useState"){let ee=v.references;for(let Ae=0;Ae<ee.length;Ae++)u.add(ee[Ae].identifier)}return!1}}}else if(K==="useTransition"&&z.type==="ArrayPattern"&&z.elements.length===2&&Array.isArray(v.identifiers)&&z.elements[1]===v.identifiers[0])return!0;return!1}function d(v){if(!c(v.defs))return!1;let N=v.defs[0];if(N==null||N.node==null||N.node.id==null)return!1;let W=N.node,J=O.childScopes,Y=null,z;for(z=0;z<J.length;z++){let K=J[z],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(z=0;z<Y.through.length;z++){let K=Y.through[z];if(K.resolved!=null&&k.has(K.resolved.scope)&&!g(K.resolved))return!1}return!0}let g=m(F,f),R=m(d,y),P=new Map;function L(v){let N=v.from,W=!1;for(;N.block!==I;)N.type==="function"&&(W=N.block.parent!=null&&N.block.parent.type==="ReturnStatement"),N=N.upper;return W}let X=new Map,G=new Map;H(w);function H(v){for(let N of v.references){if(!N.resolved||!k.has(N.resolved.scope))continue;let W=Ot(I,N.identifier),J=Kn(W),Y=_e(J,G);if(b&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&L(N)&&P.set(Y,{reference:N,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let z=N.resolved.defs[0];if(z!=null&&!(z.node!=null&&z.node.init===I.parent)&&z.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(N);else{let K=N.resolved,ee=g(K)||R(K);X.set(Y,{isStable:ee,references:[N]})}}for(let N of v.childScopes)H(N)}P.forEach(({reference:v,dependencyNode:N},W)=>{let J=v.resolved.references,Y=!1;for(let z=0;z<J.length;z++){let{identifier:K}=J[z],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||s({node:N.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(v,N){D.has(N)||(D.add(N),s({node:v,message:`Assignments to the '${N}' variable from inside React Hook ${r(S)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(S)}.`}))}let q=new Set;if(X.forEach(({isStable:v,references:N},W)=>{v&&q.add(W),N.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let v=null;if(X.forEach(({isStable:N,references:W},J)=>{v||W.forEach(Y=>{if(v)return;let z=Y.identifier;if(!l.has(z))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(v=J)})}),v){let{suggestedDependencies:N}=kt({dependencies:X,declaredDependencies:[],stableDependencies:q,externalDependencies:new Set,isEffect:!0});s({node:S,message:`React Hook ${E} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+N.join(", ")+`] as a second argument to the ${E} Hook.`,suggest:[{desc:`Add dependencies array: [${N.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${N.join(", ")}]`)}}]})}return}let ce=[],ue=new Set;A.type!=="ArrayExpression"?s({node:A,message:`React Hook ${r(S)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(v=>{if(v===null)return;if(v.type==="SpreadElement"){s({node:v,message:`React Hook ${r(S)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}x.has(v)&&s({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(Y){return Y.removeRange(v.range)}}]});let N;try{N=_e(v,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){v.type==="Literal"?X.has(v.value)?s({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?`}):s({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:v,message:`React Hook ${r(S)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=v;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!O.through.some(Y=>Y.identifier===W);ce.push({key:N,node:v}),J||ue.add(N)});let{suggestedDependencies:Fe,unnecessaryDependencies:ze,missingDependencies:Se,duplicateDependencies:nt}=kt({dependencies:X,declaredDependencies:ce,stableDependencies:q,externalDependencies:ue,isEffect:b}),qe=Fe;if(nt.size+Se.size+ze.size===0){let v=qn(S),N=v&&Yn(v);if(t&&!N)return;ji({declaredDependencies:ce,declaredDependenciesNode:A,componentScope:O,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:z})=>{let K=z==="function"?"useCallback":"useMemo",ee=z==="function"?"definition":"initialization",Ae=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Me=Y?`To fix this, ${Ae}`:`Move it inside the ${E} callback. Alternatively, ${Ae}`,bi=z==="conditional"||z==="logical expression"?"could make":"makes",xi=`The '${J.name.name}' ${z} ${bi} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Me}`,Un;Y&&J.type==="Variable"&&z==="function"&&(Un=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(zn){let[Ci,Ii]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[zn.insertTextBefore(J.node.init,Ci),zn.insertTextAfter(J.node.init,Ii)]}}]),s({node:J.node,message:xi,suggest:Un})});return}!b&&Se.size>0&&(qe=kt({dependencies:X,declaredDependencies:[],stableDependencies:q,externalDependencies:ue,isEffect:b}).suggestedDependencies);function be(){if(ce.length===0)return!0;let v=ce.map(W=>W.key),N=v.slice().sort();return v.join(",")===N.join(",")}be()&&qe.sort();function Ce(v){let N=v.split("."),W="";for(let J=0;J<N.length;J++){if(J!==0){let Y=N.slice(0,J+1).join("."),z=G.get(Y)===!0;W+=z?"?.":"."}W+=N[J]}return W}function wt(v,N,W,J){return v.size===0?null:(v.size>1?"":N+" ")+W+" "+(v.size>1?"dependencies":"dependency")+": "+Mi(Array.from(v).sort().map(Y=>"'"+Ce(Y)+"'"))+`. Either ${J} ${v.size>1?"them":"it"} or remove the dependency array.`}let Pe="";if(ze.size>0){let v=null;if(Array.from(ze.keys()).forEach(N=>{v===null&&N.endsWith(".current")&&(v=N)}),v!==null)Pe=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ue.size>0){let N=Array.from(ue)[0];w.set.has(N)||(Pe=` Outer scope values like '${N}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Pe&&Se.has("props")){let v=X.get("props");if(v==null)return;let N=v.references;if(!Array.isArray(N))return;let W=!0;for(let J=0;J<N.length;J++){let Y=N[J],z=Ot(O.block,Y.identifier);if(!z){W=!1;break}let K=z.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(Pe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${E} call and refer to those specific props inside ${r(S)}.`)}if(!Pe&&Se.size>0){let v=null;Se.forEach(N=>{if(v)return;let W=O.set.get(N),J=X.get(N);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let z=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){z=!0;break}z&&(v=N)}),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(N=>{if(v!==null)return;let J=X.get(N).references,Y,z;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,z=Y.parent;z!=null&&z!==O.block;){if(z.type==="CallExpression"){let ee=l.get(z.callee);if(ee!=null){if(ee.name===N)v={missingDep:N,setter:z.callee.name,form:"updater"};else if(u.has(Y))v={missingDep:N,setter:z.callee.name,form:"reducer"};else{let Ae=J[K].resolved;if(Ae!=null){let Me=Ae.defs[0];Me!=null&&Me.type==="Parameter"&&(v={missingDep:N,setter:z.callee.name,form:"inlineReducer"})}}break}}z=z.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.")}}s({node:A,message:`React Hook ${r(S)} has `+(wt(Se,"a","missing","include")||wt(ze,"an","unnecessary","exclude")||wt(nt,"a","duplicate","omit"))+Pe,suggest:[{desc:`Update the dependencies array to be: [${qe.map(Ce).join(", ")}]`,fix(v){return v.replaceText(A,`[${qe.map(Ce).join(", ")}]`)}}]})}function C(I){let A=Li(I.callee,i);if(A===-1)return;let S=I.arguments[A],E=I.callee,b=Qn(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(b);if(!S){s({node:E,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let O=qn(E);if(!(O&&Yn(O)))return}if(!w&&!k){(b==="useMemo"||b==="useCallback")&&s({node:E,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(S.type){case"FunctionExpression":case"ArrowFunctionExpression":h(S,w,E,b,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(F=>F&&F.type==="Identifier"&&F.name===S.name))return;let O=n(I).set.get(S.name);if(O==null||O.defs==null)return;let c=O.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":h(c.node,w,E,b,k);return;case"VariableDeclarator":let F=c.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":h(F,w,E,b,k);return}break}break;default:s({node:E,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:E,message:`React Hook ${b} has a missing dependency: '${S.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${S.name}]`,fix(O){return O.replaceText(w,`[${S.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Di.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function kt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let p=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,C)=>{let T=s(p,C);T.isUsed=!0,a(p,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:h})=>{let C=s(p,h);C.isSatisfiedRecursively=!0}),r.forEach(h=>{let C=s(p,h);C.isSatisfiedRecursively=!0});function s(h,C){let T=C.split("."),I=h;for(let A of T){let S=I.children.get(A);S||(S=i(),I.children.set(A,S)),I=S}return I}function a(h,C,T){let I=C.split("."),A=h;for(let S of I){let E=A.children.get(S);if(!E)return;T(E),A=E}}let l=new Set,u=new Set;f(p,l,u,h=>h);function f(h,C,T,I){h.children.forEach((A,S)=>{let E=I(S);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&T.add(E);return}if(A.isUsed){C.add(E);return}f(A,C,T,b=>E+"."+b)})}let y=[],x=new Set,m=new Set;return t.forEach(({key:h})=>{u.has(h)?y.indexOf(h)===-1?y.push(h):m.add(h):x.add(h)}),l.forEach(h=>{y.push(h)}),{suggestedDependencies:y,unnecessaryDependencies:x,duplicateDependencies:m,missingDependencies:l}}function We(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return We(e.consequent)!=null||We(e.alternate)!=null?"conditional":null;case"LogicalExpression":return We(e.left)!=null||We(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return We(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return We(e.expression);case"TSAsExpression":return We(e.expression)}return null}function ji({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(l=>l.name===i);if(s==null)return null;let a=s.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let l=We(a.node.init);if(l!=null)return[s,l]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[s,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function p(i){let s=!1;for(let a=0;a<i.references.length;a++){let l=i.references[a];if(l.writeExpr){if(s)return!0;s=!0;continue}let u=l.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!er(t,l.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:p(i)}))}function Kn(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)?Kn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Pt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function _e(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=_e(e.object,t),n=_e(e.property,null),o=`${r}.${n}`;return Pt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=_e(e.object,t),n=_e(e.property,null),o=`${r}.${n}`;return Pt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=_e(r.object,t),o=_e(r.property,null),p=`${n}.${o}`;return Pt(r,t,p),p}else throw new Error(`Unsupported node type: ${e.type}`)}function Qn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Li(e,t){let r=Qn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=_e(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Ot(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),_i(n,t))return n;if(er(n,t))for(let[o,p]of Object.entries(n))o!=="parent"&&(Zn(p)?(p.parent=n,r.push(p)):Array.isArray(p)&&p.forEach(i=>{Zn(i)&&(i.parent=n,r.push(i))}))}return null}function Mi(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Zn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function _i(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function er(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function $i(e){return!1}import{AST_NODE_TYPES as pe,ESLintUtils as ar}from"@typescript-eslint/utils";import B from"typescript";import{z as ir}from"zod/v4";import{AST_NODE_TYPES as tr}from"@typescript-eslint/utils";function Ze(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Ze(e.parent,t,r===1/0?r:r-1)}function*Nt(e){yield e,e.parent&&(yield*Nt(e.parent))}function Dt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function rr(e,t,r){let o=r.getDeclaredVariables(e).find(p=>p.name===t||p.identifiers[0]?.parent.type===tr.Property&&p.identifiers[0].parent.key.type===tr.Identifier&&p.identifiers[0].parent.key.name===t);return o?o.references.filter(p=>!p.init):[]}function nr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ui(e,t){return e[t]}function Oe(e,t,r){let n=r.visitorKeys,o=new Set;function p(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let a=n[i.type];if(a)for(let l of a){let u=Ui(i,l);if(u){if(Array.isArray(u)){for(let f of u)if(nr(f)&&p(f))return!0}else if(nr(u)&&p(u))return!0}}return!1}p(e)}var zi=ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="improved-no-unnecessary-condition",Wi=ir.object({alternativeForInCondition:ir.string().optional().describe("Alternative to appear in the error for `in` condition")}),sr={object:"Array",property:"isArray"},Ji=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Vi=new Set(Ji),jt={name:or,rule:zi({name:or,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:[$(Wi)]},defaultOptions:[{}],create(e,[t]){let r=ar.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===pe.UnaryExpression&&c.operator==="typeof"}function p(c){return c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown?null:c.flags&B.TypeFlags.StringLike?["string"]:c.flags&B.TypeFlags.NumberLike?["number"]:c.flags&B.TypeFlags.BigIntLike?["bigint"]:c.flags&B.TypeFlags.BooleanLike?["boolean"]:c.flags&B.TypeFlags.ESSymbolLike?["symbol"]:c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void?["undefined"]:c.flags&B.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&B.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&B.TypeFlags.NonPrimitive?["object"]:c.flags&B.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let F=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(F.expression);if(d.flags&B.TypeFlags.Any||d.flags&B.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let P of d.types){let L=p(P);if(L)g.push(...L);else return null}return g}let R=p(d);return R?(g.push(...R),g):null}function s(c){if(!(c.operator==="==="||c.operator==="!=="))return;let d=null,g=null;if(o(c.left)?(d=c.left,g=c.right.type===pe.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,g=c.left.type===pe.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!g||!Xi(g,Vi))return;let R=i(d);if(!R)return;let P=c.operator==="!==",L=R.includes(g);R.length===1?L&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ge(d,e),type:g}}):!L&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ge(d,e),type:Array.from(R)[0]}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ge(d,e),actualType:ft(R),conditionType:g}}):L&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ge(d,e),actualType:ft(R),conditionType:g}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ge(d,e),actualType:ft(R),conditionType:g}}):!L&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ge(d,e),type:ft(R)}})}function a(c){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown)return null;if(c.isUnion()){let F=[];for(let d of c.types)if(d.flags&B.TypeFlags.StringLiteral){let g=d.value;F.push(g)}else return null;return F}return c.flags&B.TypeFlags.StringLiteral?[c.value]:null}function l(c){if(!n)return null;let F=r.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(F),g=a(d);if(g)return g;let R=n.getSymbolAtLocation(F);if(R){let P=n.getTypeOfSymbolAtLocation(R,F),L=a(P);if(L)return L}return null}function u(c){let F=e.sourceCode.ast,d=null;return Oe(F,g=>{if(g.type===pe.VariableDeclarator&&g.id.type===pe.Identifier&&g.id.name===c.name&&g.id.typeAnnotation){let R=g.id.typeAnnotation.typeAnnotation;if(R.type===pe.TSUnionType){let P=[];for(let L of R.types)if(L.type===pe.TSLiteralType&&L.literal.type===pe.Literal&&typeof L.literal.value=="string")P.push(L.literal.value);else return!0;return d=P,!0}if(R.type===pe.TSLiteralType&&R.literal.type===pe.Literal&&typeof R.literal.value=="string")return d=[R.literal.value],!0}return!1},e.sourceCode),d}function f(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function y(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let F=n.getApparentType(c);if(F!==c&&(n.isArrayType(F)||n.isTupleType(F)))return!0;if(c.aliasSymbol){let g=n.getFullyQualifiedName(c.aliasSymbol);if(f(g))return!0}let d=c.getSymbol();if(d){let g=n.getFullyQualifiedName(d);if(f(g))return!0}return!1}function x(c){if(!n)return!1;if(c.flags&B.TypeFlags.StringLike||c.flags&B.TypeFlags.NumberLike||c.flags&B.TypeFlags.BigIntLike||c.flags&B.TypeFlags.BooleanLike||c.flags&B.TypeFlags.ESSymbolLike||c.flags&B.TypeFlags.EnumLike||c.flags&B.TypeFlags.Null||c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void||c.flags&B.TypeFlags.Never)return!0;let F=c.getSymbol();if(F){let d=n.getFullyQualifiedName(F);if(d==="__function"||d==="__object"&&!y(c))return!0}return!1}function m(c){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let F=!0,d=!0;for(let g of c.types){let R=m(g);if(R==="unknown")return"unknown";R!=="alwaysTrue"&&(F=!1),R!=="alwaysFalse"&&(d=!1)}return F?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(c)?"alwaysTrue":x(c)?"alwaysFalse":"unknown"}function h(c){return!c.computed&&c.object.type===pe.Identifier&&c.object.name===sr.object&&c.property.type===pe.Identifier&&c.property.name===sr.property}function C(c){if(!n||c.callee.type!==pe.MemberExpression||!h(c.callee)||c.arguments.length===0)return;let[F]=c.arguments;if(!F||F.type===pe.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(F),g=n.getTypeAtLocation(d),R=m(g);R==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):R==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function T(c){if(c.callee.type!==pe.MemberExpression||c.callee.property.type!==pe.Identifier||c.callee.computed)return;let F=c.callee.property.name;if(F!=="startsWith"&&F!=="endsWith"&&F!=="includes"||c.arguments.length!==1)return;let[d]=c.arguments;if(!d||d.type!==pe.Literal||typeof d.value!="string")return;let g=c.callee.object,R=l(g);if(!R&&g.type===pe.Identifier&&(R=u(g)),!R||R.length===0)return;let P=d.value;if(F==="includes"&&R.length>1)return;let L=0,X=0;for(let G of R)if((F==="startsWith"?G.startsWith(P):F==="endsWith"?G.endsWith(P):G.includes(P))?L++:X++,L>0&&X>0)return;if(L>0&&X===0){let G=F==="startsWith"?"unnecessaryStartsWithCondition":F==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&L===0){let G=F==="startsWith"?"alwaysFalseStartsWithCondition":F==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function d(H){if(H.type!==pe.MemberExpression||H.computed||H.property.type!==pe.Identifier||H.property.name!=="length")return null;let D=H.object,Z=l(D);if(!Z||Z.length===0)return null;let q=[];for(let ce of Z)q.push(ce.length);return{values:q}}let g=d(c.left),R=d(c.right),P=null,L=null;if(g?c.right.type===pe.Literal&&typeof c.right.value=="number"&&(P=g.values,L=c.right.value):R&&c.left.type===pe.Literal&&typeof c.left.value=="number"&&(P=R.values,L=c.left.value),!P||L===null)return;let X=0,G=0;for(let H of P){let D=!1;if(c.operator==="==="?D=H===L:c.operator==="!=="?D=H!==L:c.operator===">"?D=H>L:c.operator===">="?D=H>=L:c.operator==="<"?D=H<L:c.operator==="<="&&(D=H<=L),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===pe.Literal&&typeof c.value=="string")return c.value;let F=l(c);if(!F||F.length!==1)return null;let[d]=F;return d??null}function S(c){return(c.flags&B.TypeFlags.Intersection)!==0}function E(c){return(c.flags&B.TypeFlags.Object)!==0}function b(c){return!n||n.getIndexTypeOfType(c,B.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,B.IndexKind.Number)}function w(c,F){if(!n||b(c)||c.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(c,F);return d?d.flags&B.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,F){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown||c.flags&B.TypeFlags.Never||c.flags&B.TypeFlags.TypeParameter||c.flags&B.TypeFlags.IndexedAccess||c.flags&B.TypeFlags.StringLike||c.flags&B.TypeFlags.NumberLike||c.flags&B.TypeFlags.BigIntLike||c.flags&B.TypeFlags.BooleanLike||c.flags&B.TypeFlags.EnumLike||c.flags&B.TypeFlags.ESSymbolLike||c.flags&B.TypeFlags.NonPrimitive||c.flags&B.TypeFlags.Null||c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void)return"unknown";if(c.isUnion()){let d=!0,g=!0;for(let R of c.types){let P=k(R,F);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(g=!1),P==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(S(c)){let d=c,g=!1,R=!1;for(let P of d.types){let L=k(P,F);if(L==="unknown")return"unknown";L==="required"?g=!0:L==="optional"&&(R=!0)}return g?"required":R?"optional":"absent"}return E(c)?w(c,F):"unknown"}function O(c){if(c.operator!=="in"||c.left.type===pe.PrivateIdentifier)return;let F=A(c.left);if(!F)return;let d=c.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!n)return;let R=n.getTypeAtLocation(g),P=k(R,F);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){s(c),I(c),O(c)},CallExpression(c){T(c),C(c)}}}})};function ft(e){return Array.from(new Set(e)).join(" | ")||"never"}function Ge(e,t){let r=e.argument;return r.type===pe.Identifier?r.name:t.sourceCode.getText(r)}function Xi(e,t){return t.has(e)}import{AST_NODE_TYPES as Bi,ESLintUtils as Hi}from"@typescript-eslint/utils";import{z as Lt}from"zod/v4";var Yi=Hi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-call-with-explicit-generics",qi=Lt.object({functions:Lt.array(Lt.string())}),Zi=Yi({name:lr,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:[$(qi)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Bi.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),Mt={name:lr,rule:Zi};import{AST_NODE_TYPES as mt,ESLintUtils as Gi}from"@typescript-eslint/utils";var Ki=Gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-call-with-inferred-generics",Qi=Ki({name:pr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==mt.Identifier)return;let p=r.get(o.name);if(!p)return;let{minGenerics:i=1,allowAny:s,disallowTypes:a=t.disallowTypes}=p;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!a)&&n.typeArguments?.params.some(u=>!s&&u.type===mt.TSAnyKeyword||a&&u.type===mt.TSTypeReference&&u.typeName.type===mt.Identifier&&a.includes(u.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),_t={name:pr,rule:Qi};import{ESLintUtils as eo}from"@typescript-eslint/utils";var to=eo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-commented-out-code",no=["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:"],ro=/^\s*return\s+/,io=/\w=("|'|`)/,oo=/\w+:\s*('|"|`)/,so=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,ao=/\w+-\w+:/,lo=/\w+_\w+:/,po=/\?\s+\w/,co=/:\s+\w/,uo=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,fo=/^\s*\d+[,}]/,mo=/^\s*\[[^\]]*\][,}]/,yo=/^\s*\{[^}]*\}[,}]/,go=/\.\w+\(/,So=/\[\w+\]/,To=/^\s*(['"`]).+?\1\s*:/,Eo=/^<[A-Z]\w*(\s|>|\/)/,ho=/^<[a-z]+(\s|>|\/)/,bo=/<[A-Z]\w*(\s.*)?>/,xo=/<\/[A-Z]\w*>/,Co=/<[a-z]+(\s.*)?>/,Io=/<\/[a-z]+>/,Ao=/^\s*[*\s]*$/,wo=/^[a-zA-Z]/,Fo=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ro=/```[\s\S]*?```/g,vo=/`[^`]*`/g,cr=/[a-zA-Z0-9]/,ko=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Po=/[{}[\]()`=<>]/,Oo=/:\s*(['"`[{(]|\w+\s*=>)/,No=/\bif\s*\(|\belse\b|=>/,fe={returnStatement:ro,stringAssignment:io,objectPropertyWithQuotes:oo,computedPropertyAssignment:so,kebabCaseProperty:ao,snakeCaseProperty:lo,ternaryOperator:po,colonWithWord:co,quotedString:uo,numberWithComma:fo,arrayWithComma:mo,objectWithComma:yo,methodCall:go,arrayAccess:So,quotedPropertyKey:To,jsxSelfClosing:Eo,jsxElement:ho,jsxOpeningTag:bo,jsxClosingTag:xo,htmlOpeningTag:Co,htmlClosingTag:Io,jsdocComment:Ao};function Do(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&wo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||ko.test(t)||Po.test(t)||Oo.test(t)||No.test(t)?!1:!!(t.includes(":")&&Fo.test(t))}var jo=[") {","return;",fe.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",fe.stringAssignment,");",fe.objectPropertyWithQuotes,fe.computedPropertyAssignment,fe.kebabCaseProperty,fe.snakeCaseProperty,"&&","||","()",fe.ternaryOperator,fe.colonWithWord,fe.quotedString,fe.numberWithComma,fe.arrayWithComma,fe.objectWithComma,fe.methodCall,fe.arrayAccess,"?.(","??","=>",fe.quotedPropertyKey],Lo=["/>","</",fe.jsxSelfClosing,fe.jsxElement,fe.jsxOpeningTag,fe.jsxClosingTag,fe.htmlOpeningTag,fe.htmlClosingTag],ur=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Mo=to({name:fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let p=n.trimStart();if(n.startsWith("*")||p.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||fe.jsdocComment.test(n))return!1;for(let i of ur)if(p.startsWith(i))return!1;if(n.includes("https://")||Do(p))return!1;if(o==="Block"){for(let i of Lo)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of no)if(p.startsWith(i))return{wrongPattern:i};for(let i of jo)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let p=n,i=p.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return p;if(o==="Block"&&p.includes("```")){let l=p.split(Ro);l.some(f=>cr.test(f))&&(p=l.join(""))}if(!p.includes("`"))return p;let s=p.split(vo);return s.some(l=>cr.test(l))?s.join(""):p}return{Program(){let o=e.sourceCode.getAllComments();for(let p of o){let i=r(p.value,p.type),s=t(i,p.type);s&&e.report({node:p,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:ur.join(", ")}})}}}}}),$t={name:fr,rule:Mo};import{ESLintUtils as _o,TSESTree as $o}from"@typescript-eslint/utils";var Uo=_o.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",zo=Uo({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(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===$o.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Ut={name:mr,rule:zo};import{ESLintUtils as Wo}from"@typescript-eslint/utils";var Jo=Wo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-leaked-text-in-jsx",Vo=[",",";","[","]","(",")"],Xo=Jo({name:yr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Vo.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),zt={name:yr,rule:Xo};import{AST_NODE_TYPES as rt,ESLintUtils as Bo}from"@typescript-eslint/utils";var Ho=Bo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="no-non-camel-case-functions",Yo=/^(\$?[a-z][a-zA-Z0-9]*)$/;function dr(e){if(e.typeName.type!==rt.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===rt.Identifier&&t.name==="JSX"&&r.name==="Element"}var qo=Ho({name:gr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Yo.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===rt.TSTypeReference?dr(r):r.type===rt.TSUnionType&&r.types.some(o=>o.type===rt.TSTypeReference&&dr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Wt={name:gr,rule:qo};import{ESLintUtils as Zo,TSESTree as se}from"@typescript-eslint/utils";var Go=Zo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-optional-root-props",Ko=Go({name:Sr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let p=e.sourceCode.getDeclaredVariables(n)[0];if(!p||p.references.length!==1)return!1;let i=p.references[0];if(!i)return!1;for(let s of Nt(i.identifier)){if("returnType"in s||s.type===se.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=s.parent;if(!a)return!1;if(a.type===se.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===se.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===se.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let u=Ze(a.parent.parent,se.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=yt(u,e.sourceCode);return f?!(f.parent.type===se.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===se.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===se.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===se.AST_NODE_TYPES.ArrowFunctionExpression){let l=Ze(a,se.AST_NODE_TYPES.VariableDeclaration);return l?!!yt(l,e.sourceCode):!1}if(a.type===se.AST_NODE_TYPES.FunctionDeclaration)return!!yt(a,e.sourceCode)}return!1}function r(n){n.key.type!==se.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let p=Ze(n,se.AST_NODE_TYPES.TSPropertySignature);if(!p)return null;let i=e.sourceCode.getText(p);return o.replaceText(p,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===se.AST_NODE_TYPES.TSTypeLiteral&&!(dt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(dt(n)||!t(n)))for(let o of n.body.body)o.type===se.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==se.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==se.AST_NODE_TYPES.TSTypeLiteral)return;let p=Ze(n.parent,se.AST_NODE_TYPES.VariableDeclaration,4);if(!p)return;let i=yt(p,e.sourceCode);if(!(!i||i.parent.type===se.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===se.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of o.members)a.type===se.AST_NODE_TYPES.TSPropertySignature&&r(a)}}}});function dt(e){return e?e.parent?.type===se.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function yt(e,t){if(dt(e))return;let r;if(e.type===se.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===se.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===se.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let p=o.references.filter(i=>i.identifier!==r);if(!(p.length!==1||!p[0])&&!dt(p[0].identifier.parent.parent))return p[0].identifier}var Jt={name:Sr,rule:Ko};import{AST_NODE_TYPES as gt}from"@typescript-eslint/utils";var it=V({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===gt.Identifier?t.has(n.name):n.type===gt.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===gt.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===gt.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});import{ESLintUtils as Qo}from"@typescript-eslint/utils";import Vt from"path";import{z as Je}from"zod/v4";var es=Qo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-relative-imports",ts=Je.object({find:Je.string(),replacement:Je.string()}),ns=Je.object({aliases:Je.array(ts),rootDir:Je.string().optional(),allowNotFoundAliases:Je.boolean().optional(),_dev_simulateFileName:Je.string().optional()}),rs=es({name:Tr,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:[$(ns)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let a=Vt.dirname(s);return Vt.resolve(a,i)}function p(i){let s=t.rootDir??process.cwd(),a=Vt.relative(s,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:l,replacement:u}of t.aliases)if(a.startsWith(u)){let f=a.replace(u,l);return{alias:l,newPath:f}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let a=o(s,r),l=p(a);!l&&t.allowNotFoundAliases||e.report({node:i,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?u=>u.replaceText(i.source,`'${l.newPath}'`):void 0})}}}}),Xt={name:Tr,rule:rs};import{AST_NODE_TYPES as me}from"@typescript-eslint/utils";import{z as Er}from"zod/v4";var is=Er.object({customMessage:Er.string().optional()}),Bt=V({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(is)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case me.Literal:return!0;case me.ObjectExpression:return n.properties.every(o=>o.type===me.Property?o.computed||o.value.type===me.Identifier&&o.key.type===me.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case me.ArrayExpression:return n.elements.every(o=>o?o.type===me.SpreadElement?!1:r(o):!0);case me.TemplateLiteral:return n.expressions.length===0;case me.ConditionalExpression:case me.LogicalExpression:case me.BinaryExpression:case me.UnaryExpression:case me.CallExpression:case me.MemberExpression:case me.Identifier:case me.ArrowFunctionExpression:case me.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===me.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===me.JSXExpressionContainer?n.value.expression.type!==me.JSXEmptyExpression&&(o=n.value.expression):n.value.type===me.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as St}from"@typescript-eslint/utils";import*as Be from"zod/v4";var os=Be.object({alternativeMsgs:Be.object({inArrayFind:Be.string().optional(),inArrayFilter:Be.string().optional()}).optional(),__dev_simulateFileName:Be.string().optional()});function ss(e){return e.typeAnnotation.type!==St.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var as=/(typeGuards|type-guards)\.(ts|tsx)$/;function ls(e){return as.test(e)}function ps(e){let t=e.parent;for(;t;){if(t.type===St.CallExpression&&t.callee.type===St.MemberExpression&&t.callee.property.type===St.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Ht=V({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[$(os)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ls(r))return{};function n(o){if(!ss(o))return;let p=ps(o);if(t.alternativeMsgs&&p){let i=p.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let s=p.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as Ke}from"@typescript-eslint/utils";var cs="no-unnecessary-async-on-jsx-props";function us(e){if(e.body.type!==Ke.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Ke.ExpressionStatement?!1:r.expression.type===Ke.AwaitExpression}var Yt=V({name:cs,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){us(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,p=[],i=o.getFirstToken(r,a=>a.value==="async");if(i){let a=o.getTokenAfter(i);a?p.push(n.replaceTextRange([i.range[0],a.range[0]],"")):p.push(n.remove(i))}function s(a){if(a.type===Ke.AwaitExpression){let l=o.getFirstToken(a);if(l&&l.value==="await"){let u=o.getTokenAfter(l);u?p.push(n.replaceTextRange([l.range[0],u.range[0]],"")):p.push(n.remove(l))}}if(a.type===Ke.BlockStatement)for(let l of a.body)s(l);else a.type===Ke.ExpressionStatement&&s(a.expression)}return s(r.body),p}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as ot,ESLintUtils as br}from"@typescript-eslint/utils";import*as qt from"typescript";import st from"zod/v4";var fs=br.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-unnecessary-casting",ms=st.object({additionalCastFunctions:st.array(st.object({name:st.string(),expectedType:st.enum(["string","number"])})).optional()}),Zt={name:hr,rule:fs({name:hr,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:[$(ms)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=br.getParserServices(e,!0),p=o.program?.getTypeChecker();if(!p||!o.program)throw new Error("TypeScript services or program not available");function i(u,f){switch(u.type){case ot.Literal:return f==="number"?typeof u.value=="number":typeof u.value=="string";case ot.TemplateLiteral:return f==="string";case ot.UnaryExpression:return f==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,f){return f==="number"?!!(u.flags&qt.TypeFlags.NumberLike):!!(u.flags&qt.TypeFlags.StringLike)}function a(u,f){return y=>y.replaceText(u,e.sourceCode.getText(f))}function l(u){if(!p||u.arguments.length!==1)return;let f=u.arguments[0];if(!f||f.type===ot.SpreadElement)return;let{callee:y}=u;if(y.type!==ot.Identifier)return;let x=y.name,m=n.find(C=>C.name===x);if(!m)return;if(i(f,m.expectedType)||s(p.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,T;x==="Number"?C="unnecessaryNumberCasting":x==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",T={name:m.name,type:m.expectedType}),e.report({node:u,messageId:C,...T?{data:T}:{},fix:a(u,f)})}}return{CallExpression:l}}})};import{AST_NODE_TYPES as Re}from"@typescript-eslint/utils";import*as Tt from"zod/v4";var ys=Tt.object({ignoreWithDescription:Tt.string().optional()}),Gt=V({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:[$(ys)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function o(a){let l=a.arguments[0];return l&&l.type===Re.Literal&&typeof l.value=="string"?l.value:null}function p(a){return!a||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(a)}function i(a){return a.length!==1?!1:n.body.filter(u=>{if(u.type===Re.ExpressionStatement){let f=u.expression;if(f.type===Re.CallExpression&&f.callee.type===Re.Identifier){let y=f.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function s(a){let l=a.arguments[1];if(l&&(l.type===Re.FunctionExpression||l.type===Re.ArrowFunctionExpression)&&l.body.type===Re.BlockStatement){let u=l.body.body;return u.length===0?"":u.map(y=>r.text.slice(y.range[0],y.range[1])).join(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=l.acquire(I),k=new Set,O=null;{let v=w.upper;for(;v&&(k.add(v),v.type!=="function");)v=v.upper;if(!v)return;O=v}let c=Array.isArray;function F(v){if(!c(v.defs))return!1;let N=v.defs[0];if(N==null||N.node.type!=="VariableDeclarator")return!1;let W=N.node.init;if(W==null)return!1;for(;W.type==="TSAsExpression";)W=W.expression;let J=N.node.parent;if(J==null&&(Dt(O.block,N.node.id),J=N.node.parent,J==null))return!1;if(J.kind==="const"&&W.type==="Literal"&&(typeof W.value=="string"||typeof W.value=="number"||W.value===null))return!0;if(W.type!=="CallExpression")return!1;let Y=W.callee;if(Y.type==="MemberExpression"&&Y.object.name==="React"&&Y.property!=null&&!Y.computed&&(Y=Y.property),Y.type!=="Identifier")return!1;let z=N.node.id,{name:K}=Y;if(K==="useRef"&&z.type==="Identifier")return!0;if($i(Y)&&z.type==="Identifier"){for(let ee of v.references)ee!==z&&h.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(z.type==="ArrayPattern"&&z.elements.length===2&&c(v.identifiers)){if(z.elements[1]===v.identifiers[0]){if(K==="useState"){let ee=v.references,Ae=0;for(let Me=0;Me<ee.length;Me++){if(ee[Me].isWrite()&&Ae++,Ae>1)return!1;p.set(ee[Me].identifier,z.elements[0])}}return!0}else if(z.elements[0]===v.identifiers[0]){if(K==="useState"){let ee=v.references;for(let Ae=0;Ae<ee.length;Ae++)u.add(ee[Ae].identifier)}return!1}}}else if(K==="useTransition"&&z.type==="ArrayPattern"&&z.elements.length===2&&Array.isArray(v.identifiers)&&z.elements[1]===v.identifiers[0])return!0;return!1}function d(v){if(!c(v.defs))return!1;let N=v.defs[0];if(N==null||N.node==null||N.node.id==null)return!1;let W=N.node,J=O.childScopes,Y=null,z;for(z=0;z<J.length;z++){let K=J[z],ee=K.block;if(W.type==="FunctionDeclaration"&&ee===W||W.type==="VariableDeclarator"&&ee.parent===W){Y=K;break}}if(Y==null)return!1;for(z=0;z<Y.through.length;z++){let K=Y.through[z];if(K.resolved!=null&&k.has(K.resolved.scope)&&!g(K.resolved))return!1}return!0}let g=m(F,f),R=m(d,y),P=new Map;function L(v){let N=v.from,W=!1;for(;N.block!==I;)N.type==="function"&&(W=N.block.parent!=null&&N.block.parent.type==="ReturnStatement"),N=N.upper;return W}let X=new Map,G=new Map;H(w);function H(v){for(let N of v.references){if(!N.resolved||!k.has(N.resolved.scope))continue;let W=Dt(I,N.identifier),J=Qn(W),Y=_e(J,G);if(x&&J.type==="Identifier"&&(J.parent.type==="MemberExpression"||J.parent.type==="OptionalMemberExpression")&&!J.parent.computed&&J.parent.property.type==="Identifier"&&J.parent.property.name==="current"&&L(N)&&P.set(Y,{reference:N,dependencyNode:J}),J.parent.type==="TSTypeQuery"||J.parent.type==="TSTypeReference")continue;let z=N.resolved.defs[0];if(z!=null&&!(z.node!=null&&z.node.init===I.parent)&&z.type!=="TypeParameter")if(X.has(Y))X.get(Y).references.push(N);else{let K=N.resolved,ee=g(K)||R(K);X.set(Y,{isStable:ee,references:[N]})}}for(let N of v.childScopes)H(N)}P.forEach(({reference:v,dependencyNode:N},W)=>{let J=v.resolved.references,Y=!1;for(let z=0;z<J.length;z++){let{identifier:K}=J[z],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){Y=!0;break}}Y||s({node:N.parent.property,message:`The ref value '${W}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${W}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(v,N){D.has(N)||(D.add(N),s({node:v,message:`Assignments to the '${N}' variable from inside React Hook ${i(S)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${i(S)}.`}))}let q=new Set;if(X.forEach(({isStable:v,references:N},W)=>{v&&q.add(W),N.forEach(J=>{J.writeExpr&&Z(J.writeExpr,W)})}),D.size>0)return;if(!A){let v=null;if(X.forEach(({isStable:N,references:W},J)=>{v||W.forEach(Y=>{if(v)return;let z=Y.identifier;if(!p.has(z))return;let ee=Y.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(v=J)})}),v){let{suggestedDependencies:N}=Ot({dependencies:X,declaredDependencies:[],stableDependencies:q,externalDependencies:new Set,isEffect:!0});s({node:S,message:`React Hook ${E} contains a call to '${v}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+N.join(", ")+`] as a second argument to the ${E} Hook.`,suggest:[{desc:`Add dependencies array: [${N.join(", ")}]`,fix(W){return W.insertTextAfter(I,`, [${N.join(", ")}]`)}}]})}return}let ce=[],ue=new Set;A.type!=="ArrayExpression"?s({node:A,message:`React Hook ${i(S)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(v=>{if(v===null)return;if(v.type==="SpreadElement"){s({node:v,message:`React Hook ${i(S)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}h.has(v)&&s({node:v,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${i(v)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${i(v)}\``,fix(Y){return Y.removeRange(v.range)}}]});let N;try{N=_e(v,G)}catch(Y){if(/Unsupported node type/.test(Y.message)){v.type==="Literal"?X.has(v.value)?s({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?`}):s({node:v,message:`The ${v.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:v,message:`React Hook ${i(S)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw Y}let W=v;for(;W.type==="MemberExpression"||W.type==="OptionalMemberExpression"||W.type==="ChainExpression";)W=W.object||W.expression.object;let J=!O.through.some(Y=>Y.identifier===W);ce.push({key:N,node:v}),J||ue.add(N)});let{suggestedDependencies:Fe,unnecessaryDependencies:ze,missingDependencies:Se,duplicateDependencies:it}=Ot({dependencies:X,declaredDependencies:ce,stableDependencies:q,externalDependencies:ue,isEffect:x}),Ze=Fe;if(it.size+Se.size+ze.size===0){let v=Zn(S),N=v&&qn(v);if(t&&!N)return;ji({declaredDependencies:ce,declaredDependenciesNode:A,componentScope:O,scope:w}).forEach(({construction:J,isUsedOutsideOfHook:Y,depType:z})=>{let K=z==="function"?"useCallback":"useMemo",ee=z==="function"?"definition":"initialization",Ae=`wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,Me=Y?`To fix this, ${Ae}`:`Move it inside the ${E} callback. Alternatively, ${Ae}`,bi=z==="conditional"||z==="logical expression"?"could make":"makes",xi=`The '${J.name.name}' ${z} ${bi} the dependencies of ${E} Hook (at line ${A.loc.start.line}) change on every render. ${Me}`,zn;Y&&J.type==="Variable"&&z==="function"&&(zn=[{desc:`Wrap the ${ee} of '${J.name.name}' in its own ${K}() Hook.`,fix(Wn){let[Ci,Ii]=K==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Wn.insertTextBefore(J.node.init,Ci),Wn.insertTextAfter(J.node.init,Ii)]}}]),s({node:J.node,message:xi,suggest:zn})});return}!x&&Se.size>0&&(Ze=Ot({dependencies:X,declaredDependencies:[],stableDependencies:q,externalDependencies:ue,isEffect:x}).suggestedDependencies);function be(){if(ce.length===0)return!0;let v=ce.map(W=>W.key),N=v.slice().sort();return v.join(",")===N.join(",")}be()&&Ze.sort();function Ce(v){let N=v.split("."),W="";for(let J=0;J<N.length;J++){if(J!==0){let Y=N.slice(0,J+1).join("."),z=G.get(Y)===!0;W+=z?"?.":"."}W+=N[J]}return W}function Rt(v,N,W,J){return v.size===0?null:(v.size>1?"":N+" ")+W+" "+(v.size>1?"dependencies":"dependency")+": "+Mi(Array.from(v).sort().map(Y=>"'"+Ce(Y)+"'"))+`. Either ${J} ${v.size>1?"them":"it"} or remove the dependency array.`}let Pe="";if(ze.size>0){let v=null;if(Array.from(ze.keys()).forEach(N=>{v===null&&N.endsWith(".current")&&(v=N)}),v!==null)Pe=` Mutable values like '${v}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ue.size>0){let N=Array.from(ue)[0];w.set.has(N)||(Pe=` Outer scope values like '${N}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Pe&&Se.has("props")){let v=X.get("props");if(v==null)return;let N=v.references;if(!Array.isArray(N))return;let W=!0;for(let J=0;J<N.length;J++){let Y=N[J],z=Dt(O.block,Y.identifier);if(!z){W=!1;break}let K=z.parent;if(K==null){W=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){W=!1;break}}W&&(Pe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${E} call and refer to those specific props inside ${i(S)}.`)}if(!Pe&&Se.size>0){let v=null;Se.forEach(N=>{if(v)return;let W=O.set.get(N),J=X.get(N);if(J.references[0].resolved!==W)return;let Y=W.defs[0];if(Y==null||Y.name==null||Y.type!=="Parameter")return;let z=!1,K;for(let ee=0;ee<J.references.length;ee++)if(K=J.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){z=!0;break}z&&(v=N)}),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(N=>{if(v!==null)return;let J=X.get(N).references,Y,z;for(let K=0;K<J.length;K++){for(Y=J[K].identifier,z=Y.parent;z!=null&&z!==O.block;){if(z.type==="CallExpression"){let ee=p.get(z.callee);if(ee!=null){if(ee.name===N)v={missingDep:N,setter:z.callee.name,form:"updater"};else if(u.has(Y))v={missingDep:N,setter:z.callee.name,form:"reducer"};else{let Ae=J[K].resolved;if(Ae!=null){let Me=Ae.defs[0];Me!=null&&Me.type==="Parameter"&&(v={missingDep:N,setter:z.callee.name,form:"inlineReducer"})}}break}}z=z.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.")}}s({node:A,message:`React Hook ${i(S)} has `+(Rt(Se,"a","missing","include")||Rt(ze,"an","unnecessary","exclude")||Rt(it,"a","duplicate","omit"))+Pe,suggest:[{desc:`Update the dependencies array to be: [${Ze.map(Ce).join(", ")}]`,fix(v){return v.replaceText(A,`[${Ze.map(Ce).join(", ")}]`)}}]})}function C(I){let A=Li(I.callee,r);if(A===-1)return;let S=I.arguments[A],E=I.callee,x=er(E).name,w=I.arguments[A+1],k=/Effect($|[^a-z])/g.test(x);if(!S){s({node:E,message:`React Hook ${x} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(t&&!k){let O=Zn(E);if(!(O&&qn(O)))return}if(!w&&!k){(x==="useMemo"||x==="useCallback")&&s({node:E,message:`React Hook ${x} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(S.type){case"FunctionExpression":case"ArrowFunctionExpression":b(S,w,E,x,k);return;case"Identifier":if(!w||w.elements&&w.elements.some(F=>F&&F.type==="Identifier"&&F.name===S.name))return;let O=n(I).set.get(S.name);if(O==null||O.defs==null)return;let c=O.defs[0];if(!c||!c.node||c.type!=="Variable"&&c.type!=="FunctionName")break;switch(c.node.type){case"FunctionDeclaration":b(c.node,w,E,x,k);return;case"VariableDeclarator":let F=c.node.init;if(!F)break;switch(F.type){case"ArrowFunctionExpression":case"FunctionExpression":b(F,w,E,x,k);return}break}break;default:s({node:E,message:`React Hook ${x} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:E,message:`React Hook ${x} has a missing dependency: '${S.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${S.name}]`,fix(O){return O.replaceText(w,`[${S.name}]`)}}]})}if(!!e.options[0]?.reactCompilerIsEnabled)return t=!0,{CallExpression:I=>C(I)};if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let I of e.sourceCode.getAllComments())if(Di.test(I.value))return t=!0,{CallExpression:A=>C(A)}}return{CallExpression:I=>C(I)}}};function Ot({dependencies:e,declaredDependencies:t,stableDependencies:i,externalDependencies:n,isEffect:o}){let a=r();function r(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((b,C)=>{let T=s(a,C);T.isUsed=!0,l(a,C,I=>{I.isSubtreeUsed=!0})}),t.forEach(({key:b})=>{let C=s(a,b);C.isSatisfiedRecursively=!0}),i.forEach(b=>{let C=s(a,b);C.isSatisfiedRecursively=!0});function s(b,C){let T=C.split("."),I=b;for(let A of T){let S=I.children.get(A);S||(S=r(),I.children.set(A,S)),I=S}return I}function l(b,C,T){let I=C.split("."),A=b;for(let S of I){let E=A.children.get(S);if(!E)return;T(E),A=E}}let p=new Set,u=new Set;f(a,p,u,b=>b);function f(b,C,T,I){b.children.forEach((A,S)=>{let E=I(S);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&T.add(E);return}if(A.isUsed){C.add(E);return}f(A,C,T,x=>E+"."+x)})}let y=[],h=new Set,m=new Set;return t.forEach(({key:b})=>{u.has(b)?y.indexOf(b)===-1?y.push(b):m.add(b):h.add(b)}),p.forEach(b=>{y.push(b)}),{suggestedDependencies:y,unnecessaryDependencies:h,duplicateDependencies:m,missingDependencies:p}}function We(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return We(e.consequent)!=null||We(e.alternate)!=null?"conditional":null;case"LogicalExpression":return We(e.left)!=null||We(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return We(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return We(e.expression);case"TSAsExpression":return We(e.expression)}return null}function ji({declaredDependencies:e,declaredDependenciesNode:t,componentScope:i,scope:n}){let o=e.map(({key:r})=>{let s=i.variables.find(p=>p.name===r);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=We(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(r){let s=!1;for(let l=0;l<r.references.length;l++){let p=r.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let u=p.from;for(;u!==n&&u!=null;)u=u.upper;if(u!==n&&!tr(t,p.identifier))return!0}return!1}return o.map(([r,s])=>({construction:r.defs[0],depType:s,isUsedOutsideOfHook:a(r)}))}function Qn(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)?Qn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Nt(e,t,i){t&&(e.optional?t.has(i)||t.set(i,!0):t.has(i)||t.set(i,!1))}function _e(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let i=e.name;return t&&t.set(i,!1),i}else if(e.type==="MemberExpression"&&!e.computed){let i=_e(e.object,t),n=_e(e.property,null),o=`${i}.${n}`;return Nt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let i=_e(e.object,t),n=_e(e.property,null),o=`${i}.${n}`;return Nt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let i=e.expression;if(i.type==="CallExpression")throw new Error(`Unsupported node type: ${i.type}`);let n=_e(i.object,t),o=_e(i.property,null),a=`${n}.${o}`;return Nt(i,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function er(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Li(e,t){let i=er(e);if(i.type!=="Identifier")return-1;switch(i.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(i===e&&t&&t.additionalHooks){let n;try{n=_e(i,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function Dt(e,t){let i=[e],n=null;for(;i.length;){if(n=i.shift(),_i(n,t))return n;if(tr(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(Gn(a)?(a.parent=n,i.push(a)):Array.isArray(a)&&a.forEach(r=>{Gn(r)&&(r.parent=n,i.push(r))}))}return null}function Mi(e){let t="";for(let i=0;i<e.length;i++)t+=e[i],i===0&&e.length===2?t+=" and ":i===e.length-2&&e.length>2?t+=", and ":i<e.length-1&&(t+=", ");return t}function Gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function _i(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function tr(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function $i(e){return!1}import{AST_NODE_TYPES as pe,ESLintUtils as lr}from"@typescript-eslint/utils";import B from"typescript";import{z as or}from"zod/v4";import{AST_NODE_TYPES as nr}from"@typescript-eslint/utils";function Ge(e,t,i=1/0){if(i!==0&&e.parent)return e.type===t?e:Ge(e.parent,t,i===1/0?i:i-1)}function*jt(e){yield e,e.parent&&(yield*jt(e.parent))}function Lt(e,t){for(let i of e){let n=t(i);if(n!=null&&n!==!1)return n}}function ir(e,t,i){let o=i.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===nr.Property&&a.identifiers[0].parent.key.type===nr.Identifier&&a.identifiers[0].parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}function rr(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ui(e,t){return e[t]}function Oe(e,t,i){let n=i.visitorKeys,o=new Set;function a(r){if(o.has(r))return!1;if(o.add(r),t(r)===!0)return!0;let l=n[r.type];if(l)for(let p of l){let u=Ui(r,p);if(u){if(Array.isArray(u)){for(let f of u)if(rr(f)&&a(f))return!0}else if(rr(u)&&a(u))return!0}}return!1}a(e)}var zi=lr.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="improved-no-unnecessary-condition",Wi=or.object({alternativeForInCondition:or.string().optional().describe("Alternative to appear in the error for `in` condition")}),ar={object:"Array",property:"isArray"},Ji=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Vi=new Set(Ji),Mt={name:sr,rule:zi({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:[$(Wi)]},defaultOptions:[{}],create(e,[t]){let i=lr.getParserServices(e,!0),n=i.program?.getTypeChecker();if(!n||!i.program)throw new Error("TypeScript services or program not available");function o(c){return c.type===pe.UnaryExpression&&c.operator==="typeof"}function a(c){return c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown?null:c.flags&B.TypeFlags.StringLike?["string"]:c.flags&B.TypeFlags.NumberLike?["number"]:c.flags&B.TypeFlags.BigIntLike?["bigint"]:c.flags&B.TypeFlags.BooleanLike?["boolean"]:c.flags&B.TypeFlags.ESSymbolLike?["symbol"]:c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void?["undefined"]:c.flags&B.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&B.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&B.TypeFlags.NonPrimitive?["object"]:c.flags&B.TypeFlags.Never?["never"]:null}function r(c){if(!n)return null;let F=i.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(F.expression);if(d.flags&B.TypeFlags.Any||d.flags&B.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let P of d.types){let L=a(P);if(L)g.push(...L);else return null}return g}let R=a(d);return R?(g.push(...R),g):null}function s(c){if(!(c.operator==="==="||c.operator==="!=="))return;let d=null,g=null;if(o(c.left)?(d=c.left,g=c.right.type===pe.Literal&&typeof c.right.value=="string"?c.right.value:null):o(c.right)&&(d=c.right,g=c.left.type===pe.Literal&&typeof c.left.value=="string"?c.left.value:null),!d||!g||!Xi(g,Vi))return;let R=r(d);if(!R)return;let P=c.operator==="!==",L=R.includes(g);R.length===1?L&&!P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ke(d,e),type:g}}):!L&&P?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ke(d,e),type:Array.from(R)[0]}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ke(d,e),actualType:yt(R),conditionType:g}}):L&&P&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ke(d,e),actualType:yt(R),conditionType:g}}):!L&&!P?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ke(d,e),actualType:yt(R),conditionType:g}}):!L&&P&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ke(d,e),type:yt(R)}})}function l(c){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown)return null;if(c.isUnion()){let F=[];for(let d of c.types)if(d.flags&B.TypeFlags.StringLiteral){let g=d.value;F.push(g)}else return null;return F}return c.flags&B.TypeFlags.StringLiteral?[c.value]:null}function p(c){if(!n)return null;let F=i.esTreeNodeToTSNodeMap.get(c),d=n.getTypeAtLocation(F),g=l(d);if(g)return g;let R=n.getSymbolAtLocation(F);if(R){let P=n.getTypeOfSymbolAtLocation(R,F),L=l(P);if(L)return L}return null}function u(c){let F=e.sourceCode.ast,d=null;return Oe(F,g=>{if(g.type===pe.VariableDeclarator&&g.id.type===pe.Identifier&&g.id.name===c.name&&g.id.typeAnnotation){let R=g.id.typeAnnotation.typeAnnotation;if(R.type===pe.TSUnionType){let P=[];for(let L of R.types)if(L.type===pe.TSLiteralType&&L.literal.type===pe.Literal&&typeof L.literal.value=="string")P.push(L.literal.value);else return!0;return d=P,!0}if(R.type===pe.TSLiteralType&&R.literal.type===pe.Literal&&typeof R.literal.value=="string")return d=[R.literal.value],!0}return!1},e.sourceCode),d}function f(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function y(c){if(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let F=n.getApparentType(c);if(F!==c&&(n.isArrayType(F)||n.isTupleType(F)))return!0;if(c.aliasSymbol){let g=n.getFullyQualifiedName(c.aliasSymbol);if(f(g))return!0}let d=c.getSymbol();if(d){let g=n.getFullyQualifiedName(d);if(f(g))return!0}return!1}function h(c){if(!n)return!1;if(c.flags&B.TypeFlags.StringLike||c.flags&B.TypeFlags.NumberLike||c.flags&B.TypeFlags.BigIntLike||c.flags&B.TypeFlags.BooleanLike||c.flags&B.TypeFlags.ESSymbolLike||c.flags&B.TypeFlags.EnumLike||c.flags&B.TypeFlags.Null||c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void||c.flags&B.TypeFlags.Never)return!0;let F=c.getSymbol();if(F){let d=n.getFullyQualifiedName(F);if(d==="__function"||d==="__object"&&!y(c))return!0}return!1}function m(c){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let F=!0,d=!0;for(let g of c.types){let R=m(g);if(R==="unknown")return"unknown";R!=="alwaysTrue"&&(F=!1),R!=="alwaysFalse"&&(d=!1)}return F?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(c)?"alwaysTrue":h(c)?"alwaysFalse":"unknown"}function b(c){return!c.computed&&c.object.type===pe.Identifier&&c.object.name===ar.object&&c.property.type===pe.Identifier&&c.property.name===ar.property}function C(c){if(!n||c.callee.type!==pe.MemberExpression||!b(c.callee)||c.arguments.length===0)return;let[F]=c.arguments;if(!F||F.type===pe.SpreadElement)return;let d=i.esTreeNodeToTSNodeMap.get(F),g=n.getTypeAtLocation(d),R=m(g);R==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):R==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function T(c){if(c.callee.type!==pe.MemberExpression||c.callee.property.type!==pe.Identifier||c.callee.computed)return;let F=c.callee.property.name;if(F!=="startsWith"&&F!=="endsWith"&&F!=="includes"||c.arguments.length!==1)return;let[d]=c.arguments;if(!d||d.type!==pe.Literal||typeof d.value!="string")return;let g=c.callee.object,R=p(g);if(!R&&g.type===pe.Identifier&&(R=u(g)),!R||R.length===0)return;let P=d.value;if(F==="includes"&&R.length>1)return;let L=0,X=0;for(let G of R)if((F==="startsWith"?G.startsWith(P):F==="endsWith"?G.endsWith(P):G.includes(P))?L++:X++,L>0&&X>0)return;if(L>0&&X===0){let G=F==="startsWith"?"unnecessaryStartsWithCondition":F==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(X>0&&L===0){let G=F==="startsWith"?"alwaysFalseStartsWithCondition":F==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function I(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function d(H){if(H.type!==pe.MemberExpression||H.computed||H.property.type!==pe.Identifier||H.property.name!=="length")return null;let D=H.object,Z=p(D);if(!Z||Z.length===0)return null;let q=[];for(let ce of Z)q.push(ce.length);return{values:q}}let g=d(c.left),R=d(c.right),P=null,L=null;if(g?c.right.type===pe.Literal&&typeof c.right.value=="number"&&(P=g.values,L=c.right.value):R&&c.left.type===pe.Literal&&typeof c.left.value=="number"&&(P=R.values,L=c.left.value),!P||L===null)return;let X=0,G=0;for(let H of P){let D=!1;if(c.operator==="==="?D=H===L:c.operator==="!=="?D=H!==L:c.operator===">"?D=H>L:c.operator===">="?D=H>=L:c.operator==="<"?D=H<L:c.operator==="<="&&(D=H<=L),D?X++:G++,X>0&&G>0)return}X>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&X===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function A(c){if(c.type===pe.Literal&&typeof c.value=="string")return c.value;let F=p(c);if(!F||F.length!==1)return null;let[d]=F;return d??null}function S(c){return(c.flags&B.TypeFlags.Intersection)!==0}function E(c){return(c.flags&B.TypeFlags.Object)!==0}function x(c){return!n||n.getIndexTypeOfType(c,B.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,B.IndexKind.Number)}function w(c,F){if(!n||x(c)||c.getProperties().length===0)return"unknown";let d=n.getPropertyOfType(c,F);return d?d.flags&B.SymbolFlags.Optional?"optional":"required":"absent"}function k(c,F){if(c.flags&B.TypeFlags.Any||c.flags&B.TypeFlags.Unknown||c.flags&B.TypeFlags.Never||c.flags&B.TypeFlags.TypeParameter||c.flags&B.TypeFlags.IndexedAccess||c.flags&B.TypeFlags.StringLike||c.flags&B.TypeFlags.NumberLike||c.flags&B.TypeFlags.BigIntLike||c.flags&B.TypeFlags.BooleanLike||c.flags&B.TypeFlags.EnumLike||c.flags&B.TypeFlags.ESSymbolLike||c.flags&B.TypeFlags.NonPrimitive||c.flags&B.TypeFlags.Null||c.flags&B.TypeFlags.Undefined||c.flags&B.TypeFlags.Void)return"unknown";if(c.isUnion()){let d=!0,g=!0;for(let R of c.types){let P=k(R,F);if(P==="unknown"||(P!=="required"&&(d=!1),P!=="absent"&&(g=!1),P==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(S(c)){let d=c,g=!1,R=!1;for(let P of d.types){let L=k(P,F);if(L==="unknown")return"unknown";L==="required"?g=!0:L==="optional"&&(R=!0)}return g?"required":R?"optional":"absent"}return E(c)?w(c,F):"unknown"}function O(c){if(c.operator!=="in"||c.left.type===pe.PrivateIdentifier)return;let F=A(c.left);if(!F)return;let d=c.right,g=i.esTreeNodeToTSNodeMap.get(d);if(!n)return;let R=n.getTypeAtLocation(g),P=k(R,F);P==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):P==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){s(c),I(c),O(c)},CallExpression(c){T(c),C(c)}}}})};function yt(e){return Array.from(new Set(e)).join(" | ")||"never"}function Ke(e,t){let i=e.argument;return i.type===pe.Identifier?i.name:t.sourceCode.getText(i)}function Xi(e,t){return t.has(e)}import{AST_NODE_TYPES as dt}from"@typescript-eslint/utils";import{z as Qe}from"zod/v4";var Bi=Qe.object({functions:Qe.array(Qe.string().or(Qe.object({name:Qe.string(),message:Qe.string()})))});function Hi(e){if(e.type===dt.Identifier)return e.name;if(e.type===dt.MemberExpression&&e.property.type===dt.Identifier&&e.object.type===dt.Identifier)return`${e.object.name}.${e.property.name}`}var _t=V({name:"no-call-with-explicit-generics",meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)",noExplicitGenericsCustom:"{{ message }}"},schema:[$(Bi)]},defaultOptions:[{functions:[]}],create(e,[t]){let i=new Map,n=new Map;for(let a of t.functions){let r=typeof a=="string"?a:a.name,s=typeof a=="string"?void 0:a.message;r.startsWith("*.")?n.set(r.slice(2),s):i.set(r,s)}function o(a){if(i.has(a))return{message:i.get(a)};let r=a.indexOf(".");if(r!==-1){let s=a.slice(r+1);if(n.has(s))return{message:n.get(s)}}}return{CallExpression(a){let r=Hi(a.callee);if(!r||!a.typeArguments)return;let s=o(r);s&&(s.message?e.report({node:a,messageId:"noExplicitGenericsCustom",data:{message:s.message}}):e.report({node:a,messageId:"noExplicitGenerics",data:{functionName:r}}))}}}});import{AST_NODE_TYPES as Je,ESLintUtils as Yi}from"@typescript-eslint/utils";var qi=Yi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-call-with-inferred-generics",Zi=qi({name:pr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics",typeOfUsedInGenerics:"Function '{{ functionName }}' should not be called with 'typeof' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}},disallowTypeOf:{type:"boolean"}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let i=new Map(t.functions.map(a=>[a.name,a])),n=t.functions.some(a=>a.disallowTypeOf),o=new Set;return{...n&&{TSTypeAliasDeclaration(a){a.typeAnnotation.type===Je.TSTypeQuery&&o.add(a.id.name)}},CallExpression(a){let{callee:r}=a;if(r.type!==Je.Identifier)return;let s=i.get(r.name);if(!s)return;let{minGenerics:l=1,allowAny:p,disallowTypes:u=t.disallowTypes,disallowTypeOf:f}=s;(a.typeArguments?.params.length||0)<(l||0)&&e.report({node:a,messageId:"missingGenericDeclaration",data:{functionName:r.name,minGenerics:l||0}}),!(p&&!u)&&(a.typeArguments?.params.some(h=>!p&&h.type===Je.TSAnyKeyword||u&&h.type===Je.TSTypeReference&&h.typeName.type===Je.Identifier&&u.includes(h.typeName.name))&&e.report({node:a,messageId:"anyUsedInGenerics",data:{functionName:r.name}}),f&&a.typeArguments?.params.some(h=>h.type===Je.TSTypeQuery||h.type===Je.TSTypeReference&&h.typeName.type===Je.Identifier&&o.has(h.typeName.name))&&e.report({node:a,messageId:"typeOfUsedInGenerics",data:{functionName:r.name}}))}}}}),$t={name:pr,rule:Zi};import{ESLintUtils as Gi}from"@typescript-eslint/utils";var Ki=Gi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-commented-out-code",Qi=["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:"],eo=/^\s*return\s+/,to=/\w=("|'|`)/,no=/\w+:\s*('|"|`)/,ro=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,io=/\w+-\w+:/,oo=/\w+_\w+:/,so=/\?\s+\w/,ao=/:\s+\w/,lo=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,po=/^\s*\d+[,}]/,co=/^\s*\[[^\]]*\][,}]/,uo=/^\s*\{[^}]*\}[,}]/,fo=/\.\w+\(/,mo=/\[\w+\]/,yo=/^\s*(['"`]).+?\1\s*:/,go=/^<[A-Z]\w*(\s|>|\/)/,So=/^<[a-z]+(\s|>|\/)/,To=/<[A-Z]\w*(\s.*)?>/,Eo=/<\/[A-Z]\w*>/,ho=/<[a-z]+(\s.*)?>/,bo=/<\/[a-z]+>/,xo=/^\s*[*\s]*$/,Co=/^[a-zA-Z]/,Io=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ao=/```[\s\S]*?```/g,wo=/`[^`]*`/g,cr=/[a-zA-Z0-9]/,Fo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Ro=/[{}[\]()`=<>]/,vo=/:\s*(['"`[{(]|\w+\s*=>)/,ko=/\bif\s*\(|\belse\b|=>/,fe={returnStatement:eo,stringAssignment:to,objectPropertyWithQuotes:no,computedPropertyAssignment:ro,kebabCaseProperty:io,snakeCaseProperty:oo,ternaryOperator:so,colonWithWord:ao,quotedString:lo,numberWithComma:po,arrayWithComma:co,objectWithComma:uo,methodCall:fo,arrayAccess:mo,quotedPropertyKey:yo,jsxSelfClosing:go,jsxElement:So,jsxOpeningTag:To,jsxClosingTag:Eo,htmlOpeningTag:ho,htmlClosingTag:bo,jsdocComment:xo};function Po(e){if(e.includes(":")){let i=e.split(":")[0]?.trim();if(i&&Co.test(i)&&i.includes(" "))return!0}let t=e.trim();return t.length===0||Fo.test(t)||Ro.test(t)||vo.test(t)||ko.test(t)?!1:!!(t.includes(":")&&Io.test(t))}var Oo=[") {","return;",fe.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",fe.stringAssignment,");",fe.objectPropertyWithQuotes,fe.computedPropertyAssignment,fe.kebabCaseProperty,fe.snakeCaseProperty,"&&","||","()",fe.ternaryOperator,fe.colonWithWord,fe.quotedString,fe.numberWithComma,fe.arrayWithComma,fe.objectWithComma,fe.methodCall,fe.arrayAccess,"?.(","??","=>",fe.quotedPropertyKey],No=["/>","</",fe.jsxSelfClosing,fe.jsxElement,fe.jsxOpeningTag,fe.jsxClosingTag,fe.htmlOpeningTag,fe.htmlClosingTag],ur=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Do=Ki({name:fr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||fe.jsdocComment.test(n))return!1;for(let r of ur)if(a.startsWith(r))return!1;if(n.includes("https://")||Po(a))return!1;if(o==="Block"){for(let r of No)if(typeof r=="string"){if(n.includes(r))return{wrongPattern:r}}else if(r.test(n))return{wrongPattern:`regex(${r.toString()})`};return!1}for(let r of Qi)if(a.startsWith(r))return{wrongPattern:r};for(let r of Oo)if(typeof r=="string"){if(n.includes(r))return{wrongPattern:r}}else if(r.test(n))return{wrongPattern:`regex(${r.toString()})`};return!1}function i(n,o){let a=n,r=a.trim();if(r.startsWith("`")&&(r.endsWith("`,")||r.endsWith("`;")||r.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ao);p.some(f=>cr.test(f))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(wo);return s.some(p=>cr.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let r=i(a.value,a.type),s=t(r,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:ur.join(", ")}})}}}}}),Ut={name:fr,rule:Do};import{ESLintUtils as jo,TSESTree as Lo}from"@typescript-eslint/utils";var Mo=jo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-default-export",_o=Mo({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(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let i of t.specifiers)i.exported.type===Lo.AST_NODE_TYPES.Identifier&&i.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),zt={name:mr,rule:_o};import{ESLintUtils as $o}from"@typescript-eslint/utils";var Uo=$o.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-leaked-text-in-jsx",zo=[",",";","[","]","(",")"],Wo=Uo({name:yr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let i=t.value.trim();if(!i)return;let n="";zo.includes(i)?n=i:i.includes("&&")?n="&&":i.includes("||")?n="||":i.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Wt={name:yr,rule:Wo};import{AST_NODE_TYPES as ot,ESLintUtils as Jo}from"@typescript-eslint/utils";var Vo=Jo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="no-non-camel-case-functions",Xo=/^(\$?[a-z][a-zA-Z0-9]*)$/;function dr(e){if(e.typeName.type!==ot.TSQualifiedName)return!1;let{left:t,right:i}=e.typeName;return t.type===ot.Identifier&&t.name==="JSX"&&i.name==="Element"}var Bo=Vo({name:gr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Xo.test(t.id.name)){let i=t.returnType?.typeAnnotation;if(i&&(i.type===ot.TSTypeReference?dr(i):i.type===ot.TSUnionType&&i.types.some(o=>o.type===ot.TSTypeReference&&dr(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Jt={name:gr,rule:Bo};import{ESLintUtils as Ho,TSESTree as se}from"@typescript-eslint/utils";var Yo=Ho.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-optional-root-props",qo=Yo({name:Sr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let r=a.references[0];if(!r)return!1;for(let s of jt(r.identifier)){if("returnType"in s||s.type===se.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===se.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===se.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===se.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let u=Ge(l.parent.parent,se.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let f=gt(u,e.sourceCode);return f?!(f.parent.type===se.AST_NODE_TYPES.CallExpression&&f.parent.callee.type===se.AST_NODE_TYPES.Identifier&&f.parent.callee.name==="memo"):!1}if(s.type===se.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===se.AST_NODE_TYPES.ArrowFunctionExpression){let p=Ge(l,se.AST_NODE_TYPES.VariableDeclaration);return p?!!gt(p,e.sourceCode):!1}if(l.type===se.AST_NODE_TYPES.FunctionDeclaration)return!!gt(l,e.sourceCode)}return!1}function i(n){n.key.type!==se.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Ge(n,se.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let r=e.sourceCode.getText(a);return o.replaceText(a,r.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===se.AST_NODE_TYPES.TSTypeLiteral&&!(St(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===se.AST_NODE_TYPES.TSPropertySignature&&i(o)},TSInterfaceDeclaration(n){if(!(St(n)||!t(n)))for(let o of n.body.body)o.type===se.AST_NODE_TYPES.TSPropertySignature&&i(o)},TSTypeReference(n){if(n.typeName.type!==se.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==se.AST_NODE_TYPES.TSTypeLiteral)return;let a=Ge(n.parent,se.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let r=gt(a,e.sourceCode);if(!(!r||r.parent.type===se.AST_NODE_TYPES.CallExpression&&r.parent.callee.type===se.AST_NODE_TYPES.Identifier&&r.parent.callee.name==="memo"))for(let l of o.members)l.type===se.AST_NODE_TYPES.TSPropertySignature&&i(l)}}}});function St(e){return e?e.parent?.type===se.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===se.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function gt(e,t){if(St(e))return;let i;if(e.type===se.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===se.AST_NODE_TYPES.Identifier&&(i=e.declarations[0].id)}else{if(!e.id)return;i=e.id}if(!i)return;let n=t.getScope(e);e.type===se.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(r=>r.identifiers.includes(i));if(!o)return;let a=o.references.filter(r=>r.identifier!==i);if(!(a.length!==1||!a[0])&&!St(a[0].identifier.parent.parent))return a[0].identifier}var Vt={name:Sr,rule:qo};import{AST_NODE_TYPES as Tt}from"@typescript-eslint/utils";var st=V({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function i(n){return n?n.type===Tt.Identifier?t.has(n.name):n.type===Tt.MemberExpression?i(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===Tt.VariableDeclaration)for(let o of n.declaration.declarations)i(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===Tt.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});import{ESLintUtils as Zo}from"@typescript-eslint/utils";import Xt from"path";import{z as Ve}from"zod/v4";var Go=Zo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-relative-imports",Ko=Ve.object({find:Ve.string(),replacement:Ve.string()}),Qo=Ve.object({aliases:Ve.array(Ko),rootDir:Ve.string().optional(),allowNotFoundAliases:Ve.boolean().optional(),_dev_simulateFileName:Ve.string().optional()}),es=Go({name:Tr,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:[$(Qo)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let i=t._dev_simulateFileName??e.filename;function n(r){return r.startsWith(".")||r.startsWith("..")}function o(r,s){let l=Xt.dirname(s);return Xt.resolve(l,r)}function a(r){let s=t.rootDir??process.cwd(),l=Xt.relative(s,r);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:u}of t.aliases)if(l.startsWith(u)){let f=l.replace(u,p);return{alias:p,newPath:f}}return null}return{ImportDeclaration(r){let s=r.source.value;if(!n(s))return;let l=o(s,i),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:r,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?u=>u.replaceText(r.source,`'${p.newPath}'`):void 0})}}}}),Bt={name:Tr,rule:es};import{AST_NODE_TYPES as me}from"@typescript-eslint/utils";import{z as Er}from"zod/v4";var ts=Er.object({customMessage:Er.string().optional()}),Ht=V({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(ts)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function i(n){switch(n.type){case me.Literal:return!0;case me.ObjectExpression:return n.properties.every(o=>o.type===me.Property?o.computed||o.value.type===me.Identifier&&o.key.type===me.Identifier&&o.key.name===o.value.name?!1:i(o.value):!1);case me.ArrayExpression:return n.elements.every(o=>o?o.type===me.SpreadElement?!1:i(o):!0);case me.TemplateLiteral:return n.expressions.length===0;case me.ConditionalExpression:case me.LogicalExpression:case me.BinaryExpression:case me.UnaryExpression:case me.CallExpression:case me.MemberExpression:case me.Identifier:case me.ArrowFunctionExpression:case me.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===me.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===me.JSXExpressionContainer?n.value.expression.type!==me.JSXEmptyExpression&&(o=n.value.expression):n.value.type===me.Literal&&(o=n.value),o&&i(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as Et}from"@typescript-eslint/utils";import*as He from"zod/v4";var ns=He.object({alternativeMsgs:He.object({inArrayFind:He.string().optional(),inArrayFilter:He.string().optional()}).optional(),__dev_simulateFileName:He.string().optional()});function rs(e){return e.typeAnnotation.type!==Et.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var is=/(typeGuards|type-guards)\.(ts|tsx)$/;function os(e){return is.test(e)}function ss(e){let t=e.parent;for(;t;){if(t.type===Et.CallExpression&&t.callee.type===Et.MemberExpression&&t.callee.property.type===Et.Identifier){let i=t.callee.property.name;if(i==="filter"||i==="find")return{method:i}}t=t.parent}return null}var Yt=V({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[$(ns)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let i=t.__dev_simulateFileName??e.filename;if(os(i))return{};function n(o){if(!rs(o))return;let a=ss(o);if(t.alternativeMsgs&&a){let r=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(r){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:r}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});import{AST_NODE_TYPES as et}from"@typescript-eslint/utils";var as="no-unnecessary-async-on-jsx-props";function ls(e){if(e.body.type!==et.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let i=t[0];return!i||i.type!==et.ExpressionStatement?!1:i.expression.type===et.AwaitExpression}var qt=V({name:as,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(i){ls(i)&&e.report({node:i,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],r=o.getFirstToken(i,l=>l.value==="async");if(r){let l=o.getTokenAfter(r);l?a.push(n.replaceTextRange([r.range[0],l.range[0]],"")):a.push(n.remove(r))}function s(l){if(l.type===et.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let u=o.getTokenAfter(p);u?a.push(n.replaceTextRange([p.range[0],u.range[0]],"")):a.push(n.remove(p))}}if(l.type===et.BlockStatement)for(let p of l.body)s(p);else l.type===et.ExpressionStatement&&s(l.expression)}return s(i.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});import{AST_NODE_TYPES as at,ESLintUtils as br}from"@typescript-eslint/utils";import*as Zt from"typescript";import lt from"zod/v4";var ps=br.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-unnecessary-casting",cs=lt.object({additionalCastFunctions:lt.array(lt.object({name:lt.string(),expectedType:lt.enum(["string","number"])})).optional()}),Gt={name:hr,rule:ps({name:hr,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:[$(cs)],fixable:"code"},defaultOptions:[{}],create(e){let i=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...i],o=br.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function r(u,f){switch(u.type){case at.Literal:return f==="number"?typeof u.value=="number":typeof u.value=="string";case at.TemplateLiteral:return f==="string";case at.UnaryExpression:return f==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function s(u,f){return f==="number"?!!(u.flags&Zt.TypeFlags.NumberLike):!!(u.flags&Zt.TypeFlags.StringLike)}function l(u,f){return y=>y.replaceText(u,e.sourceCode.getText(f))}function p(u){if(!a||u.arguments.length!==1)return;let f=u.arguments[0];if(!f||f.type===at.SpreadElement)return;let{callee:y}=u;if(y.type!==at.Identifier)return;let h=y.name,m=n.find(C=>C.name===h);if(!m)return;if(r(f,m.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(f)),m.expectedType)){let C,T;h==="Number"?C="unnecessaryNumberCasting":h==="String"?C="unnecessaryStringCasting":(C="unnecessaryCustomCasting",T={name:m.name,type:m.expectedType}),e.report({node:u,messageId:C,...T?{data:T}:{},fix:l(u,f)})}}return{CallExpression:p}}})};import{AST_NODE_TYPES as Re}from"@typescript-eslint/utils";import*as ht from"zod/v4";var us=ht.object({ignoreWithDescription:ht.string().optional()}),Kt=V({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:[$(us)]},defaultOptions:[{}],create(e,[t]){let i=e.getSourceCode(),n=i.ast;function o(l){let p=l.arguments[0];return p&&p.type===Re.Literal&&typeof p.value=="string"?p.value:null}function a(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function r(l){return l.length!==1?!1:n.body.filter(u=>{if(u.type===Re.ExpressionStatement){let f=u.expression;if(f.type===Re.CallExpression&&f.callee.type===Re.Identifier){let y=f.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function s(l){let p=l.arguments[1];if(p&&(p.type===Re.FunctionExpression||p.type===Re.ArrowFunctionExpression)&&p.body.type===Re.BlockStatement){let u=p.body.body;return u.length===0?"":u.map(y=>i.text.slice(y.range[0],y.range[1])).join(`
16
16
 
17
- `)}return""}return{Program(){let a=[];for(let y of n.body)y.type===Re.ExpressionStatement&&y.expression.type===Re.CallExpression&&y.expression.callee.type===Re.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&a.push(y.expression);if(!i(a))return;let[l]=a;if(!l)return;let u=o(l);if(p(u))return;let f=n.body.find(y=>y.type===Re.ExpressionStatement&&y.expression===l);!f||f.type!==Re.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let x=s(l);return x?y.replaceText(f,x):null}}]})}}}});import{AST_NODE_TYPES as Et}from"@typescript-eslint/utils";import*as je from"zod/v4";var ds=je.object({methods:je.union([je.array(je.string()),je.literal("array")])}),Kt=V({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[$(ds)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function p(s){let{callee:a}=s;if(a.type===Et.MemberExpression){let l=a.property;if(l.type===Et.Identifier)return l.name}return null}function i(s,a){if(s.type!==Et.Identifier||!s.typeAnnotation)return;let l=a.parent;if(l.type===Et.CallExpression){let u=p(l);u&&o(u)&&l.arguments.indexOf(a)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return s.typeAnnotation?y.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let a of s.params)i(a,s)},FunctionExpression(s){for(let a of s.params)i(a,s)}}}});import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";var Qt=V({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===we.ObjectPattern||!t.init||t.init.type!==we.ObjectExpression||t.id.type===we.Identifier&&t.id.typeAnnotation||t.parent.parent.type===we.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===we.Property&&i.key.type===we.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==we.Identifier)return;let n=gs(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==we.Property?!1:i.value.type===we.FunctionExpression),p=new Set;for(let i of n){if(i.identifier.parent.type!==we.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===we.Literal&&typeof s.property.value=="string")p.add(s.property.value);else return;else{if(s.property.type!==we.Identifier)return;p.add(s.property.name)}if(s.parent.type===we.CallExpression&&o)return}for(let[i,s]of r)p.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function gs(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as xr}from"zod/v4";var Ss=xr.object({ignoreArgsMatching:xr.string().optional()}),en=V({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:[$(Ss)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function o(i){return i.type===te.ExportNamedDeclaration||i.type===te.ExportDefaultDeclaration||i.parent?.type===te.ExportNamedDeclaration||i.parent?.type===te.ExportDefaultDeclaration}function p(i){let s=[];for(let a=0;a<i.length;a++){let l=i[a];if(!l||l.type!==te.Identifier)continue;let u=l.name;if(!n(u)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let f=l.typeAnnotation.typeAnnotation,y=[];for(let x of f.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)?s.push({param:l,index:a,name:u,isObjectParam:!0,objectProps:y}):s.push({param:l,index:a,name:u,isObjectParam:!1})}else if(l.optional)s.push({param:l,index:a,name:u,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let f=l.typeAnnotation.typeAnnotation,y=[];for(let x of f.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)&&s.push({param:l,index:a,name:u,isObjectParam:!0,objectProps:y})}}}return s}return{FunctionDeclaration(i){if(o(i))return;let s=p(i.params);s.length!==0&&r.push({node:i,declarationNode:i,optionalParams:s})},VariableDeclarator(i){if(i.id.type!==te.Identifier||!i.init||i.init.type!==te.ArrowFunctionExpression&&i.init.type!==te.FunctionExpression||o(i.parent.parent))return;let a=[...p(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let l=i.id.typeAnnotation.typeAnnotation;if(l.typeName.type===te.Identifier&&l.typeName.name==="FC"){let u=l.typeArguments;if(u&&u.params.length===1){let f=u.params[0];if(f&&f.type===te.TSTypeLiteral){let y=[];for(let x of f.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&y.push({name:x.key.name,optional:x.optional===!0});y.some(x=>x.optional)&&a.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}a.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:a})},"Program:exit"(){for(let i of r){let a=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!a)continue;let l=a.references.filter(y=>y.identifier!==a.identifiers[0]);if(l.length===0)continue;let u=!1;for(let y of l){let x=y.identifier.parent;if(x.type===te.CallExpression&&y.identifier.type===te.Identifier&&x.arguments.includes(y.identifier)){u=!0;break}if(x.type===te.ReturnStatement){u=!0;break}if(x.type===te.Property&&x.parent.type===te.ObjectExpression&&x.parent.parent.type===te.ReturnStatement){u=!0;break}if(x.type===te.JSXExpressionContainer){u=!0;break}}if(u)continue;let f=[];for(let y of l){let x=y.identifier.parent;if(x.type===te.CallExpression&&x.callee===y.identifier){let m=x.arguments.length,h=x.arguments.some(T=>T.type===te.SpreadElement);if(h){u=!0;break}let C={argCount:m,hasSpread:h};for(let T of i.optionalParams)if(T.isObjectParam&&T.index<m){let I=x.arguments[T.index];if(I?.type===te.ObjectExpression){let A={};for(let S of I.properties)S.type===te.Property&&S.key.type===te.Identifier&&(A[S.key.name]=!0);C.objectArgs||(C.objectArgs=[]),C.objectArgs[T.index]=A}else if(I){u=!0;break}}f.push(C)}else if(x.type===te.JSXOpeningElement&&x.name===y.identifier){let m=x.attributes.some(C=>C.type===te.JSXSpreadAttribute);if(m){u=!0;break}let h={argCount:1,hasSpread:m};for(let C of i.optionalParams)if(C.isObjectParam&&C.index===0){let T={};for(let I of x.attributes)I.type===te.JSXAttribute&&I.name.type===te.JSXIdentifier&&(T[I.name.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[0]=T}f.push(h)}}if(!(u||f.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let x of y.objectProps){if(!x.optional)continue;let m=!1;for(let h of f)if(h.objectArgs&&h.objectArgs[y.index]){let C=h.objectArgs[y.index];if(C&&C[x.name]){m=!0;break}}m||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:x.name}})}else{let x=!1;for(let m of f)if(m.argCount>y.index){x=!0;break}x||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});import{AST_NODE_TYPES as le,ESLintUtils as Ts}from"@typescript-eslint/utils";import{z as He}from"zod/v4";var Es=He.object({selectors:He.array(He.object({name:He.string(),selectorProp:He.string().optional(),selectorArgPos:He.number().optional(),returnProp:He.string().optional()}))}),hs=Ts.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-unused-selected-values",tn={name:Cr,rule:hs({name:Cr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(Es)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let p=null;if(o.init?.type===le.CallExpression&&(p=o.init),!p)return;let i=xs(p);if(!i)return;let s=n.get(i);if(!s)return;let a=bs(p,s.selectorArgPos??0,s.selectorProp);if(!a)return;let l=Cs(a);if(!l)return;let u=Ir(l.properties,void 0);if(!u)return;if(o.id.type===le.ObjectPattern){let x=Ir(o.id.properties,s.returnProp);if(!x)return;for(let[m,h]of u)x.has(m)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==le.Identifier||s.returnProp)return;let f=Is(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let x of f){if(x.identifier.parent.type!==le.MemberExpression)return;let m=x.identifier.parent.property;if(m.type!==le.Identifier)return;y.add(m.name)}for(let[x,m]of u)y.has(x)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:x}})}}}})};function bs(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===le.ArrowFunctionExpression||n.type===le.FunctionExpression)return n;if(r&&n.type===le.ObjectExpression){let o=n.properties.find(i=>i.type===le.Property&&i.key.type===le.Identifier&&i.key.name===r);if(o?.type!==le.Property)return null;let p=o.value;if(p.type===le.ArrowFunctionExpression||p.type===le.FunctionExpression)return p}return null}function xs(e){return e.callee.type===le.Identifier?e.callee.name:e.callee.type===le.MemberExpression&&e.callee.property.type===le.Identifier?e.callee.property.name:null}function Cs(e){if(e.body.type===le.ObjectExpression)return e.body;if(e.body.type===le.BlockStatement){let t=e.body.body.filter(r=>r.type===le.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==le.ObjectExpression?null:t[0].argument}return null}function Ir(e,t){let r=e;if(t){let o=e.find(p=>p.type===le.Property&&p.key.type===le.Identifier&&p.key.name===t);if(o?.type!==le.Property||o.value.type!==le.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==le.Property||o.key.type!==le.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function Is(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var nn=V({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(p=>p.type===ae.ImportDeclaration&&p.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(p){if(o)return;if(!n){let s=As(p);s&&(n=s);return}let i=ws(p,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,a]of n)e.report({node:a,messageId:"unusedField",data:{name:s}})}}}}});function As(e){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ae.ObjectExpression)return null;let n=Dt(r.properties,p=>p.type!==ae.Property||p.key.type!==ae.Identifier||p.key.name!=="initialConfig"?null:p.value.type===ae.ObjectExpression?p.value:p.value.type===ae.ArrowFunctionExpression||p.value.type===ae.FunctionExpression?Fs(p.value):null);if(!n)return null;let o=new Map;for(let p of n.properties)p.type===ae.Property&&p.key.type===ae.Identifier&&o.set(p.key.name,p);return o}function ws(e,t){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ae.VariableDeclarator||e.parent.id.type!==ae.ObjectPattern||!Dt(e.parent.id.properties,i=>i.type===ae.Property&&i.key.type===ae.Identifier&&i.key.name==="formFields"&&i))return null;let o=rr(e.parent,"formFields",t),p=new Set;for(let{identifier:i}of o){if(i.type!==ae.Identifier||i.parent.type===ae.Property&&i.parent.parent.type===ae.ObjectExpression&&i.parent.parent.parent.type===ae.ReturnStatement||i.parent.type===ae.ReturnStatement)return null;if(i.parent.type===ae.MemberExpression){if(i.parent.object.type!==ae.Identifier||i.parent.property.type!==ae.Identifier)return null;p.add(i.parent.property.name)}}return p}function Fs(e){if(e.body.type===ae.ObjectExpression)return e.body;if(e.body.type===ae.BlockStatement){let t=e.body.body.filter(r=>r.type===ae.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ae.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as ie,ESLintUtils as Rs}from"@typescript-eslint/utils";import{z as ht}from"zod/v4";var vs=Rs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ar(e){let t=[];for(let r of e.members)r.type===ie.TSPropertySignature&&r.key.type===ie.Identifier&&t.push([r.key.name,r]);return t}function wr(e,...t){for(let r of t)e.set(...r);return e}var ks=ht.object({forceCheckOnFCPropTypesWithName:ht.array(ht.string()).optional(),alwaysCheckFunctionOptionTypes:ht.boolean().optional()}),Fr="no-unused-type-props-in-args",rn=null,Ps=vs({name:Fr,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:[$(ks)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!rn&&(rn=r.map(a=>new RegExp(a)));function o(a,l,u,f,y=!0,x=!1){let m=u.name,h=e.sourceCode.getScope(l).references.find(S=>S.identifier.name===m)?.resolved,C=a&&rn?.some(S=>S.test(m)),T=x&&n;if(!h||!C&&h.references.filter(S=>S.isTypeReference).length>1||!h.defs[0])return;let I=h.defs[0].node,A=I.parent?.type===ie.ExportNamedDeclaration;if(!(y&&A&&!T)){if(I.type===ie.TSTypeAliasDeclaration){p(a,l,f,I.typeAnnotation,!0,x);return}if(I.type===ie.TSInterfaceDeclaration){p(a,l,f,I.body,!0,x);return}}}function p(a,l,u,f,y,x=!1){if(f.type===ie.TSInterfaceBody){for(let m of f.body)m.type===ie.TSPropertySignature&&m.key.type===ie.Identifier&&u.set(m.key.name,m);return}if(f.type===ie.TSTypeLiteral){wr(u,...Ar(f));return}if(f.type===ie.TSIntersectionType){for(let m of f.types)p(a,l,u,m,!0,x);return}y||f.type===ie.TSTypeReference&&f.typeName.type===ie.Identifier&&o(a,l,f.typeName,u,!0,x)}function i(a,l,u,f=!1){for(let y of u)if(y.type===ie.ObjectPattern&&y.typeAnnotation){let x=new Map;if(p(a,l,x,y.typeAnnotation.typeAnnotation,!1,f),x.size===0)continue;s(y,x)}else y.type===ie.AssignmentPattern&&y.left.type===ie.ObjectPattern&&i(a,l,[y.left],f)}function s(a,l){let u=[];if(a.properties.at(-1)?.type===ie.RestElement)return;for(let m of a.properties)m.type===ie.Property&&m.key.type===ie.Identifier&&u.push(m.key.name);let y=[],x=[];for(let[m,h]of l)u.includes(m)||(x.push(m),y.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,h]of y.entries())e.report({...h,fix:m===y.length-1?C=>{let T=a.properties.at(-1),I=x.join(", ");return T?T.type===ie.RestElement?null:C.insertTextAfter(T,`, ${I}`):C.insertTextBeforeRange([a.range[0]+1,a.range[1]],I)}:void 0})}return{VariableDeclaration(a){let l=a.declarations[0],u=new Map,f=l.id.type===ie.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===ie.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===ie.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(f){if(f.type===ie.TSTypeReference&&f.typeName.type===ie.Identifier)o(!0,a,f.typeName,u,!1);else if(f.type===ie.TSTypeLiteral)wr(u,...Ar(f));else if(f.type===ie.TSIntersectionType)for(let y of f.types)y.type===ie.TSTypeReference&&y.typeName.type===ie.Identifier?o(!0,a,y.typeName,u,!1):p(!0,a,u,y,!0);if(u.size!==0&&l.init?.type===ie.ArrowFunctionExpression){let y=l.init.params[0];if(!y){e.report({node:l.init,messageId:"missingComponentParam"});return}y.type===ie.ObjectPattern&&s(y,u)}}},FunctionDeclaration(a){i(!1,a,a.params,n)},ArrowFunctionExpression(a){i(!1,a,a.params,n)}}}}),on={name:Fr,rule:Ps};import{AST_NODE_TYPES as Ne}from"@typescript-eslint/utils";var sn=V({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===Ne.Identifier?t.has(n.callee.name):n.callee.type===Ne.MemberExpression&&n.callee.object.type===Ne.Identifier&&n.callee.property.type===Ne.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===Ne.ImportSpecifier&&o.imported.type===Ne.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Ne.CallExpression&&r(n.init)&&n.id.type===Ne.Identifier){let p=e.sourceCode.getScope(n).set.get(n.id.name);if(p){let i=!1;for(let s of p.references){let l=s.identifier.parent;if(l!==n&&!(l.type===Ne.JSXExpressionContainer&&l.parent.type===Ne.JSXAttribute&&l.parent.name.type===Ne.JSXIdentifier&&l.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as an,ESLintUtils as Os}from"@typescript-eslint/utils";var Ns=Os.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="prefer-named-functions",Rr=new Map,Ds=Ns({name:vr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=Rr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Rr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===an.ArrowFunctionExpression&&n.id.type===an.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==an.BlockStatement)return;let p=n.parent,i=n.init.params,s=n.init.body,a=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(p,`${a.async?"async ":""}function ${o}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),ln={name:vr,rule:Ds};import{AST_NODE_TYPES as Q}from"@typescript-eslint/utils";import{z as $e}from"zod/v4";var js=$e.object({disallowedFunctions:$e.array($e.object({name:$e.string(),allowUsingWithArgs:$e.boolean().optional(),hookAlternative:$e.string().optional(),message:$e.string().optional(),allowUseInside:$e.array($e.string()).optional()}))}),Ls=/^use[A-Z]/,Ms=/^[A-Z]/;function bt(e){return Ls.test(e)}function kr(e){return Ms.test(e)}function _s(e){return e.type===Q.Identifier?bt(e.name):e.type===Q.MemberExpression&&e.property.type===Q.Identifier?bt(e.property.name):!1}function Pr(e,t){return e.type===Q.Identifier?e.name===t:e.type===Q.MemberExpression&&e.object.type===Q.Identifier&&e.property.type===Q.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Or(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Pr(e.parent.callee,"forwardRef"))}function Nr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Pr(e.parent.callee,"memo"))}function pn(e){if(e.type===Q.FunctionDeclaration||e.type===Q.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.FunctionExpression||e.type===Q.ArrowFunctionExpression){if(e.parent.type===Q.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function $s(e){let t=e.parent,r=!1;for(;t;){if(t.type===Q.FunctionDeclaration||t.type===Q.FunctionExpression||t.type===Q.ArrowFunctionExpression){let n=pn(t);if(n&&n.type===Q.Identifier){if(kr(n.name)||bt(n.name))return!r;r=!0}else{if(Or(t)||Nr(t))return!r;if(t.parent.type===Q.CallExpression){let o=t.parent;_s(o.callee)||(r=!0)}else t.parent.type===Q.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Dr(e){return e.callee.type===Q.Identifier?e.callee.name:e.callee.type===Q.MemberExpression&&e.callee.property.type===Q.Identifier?e.callee.property.name:null}function Us(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.FunctionDeclaration||r.type===Q.FunctionExpression||r.type===Q.ArrowFunctionExpression){let n=pn(r);if(n&&n.type===Q.Identifier&&t.includes(n.name))return!0}else if(r.type===Q.CallExpression){let n=Dr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function zs(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.Identifier&&t.name==="undefined")}function Ws(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===Q.FunctionDeclaration||n.type===Q.FunctionExpression||n.type===Q.ArrowFunctionExpression){let o=pn(n);if(o&&o.type===Q.Identifier){if(kr(o.name)||bt(o.name)){r=!0;break}}else if(Or(n)||Nr(n)){r=!0;break}}n=n.parent}return r?t.length===0?$s(e):!Us(e,t):!1}var cn=V({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[$(js)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let p=Dr(o);if(!p)return;let i=n.get(p);if(!i||i.allowUsingWithArgs&&zs(o))return;let s=i.allowUseInside||[];Ws(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:a=>{let l=i.hookAlternative;return l?o.callee.type===Q.Identifier?a.replaceText(o.callee,l):o.callee.type===Q.MemberExpression&&o.callee.property.type===Q.Identifier?a.replaceText(o.callee.property,l):null:null}}]:[]})}}}});import{AST_NODE_TYPES as de,AST_TOKEN_TYPES as jr,ESLintUtils as Js}from"@typescript-eslint/utils";import un from"zod/v4";var Vs=Js.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="prefer-single-line-if",Xs=un.object({maxLineLength:un.number().optional(),maxNonSimpleConditionLength:un.number().optional()}),Bs=Vs({name:Mr,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:[$(Xs)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==de.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let p=n.consequent.body[0];if(!p)return;if(p.type===de.ReturnStatement){if(!$r(p))return}else if(!(p.type===de.ContinueStatement||p.type===de.BreakStatement))return;if(n.test.type===de.LogicalExpression||n.test.type===de.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let f=Lr(n.test);if(!f&&n.test.type===de.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Lr(y)&&(f=!0)}if(f&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(p);if(i.includes(`
18
- `))return;let a=r.getTokenAfter(n);if(a&&a.type===jr.Punctuator&&a.value==="}"){let f=r.getTokenAfter(a);if(f&&f.type===jr.Keyword&&(f.value==="else"||f.value==="catch"))return}let l=Hs(r,n),u=`if (${i}) ${s}`;t.maxLineLength&&u.length+l.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,u)})}}}});function Lr(e){return e.type===de.CallExpression||e.type===de.BinaryExpression||e.type===de.MemberExpression&&_r(e)}function _r(e){return e.object.type===de.MemberExpression?_r(e.object):e.object.type!==de.Identifier}function Hs(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function $r(e){if(!e.argument)return!0;let t=e.argument;return t.type===de.ArrayExpression&&t.elements.length===0||t.type===de.ObjectExpression&&t.properties.length===0||t.type===de.Literal||t.type===de.Identifier||t.type===de.TemplateLiteral||t.type===de.TaggedTemplateExpression?!0:t.type===de.CallExpression?t.arguments.length===0:t.type===de.UnaryExpression?$r(t):!1}var fn={name:Mr,rule:Bs};import{AST_NODE_TYPES as j,ESLintUtils as Ys}from"@typescript-eslint/utils";import{z as Ur}from"zod/v4";var qs=Ys.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xr="react-compiler-extra",Zs=Ur.object({runOnlyWithEnableCompilerDirective:Ur.boolean().optional()}),Gs=/eslint +react-compiler\/react-compiler: +\["error/;function Qe(e){let t=null;if((e.type===j.FunctionDeclaration||e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression&&e.body.type===j.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===j.ExpressionStatement&&r.expression.type===j.Literal&&r.expression.value==="use no memo":!1}function zr(e){let t=e.parent;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression)return t;t=t.parent}return null}function Ks(e){return e.type===j.Identifier?e.name.startsWith("use"):!1}function Br(e){return e.type===j.Identifier?e.name.startsWith("use"):e.type===j.MemberExpression&&e.property.type===j.Identifier?e.property.name.startsWith("use"):!1}function Le(e){if(!e)return!1;switch(e.type){case j.JSXElement:case j.JSXFragment:return!0;case j.ConditionalExpression:return Le(e.consequent)||Le(e.alternate);case j.LogicalExpression:return e.operator==="&&"?Le(e.right):e.operator==="||"?Le(e.left)||Le(e.right):!1;case j.CallExpression:if(e.callee.type===j.MemberExpression&&e.callee.object.type===j.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===j.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==j.SpreadElement&&Le(t))return!0;return!1;default:return!1}}function Qs(e){let t=e.typeAnnotation;if(t.type===j.TSTypeReference){if(t.typeName.type===j.Identifier)return t.typeName.name==="FC";if(t.typeName.type===j.TSQualifiedName&&t.typeName.left.type===j.Identifier&&t.typeName.right.type===j.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var ea=/^[A-Z][a-zA-Z0-9]*$/;function lt(e){return ea.test(e)}function xt(e){return e.startsWith("use")&&e.length>3}function yn(e,t,r,n){if(r&&Qs(r))return t?lt(t.name):e.type===j.FunctionDeclaration&&e.id?lt(e.id.name):!0;if(t&&xt(t.name)||e.type===j.FunctionDeclaration&&e.id&&xt(e.id.name))return!0;if(n){let o=t?.name||e.type===j.FunctionDeclaration&&e.id?.name;if(o&&lt(o)&&Hr(e.body,n).containsJSX)return!0}return!1}function at(e){if(e.body.type===j.BlockStatement){for(let t of e.body.body)if(t.type===j.ExpressionStatement&&t.expression.type===j.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Hr(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Oe(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case j.JSXElement:case j.JSXFragment:r.containsJSX=!0;break;case j.CallExpression:Ks(n.callee)&&(r.containsHookCalls=!0),Le(n)&&(r.containsJSX=!0);break;case j.ReturnStatement:n.argument&&Le(n.argument)&&(r.containsJSX=!0);break;case j.VariableDeclarator:n.init&&Le(n.init)&&(r.containsJSX=!0);break;case j.AssignmentExpression:Le(n.right)&&(r.containsJSX=!0);break}},t),r}function Wr(e,t){let r=e.body,n=Hr(r,t);return n.containsJSX||n.containsHookCalls}var ta=/\bthis[.[]/;function Jr(e){return ta.test(e)}function na(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Oe(e,n=>{if(r.containsHookCalls||(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression)&&n!==e)return!0;n.type===j.CallExpression&&Br(n.callee)&&(r.containsHookCalls=!0)},t),r}function Vr(e){return lt(e)||xt(e)}function mn(e,t,r,n){if(!na(e.body,t).containsHookCalls)return!1;let p=yn(e,r,n,t);if(!p&&n){let i=r?.name||e.type===j.FunctionDeclaration&&e.id?.name;i&&lt(i)&&(p=!0)}return!p}var ra=qs({name:Xr,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:[$(Zs)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let i of e.sourceCode.getAllComments())if(Gs.test(i.value)){r=!0;break}if(!r)return{}}function n(i){for(let s of i.properties)if(s.type===j.Property&&s.method&&s.value.type===j.FunctionExpression){let a=e.sourceCode,l=a.getText(s.key),u=s.value,f=a.getText(u.body);if(Jr(f))e.report({node:s,messageId:"thisKeywordInMethod"});else{let y=u.params.map(m=>a.getText(m)).join(", "),x="";u.generator?x=`${l}: function* (${y}) ${f}`:u.async?x=`${l}: async (${y}) => ${f}`:x=`${l}: (${y}) => ${f}`,e.report({node:s,messageId:"objectMethodIsNotSupported",fix:m=>m.replaceText(s,x)})}}}function o(i){for(let s of i.properties)if(s.type===j.Property&&s.value.type===j.ObjectExpression){for(let a of s.value.properties)if(a.type===j.Property&&a.method&&a.value.type===j.FunctionExpression){let u=e.sourceCode.getText(a.value.body);Jr(u)&&e.report({node:a,messageId:"thisKeywordInMethod"})}}}function p(i){let s=zr(i);return s!==null&&Qe(s)}return{CallExpression(i){if(Br(i.callee))for(let s of i.arguments){if(s.type===j.ObjectExpression){if(p(i))return;n(s),o(s)}if(s.type===j.ArrowFunctionExpression){if(s.body.type===j.ObjectExpression){if(p(i))return;n(s.body),o(s.body)}if(s.body.type===j.BlockStatement){for(let a of s.body.body)if(a.type===j.ReturnStatement&&a.argument?.type===j.ObjectExpression){if(p(i))return;n(a.argument),o(a.argument)}}}if(s.type===j.FunctionExpression){for(let a of s.body.body)if(a.type===j.ReturnStatement&&a.argument?.type===j.ObjectExpression){if(p(i))return;n(a.argument),o(a.argument)}}}},VariableDeclarator(i){if(i.id.type===j.Identifier&&i.init&&(i.init.type===j.ArrowFunctionExpression||i.init.type===j.FunctionExpression)){let s=i.init,a=i.id,l=i.id.typeAnnotation;if(at(s)&&!Vr(a.name)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}if(mn(s,e.sourceCode,a,l)){if(Qe(s))return;e.report({node:s,messageId:"functionCallingHooksMustBeComponent"});return}if(yn(s,a,l,e.sourceCode)){let u=Wr(s,e.sourceCode),f=at(s);if(!u&&!f){if(Qe(s))return;e.report({node:s,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(y){if(s.body.type===j.BlockStatement){let x=s.body.range[0]+1;return y.insertTextAfterRange([x,x],`
17
+ `)}return""}return{Program(){let l=[];for(let y of n.body)y.type===Re.ExpressionStatement&&y.expression.type===Re.CallExpression&&y.expression.callee.type===Re.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&l.push(y.expression);if(!r(l))return;let[p]=l;if(!p)return;let u=o(p);if(a(u))return;let f=n.body.find(y=>y.type===Re.ExpressionStatement&&y.expression===p);!f||f.type!==Re.ExpressionStatement||e.report({node:p,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let h=s(p);return h?y.replaceText(f,h):null}}]})}}}});import{AST_NODE_TYPES as bt}from"@typescript-eslint/utils";import*as je from"zod/v4";var fs=je.object({methods:je.union([je.array(je.string()),je.literal("array")])}),Qt=V({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[$(fs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let i=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(i)?i.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===bt.MemberExpression){let p=l.property;if(p.type===bt.Identifier)return p.name}return null}function r(s,l){if(s.type!==bt.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===bt.CallExpression){let u=a(p);u&&o(u)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return s.typeAnnotation?y.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)r(l,s)},FunctionExpression(s){for(let l of s.params)r(l,s)}}}});import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";var en=V({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===we.ObjectPattern||!t.init||t.init.type!==we.ObjectExpression||t.id.type===we.Identifier&&t.id.typeAnnotation||t.parent.parent.type===we.ExportNamedDeclaration)return;let i=new Map;for(let r of t.init.properties)r.type===we.Property&&r.key.type===we.Identifier&&i.set(r.key.name,r);if(i.size===0||t.id.type!==we.Identifier)return;let n=ms(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(r=>r.type!==we.Property?!1:r.value.type===we.FunctionExpression),a=new Set;for(let r of n){if(r.identifier.parent.type!==we.MemberExpression)return;let s=r.identifier.parent;if(s.object!==r.identifier)return;if(s.computed)if(s.property.type===we.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==we.Identifier)return;a.add(s.property.name)}if(s.parent.type===we.CallExpression&&o)return}for(let[r,s]of i)a.has(r)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:r}})}}}});function ms(e,t){let i=t.getDeclaredVariables(e);if(i.length!==1)return[];let n=i[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as xr}from"zod/v4";var ys=xr.object({ignoreArgsMatching:xr.string().optional()}),tn=V({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:[$(ys)]},defaultOptions:[{}],create(e,[t]){let i=[];function n(r){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(r):!1}function o(r){return r.type===te.ExportNamedDeclaration||r.type===te.ExportDefaultDeclaration||r.parent?.type===te.ExportNamedDeclaration||r.parent?.type===te.ExportDefaultDeclaration}function a(r){let s=[];for(let l=0;l<r.length;l++){let p=r[l];if(!p||p.type!==te.Identifier)continue;let u=p.name;if(!n(u)){if(p.optional&&p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let f=p.typeAnnotation.typeAnnotation,y=[];for(let h of f.members)h.type===te.TSPropertySignature&&h.key.type===te.Identifier&&y.push({name:h.key.name,optional:h.optional===!0});y.some(h=>h.optional)?s.push({param:p,index:l,name:u,isObjectParam:!0,objectProps:y}):s.push({param:p,index:l,name:u,isObjectParam:!1})}else if(p.optional)s.push({param:p,index:l,name:u,isObjectParam:!1});else if(p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let f=p.typeAnnotation.typeAnnotation,y=[];for(let h of f.members)h.type===te.TSPropertySignature&&h.key.type===te.Identifier&&y.push({name:h.key.name,optional:h.optional===!0});y.some(h=>h.optional)&&s.push({param:p,index:l,name:u,isObjectParam:!0,objectProps:y})}}}return s}return{FunctionDeclaration(r){if(o(r))return;let s=a(r.params);s.length!==0&&i.push({node:r,declarationNode:r,optionalParams:s})},VariableDeclarator(r){if(r.id.type!==te.Identifier||!r.init||r.init.type!==te.ArrowFunctionExpression&&r.init.type!==te.FunctionExpression||o(r.parent.parent))return;let l=[...a(r.init.params)];if(r.id.typeAnnotation&&r.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let p=r.id.typeAnnotation.typeAnnotation;if(p.typeName.type===te.Identifier&&p.typeName.name==="FC"){let u=p.typeArguments;if(u&&u.params.length===1){let f=u.params[0];if(f&&f.type===te.TSTypeLiteral){let y=[];for(let h of f.members)h.type===te.TSPropertySignature&&h.key.type===te.Identifier&&y.push({name:h.key.name,optional:h.optional===!0});y.some(h=>h.optional)&&l.push({param:r.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}l.length!==0&&i.push({node:r.init,declarationNode:r,optionalParams:l})},"Program:exit"(){for(let r of i){let l=e.sourceCode.getDeclaredVariables(r.declarationNode)[0];if(!l)continue;let p=l.references.filter(y=>y.identifier!==l.identifiers[0]);if(p.length===0)continue;let u=!1;for(let y of p){let h=y.identifier.parent;if(h.type===te.CallExpression&&y.identifier.type===te.Identifier&&h.arguments.includes(y.identifier)){u=!0;break}if(h.type===te.ReturnStatement){u=!0;break}if(h.type===te.Property&&h.parent.type===te.ObjectExpression&&h.parent.parent.type===te.ReturnStatement){u=!0;break}if(h.type===te.JSXExpressionContainer){u=!0;break}}if(u)continue;let f=[];for(let y of p){let h=y.identifier.parent;if(h.type===te.CallExpression&&h.callee===y.identifier){let m=h.arguments.length,b=h.arguments.some(T=>T.type===te.SpreadElement);if(b){u=!0;break}let C={argCount:m,hasSpread:b};for(let T of r.optionalParams)if(T.isObjectParam&&T.index<m){let I=h.arguments[T.index];if(I?.type===te.ObjectExpression){let A={};for(let S of I.properties)S.type===te.Property&&S.key.type===te.Identifier&&(A[S.key.name]=!0);C.objectArgs||(C.objectArgs=[]),C.objectArgs[T.index]=A}else if(I){u=!0;break}}f.push(C)}else if(h.type===te.JSXOpeningElement&&h.name===y.identifier){let m=h.attributes.some(C=>C.type===te.JSXSpreadAttribute);if(m){u=!0;break}let b={argCount:1,hasSpread:m};for(let C of r.optionalParams)if(C.isObjectParam&&C.index===0){let T={};for(let I of h.attributes)I.type===te.JSXAttribute&&I.name.type===te.JSXIdentifier&&(T[I.name.name]=!0);b.objectArgs||(b.objectArgs=[]),b.objectArgs[0]=T}f.push(b)}}if(!(u||f.length===0))for(let y of r.optionalParams)if(y.isObjectParam&&y.objectProps)for(let h of y.objectProps){if(!h.optional)continue;let m=!1;for(let b of f)if(b.objectArgs&&b.objectArgs[y.index]){let C=b.objectArgs[y.index];if(C&&C[h.name]){m=!0;break}}m||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:h.name}})}else{let h=!1;for(let m of f)if(m.argCount>y.index){h=!0;break}h||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});import{AST_NODE_TYPES as le,ESLintUtils as ds}from"@typescript-eslint/utils";import{z as Ye}from"zod/v4";var gs=Ye.object({selectors:Ye.array(Ye.object({name:Ye.string(),selectorProp:Ye.string().optional(),selectorArgPos:Ye.number().optional(),returnProp:Ye.string().optional()}))}),Ss=ds.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="no-unused-selected-values",nn={name:Cr,rule:Ss({name:Cr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(gs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:i=[]}=t,n=new Map(i.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===le.CallExpression&&(a=o.init),!a)return;let r=Es(a);if(!r)return;let s=n.get(r);if(!s)return;let l=Ts(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=hs(l);if(!p)return;let u=Ir(p.properties,void 0);if(!u)return;if(o.id.type===le.ObjectPattern){let h=Ir(o.id.properties,s.returnProp);if(!h)return;for(let[m,b]of u)h.has(m)||e.report({node:b,messageId:"unusedSelectedValue",data:{name:m}});return}if(o.id.type!==le.Identifier||s.returnProp)return;let f=bs(o,e.sourceCode);if(f.length===0)return;let y=new Set;for(let h of f){if(h.identifier.parent.type!==le.MemberExpression)return;let m=h.identifier.parent.property;if(m.type!==le.Identifier)return;y.add(m.name)}for(let[h,m]of u)y.has(h)||e.report({node:m,messageId:"unusedSelectedValue",data:{name:h}})}}}})};function Ts(e,t,i){let n=e.arguments[t];if(!n)return null;if(n.type===le.ArrowFunctionExpression||n.type===le.FunctionExpression)return n;if(i&&n.type===le.ObjectExpression){let o=n.properties.find(r=>r.type===le.Property&&r.key.type===le.Identifier&&r.key.name===i);if(o?.type!==le.Property)return null;let a=o.value;if(a.type===le.ArrowFunctionExpression||a.type===le.FunctionExpression)return a}return null}function Es(e){return e.callee.type===le.Identifier?e.callee.name:e.callee.type===le.MemberExpression&&e.callee.property.type===le.Identifier?e.callee.property.name:null}function hs(e){if(e.body.type===le.ObjectExpression)return e.body;if(e.body.type===le.BlockStatement){let t=e.body.body.filter(i=>i.type===le.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==le.ObjectExpression?null:t[0].argument}return null}function Ir(e,t){let i=e;if(t){let o=e.find(a=>a.type===le.Property&&a.key.type===le.Identifier&&a.key.name===t);if(o?.type!==le.Property||o.value.type!==le.ObjectPattern)return null;i=o.value.properties}let n=new Map;for(let o of i){if(o.type!==le.Property||o.key.type!==le.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function bs(e,t){let i=t.getDeclaredVariables(e);if(i.length!==1)return[];let n=i[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var rn=V({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===ae.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=xs(a);s&&(n=s);return}let r=Cs(a,e.sourceCode);if(r){o=!0;for(let s of r)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function xs(e){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useForm"))return null;let i=e.arguments[0];if(!i||i.type!==ae.ObjectExpression)return null;let n=Lt(i.properties,a=>a.type!==ae.Property||a.key.type!==ae.Identifier||a.key.name!=="initialConfig"?null:a.value.type===ae.ObjectExpression?a.value:a.value.type===ae.ArrowFunctionExpression||a.value.type===ae.FunctionExpression?Is(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===ae.Property&&a.key.type===ae.Identifier&&o.set(a.key.name,a);return o}function Cs(e,t){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ae.VariableDeclarator||e.parent.id.type!==ae.ObjectPattern||!Lt(e.parent.id.properties,r=>r.type===ae.Property&&r.key.type===ae.Identifier&&r.key.name==="formFields"&&r))return null;let o=ir(e.parent,"formFields",t),a=new Set;for(let{identifier:r}of o){if(r.type!==ae.Identifier||r.parent.type===ae.Property&&r.parent.parent.type===ae.ObjectExpression&&r.parent.parent.parent.type===ae.ReturnStatement||r.parent.type===ae.ReturnStatement)return null;if(r.parent.type===ae.MemberExpression){if(r.parent.object.type!==ae.Identifier||r.parent.property.type!==ae.Identifier)return null;a.add(r.parent.property.name)}}return a}function Is(e){if(e.body.type===ae.ObjectExpression)return e.body;if(e.body.type===ae.BlockStatement){let t=e.body.body.filter(i=>i.type===ae.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==ae.ObjectExpression?null:t[0].argument}return null}import{AST_NODE_TYPES as ie,ESLintUtils as As}from"@typescript-eslint/utils";import{z as xt}from"zod/v4";var ws=As.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Ar(e){let t=[];for(let i of e.members)i.type===ie.TSPropertySignature&&i.key.type===ie.Identifier&&t.push([i.key.name,i]);return t}function wr(e,...t){for(let i of t)e.set(...i);return e}var Fs=xt.object({forceCheckOnFCPropTypesWithName:xt.array(xt.string()).optional(),alwaysCheckFunctionOptionTypes:xt.boolean().optional()}),Fr="no-unused-type-props-in-args",on=null,Rs=ws({name:Fr,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:[$(Fs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:i,alwaysCheckFunctionOptionTypes:n=!0}=t;i&&!on&&(on=i.map(l=>new RegExp(l)));function o(l,p,u,f,y=!0,h=!1){let m=u.name,b=e.sourceCode.getScope(p).references.find(S=>S.identifier.name===m)?.resolved,C=l&&on?.some(S=>S.test(m)),T=h&&n;if(!b||!C&&b.references.filter(S=>S.isTypeReference).length>1||!b.defs[0])return;let I=b.defs[0].node,A=I.parent?.type===ie.ExportNamedDeclaration;if(!(y&&A&&!T)){if(I.type===ie.TSTypeAliasDeclaration){a(l,p,f,I.typeAnnotation,!0,h);return}if(I.type===ie.TSInterfaceDeclaration){a(l,p,f,I.body,!0,h);return}}}function a(l,p,u,f,y,h=!1){if(f.type===ie.TSInterfaceBody){for(let m of f.body)m.type===ie.TSPropertySignature&&m.key.type===ie.Identifier&&u.set(m.key.name,m);return}if(f.type===ie.TSTypeLiteral){wr(u,...Ar(f));return}if(f.type===ie.TSIntersectionType){for(let m of f.types)a(l,p,u,m,!0,h);return}y||f.type===ie.TSTypeReference&&f.typeName.type===ie.Identifier&&o(l,p,f.typeName,u,!0,h)}function r(l,p,u,f=!1){for(let y of u)if(y.type===ie.ObjectPattern&&y.typeAnnotation){let h=new Map;if(a(l,p,h,y.typeAnnotation.typeAnnotation,!1,f),h.size===0)continue;s(y,h)}else y.type===ie.AssignmentPattern&&y.left.type===ie.ObjectPattern&&r(l,p,[y.left],f)}function s(l,p){let u=[];if(l.properties.at(-1)?.type===ie.RestElement)return;for(let m of l.properties)m.type===ie.Property&&m.key.type===ie.Identifier&&u.push(m.key.name);let y=[],h=[];for(let[m,b]of p)u.includes(m)||(h.push(m),y.push({node:b,messageId:"unusedObjectTypeProperty",data:{propertyName:m}}));for(let[m,b]of y.entries())e.report({...b,fix:m===y.length-1?C=>{let T=l.properties.at(-1),I=h.join(", ");return T?T.type===ie.RestElement?null:C.insertTextAfter(T,`, ${I}`):C.insertTextBeforeRange([l.range[0]+1,l.range[1]],I)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],u=new Map,f=p.id.type===ie.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===ie.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===ie.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(f){if(f.type===ie.TSTypeReference&&f.typeName.type===ie.Identifier)o(!0,l,f.typeName,u,!1);else if(f.type===ie.TSTypeLiteral)wr(u,...Ar(f));else if(f.type===ie.TSIntersectionType)for(let y of f.types)y.type===ie.TSTypeReference&&y.typeName.type===ie.Identifier?o(!0,l,y.typeName,u,!1):a(!0,l,u,y,!0);if(u.size!==0&&p.init?.type===ie.ArrowFunctionExpression){let y=p.init.params[0];if(!y){e.report({node:p.init,messageId:"missingComponentParam"});return}y.type===ie.ObjectPattern&&s(y,u)}}},FunctionDeclaration(l){r(!1,l,l.params,n)},ArrowFunctionExpression(l){r(!1,l,l.params,n)}}}}),sn={name:Fr,rule:Rs};import{AST_NODE_TYPES as Ne}from"@typescript-eslint/utils";var an=V({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function i(n){return n.callee.type===Ne.Identifier?t.has(n.callee.name):n.callee.type===Ne.MemberExpression&&n.callee.object.type===Ne.Identifier&&n.callee.property.type===Ne.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===Ne.ImportSpecifier&&o.imported.type===Ne.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Ne.CallExpression&&i(n.init)&&n.id.type===Ne.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let r=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===Ne.JSXExpressionContainer&&p.parent.type===Ne.JSXAttribute&&p.parent.name.type===Ne.JSXIdentifier&&p.parent.name.name==="ref")){r=!0;break}}r||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});import{AST_NODE_TYPES as ln,ESLintUtils as vs}from"@typescript-eslint/utils";var ks=vs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),vr="prefer-named-functions",Rr=new Map,Ps=ks({name:vr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let i=null;if(t.ignoreRegex){let n=Rr.get(t.ignoreRegex);n?i=n:(i=new RegExp(t.ignoreRegex),Rr.set(t.ignoreRegex,i))}return{VariableDeclarator(n){if(n.init&&n.init.type===ln.ArrowFunctionExpression&&n.id.type===ln.Identifier){let o=n.id.name;if(n.id.typeAnnotation||i&&i.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==ln.BlockStatement)return;let a=n.parent,r=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:i?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${r.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),pn={name:vr,rule:Ps};import{AST_NODE_TYPES as Q}from"@typescript-eslint/utils";import{z as $e}from"zod/v4";var Os=$e.object({disallowedFunctions:$e.array($e.object({name:$e.string(),allowUsingWithArgs:$e.boolean().optional(),hookAlternative:$e.string().optional(),message:$e.string().optional(),allowUseInside:$e.array($e.string()).optional()}))}),Ns=/^use[A-Z]/,Ds=/^[A-Z]/;function Ct(e){return Ns.test(e)}function kr(e){return Ds.test(e)}function js(e){return e.type===Q.Identifier?Ct(e.name):e.type===Q.MemberExpression&&e.property.type===Q.Identifier?Ct(e.property.name):!1}function Pr(e,t){return e.type===Q.Identifier?e.name===t:e.type===Q.MemberExpression&&e.object.type===Q.Identifier&&e.property.type===Q.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Or(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Pr(e.parent.callee,"forwardRef"))}function Nr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Pr(e.parent.callee,"memo"))}function cn(e){if(e.type===Q.FunctionDeclaration||e.type===Q.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.FunctionExpression||e.type===Q.ArrowFunctionExpression){if(e.parent.type===Q.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Ls(e){let t=e.parent,i=!1;for(;t;){if(t.type===Q.FunctionDeclaration||t.type===Q.FunctionExpression||t.type===Q.ArrowFunctionExpression){let n=cn(t);if(n&&n.type===Q.Identifier){if(kr(n.name)||Ct(n.name))return!i;i=!0}else{if(Or(t)||Nr(t))return!i;if(t.parent.type===Q.CallExpression){let o=t.parent;js(o.callee)||(i=!0)}else t.parent.type===Q.JSXExpressionContainer||(i=!0)}}t=t.parent}return!1}function Dr(e){return e.callee.type===Q.Identifier?e.callee.name:e.callee.type===Q.MemberExpression&&e.callee.property.type===Q.Identifier?e.callee.property.name:null}function Ms(e,t){if(!t.length)return!1;let i=e.parent;for(;i;){if(i.type===Q.FunctionDeclaration||i.type===Q.FunctionExpression||i.type===Q.ArrowFunctionExpression){let n=cn(i);if(n&&n.type===Q.Identifier&&t.includes(n.name))return!0}else if(i.type===Q.CallExpression){let n=Dr(i);if(n&&t.includes(n))return!0}i=i.parent}return!1}function _s(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===Q.Identifier&&t.name==="undefined")}function $s(e,t){let i=!1,n=e.parent;for(;n;){if(n.type===Q.FunctionDeclaration||n.type===Q.FunctionExpression||n.type===Q.ArrowFunctionExpression){let o=cn(n);if(o&&o.type===Q.Identifier){if(kr(o.name)||Ct(o.name)){i=!0;break}}else if(Or(n)||Nr(n)){i=!0;break}}n=n.parent}return i?t.length===0?Ls(e):!Ms(e,t):!1}var un=V({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[$(Os)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:i}=t,n=new Map(i.map(o=>[o.name,o]));return{CallExpression(o){let a=Dr(o);if(!a)return;let r=n.get(a);if(!r||r.allowUsingWithArgs&&_s(o))return;let s=r.allowUseInside||[];$s(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:r.message?` ${r.message}`:` use ${r.hookAlternative} instead`},suggest:r.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${r.hookAlternative}`,hookAlternative:r.hookAlternative},fix:l=>{let p=r.hookAlternative;return p?o.callee.type===Q.Identifier?l.replaceText(o.callee,p):o.callee.type===Q.MemberExpression&&o.callee.property.type===Q.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});import{AST_NODE_TYPES as de,AST_TOKEN_TYPES as jr,ESLintUtils as Us}from"@typescript-eslint/utils";import fn from"zod/v4";var zs=Us.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mr="prefer-single-line-if",Ws=fn.object({maxLineLength:fn.number().optional(),maxNonSimpleConditionLength:fn.number().optional()}),Js=zs({name:Mr,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:[$(Ws)]},defaultOptions:[{}],create(e,[t]){let i=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==de.BlockStatement||n.loc.start.line===n.loc.end.line||i.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(!a)return;if(a.type===de.ReturnStatement){if(!$r(a))return}else if(!(a.type===de.ContinueStatement||a.type===de.BreakStatement))return;if(n.test.type===de.LogicalExpression||n.test.type===de.ConditionalExpression)return;let r;if(t.maxNonSimpleConditionLength){let f=Lr(n.test);if(!f&&n.test.type===de.UnaryExpression&&n.test.operator==="!"){let y=n.test.argument;Lr(y)&&(f=!0)}if(f&&(r=i.getText(n.test),r.length>t.maxNonSimpleConditionLength))return}r||(r=i.getText(n.test));let s=i.getText(a);if(r.includes(`
18
+ `))return;let l=i.getTokenAfter(n);if(l&&l.type===jr.Punctuator&&l.value==="}"){let f=i.getTokenAfter(l);if(f&&f.type===jr.Keyword&&(f.value==="else"||f.value==="catch"))return}let p=Vs(i,n),u=`if (${r}) ${s}`;t.maxLineLength&&u.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:f=>f.replaceText(n,u)})}}}});function Lr(e){return e.type===de.CallExpression||e.type===de.BinaryExpression||e.type===de.MemberExpression&&_r(e)}function _r(e){return e.object.type===de.MemberExpression?_r(e.object):e.object.type!==de.Identifier}function Vs(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function $r(e){if(!e.argument)return!0;let t=e.argument;return t.type===de.ArrayExpression&&t.elements.length===0||t.type===de.ObjectExpression&&t.properties.length===0||t.type===de.Literal||t.type===de.Identifier||t.type===de.TemplateLiteral||t.type===de.TaggedTemplateExpression?!0:t.type===de.CallExpression?t.arguments.length===0:t.type===de.UnaryExpression?$r(t):!1}var mn={name:Mr,rule:Js};import{AST_NODE_TYPES as j,ESLintUtils as Xs}from"@typescript-eslint/utils";import{z as Ur}from"zod/v4";var Bs=Xs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xr="react-compiler-extra",Hs=Ur.object({runOnlyWithEnableCompilerDirective:Ur.boolean().optional()}),Ys=/eslint +react-compiler\/react-compiler: +\["error/;function tt(e){let t=null;if((e.type===j.FunctionDeclaration||e.type===j.FunctionExpression||e.type===j.ArrowFunctionExpression&&e.body.type===j.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let i=t.body[0];return i?i.type===j.ExpressionStatement&&i.expression.type===j.Literal&&i.expression.value==="use no memo":!1}function zr(e){let t=e.parent;for(;t;){if(t.type===j.FunctionDeclaration||t.type===j.FunctionExpression||t.type===j.ArrowFunctionExpression)return t;t=t.parent}return null}function qs(e){return e.type===j.Identifier?e.name.startsWith("use"):!1}function Br(e){return e.type===j.Identifier?e.name.startsWith("use"):e.type===j.MemberExpression&&e.property.type===j.Identifier?e.property.name.startsWith("use"):!1}function Le(e){if(!e)return!1;switch(e.type){case j.JSXElement:case j.JSXFragment:return!0;case j.ConditionalExpression:return Le(e.consequent)||Le(e.alternate);case j.LogicalExpression:return e.operator==="&&"?Le(e.right):e.operator==="||"?Le(e.left)||Le(e.right):!1;case j.CallExpression:if(e.callee.type===j.MemberExpression&&e.callee.object.type===j.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===j.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==j.SpreadElement&&Le(t))return!0;return!1;default:return!1}}function Zs(e){let t=e.typeAnnotation;if(t.type===j.TSTypeReference){if(t.typeName.type===j.Identifier)return t.typeName.name==="FC";if(t.typeName.type===j.TSQualifiedName&&t.typeName.left.type===j.Identifier&&t.typeName.right.type===j.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Gs=/^[A-Z][a-zA-Z0-9]*$/;function ct(e){return Gs.test(e)}function It(e){return e.startsWith("use")&&e.length>3}function dn(e,t,i,n){if(i&&Zs(i))return t?ct(t.name):e.type===j.FunctionDeclaration&&e.id?ct(e.id.name):!0;if(t&&It(t.name)||e.type===j.FunctionDeclaration&&e.id&&It(e.id.name))return!0;if(n){let o=t?.name||e.type===j.FunctionDeclaration&&e.id?.name;if(o&&ct(o)&&Hr(e.body,n).containsJSX)return!0}return!1}function pt(e){if(e.body.type===j.BlockStatement){for(let t of e.body.body)if(t.type===j.ExpressionStatement&&t.expression.type===j.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Hr(e,t){let i={containsJSX:!1,containsHookCalls:!1};return Oe(e,n=>{if(i.containsJSX&&i.containsHookCalls)return!0;switch(n.type){case j.JSXElement:case j.JSXFragment:i.containsJSX=!0;break;case j.CallExpression:qs(n.callee)&&(i.containsHookCalls=!0),Le(n)&&(i.containsJSX=!0);break;case j.ReturnStatement:n.argument&&Le(n.argument)&&(i.containsJSX=!0);break;case j.VariableDeclarator:n.init&&Le(n.init)&&(i.containsJSX=!0);break;case j.AssignmentExpression:Le(n.right)&&(i.containsJSX=!0);break}},t),i}function Wr(e,t){let i=e.body,n=Hr(i,t);return n.containsJSX||n.containsHookCalls}var Ks=/\bthis[.[]/;function Jr(e){return Ks.test(e)}function Qs(e,t){let i={containsJSX:!1,containsHookCalls:!1};return Oe(e,n=>{if(i.containsHookCalls||(n.type===j.FunctionDeclaration||n.type===j.FunctionExpression||n.type===j.ArrowFunctionExpression)&&n!==e)return!0;n.type===j.CallExpression&&Br(n.callee)&&(i.containsHookCalls=!0)},t),i}function Vr(e){return ct(e)||It(e)}function yn(e,t,i,n){if(!Qs(e.body,t).containsHookCalls)return!1;let a=dn(e,i,n,t);if(!a&&n){let r=i?.name||e.type===j.FunctionDeclaration&&e.id?.name;r&&ct(r)&&(a=!0)}return!a}var ea=Bs({name:Xr,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:[$(Hs)]},defaultOptions:[{}],create(e,[t]){let i=!1;if(t.runOnlyWithEnableCompilerDirective){for(let r of e.sourceCode.getAllComments())if(Ys.test(r.value)){i=!0;break}if(!i)return{}}function n(r){for(let s of r.properties)if(s.type===j.Property&&s.method&&s.value.type===j.FunctionExpression){let l=e.sourceCode,p=l.getText(s.key),u=s.value,f=l.getText(u.body);if(Jr(f))e.report({node:s,messageId:"thisKeywordInMethod"});else{let y=u.params.map(m=>l.getText(m)).join(", "),h="";u.generator?h=`${p}: function* (${y}) ${f}`:u.async?h=`${p}: async (${y}) => ${f}`:h=`${p}: (${y}) => ${f}`,e.report({node:s,messageId:"objectMethodIsNotSupported",fix:m=>m.replaceText(s,h)})}}}function o(r){for(let s of r.properties)if(s.type===j.Property&&s.value.type===j.ObjectExpression){for(let l of s.value.properties)if(l.type===j.Property&&l.method&&l.value.type===j.FunctionExpression){let u=e.sourceCode.getText(l.value.body);Jr(u)&&e.report({node:l,messageId:"thisKeywordInMethod"})}}}function a(r){let s=zr(r);return s!==null&&tt(s)}return{CallExpression(r){if(Br(r.callee))for(let s of r.arguments){if(s.type===j.ObjectExpression){if(a(r))return;n(s),o(s)}if(s.type===j.ArrowFunctionExpression){if(s.body.type===j.ObjectExpression){if(a(r))return;n(s.body),o(s.body)}if(s.body.type===j.BlockStatement){for(let l of s.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(a(r))return;n(l.argument),o(l.argument)}}}if(s.type===j.FunctionExpression){for(let l of s.body.body)if(l.type===j.ReturnStatement&&l.argument?.type===j.ObjectExpression){if(a(r))return;n(l.argument),o(l.argument)}}}},VariableDeclarator(r){if(r.id.type===j.Identifier&&r.init&&(r.init.type===j.ArrowFunctionExpression||r.init.type===j.FunctionExpression)){let s=r.init,l=r.id,p=r.id.typeAnnotation;if(pt(s)&&!Vr(l.name)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}if(yn(s,e.sourceCode,l,p)){if(tt(s))return;e.report({node:s,messageId:"functionCallingHooksMustBeComponent"});return}if(dn(s,l,p,e.sourceCode)){let u=Wr(s,e.sourceCode),f=pt(s);if(!u&&!f){if(tt(s))return;e.report({node:s,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(y){if(s.body.type===j.BlockStatement){let h=s.body.range[0]+1;return y.insertTextAfterRange([h,h],`
19
19
  "use memo"
20
- `)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&at(i)&&!Vr(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(mn(i,e.sourceCode)){if(Qe(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(yn(i,void 0,void 0,e.sourceCode)){let s=Wr(i,e.sourceCode),a=at(i);if(!s&&!a){if(Qe(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let u=i.body.range[0]+1;return l.insertTextAfterRange([u,u],`
20
+ `)}return null}}]})}}}},FunctionDeclaration(r){if(r.id&&pt(r)&&!Vr(r.id.name)){e.report({node:r,messageId:"useMemoDirectiveNaming"});return}if(yn(r,e.sourceCode)){if(tt(r))return;e.report({node:r,messageId:"functionCallingHooksMustBeComponent"});return}if(dn(r,void 0,void 0,e.sourceCode)){let s=Wr(r,e.sourceCode),l=pt(r);if(!s&&!l){if(tt(r))return;e.report({node:r,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(p){let u=r.body.range[0]+1;return p.insertTextAfterRange([u,u],`
21
21
  "use memo"
22
- `)}}]})}}},FunctionExpression(i){if(at(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(mn(i,e.sourceCode)){if(Qe(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.ObjectExpression)return;let s=zr(i);if(!s)return;let a;s.type===j.FunctionDeclaration&&s.id?a=s.id.name:(s.type===j.ArrowFunctionExpression||s.type===j.FunctionExpression)&&s.parent.type===j.VariableDeclarator&&s.parent.id.type===j.Identifier&&(a=s.parent.id.name),a&&xt(a)&&(p(i)||(n(i.argument),o(i.argument)))}}}}),dn={name:Xr,rule:ra};import{AST_NODE_TYPES as ye,ESLintUtils as ia}from"@typescript-eslint/utils";import{z as De}from"zod/v4";var oa=ia.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yr="react-compiler-migration",sa=De.object({disallowHooks:De.array(De.object({name:De.string(),replacement:De.string()})).optional(),disallowMethods:De.array(De.object({name:De.string(),replacement:De.string().optional(),requireTrueProp:De.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:De.boolean().optional()}),aa=/eslint +react-compiler\/react-compiler: +\["error/;function la(e){let t=null;if((e.type===ye.FunctionDeclaration||e.type===ye.FunctionExpression||e.type===ye.ArrowFunctionExpression&&e.body.type===ye.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===ye.ExpressionStatement&&r.expression.type===ye.Literal&&r.expression.value==="use no memo":!1}function pa(e){let t=e.parent;for(;t;){if(t.type===ye.FunctionDeclaration||t.type===ye.FunctionExpression||t.type===ye.ArrowFunctionExpression)return t;t=t.parent}return null}function ca(e){return e.type===ye.Identifier?e.name.startsWith("use"):e.type===ye.MemberExpression&&e.property.type===ye.Identifier?e.property.name.startsWith("use"):!1}var ua=oa({name:Yr,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:[$(sa)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(aa.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let p=pa(o);return p!==null&&la(p)}return{CallExpression(o){if(t.disallowHooks?.length){let p=null,i=null;if(o.callee.type===ye.Identifier?(p=o.callee.name,i=o.callee):o.callee.type===ye.MemberExpression&&o.callee.property.type===ye.Identifier&&(p=o.callee.property.name,i=o.callee.property),p){let s=t.disallowHooks.find(a=>a.name===p);if(s&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:a=>a.replaceText(i,s.replacement)}]})}}}if(t.disallowMethods?.length&&ca(o.callee)){for(let p of o.arguments)if(p.type===ye.ObjectExpression){for(let i of p.properties)if(i.type===ye.Property&&i.key.type===ye.Identifier){let s=i.key.name,a=t.disallowMethods.find(l=>l.name===s);if(a){if(n(o))return;if(a.requireTrueProp){let l=a.requireTrueProp,u=!1;for(let f of p.properties)if(f.type===ye.Property&&f.key.type===ye.Identifier&&f.key.name===l&&f.value.type===ye.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:a.name,requireTrueProp:l}});continue}}a.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>a.replacement?l.replaceText(i.key,a.replacement):null}]})}}}}}}}}),gn={name:Yr,rule:ua};import{AST_NODE_TYPES as U}from"@typescript-eslint/utils";import{z as qr}from"zod";var fa=qr.object({runOnlyWithEnableCompilerDirective:qr.boolean().optional()}),ma=/eslint +react-compiler\/react-compiler: +\["error/,ya=/^\d+$/,da=/[\s_-]+/,ga=/[a-z][A-Z]/,Sa=/^(.+?)([A-Z][a-z]+s?)$/,Ta=/^[a-z][a-zA-Z]*$/;function Zr(e,t){let r=[];if(e.type===U.JSXElement){for(let n of e.openingElement.attributes)if(n.type===U.JSXAttribute&&n.name.type===U.JSXIdentifier&&n.value?.type===U.JSXExpressionContainer&&n.value.expression.type!==U.JSXEmptyExpression){let o=n.name.name,p=n.value.expression,i=!1;Oe(p,s=>{switch(s.type){case U.ObjectExpression:case U.ArrowFunctionExpression:case U.FunctionExpression:case U.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function Ea(e){if(e.body.type===U.JSXElement||e.body.type===U.JSXFragment)return!0;if(e.body.type===U.BlockStatement){for(let t of e.body.body)if(t.type===U.ReturnStatement&&t.argument&&(t.argument.type===U.JSXElement||t.argument.type===U.JSXFragment))return!0}return!1}function ha(e,t){let r=e.callee;if(r.type===U.MemberExpression){let n=r.object;if(n.type===U.Identifier){let o=n.name,p=ba(o);if(p!==o)return Tn(p)}}if(t.length>0){let n=t[0];if(n&&n.type===U.Identifier)return Tn(n.name)}return"ListItem"}function ba(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(ga)){let n=e.match(Sa);if(n){let o=n[1],p=n[2];if(!o||!p)return Sn(e);let i=Sn(p);if(i!==p)return o+i}}return Sn(e)}function Sn(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 Tn(e){return e.match(Ta)?e.charAt(0).toUpperCase()+e.slice(1):e.split(da).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Gr(e,t,r){let n=[],o=new Set,p=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Oe(e,i=>{if(i.type===U.Identifier&&!t.includes(i.name)&&!p.has(i.name)&&!ya.test(i.name)){let s=i.parent;if(s.type===U.Property&&s.key===i||s.type===U.MemberExpression&&s.property===i&&!s.computed||s.type===U.JSXOpeningElement||s.type===U.JSXClosingElement||s.type===U.JSXAttribute&&s.name.type===U.JSXIdentifier&&s.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function Kr(e,t,r,n,o){let i=[...r.map(f=>f.type===U.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],s=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
23
- `),a=i.map(f=>f.name).join(", "),l=o.getText(t),u=`${e}Props`;return`type ${u} = {
22
+ `)}}]})}}},FunctionExpression(r){if(pt(r)){e.report({node:r,messageId:"useMemoDirectiveNaming"});return}if(yn(r,e.sourceCode)){if(tt(r))return;e.report({node:r,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(r){if(r.argument?.type!==j.ObjectExpression)return;let s=zr(r);if(!s)return;let l;s.type===j.FunctionDeclaration&&s.id?l=s.id.name:(s.type===j.ArrowFunctionExpression||s.type===j.FunctionExpression)&&s.parent.type===j.VariableDeclarator&&s.parent.id.type===j.Identifier&&(l=s.parent.id.name),l&&It(l)&&(a(r)||(n(r.argument),o(r.argument)))}}}}),gn={name:Xr,rule:ea};import{AST_NODE_TYPES as ye,ESLintUtils as ta}from"@typescript-eslint/utils";import{z as De}from"zod/v4";var na=ta.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yr="react-compiler-migration",ra=De.object({disallowHooks:De.array(De.object({name:De.string(),replacement:De.string()})).optional(),disallowMethods:De.array(De.object({name:De.string(),replacement:De.string().optional(),requireTrueProp:De.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:De.boolean().optional()}),ia=/eslint +react-compiler\/react-compiler: +\["error/;function oa(e){let t=null;if((e.type===ye.FunctionDeclaration||e.type===ye.FunctionExpression||e.type===ye.ArrowFunctionExpression&&e.body.type===ye.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let i=t.body[0];return i?i.type===ye.ExpressionStatement&&i.expression.type===ye.Literal&&i.expression.value==="use no memo":!1}function sa(e){let t=e.parent;for(;t;){if(t.type===ye.FunctionDeclaration||t.type===ye.FunctionExpression||t.type===ye.ArrowFunctionExpression)return t;t=t.parent}return null}function aa(e){return e.type===ye.Identifier?e.name.startsWith("use"):e.type===ye.MemberExpression&&e.property.type===ye.Identifier?e.property.name.startsWith("use"):!1}var la=na({name:Yr,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:[$(ra)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let i=!0;if(t.runOnlyWithEnableCompilerDirective){i=!1;for(let o of e.sourceCode.getAllComments())if(ia.test(o.value)){i=!0;break}}if(!i)return{};function n(o){let a=sa(o);return a!==null&&oa(a)}return{CallExpression(o){if(t.disallowHooks?.length){let a=null,r=null;if(o.callee.type===ye.Identifier?(a=o.callee.name,r=o.callee):o.callee.type===ye.MemberExpression&&o.callee.property.type===ye.Identifier&&(a=o.callee.property.name,r=o.callee.property),a){let s=t.disallowHooks.find(l=>l.name===a);if(s&&r){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>l.replaceText(r,s.replacement)}]})}}}if(t.disallowMethods?.length&&aa(o.callee)){for(let a of o.arguments)if(a.type===ye.ObjectExpression){for(let r of a.properties)if(r.type===ye.Property&&r.key.type===ye.Identifier){let s=r.key.name,l=t.disallowMethods.find(p=>p.name===s);if(l){if(n(o))return;if(l.requireTrueProp){let p=l.requireTrueProp,u=!1;for(let f of a.properties)if(f.type===ye.Property&&f.key.type===ye.Identifier&&f.key.name===p&&f.value.type===ye.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:r,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:r,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(r.key,l.replacement):null}]})}}}}}}}}),Sn={name:Yr,rule:la};import{AST_NODE_TYPES as U}from"@typescript-eslint/utils";import{z as qr}from"zod";var pa=qr.object({runOnlyWithEnableCompilerDirective:qr.boolean().optional()}),ca=/eslint +react-compiler\/react-compiler: +\["error/,ua=/^\d+$/,fa=/[\s_-]+/,ma=/[a-z][A-Z]/,ya=/^(.+?)([A-Z][a-z]+s?)$/,da=/^[a-z][a-zA-Z]*$/;function Zr(e,t){let i=[];if(e.type===U.JSXElement){for(let n of e.openingElement.attributes)if(n.type===U.JSXAttribute&&n.name.type===U.JSXIdentifier&&n.value?.type===U.JSXExpressionContainer&&n.value.expression.type!==U.JSXEmptyExpression){let o=n.name.name,a=n.value.expression,r=!1;Oe(a,s=>{switch(s.type){case U.ObjectExpression:case U.ArrowFunctionExpression:case U.FunctionExpression:case U.ArrayExpression:return r=!0,!0}return!1},t),r&&i.push(o)}}return{hasUnstable:i.length>0,problematicProps:i}}function ga(e){if(e.body.type===U.JSXElement||e.body.type===U.JSXFragment)return!0;if(e.body.type===U.BlockStatement){for(let t of e.body.body)if(t.type===U.ReturnStatement&&t.argument&&(t.argument.type===U.JSXElement||t.argument.type===U.JSXFragment))return!0}return!1}function Sa(e,t){let i=e.callee;if(i.type===U.MemberExpression){let n=i.object;if(n.type===U.Identifier){let o=n.name,a=Ta(o);if(a!==o)return En(a)}}if(t.length>0){let n=t[0];if(n&&n.type===U.Identifier)return En(n.name)}return"ListItem"}function Ta(e){let i={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(i)return i;if(e.match(ma)){let n=e.match(ya);if(n){let o=n[1],a=n[2];if(!o||!a)return Tn(e);let r=Tn(a);if(r!==a)return o+r}}return Tn(e)}function Tn(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 En(e){return e.match(da)?e.charAt(0).toUpperCase()+e.slice(1):e.split(fa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Gr(e,t,i){let n=[],o=new Set,a=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Oe(e,r=>{if(r.type===U.Identifier&&!t.includes(r.name)&&!a.has(r.name)&&!ua.test(r.name)){let s=r.parent;if(s.type===U.Property&&s.key===r||s.type===U.MemberExpression&&s.property===r&&!s.computed||s.type===U.JSXOpeningElement||s.type===U.JSXClosingElement||s.type===U.JSXAttribute&&s.name.type===U.JSXIdentifier&&s.name.name===r.name)return!1;o.add(r.name)}return!1},i);for(let r of o)t.includes(r)||n.push({name:r,type:"unknown"});return n}function Kr(e,t,i,n,o){let r=[...i.map(f=>f.type===U.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],s=r.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
23
+ `),l=r.map(f=>f.name).join(", "),p=o.getText(t),u=`${e}Props`;return`type ${u} = {
24
24
  ${s}
25
25
  };
26
26
 
27
- const ${e}: FC<${u}> = ({ ${a} }) => {
27
+ const ${e}: FC<${u}> = ({ ${l} }) => {
28
28
  return (
29
- ${l}
29
+ ${p}
30
30
  );
31
- };`}function xa(e,t,r,n){let o=t.map(i=>i.type===U.Identifier?i.name:"item"),p=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${p.join(" ")} />`}function Ca(e){if(e.type===U.JSXElement&&e.openingElement.name.type===U.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Tn(t)}return"ListItem"}function Ia(e,t,r){let n=[r?`key={${r}}`:"",...t.map(o=>`${o.name}={${o.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function Qr(e,t){for(let r of e.openingElement.attributes)if(r.type===U.JSXAttribute&&r.name.type===U.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===U.JSXExpressionContainer&&r.value.expression.type!==U.JSXEmptyExpression)return t.getText(r.value.expression);return null}var En=V({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:[$(fa)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let o of r.getAllComments())if(ma.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===U.MemberExpression&&n.callee.property.type===U.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Aa(n,r,e):wa(n,r,e))}}}});function Aa(e,t,r){let n=e.arguments[0];if(!n||n.type!==U.ArrowFunctionExpression&&n.type!==U.FunctionExpression||!Ea(n))return;let o=null;if(n.body.type===U.JSXElement||n.body.type===U.JSXFragment?o=n.body:n.body.type===U.BlockStatement&&n.body.body[0]?.type===U.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===U.JSXElement||n.body.body[0].argument.type===U.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let p=Zr(o,t);if(!p.hasUnstable)return;let i=ha(e,n.params),s=n.params.map(f=>f.type===U.Identifier?f.name:"item"),a=Gr(o,s,t),l=o.type===U.JSXElement?Qr(o,t):null,u=p.problematicProps.length===1?`prop "${p.problematicProps[0]}"`:`props "${p.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:f=>{let y=Kr(i,o,n.params,a,t),x=xa(i,n.params,a,l),m=e;for(;m.parent.type!==U.Program&&!(m.type===U.FunctionDeclaration||m.type===U.VariableDeclarator&&m.init&&(m.init.type===U.ArrowFunctionExpression||m.init.type===U.FunctionExpression));)m=m.parent;let h=[];return h.push(f.insertTextAfter(m,`
31
+ };`}function Ea(e,t,i,n){let o=t.map(r=>r.type===U.Identifier?r.name:"item"),a=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(r=>`${r}={${r}}`),...i.map(r=>`${r.name}={${r.name}}`)].filter(Boolean);return`<${e} ${a.join(" ")} />`}function ha(e){if(e.type===U.JSXElement&&e.openingElement.name.type===U.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return En(t)}return"ListItem"}function ba(e,t,i){let n=[i?`key={${i}}`:"",...t.map(o=>`${o.name}={${o.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function Qr(e,t){for(let i of e.openingElement.attributes)if(i.type===U.JSXAttribute&&i.name.type===U.JSXIdentifier&&i.name.name==="key"&&i.value&&i.value.type===U.JSXExpressionContainer&&i.value.expression.type!==U.JSXEmptyExpression)return t.getText(i.value.expression);return null}var hn=V({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:[$(pa)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:i}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let o of i.getAllComments())if(ca.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===U.MemberExpression&&n.callee.property.type===U.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?xa(n,i,e):Ca(n,i,e))}}}});function xa(e,t,i){let n=e.arguments[0];if(!n||n.type!==U.ArrowFunctionExpression&&n.type!==U.FunctionExpression||!ga(n))return;let o=null;if(n.body.type===U.JSXElement||n.body.type===U.JSXFragment?o=n.body:n.body.type===U.BlockStatement&&n.body.body[0]?.type===U.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===U.JSXElement||n.body.body[0].argument.type===U.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let a=Zr(o,t);if(!a.hasUnstable)return;let r=Sa(e,n.params),s=n.params.map(f=>f.type===U.Identifier?f.name:"item"),l=Gr(o,s,t),p=o.type===U.JSXElement?Qr(o,t):null,u=a.problematicProps.length===1?`prop "${a.problematicProps[0]}"`:`props "${a.problematicProps.join('", "')}"`;i.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:r},fix:f=>{let y=Kr(r,o,n.params,l,t),h=Ea(r,n.params,l,p),m=e;for(;m.parent.type!==U.Program&&!(m.type===U.FunctionDeclaration||m.type===U.VariableDeclarator&&m.init&&(m.init.type===U.ArrowFunctionExpression||m.init.type===U.FunctionExpression));)m=m.parent;let b=[];return b.push(f.insertTextAfter(m,`
32
32
 
33
- ${y}`)),h.push(f.replaceText(o,x)),h}}]})}function wa(e,t,r){let n=e.arguments[0];if(!n||n.type!==U.JSXElement&&n.type!==U.JSXFragment)return;let o=n,p=Zr(o,t);if(!p.hasUnstable)return;let i=Ca(o),s=Gr(o,[],t),a=o.type===U.JSXElement?Qr(o,t):null,l=p.problematicProps.length===1?`prop "${p.problematicProps[0]}"`:`props "${p.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:l},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=Kr(i,o,[],s,t),y=Ia(i,s,a),x=e;for(;x.parent.type!==U.Program&&!(x.type===U.FunctionDeclaration||x.type===U.VariableDeclarator&&x.init&&(x.init.type===U.ArrowFunctionExpression||x.init.type===U.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
33
+ ${y}`)),b.push(f.replaceText(o,h)),b}}]})}function Ca(e,t,i){let n=e.arguments[0];if(!n||n.type!==U.JSXElement&&n.type!==U.JSXFragment)return;let o=n,a=Zr(o,t);if(!a.hasUnstable)return;let r=ha(o),s=Gr(o,[],t),l=o.type===U.JSXElement?Qr(o,t):null,p=a.problematicProps.length===1?`prop "${a.problematicProps[0]}"`:`props "${a.problematicProps.join('", "')}"`;i.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:r},fix:u=>{let f=Kr(r,o,[],s,t),y=ba(r,s,l),h=e;for(;h.parent.type!==U.Program&&!(h.type===U.FunctionDeclaration||h.type===U.VariableDeclarator&&h.init&&(h.init.type===U.ArrowFunctionExpression||h.init.type===U.FunctionExpression));)h=h.parent;let m=[];return m.push(u.insertTextAfter(h,`
34
34
 
35
- ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as Fa,TSESTree as Ra}from"@typescript-eslint/utils";var va=Fa.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ei="require-description",ka=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Pa=/^eslint-disable-(next-)?line$/u,Oa=va({name:ei,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let p=Na(o);p!=null&&(n.has(p.kind)||p.description||e.report({loc:La(o.loc),messageId:"missingDescription"}))}}}}}),ti={name:ei,rule:Oa};function Na(e){let{text:t,description:r}=ja(e.value);if(!t)return null;let n=ka.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let p=Pa.test(o);if(e.type===Ra.AST_TOKEN_TYPES.Line&&!p||p&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Da=/\s-{2,}\s/u;function ja(e){let t=e.split(Da);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function La(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as Ue}from"zod/v4";var Ma=Ue.object({varsToCheck:Ue.array(Ue.object({selector:Ue.string().optional(),fromFnCall:Ue.string().optional(),prop:Ue.string().or(Ue.array(Ue.string())),errorMsg:Ue.string().optional()}))}),hn=V({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:[$(Ma)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,s,a,l){let u=new Set;for(let y of i.properties)y.type===ne.Property&&y.key.type===ne.Identifier&&u.add(y.key.name);let f=s.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:l,customMsg:a||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:l,customMsg:a||""}})}}function o(i){if(i.init?.type===ne.CallExpression){if(i.init.callee.type===ne.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.MemberExpression&&i.init.callee.property.type===ne.Identifier)return i.init.callee.object.type===ne.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let p={};for(let i of t.varsToCheck)i.selector&&(p[i.selector]=s=>{if(s.type===ne.VariableDeclarator&&s.id.type===ne.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===ne.VariableDeclarator&&s.id.type===ne.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,a,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;p[l]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.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.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[a,l]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${l}"]`;p[u]=f=>{if(f.type!==ne.MemberExpression||f.parent.type!==ne.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.VariableDeclarator)return;let x=y.parent;if(x.id.type===ne.Identifier)r.set(x.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:x.id,fnName:i.fromFnCall||"unknown function"});else if(x.id.type===ne.ObjectPattern){let m=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,m,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;p[a]=l=>{if(l.type!==ne.Identifier||l.parent.type!==ne.CallExpression)return;let u=l.parent;if(u.parent.type!==ne.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===ne.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...p,"Program:exit"(){for(let[i,{props:s,errorMsg:a,node:l,fnName:u}]of r){let y=e.sourceCode.getScope(l).set.get(i);if(y){let x=new Set(s);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.VariableDeclarator&&C.id===h)){if(C.type===ne.MemberExpression&&C.object===h&&C.property.type===ne.Identifier&&x.has(C.property.name)){if(x.delete(C.property.name),x.size===0)break;continue}if(C.type===ne.VariableDeclarator&&C.init===h&&C.id.type===ne.ObjectPattern){for(let T of C.id.properties)T.type===ne.Property&&T.key.type===ne.Identifier&&x.has(T.key.name)&&x.delete(T.key.name);if(x.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===h&&C.property.type===ne.Identifier&&!s.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:a||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:a||""}})}}}}}}}});function si(e){return/^use[A-Z0-9]/.test(e)}function Ct(e){return e.type==="Identifier"?si(e.name):e.type==="MemberExpression"&&!e.computed&&Ct(e.property)?e.object.type==="Identifier":!1}function ai(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function li(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function pi(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"forwardRef"))}function ci(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"memo"))}function bn(e){for(;e;){let t=fi(e);if(t&&(ai(t)||Ct(t))||pi(e)||ci(e))return!0;e=e.parent}return!1}function ni(e){return!1}function xn(e){return!1}var _a=/eslint +react-compiler\/react-compiler: +\["error/;function ri(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&r.expression.value==="use no memo"}function ii(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var ui={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(l){let u=null;if(l.callee.name==="useMemo"?u="useMemo":l.callee.name==="useCallback"&&(u="useCallback"),u){let f=ii(l);if(f&&ri(f))return;e.report({node:l,message:`"${u}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let l of e.sourceCode.getAllComments())if(_a.test(l.value))return{CallExpression(u){let f=null;if(u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f){let y=ii(u);if(y&&ri(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?l=>r(l):l=>e.sourceCode.getText(l),n=typeof e.getScope=="function"?()=>n():l=>e.sourceCode.getScope(l),o=null,p=[],i=[],s=new WeakSet;function a(l){for(let u of l.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&ni(f.init.callee))for(let y of u.resolved.references)y!==u&&s.add(y.identifier)}}return{onCodePathSegmentStart:l=>i.push(l),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>p.push(new Map),onCodePathEnd(l,u){let f=p.pop();if(f.size===0)return;let y=new Set;function x(E,b){let{cache:w}=x,k=w.get(E.id),O=new Set(b);if(O.has(E.id)){let c=[...O],F=c.slice(c.indexOf(E.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(O.add(E.id),k!==void 0)return k;if(l.thrownSegments.includes(E))k=BigInt("0");else if(E.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.prevSegments)k+=x(c,O)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),O=new Set(b);if(O.has(E.id)){let c=Array.from(O),F=c.slice(c.indexOf(E.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(O.add(E.id),k!==void 0)return k;if(l.thrownSegments.includes(E))k=BigInt("0");else if(E.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.nextSegments)k+=m(c,O)}return w.set(E.id,k),k}function h(E){let{cache:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let O=h(k);O<w&&(w=O)}w+=1}return b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(l.initialSegment),T=fi(u),I=bn(u),A=T?ai(T)||Ct(T):pi(u)||ci(u),S=1/0;for(let E of l.finalSegments){if(!E.reachable)continue;let b=h(E);b<S&&(S=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?S<=h(E):S<h(E),k=x(E)*m(E),O=y.has(E.id);for(let c of b)if(O&&!xn(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!O&&k!==C&&!xn(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${r(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}else if(T){let F=`React Hook "${r(c)}" is called in function "${r(T)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:F})}else if(u.type==="Program"){let F=`React Hook "${r(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}else if(I&&!xn(c)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&si(d.parent.id.name))return}let F=`React Hook "${r(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}}},CallExpression(l){if(Ct(l.callee)){let u=oi(p),f=oi(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||ni(l.callee))&&l.arguments.length>0&&(o=l)},Identifier(l){o==null&&s.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${r(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===o&&(o=null)},FunctionDeclaration(l){bn(l)&&a(n(l))},ArrowFunctionExpression(l){bn(l)&&a(n(l))}}}};function fi(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 oi(e){return e[e.length-1]}import{AST_NODE_TYPES as Te,AST_TOKEN_TYPES as $a}from"@typescript-eslint/utils";import*as xe from"zod/v4";var Ua=/^\s+$/,Cn=/\r?\n/,za=/^(\s*)/,Wa=/^(\s*)\S/,Ja=/\r?\n/,Va=xe.object({indent:xe.union([xe.string().regex(Ua),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),In=V({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(Va)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:p}=e.options[0],i=r.map(T=>T.toLowerCase());function s(T){let I=T.split(Cn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return T;let S=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(za);b&&(S=Math.min(S,b[1]?.length??0))}return!isFinite(S)||S===0?T:I.map(E=>E.slice(S)).join(`
36
- `)}function a(T,I,A){return T.split(Cn).map(E=>E.trim()===""?E:A.repeat(I)+E).join(`
37
- `)}function l(T){if(T.type===Te.Identifier)return T.name;if(T.type===Te.MemberExpression){let I=T.object.type===Te.Identifier?T.object.name:null,A=T.property.type===Te.Identifier?T.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(T,I){if(!T)return!1;for(let A of I)if(A.includes(".")){let S=A.split(".");if(T.type===Te.MemberExpression&&T.object.type===Te.Identifier&&T.property.type===Te.Identifier&&T.object.name===S[0]&&T.property.name===S[1])return!0}else if(T.type===Te.Identifier&&T.name===A)return!0;return!1}function f(T,I){let A=T.parent;if(A.type!==Te.TaggedTemplateExpression)return!1;let S=l(A.tag);return S?I.includes(S):!1}function y(T,I){if(!T||T.type!==Te.CallExpression)return!1;let{method:A,argumentsLength:S,optionalCall:E=!0,optionalMember:b=!0}=I;return S!==void 0&&T.arguments.length!==S||!E&&T.optional||T.callee.type!==Te.MemberExpression||!b&&T.callee.optional||T.callee.property.type!==Te.Identifier?!1:T.callee.property.name===A}function x(T,I){if(!T||T.type!==Te.CallExpression)return!1;let{name:A,argumentsLength:S,optionalCall:E=!0}=I;return S!==void 0&&T.arguments.length!==S||!E&&T.optional||T.callee.type!==Te.Identifier?!1:T.callee.name===A}function m(T){return y(T.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&T.parent.type===Te.CallExpression&&T.parent.arguments[0]===T&&x(T.parent.callee.type===Te.MemberExpression?T.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(T){if(i.length>0){let I=t.getTokenBefore(T,{includeComments:!0});if(I?.type===$a.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(T)||o.length>0&&f(T,o)||n.length>0&&T.parent.type===Te.CallExpression&&T.parent.arguments.includes(T)&&u(T.parent.callee,n))}function C(T){let I=`__PLACEHOLDER__${Math.random()}`,A=T.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),S=A.match(Ja);if(!S)return;let E=S[0],b=t.lines[t.getLocFromIndex(T.range[0]).line-1];if(!b)return;let k=b.match(Wa)?.[1]??"",O;typeof p=="string"?O=p:typeof p=="number"?O=" ".repeat(p):O=k.startsWith(" ")?" ":" ";let F=s(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+a(F,1,k+O)+E+k,g=A.includes(`\r
35
+ ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as Ia,TSESTree as Aa}from"@typescript-eslint/utils";var wa=Ia.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ei="require-description",Fa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ra=/^eslint-disable-(next-)?line$/u,va=wa({name:ei,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let i=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of i.getAllComments()){let a=ka(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:Na(o.loc),messageId:"missingDescription"}))}}}}}),ti={name:ei,rule:va};function ka(e){let{text:t,description:i}=Oa(e.value);if(!t)return null;let n=Fa.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Ra.test(o);if(e.type===Aa.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let r=t.slice(n.index+o.length);return{kind:o,value:r.trim(),description:i}}var Pa=/\s-{2,}\s/u;function Oa(e){let t=e.split(Pa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Na(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as Ue}from"zod/v4";var Da=Ue.object({varsToCheck:Ue.array(Ue.object({selector:Ue.string().optional(),fromFnCall:Ue.string().optional(),prop:Ue.string().or(Ue.array(Ue.string())),errorMsg:Ue.string().optional()}))}),bn=V({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:[$(Da)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let i=new Map;function n(r,s,l,p){let u=new Set;for(let y of r.properties)y.type===ne.Property&&y.key.type===ne.Identifier&&u.add(y.key.name);let f=s.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:r,messageId:"propNotRead",data:{prop:f[0],fnName:p,customMsg:l||""}});else{let y=f.map(h=>`"${h}"`).join(", ");e.report({node:r,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}}function o(r){if(r.init?.type===ne.CallExpression){if(r.init.callee.type===ne.Identifier)return r.init.callee.name;if(r.init.callee.type===ne.MemberExpression&&r.init.callee.property.type===ne.Identifier)return r.init.callee.object.type===ne.Identifier?`${r.init.callee.object.name}.${r.init.callee.property.name}`:r.init.callee.property.name}return"unknown function"}let a={};for(let r of t.varsToCheck)r.selector&&(a[r.selector]=s=>{if(s.type===ne.VariableDeclarator&&s.id.type===ne.Identifier&&i.set(s.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:s.id,fnName:o(s)}),s.type===ne.VariableDeclarator&&s.id.type===ne.ObjectPattern){let l=Array.isArray(r.prop)?r.prop:[r.prop];n(s.id,l,r.errorMsg,o(s))}});for(let r of t.varsToCheck)if(r.fromFnCall){let s=r.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let f=u.parent;if(f.parent.type!==ne.VariableDeclarator)return;let y=f.parent;if(y.id.type===ne.Identifier)i.set(y.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:y.id,fnName:r.fromFnCall||"unknown function"});else if(y.id.type===ne.ObjectPattern){let h=Array.isArray(r.prop)?r.prop:[r.prop];n(y.id,h,r.errorMsg,r.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[u]=f=>{if(f.type!==ne.MemberExpression||f.parent.type!==ne.CallExpression)return;let y=f.parent;if(y.parent.type!==ne.VariableDeclarator)return;let h=y.parent;if(h.id.type===ne.Identifier)i.set(h.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:h.id,fnName:r.fromFnCall||"unknown function"});else if(h.id.type===ne.ObjectPattern){let m=Array.isArray(r.prop)?r.prop:[r.prop];n(h.id,m,r.errorMsg,r.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==ne.Identifier||p.parent.type!==ne.CallExpression)return;let u=p.parent;if(u.parent.type!==ne.VariableDeclarator)return;let f=u.parent;if(f.id.type===ne.Identifier)i.set(f.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:f.id,fnName:r.fromFnCall||"unknown function"});else if(f.id.type===ne.ObjectPattern){let y=Array.isArray(r.prop)?r.prop:[r.prop];n(f.id,y,r.errorMsg,r.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[r,{props:s,errorMsg:l,node:p,fnName:u}]of i){let y=e.sourceCode.getScope(p).set.get(r);if(y){let h=new Set(s);for(let m of y.references){let b=m.identifier,C=b.parent;if(!(C.type===ne.VariableDeclarator&&C.id===b)){if(C.type===ne.MemberExpression&&C.object===b&&C.property.type===ne.Identifier&&h.has(C.property.name)){if(h.delete(C.property.name),h.size===0)break;continue}if(C.type===ne.VariableDeclarator&&C.init===b&&C.id.type===ne.ObjectPattern){for(let T of C.id.properties)T.type===ne.Property&&T.key.type===ne.Identifier&&h.has(T.key.name)&&h.delete(T.key.name);if(h.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===b&&C.property.type===ne.Identifier&&!s.includes(C.property.name))){h.clear();break}}}if(h.size>0){let m=Array.from(h);if(m.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:l||""}});else{let b=m.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:b,fnName:u,customMsg:l||""}})}}}}}}}});function si(e){return/^use[A-Z0-9]/.test(e)}function At(e){return e.type==="Identifier"?si(e.name):e.type==="MemberExpression"&&!e.computed&&At(e.property)?e.object.type==="Identifier":!1}function ai(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function li(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function pi(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"forwardRef"))}function ci(e){return!!(e.parent&&e.parent.callee&&li(e.parent.callee,"memo"))}function xn(e){for(;e;){let t=fi(e);if(t&&(ai(t)||At(t))||pi(e)||ci(e))return!0;e=e.parent}return!1}function ni(e){return!1}function Cn(e){return!1}var ja=/eslint +react-compiler\/react-compiler: +\["error/;function ri(e){let t=null;if((e.type==="FunctionDeclaration"||e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"&&e.body.type==="BlockStatement")&&(t=e.body),!t||t.body.length===0)return!1;let i=t.body[0];return i.type==="ExpressionStatement"&&i.expression.type==="Literal"&&i.expression.value==="use no memo"}function ii(e){let t=e.parent;for(;t;){if(t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression")return t;t=t.parent}return null}var ui={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!!e.options[0]?.reactCompilerIsEnabled;if(t)return{CallExpression(p){let u=null;if(p.callee.name==="useMemo"?u="useMemo":p.callee.name==="useCallback"&&(u="useCallback"),u){let f=ii(p);if(f&&ri(f))return;e.report({node:p,message:`"${u}" is not necessary when using React Compiler.`})}}};if(e.options[0]?.ignoreIfReactCompilerIsEnabled||t){for(let p of e.sourceCode.getAllComments())if(ja.test(p.value))return{CallExpression(u){let f=null;if(u.callee.name==="useMemo"?f="useMemo":u.callee.name==="useCallback"&&(f="useCallback"),f){let y=ii(u);if(y&&ri(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let i=typeof e.getSource=="function"?p=>i(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),o=null,a=[],r=[],s=new WeakSet;function l(p){for(let u of p.references){let f=u.identifier.parent;if(f.type==="VariableDeclarator"&&f.init&&f.init.type==="CallExpression"&&f.init.callee&&ni(f.init.callee))for(let y of u.resolved.references)y!==u&&s.add(y.identifier)}}return{onCodePathSegmentStart:p=>r.push(p),onCodePathSegmentEnd:()=>r.pop(),onCodePathStart:()=>a.push(new Map),onCodePathEnd(p,u){let f=a.pop();if(f.size===0)return;let y=new Set;function h(E,x){let{cache:w}=h,k=w.get(E.id),O=new Set(x);if(O.has(E.id)){let c=[...O],F=c.slice(c.indexOf(E.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(O.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.prevSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.prevSegments)k+=h(c,O)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,x){let{cache:w}=m,k=w.get(E.id),O=new Set(x);if(O.has(E.id)){let c=Array.from(O),F=c.slice(c.indexOf(E.id)+1);for(let d of F)y.add(d);return BigInt("0")}if(O.add(E.id),k!==void 0)return k;if(p.thrownSegments.includes(E))k=BigInt("0");else if(E.nextSegments.length===0)k=BigInt("1");else{k=BigInt("0");for(let c of E.nextSegments)k+=m(c,O)}return w.set(E.id,k),k}function b(E){let{cache:x}=b,w=x.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(x.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let O=b(k);O<w&&(w=O)}w+=1}return x.set(E.id,w),w}h.cache=new Map,m.cache=new Map,b.cache=new Map;let C=m(p.initialSegment),T=fi(u),I=xn(u),A=T?ai(T)||At(T):pi(u)||ci(u),S=1/0;for(let E of p.finalSegments){if(!E.reachable)continue;let x=b(E);x<S&&(S=x)}for(let[E,x]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?S<=b(E):S<b(E),k=h(E)*m(E),O=y.has(E.id);for(let c of x)if(O&&!Cn(c)&&e.report({node:c,message:`React Hook "${i(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${i(c)}" cannot be called in an async function.`}),!O&&k!==C&&!Cn(c)){let d=`React Hook "${i(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let F=`React Hook "${i(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}else if(T){let F=`React Hook "${i(c)}" is called in function "${i(T)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:F})}else if(u.type==="Program"){let F=`React Hook "${i(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}else if(I&&!Cn(c)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&si(d.parent.id.name))return}let F=`React Hook "${i(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:F})}}},CallExpression(p){if(At(p.callee)){let u=oi(a),f=oi(r),y=u.get(f);y||(y=[],u.set(f,y)),y.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||ni(p.callee))&&p.arguments.length>0&&(o=p)},Identifier(p){o==null&&s.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${i(p)}\` 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"(p){p===o&&(o=null)},FunctionDeclaration(p){xn(p)&&l(n(p))},ArrowFunctionExpression(p){xn(p)&&l(n(p))}}}};function fi(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 oi(e){return e[e.length-1]}import{AST_NODE_TYPES as Te,AST_TOKEN_TYPES as La}from"@typescript-eslint/utils";import*as xe from"zod/v4";var Ma=/^\s+$/,In=/\r?\n/,_a=/^(\s*)/,$a=/^(\s*)\S/,Ua=/\r?\n/,za=xe.object({indent:xe.union([xe.string().regex(Ma),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),An=V({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(za)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:i=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],r=i.map(T=>T.toLowerCase());function s(T){let I=T.split(In),A=I.filter(E=>E.trim()!=="");if(A.length===0)return T;let S=Number.POSITIVE_INFINITY;for(let E of A){let x=E.match(_a);x&&(S=Math.min(S,x[1]?.length??0))}return!isFinite(S)||S===0?T:I.map(E=>E.slice(S)).join(`
36
+ `)}function l(T,I,A){return T.split(In).map(E=>E.trim()===""?E:A.repeat(I)+E).join(`
37
+ `)}function p(T){if(T.type===Te.Identifier)return T.name;if(T.type===Te.MemberExpression){let I=T.object.type===Te.Identifier?T.object.name:null,A=T.property.type===Te.Identifier?T.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(T,I){if(!T)return!1;for(let A of I)if(A.includes(".")){let S=A.split(".");if(T.type===Te.MemberExpression&&T.object.type===Te.Identifier&&T.property.type===Te.Identifier&&T.object.name===S[0]&&T.property.name===S[1])return!0}else if(T.type===Te.Identifier&&T.name===A)return!0;return!1}function f(T,I){let A=T.parent;if(A.type!==Te.TaggedTemplateExpression)return!1;let S=p(A.tag);return S?I.includes(S):!1}function y(T,I){if(!T||T.type!==Te.CallExpression)return!1;let{method:A,argumentsLength:S,optionalCall:E=!0,optionalMember:x=!0}=I;return S!==void 0&&T.arguments.length!==S||!E&&T.optional||T.callee.type!==Te.MemberExpression||!x&&T.callee.optional||T.callee.property.type!==Te.Identifier?!1:T.callee.property.name===A}function h(T,I){if(!T||T.type!==Te.CallExpression)return!1;let{name:A,argumentsLength:S,optionalCall:E=!0}=I;return S!==void 0&&T.arguments.length!==S||!E&&T.optional||T.callee.type!==Te.Identifier?!1:T.callee.name===A}function m(T){return y(T.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&T.parent.type===Te.CallExpression&&T.parent.arguments[0]===T&&h(T.parent.callee.type===Te.MemberExpression?T.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function b(T){if(r.length>0){let I=t.getTokenBefore(T,{includeComments:!0});if(I?.type===La.Block&&r.includes(I.value.trim().toLowerCase()))return!0}return!!(m(T)||o.length>0&&f(T,o)||n.length>0&&T.parent.type===Te.CallExpression&&T.parent.arguments.includes(T)&&u(T.parent.callee,n))}function C(T){let I=`__PLACEHOLDER__${Math.random()}`,A=T.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),S=A.match(Ua);if(!S)return;let E=S[0],x=t.lines[t.getLocFromIndex(T.range[0]).line-1];if(!x)return;let k=x.match($a)?.[1]??"",O;typeof a=="string"?O=a:typeof a=="number"?O=" ".repeat(a):O=k.startsWith(" ")?" ":" ";let F=s(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+l(F,1,k+O)+E+k,g=A.includes(`\r
38
38
  `)?`\r
39
39
  `:`
40
- `,R=A.split(Cn),P=R.map((L,X)=>X!==R.length-1&&L===O+k?"":L).join(g);if(d!==P)return{node:T,messageId:"improperlyIndented",fix:L=>d.split(I).map((X,G)=>{let H=T.quasis[G];return H?L.replaceTextRange([H.range[0]+1,H.range[1]-(H.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(T){if(!h(T))return;let I=C(T);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as mi}from"@typescript-eslint/utils";function Xa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Ba(e){let t=e.parent;return t?.type===mi.NewExpression&&t.callee.type===mi.Identifier&&t.callee.name==="RegExp"}var An=V({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(r){Xa(r)||Ba(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});import{AST_NODE_TYPES as Ee}from"@typescript-eslint/utils";import{z as pt}from"zod/v4";var Ha=pt.object({checkOnly:pt.array(pt.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:pt.array(pt.string()).optional()}),wn=V({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:[$(Ha)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function p(m){for(let h of o)if(m.range[0]>=h.range[0]&&m.range[1]<=h.range[1])return h;return null}function i(m){let h=m.parent;for(;h;){if(h.type===Ee.FunctionDeclaration||h.type===Ee.FunctionExpression||h.type===Ee.ArrowFunctionExpression){let C=h.params;for(let T of C)if(m.range[0]>=T.range[0]&&m.range[1]<=T.range[1])return!0;break}h=h.parent}return!1}function s(m){let h=m.parent;for(;h;){if(h.type===Ee.TSTypeParameterInstantiation){let C=h.parent;if(C.type===Ee.TSTypeReference&&C.typeName.type===Ee.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===Ee.TSTypeReference&&C.typeName.type===Ee.TSQualifiedName&&C.typeName.right.name==="FC")return!0}h=h.parent}return!1}function a(m){let h=m.parent;for(;h;){if(h.type===Ee.TSTypeParameterInstantiation){let C=h.parent;if(C.type===Ee.CallExpression||C.type===Ee.NewExpression)return!0}h=h.parent}return!1}function l(m){let h=m.parent;for(;h;){if(h.type===Ee.TSTypeAliasDeclaration||h.type===Ee.TSInterfaceDeclaration)return!0;h=h.parent}return!1}function u(m){return m.parent.type===Ee.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let h=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let S=C.get(A)||[];S.push(I),C.set(A,S)}for(let{typeName:I,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:E}of m){let b=n.get(I);if(!b||b.statement===A)continue;let w=o.indexOf(b.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let O=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&E),F=(C.get(A)||[]).length>1;(O||F?w>k:w>k||w!==k-1)&&h.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:S})}if(h.length===0)return;h.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});let T=h[0];T&&e.report({node:T.typeDef.node,messageId:"moveTypeAboveUsage",fix:x(h)})}function x(m){return function*(h){let C=new Map;for(let T of m){let I=C.get(T.targetStatement)||[];I.push(T),C.set(T.targetStatement,I)}for(let[,T]of C)T.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});for(let T of m){let{typeDef:I}=T,A=I.statement,S=r.getCommentsBefore(A),E=A.range[0],b=A.range[1];S.length>0&&S[0]&&(E=S[0].range[0]),yield h.removeRange([E,b])}for(let[T,I]of C){let A=r.getCommentsBefore(T),S=A.length>0&&A[0]?A[0].range[0]:T.range[0],E=[];for(let b of I){let w=b.typeDef.statement,k=r.getText(w),O=r.getCommentsBefore(w),c=k;O.length>0&&(c=`${O.map(d=>r.getText(d)).join(`
40
+ `,R=A.split(In),P=R.map((L,X)=>X!==R.length-1&&L===O+k?"":L).join(g);if(d!==P)return{node:T,messageId:"improperlyIndented",fix:L=>d.split(I).map((X,G)=>{let H=T.quasis[G];return H?L.replaceTextRange([H.range[0]+1,H.range[1]-(H.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(T){if(!b(T))return;let I=C(T);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as mi}from"@typescript-eslint/utils";function Wa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function Ja(e){let t=e.parent;return t?.type===mi.NewExpression&&t.callee.type===mi.Identifier&&t.callee.name==="RegExp"}var wn=V({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function t(i){Wa(i)||Ja(i)||e.report({node:i,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});import{AST_NODE_TYPES as Ee}from"@typescript-eslint/utils";import{z as ut}from"zod/v4";var Va=ut.object({checkOnly:ut.array(ut.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:ut.array(ut.string()).optional()}),Fn=V({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:[$(Va)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let i=e.sourceCode,n=new Map,o=[];function a(m){for(let b of o)if(m.range[0]>=b.range[0]&&m.range[1]<=b.range[1])return b;return null}function r(m){let b=m.parent;for(;b;){if(b.type===Ee.FunctionDeclaration||b.type===Ee.FunctionExpression||b.type===Ee.ArrowFunctionExpression){let C=b.params;for(let T of C)if(m.range[0]>=T.range[0]&&m.range[1]<=T.range[1])return!0;break}b=b.parent}return!1}function s(m){let b=m.parent;for(;b;){if(b.type===Ee.TSTypeParameterInstantiation){let C=b.parent;if(C.type===Ee.TSTypeReference&&C.typeName.type===Ee.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===Ee.TSTypeReference&&C.typeName.type===Ee.TSQualifiedName&&C.typeName.right.name==="FC")return!0}b=b.parent}return!1}function l(m){let b=m.parent;for(;b;){if(b.type===Ee.TSTypeParameterInstantiation){let C=b.parent;if(C.type===Ee.CallExpression||C.type===Ee.NewExpression)return!0}b=b.parent}return!1}function p(m){let b=m.parent;for(;b;){if(b.type===Ee.TSTypeAliasDeclaration||b.type===Ee.TSInterfaceDeclaration)return!0;b=b.parent}return!1}function u(m){return m.parent.type===Ee.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let b=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let S=C.get(A)||[];S.push(I),C.set(A,S)}for(let{typeName:I,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:E}of m){let x=n.get(I);if(!x||x.statement===A)continue;let w=o.indexOf(x.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let O=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&E),F=(C.get(A)||[]).length>1;(O||F?w>k:w>k||w!==k-1)&&b.push({typeName:I,typeDef:x,targetStatement:A,firstUsagePosition:S})}if(b.length===0)return;b.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let E=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return E-x});let T=b[0];T&&e.report({node:T.typeDef.node,messageId:"moveTypeAboveUsage",fix:h(b)})}function h(m){return function*(b){let C=new Map;for(let T of m){let I=C.get(T.targetStatement)||[];I.push(T),C.set(T.targetStatement,I)}for(let[,T]of C)T.sort((I,A)=>{let S=I.firstUsagePosition-A.firstUsagePosition;if(S!==0)return S;let E=o.indexOf(I.typeDef.statement),x=o.indexOf(A.typeDef.statement);return E-x});for(let T of m){let{typeDef:I}=T,A=I.statement,S=i.getCommentsBefore(A),E=A.range[0],x=A.range[1];S.length>0&&S[0]&&(E=S[0].range[0]),yield b.removeRange([E,x])}for(let[T,I]of C){let A=i.getCommentsBefore(T),S=A.length>0&&A[0]?A[0].range[0]:T.range[0],E=[];for(let x of I){let w=x.typeDef.statement,k=i.getText(w),O=i.getCommentsBefore(w),c=k;O.length>0&&(c=`${O.map(d=>i.getText(d)).join(`
41
41
  `)}
42
- ${k}`),E.push(c)}yield h.insertTextBeforeRange([S,S],`${E.join(`
42
+ ${k}`),E.push(c)}yield b.insertTextBeforeRange([S,S],`${E.join(`
43
43
 
44
44
  `)}
45
45
 
46
- `)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===Ee.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=p(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===Ee.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=p(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===Ee.Identifier){if(u(m))return;let h=i(m),C=s(m),T=a(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:T,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(T){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&T.inFunctionArgs||I==="FC"&&T.inFCProps||I==="generic-args-at-fn-calls"&&T.inGenericArgAtFunctionCall)return!0;return!1}for(let T of f){let{typeName:I,node:A}=T;if(!n.has(I)||!h(T))continue;let S=p(A),E=n.get(I);if(!S||!E||S===E.statement)continue;m.has(I)||m.set(I,[]);let b=m.get(I);if(!b)return;b.includes(S)||b.push(S)}let C=[];for(let[T,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let S=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===T&&p(w.node)===A&&w.usagePosition<S&&(S=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let O of f){if(O.typeName!==T)continue;let c=p(O.node);if(!c)continue;let F=o.indexOf(c);F!==-1&&F<w&&(w=F)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let O of f){if(O.typeName!==T||l(O.node))continue;let c=p(O.node);if(!c)continue;let F=o.indexOf(c);F!==-1&&F<w&&(w=F)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:T,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as et from"zod/v4";var Ya=["tsx"],qa=/^[A-Z][A-Za-z0-9]*$/,Za=et.object({extensions:et.array(et.string()).optional()}),Fn=V({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:[$(Za)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??Ya,o=!1;for(let S of n)if(r.endsWith(S)){o=!0;break}if(!o)return{};let p=e.sourceCode,i=new Set,s=new Map;function a(S){return qa.test(S)}function l(S){if(S.type!==re.CallExpression)return!1;let E=S.callee;return E.type===re.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===re.MemberExpression&&E.property.type===re.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function u(S){if(S.type===re.JSXElement||S.type===re.JSXFragment)return!0;if(S.type===re.ArrayExpression){for(let E of S.elements)if(E&&(E.type===re.JSXElement||E.type===re.JSXFragment))return!0}return!1}function f(S){if(S.type!==re.ArrowFunctionExpression)return!1;let E=S.body;if(E.type===re.ArrowFunctionExpression){let b=E.body;if(u(b))return!0}return!1}function y(S){if(S.id.type!==re.Identifier)return;let E=S.id.name,b=S.init;if(b){if(a(E)&&(b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||l(b))){i.add(E);return}b.type===re.Identifier&&s.set(E,b.name),a(E)||f(b)&&i.add(E)}}function x(S){if(S.type===re.VariableDeclaration){for(let E of S.declarations)y(E);return}if(S.type===re.FunctionDeclaration&&S.id){a(S.id.name)&&i.add(S.id.name);return}if(S.type===re.ExportNamedDeclaration&&S.declaration){let E=S.declaration;if(E.type===re.VariableDeclaration){for(let b of E.declarations)y(b);return}if(E.type===re.FunctionDeclaration&&E.id){a(E.id.name)&&i.add(E.id.name);return}}}for(let S of p.ast.body)x(S);function m(S,E=new Set){if(i.has(S))return!0;if(E.has(S))return!1;E.add(S);let b=s.get(S);return b?m(b,E):!1}let h=[];function C(S,E,b){h.push({node:S,isType:E,isComponent:b})}for(let S of p.ast.body){if(S.type===re.ExportNamedDeclaration){let E=S.exportKind==="type";if(S.declaration){let b=S.declaration;if(b.type===re.TSTypeAliasDeclaration||b.type===re.TSInterfaceDeclaration){C(b,!0,!1);continue}if(b.type===re.VariableDeclaration){for(let w of b.declarations){if(w.id.type!==re.Identifier)continue;let k=w.id.name,O=m(k);C(w,E,O)}continue}if(b.type===re.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||a(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(S.specifiers.length>0)for(let b of S.specifiers){if(b.local.type!==re.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(S.type===re.ExportDefaultDeclaration){let E=S.declaration;if(E.type===re.Identifier){let b=m(E.name)||a(E.name);C(S,!1,b);continue}if(E.type===re.FunctionDeclaration||E.type===re.ArrowFunctionExpression||E.type===re.FunctionExpression||E.type===re.CallExpression){C(S,!1,!0);continue}C(S,!1,!1);continue}}let T=!1;for(let S of h)if(!S.isType&&S.isComponent){T=!0;break}if(!T)return{};let I=[];for(let S of h)S.isType||I.push(S);let A=-1;for(let[S,E]of I.entries())if(E.isComponent){A=S;break}if(A===-1)return{};for(let[S,E]of I.entries())if(S!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as Ve}from"@typescript-eslint/utils";import{z as Rn}from"zod/v4";function It(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ga(e){return e.callee.type===Ve.Identifier?e.callee.name==="useState":e.callee.type===Ve.MemberExpression&&e.callee.object.type===Ve.Identifier&&e.callee.property.type===Ve.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ka=Rn.object({ignorePrefixes:Rn.array(Rn.string()).optional()});function yi(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Qa(e){return`set${It(e)}`}var vn=V({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:[$(Ka)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Ve.CallExpression||!Ga(r.init)||r.id.type!==Ve.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Ve.Identifier||o.type!==Ve.Identifier)return;let p=n.name,i=o.name,s=t.ignorePrefixes||[],a=yi(p,s),l=yi(i,s);if(a===""){if(!l.startsWith("set")){let f=`set${It(p)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:It(p),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=Qa(a);l!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:It(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});import{AST_NODE_TYPES as ge}from"@typescript-eslint/utils";import{z as tt}from"zod/v4";var el=tt.object({name:tt.string(),defaults:tt.array(tt.unknown())}),tl=tt.object({functions:tt.array(el)});function At(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,p)=>At(o,t[p]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let p=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!p||!i)return!1;let s=p.value,a=i.value;if(!At(s,a))return!1}return!0}function nl(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),p=Object.getOwnPropertyDescriptor(t,n);o&&p&&At(o.value,p.value)&&r.add(n)}return r}function di(e){if(e.type===ge.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ge.Literal:return e.value;case ge.ObjectExpression:{let t={};for(let r of e.properties)r.type===ge.Property&&r.key.type===ge.Identifier&&!r.computed&&(r.value.type===ge.Literal?t[r.key.name]=r.value.value:r.value.type===ge.ObjectExpression?t[r.key.name]=di(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case ge.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===ge.SpreadElement))return t.type===ge.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function rl(e){return e.type===ge.Identifier?e.name:e.type===ge.MemberExpression&&e.property.type===ge.Identifier&&!e.computed?e.property.name:null}var kn=V({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:[$(tl)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let o=rl(n.callee);if(!o)return;let p=r.get(o);if(!p)return;let i=n.arguments;if(i.length===0)return;let s=-1,a=!1,l=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=p.length){s=m;continue}let h=p[m],C=i[m];if(!C||C.type===ge.SpreadElement){s=m;continue}let T=di(C);if(h===void 0){s=m;continue}if(At(T,h)){C.type===ge.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,T),y.push({type:"simple",position:m+1,value:T}));continue}if(C.type===ge.ObjectExpression&&C.properties.length===0&&typeof h=="object"&&h!==null&&Object.keys(h).length>0){u.add(m),y.push({type:"object",position:m+1});continue}let I=nl(T,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===ge.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){u.add(m),y.push({type:"object",position:m+1});continue}else a=!0,l.set(m,I),y.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),s=m}else s=m}if(s<i.length-1||a||u.size>0){let m=function(){let C=[];for(let T of y)if(T.type==="simple")C.push(`Param ${T.position} with value ${JSON.stringify(T.value)}`);else if(T.type==="object")C.push(`Param ${T.position} (object)`);else{let I=T.redundantProperties||[],A=p?p[T.position-1]:void 0;if(typeof A=="object"&&A!==null){let S=A;for(let E of I)if(E in S){let b=Object.getOwnPropertyDescriptor(S,E);b&&C.push(`Param ${T.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let T=[];if(a)for(let[A,S]of l){let E=i[A];if(E&&E.type===ge.ObjectExpression){let b=[];for(let k of E.properties)k.type===ge.Property&&k.key.type===ge.Identifier&&!k.computed&&S.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));T.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=s){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),S=e.sourceCode.getLastToken(n);A&&S&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}else{let A=i[I],S=e.sourceCode.getLastToken(n);S&&A&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}return T.length>0?T:null}})}}}}});import{AST_NODE_TYPES as ve}from"@typescript-eslint/utils";function il(e){let t=e.parent;for(;t;){if(t.type===ve.AwaitExpression||t.type===ve.MemberExpression&&t.object===e&&t.property.type===ve.Identifier&&t.property.name==="then"||t.type===ve.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ve.ArrayExpression&&t.parent.type===ve.CallExpression){let r=t.parent;if(r.callee.type===ve.MemberExpression&&r.callee.object.type===ve.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===ve.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function ol(e){let{callee:t}=e;return t.type===ve.Identifier&&t.name==="require"||t.type===ve.MemberExpression&&t.object.type===ve.Identifier&&t.object.name==="require"}var Pn=V({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){il(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){ol(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as On}from"zod/v4";var sl=On.object({mainComponentRegex:On.string().optional(),mainComponentSelector:On.string().optional()}),al=/^[A-Z][A-Za-z0-9]*$/,Nn=V({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:[$(sl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,s=new Map,a=[],l=[],u=new Set;function f(d){let g=d.node;if(g.type===M.VariableDeclaration){for(let R of g.declarations)if(R.id.type===M.Identifier&&R.id.name===d.name&&R.init)return R.init}if(g.type===M.ExportNamedDeclaration){let R=g.declaration;if(R&&R.type===M.VariableDeclaration){for(let P of R.declarations)if(P.id.type===M.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let g=new Set;return Oe(d,R=>(R.type===M.Identifier&&R.name!=="styled"&&R.name!=="css"&&g.add(R.name),!1),r),g}function x(d){return al.test(d)}function m(d){if(d.type!==M.CallExpression)return!1;let g=d.callee;return g.type===M.Identifier?g.name==="memo"||g.name==="forwardRef":g.type===M.MemberExpression&&g.property.type===M.Identifier?g.property.name==="memo"||g.property.name==="forwardRef":!1}function h(d){if(d.type===M.JSXElement||d.type===M.JSXFragment)return!0;if(d.type===M.BlockStatement){for(let g of d.body)if(g.type===M.ReturnStatement&&g.argument)return h(g.argument)}if(d.type===M.ArrayExpression){for(let g of d.elements)if(g&&(g.type===M.JSXElement||g.type===M.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.ArrowFunctionExpression)return!1;let g=d.body;if(g.type===M.ArrowFunctionExpression){let R=g.body;if(h(R))return!0}return!1}function T(d){if(d.type===M.TaggedTemplateExpression){let g=d.tag;if(g.type===M.MemberExpression&&g.object.type===M.Identifier&&g.object.name==="styled")return!0;if(g.type===M.CallExpression){let R=g.callee;if(R.type===M.Identifier&&R.name==="styled")return!0}}return!1}function I(d){if(d.type===M.TaggedTemplateExpression){let g=d.tag;if(g.type===M.Identifier&&g.name==="css")return!0}return!1}function A(d,g){if(d.id.type!==M.Identifier)return;let R=d.id.name,P=d.init;if(P){if(T(P)||I(P)){l.push({node:g,name:R});return}if((x(R)||P.type===M.ArrowFunctionExpression)&&(P.type===M.ArrowFunctionExpression||P.type===M.FunctionExpression||m(P))){if(P.type===M.ArrowFunctionExpression||P.type===M.FunctionExpression){if(h(P.body)){i.add(R);return}}else if(m(P)){i.add(R);return}}P.type===M.Identifier&&s.set(R,P.name),x(R)||C(P)&&i.add(R)}}function S(d){return d.type===M.ExportDefaultDeclaration||d.type===M.ExportNamedDeclaration}function E(d){if(d.type===M.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===M.VariableDeclaration){let g=d.declarations[0];if(g&&g.id.type===M.Identifier)return g.id.name}if(d.type===M.ExportDefaultDeclaration){let g=d.declaration;if(g.type===M.FunctionDeclaration)return g.id?g.id.name:"default";if(g.type===M.Identifier)return g.name}if(d.type===M.ExportNamedDeclaration){let g=d.declaration;if(g&&g.type===M.FunctionDeclaration)return g.id?g.id.name:null;if(g&&g.type===M.VariableDeclaration){let R=g.declarations[0];if(R&&R.id.type===M.Identifier)return R.id.name}}return null}function b(d,g){return o?u.has(d):n?n.test(g):S(d)}function w(d){let g=new Set;Oe(d.node,R=>{if(R.type===M.Identifier)for(let P of l)P.name===R.name&&(g.add(P.name),(P.firstUsagePosition===void 0||R.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=R.range[0]));if(R.type===M.JSXElement){let P=R.openingElement;if(P.name.type===M.JSXIdentifier)for(let L of l)L.name===P.name.name&&(g.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=g}function k(d){if(d.type===M.VariableDeclaration){for(let g of d.declarations)A(g,d);return}if(d.type===M.FunctionDeclaration){x(d.id.name)&&h(d.body)&&i.add(d.id.name);return}if(d.type===M.ExportNamedDeclaration&&d.declaration){let g=d.declaration;if(g.type===M.VariableDeclaration){for(let R of g.declarations)A(R,d);return}if(g.type===M.FunctionDeclaration&&g.id){x(g.id.name)&&h(g.body)&&i.add(g.id.name);return}}if(d.type===M.ExportDefaultDeclaration){let g=d.declaration;g.type===M.Identifier&&i.add(g.name),(g.type===M.FunctionDeclaration||g.type===M.ArrowFunctionExpression||g.type===M.FunctionExpression)&&(g.type===M.FunctionDeclaration?g.id?i.add(g.id.name):i.add("default"):h(g.body)&&i.add("default"))}}function O(d,g=new Set){if(i.has(d))return!0;if(g.has(d))return!1;g.add(d);let R=s.get(d);return R?O(R,g):!1}let c={};return o&&(c[o]=d=>{let g=d;for(;g.parent&&g.parent.type!==M.Program;)g=g.parent;g.parent&&(g.type===M.VariableDeclaration||g.type===M.FunctionDeclaration||g.type===M.ExportNamedDeclaration||g.type===M.ExportDefaultDeclaration)&&u.add(g)}),c["Program:exit"]=d=>{let g=0;for(let D of d.body){if(D.type===M.ImportDeclaration){g+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&O(Z)){let q=b(D,Z);a.push({node:D,name:Z,isMainComponent:q,usedStyles:new Set,isExported:S(D)})}}if(!o&&n&&!a.some(D=>D.isMainComponent))for(let D of a)D.isExported&&(D.isMainComponent=!0);for(let D of a)w(D);let R=new Set;for(let D of l)R.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let q of l)q.node===Z&&P.set(q.name,D)}let L=new Map;for(let D of l){let Z=f(D),q=new Set;if(Z){let ce=y(Z);for(let ue of ce)R.has(ue)&&ue!==D.name&&q.add(ue)}L.set(D.name,q)}let X=new Map;for(let D of l){let Z=L.get(D.name);if(!Z)continue;let q=P.get(D.name);if(q!==void 0)for(let ce of Z){let ue=X.get(ce);(ue===void 0||q<ue)&&X.set(ce,q)}}let G=[];for(let D of l){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),q=-1;for(let be of a){if(!be.usedStyles.has(D.name))continue;let Ce=d.body.indexOf(be.node);(q===-1||Ce<q)&&(q=Ce)}let ce=X.get(D.name);if(ce!==void 0&&(q===-1||ce<q)&&(q=ce),q===-1)continue;let ue=-1;for(let be of a){let Ce=d.body.indexOf(be.node);Ce<q&&Ce>ue&&(ue=Ce)}let Fe=Z<q,ze=Z>ue,Se=-1,nt=L.get(D.name);if(nt)for(let be of nt){let Ce=P.get(be);Ce!==void 0&&Ce>Se&&(Se=Ce)}let qe=Z>Se;if(!(Fe&&ze&&qe)){let be=ue+1;if(Se+1>be&&(be=Se+1),be<g&&(be=g),be>q)continue;G.push({style:D,targetPosition:be})}}let H=null;if(a.length>1){let D=a.map(q=>({c:q,idx:d.body.indexOf(q.node)})).sort((q,ce)=>q.idx-ce.idx)[0]?.c,Z=a.find(q=>q.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(H={component:Z,targetBefore:D.node})}if(G.length>0||H){let D=G[0]?.style.node||H?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:F(G,H,d.body)})}},c;function F(d,g,R){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),H=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(H=G[0].range[0]),H===X.node.range[0]&&r.text.slice(0,H).trim().length===0&&(H=0),yield P.removeRange([H,D])}let L=new Map;for(let X of d){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let H=R[X];if(!H)continue;let D=r.getCommentsBefore(H),Z=D.length>0&&D[0]?D[0].range[0]:H.range[0],q=[];for(let{style:ce}of G){let ue=r.getCommentsBefore(ce.node),Fe=r.getText(ce.node);ue.length>0&&(Fe=`${ue.map(Se=>r.getText(Se)).join(`
46
+ `)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===Ee.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=a(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===Ee.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=a(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===Ee.Identifier){if(u(m))return;let b=r(m),C=s(m),T=l(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:b,inFCProps:C,inGenericArgAtFunctionCall:T,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function b(T){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&T.inFunctionArgs||I==="FC"&&T.inFCProps||I==="generic-args-at-fn-calls"&&T.inGenericArgAtFunctionCall)return!0;return!1}for(let T of f){let{typeName:I,node:A}=T;if(!n.has(I)||!b(T))continue;let S=a(A),E=n.get(I);if(!S||!E||S===E.statement)continue;m.has(I)||m.set(I,[]);let x=m.get(I);if(!x)return;x.includes(S)||x.push(S)}let C=[];for(let[T,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let S=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)b(w)&&w.typeName===T&&a(w.node)===A&&w.usagePosition<S&&(S=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let O of f){if(O.typeName!==T)continue;let c=a(O.node);if(!c)continue;let F=o.indexOf(c);F!==-1&&F<w&&(w=F)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let O of f){if(O.typeName!==T||p(O.node))continue;let c=a(O.node);if(!c)continue;let F=o.indexOf(c);F!==-1&&F<w&&(w=F)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:T,firstUsage:A,firstUsagePosition:S,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as nt from"zod/v4";var Xa=["tsx"],Ba=/^[A-Z][A-Za-z0-9]*$/,Ha=nt.object({extensions:nt.array(nt.string()).optional()}),Rn=V({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:[$(Ha)]},defaultOptions:[{}],create(e,[t]){let i=e.getFilename(),n=t.extensions??Xa,o=!1;for(let S of n)if(i.endsWith(S)){o=!0;break}if(!o)return{};let a=e.sourceCode,r=new Set,s=new Map;function l(S){return Ba.test(S)}function p(S){if(S.type!==re.CallExpression)return!1;let E=S.callee;return E.type===re.Identifier?E.name==="memo"||E.name==="forwardRef":E.type===re.MemberExpression&&E.property.type===re.Identifier?E.property.name==="memo"||E.property.name==="forwardRef":!1}function u(S){if(S.type===re.JSXElement||S.type===re.JSXFragment)return!0;if(S.type===re.ArrayExpression){for(let E of S.elements)if(E&&(E.type===re.JSXElement||E.type===re.JSXFragment))return!0}return!1}function f(S){if(S.type!==re.ArrowFunctionExpression)return!1;let E=S.body;if(E.type===re.ArrowFunctionExpression){let x=E.body;if(u(x))return!0}return!1}function y(S){if(S.id.type!==re.Identifier)return;let E=S.id.name,x=S.init;if(x){if(l(E)&&(x.type===re.ArrowFunctionExpression||x.type===re.FunctionExpression||p(x))){r.add(E);return}x.type===re.Identifier&&s.set(E,x.name),l(E)||f(x)&&r.add(E)}}function h(S){if(S.type===re.VariableDeclaration){for(let E of S.declarations)y(E);return}if(S.type===re.FunctionDeclaration&&S.id){l(S.id.name)&&r.add(S.id.name);return}if(S.type===re.ExportNamedDeclaration&&S.declaration){let E=S.declaration;if(E.type===re.VariableDeclaration){for(let x of E.declarations)y(x);return}if(E.type===re.FunctionDeclaration&&E.id){l(E.id.name)&&r.add(E.id.name);return}}}for(let S of a.ast.body)h(S);function m(S,E=new Set){if(r.has(S))return!0;if(E.has(S))return!1;E.add(S);let x=s.get(S);return x?m(x,E):!1}let b=[];function C(S,E,x){b.push({node:S,isType:E,isComponent:x})}for(let S of a.ast.body){if(S.type===re.ExportNamedDeclaration){let E=S.exportKind==="type";if(S.declaration){let x=S.declaration;if(x.type===re.TSTypeAliasDeclaration||x.type===re.TSInterfaceDeclaration){C(x,!0,!1);continue}if(x.type===re.VariableDeclaration){for(let w of x.declarations){if(w.id.type!==re.Identifier)continue;let k=w.id.name,O=m(k);C(w,E,O)}continue}if(x.type===re.FunctionDeclaration){let w=x.id?.name,k=w?m(w)||l(w):!1;C(x,E,k);continue}C(x,E,!1);continue}if(S.specifiers.length>0)for(let x of S.specifiers){if(x.local.type!==re.Identifier)continue;let w=x.local.name,k=m(w);C(x,E,k)}continue}if(S.type===re.ExportDefaultDeclaration){let E=S.declaration;if(E.type===re.Identifier){let x=m(E.name)||l(E.name);C(S,!1,x);continue}if(E.type===re.FunctionDeclaration||E.type===re.ArrowFunctionExpression||E.type===re.FunctionExpression||E.type===re.CallExpression){C(S,!1,!0);continue}C(S,!1,!1);continue}}let T=!1;for(let S of b)if(!S.isType&&S.isComponent){T=!0;break}if(!T)return{};let I=[];for(let S of b)S.isType||I.push(S);let A=-1;for(let[S,E]of I.entries())if(E.isComponent){A=S;break}if(A===-1)return{};for(let[S,E]of I.entries())if(S!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as Xe}from"@typescript-eslint/utils";import{z as vn}from"zod/v4";function wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ya(e){return e.callee.type===Xe.Identifier?e.callee.name==="useState":e.callee.type===Xe.MemberExpression&&e.callee.object.type===Xe.Identifier&&e.callee.property.type===Xe.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var qa=vn.object({ignorePrefixes:vn.array(vn.string()).optional()});function yi(e,t){for(let i of t)if(e.startsWith(i))return e.slice(i.length);return e}function Za(e){return`set${wt(e)}`}var kn=V({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:[$(qa)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(i){if(!i.init||i.init.type!==Xe.CallExpression||!Ya(i.init)||i.id.type!==Xe.ArrayPattern||i.id.elements.length!==2)return;let[n,o]=i.id.elements;if(!n||!o||n.type!==Xe.Identifier||o.type!==Xe.Identifier)return;let a=n.name,r=o.name,s=t.ignorePrefixes||[],l=yi(a,s),p=yi(r,s);if(l===""){if(!p.startsWith("set")){let f=`set${wt(a)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:wt(a),actualName:r},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=Za(l);p!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:wt(l),actualName:r},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});import{AST_NODE_TYPES as ge}from"@typescript-eslint/utils";import{z as rt}from"zod/v4";var Ga=rt.object({name:rt.string(),defaults:rt.array(rt.unknown())}),Ka=rt.object({functions:rt.array(Ga)});function Ft(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,a)=>Ft(o,t[a]));let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let o of i){if(!n.includes(o))return!1;let a=Object.getOwnPropertyDescriptor(e,o),r=Object.getOwnPropertyDescriptor(t,o);if(!a||!r)return!1;let s=a.value,l=r.value;if(!Ft(s,l))return!1}return!0}function Qa(e,t){let i=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return i;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);o&&a&&Ft(o.value,a.value)&&i.add(n)}return i}function di(e){if(e.type===ge.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ge.Literal:return e.value;case ge.ObjectExpression:{let t={};for(let i of e.properties)i.type===ge.Property&&i.key.type===ge.Identifier&&!i.computed&&(i.value.type===ge.Literal?t[i.key.name]=i.value.value:i.value.type===ge.ObjectExpression?t[i.key.name]=di(i.value):t[i.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case ge.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===ge.SpreadElement))return t.type===ge.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function el(e){return e.type===ge.Identifier?e.name:e.type===ge.MemberExpression&&e.property.type===ge.Identifier&&!e.computed?e.property.name:null}var Pn=V({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:[$(Ka)]},defaultOptions:[{functions:[]}],create(e,[t]){let i=new Map;for(let n of t.functions)i.set(n.name,n.defaults);return{CallExpression(n){let o=el(n.callee);if(!o)return;let a=i.get(o);if(!a)return;let r=n.arguments;if(r.length===0)return;let s=-1,l=!1,p=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<r.length;m++){if(m>=a.length){s=m;continue}let b=a[m],C=r[m];if(!C||C.type===ge.SpreadElement){s=m;continue}let T=di(C);if(b===void 0){s=m;continue}if(Ft(T,b)){C.type===ge.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,T),y.push({type:"simple",position:m+1,value:T}));continue}if(C.type===ge.ObjectExpression&&C.properties.length===0&&typeof b=="object"&&b!==null&&Object.keys(b).length>0){u.add(m),y.push({type:"object",position:m+1});continue}let I=Qa(T,b);if(I.size>0){let A=typeof b=="object"&&b!==null?Object.keys(b).length:0;if(C.type===ge.ObjectExpression&&C.properties.length===I.size&&C.properties.length===A){u.add(m),y.push({type:"object",position:m+1});continue}else l=!0,p.set(m,I),y.push({type:"partialObject",position:m+1,redundantProperties:Array.from(I)}),s=m}else s=m}if(s<r.length-1||l||u.size>0){let m=function(){let C=[];for(let T of y)if(T.type==="simple")C.push(`Param ${T.position} with value ${JSON.stringify(T.value)}`);else if(T.type==="object")C.push(`Param ${T.position} (object)`);else{let I=T.redundantProperties||[],A=a?a[T.position-1]:void 0;if(typeof A=="object"&&A!==null){let S=A;for(let E of I)if(E in S){let x=Object.getOwnPropertyDescriptor(S,E);x&&C.push(`Param ${T.position} property "${E}" with value ${JSON.stringify(x.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var h=m;let b=m();e.report({node:n,messageId:b.messageId,data:b.data,fix(C){let T=[];if(l)for(let[A,S]of p){let E=r[A];if(E&&E.type===ge.ObjectExpression){let x=[];for(let k of E.properties)k.type===ge.Property&&k.key.type===ge.Identifier&&!k.computed&&S.has(k.key.name)||x.push(k);let w=x.map(k=>e.sourceCode.getText(k));T.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=r.length-1;A>=0;A--)if(!u.has(A)&&A<=s){I=A;break}if(I<r.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),S=e.sourceCode.getLastToken(n);A&&S&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}else{let A=r[I],S=e.sourceCode.getLastToken(n);S&&A&&T.push(C.replaceTextRange([A.range[1],S.range[0]],""))}return T.length>0?T:null}})}}}}});import{AST_NODE_TYPES as ve}from"@typescript-eslint/utils";function tl(e){let t=e.parent;for(;t;){if(t.type===ve.AwaitExpression||t.type===ve.MemberExpression&&t.object===e&&t.property.type===ve.Identifier&&t.property.name==="then"||t.type===ve.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ve.ArrayExpression&&t.parent.type===ve.CallExpression){let i=t.parent;if(i.callee.type===ve.MemberExpression&&i.callee.object.type===ve.Identifier&&i.callee.object.name==="Promise"&&i.callee.property.type===ve.Identifier&&["all","allSettled","race"].includes(i.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function nl(e){let{callee:t}=e;return t.type===ve.Identifier&&t.name==="require"||t.type===ve.MemberExpression&&t.object.type===ve.Identifier&&t.object.name==="require"}var On=V({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){tl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){nl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as Nn}from"zod/v4";var rl=Nn.object({mainComponentRegex:Nn.string().optional(),mainComponentSelector:Nn.string().optional()}),il=/^[A-Z][A-Za-z0-9]*$/,Dn=V({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:[$(rl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let i=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let r=new Set,s=new Map,l=[],p=[],u=new Set;function f(d){let g=d.node;if(g.type===M.VariableDeclaration){for(let R of g.declarations)if(R.id.type===M.Identifier&&R.id.name===d.name&&R.init)return R.init}if(g.type===M.ExportNamedDeclaration){let R=g.declaration;if(R&&R.type===M.VariableDeclaration){for(let P of R.declarations)if(P.id.type===M.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let g=new Set;return Oe(d,R=>(R.type===M.Identifier&&R.name!=="styled"&&R.name!=="css"&&g.add(R.name),!1),i),g}function h(d){return il.test(d)}function m(d){if(d.type!==M.CallExpression)return!1;let g=d.callee;return g.type===M.Identifier?g.name==="memo"||g.name==="forwardRef":g.type===M.MemberExpression&&g.property.type===M.Identifier?g.property.name==="memo"||g.property.name==="forwardRef":!1}function b(d){if(d.type===M.JSXElement||d.type===M.JSXFragment)return!0;if(d.type===M.BlockStatement){for(let g of d.body)if(g.type===M.ReturnStatement&&g.argument)return b(g.argument)}if(d.type===M.ArrayExpression){for(let g of d.elements)if(g&&(g.type===M.JSXElement||g.type===M.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.ArrowFunctionExpression)return!1;let g=d.body;if(g.type===M.ArrowFunctionExpression){let R=g.body;if(b(R))return!0}return!1}function T(d){if(d.type===M.TaggedTemplateExpression){let g=d.tag;if(g.type===M.MemberExpression&&g.object.type===M.Identifier&&g.object.name==="styled")return!0;if(g.type===M.CallExpression){let R=g.callee;if(R.type===M.Identifier&&R.name==="styled")return!0}}return!1}function I(d){if(d.type===M.TaggedTemplateExpression){let g=d.tag;if(g.type===M.Identifier&&g.name==="css")return!0}return!1}function A(d,g){if(d.id.type!==M.Identifier)return;let R=d.id.name,P=d.init;if(P){if(T(P)||I(P)){p.push({node:g,name:R});return}if((h(R)||P.type===M.ArrowFunctionExpression)&&(P.type===M.ArrowFunctionExpression||P.type===M.FunctionExpression||m(P))){if(P.type===M.ArrowFunctionExpression||P.type===M.FunctionExpression){if(b(P.body)){r.add(R);return}}else if(m(P)){r.add(R);return}}P.type===M.Identifier&&s.set(R,P.name),h(R)||C(P)&&r.add(R)}}function S(d){return d.type===M.ExportDefaultDeclaration||d.type===M.ExportNamedDeclaration}function E(d){if(d.type===M.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===M.VariableDeclaration){let g=d.declarations[0];if(g&&g.id.type===M.Identifier)return g.id.name}if(d.type===M.ExportDefaultDeclaration){let g=d.declaration;if(g.type===M.FunctionDeclaration)return g.id?g.id.name:"default";if(g.type===M.Identifier)return g.name}if(d.type===M.ExportNamedDeclaration){let g=d.declaration;if(g&&g.type===M.FunctionDeclaration)return g.id?g.id.name:null;if(g&&g.type===M.VariableDeclaration){let R=g.declarations[0];if(R&&R.id.type===M.Identifier)return R.id.name}}return null}function x(d,g){return o?u.has(d):n?n.test(g):S(d)}function w(d){let g=new Set;Oe(d.node,R=>{if(R.type===M.Identifier)for(let P of p)P.name===R.name&&(g.add(P.name),(P.firstUsagePosition===void 0||R.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=R.range[0]));if(R.type===M.JSXElement){let P=R.openingElement;if(P.name.type===M.JSXIdentifier)for(let L of p)L.name===P.name.name&&(g.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},i),d.usedStyles=g}function k(d){if(d.type===M.VariableDeclaration){for(let g of d.declarations)A(g,d);return}if(d.type===M.FunctionDeclaration){h(d.id.name)&&b(d.body)&&r.add(d.id.name);return}if(d.type===M.ExportNamedDeclaration&&d.declaration){let g=d.declaration;if(g.type===M.VariableDeclaration){for(let R of g.declarations)A(R,d);return}if(g.type===M.FunctionDeclaration&&g.id){h(g.id.name)&&b(g.body)&&r.add(g.id.name);return}}if(d.type===M.ExportDefaultDeclaration){let g=d.declaration;g.type===M.Identifier&&r.add(g.name),(g.type===M.FunctionDeclaration||g.type===M.ArrowFunctionExpression||g.type===M.FunctionExpression)&&(g.type===M.FunctionDeclaration?g.id?r.add(g.id.name):r.add("default"):b(g.body)&&r.add("default"))}}function O(d,g=new Set){if(r.has(d))return!0;if(g.has(d))return!1;g.add(d);let R=s.get(d);return R?O(R,g):!1}let c={};return o&&(c[o]=d=>{let g=d;for(;g.parent&&g.parent.type!==M.Program;)g=g.parent;g.parent&&(g.type===M.VariableDeclaration||g.type===M.FunctionDeclaration||g.type===M.ExportNamedDeclaration||g.type===M.ExportDefaultDeclaration)&&u.add(g)}),c["Program:exit"]=d=>{let g=0;for(let D of d.body){if(D.type===M.ImportDeclaration){g+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&O(Z)){let q=x(D,Z);l.push({node:D,name:Z,isMainComponent:q,usedStyles:new Set,isExported:S(D)})}}if(!o&&n&&!l.some(D=>D.isMainComponent))for(let D of l)D.isExported&&(D.isMainComponent=!0);for(let D of l)w(D);let R=new Set;for(let D of p)R.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let q of p)q.node===Z&&P.set(q.name,D)}let L=new Map;for(let D of p){let Z=f(D),q=new Set;if(Z){let ce=y(Z);for(let ue of ce)R.has(ue)&&ue!==D.name&&q.add(ue)}L.set(D.name,q)}let X=new Map;for(let D of p){let Z=L.get(D.name);if(!Z)continue;let q=P.get(D.name);if(q!==void 0)for(let ce of Z){let ue=X.get(ce);(ue===void 0||q<ue)&&X.set(ce,q)}}let G=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),q=-1;for(let be of l){if(!be.usedStyles.has(D.name))continue;let Ce=d.body.indexOf(be.node);(q===-1||Ce<q)&&(q=Ce)}let ce=X.get(D.name);if(ce!==void 0&&(q===-1||ce<q)&&(q=ce),q===-1)continue;let ue=-1;for(let be of l){let Ce=d.body.indexOf(be.node);Ce<q&&Ce>ue&&(ue=Ce)}let Fe=Z<q,ze=Z>ue,Se=-1,it=L.get(D.name);if(it)for(let be of it){let Ce=P.get(be);Ce!==void 0&&Ce>Se&&(Se=Ce)}let Ze=Z>Se;if(!(Fe&&ze&&Ze)){let be=ue+1;if(Se+1>be&&(be=Se+1),be<g&&(be=g),be>q)continue;G.push({style:D,targetPosition:be})}}let H=null;if(l.length>1){let D=l.map(q=>({c:q,idx:d.body.indexOf(q.node)})).sort((q,ce)=>q.idx-ce.idx)[0]?.c,Z=l.find(q=>q.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(H={component:Z,targetBefore:D.node})}if(G.length>0||H){let D=G[0]?.style.node||H?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:F(G,H,d.body)})}},c;function F(d,g,R){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=i.getCommentsBefore(X.node),H=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(H=G[0].range[0]),H===X.node.range[0]&&i.text.slice(0,H).trim().length===0&&(H=0),yield P.removeRange([H,D])}let L=new Map;for(let X of d){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let H=R[X];if(!H)continue;let D=i.getCommentsBefore(H),Z=D.length>0&&D[0]?D[0].range[0]:H.range[0],q=[];for(let{style:ce}of G){let ue=i.getCommentsBefore(ce.node),Fe=i.getText(ce.node);ue.length>0&&(Fe=`${ue.map(Se=>i.getText(Se)).join(`
47
47
  `)}
48
48
  ${Fe}`),q.push(Fe)}yield P.insertTextBeforeRange([Z,Z],`${q.join(`
49
49
 
50
50
  `)}
51
51
 
52
- `)}if(g){let{component:X,targetBefore:G}=g,H=r.getCommentsBefore(X.node),D=X.node.range[0],Z=X.node.range[1];H.length>0&&H[0]&&(D=H[0].range[0]),D===X.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let q=r.getCommentsBefore(G),ce=q.length>0&&q[0]?q[0].range[0]:G.range[0],ue=(()=>{let Fe=r.getText(X.node);return H.length>0&&(Fe=`${H.map(Se=>r.getText(Se)).join(`
52
+ `)}if(g){let{component:X,targetBefore:G}=g,H=i.getCommentsBefore(X.node),D=X.node.range[0],Z=X.node.range[1];H.length>0&&H[0]&&(D=H[0].range[0]),D===X.node.range[0]&&i.text.slice(0,D).trim().length===0&&(D=0);let q=i.getCommentsBefore(G),ce=q.length>0&&q[0]?q[0].range[0]:G.range[0],ue=(()=>{let Fe=i.getText(X.node);return H.length>0&&(Fe=`${H.map(Se=>i.getText(Se)).join(`
53
53
  `)}
54
54
  ${Fe}`),Fe})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([ce,ce],`${ue}
55
- `)}}}}});import{AST_NODE_TYPES as ll,ESLintUtils as pl}from"@typescript-eslint/utils";import gi from"typescript";import{z as cl}from"zod/v4";var ul=cl.object({}),Dn=V({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:[$(ul)]},defaultOptions:[{}],create(e){let t=pl.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o,p){if(o.flags&gi.TypeFlags.Any||o.flags&gi.TypeFlags.Unknown)return!1;let i=o.getProperty("then");return i?p.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==ll.CallExpression)return;let p=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(p);if(!n(i,r)){let a=e.sourceCode.getText(o.argument);e.report({node:o,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(l){return l.replaceText(o,a)}}]})}}}}});import{AST_NODE_TYPES as Ie}from"@typescript-eslint/utils";import{z as ct}from"zod/v4";var fl=ct.object({functions:ct.array(ct.string()).optional(),selectors:ct.array(ct.string()).optional()});function Si(e){let t=e.parent;for(;t;){if(t.type===Ie.FunctionDeclaration||t.type===Ie.FunctionExpression||t.type===Ie.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Ti(e){if(e.type===Ie.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ie.Identifier?r.name:r.type===Ie.MemberExpression&&r.property.type===Ie.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ie.Identifier?t.name:t.type===Ie.MemberExpression&&t.property.type===Ie.Identifier?t.property.name:null}var jn=V({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[$(fl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(Si(i))return;let s=Ti(i);s&&r.has(s)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:s}})}let p={CallExpression(i){i.type===Ie.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ie.TaggedTemplateExpression&&o(i)}};for(let i of n)p[i]=s=>{if(s.type!==Ie.CallExpression&&s.type!==Ie.TaggedTemplateExpression||Si(s))return;let a=Ti(s);a&&e.report({node:s,messageId:"moduleLevel",data:{functionName:a}})};return p}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function ml(e,t){let{body:r}=e;if(r.type!==ke.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==ke.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function yl(e){let t=e.parent;if(t.type!==ke.ReturnStatement)return null;let r=t.parent;if(r.type!==ke.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==ke.FunctionDeclaration&&n.type!==ke.ArrowFunctionExpression&&n.type!==ke.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Ln=V({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(r){let{callee:n,arguments:o}=r;if(o.length>0||n.type!==ke.FunctionExpression&&n.type!==ke.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:p}=n;if(p.type===ke.BlockStatement){if(p.body.length!==1){let l=yl(r);if(l){if(t.getCommentsInside(n).length>0)return;let f=t.getText(p);e.report({node:r,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:x}=l;return x.body.type!==ke.BlockStatement?null:y.replaceText(x.body,f)}})}return}let a=p.body[0];if(!a||a.type!==ke.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let s=ml(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:a=>a.replaceText(r,s)})}}}});import{z as Ye}from"zod/v4";var dl="no-restricted-comments",gl=Ye.object({regex:Ye.string().optional(),includes:Ye.string().optional(),message:Ye.string().optional(),autoFix:Ye.boolean().optional()}),Sl=Ye.object({patterns:Ye.array(gl)}),Mn=V({name:dl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[$(Sl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function o(i){let s=n.get(i);return s||(s=new RegExp(i),n.set(i,s)),s}function p(i,s){return s.regex?o(s.regex).test(i):s.includes?i.includes(s.includes):!1}return{Program(){let i=r.getAllComments();for(let a of i)for(let l of t.patterns)if(p(a.value,l)){let f=function(y){return y.remove(a)};var s=f;let u=l.regex??l.includes??"";l.message?e.report({loc:a.loc,messageId:"restrictedCommentWithMessage",data:{message:l.message},fix:l.autoFix?f:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:f}]}):e.report({loc:a.loc,messageId:"restrictedComment",data:{pattern:u},fix:l.autoFix?f:void 0,suggest:l.autoFix?void 0:[{messageId:"removeComment",fix:f}]});break}}}}});import{AST_NODE_TYPES as _n}from"@typescript-eslint/utils";import{z as ut}from"zod/v4";var Tl=ut.object({allow:ut.record(ut.string(),ut.array(ut.string())).optional()}),$n=V({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[$(Tl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let s=i.charAt(0);return s===s.toUpperCase()&&s!==s.toLowerCase()}function o(i){return i.type===_n.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===_n.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function p(i,s){let a=r[i];return a?a.includes(s):!1}return{JSXAttribute(i){if(i.name.type!==_n.JSXIdentifier)return;let s=i.name.name;if(!s.startsWith("data-"))return;let a=o(i.parent.name);!a||!a.isCustom||a.name&&p(a.name,s)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});var Ei={[on.name]:on.rule,[$t.name]:$t.rule,[_t.name]:_t.rule,"rules-of-hooks":ui,"exhaustive-deps":Gn,"require-description":ti.rule,[Ut.name]:Ut.rule,[Wt.name]:Wt.rule,[ln.name]:ln.rule,[Ft.name]:Ft.rule,[Mt.name]:Mt.rule,[Xt.name]:Xt.rule,[it.name]:it.rule,[fn.name]:fn.rule,[Jt.name]:Jt.rule,[zt.name]:zt.rule,[Bt.name]:Bt.rule,[vt.name]:vt.rule,[gn.name]:gn.rule,[dn.name]:dn.rule,[En.name]:En.rule,[jt.name]:jt.rule,[Zt.name]:Zt.rule,[Gt.name]:Gt.rule,[Kt.name]:Kt.rule,[tn.name]:tn.rule,[nn.name]:nn.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[cn.name]:cn.rule,[Yt.name]:Yt.rule,[Ht.name]:Ht.rule,[An.name]:An.rule,[sn.name]:sn.rule,[hn.name]:hn.rule,[In.name]:In.rule,[wn.name]:wn.rule,[Fn.name]:Fn.rule,[vn.name]:vn.rule,[kn.name]:kn.rule,[Pn.name]:Pn.rule,[Nn.name]:Nn.rule,[Dn.name]:Dn.rule,[jn.name]:jn.rule,[it.name]:it.rule,[Ln.name]:Ln.rule,[Mn.name]:Mn.rule,[$n.name]:$n.rule};var mm={rules:Ei};export{mm as extendedLintPlugin};
55
+ `)}}}}});import{AST_NODE_TYPES as ol,ESLintUtils as sl}from"@typescript-eslint/utils";import gi from"typescript";import{z as al}from"zod/v4";var ll=al.object({}),jn=V({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:[$(ll)]},defaultOptions:[{}],create(e){let t=sl.getParserServices(e,!0),i=t.program?.getTypeChecker();if(!i||!t.program)throw new Error("TypeScript services or program not available");function n(o,a){if(o.flags&gi.TypeFlags.Any||o.flags&gi.TypeFlags.Unknown)return!1;let r=o.getProperty("then");return r?a.getTypeOfSymbol(r).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==ol.CallExpression)return;let a=t.esTreeNodeToTSNodeMap.get(o.argument),r=i.getTypeAtLocation(a);if(!n(r,i)){let l=e.sourceCode.getText(o.argument);e.report({node:o,messageId:"unnecessaryVoid",suggest:[{messageId:"removeVoid",fix(p){return p.replaceText(o,l)}}]})}}}}});import{AST_NODE_TYPES as Ie}from"@typescript-eslint/utils";import{z as ft}from"zod/v4";var pl=ft.object({functions:ft.array(ft.string()).optional(),selectors:ft.array(ft.string()).optional()});function Si(e){let t=e.parent;for(;t;){if(t.type===Ie.FunctionDeclaration||t.type===Ie.FunctionExpression||t.type===Ie.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Ti(e){if(e.type===Ie.TaggedTemplateExpression){let{tag:i}=e;return i.type===Ie.Identifier?i.name:i.type===Ie.MemberExpression&&i.property.type===Ie.Identifier?i.property.name:null}let{callee:t}=e;return t.type===Ie.Identifier?t.name:t.type===Ie.MemberExpression&&t.property.type===Ie.Identifier?t.property.name:null}var Ln=V({name:"require-lazy-execution",meta:{type:"problem",docs:{description:"Require certain function calls to be executed lazily (inside functions, not at module level)"},messages:{moduleLevel:'Function "{{ functionName }}" must only be called inside functions or getters, not at module level'},schema:[$(pl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,i=new Set(t.functions??[]),n=t.selectors??[];function o(r){if(Si(r))return;let s=Ti(r);s&&i.has(s)&&e.report({node:r,messageId:"moduleLevel",data:{functionName:s}})}let a={CallExpression(r){r.type===Ie.CallExpression&&o(r)},TaggedTemplateExpression(r){r.type===Ie.TaggedTemplateExpression&&o(r)}};for(let r of n)a[r]=s=>{if(s.type!==Ie.CallExpression&&s.type!==Ie.TaggedTemplateExpression||Si(s))return;let l=Ti(s);l&&e.report({node:s,messageId:"moduleLevel",data:{functionName:l}})};return a}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function cl(e,t){let{body:i}=e;if(i.type!==ke.BlockStatement)return t.getText(i);let n=i.body[0];return!n||n.type!==ke.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function ul(e){let t=e.parent;if(t.type!==ke.ReturnStatement)return null;let i=t.parent;if(i.type!==ke.BlockStatement||i.body.length!==1)return null;let n=i.parent;return n.type!==ke.FunctionDeclaration&&n.type!==ke.ArrowFunctionExpression&&n.type!==ke.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Mn=V({name:"no-unnecessary-iife",meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary immediately invoked function expressions"},messages:{unnecessaryIife:"Unnecessary IIFE. Can be simplified to the returned expression."},schema:[]},defaultOptions:[],create(e){let t=e.sourceCode;return{CallExpression(i){let{callee:n,arguments:o}=i;if(o.length>0||n.type!==ke.FunctionExpression&&n.type!==ke.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:a}=n;if(a.type===ke.BlockStatement){if(a.body.length!==1){let p=ul(i);if(p){if(t.getCommentsInside(n).length>0)return;let f=t.getText(a);e.report({node:i,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:h}=p;return h.body.type!==ke.BlockStatement?null:y.replaceText(h.body,f)}})}return}let l=a.body[0];if(!l||l.type!==ke.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let s=cl(n,t);e.report({node:i,messageId:"unnecessaryIife",fix:l=>l.replaceText(i,s)})}}}});import{z as qe}from"zod/v4";var fl="no-restricted-comments",ml=qe.object({regex:qe.string().optional(),includes:qe.string().optional(),message:qe.string().optional(),autoFix:qe.boolean().optional()}),yl=qe.object({patterns:qe.array(ml)}),_n=V({name:fl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[$(yl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let i=e.sourceCode,n=new Map;function o(r){let s=n.get(r);return s||(s=new RegExp(r),n.set(r,s)),s}function a(r,s){return s.regex?o(s.regex).test(r):s.includes?r.includes(s.includes):!1}return{Program(){let r=i.getAllComments();for(let l of r)for(let p of t.patterns)if(a(l.value,p)){let f=function(y){return y.remove(l)};var s=f;let u=p.regex??p.includes??"";p.message?e.report({loc:l.loc,messageId:"restrictedCommentWithMessage",data:{message:p.message},fix:p.autoFix?f:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:f}]}):e.report({loc:l.loc,messageId:"restrictedComment",data:{pattern:u},fix:p.autoFix?f:void 0,suggest:p.autoFix?void 0:[{messageId:"removeComment",fix:f}]});break}}}}});import{AST_NODE_TYPES as $n}from"@typescript-eslint/utils";import{z as mt}from"zod/v4";var dl=mt.object({allow:mt.record(mt.string(),mt.array(mt.string())).optional()}),Un=V({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[$(dl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let i=t.allow??{};function n(r){let s=r.charAt(0);return s===s.toUpperCase()&&s!==s.toLowerCase()}function o(r){return r.type===$n.JSXIdentifier?{name:r.name,isCustom:n(r.name)}:r.type===$n.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${r.namespace.name}:${r.name.name}`,isCustom:!1}}function a(r,s){let l=i[r];return l?l.includes(s):!1}return{JSXAttribute(r){if(r.name.type!==$n.JSXIdentifier)return;let s=r.name.name;if(!s.startsWith("data-"))return;let l=o(r.parent.name);!l||!l.isCustom||l.name&&a(l.name,s)||e.report({node:r,messageId:"noDataAttributesOnComponents"})}}}});var Ei={[sn.name]:sn.rule,[Ut.name]:Ut.rule,[$t.name]:$t.rule,"rules-of-hooks":ui,"exhaustive-deps":Kn,"require-description":ti.rule,[zt.name]:zt.rule,[Jt.name]:Jt.rule,[pn.name]:pn.rule,[vt.name]:vt.rule,[_t.name]:_t.rule,[Bt.name]:Bt.rule,[st.name]:st.rule,[mn.name]:mn.rule,[Vt.name]:Vt.rule,[Wt.name]:Wt.rule,[Ht.name]:Ht.rule,[Pt.name]:Pt.rule,[Sn.name]:Sn.rule,[gn.name]:gn.rule,[hn.name]:hn.rule,[Mt.name]:Mt.rule,[Gt.name]:Gt.rule,[Kt.name]:Kt.rule,[Qt.name]:Qt.rule,[nn.name]:nn.rule,[rn.name]:rn.rule,[en.name]:en.rule,[tn.name]:tn.rule,[un.name]:un.rule,[qt.name]:qt.rule,[Yt.name]:Yt.rule,[wn.name]:wn.rule,[an.name]:an.rule,[bn.name]:bn.rule,[An.name]:An.rule,[Fn.name]:Fn.rule,[Rn.name]:Rn.rule,[kn.name]:kn.rule,[Pn.name]:Pn.rule,[On.name]:On.rule,[Dn.name]:Dn.rule,[jn.name]:jn.rule,[Ln.name]:Ln.rule,[st.name]:st.rule,[Mn.name]:Mn.rule,[_n.name]:_n.rule,[Un.name]:Un.rule};var fm={rules:Ei};export{fm as extendedLintPlugin};