@ls-stack/extended-lint 0.88.0 → 0.88.1

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,6 +1,6 @@
1
- import{AST_NODE_TYPES as be}from"@typescript-eslint/utils";import{z as _}from"zod/v4";import{ESLintUtils as ki}from"@typescript-eslint/utils";import*as Bn from"zod/v4";function $(e){let r=ki.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function U(e){return Bn.toJSONSchema(e)}var Pi=_.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(),excludeRegex:_.optional(_.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()})))})))}),kt=$({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[U(Pi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,l=[],p=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===be.ImportSpecifier&&w.imported.type===be.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===be.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(b.declaration.type===be.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===be.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===be.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&v==="any"&&y.delete(N)}}}function C(b){b.id.type===be.Identifier&&b.init?.type===be.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:L}of v??[])F=F.replaceAll(P,L);return F};var E=d;let v=Ni(a,new RegExp(b));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:T,message:F}of k??[]){let P=`Expected file to call the function: ${T.map(({fn:L})=>L).join(" or ")}`;u.add(P),l.push(L=>{let{callee:X}=L;if(X.type===be.Identifier){for(let{fn:G,withArgs:q}of T)if(X.name===G){u.delete(P);for(let D of q){let Z=L.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:L,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${d(F)}`:""}`}});continue}if(Z.type!==be.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${d(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${d(F)}`:""}`},fix:pe=>pe.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:T,message:F}of N??[])f.set(T,d(F)),p.set(d(T),()=>{f.delete(T)});for(let{name:T,type:F,message:P}of c??[]){let L=d(T),X=d(P);y.add(`${L}:${F}:${X}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||l.push(v=>{let{callee:d}=v;if(d.type!==be.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.Literal||P.value!==F.value)return}let T=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:T}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){l.push(c=>{g(k,c,w,N)});continue}r[b]=c=>{g(k,c,w,N)}}if(p.size>0)for(let[b,w]of p)A(b,w);return l.length>0&&(r.CallExpression=b=>{if(b.type===be.CallExpression)for(let w of l)w(b)}),r.ImportDeclaration=b=>{b.type===be.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===be.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===be.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(b,w,k,N){let c=v=>{if(!b)return null;if(typeof b=="string")return v.replaceText(w,b);{let d=new RegExp(b.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?c:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Ni(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Hn(o)}),r.push({name:"$0_uncapitalize",value:Yn(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,l=s[i];l!==void 0&&(r.push({name:`${a}_lowercase`,value:l.toLowerCase()}),r.push({name:`${a}_capitalize`,value:Hn(l)}),r.push({name:`${a}_uncapitalize`,value:Yn(l)}),r.push({name:a,value:l}))}return r}function Hn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yn(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as se,AST_TOKEN_TYPES as qn,ESLintUtils as Oi}from"@typescript-eslint/utils";import{z as He}from"zod/v4";var Di=Oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="collapse-simple-objs-in-one-line",Li=He.object({maxLineLength:He.number().optional(),maxProperties:He.number().optional(),nestedObjMaxLineLength:He.number().optional(),nestedObjMaxProperties:He.number().optional(),ignoreTypesWithSuffix:He.array(He.string()).optional()}),ji=Di({name:Gn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[U(Li)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(p){if(p.type===se.ObjectExpression){let u=p.parent.type===se.Property,f=u?i:o,y=p.properties.length;if(y>f)return!1;if(y===1){let m=p.properties[0];return!m||m.type===se.Property&&m.value.type===se.ObjectExpression||m.type===se.Property&&m.value.type===se.ArrayExpression&&!m.value.elements.every(C=>C&&Pt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of p.properties){if(m.type===se.Property&&!Pt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=p.parent.parent?.type===se.TSPropertySignature,f=u?i:o,y=p.members.length;if(y>f)return!1;if(n.length>0&&p.parent.type===se.TSTypeAliasDeclaration){let m=p.parent.id.name;if(n.some(h=>m.endsWith(h)))return!1}if(y===1){let m=p.members[0];return!m||m.type===se.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===se.TSTypeLiteral?!1:{text:r.getText(m),isNested:u,propsSize:1}}if(p.parent.type===se.TSIntersectionType||p.parent.type===se.TSUnionType&&p.parent.types[0]!==p)return!1;let x=[];for(let m of p.members){if(m.type!==se.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===se.TSTypeLiteral||!Zn(h))return!1;if(h.type===se.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let S=h.typeArguments.params[0];if(!S||!Zn(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==se.JSXExpressionContainer){let h=0,C=!1,S=r.getTokenAfter(p,{filter:A=>A.type!==qn.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=S?.type===qn.Template&&S.value.startsWith(`}
1
+ import{AST_NODE_TYPES as be}from"@typescript-eslint/utils";import{z as _}from"zod/v4";import{ESLintUtils as ki}from"@typescript-eslint/utils";import*as Bn from"zod/v4";function $(e){let r=ki.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function U(e){return Bn.toJSONSchema(e)}var Pi=_.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(),excludeRegex:_.optional(_.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()})))})))}),kt=$({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[U(Pi)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:s,disallowFnCalls:i}=t,a=o??e.filename,l=[],p=new Map,u=new Set,f=new Map,y=new Set,x=new Map;function m(b){for(let w of b.specifiers)w.type===be.ImportSpecifier&&w.imported.type===be.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function h(b){if(b.declaration){if(b.declaration.type===be.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let k of Array.from(y)){let[N,c]=k.split(":");N===w&&(c==="function"||c==="any")&&y.delete(k)}}else if(b.declaration.type===be.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===be.Identifier){let k=w.id.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&(v==="variable"||v==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===be.Identifier){let k=w.exported.name;for(let N of Array.from(y)){let[c,v]=N.split(":");c===k&&v==="any"&&y.delete(N)}}}function C(b){b.id.type===be.Identifier&&b.init?.type===be.Identifier&&x.set(b.id.name,b.init.name)}function S(b){return x.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,excludeRegex:w,mustCallFn:k,mustMatchSelector:N,mustHaveExport:c}of n??[]){let d=function(T){let F=T;for(let{name:P,value:L}of v??[])F=F.replaceAll(P,L);return F};var E=d;let v=Ni(a,new RegExp(b));if(v&&!(w&&new RegExp(w).test(a))){for(let{anyCall:T,message:F}of k??[]){let P=`Expected file to call the function: ${T.map(({fn:L})=>L).join(" or ")}`;u.add(P),l.push(L=>{let{callee:X}=L;if(X.type===be.Identifier){for(let{fn:G,withArgs:q}of T)if(X.name===G){u.delete(P);for(let D of q){let Z=L.arguments[D.atIndex],B=typeof D.literal=="string"?d(D.literal):D.literal;if(!Z){e.report({node:L,messageId:"default",data:{message:`Missing argument with value "${B}" at index ${D.atIndex}${F?`: ${d(F)}`:""}`}});continue}if(Z.type!==be.Literal){e.report({node:Z,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${B}"${F?`: ${d(F)}`:""}`}});continue}Z.value!==B&&e.report({node:Z,messageId:"default",data:{message:`Argument should have the value "${B}"${F?`: ${d(F)}`:""}`},fix:pe=>pe.replaceText(Z,typeof B=="string"?`'${B}'`:String(B))})}break}}})}for(let{selector:T,message:F}of N??[])f.set(T,d(F)),p.set(d(T),()=>{f.delete(T)});for(let{name:T,type:F,message:P}of c??[]){let L=d(T),X=d(P);y.add(`${L}:${F}:${X}`)}}}for(let{fn:b,withArgs:w,message:k,replaceWith:N,ignoreRegex:c}of i??[])c&&new RegExp(c).test(a)||l.push(v=>{let{callee:d}=v;if(d.type!==be.Identifier||!I(d.name,b))return;if(w)for(let F of w){let P=v.arguments[F.atIndex];if(!P){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${k}`}});return}if(P.type!==be.Literal||P.value!==F.value)return}let T=F=>N?F.replaceText(v,N):null;e.report({node:v,messageId:"default",data:{message:k},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:T}]:void 0})});function A(b,w){let k=r[b];k?r[b]=N=>{k(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:k,replaceType:N="suggestion"}of s??[]){if(b==="CallExpression"){l.push(c=>{g(k,c,w,N)});continue}r[b]=c=>{g(k,c,w,N)}}if(p.size>0)for(let[b,w]of p)A(b,w);return l.length>0&&(r.CallExpression=b=>{if(b.type===be.CallExpression)for(let w of l)w(b)}),r.ImportDeclaration=b=>{b.type===be.ImportDeclaration&&m(b)},r.ExportNamedDeclaration=b=>{b.type===be.ExportNamedDeclaration&&h(b)},r.VariableDeclarator=b=>{b.type===be.VariableDeclarator&&C(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of f)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[k,N,c]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${k}" of type ${N}: ${c}`}})}},r;function g(b,w,k,N){let c=v=>{if(!b)return null;if(typeof b=="string")return v.replaceText(w,b);{let d=new RegExp(b.regex),T=e.sourceCode.getText(w);return v.replaceText(w,T.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:k},fix:b&&N==="autofix"?c:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:c}]:void 0})}}});function Ni(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...s]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:Hn(o)}),r.push({name:"$0_uncapitalize",value:Yn(o)}),r.push({name:"$0",value:o});for(let i=0;i<s.length;i++){let a=`$${i+1}`,l=s[i];l!==void 0&&(r.push({name:`${a}_lowercase`,value:l.toLowerCase()}),r.push({name:`${a}_capitalize`,value:Hn(l)}),r.push({name:`${a}_uncapitalize`,value:Yn(l)}),r.push({name:a,value:l}))}return r}function Hn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Yn(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as oe,AST_TOKEN_TYPES as qn,ESLintUtils as Oi}from"@typescript-eslint/utils";import{z as He}from"zod/v4";var Di=Oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="collapse-simple-objs-in-one-line",Li=He.object({maxLineLength:He.number().optional(),maxProperties:He.number().optional(),nestedObjMaxLineLength:He.number().optional(),nestedObjMaxProperties:He.number().optional(),ignoreTypesWithSuffix:He.array(He.string()).optional()}),ji=Di({name:Gn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[U(Li)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function a(p){if(p.type===oe.ObjectExpression){let u=p.parent.type===oe.Property,f=u?i: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&&Pt(C))?!1:{text:r.getText(m),isNested:u,propsSize:y}}let x=[];for(let m of p.properties){if(m.type===oe.Property&&!Pt(m.value))return!1;x.push(r.getText(m))}return{text:x.join(", "),isNested:u,propsSize:y}}else{let u=p.parent.parent?.type===oe.TSPropertySignature,f=u?i: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(h=>m.endsWith(h)))return!1}if(y===1){let m=p.members[0];return!m||m.type===oe.TSPropertySignature&&m.typeAnnotation?.typeAnnotation.type===oe.TSTypeLiteral?!1:{text:r.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 x=[];for(let m of p.members){if(m.type!==oe.TSPropertySignature)return!1;let h=m.typeAnnotation?.typeAnnotation;if(!h||h.type===oe.TSTypeLiteral||!Zn(h))return!1;if(h.type===oe.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let S=h.typeArguments.params[0];if(!S||!Zn(S))return!1}let C=r.getText(m).trim();(C.endsWith(";")||C.endsWith(","))&&(C=C.slice(0,-1)),x.push(C)}return{text:x.join("; "),isNested:u,propsSize:y}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==oe.JSXExpressionContainer){let h=0,C=!1,S=r.getTokenAfter(p,{filter:A=>A.type!==qn.Punctuator||C?!0:A.value===","?(h++,!1):A.value===";"?(h++,C=!0,!1):A.value===")"||A.value==="}"?(h++,!1):!0});if(h>4)return;let I=S?.type===qn.Template&&S.value.startsWith(`}
2
2
  `);if(S?.loc.start.line===p.loc.end.line&&!I)return}let u=a(p);if(!u)return;let f=u.text;if(f.includes(`
3
- `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=_i(r,p),m=u.isNested&&u.propsSize>2?s:t.maxLineLength;m&&y.length+x.length+Mi(p,r)>m||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Zn(e){return e.type===se.TSLiteralType||e.type===se.TSTypeReference||e.type===se.TSNumberKeyword||e.type===se.TSStringKeyword||e.type===se.TSBooleanKeyword||e.type===se.TSNullKeyword||e.type===se.TSUndefinedKeyword}function Pt(e,t){return!!(e.type===se.Literal||e.type===se.Identifier||e.type===se.TemplateLiteral||e.type===se.TaggedTemplateExpression||!t&&e.type===se.ArrayExpression&&e.elements.every(r=>r&&Pt(r,!0)))}function Mi(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
3
+ `)||r.getCommentsInside(p).length>0)return;f.endsWith(";")&&(f=f.slice(0,-1));let y=`{ ${f} }`,x=_i(r,p),m=u.isNested&&u.propsSize>2?s:t.maxLineLength;m&&y.length+x.length+Mi(p,r)>m||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,y)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function Zn(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 Pt(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&&Pt(r,!0)))}function Mi(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
4
4
  `,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function _i(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var Nt={name:Gn,rule:ji};var $i=/eslint +react-compiler\/react-compiler: +\["error/;function Kn(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 tr={meta:{type:"suggestion",docs:{description:"verifies the list of dependencies for Hooks like useEffect and similar",recommended:!0,url:"https://github.com/facebook/react/issues/14920"},fixable:"code",hasSuggestions:!0,schema:[{type:"object",additionalProperties:!1,ignoreIfReactCompilerIsEnabled:!1,enableDangerousAutofixThisMayCauseInfiniteLoops:!1,properties:{additionalHooks:{type:"string"},ignoreIfReactCompilerIsEnabled:{type:"boolean"},enableDangerousAutofixThisMayCauseInfiniteLoops:{type:"boolean"},reactCompilerIsEnabled:{type:"boolean"}}}]},create(e){let t=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),n=typeof e.getScope=="function"?()=>n():I=>e.sourceCode.getScope(I),o=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function a(I){s&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let l=e.getSourceCode().scopeManager,p=new WeakMap,u=new WeakSet,f=new WeakMap,y=new WeakMap,x=new WeakSet;function m(I,A){return function(g){if(A.has(g))return A.get(g);let E=I(g);return A.set(g,E),E}}function h(I,A,g,E,b){b&&I.async&&a({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
@@ -19,7 +19,7 @@ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-f
19
19
  "use memo"
20
20
  `)}return null}}]})}}}},FunctionDeclaration(i){if(i.id&&ct(i)&&!Hr(i.id.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(dn(i,e.sourceCode)){if(nt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(gn(i,void 0,void 0,e.sourceCode)){let a=Xr(i,e.sourceCode),l=ct(i);if(!a&&!l){if(nt(i))return;e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(p){let u=i.body.range[0]+1;return p.insertTextAfterRange([u,u],`
21
21
  "use memo"
22
- `)}}]})}}},FunctionExpression(i){if(ct(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(dn(i,e.sourceCode)){if(nt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.ObjectExpression)return;let a=Jr(i);if(!a)return;let l;a.type===j.FunctionDeclaration&&a.id?l=a.id.name:(a.type===j.ArrowFunctionExpression||a.type===j.FunctionExpression)&&a.parent.type===j.VariableDeclarator&&a.parent.id.type===j.Identifier&&(l=a.parent.id.name),l&&At(l)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),Sn={name:Yr,rule:oa};import{AST_NODE_TYPES as de,ESLintUtils as sa}from"@typescript-eslint/utils";import{z as Le}from"zod/v4";var aa=sa.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gr="react-compiler-migration",la=Le.object({disallowHooks:Le.array(Le.object({name:Le.string(),replacement:Le.string()})).optional(),disallowMethods:Le.array(Le.object({name:Le.string(),replacement:Le.string().optional(),requireTrueProp:Le.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Le.boolean().optional()}),pa=/eslint +react-compiler\/react-compiler: +\["error/;function ca(e){let t=null;if((e.type===de.FunctionDeclaration||e.type===de.FunctionExpression||e.type===de.ArrowFunctionExpression&&e.body.type===de.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===de.ExpressionStatement&&r.expression.type===de.Literal&&r.expression.value==="use no memo":!1}function ua(e){let t=e.parent;for(;t;){if(t.type===de.FunctionDeclaration||t.type===de.FunctionExpression||t.type===de.ArrowFunctionExpression)return t;t=t.parent}return null}function fa(e){return e.type===de.Identifier?e.name.startsWith("use"):e.type===de.MemberExpression&&e.property.type===de.Identifier?e.property.name.startsWith("use"):!1}var ma=aa({name:Gr,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:[U(la)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(pa.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ua(o);return s!==null&&ca(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===de.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===de.MemberExpression&&o.callee.property.type===de.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(l=>l.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&fa(o.callee)){for(let s of o.arguments)if(s.type===de.ObjectExpression){for(let i of s.properties)if(i.type===de.Property&&i.key.type===de.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(o))return;if(l.requireTrueProp){let p=l.requireTrueProp,u=!1;for(let f of s.properties)if(f.type===de.Property&&f.key.type===de.Identifier&&f.key.name===p&&f.value.type===de.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Tn={name:Gr,rule:ma};import{AST_NODE_TYPES as oe}from"@typescript-eslint/utils";var ya=/\.(tsx|jsx)$/,da=/^[A-Z][A-Za-z0-9]*$/,Kr=80,hn=$({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level non-primitive values and long strings that are only used in one React component"},schema:[],messages:{moveValueInsideComponent:'Module-level "{{valueName}}" is only used in React component "{{componentName}}". Move it inside the component to improve memory usage.'}},defaultOptions:[],create(e){if(!ya.test(e.filename))return{};let t=e.sourceCode,r=ga(t.ast.body);return r.length===0?{}:{VariableDeclarator(n){if(n.id.type!==oe.Identifier||!Sa(n)||!ha(n.init))return;let o=n.id.name,i=t.getDeclaredVariables(n).find(f=>f.name===o);if(!i)return;let a=new Set,l=!1,p=!1;for(let f of i.references){if(f.init)continue;p=!0;let y=Ta(f.identifier,r);if(!y){l=!0;break}if(a.add(y),a.size>1)break}if(!p||l||a.size!==1)return;let[u]=Array.from(a);u&&e.report({node:n.id,messageId:"moveValueInsideComponent",data:{valueName:o,componentName:u}})}}}});function ga(e){let t=[],r=new Set;function n(s,i){da.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==oe.Identifier)continue;let a=Qr(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===oe.VariableDeclaration){o(s);continue}if(s.type===oe.FunctionDeclaration){n(s.id.name,s);continue}s.type===oe.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===oe.VariableDeclaration?o(s.declaration):s.declaration.type===oe.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function Sa(e){return e.parent.parent.type===oe.Program}function Ta(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function Qr(e){if(!e)return null;let t=En(e);if(t.type===oe.ArrowFunctionExpression||t.type===oe.FunctionExpression)return t;if(t.type!==oe.CallExpression||!Ea(t.callee))return null;let r=t.arguments[0];if(!r||r.type===oe.SpreadElement)return null;if(r.type===oe.CallExpression)return Qr(r);let n=En(r);return n.type===oe.ArrowFunctionExpression||n.type===oe.FunctionExpression?n:null}function Ea(e){return e.type===oe.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===oe.MemberExpression?e.property.type===oe.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function En(e){let t=e;for(;;){if(t.type===oe.TSAsExpression){t=t.expression;continue}if(t.type===oe.TSSatisfiesExpression){t=t.expression;continue}if(t.type===oe.TSNonNullExpression){t=t.expression;continue}return t}}function ha(e){if(!e)return!1;let t=En(e);return ba(t)?!0:xa(t)}function ba(e){if(e.type===oe.Literal)return typeof e.value=="string"&&e.value.length>=Kr;if(e.type===oe.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=Kr:!1}return!1}function xa(e){return e.type===oe.Literal?e.value instanceof RegExp:e.type===oe.ArrayExpression||e.type===oe.ObjectExpression||e.type===oe.ArrowFunctionExpression||e.type===oe.FunctionExpression||e.type===oe.ClassExpression||e.type===oe.NewExpression}import{AST_NODE_TYPES as z}from"@typescript-eslint/utils";import{z as ei}from"zod";var Ca=ei.object({runOnlyWithEnableCompilerDirective:ei.boolean().optional()}),Ia=/eslint +react-compiler\/react-compiler: +\["error/,Aa=/^\d+$/,wa=/[\s_-]+/,Fa=/[a-z][A-Z]/,va=/^(.+?)([A-Z][a-z]+s?)$/,Ra=/^[a-z][a-zA-Z]*$/;function ti(e,t){let r=[];if(e.type===z.JSXElement){for(let n of e.openingElement.attributes)if(n.type===z.JSXAttribute&&n.name.type===z.JSXIdentifier&&n.value?.type===z.JSXExpressionContainer&&n.value.expression.type!==z.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Oe(s,a=>{switch(a.type){case z.ObjectExpression:case z.ArrowFunctionExpression:case z.FunctionExpression:case z.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function ka(e){if(e.body.type===z.JSXElement||e.body.type===z.JSXFragment)return!0;if(e.body.type===z.BlockStatement){for(let t of e.body.body)if(t.type===z.ReturnStatement&&t.argument&&(t.argument.type===z.JSXElement||t.argument.type===z.JSXFragment))return!0}return!1}function Pa(e,t){let r=e.callee;if(r.type===z.MemberExpression){let n=r.object;if(n.type===z.Identifier){let o=n.name,s=Na(o);if(s!==o)return xn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===z.Identifier)return xn(n.name)}return"ListItem"}function Na(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(Fa)){let n=e.match(va);if(n){let o=n[1],s=n[2];if(!o||!s)return bn(e);let i=bn(s);if(i!==s)return o+i}}return bn(e)}function bn(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 xn(e){return e.match(Ra)?e.charAt(0).toUpperCase()+e.slice(1):e.split(wa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ni(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Oe(e,i=>{if(i.type===z.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!Aa.test(i.name)){let a=i.parent;if(a.type===z.Property&&a.key===i||a.type===z.MemberExpression&&a.property===i&&!a.computed||a.type===z.JSXOpeningElement||a.type===z.JSXClosingElement||a.type===z.JSXAttribute&&a.name.type===z.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function ri(e,t,r,n,o){let i=[...r.map(f=>f.type===z.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],a=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
22
+ `)}}]})}}},FunctionExpression(i){if(ct(i)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(dn(i,e.sourceCode)){if(nt(i))return;e.report({node:i,messageId:"functionCallingHooksMustBeComponent"})}},ReturnStatement(i){if(i.argument?.type!==j.ObjectExpression)return;let a=Jr(i);if(!a)return;let l;a.type===j.FunctionDeclaration&&a.id?l=a.id.name:(a.type===j.ArrowFunctionExpression||a.type===j.FunctionExpression)&&a.parent.type===j.VariableDeclarator&&a.parent.id.type===j.Identifier&&(l=a.parent.id.name),l&&At(l)&&(s(i)||(n(i.argument),o(i.argument)))}}}}),Sn={name:Yr,rule:oa};import{AST_NODE_TYPES as de,ESLintUtils as sa}from"@typescript-eslint/utils";import{z as Le}from"zod/v4";var aa=sa.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gr="react-compiler-migration",la=Le.object({disallowHooks:Le.array(Le.object({name:Le.string(),replacement:Le.string()})).optional(),disallowMethods:Le.array(Le.object({name:Le.string(),replacement:Le.string().optional(),requireTrueProp:Le.string().optional()})).optional(),runOnlyWithEnableCompilerDirective:Le.boolean().optional()}),pa=/eslint +react-compiler\/react-compiler: +\["error/;function ca(e){let t=null;if((e.type===de.FunctionDeclaration||e.type===de.FunctionExpression||e.type===de.ArrowFunctionExpression&&e.body.type===de.BlockStatement)&&(t=e.body),!t||t.body.length===0)return!1;let r=t.body[0];return r?r.type===de.ExpressionStatement&&r.expression.type===de.Literal&&r.expression.value==="use no memo":!1}function ua(e){let t=e.parent;for(;t;){if(t.type===de.FunctionDeclaration||t.type===de.FunctionExpression||t.type===de.ArrowFunctionExpression)return t;t=t.parent}return null}function fa(e){return e.type===de.Identifier?e.name.startsWith("use"):e.type===de.MemberExpression&&e.property.type===de.Identifier?e.property.name.startsWith("use"):!1}var ma=aa({name:Gr,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:[U(la)]},defaultOptions:[{disallowHooks:[],disallowMethods:[],runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let r=!0;if(t.runOnlyWithEnableCompilerDirective){r=!1;for(let o of e.sourceCode.getAllComments())if(pa.test(o.value)){r=!0;break}}if(!r)return{};function n(o){let s=ua(o);return s!==null&&ca(s)}return{CallExpression(o){if(t.disallowHooks?.length){let s=null,i=null;if(o.callee.type===de.Identifier?(s=o.callee.name,i=o.callee):o.callee.type===de.MemberExpression&&o.callee.property.type===de.Identifier&&(s=o.callee.property.name,i=o.callee.property),s){let a=t.disallowHooks.find(l=>l.name===s);if(a&&i){if(n(o))return;e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:a.name,replacement:a.replacement},suggest:[{messageId:"replace",data:{replacement:a.replacement},fix:l=>l.replaceText(i,a.replacement)}]})}}}if(t.disallowMethods?.length&&fa(o.callee)){for(let s of o.arguments)if(s.type===de.ObjectExpression){for(let i of s.properties)if(i.type===de.Property&&i.key.type===de.Identifier){let a=i.key.name,l=t.disallowMethods.find(p=>p.name===a);if(l){if(n(o))return;if(l.requireTrueProp){let p=l.requireTrueProp,u=!1;for(let f of s.properties)if(f.type===de.Property&&f.key.type===de.Identifier&&f.key.name===p&&f.value.type===de.Literal&&f.value.value===!0){u=!0;break}if(!u){e.report({node:i,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:l.name,requireTrueProp:p}});continue}}l.replacement&&e.report({node:i,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:l.name,replacement:l.replacement},suggest:[{messageId:"replace",data:{replacement:l.replacement},fix:p=>l.replacement?p.replaceText(i.key,l.replacement):null}]})}}}}}}}}),Tn={name:Gr,rule:ma};import{AST_NODE_TYPES as se}from"@typescript-eslint/utils";var ya=/\.(tsx|jsx)$/,da=/^[A-Z][A-Za-z0-9]*$/,Kr=80,hn=$({name:"react-no-module-level-single-use-values",meta:{type:"problem",docs:{description:"Disallow module-level allocated data values and long strings that are only used in one React component, excluding functions, inferable aliases, and regex values"},schema:[],messages:{moveValueInsideComponent:'Module-level "{{valueName}}" is only used in React component "{{componentName}}". Move it inside the component to improve memory usage.'}},defaultOptions:[],create(e){if(!ya.test(e.filename))return{};let t=e.sourceCode,r=ga(t.ast.body);return r.length===0?{}:{VariableDeclarator(n){if(n.id.type!==se.Identifier||!Sa(n)||!ha(n.init))return;let o=n.id.name,i=t.getDeclaredVariables(n).find(f=>f.name===o);if(!i)return;let a=new Set,l=!1,p=!1;for(let f of i.references){if(f.init)continue;p=!0;let y=Ta(f.identifier,r);if(!y){l=!0;break}if(a.add(y),a.size>1)break}if(!p||l||a.size!==1)return;let[u]=Array.from(a);u&&e.report({node:n.id,messageId:"moveValueInsideComponent",data:{valueName:o,componentName:u}})}}}});function ga(e){let t=[],r=new Set;function n(s,i){da.test(s)&&(r.has(s)||(r.add(s),t.push({name:s,range:i.range})))}function o(s){for(let i of s.declarations){if(i.id.type!==se.Identifier)continue;let a=Qr(i.init);a&&n(i.id.name,a)}}for(let s of e){if(s.type===se.VariableDeclaration){o(s);continue}if(s.type===se.FunctionDeclaration){n(s.id.name,s);continue}s.type===se.ExportNamedDeclaration&&s.declaration&&(s.declaration.type===se.VariableDeclaration?o(s.declaration):s.declaration.type===se.FunctionDeclaration&&s.declaration.id&&n(s.declaration.id.name,s.declaration))}return t}function Sa(e){return e.parent.parent.type===se.Program}function Ta(e,t){let r=null;for(let n of t){if(!(e.range[0]>=n.range[0]&&e.range[1]<=n.range[1]))continue;if(!r){r=n;continue}let s=r.range[1]-r.range[0];n.range[1]-n.range[0]<s&&(r=n)}return r?.name??null}function Qr(e){if(!e)return null;let t=En(e);if(t.type===se.ArrowFunctionExpression||t.type===se.FunctionExpression)return t;if(t.type!==se.CallExpression||!Ea(t.callee))return null;let r=t.arguments[0];if(!r||r.type===se.SpreadElement)return null;if(r.type===se.CallExpression)return Qr(r);let n=En(r);return n.type===se.ArrowFunctionExpression||n.type===se.FunctionExpression?n:null}function Ea(e){return e.type===se.Identifier?e.name==="memo"||e.name==="forwardRef":e.type===se.MemberExpression?e.property.type===se.Identifier&&(e.property.name==="memo"||e.property.name==="forwardRef"):!1}function En(e){let t=e;for(;;){if(t.type===se.TSAsExpression){t=t.expression;continue}if(t.type===se.TSSatisfiesExpression){t=t.expression;continue}if(t.type===se.TSNonNullExpression){t=t.expression;continue}return t}}function ha(e){if(!e)return!1;let t=En(e);return ba(t)?!1:xa(t)?!0:Ca(t)}function ba(e){return e.type===se.Identifier||e.type===se.MemberExpression}function xa(e){if(e.type===se.Literal)return typeof e.value=="string"&&e.value.length>=Kr;if(e.type===se.TemplateLiteral){if(e.expressions.length>0)return!1;let t=e.quasis[0];return t?t.value.cooked.length>=Kr:!1}return!1}function Ca(e){return e.type===se.ArrayExpression||e.type===se.ObjectExpression||e.type===se.ClassExpression||e.type===se.NewExpression}import{AST_NODE_TYPES as z}from"@typescript-eslint/utils";import{z as ei}from"zod";var Ia=ei.object({runOnlyWithEnableCompilerDirective:ei.boolean().optional()}),Aa=/eslint +react-compiler\/react-compiler: +\["error/,wa=/^\d+$/,Fa=/[\s_-]+/,va=/[a-z][A-Z]/,Ra=/^(.+?)([A-Z][a-z]+s?)$/,ka=/^[a-z][a-zA-Z]*$/;function ti(e,t){let r=[];if(e.type===z.JSXElement){for(let n of e.openingElement.attributes)if(n.type===z.JSXAttribute&&n.name.type===z.JSXIdentifier&&n.value?.type===z.JSXExpressionContainer&&n.value.expression.type!==z.JSXEmptyExpression){let o=n.name.name,s=n.value.expression,i=!1;Oe(s,a=>{switch(a.type){case z.ObjectExpression:case z.ArrowFunctionExpression:case z.FunctionExpression:case z.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(o)}}return{hasUnstable:r.length>0,problematicProps:r}}function Pa(e){if(e.body.type===z.JSXElement||e.body.type===z.JSXFragment)return!0;if(e.body.type===z.BlockStatement){for(let t of e.body.body)if(t.type===z.ReturnStatement&&t.argument&&(t.argument.type===z.JSXElement||t.argument.type===z.JSXFragment))return!0}return!1}function Na(e,t){let r=e.callee;if(r.type===z.MemberExpression){let n=r.object;if(n.type===z.Identifier){let o=n.name,s=Oa(o);if(s!==o)return xn(s)}}if(t.length>0){let n=t[0];if(n&&n.type===z.Identifier)return xn(n.name)}return"ListItem"}function Oa(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(va)){let n=e.match(Ra);if(n){let o=n[1],s=n[2];if(!o||!s)return bn(e);let i=bn(s);if(i!==s)return o+i}}return bn(e)}function bn(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 xn(e){return e.match(ka)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Fa).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function ni(e,t,r){let n=[],o=new Set,s=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Oe(e,i=>{if(i.type===z.Identifier&&!t.includes(i.name)&&!s.has(i.name)&&!wa.test(i.name)){let a=i.parent;if(a.type===z.Property&&a.key===i||a.type===z.MemberExpression&&a.property===i&&!a.computed||a.type===z.JSXOpeningElement||a.type===z.JSXClosingElement||a.type===z.JSXAttribute&&a.name.type===z.JSXIdentifier&&a.name.name===i.name)return!1;o.add(i.name)}return!1},r);for(let i of o)t.includes(i)||n.push({name:i,type:"unknown"});return n}function ri(e,t,r,n,o){let i=[...r.map(f=>f.type===z.Identifier?f.name:"item").map((f,y)=>({name:f,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...n],a=i.map(f=>{let y=f.type;return f.name.includes("on")&&y==="any"&&(y="unknown"),` ${f.name}: ${y};`}).join(`
23
23
  `),l=i.map(f=>f.name).join(", "),p=o.getText(t),u=`${e}Props`;return`type ${u} = {
24
24
  ${a}
25
25
  };
@@ -28,22 +28,22 @@ const ${e}: FC<${u}> = ({ ${l} }) => {
28
28
  return (
29
29
  ${p}
30
30
  );
31
- };`}function Oa(e,t,r,n){let o=t.map(i=>i.type===z.Identifier?i.name:"item"),s=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function Da(e){if(e.type===z.JSXElement&&e.openingElement.name.type===z.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return xn(t)}return"ListItem"}function La(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 ii(e,t){for(let r of e.openingElement.attributes)if(r.type===z.JSXAttribute&&r.name.type===z.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===z.JSXExpressionContainer&&r.value.expression.type!==z.JSXEmptyExpression)return t.getText(r.value.expression);return null}var Cn=$({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:[U(Ca)],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(Ia.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===z.MemberExpression&&n.callee.property.type===z.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?ja(n,r,e):Ma(n,r,e))}}}});function ja(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.ArrowFunctionExpression&&n.type!==z.FunctionExpression||!ka(n))return;let o=null;if(n.body.type===z.JSXElement||n.body.type===z.JSXFragment?o=n.body:n.body.type===z.BlockStatement&&n.body.body[0]?.type===z.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===z.JSXElement||n.body.body[0].argument.type===z.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=ti(o,t);if(!s.hasUnstable)return;let i=Pa(e,n.params),a=n.params.map(f=>f.type===z.Identifier?f.name:"item"),l=ni(o,a,t),p=o.type===z.JSXElement?ii(o,t):null,u=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:f=>{let y=ri(i,o,n.params,l,t),x=Oa(i,n.params,l,p),m=e;for(;m.parent.type!==z.Program&&!(m.type===z.FunctionDeclaration||m.type===z.VariableDeclarator&&m.init&&(m.init.type===z.ArrowFunctionExpression||m.init.type===z.FunctionExpression));)m=m.parent;let h=[];return h.push(f.insertTextAfter(m,`
31
+ };`}function Da(e,t,r,n){let o=t.map(i=>i.type===z.Identifier?i.name:"item"),s=[n?`key={${n}}`:`key={${o[0]}.id}`,...o.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${s.join(" ")} />`}function La(e){if(e.type===z.JSXElement&&e.openingElement.name.type===z.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return xn(t)}return"ListItem"}function ja(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 ii(e,t){for(let r of e.openingElement.attributes)if(r.type===z.JSXAttribute&&r.name.type===z.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===z.JSXExpressionContainer&&r.value.expression.type!==z.JSXEmptyExpression)return t.getText(r.value.expression);return null}var Cn=$({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:[U(Ia)],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(Aa.test(o.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===z.MemberExpression&&n.callee.property.type===z.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?Ma(n,r,e):_a(n,r,e))}}}});function Ma(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.ArrowFunctionExpression&&n.type!==z.FunctionExpression||!Pa(n))return;let o=null;if(n.body.type===z.JSXElement||n.body.type===z.JSXFragment?o=n.body:n.body.type===z.BlockStatement&&n.body.body[0]?.type===z.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===z.JSXElement||n.body.body[0].argument.type===z.JSXFragment)&&(o=n.body.body[0].argument),!o)return;let s=ti(o,t);if(!s.hasUnstable)return;let i=Na(e,n.params),a=n.params.map(f=>f.type===z.Identifier?f.name:"item"),l=ni(o,a,t),p=o.type===z.JSXElement?ii(o,t):null,u=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:f=>{let y=ri(i,o,n.params,l,t),x=Da(i,n.params,l,p),m=e;for(;m.parent.type!==z.Program&&!(m.type===z.FunctionDeclaration||m.type===z.VariableDeclarator&&m.init&&(m.init.type===z.ArrowFunctionExpression||m.init.type===z.FunctionExpression));)m=m.parent;let h=[];return h.push(f.insertTextAfter(m,`
32
32
 
33
- ${y}`)),h.push(f.replaceText(o,x)),h}}]})}function Ma(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.JSXElement&&n.type!==z.JSXFragment)return;let o=n,s=ti(o,t);if(!s.hasUnstable)return;let i=Da(o),a=ni(o,[],t),l=o.type===z.JSXElement?ii(o,t):null,p=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=ri(i,o,[],a,t),y=La(i,a,l),x=e;for(;x.parent.type!==z.Program&&!(x.type===z.FunctionDeclaration||x.type===z.VariableDeclarator&&x.init&&(x.init.type===z.ArrowFunctionExpression||x.init.type===z.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
33
+ ${y}`)),h.push(f.replaceText(o,x)),h}}]})}function _a(e,t,r){let n=e.arguments[0];if(!n||n.type!==z.JSXElement&&n.type!==z.JSXFragment)return;let o=n,s=ti(o,t);if(!s.hasUnstable)return;let i=La(o),a=ni(o,[],t),l=o.type===z.JSXElement?ii(o,t):null,p=s.problematicProps.length===1?`prop "${s.problematicProps[0]}"`:`props "${s.problematicProps.join('", "')}"`;r.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let f=ri(i,o,[],a,t),y=ja(i,a,l),x=e;for(;x.parent.type!==z.Program&&!(x.type===z.FunctionDeclaration||x.type===z.VariableDeclarator&&x.init&&(x.init.type===z.ArrowFunctionExpression||x.init.type===z.FunctionExpression));)x=x.parent;let m=[];return m.push(u.insertTextAfter(x,`
34
34
 
35
- ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as _a,TSESTree as $a}from"@typescript-eslint/utils";var Ua=_a.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),oi="require-description",za=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Va=/^eslint-disable-(next-)?line$/u,Wa=Ua({name:oi,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=Ja(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ha(o.loc),messageId:"missingDescription"}))}}}}}),si={name:oi,rule:Wa};function Ja(e){let{text:t,description:r}=Ba(e.value);if(!t)return null;let n=za.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Va.test(o);if(e.type===$a.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Xa=/\s-{2,}\s/u;function Ba(e){let t=e.split(Xa);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ha(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 Ve}from"zod/v4";var Ya=Ve.object({varsToCheck:Ve.array(Ve.object({selector:Ve.string().optional(),fromFnCall:Ve.string().optional(),prop:Ve.string().or(Ve.array(Ve.string())),errorMsg:Ve.string().optional()}))}),In=$({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:[U(Ya)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){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=a.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:p,customMsg:l||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}}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 s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.VariableDeclarator&&a.id.type===ne.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:o(a)}),a.type===ne.VariableDeclarator&&a.id.type===ne.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[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)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(a.includes(".")){let[l,p]=a.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;s[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 l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[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)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{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:u}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let x=new Set(a);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.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 S of C.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===h&&C.property.type===ne.Identifier&&!a.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:l||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:l||""}})}}}}}}}});function ui(e){return/^use[A-Z0-9]/.test(e)}function wt(e){return e.type==="Identifier"?ui(e.name):e.type==="MemberExpression"&&!e.computed&&wt(e.property)?e.object.type==="Identifier":!1}function fi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function mi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function yi(e){return!!(e.parent&&e.parent.callee&&mi(e.parent.callee,"forwardRef"))}function di(e){return!!(e.parent&&e.parent.callee&&mi(e.parent.callee,"memo"))}function An(e){for(;e;){let t=Si(e);if(t&&(fi(t)||wt(t))||yi(e)||di(e))return!0;e=e.parent}return!1}function ai(e){return!1}function wn(e){return!1}var qa=/eslint +react-compiler\/react-compiler: +\["error/;function li(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 pi(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 gi={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=pi(p);if(f&&li(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(qa.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=pi(u);if(y&&li(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),o=null,s=[],i=[],a=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&&ai(f.init.callee))for(let y of u.resolved.references)y!==u&&a.add(y.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(p,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(E,b){let{cache:w}=x,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=[...N],v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(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+=x(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=Array.from(N),v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(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,N)}return w.set(E.id,k),k}function h(E){let{cache:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let N=h(k);N<w&&(w=N)}w+=1}return b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(p.initialSegment),S=Si(u),I=An(u),A=S?fi(S)||wt(S):yi(u)||di(u),g=1/0;for(let E of p.finalSegments){if(!E.reachable)continue;let b=h(E);b<g&&(g=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=x(E)*m(E),N=y.has(E.id);for(let c of b)if(N&&!wn(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!wn(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let v=`React Hook "${r(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(S){let v=`React Hook "${r(c)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(u.type==="Program"){let v=`React Hook "${r(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(I&&!wn(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"&&ui(d.parent.id.name))return}let v=`React Hook "${r(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}}},CallExpression(p){if(wt(p.callee)){let u=ci(s),f=ci(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||ai(p.callee))&&p.arguments.length>0&&(o=p)},Identifier(p){o==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(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){An(p)&&l(n(p))},ArrowFunctionExpression(p){An(p)&&l(n(p))}}}};function Si(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function ci(e){return e[e.length-1]}import{AST_NODE_TYPES as Ee,AST_TOKEN_TYPES as Za}from"@typescript-eslint/utils";import*as Ce from"zod/v4";var Ga=/^\s+$/,Fn=/\r?\n/,Ka=/^(\s*)/,Qa=/^(\s*)\S/,el=/\r?\n/,tl=Ce.object({indent:Ce.union([Ce.string().regex(Ga),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),vn=$({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[U(tl)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function a(S){let I=S.split(Fn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(Ka);b&&(g=Math.min(g,b[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
35
+ ${f}`)),m.push(u.replaceText(o,y)),m}}]})}import{ESLintUtils as $a,TSESTree as Ua}from"@typescript-eslint/utils";var za=$a.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),oi="require-description",Va=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Wa=/^eslint-disable-(next-)?line$/u,Ja=za({name:oi,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let s=Xa(o);s!=null&&(n.has(s.kind)||s.description||e.report({loc:Ya(o.loc),messageId:"missingDescription"}))}}}}}),si={name:oi,rule:Ja};function Xa(e){let{text:t,description:r}=Ha(e.value);if(!t)return null;let n=Va.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let s=Wa.test(o);if(e.type===Ua.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Ba=/\s-{2,}\s/u;function Ha(e){let t=e.split(Ba);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function Ya(e){return{start:{line:e.start.line,column:-1},end:e.end}}import{AST_NODE_TYPES as ne}from"@typescript-eslint/utils";import{z as Ve}from"zod/v4";var qa=Ve.object({varsToCheck:Ve.array(Ve.object({selector:Ve.string().optional(),fromFnCall:Ve.string().optional(),prop:Ve.string().or(Ve.array(Ve.string())),errorMsg:Ve.string().optional()}))}),In=$({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:[U(qa)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,a,l,p){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=a.filter(y=>!u.has(y));if(f.length>0)if(f.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:f[0],fnName:p,customMsg:l||""}});else{let y=f.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:p,customMsg:l||""}})}}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 s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=a=>{if(a.type===ne.VariableDeclarator&&a.id.type===ne.Identifier&&r.set(a.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:a.id,fnName:o(a)}),a.type===ne.VariableDeclarator&&a.id.type===ne.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(a.id,l,i.errorMsg,o(a))}});for(let i of t.varsToCheck)if(i.fromFnCall){let a=i.fromFnCall;if(a.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${a.slice(2)}"]`;s[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)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(a.includes(".")){let[l,p]=a.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;s[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 l=`VariableDeclarator > CallExpression > Identifier[name="${a}"]`;s[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)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{...s,"Program:exit"(){for(let[i,{props:a,errorMsg:l,node:p,fnName:u}]of r){let y=e.sourceCode.getScope(p).set.get(i);if(y){let x=new Set(a);for(let m of y.references){let h=m.identifier,C=h.parent;if(!(C.type===ne.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 S of C.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&x.has(S.key.name)&&x.delete(S.key.name);if(x.size===0)break;continue}if(!(C.type===ne.MemberExpression&&C.object===h&&C.property.type===ne.Identifier&&!a.includes(C.property.name))){x.clear();break}}}if(x.size>0){let m=Array.from(x);if(m.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:m[0],fnName:u,customMsg:l||""}});else{let h=m.map(C=>`"${C}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:u,customMsg:l||""}})}}}}}}}});function ui(e){return/^use[A-Z0-9]/.test(e)}function wt(e){return e.type==="Identifier"?ui(e.name):e.type==="MemberExpression"&&!e.computed&&wt(e.property)?e.object.type==="Identifier":!1}function fi(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function mi(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function yi(e){return!!(e.parent&&e.parent.callee&&mi(e.parent.callee,"forwardRef"))}function di(e){return!!(e.parent&&e.parent.callee&&mi(e.parent.callee,"memo"))}function An(e){for(;e;){let t=Si(e);if(t&&(fi(t)||wt(t))||yi(e)||di(e))return!0;e=e.parent}return!1}function ai(e){return!1}function wn(e){return!1}var Za=/eslint +react-compiler\/react-compiler: +\["error/;function li(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 pi(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 gi={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=pi(p);if(f&&li(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(Za.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=pi(u);if(y&&li(y))return;e.report({node:u,message:`"${f}" is not necessary when using React Compiler.`})}}}}let r=typeof e.getSource=="function"?p=>r(p):p=>e.sourceCode.getText(p),n=typeof e.getScope=="function"?()=>n():p=>e.sourceCode.getScope(p),o=null,s=[],i=[],a=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&&ai(f.init.callee))for(let y of u.resolved.references)y!==u&&a.add(y.identifier)}}return{onCodePathSegmentStart:p=>i.push(p),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(p,u){let f=s.pop();if(f.size===0)return;let y=new Set;function x(E,b){let{cache:w}=x,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=[...N],v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(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+=x(c,N)}return E.reachable&&k===BigInt("0")?w.delete(E.id):w.set(E.id,k),k}function m(E,b){let{cache:w}=m,k=w.get(E.id),N=new Set(b);if(N.has(E.id)){let c=Array.from(N),v=c.slice(c.indexOf(E.id)+1);for(let d of v)y.add(d);return BigInt("0")}if(N.add(E.id),k!==void 0)return k;if(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,N)}return w.set(E.id,k),k}function h(E){let{cache:b}=h,w=b.get(E.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(E.id,null),E.prevSegments.length===0)w=1;else{w=1/0;for(let k of E.prevSegments){let N=h(k);N<w&&(w=N)}w+=1}return b.set(E.id,w),w}x.cache=new Map,m.cache=new Map,h.cache=new Map;let C=m(p.initialSegment),S=Si(u),I=An(u),A=S?fi(S)||wt(S):yi(u)||di(u),g=1/0;for(let E of p.finalSegments){if(!E.reachable)continue;let b=h(E);b<g&&(g=b)}for(let[E,b]of f){if(!E.reachable)continue;let w=E.nextSegments.length===0?g<=h(E):g<h(E),k=x(E)*m(E),N=y.has(E.id);for(let c of b)if(N&&!wn(c)&&e.report({node:c,message:`React Hook "${r(c)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:c,message:`React Hook "${r(c)}" cannot be called in an async function.`}),!N&&k!==C&&!wn(c)){let d=`React Hook "${r(c)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:c,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let v=`React Hook "${r(c)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(S){let v=`React Hook "${r(c)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:c,message:v})}else if(u.type==="Program"){let v=`React Hook "${r(c)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}else if(I&&!wn(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"&&ui(d.parent.id.name))return}let v=`React Hook "${r(c)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:c,message:v})}}},CallExpression(p){if(wt(p.callee)){let u=ci(s),f=ci(i),y=u.get(f);y||(y=[],u.set(f,y)),y.push(p.callee)}p.callee.type==="Identifier"&&(p.callee.name==="useEffect"||ai(p.callee))&&p.arguments.length>0&&(o=p)},Identifier(p){o==null&&a.has(p)&&p.parent.type!=="CallExpression"&&e.report({node:p,message:`\`${r(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){An(p)&&l(n(p))},ArrowFunctionExpression(p){An(p)&&l(n(p))}}}};function Si(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function ci(e){return e[e.length-1]}import{AST_NODE_TYPES as Ee,AST_TOKEN_TYPES as Ga}from"@typescript-eslint/utils";import*as Ce from"zod/v4";var Ka=/^\s+$/,Fn=/\r?\n/,Qa=/^(\s*)/,el=/^(\s*)\S/,tl=/\r?\n/,nl=Ce.object({indent:Ce.union([Ce.string().regex(Ka),Ce.number().int().min(1)]).optional(),tags:Ce.array(Ce.string()).optional(),functions:Ce.array(Ce.string()).optional(),comments:Ce.array(Ce.string()).optional()}),vn=$({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[U(nl)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(S=>S.toLowerCase());function a(S){let I=S.split(Fn),A=I.filter(E=>E.trim()!=="");if(A.length===0)return S;let g=Number.POSITIVE_INFINITY;for(let E of A){let b=E.match(Qa);b&&(g=Math.min(g,b[1]?.length??0))}return!isFinite(g)||g===0?S:I.map(E=>E.slice(g)).join(`
36
36
  `)}function l(S,I,A){return S.split(Fn).map(E=>E.trim()===""?E:A.repeat(I)+E).join(`
37
- `)}function p(S){if(S.type===Ee.Identifier)return S.name;if(S.type===Ee.MemberExpression){let I=S.object.type===Ee.Identifier?S.object.name:null,A=S.property.type===Ee.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Ee.MemberExpression&&S.object.type===Ee.Identifier&&S.property.type===Ee.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Ee.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Ee.TaggedTemplateExpression)return!1;let g=p(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Ee.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:b=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Ee.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Ee.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==Ee.CallExpression)return!1;let{name:A,argumentsLength:g,optionalCall:E=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Ee.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Ee.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===Ee.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===Za.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===Ee.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),g=A.match(el);if(!g)return;let E=g[0],b=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(Qa)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let v=a(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+l(v,1,k+N)+E+k,T=A.includes(`\r
37
+ `)}function p(S){if(S.type===Ee.Identifier)return S.name;if(S.type===Ee.MemberExpression){let I=S.object.type===Ee.Identifier?S.object.name:null,A=S.property.type===Ee.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let g=A.split(".");if(S.type===Ee.MemberExpression&&S.object.type===Ee.Identifier&&S.property.type===Ee.Identifier&&S.object.name===g[0]&&S.property.name===g[1])return!0}else if(S.type===Ee.Identifier&&S.name===A)return!0;return!1}function f(S,I){let A=S.parent;if(A.type!==Ee.TaggedTemplateExpression)return!1;let g=p(A.tag);return g?I.includes(g):!1}function y(S,I){if(!S||S.type!==Ee.CallExpression)return!1;let{method:A,argumentsLength:g,optionalCall:E=!0,optionalMember:b=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Ee.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Ee.Identifier?!1:S.callee.property.name===A}function x(S,I){if(!S||S.type!==Ee.CallExpression)return!1;let{name:A,argumentsLength:g,optionalCall:E=!0}=I;return g!==void 0&&S.arguments.length!==g||!E&&S.optional||S.callee.type!==Ee.Identifier?!1:S.callee.name===A}function m(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Ee.CallExpression&&S.parent.arguments[0]===S&&x(S.parent.callee.type===Ee.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(S){if(i.length>0){let I=t.getTokenBefore(S,{includeComments:!0});if(I?.type===Ga.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(m(S)||o.length>0&&f(S,o)||n.length>0&&S.parent.type===Ee.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,n))}function C(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(L=>t.getText(L).slice(1,L.tail?-1:-2)).join(I),g=A.match(tl);if(!g)return;let E=g[0],b=t.lines[t.getLocFromIndex(S.range[0]).line-1];if(!b)return;let k=b.match(el)?.[1]??"",N;typeof s=="string"?N=s:typeof s=="number"?N=" ".repeat(s):N=k.startsWith(" ")?" ":" ";let v=a(A).replace(new RegExp(`^${E}|${E}[ ]*$`,"g"),""),d=E+l(v,1,k+N)+E+k,T=A.includes(`\r
38
38
  `)?`\r
39
39
  `:`
40
- `,F=A.split(Fn),P=F.map((L,X)=>X!==F.length-1&&L===N+k?"":L).join(T);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:L=>d.split(I).map((X,G)=>{let q=S.quasis[G];return q?L.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(S){if(!h(S))return;let I=C(S);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as Ti}from"@typescript-eslint/utils";function nl(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function rl(e){let t=e.parent;return t?.type===Ti.NewExpression&&t.callee.type===Ti.Identifier&&t.callee.name==="RegExp"}var Rn=$({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){nl(r)||rl(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 he}from"@typescript-eslint/utils";import{z as ft}from"zod/v4";var il=ft.object({checkOnly:ft.array(ft.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:ft.array(ft.string()).optional()}),kn=$({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:[U(il)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function s(m){for(let h of o)if(m.range[0]>=h.range[0]&&m.range[1]<=h.range[1])return h;return null}function i(m){let h=m.parent;for(;h;){if(h.type===he.FunctionDeclaration||h.type===he.FunctionExpression||h.type===he.ArrowFunctionExpression){let C=h.params;for(let S of C)if(m.range[0]>=S.range[0]&&m.range[1]<=S.range[1])return!0;break}h=h.parent}return!1}function a(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.TSTypeReference&&C.typeName.type===he.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===he.TSTypeReference&&C.typeName.type===he.TSQualifiedName&&C.typeName.right.name==="FC")return!0}h=h.parent}return!1}function l(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.CallExpression||C.type===he.NewExpression)return!0}h=h.parent}return!1}function p(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeAliasDeclaration||h.type===he.TSInterfaceDeclaration)return!0;h=h.parent}return!1}function u(m){return m.parent.type===he.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let h=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let g=C.get(A)||[];g.push(I),C.set(A,g)}for(let{typeName:I,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E}of m){let b=n.get(I);if(!b||b.statement===A)continue;let w=o.indexOf(b.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let N=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&E),v=(C.get(A)||[]).length>1;(N||v?w>k:w>k||w!==k-1)&&h.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:g})}if(h.length===0)return;h.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});let S=h[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:x(h)})}function x(m){return function*(h){let C=new Map;for(let S of m){let I=C.get(S.targetStatement)||[];I.push(S),C.set(S.targetStatement,I)}for(let[,S]of C)S.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});for(let S of m){let{typeDef:I}=S,A=I.statement,g=r.getCommentsBefore(A),E=A.range[0],b=A.range[1];g.length>0&&g[0]&&(E=g[0].range[0]),yield h.removeRange([E,b])}for(let[S,I]of C){let A=r.getCommentsBefore(S),g=A.length>0&&A[0]?A[0].range[0]:S.range[0],E=[];for(let b of I){let w=b.typeDef.statement,k=r.getText(w),N=r.getCommentsBefore(w),c=k;N.length>0&&(c=`${N.map(d=>r.getText(d)).join(`
40
+ `,F=A.split(Fn),P=F.map((L,X)=>X!==F.length-1&&L===N+k?"":L).join(T);if(d!==P)return{node:S,messageId:"improperlyIndented",fix:L=>d.split(I).map((X,G)=>{let q=S.quasis[G];return q?L.replaceTextRange([q.range[0]+1,q.range[1]-(q.tail?1:2)],X):[]}).flat()}}return{TemplateLiteral(S){if(!h(S))return;let I=C(S);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as Ti}from"@typescript-eslint/utils";function rl(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function il(e){let t=e.parent;return t?.type===Ti.NewExpression&&t.callee.type===Ti.Identifier&&t.callee.name==="RegExp"}var Rn=$({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){rl(r)||il(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 he}from"@typescript-eslint/utils";import{z as ft}from"zod/v4";var ol=ft.object({checkOnly:ft.array(ft.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:ft.array(ft.string()).optional()}),kn=$({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:[U(ol)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,o=[];function s(m){for(let h of o)if(m.range[0]>=h.range[0]&&m.range[1]<=h.range[1])return h;return null}function i(m){let h=m.parent;for(;h;){if(h.type===he.FunctionDeclaration||h.type===he.FunctionExpression||h.type===he.ArrowFunctionExpression){let C=h.params;for(let S of C)if(m.range[0]>=S.range[0]&&m.range[1]<=S.range[1])return!0;break}h=h.parent}return!1}function a(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.TSTypeReference&&C.typeName.type===he.Identifier&&(C.typeName.name==="FC"||C.typeName.name==="React.FC")||C.type===he.TSTypeReference&&C.typeName.type===he.TSQualifiedName&&C.typeName.right.name==="FC")return!0}h=h.parent}return!1}function l(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeParameterInstantiation){let C=h.parent;if(C.type===he.CallExpression||C.type===he.NewExpression)return!0}h=h.parent}return!1}function p(m){let h=m.parent;for(;h;){if(h.type===he.TSTypeAliasDeclaration||h.type===he.TSInterfaceDeclaration)return!0;h=h.parent}return!1}function u(m){return m.parent.type===he.TSIndexedAccessType&&m.parent.objectType===m}let f=[];function y(m){let h=[],C=new Map;for(let{typeName:I,firstUsage:A}of m){let g=C.get(A)||[];g.push(I),C.set(A,g)}for(let{typeName:I,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E}of m){let b=n.get(I);if(!b||b.statement===A)continue;let w=o.indexOf(b.statement),k=o.indexOf(A);if(w===-1||k===-1)continue;let N=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&E),v=(C.get(A)||[]).length>1;(N||v?w>k:w>k||w!==k-1)&&h.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:g})}if(h.length===0)return;h.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});let S=h[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:x(h)})}function x(m){return function*(h){let C=new Map;for(let S of m){let I=C.get(S.targetStatement)||[];I.push(S),C.set(S.targetStatement,I)}for(let[,S]of C)S.sort((I,A)=>{let g=I.firstUsagePosition-A.firstUsagePosition;if(g!==0)return g;let E=o.indexOf(I.typeDef.statement),b=o.indexOf(A.typeDef.statement);return E-b});for(let S of m){let{typeDef:I}=S,A=I.statement,g=r.getCommentsBefore(A),E=A.range[0],b=A.range[1];g.length>0&&g[0]&&(E=g[0].range[0]),yield h.removeRange([E,b])}for(let[S,I]of C){let A=r.getCommentsBefore(S),g=A.length>0&&A[0]?A[0].range[0]:S.range[0],E=[];for(let b of I){let w=b.typeDef.statement,k=r.getText(w),N=r.getCommentsBefore(w),c=k;N.length>0&&(c=`${N.map(d=>r.getText(d)).join(`
41
41
  `)}
42
42
  ${k}`),E.push(c)}yield h.insertTextBeforeRange([g,g],`${E.join(`
43
43
 
44
44
  `)}
45
45
 
46
- `)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.Identifier){if(u(m))return;let h=i(m),C=a(m),S=l(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:S,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of f){let{typeName:I,node:A}=S;if(!n.has(I)||!h(S))continue;let g=s(A),E=n.get(I);if(!g||!E||g===E.statement)continue;m.has(I)||m.set(I,[]);let b=m.get(I);if(!b)return;b.includes(g)||b.push(g)}let C=[];for(let[S,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let g=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<g&&(g=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S||p(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:S,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as rt from"zod/v4";var ol=["tsx"],sl=/^[A-Z][A-Za-z0-9]*$/,al=rt.object({extensions:rt.array(rt.string()).optional()}),Pn=$({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:[U(al)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??ol,o=!1;for(let g of n)if(r.endsWith(g)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function l(g){return sl.test(g)}function p(g){if(g.type!==re.CallExpression)return!1;let E=g.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(g){if(g.type===re.JSXElement||g.type===re.JSXFragment)return!0;if(g.type===re.ArrayExpression){for(let E of g.elements)if(E&&(E.type===re.JSXElement||E.type===re.JSXFragment))return!0}return!1}function f(g){if(g.type!==re.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===re.ArrowFunctionExpression){let b=E.body;if(u(b))return!0}return!1}function y(g){if(g.id.type!==re.Identifier)return;let E=g.id.name,b=g.init;if(b){if(l(E)&&(b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||p(b))){i.add(E);return}b.type===re.Identifier&&a.set(E,b.name),l(E)||f(b)&&i.add(E)}}function x(g){if(g.type===re.VariableDeclaration){for(let E of g.declarations)y(E);return}if(g.type===re.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===re.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===re.VariableDeclaration){for(let b of E.declarations)y(b);return}if(E.type===re.FunctionDeclaration&&E.id){l(E.id.name)&&i.add(E.id.name);return}}}for(let g of s.ast.body)x(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let b=a.get(g);return b?m(b,E):!1}let h=[];function C(g,E,b){h.push({node:g,isType:E,isComponent:b})}for(let g of s.ast.body){if(g.type===re.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let b=g.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,N=m(k);C(w,E,N)}continue}if(b.type===re.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||l(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(g.specifiers.length>0)for(let b of g.specifiers){if(b.local.type!==re.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(g.type===re.ExportDefaultDeclaration){let E=g.declaration;if(E.type===re.Identifier){let b=m(E.name)||l(E.name);C(g,!1,b);continue}if(E.type===re.FunctionDeclaration||E.type===re.ArrowFunctionExpression||E.type===re.FunctionExpression||E.type===re.CallExpression){C(g,!1,!0);continue}C(g,!1,!1);continue}}let S=!1;for(let g of h)if(!g.isType&&g.isComponent){S=!0;break}if(!S)return{};let I=[];for(let g of h)g.isType||I.push(g);let A=-1;for(let[g,E]of I.entries())if(E.isComponent){A=g;break}if(A===-1)return{};for(let[g,E]of I.entries())if(g!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as Be}from"@typescript-eslint/utils";import{z as Nn}from"zod/v4";function Ft(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ll(e){return e.callee.type===Be.Identifier?e.callee.name==="useState":e.callee.type===Be.MemberExpression&&e.callee.object.type===Be.Identifier&&e.callee.property.type===Be.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var pl=Nn.object({ignorePrefixes:Nn.array(Nn.string()).optional()});function Ei(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function cl(e){return`set${Ft(e)}`}var On=$({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:[U(pl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.CallExpression||!ll(r.init)||r.id.type!==Be.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.Identifier||o.type!==Be.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],l=Ei(s,a),p=Ei(i,a);if(l===""){if(!p.startsWith("set")){let f=`set${Ft(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Ft(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=cl(l);p!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Ft(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});import{AST_NODE_TYPES as Se}from"@typescript-eslint/utils";import{z as it}from"zod/v4";var ul=it.object({name:it.string(),defaults:it.array(it.unknown())}),fl=it.object({functions:it.array(ul)});function vt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,s)=>vt(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,l=i.value;if(!vt(a,l))return!1}return!0}function ml(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&vt(o.value,s.value)&&r.add(n)}return r}function hi(e){if(e.type===Se.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.Literal:return e.value;case Se.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.Property&&r.key.type===Se.Identifier&&!r.computed&&(r.value.type===Se.Literal?t[r.key.name]=r.value.value:r.value.type===Se.ObjectExpression?t[r.key.name]=hi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.SpreadElement))return t.type===Se.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function yl(e){return e.type===Se.Identifier?e.name:e.type===Se.MemberExpression&&e.property.type===Se.Identifier&&!e.computed?e.property.name:null}var Dn=$({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:[U(fl)]},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=yl(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let h=s[m],C=i[m];if(!C||C.type===Se.SpreadElement){a=m;continue}let S=hi(C);if(h===void 0){a=m;continue}if(vt(S,h)){C.type===Se.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,S),y.push({type:"simple",position:m+1,value:S}));continue}if(C.type===Se.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=ml(S,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===Se.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)}),a=m}else a=m}if(a<i.length-1||l||u.size>0){let m=function(){let C=[];for(let S of y)if(S.type==="simple")C.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")C.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=s?s[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let g=A;for(let E of I)if(E in g){let b=Object.getOwnPropertyDescriptor(g,E);b&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let S=[];if(l)for(let[A,g]of p){let E=i[A];if(E&&E.type===Se.ObjectExpression){let b=[];for(let k of E.properties)k.type===Se.Property&&k.key.type===Se.Identifier&&!k.computed&&g.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),g=e.sourceCode.getLastToken(n);A&&g&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}else{let A=i[I],g=e.sourceCode.getLastToken(n);g&&A&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}return S.length>0?S:null}})}}}}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function dl(e){let t=e.parent;for(;t;){if(t.type===ke.AwaitExpression||t.type===ke.MemberExpression&&t.object===e&&t.property.type===ke.Identifier&&t.property.name==="then"||t.type===ke.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ke.ArrayExpression&&t.parent.type===ke.CallExpression){let r=t.parent;if(r.callee.type===ke.MemberExpression&&r.callee.object.type===ke.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===ke.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function gl(e){let{callee:t}=e;return t.type===ke.Identifier&&t.name==="require"||t.type===ke.MemberExpression&&t.object.type===ke.Identifier&&t.object.name==="require"}var Ln=$({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){dl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){gl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as jn}from"zod/v4";var Sl=jn.object({mainComponentRegex:jn.string().optional(),mainComponentSelector:jn.string().optional()}),Tl=/^[A-Z][A-Za-z0-9]*$/,Mn=$({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:[U(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,a=new Map,l=[],p=[],u=new Set;function f(d){let T=d.node;if(T.type===M.VariableDeclaration){for(let F of T.declarations)if(F.id.type===M.Identifier&&F.id.name===d.name&&F.init)return F.init}if(T.type===M.ExportNamedDeclaration){let F=T.declaration;if(F&&F.type===M.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let T=new Set;return Oe(d,F=>(F.type===M.Identifier&&F.name!=="styled"&&F.name!=="css"&&T.add(F.name),!1),r),T}function x(d){return Tl.test(d)}function m(d){if(d.type!==M.CallExpression)return!1;let T=d.callee;return T.type===M.Identifier?T.name==="memo"||T.name==="forwardRef":T.type===M.MemberExpression&&T.property.type===M.Identifier?T.property.name==="memo"||T.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 T of d.body)if(T.type===M.ReturnStatement&&T.argument)return h(T.argument)}if(d.type===M.ArrayExpression){for(let T of d.elements)if(T&&(T.type===M.JSXElement||T.type===M.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.ArrowFunctionExpression)return!1;let T=d.body;if(T.type===M.ArrowFunctionExpression){let F=T.body;if(h(F))return!0}return!1}function S(d){if(d.type===M.TaggedTemplateExpression){let T=d.tag;if(T.type===M.MemberExpression&&T.object.type===M.Identifier&&T.object.name==="styled")return!0;if(T.type===M.CallExpression){let F=T.callee;if(F.type===M.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===M.TaggedTemplateExpression){let T=d.tag;if(T.type===M.Identifier&&T.name==="css")return!0}return!1}function A(d,T){if(d.id.type!==M.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){p.push({node:T,name:F});return}if((x(F)||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(F);return}}else if(m(P)){i.add(F);return}}P.type===M.Identifier&&a.set(F,P.name),x(F)||C(P)&&i.add(F)}}function g(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 T=d.declarations[0];if(T&&T.id.type===M.Identifier)return T.id.name}if(d.type===M.ExportDefaultDeclaration){let T=d.declaration;if(T.type===M.FunctionDeclaration)return T.id?T.id.name:"default";if(T.type===M.Identifier)return T.name}if(d.type===M.ExportNamedDeclaration){let T=d.declaration;if(T&&T.type===M.FunctionDeclaration)return T.id?T.id.name:null;if(T&&T.type===M.VariableDeclaration){let F=T.declarations[0];if(F&&F.id.type===M.Identifier)return F.id.name}}return null}function b(d,T){return o?u.has(d):n?n.test(T):g(d)}function w(d){let T=new Set;Oe(d.node,F=>{if(F.type===M.Identifier)for(let P of p)P.name===F.name&&(T.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.JSXElement){let P=F.openingElement;if(P.name.type===M.JSXIdentifier)for(let L of p)L.name===P.name.name&&(T.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=T}function k(d){if(d.type===M.VariableDeclaration){for(let T of d.declarations)A(T,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 T=d.declaration;if(T.type===M.VariableDeclaration){for(let F of T.declarations)A(F,d);return}if(T.type===M.FunctionDeclaration&&T.id){x(T.id.name)&&h(T.body)&&i.add(T.id.name);return}}if(d.type===M.ExportDefaultDeclaration){let T=d.declaration;T.type===M.Identifier&&i.add(T.name),(T.type===M.FunctionDeclaration||T.type===M.ArrowFunctionExpression||T.type===M.FunctionExpression)&&(T.type===M.FunctionDeclaration?T.id?i.add(T.id.name):i.add("default"):h(T.body)&&i.add("default"))}}function N(d,T=new Set){if(i.has(d))return!0;if(T.has(d))return!1;T.add(d);let F=a.get(d);return F?N(F,T):!1}let c={};return o&&(c[o]=d=>{let T=d;for(;T.parent&&T.parent.type!==M.Program;)T=T.parent;T.parent&&(T.type===M.VariableDeclaration||T.type===M.FunctionDeclaration||T.type===M.ExportNamedDeclaration||T.type===M.ExportDefaultDeclaration)&&u.add(T)}),c["Program:exit"]=d=>{let T=0;for(let D of d.body){if(D.type===M.ImportDeclaration){T+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&N(Z)){let B=b(D,Z);l.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:g(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 F=new Set;for(let D of p)F.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let B of p)B.node===Z&&P.set(B.name,D)}let L=new Map;for(let D of p){let Z=f(D),B=new Set;if(Z){let pe=y(Z);for(let fe of pe)F.has(fe)&&fe!==D.name&&B.add(fe)}L.set(D.name,B)}let X=new Map;for(let D of p){let Z=L.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let pe of Z){let fe=X.get(pe);(fe===void 0||B<fe)&&X.set(pe,B)}}let G=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),B=-1;for(let xe of l){if(!xe.usedStyles.has(D.name))continue;let Ie=d.body.indexOf(xe.node);(B===-1||Ie<B)&&(B=Ie)}let pe=X.get(D.name);if(pe!==void 0&&(B===-1||pe<B)&&(B=pe),B===-1)continue;let fe=-1;for(let xe of l){let Ie=d.body.indexOf(xe.node);Ie<B&&Ie>fe&&(fe=Ie)}let ve=Z<B,We=Z>fe,Te=-1,ot=L.get(D.name);if(ot)for(let xe of ot){let Ie=P.get(xe);Ie!==void 0&&Ie>Te&&(Te=Ie)}let Ge=Z>Te;if(!(ve&&We&&Ge)){let xe=fe+1;if(Te+1>xe&&(xe=Te+1),xe<T&&(xe=T),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(l.length>1){let D=l.map(B=>({c:B,idx:d.body.indexOf(B.node)})).sort((B,pe)=>B.idx-pe.idx)[0]?.c,Z=l.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,d.body)})}},c;function v(d,T,F){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let L=new Map;for(let X of d){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:pe}of G){let fe=r.getCommentsBefore(pe.node),ve=r.getText(pe.node);fe.length>0&&(ve=`${fe.map(Te=>r.getText(Te)).join(`
46
+ `)}}}return{Program(m){o.push(...m.body)},TSTypeAliasDeclaration(m){if(o.some(C=>C.type===he.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSInterfaceDeclaration(m){if(o.some(C=>C.type===he.ExportNamedDeclaration&&C.declaration===m?!0:C===m)){let C=s(m);C&&n.set(m.id.name,{node:m,name:m.id.name,statement:C})}},TSTypeReference(m){if(m.typeName.type===he.Identifier){if(u(m))return;let h=i(m),C=a(m),S=l(m);f.push({typeName:m.typeName.name,node:m,inFunctionArgs:h,inFCProps:C,inGenericArgAtFunctionCall:S,usagePosition:m.range[0]})}},"Program:exit"(){let m=new Map;function h(S){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let I of t.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of f){let{typeName:I,node:A}=S;if(!n.has(I)||!h(S))continue;let g=s(A),E=n.get(I);if(!g||!E||g===E.statement)continue;m.has(I)||m.set(I,[]);let b=m.get(I);if(!b)return;b.includes(g)||b.push(g)}let C=[];for(let[S,I]of m)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let g=Number.MAX_SAFE_INTEGER,E=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of f)h(w)&&w.typeName===S&&s(w.node)===A&&w.usagePosition<g&&(g=w.usagePosition,E=w.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S)continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of f){if(N.typeName!==S||p(N.node))continue;let c=s(N.node);if(!c)continue;let v=o.indexOf(c);v!==-1&&v<w&&(w=v)}let k=o.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&k!==-1&&w<k)continue}C.push({typeName:S,firstUsage:A,firstUsagePosition:g,firstUsageInFunctionArgs:E})}C.length>0&&y(C)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as rt from"zod/v4";var sl=["tsx"],al=/^[A-Z][A-Za-z0-9]*$/,ll=rt.object({extensions:rt.array(rt.string()).optional()}),Pn=$({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:[U(ll)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??sl,o=!1;for(let g of n)if(r.endsWith(g)){o=!0;break}if(!o)return{};let s=e.sourceCode,i=new Set,a=new Map;function l(g){return al.test(g)}function p(g){if(g.type!==re.CallExpression)return!1;let E=g.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(g){if(g.type===re.JSXElement||g.type===re.JSXFragment)return!0;if(g.type===re.ArrayExpression){for(let E of g.elements)if(E&&(E.type===re.JSXElement||E.type===re.JSXFragment))return!0}return!1}function f(g){if(g.type!==re.ArrowFunctionExpression)return!1;let E=g.body;if(E.type===re.ArrowFunctionExpression){let b=E.body;if(u(b))return!0}return!1}function y(g){if(g.id.type!==re.Identifier)return;let E=g.id.name,b=g.init;if(b){if(l(E)&&(b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||p(b))){i.add(E);return}b.type===re.Identifier&&a.set(E,b.name),l(E)||f(b)&&i.add(E)}}function x(g){if(g.type===re.VariableDeclaration){for(let E of g.declarations)y(E);return}if(g.type===re.FunctionDeclaration&&g.id){l(g.id.name)&&i.add(g.id.name);return}if(g.type===re.ExportNamedDeclaration&&g.declaration){let E=g.declaration;if(E.type===re.VariableDeclaration){for(let b of E.declarations)y(b);return}if(E.type===re.FunctionDeclaration&&E.id){l(E.id.name)&&i.add(E.id.name);return}}}for(let g of s.ast.body)x(g);function m(g,E=new Set){if(i.has(g))return!0;if(E.has(g))return!1;E.add(g);let b=a.get(g);return b?m(b,E):!1}let h=[];function C(g,E,b){h.push({node:g,isType:E,isComponent:b})}for(let g of s.ast.body){if(g.type===re.ExportNamedDeclaration){let E=g.exportKind==="type";if(g.declaration){let b=g.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,N=m(k);C(w,E,N)}continue}if(b.type===re.FunctionDeclaration){let w=b.id?.name,k=w?m(w)||l(w):!1;C(b,E,k);continue}C(b,E,!1);continue}if(g.specifiers.length>0)for(let b of g.specifiers){if(b.local.type!==re.Identifier)continue;let w=b.local.name,k=m(w);C(b,E,k)}continue}if(g.type===re.ExportDefaultDeclaration){let E=g.declaration;if(E.type===re.Identifier){let b=m(E.name)||l(E.name);C(g,!1,b);continue}if(E.type===re.FunctionDeclaration||E.type===re.ArrowFunctionExpression||E.type===re.FunctionExpression||E.type===re.CallExpression){C(g,!1,!0);continue}C(g,!1,!1);continue}}let S=!1;for(let g of h)if(!g.isType&&g.isComponent){S=!0;break}if(!S)return{};let I=[];for(let g of h)g.isType||I.push(g);let A=-1;for(let[g,E]of I.entries())if(E.isComponent){A=g;break}if(A===-1)return{};for(let[g,E]of I.entries())if(g!==A){e.report({node:E.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as Be}from"@typescript-eslint/utils";import{z as Nn}from"zod/v4";function Ft(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pl(e){return e.callee.type===Be.Identifier?e.callee.name==="useState":e.callee.type===Be.MemberExpression&&e.callee.object.type===Be.Identifier&&e.callee.property.type===Be.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var cl=Nn.object({ignorePrefixes:Nn.array(Nn.string()).optional()});function Ei(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function ul(e){return`set${Ft(e)}`}var On=$({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:[U(cl)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Be.CallExpression||!pl(r.init)||r.id.type!==Be.ArrayPattern||r.id.elements.length!==2)return;let[n,o]=r.id.elements;if(!n||!o||n.type!==Be.Identifier||o.type!==Be.Identifier)return;let s=n.name,i=o.name,a=t.ignorePrefixes||[],l=Ei(s,a),p=Ei(i,a);if(l===""){if(!p.startsWith("set")){let f=`set${Ft(s)}`;e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Ft(s),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:f},fix:y=>y.replaceText(o,f)}]})}return}let u=ul(l);p!==u&&e.report({node:o,messageId:"incorrectSetterName",data:{expectedName:Ft(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:f=>f.replaceText(o,u)}]})}}}});import{AST_NODE_TYPES as Se}from"@typescript-eslint/utils";import{z as it}from"zod/v4";var fl=it.object({name:it.string(),defaults:it.array(it.unknown())}),ml=it.object({functions:it.array(fl)});function vt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,s)=>vt(o,t[s]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r){if(!n.includes(o))return!1;let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return!1;let a=s.value,l=i.value;if(!vt(a,l))return!1}return!0}function yl(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let o=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);o&&s&&vt(o.value,s.value)&&r.add(n)}return r}function hi(e){if(e.type===Se.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case Se.Literal:return e.value;case Se.ObjectExpression:{let t={};for(let r of e.properties)r.type===Se.Property&&r.key.type===Se.Identifier&&!r.computed&&(r.value.type===Se.Literal?t[r.key.name]=r.value.value:r.value.type===Se.ObjectExpression?t[r.key.name]=hi(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case Se.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===Se.SpreadElement))return t.type===Se.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function dl(e){return e.type===Se.Identifier?e.name:e.type===Se.MemberExpression&&e.property.type===Se.Identifier&&!e.computed?e.property.name:null}var Dn=$({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:[U(ml)]},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=dl(n.callee);if(!o)return;let s=r.get(o);if(!s)return;let i=n.arguments;if(i.length===0)return;let a=-1,l=!1,p=new Map,u=new Set,f=new Map,y=[];for(let m=0;m<i.length;m++){if(m>=s.length){a=m;continue}let h=s[m],C=i[m];if(!C||C.type===Se.SpreadElement){a=m;continue}let S=hi(C);if(h===void 0){a=m;continue}if(vt(S,h)){C.type===Se.ObjectExpression?(u.add(m),y.push({type:"object",position:m+1})):(f.set(m,S),y.push({type:"simple",position:m+1,value:S}));continue}if(C.type===Se.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=yl(S,h);if(I.size>0){let A=typeof h=="object"&&h!==null?Object.keys(h).length:0;if(C.type===Se.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)}),a=m}else a=m}if(a<i.length-1||l||u.size>0){let m=function(){let C=[];for(let S of y)if(S.type==="simple")C.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")C.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=s?s[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let g=A;for(let E of I)if(E in g){let b=Object.getOwnPropertyDescriptor(g,E);b&&C.push(`Param ${S.position} property "${E}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:C.join(", ")}}};var x=m;let h=m();e.report({node:n,messageId:h.messageId,data:h.data,fix(C){let S=[];if(l)for(let[A,g]of p){let E=i[A];if(E&&E.type===Se.ObjectExpression){let b=[];for(let k of E.properties)k.type===Se.Property&&k.key.type===Se.Identifier&&!k.computed&&g.has(k.key.name)||b.push(k);let w=b.map(k=>e.sourceCode.getText(k));S.push(C.replaceText(E,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=a){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(n.callee),g=e.sourceCode.getLastToken(n);A&&g&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}else{let A=i[I],g=e.sourceCode.getLastToken(n);g&&A&&S.push(C.replaceTextRange([A.range[1],g.range[0]],""))}return S.length>0?S:null}})}}}}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function gl(e){let t=e.parent;for(;t;){if(t.type===ke.AwaitExpression||t.type===ke.MemberExpression&&t.object===e&&t.property.type===ke.Identifier&&t.property.name==="then"||t.type===ke.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===ke.ArrayExpression&&t.parent.type===ke.CallExpression){let r=t.parent;if(r.callee.type===ke.MemberExpression&&r.callee.object.type===ke.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===ke.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function Sl(e){let{callee:t}=e;return t.type===ke.Identifier&&t.name==="require"||t.type===ke.MemberExpression&&t.object.type===ke.Identifier&&t.object.name==="require"}var Ln=$({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){gl(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){Sl(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as M}from"@typescript-eslint/utils";import{z as jn}from"zod/v4";var Tl=jn.object({mainComponentRegex:jn.string().optional(),mainComponentSelector:jn.string().optional()}),El=/^[A-Z][A-Za-z0-9]*$/,Mn=$({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:[U(Tl)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,o=t.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,a=new Map,l=[],p=[],u=new Set;function f(d){let T=d.node;if(T.type===M.VariableDeclaration){for(let F of T.declarations)if(F.id.type===M.Identifier&&F.id.name===d.name&&F.init)return F.init}if(T.type===M.ExportNamedDeclaration){let F=T.declaration;if(F&&F.type===M.VariableDeclaration){for(let P of F.declarations)if(P.id.type===M.Identifier&&P.id.name===d.name&&P.init)return P.init}}return null}function y(d){let T=new Set;return Oe(d,F=>(F.type===M.Identifier&&F.name!=="styled"&&F.name!=="css"&&T.add(F.name),!1),r),T}function x(d){return El.test(d)}function m(d){if(d.type!==M.CallExpression)return!1;let T=d.callee;return T.type===M.Identifier?T.name==="memo"||T.name==="forwardRef":T.type===M.MemberExpression&&T.property.type===M.Identifier?T.property.name==="memo"||T.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 T of d.body)if(T.type===M.ReturnStatement&&T.argument)return h(T.argument)}if(d.type===M.ArrayExpression){for(let T of d.elements)if(T&&(T.type===M.JSXElement||T.type===M.JSXFragment))return!0}return!1}function C(d){if(d.type!==M.ArrowFunctionExpression)return!1;let T=d.body;if(T.type===M.ArrowFunctionExpression){let F=T.body;if(h(F))return!0}return!1}function S(d){if(d.type===M.TaggedTemplateExpression){let T=d.tag;if(T.type===M.MemberExpression&&T.object.type===M.Identifier&&T.object.name==="styled")return!0;if(T.type===M.CallExpression){let F=T.callee;if(F.type===M.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===M.TaggedTemplateExpression){let T=d.tag;if(T.type===M.Identifier&&T.name==="css")return!0}return!1}function A(d,T){if(d.id.type!==M.Identifier)return;let F=d.id.name,P=d.init;if(P){if(S(P)||I(P)){p.push({node:T,name:F});return}if((x(F)||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(F);return}}else if(m(P)){i.add(F);return}}P.type===M.Identifier&&a.set(F,P.name),x(F)||C(P)&&i.add(F)}}function g(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 T=d.declarations[0];if(T&&T.id.type===M.Identifier)return T.id.name}if(d.type===M.ExportDefaultDeclaration){let T=d.declaration;if(T.type===M.FunctionDeclaration)return T.id?T.id.name:"default";if(T.type===M.Identifier)return T.name}if(d.type===M.ExportNamedDeclaration){let T=d.declaration;if(T&&T.type===M.FunctionDeclaration)return T.id?T.id.name:null;if(T&&T.type===M.VariableDeclaration){let F=T.declarations[0];if(F&&F.id.type===M.Identifier)return F.id.name}}return null}function b(d,T){return o?u.has(d):n?n.test(T):g(d)}function w(d){let T=new Set;Oe(d.node,F=>{if(F.type===M.Identifier)for(let P of p)P.name===F.name&&(T.add(P.name),(P.firstUsagePosition===void 0||F.range[0]<P.firstUsagePosition)&&(P.firstUsagePosition=F.range[0]));if(F.type===M.JSXElement){let P=F.openingElement;if(P.name.type===M.JSXIdentifier)for(let L of p)L.name===P.name.name&&(T.add(L.name),(L.firstUsagePosition===void 0||P.name.range[0]<L.firstUsagePosition)&&(L.firstUsagePosition=P.name.range[0]))}return!1},r),d.usedStyles=T}function k(d){if(d.type===M.VariableDeclaration){for(let T of d.declarations)A(T,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 T=d.declaration;if(T.type===M.VariableDeclaration){for(let F of T.declarations)A(F,d);return}if(T.type===M.FunctionDeclaration&&T.id){x(T.id.name)&&h(T.body)&&i.add(T.id.name);return}}if(d.type===M.ExportDefaultDeclaration){let T=d.declaration;T.type===M.Identifier&&i.add(T.name),(T.type===M.FunctionDeclaration||T.type===M.ArrowFunctionExpression||T.type===M.FunctionExpression)&&(T.type===M.FunctionDeclaration?T.id?i.add(T.id.name):i.add("default"):h(T.body)&&i.add("default"))}}function N(d,T=new Set){if(i.has(d))return!0;if(T.has(d))return!1;T.add(d);let F=a.get(d);return F?N(F,T):!1}let c={};return o&&(c[o]=d=>{let T=d;for(;T.parent&&T.parent.type!==M.Program;)T=T.parent;T.parent&&(T.type===M.VariableDeclaration||T.type===M.FunctionDeclaration||T.type===M.ExportNamedDeclaration||T.type===M.ExportDefaultDeclaration)&&u.add(T)}),c["Program:exit"]=d=>{let T=0;for(let D of d.body){if(D.type===M.ImportDeclaration){T+=1;continue}break}for(let D of d.body)k(D);for(let D of d.body){let Z=E(D);if(Z&&N(Z)){let B=b(D,Z);l.push({node:D,name:Z,isMainComponent:B,usedStyles:new Set,isExported:g(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 F=new Set;for(let D of p)F.add(D.name);let P=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let B of p)B.node===Z&&P.set(B.name,D)}let L=new Map;for(let D of p){let Z=f(D),B=new Set;if(Z){let pe=y(Z);for(let fe of pe)F.has(fe)&&fe!==D.name&&B.add(fe)}L.set(D.name,B)}let X=new Map;for(let D of p){let Z=L.get(D.name);if(!Z)continue;let B=P.get(D.name);if(B!==void 0)for(let pe of Z){let fe=X.get(pe);(fe===void 0||B<fe)&&X.set(pe,B)}}let G=[];for(let D of p){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),B=-1;for(let xe of l){if(!xe.usedStyles.has(D.name))continue;let Ie=d.body.indexOf(xe.node);(B===-1||Ie<B)&&(B=Ie)}let pe=X.get(D.name);if(pe!==void 0&&(B===-1||pe<B)&&(B=pe),B===-1)continue;let fe=-1;for(let xe of l){let Ie=d.body.indexOf(xe.node);Ie<B&&Ie>fe&&(fe=Ie)}let ve=Z<B,We=Z>fe,Te=-1,ot=L.get(D.name);if(ot)for(let xe of ot){let Ie=P.get(xe);Ie!==void 0&&Ie>Te&&(Te=Ie)}let Ge=Z>Te;if(!(ve&&We&&Ge)){let xe=fe+1;if(Te+1>xe&&(xe=Te+1),xe<T&&(xe=T),xe>B)continue;G.push({style:D,targetPosition:xe})}}let q=null;if(l.length>1){let D=l.map(B=>({c:B,idx:d.body.indexOf(B.node)})).sort((B,pe)=>B.idx-pe.idx)[0]?.c,Z=l.find(B=>B.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(q={component:Z,targetBefore:D.node})}if(G.length>0||q){let D=G[0]?.style.node||q?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:v(G,q,d.body)})}},c;function v(d,T,F){return function*(P){d.sort((X,G)=>X.targetPosition-G.targetPosition);for(let{style:X}of d){let G=r.getCommentsBefore(X.node),q=X.node.range[0],D=X.node.range[1];G.length>0&&G[0]&&(q=G[0].range[0]),q===X.node.range[0]&&r.text.slice(0,q).trim().length===0&&(q=0),yield P.removeRange([q,D])}let L=new Map;for(let X of d){let G=L.get(X.targetPosition)||[];G.push(X),L.set(X.targetPosition,G)}for(let[X,G]of L){let q=F[X];if(!q)continue;let D=r.getCommentsBefore(q),Z=D.length>0&&D[0]?D[0].range[0]:q.range[0],B=[];for(let{style:pe}of G){let fe=r.getCommentsBefore(pe.node),ve=r.getText(pe.node);fe.length>0&&(ve=`${fe.map(Te=>r.getText(Te)).join(`
47
47
  `)}
48
48
  ${ve}`),B.push(ve)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
49
49
 
@@ -52,4 +52,4 @@ ${ve}`),B.push(ve)}yield P.insertTextBeforeRange([Z,Z],`${B.join(`
52
52
  `)}if(T){let{component:X,targetBefore:G}=T,q=r.getCommentsBefore(X.node),D=X.node.range[0],Z=X.node.range[1];q.length>0&&q[0]&&(D=q[0].range[0]),D===X.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let B=r.getCommentsBefore(G),pe=B.length>0&&B[0]?B[0].range[0]:G.range[0],fe=(()=>{let ve=r.getText(X.node);return q.length>0&&(ve=`${q.map(Te=>r.getText(Te)).join(`
53
53
  `)}
54
54
  ${ve}`),ve})();yield P.removeRange([D,Z]),yield P.insertTextBeforeRange([pe,pe],`${fe}
55
- `)}}}}});import{AST_NODE_TYPES as El,ESLintUtils as hl}from"@typescript-eslint/utils";import bi from"typescript";import{z as bl}from"zod/v4";var xl=bl.object({}),_n=$({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:[U(xl)]},defaultOptions:[{}],create(e){let t=hl.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o,s){if(o.flags&bi.TypeFlags.Any||o.flags&bi.TypeFlags.Unknown)return!1;let i=o.getProperty("then");return i?s.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==El.CallExpression)return;let s=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(s);if(!n(i,r)){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 Ae}from"@typescript-eslint/utils";import{z as mt}from"zod/v4";var Cl=mt.object({functions:mt.array(mt.string()).optional(),selectors:mt.array(mt.string()).optional()});function xi(e){let t=e.parent;for(;t;){if(t.type===Ae.FunctionDeclaration||t.type===Ae.FunctionExpression||t.type===Ae.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Ci(e){if(e.type===Ae.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ae.Identifier?r.name:r.type===Ae.MemberExpression&&r.property.type===Ae.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ae.Identifier?t.name:t.type===Ae.MemberExpression&&t.property.type===Ae.Identifier?t.property.name:null}var $n=$({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:[U(Cl)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(xi(i))return;let a=Ci(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(i){i.type===Ae.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ae.TaggedTemplateExpression&&o(i)}};for(let i of n)s[i]=a=>{if(a.type!==Ae.CallExpression&&a.type!==Ae.TaggedTemplateExpression||xi(a))return;let l=Ci(a);l&&e.report({node:a,messageId:"moduleLevel",data:{functionName:l}})};return s}});import{AST_NODE_TYPES as Pe}from"@typescript-eslint/utils";function Il(e,t){let{body:r}=e;if(r.type!==Pe.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==Pe.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function Al(e){let t=e.parent;if(t.type!==Pe.ReturnStatement)return null;let r=t.parent;if(r.type!==Pe.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==Pe.FunctionDeclaration&&n.type!==Pe.ArrowFunctionExpression&&n.type!==Pe.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Un=$({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!==Pe.FunctionExpression&&n.type!==Pe.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:s}=n;if(s.type===Pe.BlockStatement){if(s.body.length!==1){let p=Al(r);if(p){if(t.getCommentsInside(n).length>0)return;let f=t.getText(s);e.report({node:r,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:x}=p;return x.body.type!==Pe.BlockStatement?null:y.replaceText(x.body,f)}})}return}let l=s.body[0];if(!l||l.type!==Pe.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=Il(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:l=>l.replaceText(r,a)})}}}});import{z as Ze}from"zod/v4";var wl="no-restricted-comments",Fl=Ze.object({regex:Ze.string().optional(),includes:Ze.string().optional(),message:Ze.string().optional(),autoFix:Ze.boolean().optional()}),vl=Ze.object({patterns:Ze.array(Fl)}),zn=$({name:wl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[U(vl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function o(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function s(i,a){return a.regex?o(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let l of i)for(let p of t.patterns)if(s(l.value,p)){let f=function(y){return y.remove(l)};var a=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 Vn}from"@typescript-eslint/utils";import{z as yt}from"zod/v4";var Rl=yt.object({allow:yt.record(yt.string(),yt.array(yt.string())).optional()}),Wn=$({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[U(Rl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function o(i){return i.type===Vn.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===Vn.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function s(i,a){let l=r[i];return l?l.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==Vn.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let l=o(i.parent.name);!l||!l.isCustom||l.name&&s(l.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});var Ii={[an.name]:an.rule,[zt.name]:zt.rule,[Ut.name]:Ut.rule,"rules-of-hooks":gi,"exhaustive-deps":tr,"require-description":si.rule,[Vt.name]:Vt.rule,[Jt.name]:Jt.rule,[cn.name]:cn.rule,[kt.name]:kt.rule,[$t.name]:$t.rule,[Ht.name]:Ht.rule,[at.name]:at.rule,[yn.name]:yn.rule,[Xt.name]:Xt.rule,[Wt.name]:Wt.rule,[Yt.name]:Yt.rule,[Nt.name]:Nt.rule,[Tn.name]:Tn.rule,[Sn.name]:Sn.rule,[hn.name]:hn.rule,[Cn.name]:Cn.rule,[_t.name]:_t.rule,[Kt.name]:Kt.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[rn.name]:rn.rule,[on.name]:on.rule,[tn.name]:tn.rule,[nn.name]:nn.rule,[fn.name]:fn.rule,[Zt.name]:Zt.rule,[qt.name]:qt.rule,[Rn.name]:Rn.rule,[ln.name]:ln.rule,[In.name]:In.rule,[vn.name]:vn.rule,[kn.name]:kn.rule,[Pn.name]:Pn.rule,[On.name]:On.rule,[Dn.name]:Dn.rule,[Ln.name]:Ln.rule,[Mn.name]:Mn.rule,[_n.name]:_n.rule,[$n.name]:$n.rule,[at.name]:at.rule,[Un.name]:Un.rule,[zn.name]:zn.rule,[Wn.name]:Wn.rule};var kl={rules:Ii},Nm=kl;export{Nm as default,kl as extendedLintPlugin};
55
+ `)}}}}});import{AST_NODE_TYPES as hl,ESLintUtils as bl}from"@typescript-eslint/utils";import bi from"typescript";import{z as xl}from"zod/v4";var Cl=xl.object({}),_n=$({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:[U(Cl)]},defaultOptions:[{}],create(e){let t=bl.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o,s){if(o.flags&bi.TypeFlags.Any||o.flags&bi.TypeFlags.Unknown)return!1;let i=o.getProperty("then");return i?s.getTypeOfSymbol(i).getCallSignatures().length>0:!1}return{UnaryExpression(o){if(o.operator!=="void"||o.argument.type!==hl.CallExpression)return;let s=t.esTreeNodeToTSNodeMap.get(o.argument),i=r.getTypeAtLocation(s);if(!n(i,r)){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 Ae}from"@typescript-eslint/utils";import{z as mt}from"zod/v4";var Il=mt.object({functions:mt.array(mt.string()).optional(),selectors:mt.array(mt.string()).optional()});function xi(e){let t=e.parent;for(;t;){if(t.type===Ae.FunctionDeclaration||t.type===Ae.FunctionExpression||t.type===Ae.ArrowFunctionExpression)return!0;t=t.parent}return!1}function Ci(e){if(e.type===Ae.TaggedTemplateExpression){let{tag:r}=e;return r.type===Ae.Identifier?r.name:r.type===Ae.MemberExpression&&r.property.type===Ae.Identifier?r.property.name:null}let{callee:t}=e;return t.type===Ae.Identifier?t.name:t.type===Ae.MemberExpression&&t.property.type===Ae.Identifier?t.property.name:null}var $n=$({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:[U(Il)]},defaultOptions:[{functions:[],selectors:[]}],create(e){let[t]=e.options,r=new Set(t.functions??[]),n=t.selectors??[];function o(i){if(xi(i))return;let a=Ci(i);a&&r.has(a)&&e.report({node:i,messageId:"moduleLevel",data:{functionName:a}})}let s={CallExpression(i){i.type===Ae.CallExpression&&o(i)},TaggedTemplateExpression(i){i.type===Ae.TaggedTemplateExpression&&o(i)}};for(let i of n)s[i]=a=>{if(a.type!==Ae.CallExpression&&a.type!==Ae.TaggedTemplateExpression||xi(a))return;let l=Ci(a);l&&e.report({node:a,messageId:"moduleLevel",data:{functionName:l}})};return s}});import{AST_NODE_TYPES as Pe}from"@typescript-eslint/utils";function Al(e,t){let{body:r}=e;if(r.type!==Pe.BlockStatement)return t.getText(r);let n=r.body[0];return!n||n.type!==Pe.ReturnStatement?"":n.argument?t.getText(n.argument):"undefined"}function wl(e){let t=e.parent;if(t.type!==Pe.ReturnStatement)return null;let r=t.parent;if(r.type!==Pe.BlockStatement||r.body.length!==1)return null;let n=r.parent;return n.type!==Pe.FunctionDeclaration&&n.type!==Pe.ArrowFunctionExpression&&n.type!==Pe.FunctionExpression?null:{parentFunction:n,returnStatement:t}}var Un=$({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!==Pe.FunctionExpression&&n.type!==Pe.ArrowFunctionExpression||n.async||n.params.length>0)return;let{body:s}=n;if(s.type===Pe.BlockStatement){if(s.body.length!==1){let p=wl(r);if(p){if(t.getCommentsInside(n).length>0)return;let f=t.getText(s);e.report({node:r,messageId:"unnecessaryIife",fix:y=>{let{parentFunction:x}=p;return x.body.type!==Pe.BlockStatement?null:y.replaceText(x.body,f)}})}return}let l=s.body[0];if(!l||l.type!==Pe.ReturnStatement)return}if(t.getCommentsInside(n).length>0)return;let a=Al(n,t);e.report({node:r,messageId:"unnecessaryIife",fix:l=>l.replaceText(r,a)})}}}});import{z as Ze}from"zod/v4";var Fl="no-restricted-comments",vl=Ze.object({regex:Ze.string().optional(),includes:Ze.string().optional(),message:Ze.string().optional(),autoFix:Ze.boolean().optional()}),Rl=Ze.object({patterns:Ze.array(vl)}),zn=$({name:Fl,meta:{type:"problem",docs:{description:"Disallow comments matching specific patterns"},fixable:"code",hasSuggestions:!0,schema:[U(Rl)],messages:{restrictedComment:"Comment matches restricted pattern '{{pattern}}'",restrictedCommentWithMessage:"{{message}}",removeComment:"Remove this comment"}},defaultOptions:[{patterns:[]}],create(e,[t]){let r=e.sourceCode,n=new Map;function o(i){let a=n.get(i);return a||(a=new RegExp(i),n.set(i,a)),a}function s(i,a){return a.regex?o(a.regex).test(i):a.includes?i.includes(a.includes):!1}return{Program(){let i=r.getAllComments();for(let l of i)for(let p of t.patterns)if(s(l.value,p)){let f=function(y){return y.remove(l)};var a=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 Vn}from"@typescript-eslint/utils";import{z as yt}from"zod/v4";var kl=yt.object({allow:yt.record(yt.string(),yt.array(yt.string())).optional()}),Wn=$({name:"no-data-attributes-on-components",meta:{type:"problem",docs:{description:"Disallow data-* attributes on custom React components. Use regular props instead."},schema:[U(kl)],messages:{noDataAttributesOnComponents:"Avoid using data-* attributes on custom components. Use regular props instead or apply data attributes to the underlying DOM element."}},defaultOptions:[{}],create(e,[t]){let r=t.allow??{};function n(i){let a=i.charAt(0);return a===a.toUpperCase()&&a!==a.toLowerCase()}function o(i){return i.type===Vn.JSXIdentifier?{name:i.name,isCustom:n(i.name)}:i.type===Vn.JSXMemberExpression?{name:"",isCustom:!0}:{name:`${i.namespace.name}:${i.name.name}`,isCustom:!1}}function s(i,a){let l=r[i];return l?l.includes(a):!1}return{JSXAttribute(i){if(i.name.type!==Vn.JSXIdentifier)return;let a=i.name.name;if(!a.startsWith("data-"))return;let l=o(i.parent.name);!l||!l.isCustom||l.name&&s(l.name,a)||e.report({node:i,messageId:"noDataAttributesOnComponents"})}}}});var Ii={[an.name]:an.rule,[zt.name]:zt.rule,[Ut.name]:Ut.rule,"rules-of-hooks":gi,"exhaustive-deps":tr,"require-description":si.rule,[Vt.name]:Vt.rule,[Jt.name]:Jt.rule,[cn.name]:cn.rule,[kt.name]:kt.rule,[$t.name]:$t.rule,[Ht.name]:Ht.rule,[at.name]:at.rule,[yn.name]:yn.rule,[Xt.name]:Xt.rule,[Wt.name]:Wt.rule,[Yt.name]:Yt.rule,[Nt.name]:Nt.rule,[Tn.name]:Tn.rule,[Sn.name]:Sn.rule,[hn.name]:hn.rule,[Cn.name]:Cn.rule,[_t.name]:_t.rule,[Kt.name]:Kt.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[rn.name]:rn.rule,[on.name]:on.rule,[tn.name]:tn.rule,[nn.name]:nn.rule,[fn.name]:fn.rule,[Zt.name]:Zt.rule,[qt.name]:qt.rule,[Rn.name]:Rn.rule,[ln.name]:ln.rule,[In.name]:In.rule,[vn.name]:vn.rule,[kn.name]:kn.rule,[Pn.name]:Pn.rule,[On.name]:On.rule,[Dn.name]:Dn.rule,[Ln.name]:Ln.rule,[Mn.name]:Mn.rule,[_n.name]:_n.rule,[$n.name]:$n.rule,[at.name]:at.rule,[Un.name]:Un.rule,[zn.name]:zn.rule,[Wn.name]:Wn.rule};var Pl={rules:Ii},Om=Pl;export{Om as default,Pl as extendedLintPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ls-stack/extended-lint",
3
- "version": "0.88.0",
3
+ "version": "0.88.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"