@ls-stack/extended-lint 0.75.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import{AST_NODE_TYPES as he}from"@typescript-eslint/utils";import{z as M}from"zod/v4";import{ESLintUtils as ni}from"@typescript-eslint/utils";import*as Pn from"zod/v4";function q(e){let r=ni.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:r}}function B(e){return Pn.toJSONSchema(e)}var ri=M.object({disallow:M.array(M.object({selector:M.string(),message:M.string(),replace:M.optional(M.union([M.string(),M.object({regex:M.string(),with:M.string()})])),replaceType:M.optional(M.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.optional(M.array(M.object({fn:M.string(),withArgs:M.optional(M.array(M.object({atIndex:M.number(),value:M.union([M.string(),M.number(),M.boolean()])}))),message:M.string(),replaceWith:M.optional(M.string()),ignoreRegex:M.optional(M.string())}))),__dev_simulateFileName:M.optional(M.string()),mustMatchSyntax:M.optional(M.array(M.object({includeRegex:M.string(),mustCallFn:M.optional(M.array(M.object({anyCall:M.array(M.object({fn:M.string(),withArgs:M.array(M.object({atIndex:M.number(),literal:M.union([M.string(),M.number(),M.boolean()])}))})),message:M.optional(M.string())}))),mustMatchSelector:M.optional(M.array(M.object({selector:M.string(),message:M.string()}))),mustHaveExport:M.optional(M.array(M.object({name:M.string(),type:M.enum(["function","variable","any"]).default("any"),message:M.string()})))})))}),Tt=q({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[B(ri)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[n]){let r={},{mustMatchSyntax:t,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=n,p=s??e.filename,a=[],l=new Map,u=new Set,d=new Map,g=new Set,x=new Map;function y(h){for(let w of h.specifiers)w.type===he.ImportSpecifier&&w.imported.type===he.Identifier&&w.imported.name!==w.local.name&&x.set(w.local.name,w.imported.name)}function E(h){if(h.declaration){if(h.declaration.type===he.FunctionDeclaration&&h.declaration.id){let w=h.declaration.id.name;for(let P of Array.from(g)){let[v,c]=P.split(":");v===w&&(c==="function"||c==="any")&&g.delete(P)}}else if(h.declaration.type===he.VariableDeclaration){for(let w of h.declaration.declarations)if(w.id.type===he.Identifier){let P=w.id.name;for(let v of Array.from(g)){let[c,F]=v.split(":");c===P&&(F==="variable"||F==="any")&&g.delete(v)}}}}for(let w of h.specifiers)if(w.exported.type===he.Identifier){let P=w.exported.name;for(let v of Array.from(g)){let[c,F]=v.split(":");c===P&&F==="any"&&g.delete(v)}}}function b(h){h.id.type===he.Identifier&&h.init?.type===he.Identifier&&x.set(h.id.name,h.init.name)}function f(h){return x.get(h)??h}function A(h,w){return f(h)===w||h===w}for(let{includeRegex:h,mustCallFn:w,mustMatchSelector:P,mustHaveExport:v}of t??[]){let F=function(T){let S=T;for(let{name:R,value:O}of c??[])S=S.replaceAll(R,O);return S};var C=F;let c=ii(p,new RegExp(h));if(c){for(let{anyCall:T,message:S}of w??[]){let R=`Expected file to call the function: ${T.map(({fn:O})=>O).join(" or ")}`;u.add(R),a.push(O=>{let{callee:D}=O;if(D.type===he.Identifier){for(let{fn:Z,withArgs:G}of T)if(D.name===Z){u.delete(R);for(let V of G){let j=O.arguments[V.atIndex],Y=typeof V.literal=="string"?F(V.literal):V.literal;if(!j){e.report({node:O,messageId:"default",data:{message:`Missing argument with value "${Y}" at index ${V.atIndex}${S?`: ${F(S)}`:""}`}});continue}if(j.type!==he.Literal){e.report({node:j,messageId:"default",data:{message:`Argument at position ${V.atIndex} should the literal "${Y}"${S?`: ${F(S)}`:""}`}});continue}j.value!==Y&&e.report({node:j,messageId:"default",data:{message:`Argument should have the value "${Y}"${S?`: ${F(S)}`:""}`},fix:H=>H.replaceText(j,typeof Y=="string"?`'${Y}'`:String(Y))})}break}}})}for(let{selector:T,message:S}of P??[])d.set(T,F(S)),l.set(F(T),()=>{d.delete(T)});for(let{name:T,type:S,message:R}of v??[]){let O=F(T),D=F(R);g.add(`${O}:${S}:${D}`)}}}for(let{fn:h,withArgs:w,message:P,replaceWith:v,ignoreRegex:c}of i??[])c&&new RegExp(c).test(p)||a.push(F=>{let{callee:T}=F;if(T.type!==he.Identifier||!A(T.name,h))return;if(w)for(let R of w){let O=F.arguments[R.atIndex];if(!O){e.report({node:F,messageId:"default",data:{message:`Missing argument with value "${R.value}" at index ${R.atIndex}: ${P}`}});return}if(O.type!==he.Literal||O.value!==R.value)return}let S=R=>v?R.replaceText(F,v):null;e.report({node:F,messageId:"default",data:{message:P},suggest:v?[{messageId:"default",data:{message:`Replace with "${v}"`},fix:S}]:void 0})});function I(h,w){let P=r[h];P?r[h]=v=>{P(v),w(v)}:r[h]=w}for(let{selector:h,message:w,replace:P,replaceType:v="suggestion"}of o??[]){if(h==="CallExpression"){a.push(c=>{m(P,c,w,v)});continue}r[h]=c=>{m(P,c,w,v)}}if(l.size>0)for(let[h,w]of l)I(h,w);return a.length>0&&(r.CallExpression=h=>{if(h.type===he.CallExpression)for(let w of a)w(h)}),r.ImportDeclaration=h=>{h.type===he.ImportDeclaration&&y(h)},r.ExportNamedDeclaration=h=>{h.type===he.ExportNamedDeclaration&&E(h)},r.VariableDeclarator=h=>{h.type===he.VariableDeclarator&&b(h)},r["Program:exit"]=h=>{for(let w of u)e.report({node:h,messageId:"default",data:{message:w}});for(let[,w]of d)e.report({node:h,messageId:"default",data:{message:w}});for(let w of g){let[P,v,c]=w.split(":");e.report({node:h,messageId:"default",data:{message:`Missing required export "${P}" of type ${v}: ${c}`}})}},r;function m(h,w,P,v){let c=F=>{if(!h)return null;if(typeof h=="string")return F.replaceText(w,h);{let T=new RegExp(h.regex),S=e.sourceCode.getText(w);return F.replaceText(w,S.replace(T,h.with))}};e.report({node:w,messageId:"default",data:{message:P},fix:h&&v==="autofix"?c:void 0,suggest:h&&v==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof h=="string"?h:h.with}"`},fix:c}]:void 0})}}});function ii(e,n){let r=[],t=n.exec(e);if(!t)return null;let[s,...o]=t;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:vn(s)}),r.push({name:"$0_uncapitalize",value:On(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,a=o[i];a!==void 0&&(r.push({name:`${p}_lowercase`,value:a.toLowerCase()}),r.push({name:`${p}_capitalize`,value:vn(a)}),r.push({name:`${p}_uncapitalize`,value:On(a)}),r.push({name:p,value:a}))}return r}function vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function On(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as se,AST_TOKEN_TYPES as Nn,ESLintUtils as si}from"@typescript-eslint/utils";import{z as Ve}from"zod/v4";var oi=si.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="collapse-simple-objs-in-one-line",ai=Ve.object({maxLineLength:Ve.number().optional(),maxProperties:Ve.number().optional(),nestedObjMaxLineLength:Ve.number().optional(),nestedObjMaxProperties:Ve.number().optional(),ignoreTypesWithSuffix:Ve.array(Ve.string()).optional()}),li=oi({name:jn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[B(ai)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.ignoreTypesWithSuffix??[],s=n.maxProperties??2,o=n.nestedObjMaxLineLength??n.maxLineLength,i=n.nestedObjMaxProperties??3;function p(l){if(l.type===se.ObjectExpression){let u=l.parent.type===se.Property,d=u?i:s,g=l.properties.length;if(g>d)return!1;if(g===1){let y=l.properties[0];return!y||y.type===se.Property&&y.value.type===se.ObjectExpression||y.type===se.Property&&y.value.type===se.ArrayExpression&&!y.value.elements.every(b=>b&&ht(b))?!1:{text:r.getText(y),isNested:u,propsSize:g}}let x=[];for(let y of l.properties){if(y.type===se.Property&&!ht(y.value))return!1;x.push(r.getText(y))}return{text:x.join(", "),isNested:u,propsSize:g}}else{let u=l.parent.parent?.type===se.TSPropertySignature,d=u?i:s,g=l.members.length;if(g>d)return!1;if(t.length>0&&l.parent.type===se.TSTypeAliasDeclaration){let y=l.parent.id.name;if(t.some(E=>y.endsWith(E)))return!1}if(g===1){let y=l.members[0];return!y||y.type===se.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===se.TSTypeLiteral?!1:{text:r.getText(y),isNested:u,propsSize:1}}if(l.parent.type===se.TSIntersectionType||l.parent.type===se.TSUnionType&&l.parent.types[0]!==l)return!1;let x=[];for(let y of l.members){if(y.type!==se.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===se.TSTypeLiteral||!Dn(E))return!1;if(E.type===se.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let f=E.typeArguments.params[0];if(!f||!Dn(f))return!1}let b=r.getText(y).trim();(b.endsWith(";")||b.endsWith(","))&&(b=b.slice(0,-1)),x.push(b)}return{text:x.join("; "),isNested:u,propsSize:g}}}function a(l){if(l.loc.start.line===l.loc.end.line)return;if(l.parent.type!==se.JSXExpressionContainer){let E=0,b=!1,f=r.getTokenAfter(l,{filter:I=>I.type!==Nn.Punctuator||b?!0:I.value===","?(E++,!1):I.value===";"?(E++,b=!0,!1):I.value===")"||I.value==="}"?(E++,!1):!0});if(E>4)return;let A=f?.type===Nn.Template&&f.value.startsWith(`}
2
- `);if(f?.loc.start.line===l.loc.end.line&&!A)return}let u=p(l);if(!u)return;let d=u.text;if(d.includes(`
3
- `)||r.getCommentsInside(l).length>0)return;d.endsWith(";")&&(d=d.slice(0,-1));let g=`{ ${d} }`,x=ci(r,l),y=u.isNested&&u.propsSize>2?o:n.maxLineLength;y&&g.length+x.length+pi(l,r)>y||e.report({node:l,messageId:"singleLineProp",fix:E=>E.replaceText(l,g)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function Dn(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 ht(e,n){return!!(e.type===se.Literal||e.type===se.Identifier||e.type===se.TemplateLiteral||e.type===se.TaggedTemplateExpression||!n&&e.type===se.ArrayExpression&&e.elements.every(r=>r&&ht(r,!0)))}function pi(e,n){let r=n.getLastToken(e);if(!r)return 0;let t=n.text.indexOf(`
4
- `,r.range[1]);return(t!==-1?t:n.text.length)-r.range[1]}function ci(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var Et={name:jn,rule:li};var ui=/eslint +react-compiler\/react-compiler: +\["error/,Mn={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"}}}]},create(e){let n=!1,r=typeof e.getSource=="function"?f=>r(f):f=>e.sourceCode.getText(f),t=typeof e.getScope=="function"?()=>t():f=>e.sourceCode.getScope(f),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,o=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:o};function p(f){o&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let a=e.getSourceCode().scopeManager,l=new WeakMap,u=new WeakSet,d=new WeakMap,g=new WeakMap,x=new WeakSet;function y(f,A){return function(I){if(A.has(I))return A.get(I);let m=f(I);return A.set(I,m),m}}function E(f,A,I,m,C){C&&f.async&&p({node:f,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
1
+ import{AST_NODE_TYPES as he}from"@typescript-eslint/utils";import{z as M}from"zod/v4";import{ESLintUtils as ri}from"@typescript-eslint/utils";import*as Pn from"zod/v4";function q(e){let r=ri.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:r}}function B(e){return Pn.toJSONSchema(e)}var ii=M.object({disallow:M.array(M.object({selector:M.string(),message:M.string(),replace:M.optional(M.union([M.string(),M.object({regex:M.string(),with:M.string()})])),replaceType:M.optional(M.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.optional(M.array(M.object({fn:M.string(),withArgs:M.optional(M.array(M.object({atIndex:M.number(),value:M.union([M.string(),M.number(),M.boolean()])}))),message:M.string(),replaceWith:M.optional(M.string()),ignoreRegex:M.optional(M.string())}))),__dev_simulateFileName:M.optional(M.string()),mustMatchSyntax:M.optional(M.array(M.object({includeRegex:M.string(),mustCallFn:M.optional(M.array(M.object({anyCall:M.array(M.object({fn:M.string(),withArgs:M.array(M.object({atIndex:M.number(),literal:M.union([M.string(),M.number(),M.boolean()])}))})),message:M.optional(M.string())}))),mustMatchSelector:M.optional(M.array(M.object({selector:M.string(),message:M.string()}))),mustHaveExport:M.optional(M.array(M.object({name:M.string(),type:M.enum(["function","variable","any"]).default("any"),message:M.string()})))})))}),Et=q({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[B(ii)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[n]){let r={},{mustMatchSyntax:t,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=n,p=s??e.filename,c=[],a=new Map,u=new Set,m=new Map,y=new Set,C=new Map;function f(b){for(let w of b.specifiers)w.type===he.ImportSpecifier&&w.imported.type===he.Identifier&&w.imported.name!==w.local.name&&C.set(w.local.name,w.imported.name)}function E(b){if(b.declaration){if(b.declaration.type===he.FunctionDeclaration&&b.declaration.id){let w=b.declaration.id.name;for(let P of Array.from(y)){let[N,l]=P.split(":");N===w&&(l==="function"||l==="any")&&y.delete(P)}}else if(b.declaration.type===he.VariableDeclaration){for(let w of b.declaration.declarations)if(w.id.type===he.Identifier){let P=w.id.name;for(let N of Array.from(y)){let[l,R]=N.split(":");l===P&&(R==="variable"||R==="any")&&y.delete(N)}}}}for(let w of b.specifiers)if(w.exported.type===he.Identifier){let P=w.exported.name;for(let N of Array.from(y)){let[l,R]=N.split(":");l===P&&R==="any"&&y.delete(N)}}}function x(b){b.id.type===he.Identifier&&b.init?.type===he.Identifier&&C.set(b.id.name,b.init.name)}function S(b){return C.get(b)??b}function I(b,w){return S(b)===w||b===w}for(let{includeRegex:b,mustCallFn:w,mustMatchSelector:P,mustHaveExport:N}of t??[]){let R=function(d){let g=d;for(let{name:F,value:v}of l??[])g=g.replaceAll(F,v);return g};var h=R;let l=si(p,new RegExp(b));if(l){for(let{anyCall:d,message:g}of w??[]){let F=`Expected file to call the function: ${d.map(({fn:v})=>v).join(" or ")}`;u.add(F),c.push(v=>{let{callee:j}=v;if(j.type===he.Identifier){for(let{fn:J,withArgs:G}of d)if(j.name===J){u.delete(F);for(let H of G){let D=v.arguments[H.atIndex],Z=typeof H.literal=="string"?R(H.literal):H.literal;if(!D){e.report({node:v,messageId:"default",data:{message:`Missing argument with value "${Z}" at index ${H.atIndex}${g?`: ${R(g)}`:""}`}});continue}if(D.type!==he.Literal){e.report({node:D,messageId:"default",data:{message:`Argument at position ${H.atIndex} should the literal "${Z}"${g?`: ${R(g)}`:""}`}});continue}D.value!==Z&&e.report({node:D,messageId:"default",data:{message:`Argument should have the value "${Z}"${g?`: ${R(g)}`:""}`},fix:Y=>Y.replaceText(D,typeof Z=="string"?`'${Z}'`:String(Z))})}break}}})}for(let{selector:d,message:g}of P??[])m.set(d,R(g)),a.set(R(d),()=>{m.delete(d)});for(let{name:d,type:g,message:F}of N??[]){let v=R(d),j=R(F);y.add(`${v}:${g}:${j}`)}}}for(let{fn:b,withArgs:w,message:P,replaceWith:N,ignoreRegex:l}of i??[])l&&new RegExp(l).test(p)||c.push(R=>{let{callee:d}=R;if(d.type!==he.Identifier||!I(d.name,b))return;if(w)for(let F of w){let v=R.arguments[F.atIndex];if(!v){e.report({node:R,messageId:"default",data:{message:`Missing argument with value "${F.value}" at index ${F.atIndex}: ${P}`}});return}if(v.type!==he.Literal||v.value!==F.value)return}let g=F=>N?F.replaceText(R,N):null;e.report({node:R,messageId:"default",data:{message:P},suggest:N?[{messageId:"default",data:{message:`Replace with "${N}"`},fix:g}]:void 0})});function A(b,w){let P=r[b];P?r[b]=N=>{P(N),w(N)}:r[b]=w}for(let{selector:b,message:w,replace:P,replaceType:N="suggestion"}of o??[]){if(b==="CallExpression"){c.push(l=>{T(P,l,w,N)});continue}r[b]=l=>{T(P,l,w,N)}}if(a.size>0)for(let[b,w]of a)A(b,w);return c.length>0&&(r.CallExpression=b=>{if(b.type===he.CallExpression)for(let w of c)w(b)}),r.ImportDeclaration=b=>{b.type===he.ImportDeclaration&&f(b)},r.ExportNamedDeclaration=b=>{b.type===he.ExportNamedDeclaration&&E(b)},r.VariableDeclarator=b=>{b.type===he.VariableDeclarator&&x(b)},r["Program:exit"]=b=>{for(let w of u)e.report({node:b,messageId:"default",data:{message:w}});for(let[,w]of m)e.report({node:b,messageId:"default",data:{message:w}});for(let w of y){let[P,N,l]=w.split(":");e.report({node:b,messageId:"default",data:{message:`Missing required export "${P}" of type ${N}: ${l}`}})}},r;function T(b,w,P,N){let l=R=>{if(!b)return null;if(typeof b=="string")return R.replaceText(w,b);{let d=new RegExp(b.regex),g=e.sourceCode.getText(w);return R.replaceText(w,g.replace(d,b.with))}};e.report({node:w,messageId:"default",data:{message:P},fix:b&&N==="autofix"?l:void 0,suggest:b&&N==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof b=="string"?b:b.with}"`},fix:l}]:void 0})}}});function si(e,n){let r=[],t=n.exec(e);if(!t)return null;let[s,...o]=t;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:vn(s)}),r.push({name:"$0_uncapitalize",value:On(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,c=o[i];c!==void 0&&(r.push({name:`${p}_lowercase`,value:c.toLowerCase()}),r.push({name:`${p}_capitalize`,value:vn(c)}),r.push({name:`${p}_uncapitalize`,value:On(c)}),r.push({name:p,value:c}))}return r}function vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function On(e){return e.charAt(0).toLowerCase()+e.slice(1)}import{AST_NODE_TYPES as se,AST_TOKEN_TYPES as Nn,ESLintUtils as oi}from"@typescript-eslint/utils";import{z as Je}from"zod/v4";var ai=oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="collapse-simple-objs-in-one-line",li=Je.object({maxLineLength:Je.number().optional(),maxProperties:Je.number().optional(),nestedObjMaxLineLength:Je.number().optional(),nestedObjMaxProperties:Je.number().optional(),ignoreTypesWithSuffix:Je.array(Je.string()).optional()}),pi=ai({name:jn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[B(li)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.ignoreTypesWithSuffix??[],s=n.maxProperties??2,o=n.nestedObjMaxLineLength??n.maxLineLength,i=n.nestedObjMaxProperties??3;function p(a){if(a.type===se.ObjectExpression){let u=a.parent.type===se.Property,m=u?i:s,y=a.properties.length;if(y>m)return!1;if(y===1){let f=a.properties[0];return!f||f.type===se.Property&&f.value.type===se.ObjectExpression||f.type===se.Property&&f.value.type===se.ArrayExpression&&!f.value.elements.every(x=>x&&bt(x))?!1:{text:r.getText(f),isNested:u,propsSize:y}}let C=[];for(let f of a.properties){if(f.type===se.Property&&!bt(f.value))return!1;C.push(r.getText(f))}return{text:C.join(", "),isNested:u,propsSize:y}}else{let u=a.parent.parent?.type===se.TSPropertySignature,m=u?i:s,y=a.members.length;if(y>m)return!1;if(t.length>0&&a.parent.type===se.TSTypeAliasDeclaration){let f=a.parent.id.name;if(t.some(E=>f.endsWith(E)))return!1}if(y===1){let f=a.members[0];return!f||f.type===se.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===se.TSTypeLiteral?!1:{text:r.getText(f),isNested:u,propsSize:1}}if(a.parent.type===se.TSIntersectionType||a.parent.type===se.TSUnionType&&a.parent.types[0]!==a)return!1;let C=[];for(let f of a.members){if(f.type!==se.TSPropertySignature)return!1;let E=f.typeAnnotation?.typeAnnotation;if(!E||E.type===se.TSTypeLiteral||!Dn(E))return!1;if(E.type===se.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let S=E.typeArguments.params[0];if(!S||!Dn(S))return!1}let x=r.getText(f).trim();(x.endsWith(";")||x.endsWith(","))&&(x=x.slice(0,-1)),C.push(x)}return{text:C.join("; "),isNested:u,propsSize:y}}}function c(a){if(a.loc.start.line===a.loc.end.line)return;if(a.parent.type!==se.JSXExpressionContainer){let E=0,x=!1,S=r.getTokenAfter(a,{filter:A=>A.type!==Nn.Punctuator||x?!0:A.value===","?(E++,!1):A.value===";"?(E++,x=!0,!1):A.value===")"||A.value==="}"?(E++,!1):!0});if(E>4)return;let I=S?.type===Nn.Template&&S.value.startsWith(`}
2
+ `);if(S?.loc.start.line===a.loc.end.line&&!I)return}let u=p(a);if(!u)return;let m=u.text;if(m.includes(`
3
+ `)||r.getCommentsInside(a).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let y=`{ ${m} }`,C=ui(r,a),f=u.isNested&&u.propsSize>2?o:n.maxLineLength;f&&y.length+C.length+ci(a,r)>f||e.report({node:a,messageId:"singleLineProp",fix:E=>E.replaceText(a,y)})}return{TSTypeLiteral:c,ObjectExpression:c}}});function Dn(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 bt(e,n){return!!(e.type===se.Literal||e.type===se.Identifier||e.type===se.TemplateLiteral||e.type===se.TaggedTemplateExpression||!n&&e.type===se.ArrayExpression&&e.elements.every(r=>r&&bt(r,!0)))}function ci(e,n){let r=n.getLastToken(e);if(!r)return 0;let t=n.text.indexOf(`
4
+ `,r.range[1]);return(t!==-1?t:n.text.length)-r.range[1]}function ui(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var xt={name:jn,rule:pi};var fi=/eslint +react-compiler\/react-compiler: +\["error/,Mn={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"}}}]},create(e){let n=!1,r=typeof e.getSource=="function"?I=>r(I):I=>e.sourceCode.getText(I),t=typeof e.getScope=="function"?()=>t():I=>e.sourceCode.getScope(I),s=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,o=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:s,enableDangerousAutofixThisMayCauseInfiniteLoops:o};function p(I){o&&Array.isArray(I.suggest)&&I.suggest.length>0&&(I.fix=I.suggest[0].fix),e.report(I)}let c=e.getSourceCode().scopeManager,a=new WeakMap,u=new WeakSet,m=new WeakMap,y=new WeakMap,C=new WeakSet;function f(I,A){return function(T){if(A.has(T))return A.get(T);let h=I(T);return A.set(T,h),h}}function E(I,A,T,h,b){b&&I.async&&p({node:I,message:`Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
5
5
 
6
6
  useEffect(() => {
7
7
  async function fetchData() {
@@ -12,44 +12,44 @@ useEffect(() => {
12
12
  fetchData();
13
13
  }, [someId]); // Or [] if effect doesn't need props or state
14
14
 
15
- Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let h=a.acquire(f),w=new Set,P=null;{let k=h.upper;for(;k&&(w.add(k),k.type!=="function");)k=k.upper;if(!k)return;P=k}let v=Array.isArray;function c(k){if(!v(k.defs))return!1;let N=k.defs[0];if(N==null||N.node.type!=="VariableDeclarator")return!1;let $=N.node.init;if($==null)return!1;for(;$.type==="TSAsExpression";)$=$.expression;let U=N.node.parent;if(U==null&&(Ct(P.block,N.node.id),U=N.node.parent,U==null))return!1;if(U.kind==="const"&&$.type==="Literal"&&(typeof $.value=="string"||typeof $.value=="number"||$.value===null))return!0;if($.type!=="CallExpression")return!1;let X=$.callee;if(X.type==="MemberExpression"&&X.object.name==="React"&&X.property!=null&&!X.computed&&(X=X.property),X.type!=="Identifier")return!1;let W=N.node.id,{name:K}=X;if(K==="useRef"&&W.type==="Identifier")return!0;if(gi(X)&&W.type==="Identifier"){for(let ee of k.references)ee!==W&&x.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&v(k.identifiers)){if(W.elements[1]===k.identifiers[0]){if(K==="useState"){let ee=k.references,we=0;for(let Le=0;Le<ee.length;Le++){if(ee[Le].isWrite()&&we++,we>1)return!1;l.set(ee[Le].identifier,W.elements[0])}}return!0}else if(W.elements[0]===k.identifiers[0]){if(K==="useState"){let ee=k.references;for(let we=0;we<ee.length;we++)u.add(ee[we].identifier)}return!1}}}else if(K==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(k.identifiers)&&W.elements[1]===k.identifiers[0])return!0;return!1}function F(k){if(!v(k.defs))return!1;let N=k.defs[0];if(N==null||N.node==null||N.node.id==null)return!1;let $=N.node,U=P.childScopes,X=null,W;for(W=0;W<U.length;W++){let K=U[W],ee=K.block;if($.type==="FunctionDeclaration"&&ee===$||$.type==="VariableDeclarator"&&ee.parent===$){X=K;break}}if(X==null)return!1;for(W=0;W<X.through.length;W++){let K=X.through[W];if(K.resolved!=null&&w.has(K.resolved.scope)&&!T(K.resolved))return!1}return!0}let T=y(c,d),S=y(F,g),R=new Map;function O(k){let N=k.from,$=!1;for(;N.block!==f;)N.type==="function"&&($=N.block.parent!=null&&N.block.parent.type==="ReturnStatement"),N=N.upper;return $}let D=new Map,Z=new Map;G(h);function G(k){for(let N of k.references){if(!N.resolved||!w.has(N.resolved.scope))continue;let $=Ct(f,N.identifier),U=$n($),X=Me(U,Z);if(C&&U.type==="Identifier"&&(U.parent.type==="MemberExpression"||U.parent.type==="OptionalMemberExpression")&&!U.parent.computed&&U.parent.property.type==="Identifier"&&U.parent.property.name==="current"&&O(N)&&R.set(X,{reference:N,dependencyNode:U}),U.parent.type==="TSTypeQuery"||U.parent.type==="TSTypeReference")continue;let W=N.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===f.parent)&&W.type!=="TypeParameter")if(D.has(X))D.get(X).references.push(N);else{let K=N.resolved,ee=T(K)||S(K);D.set(X,{isStable:ee,references:[N]})}}for(let N of k.childScopes)G(N)}R.forEach(({reference:k,dependencyNode:N},$)=>{let U=k.resolved.references,X=!1;for(let W=0;W<U.length;W++){let{identifier:K}=U[W],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){X=!0;break}}X||p({node:N.parent.property,message:`The ref value '${$}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${$}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let V=new Set;function j(k,N){V.has(N)||(V.add(N),p({node:k,message:`Assignments to the '${N}' variable from inside React Hook ${r(I)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(I)}.`}))}let Y=new Set;if(D.forEach(({isStable:k,references:N},$)=>{k&&Y.add($),N.forEach(U=>{U.writeExpr&&j(U.writeExpr,$)})}),V.size>0)return;if(!A){let k=null;if(D.forEach(({isStable:N,references:$},U)=>{k||$.forEach(X=>{if(k)return;let W=X.identifier;if(!l.has(W))return;let ee=X.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===f&&(k=U)})}),k){let{suggestedDependencies:N}=bt({dependencies:D,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});p({node:I,message:`React Hook ${m} contains a call to '${k}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+N.join(", ")+`] as a second argument to the ${m} Hook.`,suggest:[{desc:`Add dependencies array: [${N.join(", ")}]`,fix($){return $.insertTextAfter(f,`, [${N.join(", ")}]`)}}]})}return}let H=[],ce=new Set;A.type!=="ArrayExpression"?p({node:A,message:`React Hook ${r(I)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(k=>{if(k===null)return;if(k.type==="SpreadElement"){p({node:k,message:`React Hook ${r(I)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}x.has(k)&&p({node:k,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(k)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(k)}\``,fix(X){return X.removeRange(k.range)}}]});let N;try{N=Me(k,Z)}catch(X){if(/Unsupported node type/.test(X.message)){k.type==="Literal"?D.has(k.value)?p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. Did you mean to include ${k.value} in the array instead?`}):p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:k,message:`React Hook ${r(I)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw X}let $=k;for(;$.type==="MemberExpression"||$.type==="OptionalMemberExpression"||$.type==="ChainExpression";)$=$.object||$.expression.object;let U=!P.through.some(X=>X.identifier===$);H.push({key:N,node:k}),U||ce.add(N)});let{suggestedDependencies:de,unnecessaryDependencies:Ee,missingDependencies:Ie,duplicateDependencies:Ae}=bt({dependencies:D,declaredDependencies:H,stableDependencies:Y,externalDependencies:ce,isEffect:C}),Je=de;if(Ae.size+Ie.size+Ee.size===0){if(n)return;fi({declaredDependencies:H,declaredDependenciesNode:A,componentScope:P,scope:h}).forEach(({construction:N,isUsedOutsideOfHook:$,depType:U})=>{let X=U==="function"?"useCallback":"useMemo",W=U==="function"?"definition":"initialization",K=`wrap the ${W} of '${N.name.name}' in its own ${X}() Hook.`,ee=$?`To fix this, ${K}`:`Move it inside the ${m} callback. Alternatively, ${K}`,we=U==="conditional"||U==="logical expression"?"could make":"makes",Le=`The '${N.name.name}' ${U} ${we} the dependencies of ${m} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Fn;$&&N.type==="Variable"&&U==="function"&&(Fn=[{desc:`Wrap the ${W} of '${N.name.name}' in its own ${X}() Hook.`,fix(kn){let[ei,ti]=X==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[kn.insertTextBefore(N.node.init,ei),kn.insertTextAfter(N.node.init,ti)]}}]),p({node:N.node,message:Le,suggest:Fn})});return}!C&&Ie.size>0&&(Je=bt({dependencies:D,declaredDependencies:[],stableDependencies:Y,externalDependencies:ce,isEffect:C}).suggestedDependencies);function Rn(){if(H.length===0)return!0;let k=H.map($=>$.key),N=k.slice().sort();return k.join(",")===N.join(",")}Rn()&&Je.sort();function ge(k){let N=k.split("."),$="";for(let U=0;U<N.length;U++){if(U!==0){let X=N.slice(0,U+1).join("."),W=Z.get(X)===!0;$+=W?"?.":"."}$+=N[U]}return $}function xe(k,N,$,U){return k.size===0?null:(k.size>1?"":N+" ")+$+" "+(k.size>1?"dependencies":"dependency")+": "+yi(Array.from(k).sort().map(X=>"'"+ge(X)+"'"))+`. Either ${U} ${k.size>1?"them":"it"} or remove the dependency array.`}let Pe="";if(Ee.size>0){let k=null;if(Array.from(Ee.keys()).forEach(N=>{k===null&&N.endsWith(".current")&&(k=N)}),k!==null)Pe=` Mutable values like '${k}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ce.size>0){let N=Array.from(ce)[0];h.set.has(N)||(Pe=` Outer scope values like '${N}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Pe&&Ie.has("props")){let k=D.get("props");if(k==null)return;let N=k.references;if(!Array.isArray(N))return;let $=!0;for(let U=0;U<N.length;U++){let X=N[U],W=Ct(P.block,X.identifier);if(!W){$=!1;break}let K=W.parent;if(K==null){$=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){$=!1;break}}$&&(Pe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${m} call and refer to those specific props inside ${r(I)}.`)}if(!Pe&&Ie.size>0){let k=null;Ie.forEach(N=>{if(k)return;let $=P.set.get(N),U=D.get(N);if(U.references[0].resolved!==$)return;let X=$.defs[0];if(X==null||X.name==null||X.type!=="Parameter")return;let W=!1,K;for(let ee=0;ee<U.references.length;ee++)if(K=U.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){W=!0;break}W&&(k=N)}),k!==null&&(Pe=` If '${k}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Pe&&Ie.size>0){let k=null;if(Ie.forEach(N=>{if(k!==null)return;let U=D.get(N).references,X,W;for(let K=0;K<U.length;K++){for(X=U[K].identifier,W=X.parent;W!=null&&W!==P.block;){if(W.type==="CallExpression"){let ee=l.get(W.callee);if(ee!=null){if(ee.name===N)k={missingDep:N,setter:W.callee.name,form:"updater"};else if(u.has(X))k={missingDep:N,setter:W.callee.name,form:"reducer"};else{let we=U[K].resolved;if(we!=null){let Le=we.defs[0];Le!=null&&Le.type==="Parameter"&&(k={missingDep:N,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(k!==null)break}}),k!==null)switch(k.form){case"reducer":Pe=` You can also replace multiple useState variables with useReducer if '${k.setter}' needs the current value of '${k.missingDep}'.`;break;case"inlineReducer":Pe=` If '${k.setter}' needs the current value of '${k.missingDep}', you can also switch to useReducer instead of useState and read '${k.missingDep}' in the reducer.`;break;case"updater":Pe=` You can also do a functional update '${k.setter}(${k.missingDep.slice(0,1)} => ...)' if you only need '${k.missingDep}' in the '${k.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:A,message:`React Hook ${r(I)} has `+(xe(Ie,"a","missing","include")||xe(Ee,"an","unnecessary","exclude")||xe(Ae,"a","duplicate","omit"))+Pe,suggest:[{desc:`Update the dependencies array to be: [${Je.map(ge).join(", ")}]`,fix(k){return k.replaceText(A,`[${Je.map(ge).join(", ")}]`)}}]})}function b(f){let A=mi(f.callee,i);if(A===-1)return;let I=f.arguments[A],m=f.callee,C=_n(m).name,h=f.arguments[A+1],w=/Effect($|[^a-z])/g.test(C);if(!I){p({node:m,message:`React Hook ${C} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!w)){if(!h&&!w){(C==="useMemo"||C==="useCallback")&&p({node:m,message:`React Hook ${C} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(I.type){case"FunctionExpression":case"ArrowFunctionExpression":E(I,h,m,C,w);return;case"Identifier":if(!h||h.elements&&h.elements.some(c=>c&&c.type==="Identifier"&&c.name===I.name))return;let P=t(f).set.get(I.name);if(P==null||P.defs==null)return;let v=P.defs[0];if(!v||!v.node||v.type!=="Variable"&&v.type!=="FunctionName")break;switch(v.node.type){case"FunctionDeclaration":E(v.node,h,m,C,w);return;case"VariableDeclarator":let c=v.node.init;if(!c)break;switch(c.type){case"ArrowFunctionExpression":case"FunctionExpression":E(c,h,m,C,w);return}break}break;default:p({node:m,message:`React Hook ${C} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:m,message:`React Hook ${C} has a missing dependency: '${I.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${I.name}]`,fix(P){return P.replaceText(h,`[${I.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(ui.test(f.value))return n=!0,{CallExpression:A=>b(A,!0)}}return{CallExpression:f=>b(f)}}};function bt({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,b)=>{let f=p(o,b);f.isUsed=!0,a(o,b,A=>{A.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let b=p(o,E);b.isSatisfiedRecursively=!0}),r.forEach(E=>{let b=p(o,E);b.isSatisfiedRecursively=!0});function p(E,b){let f=b.split("."),A=E;for(let I of f){let m=A.children.get(I);m||(m=i(),A.children.set(I,m)),A=m}return A}function a(E,b,f){let A=b.split("."),I=E;for(let m of A){let C=I.children.get(m);if(!C)return;f(C),I=C}}let l=new Set,u=new Set;d(o,l,u,E=>E);function d(E,b,f,A){E.children.forEach((I,m)=>{let C=A(m);if(I.isSatisfiedRecursively){I.isSubtreeUsed&&f.add(C);return}if(I.isUsed){b.add(C);return}d(I,b,f,h=>C+"."+h)})}let g=[],x=new Set,y=new Set;return n.forEach(({key:E})=>{u.has(E)?g.indexOf(E)===-1?g.push(E):y.add(E):x.add(E)}),l.forEach(E=>{g.push(E)}),{suggestedDependencies:g,unnecessaryDependencies:x,duplicateDependencies:y,missingDependencies:l}}function Ue(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return Ue(e.consequent)!=null||Ue(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ue(e.left)!=null||Ue(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ue(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ue(e.expression);case"TSAsExpression":return Ue(e.expression)}return null}function fi({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let s=e.map(({key:i})=>{let p=r.variables.find(l=>l.name===i);if(p==null)return null;let a=p.defs[0];if(a==null)return null;if(a.type==="Variable"&&a.node.type==="VariableDeclarator"&&a.node.id.type==="Identifier"&&a.node.init!=null){let l=Ue(a.node.init);if(l!=null)return[p,l]}return a.type==="FunctionName"&&a.node.type==="FunctionDeclaration"?[p,"function"]:a.type==="ClassName"&&a.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let a=0;a<i.references.length;a++){let l=i.references[a];if(l.writeExpr){if(p)return!0;p=!0;continue}let u=l.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!Un(n,l.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function $n(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?$n(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function xt(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Me(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Me(e.object,n),t=Me(e.property,null),s=`${r}.${t}`;return xt(e,n,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Me(e.object,n),t=Me(e.property,null),s=`${r}.${t}`;return xt(e,n,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Me(r.object,n),s=Me(r.property,null),o=`${t}.${s}`;return xt(r,n,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function _n(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function mi(e,n){let r=_n(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Me(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return n.additionalHooks.test(t)?0:-1}else return-1}}function Ct(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),di(t,n))return t;if(Un(t,n))for(let[s,o]of Object.entries(t))s!=="parent"&&(Ln(o)?(o.parent=t,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Ln(i)&&(i.parent=t,r.push(i))}))}return null}function yi(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function Ln(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function di(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function Un(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function gi(e){return!1}import{AST_NODE_TYPES as pe,ESLintUtils as Hn}from"@typescript-eslint/utils";import J from"typescript";import{z as Vn}from"zod/v4";import{AST_NODE_TYPES as zn}from"@typescript-eslint/utils";function He(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:He(e.parent,n,r===1/0?r:r-1)}function*It(e){yield e,e.parent&&(yield*It(e.parent))}function At(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function Jn(e,n,r){let s=r.getDeclaredVariables(e).find(o=>o.name===n||o.identifiers[0]?.parent.type===zn.Property&&o.identifiers[0].parent.key.type===zn.Identifier&&o.identifiers[0].parent.key.name===n);return s?s.references.filter(o=>!o.init):[]}function Wn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Si(e,n){return e[n]}function ve(e,n,r){let t=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),n(i)===!0)return!0;let a=t[i.type];if(a)for(let l of a){let u=Si(i,l);if(u){if(Array.isArray(u)){for(let d of u)if(Wn(d)&&o(d))return!0}else if(Wn(u)&&o(u))return!0}}return!1}o(e)}var Ti=Hn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xn="improved-no-unnecessary-condition",hi=Vn.object({alternativeForInCondition:Vn.string().optional().describe("Alternative to appear in the error for `in` condition")}),Bn={object:"Array",property:"isArray"},Ei=["string","number","bigint","boolean","symbol","undefined","object","function","never"],bi=new Set(Ei),wt={name:Xn,rule:Ti({name:Xn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[B(hi)]},defaultOptions:[{}],create(e,[n]){let r=Hn.getParserServices(e,!0),t=r.program?.getTypeChecker();if(!t||!r.program)throw new Error("TypeScript services or program not available");function s(c){return c.type===pe.UnaryExpression&&c.operator==="typeof"}function o(c){return c.flags&J.TypeFlags.Any||c.flags&J.TypeFlags.Unknown?null:c.flags&J.TypeFlags.StringLike?["string"]:c.flags&J.TypeFlags.NumberLike?["number"]:c.flags&J.TypeFlags.BigIntLike?["bigint"]:c.flags&J.TypeFlags.BooleanLike?["boolean"]:c.flags&J.TypeFlags.ESSymbolLike?["symbol"]:c.flags&J.TypeFlags.Undefined||c.flags&J.TypeFlags.Void?["undefined"]:c.flags&J.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&J.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&J.TypeFlags.NonPrimitive?["object"]:c.flags&J.TypeFlags.Never?["never"]:null}function i(c){if(!t)return null;let F=r.esTreeNodeToTSNodeMap.get(c),T=t.getTypeAtLocation(F.expression);if(T.flags&J.TypeFlags.Any||T.flags&J.TypeFlags.Unknown)return null;let S=[];if(T.isUnion()){for(let O of T.types){let D=o(O);if(D)S.push(...D);else return null}return S}let R=o(T);return R?(S.push(...R),S):null}function p(c){if(!(c.operator==="==="||c.operator==="!=="))return;let T=null,S=null;if(s(c.left)?(T=c.left,S=c.right.type===pe.Literal&&typeof c.right.value=="string"?c.right.value:null):s(c.right)&&(T=c.right,S=c.left.type===pe.Literal&&typeof c.left.value=="string"?c.left.value:null),!T||!S||!xi(S,bi))return;let R=i(T);if(!R)return;let O=c.operator==="!==",D=R.includes(S);R.length===1?D&&!O?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ye(T,e),type:S}}):!D&&O?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ye(T,e),type:Array.from(R)[0]}}):!D&&!O?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(T,e),actualType:st(R),conditionType:S}}):D&&O&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(T,e),actualType:st(R),conditionType:S}}):!D&&!O?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(T,e),actualType:st(R),conditionType:S}}):!D&&O&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:Ye(T,e),type:st(R)}})}function a(c){if(c.flags&J.TypeFlags.Any||c.flags&J.TypeFlags.Unknown)return null;if(c.isUnion()){let F=[];for(let T of c.types)if(T.flags&J.TypeFlags.StringLiteral){let S=T.value;F.push(S)}else return null;return F}return c.flags&J.TypeFlags.StringLiteral?[c.value]:null}function l(c){if(!t)return null;let F=r.esTreeNodeToTSNodeMap.get(c),T=t.getTypeAtLocation(F),S=a(T);if(S)return S;let R=t.getSymbolAtLocation(F);if(R){let O=t.getTypeOfSymbolAtLocation(R,F),D=a(O);if(D)return D}return null}function u(c){let F=e.sourceCode.ast,T=null;return ve(F,S=>{if(S.type===pe.VariableDeclarator&&S.id.type===pe.Identifier&&S.id.name===c.name&&S.id.typeAnnotation){let R=S.id.typeAnnotation.typeAnnotation;if(R.type===pe.TSUnionType){let O=[];for(let D of R.types)if(D.type===pe.TSLiteralType&&D.literal.type===pe.Literal&&typeof D.literal.value=="string")O.push(D.literal.value);else return!0;return T=O,!0}if(R.type===pe.TSLiteralType&&R.literal.type===pe.Literal&&typeof R.literal.value=="string")return T=[R.literal.value],!0}return!1},e.sourceCode),T}function d(c){return c==="Array"||c==="ReadonlyArray"?!0:c.endsWith(".Array")||c.endsWith(".ReadonlyArray")}function g(c){if(!t)return!1;if(t.isArrayType(c)||t.isTupleType(c))return!0;let F=t.getApparentType(c);if(F!==c&&(t.isArrayType(F)||t.isTupleType(F)))return!0;if(c.aliasSymbol){let S=t.getFullyQualifiedName(c.aliasSymbol);if(d(S))return!0}let T=c.getSymbol();if(T){let S=t.getFullyQualifiedName(T);if(d(S))return!0}return!1}function x(c){if(!t)return!1;if(c.flags&J.TypeFlags.StringLike||c.flags&J.TypeFlags.NumberLike||c.flags&J.TypeFlags.BigIntLike||c.flags&J.TypeFlags.BooleanLike||c.flags&J.TypeFlags.ESSymbolLike||c.flags&J.TypeFlags.EnumLike||c.flags&J.TypeFlags.Null||c.flags&J.TypeFlags.Undefined||c.flags&J.TypeFlags.Void||c.flags&J.TypeFlags.Never)return!0;let F=c.getSymbol();if(F){let T=t.getFullyQualifiedName(F);if(T==="__function"||T==="__object"&&!g(c))return!0}return!1}function y(c){if(c.flags&J.TypeFlags.Any||c.flags&J.TypeFlags.Unknown)return"unknown";if(c.isUnion()){let F=!0,T=!0;for(let S of c.types){let R=y(S);if(R==="unknown")return"unknown";R!=="alwaysTrue"&&(F=!1),R!=="alwaysFalse"&&(T=!1)}return F?"alwaysTrue":T?"alwaysFalse":"unknown"}return g(c)?"alwaysTrue":x(c)?"alwaysFalse":"unknown"}function E(c){return!c.computed&&c.object.type===pe.Identifier&&c.object.name===Bn.object&&c.property.type===pe.Identifier&&c.property.name===Bn.property}function b(c){if(!t||c.callee.type!==pe.MemberExpression||!E(c.callee)||c.arguments.length===0)return;let[F]=c.arguments;if(!F||F.type===pe.SpreadElement)return;let T=r.esTreeNodeToTSNodeMap.get(F),S=t.getTypeAtLocation(T),R=y(S);R==="alwaysTrue"?e.report({node:c,messageId:"unnecessaryArrayIsArrayCondition"}):R==="alwaysFalse"&&e.report({node:c,messageId:"alwaysFalseArrayIsArrayCondition"})}function f(c){if(c.callee.type!==pe.MemberExpression||c.callee.property.type!==pe.Identifier||c.callee.computed)return;let F=c.callee.property.name;if(F!=="startsWith"&&F!=="endsWith"&&F!=="includes"||c.arguments.length!==1)return;let[T]=c.arguments;if(!T||T.type!==pe.Literal||typeof T.value!="string")return;let S=c.callee.object,R=l(S);if(!R&&S.type===pe.Identifier&&(R=u(S)),!R||R.length===0)return;let O=T.value;if(F==="includes"&&R.length>1)return;let D=0,Z=0;for(let G of R)if((F==="startsWith"?G.startsWith(O):F==="endsWith"?G.endsWith(O):G.includes(O))?D++:Z++,D>0&&Z>0)return;if(D>0&&Z===0){let G=F==="startsWith"?"unnecessaryStartsWithCondition":F==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:G})}else if(Z>0&&D===0){let G=F==="startsWith"?"alwaysFalseStartsWithCondition":F==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:G})}}function A(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function T(V){if(V.type!==pe.MemberExpression||V.computed||V.property.type!==pe.Identifier||V.property.name!=="length")return null;let j=V.object,Y=l(j);if(!Y||Y.length===0)return null;let H=[];for(let ce of Y)H.push(ce.length);return{values:H}}let S=T(c.left),R=T(c.right),O=null,D=null;if(S?c.right.type===pe.Literal&&typeof c.right.value=="number"&&(O=S.values,D=c.right.value):R&&c.left.type===pe.Literal&&typeof c.left.value=="number"&&(O=R.values,D=c.left.value),!O||D===null)return;let Z=0,G=0;for(let V of O){let j=!1;if(c.operator==="==="?j=V===D:c.operator==="!=="?j=V!==D:c.operator===">"?j=V>D:c.operator===">="?j=V>=D:c.operator==="<"?j=V<D:c.operator==="<="&&(j=V<=D),j?Z++:G++,Z>0&&G>0)return}Z>0&&G===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):G>0&&Z===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function I(c){if(c.type===pe.Literal&&typeof c.value=="string")return c.value;let F=l(c);if(!F||F.length!==1)return null;let[T]=F;return T??null}function m(c){return(c.flags&J.TypeFlags.Intersection)!==0}function C(c){return(c.flags&J.TypeFlags.Object)!==0}function h(c){return!t||t.getIndexTypeOfType(c,J.IndexKind.String)?!0:!!t.getIndexTypeOfType(c,J.IndexKind.Number)}function w(c,F){if(!t||h(c)||c.getProperties().length===0)return"unknown";let T=t.getPropertyOfType(c,F);return T?T.flags&J.SymbolFlags.Optional?"optional":"required":"absent"}function P(c,F){if(c.flags&J.TypeFlags.Any||c.flags&J.TypeFlags.Unknown||c.flags&J.TypeFlags.Never||c.flags&J.TypeFlags.TypeParameter||c.flags&J.TypeFlags.IndexedAccess||c.flags&J.TypeFlags.StringLike||c.flags&J.TypeFlags.NumberLike||c.flags&J.TypeFlags.BigIntLike||c.flags&J.TypeFlags.BooleanLike||c.flags&J.TypeFlags.EnumLike||c.flags&J.TypeFlags.ESSymbolLike||c.flags&J.TypeFlags.NonPrimitive||c.flags&J.TypeFlags.Null||c.flags&J.TypeFlags.Undefined||c.flags&J.TypeFlags.Void)return"unknown";if(c.isUnion()){let T=!0,S=!0;for(let R of c.types){let O=P(R,F);if(O==="unknown"||(O!=="required"&&(T=!1),O!=="absent"&&(S=!1),O==="optional"))return"unknown"}return T?"required":S?"absent":"unknown"}if(m(c)){let T=c,S=!1,R=!1;for(let O of T.types){let D=P(O,F);if(D==="unknown")return"unknown";D==="required"?S=!0:D==="optional"&&(R=!0)}return S?"required":R?"optional":"absent"}return C(c)?w(c,F):"unknown"}function v(c){if(c.operator!=="in"||c.left.type===pe.PrivateIdentifier)return;let F=I(c.left);if(!F)return;let T=c.right,S=r.esTreeNodeToTSNodeMap.get(T);if(!t)return;let R=t.getTypeAtLocation(S),O=P(R,F);O==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:F,type:t.typeToString(R),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}}):O==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:F,type:t.typeToString(R),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}})}return{BinaryExpression(c){p(c),A(c),v(c)},CallExpression(c){f(c),b(c)}}}})};function st(e){return Array.from(new Set(e)).join(" | ")||"never"}function Ye(e,n){let r=e.argument;return r.type===pe.Identifier?r.name:n.sourceCode.getText(r)}function xi(e,n){return n.has(e)}import{AST_NODE_TYPES as Ci,ESLintUtils as Ii}from"@typescript-eslint/utils";import{z as Rt}from"zod/v4";var Ai=Ii.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yn="no-call-with-explicit-generics",wi=Rt.object({functions:Rt.array(Rt.string())}),Ri=Ai({name:Yn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[B(wi)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:s}=t;s.type===Ci.Identifier&&r.has(s.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Ft={name:Yn,rule:Ri};import{AST_NODE_TYPES as ot,ESLintUtils as Fi}from"@typescript-eslint/utils";var ki=Fi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="no-call-with-inferred-generics",Pi=ki({name:qn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:s}=t;if(s.type!==ot.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:a=n.disallowTypes}=o;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!a)&&t.typeArguments?.params.some(u=>!p&&u.type===ot.TSAnyKeyword||a&&u.type===ot.TSTypeReference&&u.typeName.type===ot.Identifier&&a.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),kt={name:qn,rule:Pi};import{ESLintUtils as vi}from"@typescript-eslint/utils";var Oi=vi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kn="no-commented-out-code",Ni=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],Di=/^\s*return\s+/,ji=/\w=("|'|`)/,Li=/\w+:\s*('|"|`)/,Mi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,$i=/\w+-\w+:/,_i=/\w+_\w+:/,Ui=/\?\s+\w/,zi=/:\s+\w/,Wi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Ji=/^\s*\d+[,}]/,Vi=/^\s*\[[^\]]*\][,}]/,Xi=/^\s*\{[^}]*\}[,}]/,Bi=/\.\w+\(/,Hi=/\[\w+\]/,Yi=/^\s*(['"`]).+?\1\s*:/,qi=/^<[A-Z]\w*(\s|>|\/)/,Zi=/^<[a-z]+(\s|>|\/)/,Gi=/<[A-Z]\w*(\s.*)?>/,Ki=/<\/[A-Z]\w*>/,Qi=/<[a-z]+(\s.*)?>/,es=/<\/[a-z]+>/,ts=/^\s*[*\s]*$/,ns=/^[a-zA-Z]/,rs=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,is=/```[\s\S]*?```/g,ss=/`[^`]*`/g,Zn=/[a-zA-Z0-9]/,os=/\.[A-Za-z_][A-Za-z0-9_]*\(/,as=/[{}[\]()`=<>]/,ls=/:\s*(['"`[{(]|\w+\s*=>)/,ps=/\bif\s*\(|\belse\b|=>/,ue={returnStatement:Di,stringAssignment:ji,objectPropertyWithQuotes:Li,computedPropertyAssignment:Mi,kebabCaseProperty:$i,snakeCaseProperty:_i,ternaryOperator:Ui,colonWithWord:zi,quotedString:Wi,numberWithComma:Ji,arrayWithComma:Vi,objectWithComma:Xi,methodCall:Bi,arrayAccess:Hi,quotedPropertyKey:Yi,jsxSelfClosing:qi,jsxElement:Zi,jsxOpeningTag:Gi,jsxClosingTag:Ki,htmlOpeningTag:Qi,htmlClosingTag:es,jsdocComment:ts};function cs(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&ns.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||os.test(n)||as.test(n)||ls.test(n)||ps.test(n)?!1:!!(n.includes(":")&&rs.test(n))}var us=[") {","return;",ue.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",ue.stringAssignment,");",ue.objectPropertyWithQuotes,ue.computedPropertyAssignment,ue.kebabCaseProperty,ue.snakeCaseProperty,"&&","||","()",ue.ternaryOperator,ue.colonWithWord,ue.quotedString,ue.numberWithComma,ue.arrayWithComma,ue.objectWithComma,ue.methodCall,ue.arrayAccess,"?.(","??","=>",ue.quotedPropertyKey],fs=["/>","</",ue.jsxSelfClosing,ue.jsxElement,ue.jsxOpeningTag,ue.jsxClosingTag,ue.htmlOpeningTag,ue.htmlClosingTag],Gn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ms=Oi({name:Kn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,s){if(t.startsWith("/"))return!1;let o=t.trimStart();if(t.startsWith("*")||o.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||ue.jsdocComment.test(t))return!1;for(let i of Gn)if(o.startsWith(i))return!1;if(t.includes("https://")||cs(o))return!1;if(s==="Block"){for(let i of fs)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Ni)if(o.startsWith(i))return{wrongPattern:i};for(let i of us)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,s){let o=t,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let l=o.split(is);l.some(d=>Zn.test(d))&&(o=l.join(""))}if(!o.includes("`"))return o;let p=o.split(ss);return p.some(l=>Zn.test(l))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=n(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:Gn.join(", ")}})}}}}}),Pt={name:Kn,rule:ms};import{ESLintUtils as ys,TSESTree as ds}from"@typescript-eslint/utils";var gs=ys.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qn="no-default-export",Ss=gs({name:Qn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===ds.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),vt={name:Qn,rule:Ss};import{ESLintUtils as Ts}from"@typescript-eslint/utils";var hs=Ts.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="no-leaked-text-in-jsx",Es=[",",";","[","]","(",")"],bs=hs({name:er,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";Es.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),Ot={name:er,rule:bs};import{AST_NODE_TYPES as Ke,ESLintUtils as xs}from"@typescript-eslint/utils";var Cs=xs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-non-camel-case-functions",Is=/^(\$?[a-z][a-zA-Z0-9]*)$/;function tr(e){if(e.typeName.type!==Ke.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Ke.Identifier&&n.name==="JSX"&&r.name==="Element"}var As=Cs({name:nr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(n){if(n.id&&!Is.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Ke.TSTypeReference?tr(r):r.type===Ke.TSUnionType&&r.types.some(s=>s.type===Ke.TSTypeReference&&tr(s))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),Nt={name:nr,rule:As};import{ESLintUtils as ws,TSESTree as oe}from"@typescript-eslint/utils";var Rs=ws.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-optional-root-props",Fs=Rs({name:rr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let o=e.sourceCode.getDeclaredVariables(t)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of It(i.identifier)){if("returnType"in p||p.type===oe.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=p.parent;if(!a)return!1;if(a.type===oe.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===oe.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===oe.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let u=He(a.parent.parent,oe.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let d=at(u,e.sourceCode);return d?!(d.parent.type===oe.AST_NODE_TYPES.CallExpression&&d.parent.callee.type===oe.AST_NODE_TYPES.Identifier&&d.parent.callee.name==="memo"):!1}if(p.type===oe.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let l=He(a,oe.AST_NODE_TYPES.VariableDeclaration);return l?!!at(l,e.sourceCode):!1}if(a.type===oe.AST_NODE_TYPES.FunctionDeclaration)return!!at(a,e.sourceCode)}return!1}function r(t){t.key.type!==oe.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=He(t,oe.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeLiteral&&!(lt(t)||!n(t)))for(let s of t.typeAnnotation.members)s.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(t){if(!(lt(t)||!n(t)))for(let s of t.body.body)s.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(t){if(t.typeName.type!==oe.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let s=t.typeArguments.params[0];if(s.type!==oe.AST_NODE_TYPES.TSTypeLiteral)return;let o=He(t.parent,oe.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=at(o,e.sourceCode);if(!(!i||i.parent.type===oe.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===oe.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of s.members)a.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(a)}}}});function lt(e){return e?e.parent?.type===oe.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===oe.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function at(e,n){if(lt(e))return;let r;if(e.type===oe.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===oe.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===oe.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let s=t.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!lt(o[0].identifier.parent.parent))return o[0].identifier}var Dt={name:rr,rule:Fs};import{AST_NODE_TYPES as pt}from"@typescript-eslint/utils";var Qe=q({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===pt.Identifier?n.has(t.name):t.type===pt.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let s of t.specifiers)n.add(s.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===pt.VariableDeclaration)for(let s of t.declaration.declarations)r(s.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===pt.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as ks}from"@typescript-eslint/utils";import jt from"path";import{z as ze}from"zod/v4";var Ps=ks.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="no-relative-imports",vs=ze.object({find:ze.string(),replacement:ze.string()}),Os=ze.object({aliases:ze.array(vs),rootDir:ze.string().optional(),allowNotFoundAliases:ze.boolean().optional(),_dev_simulateFileName:ze.string().optional()}),Ns=Ps({name:ir,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[B(Os)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let a=jt.dirname(p);return jt.resolve(a,i)}function o(i){let p=n.rootDir??process.cwd(),a=jt.relative(p,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:l,replacement:u}of n.aliases)if(a.startsWith(u)){let d=a.replace(u,l);return{alias:l,newPath:d}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!t(p))return;let a=s(p,r),l=o(a);!l&&n.allowNotFoundAliases||e.report({node:i,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?u=>u.replaceText(i.source,`'${l.newPath}'`):void 0})}}}}),Lt={name:ir,rule:Ns};import{AST_NODE_TYPES as fe}from"@typescript-eslint/utils";import{z as sr}from"zod/v4";var Ds=sr.object({customMessage:sr.string().optional()}),Mt=q({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[B(Ds)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case fe.Literal:return!0;case fe.ObjectExpression:return t.properties.every(s=>s.type===fe.Property?s.computed||s.value.type===fe.Identifier&&s.key.type===fe.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case fe.ArrayExpression:return t.elements.every(s=>s?s.type===fe.SpreadElement?!1:r(s):!0);case fe.TemplateLiteral:return t.expressions.length===0;case fe.ConditionalExpression:case fe.LogicalExpression:case fe.BinaryExpression:case fe.UnaryExpression:case fe.CallExpression:case fe.MemberExpression:case fe.Identifier:case fe.ArrowFunctionExpression:case fe.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===fe.JSXIdentifier&&t.name.name==="style"&&t.value){let s=null;t.value.type===fe.JSXExpressionContainer?t.value.expression.type!==fe.JSXEmptyExpression&&(s=t.value.expression):t.value.type===fe.Literal&&(s=t.value),s&&r(s)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as ct}from"@typescript-eslint/utils";import*as Xe from"zod/v4";var js=Xe.object({alternativeMsgs:Xe.object({inArrayFind:Xe.string().optional(),inArrayFilter:Xe.string().optional()}).optional(),__dev_simulateFileName:Xe.string().optional()});function Ls(e){return e.typeAnnotation.type!==ct.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var Ms=/(typeGuards|type-guards)\.(ts|tsx)$/;function $s(e){return Ms.test(e)}function _s(e){let n=e.parent;for(;n;){if(n.type===ct.CallExpression&&n.callee.type===ct.MemberExpression&&n.callee.property.type===ct.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var $t=q({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[B(js)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if($s(r))return{};function t(s){if(!Ls(s))return;let o=_s(s);if(n.alternativeMsgs&&o){let i=o.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});import{AST_NODE_TYPES as qe}from"@typescript-eslint/utils";var Us="no-unnecessary-async-on-jsx-props";function zs(e){if(e.body.type!==qe.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==qe.ExpressionStatement?!1:r.expression.type===qe.AwaitExpression}var _t=q({name:Us,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){zs(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let s=e.sourceCode,o=[],i=s.getFirstToken(r,a=>a.value==="async");if(i){let a=s.getTokenAfter(i);a?o.push(t.replaceTextRange([i.range[0],a.range[0]],"")):o.push(t.remove(i))}function p(a){if(a.type===qe.AwaitExpression){let l=s.getFirstToken(a);if(l&&l.value==="await"){let u=s.getTokenAfter(l);u?o.push(t.replaceTextRange([l.range[0],u.range[0]],"")):o.push(t.remove(l))}}if(a.type===qe.BlockStatement)for(let l of a.body)p(l);else a.type===qe.ExpressionStatement&&p(a.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});import{AST_NODE_TYPES as et,ESLintUtils as ar}from"@typescript-eslint/utils";import*as Ut from"typescript";import tt from"zod/v4";var Ws=ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="no-unnecessary-casting",Js=tt.object({additionalCastFunctions:tt.array(tt.object({name:tt.string(),expectedType:tt.enum(["string","number"])})).optional()}),zt={name:or,rule:Ws({name:or,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[B(Js)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ar.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(u,d){switch(u.type){case et.Literal:return d==="number"?typeof u.value=="number":typeof u.value=="string";case et.TemplateLiteral:return d==="string";case et.UnaryExpression:return d==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function p(u,d){return d==="number"?!!(u.flags&Ut.TypeFlags.NumberLike):!!(u.flags&Ut.TypeFlags.StringLike)}function a(u,d){return g=>g.replaceText(u,e.sourceCode.getText(d))}function l(u){if(!o||u.arguments.length!==1)return;let d=u.arguments[0];if(!d||d.type===et.SpreadElement)return;let{callee:g}=u;if(g.type!==et.Identifier)return;let x=g.name,y=t.find(b=>b.name===x);if(!y)return;if(i(d,y.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(d)),y.expectedType)){let b,f;x==="Number"?b="unnecessaryNumberCasting":x==="String"?b="unnecessaryStringCasting":(b="unnecessaryCustomCasting",f={name:y.name,type:y.expectedType}),e.report({node:u,messageId:b,...f?{data:f}:{},fix:a(u,d)})}}return{CallExpression:l}}})};import{AST_NODE_TYPES as Re}from"@typescript-eslint/utils";import*as ut from"zod/v4";var Vs=ut.object({ignoreWithDescription:ut.string().optional()}),Wt=q({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[B(Vs)]},defaultOptions:[{}],create(e,[n]){let r=e.getSourceCode(),t=r.ast;function s(a){let l=a.arguments[0];return l&&l.type===Re.Literal&&typeof l.value=="string"?l.value:null}function o(a){return!a||!n.ignoreWithDescription?!1:new RegExp(n.ignoreWithDescription).test(a)}function i(a){return a.length!==1?!1:t.body.filter(u=>{if(u.type===Re.ExpressionStatement){let d=u.expression;if(d.type===Re.CallExpression&&d.callee.type===Re.Identifier){let g=d.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(g)}}return!1}).length===0}function p(a){let l=a.arguments[1];if(l&&(l.type===Re.FunctionExpression||l.type===Re.ArrowFunctionExpression)&&l.body.type===Re.BlockStatement){let u=l.body.body;return u.length===0?"":u.map(g=>r.text.slice(g.range[0],g.range[1])).join(`
15
+ Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let w=c.acquire(I),P=new Set,N=null;{let k=w.upper;for(;k&&(P.add(k),k.type!=="function");)k=k.upper;if(!k)return;N=k}let l=Array.isArray;function R(k){if(!l(k.defs))return!1;let O=k.defs[0];if(O==null||O.node.type!=="VariableDeclarator")return!1;let $=O.node.init;if($==null)return!1;for(;$.type==="TSAsExpression";)$=$.expression;let U=O.node.parent;if(U==null&&(At(N.block,O.node.id),U=O.node.parent,U==null))return!1;if(U.kind==="const"&&$.type==="Literal"&&(typeof $.value=="string"||typeof $.value=="number"||$.value===null))return!0;if($.type!=="CallExpression")return!1;let X=$.callee;if(X.type==="MemberExpression"&&X.object.name==="React"&&X.property!=null&&!X.computed&&(X=X.property),X.type!=="Identifier")return!1;let W=O.node.id,{name:K}=X;if(K==="useRef"&&W.type==="Identifier")return!0;if(Si(X)&&W.type==="Identifier"){for(let ee of k.references)ee!==W&&C.add(ee.identifier);return!0}else if(K==="useState"||K==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&l(k.identifiers)){if(W.elements[1]===k.identifiers[0]){if(K==="useState"){let ee=k.references,Ae=0;for(let je=0;je<ee.length;je++){if(ee[je].isWrite()&&Ae++,Ae>1)return!1;a.set(ee[je].identifier,W.elements[0])}}return!0}else if(W.elements[0]===k.identifiers[0]){if(K==="useState"){let ee=k.references;for(let Ae=0;Ae<ee.length;Ae++)u.add(ee[Ae].identifier)}return!1}}}else if(K==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(k.identifiers)&&W.elements[1]===k.identifiers[0])return!0;return!1}function d(k){if(!l(k.defs))return!1;let O=k.defs[0];if(O==null||O.node==null||O.node.id==null)return!1;let $=O.node,U=N.childScopes,X=null,W;for(W=0;W<U.length;W++){let K=U[W],ee=K.block;if($.type==="FunctionDeclaration"&&ee===$||$.type==="VariableDeclarator"&&ee.parent===$){X=K;break}}if(X==null)return!1;for(W=0;W<X.through.length;W++){let K=X.through[W];if(K.resolved!=null&&P.has(K.resolved.scope)&&!g(K.resolved))return!1}return!0}let g=f(R,m),F=f(d,y),v=new Map;function j(k){let O=k.from,$=!1;for(;O.block!==I;)O.type==="function"&&($=O.block.parent!=null&&O.block.parent.type==="ReturnStatement"),O=O.upper;return $}let J=new Map,G=new Map;H(w);function H(k){for(let O of k.references){if(!O.resolved||!P.has(O.resolved.scope))continue;let $=At(I,O.identifier),U=$n($),X=Le(U,G);if(b&&U.type==="Identifier"&&(U.parent.type==="MemberExpression"||U.parent.type==="OptionalMemberExpression")&&!U.parent.computed&&U.parent.property.type==="Identifier"&&U.parent.property.name==="current"&&j(O)&&v.set(X,{reference:O,dependencyNode:U}),U.parent.type==="TSTypeQuery"||U.parent.type==="TSTypeReference")continue;let W=O.resolved.defs[0];if(W!=null&&!(W.node!=null&&W.node.init===I.parent)&&W.type!=="TypeParameter")if(J.has(X))J.get(X).references.push(O);else{let K=O.resolved,ee=g(K)||F(K);J.set(X,{isStable:ee,references:[O]})}}for(let O of k.childScopes)H(O)}v.forEach(({reference:k,dependencyNode:O},$)=>{let U=k.resolved.references,X=!1;for(let W=0;W<U.length;W++){let{identifier:K}=U[W],{parent:ee}=K;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){X=!0;break}}X||p({node:O.parent.property,message:`The ref value '${$}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${$}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function Z(k,O){D.has(O)||(D.add(O),p({node:k,message:`Assignments to the '${O}' variable from inside React Hook ${r(T)} will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside ${r(T)}.`}))}let Y=new Set;if(J.forEach(({isStable:k,references:O},$)=>{k&&Y.add($),O.forEach(U=>{U.writeExpr&&Z(U.writeExpr,$)})}),D.size>0)return;if(!A){let k=null;if(J.forEach(({isStable:O,references:$},U)=>{k||$.forEach(X=>{if(k)return;let W=X.identifier;if(!a.has(W))return;let ee=X.from;for(;ee.type!=="function";)ee=ee.upper;ee.block===I&&(k=U)})}),k){let{suggestedDependencies:O}=Ct({dependencies:J,declaredDependencies:[],stableDependencies:Y,externalDependencies:new Set,isEffect:!0});p({node:T,message:`React Hook ${h} contains a call to '${k}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+O.join(", ")+`] as a second argument to the ${h} Hook.`,suggest:[{desc:`Add dependencies array: [${O.join(", ")}]`,fix($){return $.insertTextAfter(I,`, [${O.join(", ")}]`)}}]})}return}let ce=[],ue=new Set;A.type!=="ArrayExpression"?p({node:A,message:`React Hook ${r(T)} was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.`}):A.elements.forEach(k=>{if(k===null)return;if(k.type==="SpreadElement"){p({node:k,message:`React Hook ${r(T)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}C.has(k)&&p({node:k,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(k)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(k)}\``,fix(X){return X.removeRange(k.range)}}]});let O;try{O=Le(k,G)}catch(X){if(/Unsupported node type/.test(X.message)){k.type==="Literal"?J.has(k.value)?p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. Did you mean to include ${k.value} in the array instead?`}):p({node:k,message:`The ${k.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:k,message:`React Hook ${r(T)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw X}let $=k;for(;$.type==="MemberExpression"||$.type==="OptionalMemberExpression"||$.type==="ChainExpression";)$=$.object||$.expression.object;let U=!N.through.some(X=>X.identifier===$);ce.push({key:O,node:k}),U||ue.add(O)});let{suggestedDependencies:Ie,unnecessaryDependencies:_e,missingDependencies:ge,duplicateDependencies:Ke}=Ct({dependencies:J,declaredDependencies:ce,stableDependencies:Y,externalDependencies:ue,isEffect:b}),Be=Ie;if(Ke.size+ge.size+_e.size===0){if(n)return;mi({declaredDependencies:ce,declaredDependenciesNode:A,componentScope:N,scope:w}).forEach(({construction:O,isUsedOutsideOfHook:$,depType:U})=>{let X=U==="function"?"useCallback":"useMemo",W=U==="function"?"definition":"initialization",K=`wrap the ${W} of '${O.name.name}' in its own ${X}() Hook.`,ee=$?`To fix this, ${K}`:`Move it inside the ${h} callback. Alternatively, ${K}`,Ae=U==="conditional"||U==="logical expression"?"could make":"makes",je=`The '${O.name.name}' ${U} ${Ae} the dependencies of ${h} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Fn;$&&O.type==="Variable"&&U==="function"&&(Fn=[{desc:`Wrap the ${W} of '${O.name.name}' in its own ${X}() Hook.`,fix(kn){let[ti,ni]=X==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[kn.insertTextBefore(O.node.init,ti),kn.insertTextAfter(O.node.init,ni)]}}]),p({node:O.node,message:je,suggest:Fn})});return}!b&&ge.size>0&&(Be=Ct({dependencies:J,declaredDependencies:[],stableDependencies:Y,externalDependencies:ue,isEffect:b}).suggestedDependencies);function Ee(){if(ce.length===0)return!0;let k=ce.map($=>$.key),O=k.slice().sort();return k.join(",")===O.join(",")}Ee()&&Be.sort();function xe(k){let O=k.split("."),$="";for(let U=0;U<O.length;U++){if(U!==0){let X=O.slice(0,U+1).join("."),W=G.get(X)===!0;$+=W?"?.":"."}$+=O[U]}return $}function ht(k,O,$,U){return k.size===0?null:(k.size>1?"":O+" ")+$+" "+(k.size>1?"dependencies":"dependency")+": "+di(Array.from(k).sort().map(X=>"'"+xe(X)+"'"))+`. Either ${U} ${k.size>1?"them":"it"} or remove the dependency array.`}let ke="";if(_e.size>0){let k=null;if(Array.from(_e.keys()).forEach(O=>{k===null&&O.endsWith(".current")&&(k=O)}),k!==null)ke=` Mutable values like '${k}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ue.size>0){let O=Array.from(ue)[0];w.set.has(O)||(ke=` Outer scope values like '${O}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ke&&ge.has("props")){let k=J.get("props");if(k==null)return;let O=k.references;if(!Array.isArray(O))return;let $=!0;for(let U=0;U<O.length;U++){let X=O[U],W=At(N.block,X.identifier);if(!W){$=!1;break}let K=W.parent;if(K==null){$=!1;break}if(K.type!=="MemberExpression"&&K.type!=="OptionalMemberExpression"){$=!1;break}}$&&(ke=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${h} call and refer to those specific props inside ${r(T)}.`)}if(!ke&&ge.size>0){let k=null;ge.forEach(O=>{if(k)return;let $=N.set.get(O),U=J.get(O);if(U.references[0].resolved!==$)return;let X=$.defs[0];if(X==null||X.name==null||X.type!=="Parameter")return;let W=!1,K;for(let ee=0;ee<U.references.length;ee++)if(K=U.references[ee].identifier,K!=null&&K.parent!=null&&(K.parent.type==="CallExpression"||K.parent.type==="OptionalCallExpression")&&K.parent.callee===K){W=!0;break}W&&(k=O)}),k!==null&&(ke=` If '${k}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ke&&ge.size>0){let k=null;if(ge.forEach(O=>{if(k!==null)return;let U=J.get(O).references,X,W;for(let K=0;K<U.length;K++){for(X=U[K].identifier,W=X.parent;W!=null&&W!==N.block;){if(W.type==="CallExpression"){let ee=a.get(W.callee);if(ee!=null){if(ee.name===O)k={missingDep:O,setter:W.callee.name,form:"updater"};else if(u.has(X))k={missingDep:O,setter:W.callee.name,form:"reducer"};else{let Ae=U[K].resolved;if(Ae!=null){let je=Ae.defs[0];je!=null&&je.type==="Parameter"&&(k={missingDep:O,setter:W.callee.name,form:"inlineReducer"})}}break}}W=W.parent}if(k!==null)break}}),k!==null)switch(k.form){case"reducer":ke=` You can also replace multiple useState variables with useReducer if '${k.setter}' needs the current value of '${k.missingDep}'.`;break;case"inlineReducer":ke=` If '${k.setter}' needs the current value of '${k.missingDep}', you can also switch to useReducer instead of useState and read '${k.missingDep}' in the reducer.`;break;case"updater":ke=` You can also do a functional update '${k.setter}(${k.missingDep.slice(0,1)} => ...)' if you only need '${k.missingDep}' in the '${k.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:A,message:`React Hook ${r(T)} has `+(ht(ge,"a","missing","include")||ht(_e,"an","unnecessary","exclude")||ht(Ke,"a","duplicate","omit"))+ke,suggest:[{desc:`Update the dependencies array to be: [${Be.map(xe).join(", ")}]`,fix(k){return k.replaceText(A,`[${Be.map(xe).join(", ")}]`)}}]})}function x(I){let A=yi(I.callee,i);if(A===-1)return;let T=I.arguments[A],h=I.callee,b=_n(h).name,w=I.arguments[A+1],P=/Effect($|[^a-z])/g.test(b);if(!T){p({node:h,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!P)){if(!w&&!P){(b==="useMemo"||b==="useCallback")&&p({node:h,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(T.type){case"FunctionExpression":case"ArrowFunctionExpression":E(T,w,h,b,P);return;case"Identifier":if(!w||w.elements&&w.elements.some(R=>R&&R.type==="Identifier"&&R.name===T.name))return;let N=t(I).set.get(T.name);if(N==null||N.defs==null)return;let l=N.defs[0];if(!l||!l.node||l.type!=="Variable"&&l.type!=="FunctionName")break;switch(l.node.type){case"FunctionDeclaration":E(l.node,w,h,b,P);return;case"VariableDeclarator":let R=l.node.init;if(!R)break;switch(R.type){case"ArrowFunctionExpression":case"FunctionExpression":E(R,w,h,b,P);return}break}break;default:p({node:h,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:h,message:`React Hook ${b} has a missing dependency: '${T.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${T.name}]`,fix(N){return N.replaceText(w,`[${T.name}]`)}}]})}}let S=!!e.options[0]?.reactCompilerIsEnabled;if(e.options[0]?.ignoreIfReactCompilerIsEnabled||S){for(let I of e.sourceCode.getAllComments())if(S||fi.test(I.value))return n=!0,{CallExpression:A=>x(A,!0)}}return{CallExpression:I=>x(I)}}};function Ct({dependencies:e,declaredDependencies:n,stableDependencies:r,externalDependencies:t,isEffect:s}){let o=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,x)=>{let S=p(o,x);S.isUsed=!0,c(o,x,I=>{I.isSubtreeUsed=!0})}),n.forEach(({key:E})=>{let x=p(o,E);x.isSatisfiedRecursively=!0}),r.forEach(E=>{let x=p(o,E);x.isSatisfiedRecursively=!0});function p(E,x){let S=x.split("."),I=E;for(let A of S){let T=I.children.get(A);T||(T=i(),I.children.set(A,T)),I=T}return I}function c(E,x,S){let I=x.split("."),A=E;for(let T of I){let h=A.children.get(T);if(!h)return;S(h),A=h}}let a=new Set,u=new Set;m(o,a,u,E=>E);function m(E,x,S,I){E.children.forEach((A,T)=>{let h=I(T);if(A.isSatisfiedRecursively){A.isSubtreeUsed&&S.add(h);return}if(A.isUsed){x.add(h);return}m(A,x,S,b=>h+"."+b)})}let y=[],C=new Set,f=new Set;return n.forEach(({key:E})=>{u.has(E)?y.indexOf(E)===-1?y.push(E):f.add(E):C.add(E)}),a.forEach(E=>{y.push(E)}),{suggestedDependencies:y,unnecessaryDependencies:C,duplicateDependencies:f,missingDependencies:a}}function Ue(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return Ue(e.consequent)!=null||Ue(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ue(e.left)!=null||Ue(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ue(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ue(e.expression);case"TSAsExpression":return Ue(e.expression)}return null}function mi({declaredDependencies:e,declaredDependenciesNode:n,componentScope:r,scope:t}){let s=e.map(({key:i})=>{let p=r.variables.find(a=>a.name===i);if(p==null)return null;let c=p.defs[0];if(c==null)return null;if(c.type==="Variable"&&c.node.type==="VariableDeclarator"&&c.node.id.type==="Identifier"&&c.node.init!=null){let a=Ue(c.node.init);if(a!=null)return[p,a]}return c.type==="FunctionName"&&c.node.type==="FunctionDeclaration"?[p,"function"]:c.type==="ClassName"&&c.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function o(i){let p=!1;for(let c=0;c<i.references.length;c++){let a=i.references[c];if(a.writeExpr){if(p)return!0;p=!0;continue}let u=a.from;for(;u!==t&&u!=null;)u=u.upper;if(u!==t&&!Un(n,a.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function $n(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?$n(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function It(e,n,r){n&&(e.optional?n.has(r)||n.set(r,!0):n.has(r)||n.set(r,!1))}function Le(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return n&&n.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Le(e.object,n),t=Le(e.property,null),s=`${r}.${t}`;return It(e,n,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Le(e.object,n),t=Le(e.property,null),s=`${r}.${t}`;return It(e,n,s),s}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let t=Le(r.object,n),s=Le(r.property,null),o=`${t}.${s}`;return It(r,n,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function _n(e,n){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function yi(e,n){let r=_n(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&n&&n.additionalHooks){let t;try{t=Le(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return n.additionalHooks.test(t)?0:-1}else return-1}}function At(e,n){let r=[e],t=null;for(;r.length;){if(t=r.shift(),gi(t,n))return t;if(Un(t,n))for(let[s,o]of Object.entries(t))s!=="parent"&&(Ln(o)?(o.parent=t,r.push(o)):Array.isArray(o)&&o.forEach(i=>{Ln(i)&&(i.parent=t,r.push(i))}))}return null}function di(e){let n="";for(let r=0;r<e.length;r++)n+=e[r],r===0&&e.length===2?n+=" and ":r===e.length-2&&e.length>2?n+=", and ":r<e.length-1&&(n+=", ");return n}function Ln(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function gi(e,n){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===n.type&&e.name===n.name&&e.range[0]===n.range[0]&&e.range[1]===n.range[1]}function Un(e,n){return e.range[0]<=n.range[0]&&e.range[1]>=n.range[1]}function Si(e){return!1}import{AST_NODE_TYPES as pe,ESLintUtils as Hn}from"@typescript-eslint/utils";import V from"typescript";import{z as Vn}from"zod/v4";import{AST_NODE_TYPES as zn}from"@typescript-eslint/utils";function He(e,n,r=1/0){if(r!==0&&e.parent)return e.type===n?e:He(e.parent,n,r===1/0?r:r-1)}function*wt(e){yield e,e.parent&&(yield*wt(e.parent))}function Rt(e,n){for(let r of e){let t=n(r);if(t!=null&&t!==!1)return t}}function Jn(e,n,r){let s=r.getDeclaredVariables(e).find(o=>o.name===n||o.identifiers[0]?.parent.type===zn.Property&&o.identifiers[0].parent.key.type===zn.Identifier&&o.identifiers[0].parent.key.name===n);return s?s.references.filter(o=>!o.init):[]}function Wn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ti(e,n){return e[n]}function Pe(e,n,r){let t=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),n(i)===!0)return!0;let c=t[i.type];if(c)for(let a of c){let u=Ti(i,a);if(u){if(Array.isArray(u)){for(let m of u)if(Wn(m)&&o(m))return!0}else if(Wn(u)&&o(u))return!0}}return!1}o(e)}var hi=Hn.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xn="improved-no-unnecessary-condition",Ei=Vn.object({alternativeForInCondition:Vn.string().optional().describe("Alternative to appear in the error for `in` condition")}),Bn={object:"Array",property:"isArray"},bi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],xi=new Set(bi),Ft={name:Xn,rule:hi({name:Xn,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[B(Ei)]},defaultOptions:[{}],create(e,[n]){let r=Hn.getParserServices(e,!0),t=r.program?.getTypeChecker();if(!t||!r.program)throw new Error("TypeScript services or program not available");function s(l){return l.type===pe.UnaryExpression&&l.operator==="typeof"}function o(l){return l.flags&V.TypeFlags.Any||l.flags&V.TypeFlags.Unknown?null:l.flags&V.TypeFlags.StringLike?["string"]:l.flags&V.TypeFlags.NumberLike?["number"]:l.flags&V.TypeFlags.BigIntLike?["bigint"]:l.flags&V.TypeFlags.BooleanLike?["boolean"]:l.flags&V.TypeFlags.ESSymbolLike?["symbol"]:l.flags&V.TypeFlags.Undefined||l.flags&V.TypeFlags.Void?["undefined"]:l.flags&V.TypeFlags.Null?["object"]:l.getCallSignatures().length>0?["function"]:l.flags&V.TypeFlags.Object?l.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:l.flags&V.TypeFlags.NonPrimitive?["object"]:l.flags&V.TypeFlags.Never?["never"]:null}function i(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.getTypeAtLocation(R.expression);if(d.flags&V.TypeFlags.Any||d.flags&V.TypeFlags.Unknown)return null;let g=[];if(d.isUnion()){for(let v of d.types){let j=o(v);if(j)g.push(...j);else return null}return g}let F=o(d);return F?(g.push(...F),g):null}function p(l){if(!(l.operator==="==="||l.operator==="!=="))return;let d=null,g=null;if(s(l.left)?(d=l.left,g=l.right.type===pe.Literal&&typeof l.right.value=="string"?l.right.value:null):s(l.right)&&(d=l.right,g=l.left.type===pe.Literal&&typeof l.left.value=="string"?l.left.value:null),!d||!g||!Ci(g,xi))return;let F=i(d);if(!F)return;let v=l.operator==="!==",j=F.includes(g);F.length===1?j&&!v?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:Ye(d,e),type:g}}):!j&&v?e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:Ye(d,e),type:Array.from(F)[0]}}):!j&&!v?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(d,e),actualType:ot(F),conditionType:g}}):j&&v&&e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(d,e),actualType:ot(F),conditionType:g}}):!j&&!v?e.report({node:l,messageId:"alwaysFalseTypeofCondition",data:{name:Ye(d,e),actualType:ot(F),conditionType:g}}):!j&&v&&e.report({node:l,messageId:"unnecessaryTypeofCondition",data:{name:Ye(d,e),type:ot(F)}})}function c(l){if(l.flags&V.TypeFlags.Any||l.flags&V.TypeFlags.Unknown)return null;if(l.isUnion()){let R=[];for(let d of l.types)if(d.flags&V.TypeFlags.StringLiteral){let g=d.value;R.push(g)}else return null;return R}return l.flags&V.TypeFlags.StringLiteral?[l.value]:null}function a(l){if(!t)return null;let R=r.esTreeNodeToTSNodeMap.get(l),d=t.getTypeAtLocation(R),g=c(d);if(g)return g;let F=t.getSymbolAtLocation(R);if(F){let v=t.getTypeOfSymbolAtLocation(F,R),j=c(v);if(j)return j}return null}function u(l){let R=e.sourceCode.ast,d=null;return Pe(R,g=>{if(g.type===pe.VariableDeclarator&&g.id.type===pe.Identifier&&g.id.name===l.name&&g.id.typeAnnotation){let F=g.id.typeAnnotation.typeAnnotation;if(F.type===pe.TSUnionType){let v=[];for(let j of F.types)if(j.type===pe.TSLiteralType&&j.literal.type===pe.Literal&&typeof j.literal.value=="string")v.push(j.literal.value);else return!0;return d=v,!0}if(F.type===pe.TSLiteralType&&F.literal.type===pe.Literal&&typeof F.literal.value=="string")return d=[F.literal.value],!0}return!1},e.sourceCode),d}function m(l){return l==="Array"||l==="ReadonlyArray"?!0:l.endsWith(".Array")||l.endsWith(".ReadonlyArray")}function y(l){if(!t)return!1;if(t.isArrayType(l)||t.isTupleType(l))return!0;let R=t.getApparentType(l);if(R!==l&&(t.isArrayType(R)||t.isTupleType(R)))return!0;if(l.aliasSymbol){let g=t.getFullyQualifiedName(l.aliasSymbol);if(m(g))return!0}let d=l.getSymbol();if(d){let g=t.getFullyQualifiedName(d);if(m(g))return!0}return!1}function C(l){if(!t)return!1;if(l.flags&V.TypeFlags.StringLike||l.flags&V.TypeFlags.NumberLike||l.flags&V.TypeFlags.BigIntLike||l.flags&V.TypeFlags.BooleanLike||l.flags&V.TypeFlags.ESSymbolLike||l.flags&V.TypeFlags.EnumLike||l.flags&V.TypeFlags.Null||l.flags&V.TypeFlags.Undefined||l.flags&V.TypeFlags.Void||l.flags&V.TypeFlags.Never)return!0;let R=l.getSymbol();if(R){let d=t.getFullyQualifiedName(R);if(d==="__function"||d==="__object"&&!y(l))return!0}return!1}function f(l){if(l.flags&V.TypeFlags.Any||l.flags&V.TypeFlags.Unknown)return"unknown";if(l.isUnion()){let R=!0,d=!0;for(let g of l.types){let F=f(g);if(F==="unknown")return"unknown";F!=="alwaysTrue"&&(R=!1),F!=="alwaysFalse"&&(d=!1)}return R?"alwaysTrue":d?"alwaysFalse":"unknown"}return y(l)?"alwaysTrue":C(l)?"alwaysFalse":"unknown"}function E(l){return!l.computed&&l.object.type===pe.Identifier&&l.object.name===Bn.object&&l.property.type===pe.Identifier&&l.property.name===Bn.property}function x(l){if(!t||l.callee.type!==pe.MemberExpression||!E(l.callee)||l.arguments.length===0)return;let[R]=l.arguments;if(!R||R.type===pe.SpreadElement)return;let d=r.esTreeNodeToTSNodeMap.get(R),g=t.getTypeAtLocation(d),F=f(g);F==="alwaysTrue"?e.report({node:l,messageId:"unnecessaryArrayIsArrayCondition"}):F==="alwaysFalse"&&e.report({node:l,messageId:"alwaysFalseArrayIsArrayCondition"})}function S(l){if(l.callee.type!==pe.MemberExpression||l.callee.property.type!==pe.Identifier||l.callee.computed)return;let R=l.callee.property.name;if(R!=="startsWith"&&R!=="endsWith"&&R!=="includes"||l.arguments.length!==1)return;let[d]=l.arguments;if(!d||d.type!==pe.Literal||typeof d.value!="string")return;let g=l.callee.object,F=a(g);if(!F&&g.type===pe.Identifier&&(F=u(g)),!F||F.length===0)return;let v=d.value;if(R==="includes"&&F.length>1)return;let j=0,J=0;for(let G of F)if((R==="startsWith"?G.startsWith(v):R==="endsWith"?G.endsWith(v):G.includes(v))?j++:J++,j>0&&J>0)return;if(j>0&&J===0){let G=R==="startsWith"?"unnecessaryStartsWithCondition":R==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:l,messageId:G})}else if(J>0&&j===0){let G=R==="startsWith"?"alwaysFalseStartsWithCondition":R==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:l,messageId:G})}}function I(l){if(!new Set(["===","!==",">",">=","<","<="]).has(l.operator))return;function d(H){if(H.type!==pe.MemberExpression||H.computed||H.property.type!==pe.Identifier||H.property.name!=="length")return null;let D=H.object,Z=a(D);if(!Z||Z.length===0)return null;let Y=[];for(let ce of Z)Y.push(ce.length);return{values:Y}}let g=d(l.left),F=d(l.right),v=null,j=null;if(g?l.right.type===pe.Literal&&typeof l.right.value=="number"&&(v=g.values,j=l.right.value):F&&l.left.type===pe.Literal&&typeof l.left.value=="number"&&(v=F.values,j=l.left.value),!v||j===null)return;let J=0,G=0;for(let H of v){let D=!1;if(l.operator==="==="?D=H===j:l.operator==="!=="?D=H!==j:l.operator===">"?D=H>j:l.operator===">="?D=H>=j:l.operator==="<"?D=H<j:l.operator==="<="&&(D=H<=j),D?J++:G++,J>0&&G>0)return}J>0&&G===0?e.report({node:l,messageId:"unnecessaryLengthCondition"}):G>0&&J===0&&e.report({node:l,messageId:"alwaysFalseLengthCondition"})}function A(l){if(l.type===pe.Literal&&typeof l.value=="string")return l.value;let R=a(l);if(!R||R.length!==1)return null;let[d]=R;return d??null}function T(l){return(l.flags&V.TypeFlags.Intersection)!==0}function h(l){return(l.flags&V.TypeFlags.Object)!==0}function b(l){return!t||t.getIndexTypeOfType(l,V.IndexKind.String)?!0:!!t.getIndexTypeOfType(l,V.IndexKind.Number)}function w(l,R){if(!t||b(l)||l.getProperties().length===0)return"unknown";let d=t.getPropertyOfType(l,R);return d?d.flags&V.SymbolFlags.Optional?"optional":"required":"absent"}function P(l,R){if(l.flags&V.TypeFlags.Any||l.flags&V.TypeFlags.Unknown||l.flags&V.TypeFlags.Never||l.flags&V.TypeFlags.TypeParameter||l.flags&V.TypeFlags.IndexedAccess||l.flags&V.TypeFlags.StringLike||l.flags&V.TypeFlags.NumberLike||l.flags&V.TypeFlags.BigIntLike||l.flags&V.TypeFlags.BooleanLike||l.flags&V.TypeFlags.EnumLike||l.flags&V.TypeFlags.ESSymbolLike||l.flags&V.TypeFlags.NonPrimitive||l.flags&V.TypeFlags.Null||l.flags&V.TypeFlags.Undefined||l.flags&V.TypeFlags.Void)return"unknown";if(l.isUnion()){let d=!0,g=!0;for(let F of l.types){let v=P(F,R);if(v==="unknown"||(v!=="required"&&(d=!1),v!=="absent"&&(g=!1),v==="optional"))return"unknown"}return d?"required":g?"absent":"unknown"}if(T(l)){let d=l,g=!1,F=!1;for(let v of d.types){let j=P(v,R);if(j==="unknown")return"unknown";j==="required"?g=!0:j==="optional"&&(F=!0)}return g?"required":F?"optional":"absent"}return h(l)?w(l,R):"unknown"}function N(l){if(l.operator!=="in"||l.left.type===pe.PrivateIdentifier)return;let R=A(l.left);if(!R)return;let d=l.right,g=r.esTreeNodeToTSNodeMap.get(d);if(!t)return;let F=t.getTypeAtLocation(g),v=P(F,R);v==="required"?e.report({node:l,messageId:"unnecessaryInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}}):v==="absent"&&e.report({node:l,messageId:"alwaysFalseInCondition",data:{property:R,type:t.typeToString(F),alternative:n.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${n.alternativeForInCondition}`:""}})}return{BinaryExpression(l){p(l),I(l),N(l)},CallExpression(l){S(l),x(l)}}}})};function ot(e){return Array.from(new Set(e)).join(" | ")||"never"}function Ye(e,n){let r=e.argument;return r.type===pe.Identifier?r.name:n.sourceCode.getText(r)}function Ci(e,n){return n.has(e)}import{AST_NODE_TYPES as Ii,ESLintUtils as Ai}from"@typescript-eslint/utils";import{z as kt}from"zod/v4";var wi=Ai.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yn="no-call-with-explicit-generics",Ri=kt.object({functions:kt.array(kt.string())}),Fi=wi({name:Yn,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[B(Ri)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Set(n.functions);return{CallExpression(t){let{callee:s}=t;s.type===Ii.Identifier&&r.has(s.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Pt={name:Yn,rule:Fi};import{AST_NODE_TYPES as at,ESLintUtils as ki}from"@typescript-eslint/utils";var Pi=ki.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),qn="no-call-with-inferred-generics",vi=Pi({name:qn,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:s}=t;if(s.type!==at.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:c=n.disallowTypes}=o;(t.typeArguments?.params.length||0)<(i||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!c)&&t.typeArguments?.params.some(u=>!p&&u.type===at.TSAnyKeyword||c&&u.type===at.TSTypeReference&&u.typeName.type===at.Identifier&&c.includes(u.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),vt={name:qn,rule:vi};import{ESLintUtils as Oi}from"@typescript-eslint/utils";var Ni=Oi.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Kn="no-commented-out-code",Di=["function ","class ","interface ","type ","enum ","namespace ","import ","export ","const ","let ","var ","return ","throw ","break","continue","try {","catch (","finally {","async ","await ","case ","switch (","while (","for (","default:"],ji=/^\s*return\s+/,Li=/\w=("|'|`)/,Mi=/\w+:\s*('|"|`)/,$i=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,_i=/\w+-\w+:/,Ui=/\w+_\w+:/,zi=/\?\s+\w/,Wi=/:\s+\w/,Ji=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Vi=/^\s*\d+[,}]/,Xi=/^\s*\[[^\]]*\][,}]/,Bi=/^\s*\{[^}]*\}[,}]/,Hi=/\.\w+\(/,Yi=/\[\w+\]/,qi=/^\s*(['"`]).+?\1\s*:/,Zi=/^<[A-Z]\w*(\s|>|\/)/,Gi=/^<[a-z]+(\s|>|\/)/,Ki=/<[A-Z]\w*(\s.*)?>/,Qi=/<\/[A-Z]\w*>/,es=/<[a-z]+(\s.*)?>/,ts=/<\/[a-z]+>/,ns=/^\s*[*\s]*$/,rs=/^[a-zA-Z]/,is=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,ss=/```[\s\S]*?```/g,os=/`[^`]*`/g,Zn=/[a-zA-Z0-9]/,as=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ls=/[{}[\]()`=<>]/,ps=/:\s*(['"`[{(]|\w+\s*=>)/,cs=/\bif\s*\(|\belse\b|=>/,fe={returnStatement:ji,stringAssignment:Li,objectPropertyWithQuotes:Mi,computedPropertyAssignment:$i,kebabCaseProperty:_i,snakeCaseProperty:Ui,ternaryOperator:zi,colonWithWord:Wi,quotedString:Ji,numberWithComma:Vi,arrayWithComma:Xi,objectWithComma:Bi,methodCall:Hi,arrayAccess:Yi,quotedPropertyKey:qi,jsxSelfClosing:Zi,jsxElement:Gi,jsxOpeningTag:Ki,jsxClosingTag:Qi,htmlOpeningTag:es,htmlClosingTag:ts,jsdocComment:ns};function us(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&rs.test(r)&&r.includes(" "))return!0}let n=e.trim();return n.length===0||as.test(n)||ls.test(n)||ps.test(n)||cs.test(n)?!1:!!(n.includes(":")&&is.test(n))}var fs=[") {","return;",fe.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",fe.stringAssignment,");",fe.objectPropertyWithQuotes,fe.computedPropertyAssignment,fe.kebabCaseProperty,fe.snakeCaseProperty,"&&","||","()",fe.ternaryOperator,fe.colonWithWord,fe.quotedString,fe.numberWithComma,fe.arrayWithComma,fe.objectWithComma,fe.methodCall,fe.arrayAccess,"?.(","??","=>",fe.quotedPropertyKey],ms=["/>","</",fe.jsxSelfClosing,fe.jsxElement,fe.jsxOpeningTag,fe.jsxClosingTag,fe.htmlOpeningTag,fe.htmlClosingTag],Gn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],ys=Ni({name:Kn,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function n(t,s){if(t.startsWith("/"))return!1;let o=t.trimStart();if(t.startsWith("*")||o.startsWith("eslint-disable")||t.includes("@deprecated")||t.includes("@example")||t.includes("@param")||t.includes("@returns")||t.includes("@throws")||t.includes("typescript-eslint")||t.includes("@ts-")||t.includes("prettier-ignore")||fe.jsdocComment.test(t))return!1;for(let i of Gn)if(o.startsWith(i))return!1;if(t.includes("https://")||us(o))return!1;if(s==="Block"){for(let i of ms)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Di)if(o.startsWith(i))return{wrongPattern:i};for(let i of fs)if(typeof i=="string"){if(t.includes(i))return{wrongPattern:i}}else if(i.test(t))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(t,s){let o=t,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let a=o.split(ss);a.some(m=>Zn.test(m))&&(o=a.join(""))}if(!o.includes("`"))return o;let p=o.split(os);return p.some(a=>Zn.test(a))?p.join(""):o}return{Program(){let s=e.sourceCode.getAllComments();for(let o of s){let i=r(o.value,o.type),p=n(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:Gn.join(", ")}})}}}}}),Ot={name:Kn,rule:ys};import{ESLintUtils as ds,TSESTree as gs}from"@typescript-eslint/utils";var Ss=ds.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Qn="no-default-export",Ts=Ss({name:Qn,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(n){e.report({node:n,messageId:"noDefaultExport"})},ExportNamedDeclaration(n){for(let r of n.specifiers)r.exported.type===gs.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Nt={name:Qn,rule:Ts};import{ESLintUtils as hs}from"@typescript-eslint/utils";var Es=hs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="no-leaked-text-in-jsx",bs=[",",";","[","]","(",")"],xs=Es({name:er,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(n){let r=n.value.trim();if(!r)return;let t="";bs.includes(r)?t=r:r.includes("&&")?t="&&":r.includes("||")?t="||":r.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),Dt={name:er,rule:xs};import{AST_NODE_TYPES as Qe,ESLintUtils as Cs}from"@typescript-eslint/utils";var Is=Cs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-non-camel-case-functions",As=/^(\$?[a-z][a-zA-Z0-9]*)$/;function tr(e){if(e.typeName.type!==Qe.TSQualifiedName)return!1;let{left:n,right:r}=e.typeName;return n.type===Qe.Identifier&&n.name==="JSX"&&r.name==="Element"}var ws=Is({name:nr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(n){if(n.id&&!As.test(n.id.name)){let r=n.returnType?.typeAnnotation;if(r&&(r.type===Qe.TSTypeReference?tr(r):r.type===Qe.TSUnionType&&r.types.some(s=>s.type===Qe.TSTypeReference&&tr(s))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),jt={name:nr,rule:ws};import{ESLintUtils as Rs,TSESTree as oe}from"@typescript-eslint/utils";var Fs=Rs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-optional-root-props",ks=Fs({name:rr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function n(t){let o=e.sourceCode.getDeclaredVariables(t)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of wt(i.identifier)){if("returnType"in p||p.type===oe.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let c=p.parent;if(!c)return!1;if(c.type===oe.AST_NODE_TYPES.TSTypeParameterInstantiation&&c.parent.type===oe.AST_NODE_TYPES.TSTypeReference&&c.parent.typeName.type===oe.AST_NODE_TYPES.Identifier&&c.parent.typeName.name==="FC"){let u=He(c.parent.parent,oe.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let m=lt(u,e.sourceCode);return m?!(m.parent.type===oe.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===oe.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(p.type===oe.AST_NODE_TYPES.AssignmentPattern)return!1;if(c.type===oe.AST_NODE_TYPES.ArrowFunctionExpression){let a=He(c,oe.AST_NODE_TYPES.VariableDeclaration);return a?!!lt(a,e.sourceCode):!1}if(c.type===oe.AST_NODE_TYPES.FunctionDeclaration)return!!lt(c,e.sourceCode)}return!1}function r(t){t.key.type!==oe.AST_NODE_TYPES.Identifier||!t.optional||e.report({node:t.key,messageId:"optionalNotAllowed",data:{propertyName:t.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=He(t,oe.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===oe.AST_NODE_TYPES.TSTypeLiteral&&!(pt(t)||!n(t)))for(let s of t.typeAnnotation.members)s.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(t){if(!(pt(t)||!n(t)))for(let s of t.body.body)s.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(t){if(t.typeName.type!==oe.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let s=t.typeArguments.params[0];if(s.type!==oe.AST_NODE_TYPES.TSTypeLiteral)return;let o=He(t.parent,oe.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=lt(o,e.sourceCode);if(!(!i||i.parent.type===oe.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===oe.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let c of s.members)c.type===oe.AST_NODE_TYPES.TSPropertySignature&&r(c)}}}});function pt(e){return e?e.parent?.type===oe.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===oe.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function lt(e,n){if(pt(e))return;let r;if(e.type===oe.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===oe.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let t=n.getScope(e);e.type===oe.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let s=t.variables.find(i=>i.identifiers.includes(r));if(!s)return;let o=s.references.filter(i=>i.identifier!==r);if(!(o.length!==1||!o[0])&&!pt(o[0].identifier.parent.parent))return o[0].identifier}var Lt={name:rr,rule:ks};import{AST_NODE_TYPES as ct}from"@typescript-eslint/utils";var et=q({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let n=new Set;function r(t){return t?t.type===ct.Identifier?n.has(t.name):t.type===ct.MemberExpression?r(t.object):!1:!1}return{ImportDeclaration(t){for(let s of t.specifiers)n.add(s.local.name)},ExportNamedDeclaration(t){if(t.source){e.report({node:t,messageId:"noReexport"});return}if(t.declaration?.type===ct.VariableDeclaration)for(let s of t.declaration.declarations)r(s.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===ct.Identifier&&n.has(t.declaration.name)&&e.report({node:t,messageId:"noReexport"})},ExportAllDeclaration(t){e.report({node:t,messageId:"noReexport"})}}}});import{ESLintUtils as Ps}from"@typescript-eslint/utils";import Mt from"path";import{z as ze}from"zod/v4";var vs=Ps.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="no-relative-imports",Os=ze.object({find:ze.string(),replacement:ze.string()}),Ns=ze.object({aliases:ze.array(Os),rootDir:ze.string().optional(),allowNotFoundAliases:ze.boolean().optional(),_dev_simulateFileName:ze.string().optional()}),Ds=vs({name:ir,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[B(Ns)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[n]){let r=n._dev_simulateFileName??e.filename;function t(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let c=Mt.dirname(p);return Mt.resolve(c,i)}function o(i){let p=n.rootDir??process.cwd(),c=Mt.relative(p,i);if(c.startsWith("."))return null;c.startsWith("/")||(c=`/${c}`);for(let{find:a,replacement:u}of n.aliases)if(c.startsWith(u)){let m=c.replace(u,a);return{alias:a,newPath:m}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!t(p))return;let c=s(p,r),a=o(c);!a&&n.allowNotFoundAliases||e.report({node:i,messageId:a?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:a?.alias},fix:a?u=>u.replaceText(i.source,`'${a.newPath}'`):void 0})}}}}),$t={name:ir,rule:Ds};import{AST_NODE_TYPES as me}from"@typescript-eslint/utils";import{z as sr}from"zod/v4";var js=sr.object({customMessage:sr.string().optional()}),_t=q({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[B(js)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[n]){function r(t){switch(t.type){case me.Literal:return!0;case me.ObjectExpression:return t.properties.every(s=>s.type===me.Property?s.computed||s.value.type===me.Identifier&&s.key.type===me.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case me.ArrayExpression:return t.elements.every(s=>s?s.type===me.SpreadElement?!1:r(s):!0);case me.TemplateLiteral:return t.expressions.length===0;case me.ConditionalExpression:case me.LogicalExpression:case me.BinaryExpression:case me.UnaryExpression:case me.CallExpression:case me.MemberExpression:case me.Identifier:case me.ArrowFunctionExpression:case me.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===me.JSXIdentifier&&t.name.name==="style"&&t.value){let s=null;t.value.type===me.JSXExpressionContainer?t.value.expression.type!==me.JSXEmptyExpression&&(s=t.value.expression):t.value.type===me.Literal&&(s=t.value),s&&r(s)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});import{AST_NODE_TYPES as ut}from"@typescript-eslint/utils";import*as Ve from"zod/v4";var Ls=Ve.object({alternativeMsgs:Ve.object({inArrayFind:Ve.string().optional(),inArrayFilter:Ve.string().optional()}).optional(),__dev_simulateFileName:Ve.string().optional()});function Ms(e){return e.typeAnnotation.type!==ut.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var $s=/(typeGuards|type-guards)\.(ts|tsx)$/;function _s(e){return $s.test(e)}function Us(e){let n=e.parent;for(;n;){if(n.type===ut.CallExpression&&n.callee.type===ut.MemberExpression&&n.callee.property.type===ut.Identifier){let r=n.callee.property.name;if(r==="filter"||r==="find")return{method:r}}n=n.parent}return null}var Ut=q({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[B(Ls)],hasSuggestions:!0},defaultOptions:[{}],create(e,[n]){let r=n.__dev_simulateFileName??e.filename;if(_s(r))return{};function t(s){if(!Ms(s))return;let o=Us(s);if(n.alternativeMsgs&&o){let i=o.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(i){let p=o.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":t,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":t,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":t}}});import{AST_NODE_TYPES as qe}from"@typescript-eslint/utils";var zs="no-unnecessary-async-on-jsx-props";function Ws(e){if(e.body.type!==qe.BlockStatement)return!1;let n=e.body.body;if(n.length!==1)return!1;let r=n[0];return!r||r.type!==qe.ExpressionStatement?!1:r.expression.type===qe.AwaitExpression}var zt=q({name:zs,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function n(r){Ws(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(t){let s=e.sourceCode,o=[],i=s.getFirstToken(r,c=>c.value==="async");if(i){let c=s.getTokenAfter(i);c?o.push(t.replaceTextRange([i.range[0],c.range[0]],"")):o.push(t.remove(i))}function p(c){if(c.type===qe.AwaitExpression){let a=s.getFirstToken(c);if(a&&a.value==="await"){let u=s.getTokenAfter(a);u?o.push(t.replaceTextRange([a.range[0],u.range[0]],"")):o.push(t.remove(a))}}if(c.type===qe.BlockStatement)for(let a of c.body)p(a);else c.type===qe.ExpressionStatement&&p(c.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});import{AST_NODE_TYPES as tt,ESLintUtils as ar}from"@typescript-eslint/utils";import*as Wt from"typescript";import nt from"zod/v4";var Js=ar.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),or="no-unnecessary-casting",Vs=nt.object({additionalCastFunctions:nt.array(nt.object({name:nt.string(),expectedType:nt.enum(["string","number"])})).optional()}),Jt={name:or,rule:Js({name:or,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[B(Vs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=ar.getParserServices(e,!0),o=s.program?.getTypeChecker();if(!o||!s.program)throw new Error("TypeScript services or program not available");function i(u,m){switch(u.type){case tt.Literal:return m==="number"?typeof u.value=="number":typeof u.value=="string";case tt.TemplateLiteral:return m==="string";case tt.UnaryExpression:return m==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function p(u,m){return m==="number"?!!(u.flags&Wt.TypeFlags.NumberLike):!!(u.flags&Wt.TypeFlags.StringLike)}function c(u,m){return y=>y.replaceText(u,e.sourceCode.getText(m))}function a(u){if(!o||u.arguments.length!==1)return;let m=u.arguments[0];if(!m||m.type===tt.SpreadElement)return;let{callee:y}=u;if(y.type!==tt.Identifier)return;let C=y.name,f=t.find(x=>x.name===C);if(!f)return;if(i(m,f.expectedType)||p(o.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(m)),f.expectedType)){let x,S;C==="Number"?x="unnecessaryNumberCasting":C==="String"?x="unnecessaryStringCasting":(x="unnecessaryCustomCasting",S={name:f.name,type:f.expectedType}),e.report({node:u,messageId:x,...S?{data:S}:{},fix:c(u,m)})}}return{CallExpression:a}}})};import{AST_NODE_TYPES as we}from"@typescript-eslint/utils";import*as ft from"zod/v4";var Xs=ft.object({ignoreWithDescription:ft.string().optional()}),Vt=q({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[B(Xs)]},defaultOptions:[{}],create(e,[n]){let r=e.getSourceCode(),t=r.ast;function s(c){let a=c.arguments[0];return a&&a.type===we.Literal&&typeof a.value=="string"?a.value:null}function o(c){return!c||!n.ignoreWithDescription?!1:new RegExp(n.ignoreWithDescription).test(c)}function i(c){return c.length!==1?!1:t.body.filter(u=>{if(u.type===we.ExpressionStatement){let m=u.expression;if(m.type===we.CallExpression&&m.callee.type===we.Identifier){let y=m.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(y)}}return!1}).length===0}function p(c){let a=c.arguments[1];if(a&&(a.type===we.FunctionExpression||a.type===we.ArrowFunctionExpression)&&a.body.type===we.BlockStatement){let u=a.body.body;return u.length===0?"":u.map(y=>r.text.slice(y.range[0],y.range[1])).join(`
16
16
 
17
- `)}return""}return{Program(){let a=[];for(let g of t.body)g.type===Re.ExpressionStatement&&g.expression.type===Re.CallExpression&&g.expression.callee.type===Re.Identifier&&g.expression.callee.name==="describe"&&g.expression.arguments.length===2&&a.push(g.expression);if(!i(a))return;let[l]=a;if(!l)return;let u=s(l);if(o(u))return;let d=t.body.find(g=>g.type===Re.ExpressionStatement&&g.expression===l);!d||d.type!==Re.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(g){let x=p(l);return x?g.replaceText(d,x):null}}]})}}}});import{AST_NODE_TYPES as ft}from"@typescript-eslint/utils";import*as Ne from"zod/v4";var Xs=Ne.object({methods:Ne.union([Ne.array(Ne.string()),Ne.literal("array")])}),Jt=q({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[B(Xs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):t.has(p)}function o(p){let{callee:a}=p;if(a.type===ft.MemberExpression){let l=a.property;if(l.type===ft.Identifier)return l.name}return null}function i(p,a){if(p.type!==ft.Identifier||!p.typeAnnotation)return;let l=a.parent;if(l.type===ft.CallExpression){let u=o(l);u&&s(u)&&l.arguments.indexOf(a)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return p.typeAnnotation?g.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let a of p.params)i(a,p)},FunctionExpression(p){for(let a of p.params)i(a,p)}}}});import{AST_NODE_TYPES as Ce}from"@typescript-eslint/utils";var Vt=q({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===Ce.ObjectPattern||!n.init||n.init.type!==Ce.ObjectExpression||n.id.type===Ce.Identifier&&n.id.typeAnnotation||n.parent.parent.type===Ce.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===Ce.Property&&i.key.type===Ce.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==Ce.Identifier)return;let t=Bs(n,e.sourceCode);if(t.length===0)return;let s=n.init.properties.some(i=>i.type!==Ce.Property?!1:i.value.type===Ce.FunctionExpression),o=new Set;for(let i of t){if(i.identifier.parent.type!==Ce.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ce.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==Ce.Identifier)return;o.add(p.property.name)}if(p.parent.type===Ce.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Bs(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as lr}from"zod/v4";var Hs=lr.object({ignoreArgsMatching:lr.string().optional()}),Xt=q({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[B(Hs)]},defaultOptions:[{}],create(e,[n]){let r=[];function t(i){return n.ignoreArgsMatching?new RegExp(n.ignoreArgsMatching).test(i):!1}function s(i){return i.type===te.ExportNamedDeclaration||i.type===te.ExportDefaultDeclaration||i.parent?.type===te.ExportNamedDeclaration||i.parent?.type===te.ExportDefaultDeclaration}function o(i){let p=[];for(let a=0;a<i.length;a++){let l=i[a];if(!l||l.type!==te.Identifier)continue;let u=l.name;if(!t(u)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let d=l.typeAnnotation.typeAnnotation,g=[];for(let x of d.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&g.push({name:x.key.name,optional:x.optional===!0});g.some(x=>x.optional)?p.push({param:l,index:a,name:u,isObjectParam:!0,objectProps:g}):p.push({param:l,index:a,name:u,isObjectParam:!1})}else if(l.optional)p.push({param:l,index:a,name:u,isObjectParam:!1});else if(l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let d=l.typeAnnotation.typeAnnotation,g=[];for(let x of d.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&g.push({name:x.key.name,optional:x.optional===!0});g.some(x=>x.optional)&&p.push({param:l,index:a,name:u,isObjectParam:!0,objectProps:g})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==te.Identifier||!i.init||i.init.type!==te.ArrowFunctionExpression&&i.init.type!==te.FunctionExpression||s(i.parent.parent))return;let a=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let l=i.id.typeAnnotation.typeAnnotation;if(l.typeName.type===te.Identifier&&l.typeName.name==="FC"){let u=l.typeArguments;if(u&&u.params.length===1){let d=u.params[0];if(d&&d.type===te.TSTypeLiteral){let g=[];for(let x of d.members)x.type===te.TSPropertySignature&&x.key.type===te.Identifier&&g.push({name:x.key.name,optional:x.optional===!0});g.some(x=>x.optional)&&a.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:g})}}}}a.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:a})},"Program:exit"(){for(let i of r){let a=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!a)continue;let l=a.references.filter(g=>g.identifier!==a.identifiers[0]);if(l.length===0)continue;let u=!1;for(let g of l){let x=g.identifier.parent;if(x.type===te.CallExpression&&g.identifier.type===te.Identifier&&x.arguments.includes(g.identifier)){u=!0;break}if(x.type===te.ReturnStatement){u=!0;break}if(x.type===te.Property&&x.parent.type===te.ObjectExpression&&x.parent.parent.type===te.ReturnStatement){u=!0;break}if(x.type===te.JSXExpressionContainer){u=!0;break}}if(u)continue;let d=[];for(let g of l){let x=g.identifier.parent;if(x.type===te.CallExpression&&x.callee===g.identifier){let y=x.arguments.length,E=x.arguments.some(f=>f.type===te.SpreadElement);if(E){u=!0;break}let b={argCount:y,hasSpread:E};for(let f of i.optionalParams)if(f.isObjectParam&&f.index<y){let A=x.arguments[f.index];if(A?.type===te.ObjectExpression){let I={};for(let m of A.properties)m.type===te.Property&&m.key.type===te.Identifier&&(I[m.key.name]=!0);b.objectArgs||(b.objectArgs=[]),b.objectArgs[f.index]=I}else if(A){u=!0;break}}d.push(b)}else if(x.type===te.JSXOpeningElement&&x.name===g.identifier){let y=x.attributes.some(b=>b.type===te.JSXSpreadAttribute);if(y){u=!0;break}let E={argCount:1,hasSpread:y};for(let b of i.optionalParams)if(b.isObjectParam&&b.index===0){let f={};for(let A of x.attributes)A.type===te.JSXAttribute&&A.name.type===te.JSXIdentifier&&(f[A.name.name]=!0);E.objectArgs||(E.objectArgs=[]),E.objectArgs[0]=f}d.push(E)}}if(!(u||d.length===0))for(let g of i.optionalParams)if(g.isObjectParam&&g.objectProps)for(let x of g.objectProps){if(!x.optional)continue;let y=!1;for(let E of d)if(E.objectArgs&&E.objectArgs[g.index]){let b=E.objectArgs[g.index];if(b&&b[x.name]){y=!0;break}}y||e.report({node:g.param,messageId:"unusedOptionalProp",data:{name:x.name}})}else{let x=!1;for(let y of d)if(y.argCount>g.index){x=!0;break}x||e.report({node:g.param,messageId:"unusedOptionalArg",data:{name:g.name}})}}}}}});import{AST_NODE_TYPES as le,ESLintUtils as Ys}from"@typescript-eslint/utils";import{z as Be}from"zod/v4";var qs=Be.object({selectors:Be.array(Be.object({name:Be.string(),selectorProp:Be.string().optional(),selectorArgPos:Be.number().optional(),returnProp:Be.string().optional()}))}),Zs=Ys.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-unused-selected-values",Bt={name:pr,rule:Zs({name:pr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[B(qs)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===le.CallExpression&&(o=s.init),!o)return;let i=Ks(o);if(!i)return;let p=t.get(i);if(!p)return;let a=Gs(o,p.selectorArgPos??0,p.selectorProp);if(!a)return;let l=Qs(a);if(!l)return;let u=cr(l.properties,void 0);if(!u)return;if(s.id.type===le.ObjectPattern){let x=cr(s.id.properties,p.returnProp);if(!x)return;for(let[y,E]of u)x.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(s.id.type!==le.Identifier||p.returnProp)return;let d=eo(s,e.sourceCode);if(d.length===0)return;let g=new Set;for(let x of d){if(x.identifier.parent.type!==le.MemberExpression)return;let y=x.identifier.parent.property;if(y.type!==le.Identifier)return;g.add(y.name)}for(let[x,y]of u)g.has(x)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:x}})}}}})};function Gs(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===le.ArrowFunctionExpression||t.type===le.FunctionExpression)return t;if(r&&t.type===le.ObjectExpression){let s=t.properties.find(i=>i.type===le.Property&&i.key.type===le.Identifier&&i.key.name===r);if(s?.type!==le.Property)return null;let o=s.value;if(o.type===le.ArrowFunctionExpression||o.type===le.FunctionExpression)return o}return null}function Ks(e){return e.callee.type===le.Identifier?e.callee.name:e.callee.type===le.MemberExpression&&e.callee.property.type===le.Identifier?e.callee.property.name:null}function Qs(e){if(e.body.type===le.ObjectExpression)return e.body;if(e.body.type===le.BlockStatement){let n=e.body.body.filter(r=>r.type===le.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==le.ObjectExpression?null:n[0].argument}return null}function cr(e,n){let r=e;if(n){let s=e.find(o=>o.type===le.Property&&o.key.type===le.Identifier&&o.key.name===n);if(s?.type!==le.Property||s.value.type!==le.ObjectPattern)return null;r=s.value.properties}let t=new Map;for(let s of r){if(s.type!==le.Property||s.key.type!==le.Identifier)return null;t.set(s.key.name,s)}return t.size>0?t:null}function eo(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var Ht=q({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(o=>o.type===ae.ImportDeclaration&&o.source.value==="t-state-form"))return{};let t=null,s=!1;return{CallExpression(o){if(s)return;if(!t){let p=to(o);p&&(t=p);return}let i=no(o,e.sourceCode);if(i){s=!0;for(let p of i)t.delete(p);if(t.size!==0)for(let[p,a]of t)e.report({node:a,messageId:"unusedField",data:{name:p}})}}}}});function to(e){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ae.ObjectExpression)return null;let t=At(r.properties,o=>o.type!==ae.Property||o.key.type!==ae.Identifier||o.key.name!=="initialConfig"?null:o.value.type===ae.ObjectExpression?o.value:o.value.type===ae.ArrowFunctionExpression||o.value.type===ae.FunctionExpression?ro(o.value):null);if(!t)return null;let s=new Map;for(let o of t.properties)o.type===ae.Property&&o.key.type===ae.Identifier&&s.set(o.key.name,o);return s}function no(e,n){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ae.VariableDeclarator||e.parent.id.type!==ae.ObjectPattern||!At(e.parent.id.properties,i=>i.type===ae.Property&&i.key.type===ae.Identifier&&i.key.name==="formFields"&&i))return null;let s=Jn(e.parent,"formFields",n),o=new Set;for(let{identifier:i}of s){if(i.type!==ae.Identifier||i.parent.type===ae.Property&&i.parent.parent.type===ae.ObjectExpression&&i.parent.parent.parent.type===ae.ReturnStatement||i.parent.type===ae.ReturnStatement)return null;if(i.parent.type===ae.MemberExpression){if(i.parent.object.type!==ae.Identifier||i.parent.property.type!==ae.Identifier)return null;o.add(i.parent.property.name)}}return o}function ro(e){if(e.body.type===ae.ObjectExpression)return e.body;if(e.body.type===ae.BlockStatement){let n=e.body.body.filter(r=>r.type===ae.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==ae.ObjectExpression?null:n[0].argument}return null}import{AST_NODE_TYPES as ie,ESLintUtils as io}from"@typescript-eslint/utils";import{z as mt}from"zod/v4";var so=io.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function ur(e){let n=[];for(let r of e.members)r.type===ie.TSPropertySignature&&r.key.type===ie.Identifier&&n.push([r.key.name,r]);return n}function fr(e,...n){for(let r of n)e.set(...r);return e}var oo=mt.object({forceCheckOnFCPropTypesWithName:mt.array(mt.string()).optional(),alwaysCheckFunctionOptionTypes:mt.boolean().optional()}),mr="no-unused-type-props-in-args",Yt=null,ao=so({name:mr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[B(oo)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!Yt&&(Yt=r.map(a=>new RegExp(a)));function s(a,l,u,d,g=!0,x=!1){let y=u.name,E=e.sourceCode.getScope(l).references.find(m=>m.identifier.name===y)?.resolved,b=a&&Yt?.some(m=>m.test(y)),f=x&&t;if(!E||!b&&E.references.filter(m=>m.isTypeReference).length>1||!E.defs[0])return;let A=E.defs[0].node,I=A.parent?.type===ie.ExportNamedDeclaration;if(!(g&&I&&!f)){if(A.type===ie.TSTypeAliasDeclaration){o(a,l,d,A.typeAnnotation,!0,x);return}if(A.type===ie.TSInterfaceDeclaration){o(a,l,d,A.body,!0,x);return}}}function o(a,l,u,d,g,x=!1){if(d.type===ie.TSInterfaceBody){for(let y of d.body)y.type===ie.TSPropertySignature&&y.key.type===ie.Identifier&&u.set(y.key.name,y);return}if(d.type===ie.TSTypeLiteral){fr(u,...ur(d));return}if(d.type===ie.TSIntersectionType){for(let y of d.types)o(a,l,u,y,!0,x);return}g||d.type===ie.TSTypeReference&&d.typeName.type===ie.Identifier&&s(a,l,d.typeName,u,!0,x)}function i(a,l,u,d=!1){for(let g of u)if(g.type===ie.ObjectPattern&&g.typeAnnotation){let x=new Map;if(o(a,l,x,g.typeAnnotation.typeAnnotation,!1,d),x.size===0)continue;p(g,x)}else g.type===ie.AssignmentPattern&&g.left.type===ie.ObjectPattern&&i(a,l,[g.left],d)}function p(a,l){let u=[];if(a.properties.at(-1)?.type===ie.RestElement)return;for(let y of a.properties)y.type===ie.Property&&y.key.type===ie.Identifier&&u.push(y.key.name);let g=[],x=[];for(let[y,E]of l)u.includes(y)||(x.push(y),g.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of g.entries())e.report({...E,fix:y===g.length-1?b=>{let f=a.properties.at(-1),A=x.join(", ");return f?f.type===ie.RestElement?null:b.insertTextAfter(f,`, ${A}`):b.insertTextBeforeRange([a.range[0]+1,a.range[1]],A)}:void 0})}return{VariableDeclaration(a){let l=a.declarations[0],u=new Map,d=l.id.type===ie.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===ie.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===ie.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(d){if(d.type===ie.TSTypeReference&&d.typeName.type===ie.Identifier)s(!0,a,d.typeName,u,!1);else if(d.type===ie.TSTypeLiteral)fr(u,...ur(d));else if(d.type===ie.TSIntersectionType)for(let g of d.types)g.type===ie.TSTypeReference&&g.typeName.type===ie.Identifier?s(!0,a,g.typeName,u,!1):o(!0,a,u,g,!0);if(u.size!==0&&l.init?.type===ie.ArrowFunctionExpression){let g=l.init.params[0];if(!g){e.report({node:l.init,messageId:"missingComponentParam"});return}g.type===ie.ObjectPattern&&p(g,u)}}},FunctionDeclaration(a){i(!1,a,a.params,t)},ArrowFunctionExpression(a){i(!1,a,a.params,t)}}}}),qt={name:mr,rule:ao};import{AST_NODE_TYPES as Oe}from"@typescript-eslint/utils";var Zt=q({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===Oe.Identifier?n.has(t.callee.name):t.callee.type===Oe.MemberExpression&&t.callee.object.type===Oe.Identifier&&t.callee.property.type===Oe.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let s of t.specifiers)s.type===Oe.ImportSpecifier&&s.imported.type===Oe.Identifier&&s.imported.name==="useRef"&&n.add(s.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===Oe.CallExpression&&r(t.init)&&t.id.type===Oe.Identifier){let o=e.sourceCode.getScope(t).set.get(t.id.name);if(o){let i=!1;for(let p of o.references){let l=p.identifier.parent;if(l!==t&&!(l.type===Oe.JSXExpressionContainer&&l.parent.type===Oe.JSXAttribute&&l.parent.name.type===Oe.JSXIdentifier&&l.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});import{AST_NODE_TYPES as Gt,ESLintUtils as lo}from"@typescript-eslint/utils";var po=lo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="prefer-named-functions",yr=new Map,co=po({name:dr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[n]){let r=null;if(n.ignoreRegex){let t=yr.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),yr.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===Gt.ArrowFunctionExpression&&t.id.type===Gt.Identifier){let s=t.id.name;if(t.id.typeAnnotation||r&&r.test(s)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Gt.BlockStatement)return;let o=t.parent,i=t.init.params,p=t.init.body,a=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:l=>l.replaceText(o,`${a.async?"async ":""}function ${s}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),Kt={name:dr,rule:co};import{AST_NODE_TYPES as Q}from"@typescript-eslint/utils";import{z as $e}from"zod/v4";var uo=$e.object({disallowedFunctions:$e.array($e.object({name:$e.string(),allowUsingWithArgs:$e.boolean().optional(),hookAlternative:$e.string().optional(),message:$e.string().optional(),allowUseInside:$e.array($e.string()).optional()}))}),fo=/^use[A-Z]/,mo=/^[A-Z]/;function yt(e){return fo.test(e)}function gr(e){return mo.test(e)}function yo(e){return e.type===Q.Identifier?yt(e.name):e.type===Q.MemberExpression&&e.property.type===Q.Identifier?yt(e.property.name):!1}function Sr(e,n){return e.type===Q.Identifier?e.name===n:e.type===Q.MemberExpression&&e.object.type===Q.Identifier&&e.property.type===Q.Identifier?e.object.name==="React"&&e.property.name===n:!1}function Tr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Sr(e.parent.callee,"forwardRef"))}function hr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Sr(e.parent.callee,"memo"))}function Qt(e){if(e.type===Q.FunctionDeclaration||e.type===Q.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.FunctionExpression||e.type===Q.ArrowFunctionExpression){if(e.parent.type===Q.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function go(e){let n=e.parent,r=!1;for(;n;){if(n.type===Q.FunctionDeclaration||n.type===Q.FunctionExpression||n.type===Q.ArrowFunctionExpression){let t=Qt(n);if(t&&t.type===Q.Identifier){if(gr(t.name)||yt(t.name))return!r;r=!0}else{if(Tr(n)||hr(n))return!r;if(n.parent.type===Q.CallExpression){let s=n.parent;yo(s.callee)||(r=!0)}else n.parent.type===Q.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Er(e){return e.callee.type===Q.Identifier?e.callee.name:e.callee.type===Q.MemberExpression&&e.callee.property.type===Q.Identifier?e.callee.property.name:null}function So(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.FunctionDeclaration||r.type===Q.FunctionExpression||r.type===Q.ArrowFunctionExpression){let t=Qt(r);if(t&&t.type===Q.Identifier&&n.includes(t.name))return!0}else if(r.type===Q.CallExpression){let t=Er(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function To(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===Q.Identifier&&n.name==="undefined")}function ho(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===Q.FunctionDeclaration||t.type===Q.FunctionExpression||t.type===Q.ArrowFunctionExpression){let s=Qt(t);if(s&&s.type===Q.Identifier){if(gr(s.name)||yt(s.name)){r=!0;break}}else if(Tr(t)||hr(t)){r=!0;break}}t=t.parent}return r?n.length===0?go(e):!So(e,n):!1}var en=q({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[B(uo)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Er(s);if(!o)return;let i=t.get(o);if(!i||i.allowUsingWithArgs&&To(s))return;let p=i.allowUseInside||[];ho(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:a=>{let l=i.hookAlternative;return l?s.callee.type===Q.Identifier?a.replaceText(s.callee,l):s.callee.type===Q.MemberExpression&&s.callee.property.type===Q.Identifier?a.replaceText(s.callee.property,l):null:null}}]:[]})}}}});import{AST_NODE_TYPES as me,AST_TOKEN_TYPES as br,ESLintUtils as Eo}from"@typescript-eslint/utils";import tn from"zod/v4";var bo=Eo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="prefer-single-line-if",xo=tn.object({maxLineLength:tn.number().optional(),maxNonSimpleConditionLength:tn.number().optional()}),Co=bo({name:Cr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[B(xo)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==me.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let o=t.consequent.body[0];if(!o)return;if(o.type===me.ReturnStatement){if(!Ar(o))return}else if(!(o.type===me.ContinueStatement||o.type===me.BreakStatement))return;if(t.test.type===me.LogicalExpression||t.test.type===me.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let d=xr(t.test);if(!d&&t.test.type===me.UnaryExpression&&t.test.operator==="!"){let g=t.test.argument;xr(g)&&(d=!0)}if(d&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let p=r.getText(o);if(i.includes(`
18
- `))return;let a=r.getTokenAfter(t);if(a&&a.type===br.Punctuator&&a.value==="}"){let d=r.getTokenAfter(a);if(d&&d.type===br.Keyword&&(d.value==="else"||d.value==="catch"))return}let l=Io(r,t),u=`if (${i}) ${p}`;n.maxLineLength&&u.length+l.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:d=>d.replaceText(t,u)})}}}});function xr(e){return e.type===me.CallExpression||e.type===me.BinaryExpression||e.type===me.MemberExpression&&Ir(e)}function Ir(e){return e.object.type===me.MemberExpression?Ir(e.object):e.object.type!==me.Identifier}function Io(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}function Ar(e){if(!e.argument)return!0;let n=e.argument;return n.type===me.ArrayExpression&&n.elements.length===0||n.type===me.ObjectExpression&&n.properties.length===0||n.type===me.Literal||n.type===me.Identifier||n.type===me.TemplateLiteral||n.type===me.TaggedTemplateExpression?!0:n.type===me.CallExpression?n.arguments.length===0:n.type===me.UnaryExpression?Ar(n):!1}var nn={name:Cr,rule:Co};import{AST_NODE_TYPES as z,ESLintUtils as Ao}from"@typescript-eslint/utils";import{z as wr}from"zod/v4";var wo=Ao.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="react-compiler-extra",Ro=wr.object({runOnlyWithEnableCompilerDirective:wr.boolean().optional()}),Fo=/eslint +react-compiler\/react-compiler: +\["error/;function vr(e){return e.type===z.Identifier?e.name.startsWith("use"):!1}function ko(e){return e.type===z.Identifier?e.name.startsWith("use"):e.type===z.MemberExpression&&e.property.type===z.Identifier?e.property.name.startsWith("use"):!1}function De(e){if(!e)return!1;switch(e.type){case z.JSXElement:case z.JSXFragment:return!0;case z.ConditionalExpression:return De(e.consequent)||De(e.alternate);case z.LogicalExpression:return e.operator==="&&"?De(e.right):e.operator==="||"?De(e.left)||De(e.right):!1;case z.CallExpression:if(e.callee.type===z.MemberExpression&&e.callee.object.type===z.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===z.Identifier&&e.callee.property.name==="createElement")return!0;for(let n of e.arguments)if(n.type!==z.SpreadElement&&De(n))return!0;return!1;default:return!1}}function Po(e){let n=e.typeAnnotation;if(n.type===z.TSTypeReference){if(n.typeName.type===z.Identifier)return n.typeName.name==="FC";if(n.typeName.type===z.TSQualifiedName&&n.typeName.left.type===z.Identifier&&n.typeName.right.type===z.Identifier)return n.typeName.left.name==="React"&&n.typeName.right.name==="FC"}return!1}var vo=/^[A-Z][a-zA-Z0-9]*$/;function rt(e){return vo.test(e)}function sn(e){return e.startsWith("use")&&e.length>3}function on(e,n,r,t){if(r&&Po(r))return n?rt(n.name):e.type===z.FunctionDeclaration&&e.id?rt(e.id.name):!0;if(n&&sn(n.name)||e.type===z.FunctionDeclaration&&e.id&&sn(e.id.name))return!0;if(t){let s=n?.name||e.type===z.FunctionDeclaration&&e.id?.name;if(s&&rt(s)&&Or(e.body,t).containsJSX)return!0}return!1}function nt(e){if(e.body.type===z.BlockStatement){for(let n of e.body.body)if(n.type===z.ExpressionStatement&&n.expression.type===z.Literal&&typeof n.expression.value=="string"&&n.expression.value==="use memo")return!0}return!1}function Or(e,n){let r={containsJSX:!1,containsHookCalls:!1};return ve(e,t=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(t.type){case z.JSXElement:case z.JSXFragment:r.containsJSX=!0;break;case z.CallExpression:vr(t.callee)&&(r.containsHookCalls=!0),De(t)&&(r.containsJSX=!0);break;case z.ReturnStatement:t.argument&&De(t.argument)&&(r.containsJSX=!0);break;case z.VariableDeclarator:t.init&&De(t.init)&&(r.containsJSX=!0);break;case z.AssignmentExpression:De(t.right)&&(r.containsJSX=!0);break}},n),r}function Rr(e,n){let r=e.body,t=Or(r,n);return t.containsJSX||t.containsHookCalls}var Oo=/\bthis[.[]/;function Fr(e){return Oo.test(e)}function No(e,n){let r={containsJSX:!1,containsHookCalls:!1};return ve(e,t=>{if(r.containsHookCalls||(t.type===z.FunctionDeclaration||t.type===z.FunctionExpression||t.type===z.ArrowFunctionExpression)&&t!==e)return!0;t.type===z.CallExpression&&ko(t.callee)&&(r.containsHookCalls=!0)},n),r}function kr(e){return rt(e)||sn(e)}function rn(e,n,r,t){if(!No(e.body,n).containsHookCalls)return!1;let o=on(e,r,t,n);if(!o&&t){let i=r?.name||e.type===z.FunctionDeclaration&&e.id?.name;i&&rt(i)&&(o=!0)}return!o}var Do=wo({name:Pr,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:'React components and hooks should create JSX elements, call other hooks or use the "use memo" directive for optimal React compiler detection.',addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization',functionCallingHooksMustBeComponent:'Functions calling hooks must be React components (PascalCase with FC type) or hooks (start with "use").',useMemoDirectiveNaming:'Functions using "use memo" directive must follow React naming conventions (PascalCase for components or start with "use" for hooks).'},hasSuggestions:!0,schema:[B(Ro)]},defaultOptions:[{}],create(e,[n]){let r=!1;if(n.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(Fo.test(o.value)){r=!0;break}if(!r)return{}}function t(o){for(let i of o.properties)if(i.type===z.Property&&i.method&&i.value.type===z.FunctionExpression){let p=e.sourceCode,a=p.getText(i.key),l=i.value,u=p.getText(l.body);if(Fr(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let d=l.params.map(x=>p.getText(x)).join(", "),g="";l.generator?g=`${a}: function* (${d}) ${u}`:g=`${a}: (${d}) => ${u}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:x=>x.replaceText(i,g)})}}}function s(o){for(let i of o.properties)if(i.type===z.Property&&i.value.type===z.ObjectExpression){for(let p of i.value.properties)if(p.type===z.Property&&p.method&&p.value.type===z.FunctionExpression){let l=e.sourceCode.getText(p.value.body);Fr(l)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(vr(o.callee))for(let i of o.arguments){if(i.type===z.ObjectExpression&&(t(i),s(i)),i.type===z.ArrowFunctionExpression&&(i.body.type===z.ObjectExpression&&(t(i.body),s(i.body)),i.body.type===z.BlockStatement))for(let p of i.body.body)p.type===z.ReturnStatement&&p.argument?.type===z.ObjectExpression&&(t(p.argument),s(p.argument));if(i.type===z.FunctionExpression)for(let p of i.body.body)p.type===z.ReturnStatement&&p.argument?.type===z.ObjectExpression&&(t(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===z.Identifier&&o.init&&(o.init.type===z.ArrowFunctionExpression||o.init.type===z.FunctionExpression)){let i=o.init,p=o.id,a=o.id.typeAnnotation;if(nt(i)&&!kr(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(rn(i,e.sourceCode,p,a)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(on(i,p,a,e.sourceCode)){let l=Rr(i,e.sourceCode),u=nt(i);!l&&!u&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(d){if(i.body.type===z.BlockStatement){let g=i.body.range[0]+1;return d.insertTextAfterRange([g,g],`
17
+ `)}return""}return{Program(){let c=[];for(let y of t.body)y.type===we.ExpressionStatement&&y.expression.type===we.CallExpression&&y.expression.callee.type===we.Identifier&&y.expression.callee.name==="describe"&&y.expression.arguments.length===2&&c.push(y.expression);if(!i(c))return;let[a]=c;if(!a)return;let u=s(a);if(o(u))return;let m=t.body.find(y=>y.type===we.ExpressionStatement&&y.expression===a);!m||m.type!==we.ExpressionStatement||e.report({node:a,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(y){let C=p(a);return C?y.replaceText(m,C):null}}]})}}}});import{AST_NODE_TYPES as mt}from"@typescript-eslint/utils";import*as Oe from"zod/v4";var Bs=Oe.object({methods:Oe.union([Oe.array(Oe.string()),Oe.literal("array")])}),Xt=q({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[B(Bs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let r=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):t.has(p)}function o(p){let{callee:c}=p;if(c.type===mt.MemberExpression){let a=c.property;if(a.type===mt.Identifier)return a.name}return null}function i(p,c){if(p.type!==mt.Identifier||!p.typeAnnotation)return;let a=c.parent;if(a.type===mt.CallExpression){let u=o(a);u&&s(u)&&a.arguments.indexOf(c)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(y){return p.typeAnnotation?y.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let c of p.params)i(c,p)},FunctionExpression(p){for(let c of p.params)i(c,p)}}}});import{AST_NODE_TYPES as Ce}from"@typescript-eslint/utils";var Bt=q({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(n){if(n.id.type===Ce.ObjectPattern||!n.init||n.init.type!==Ce.ObjectExpression||n.id.type===Ce.Identifier&&n.id.typeAnnotation||n.parent.parent.type===Ce.ExportNamedDeclaration)return;let r=new Map;for(let i of n.init.properties)i.type===Ce.Property&&i.key.type===Ce.Identifier&&r.set(i.key.name,i);if(r.size===0||n.id.type!==Ce.Identifier)return;let t=Hs(n,e.sourceCode);if(t.length===0)return;let s=n.init.properties.some(i=>i.type!==Ce.Property?!1:i.value.type===Ce.FunctionExpression),o=new Set;for(let i of t){if(i.identifier.parent.type!==Ce.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ce.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==Ce.Identifier)return;o.add(p.property.name)}if(p.parent.type===Ce.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Hs(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}import{AST_NODE_TYPES as te}from"@typescript-eslint/utils";import{z as lr}from"zod/v4";var Ys=lr.object({ignoreArgsMatching:lr.string().optional()}),Ht=q({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[B(Ys)]},defaultOptions:[{}],create(e,[n]){let r=[];function t(i){return n.ignoreArgsMatching?new RegExp(n.ignoreArgsMatching).test(i):!1}function s(i){return i.type===te.ExportNamedDeclaration||i.type===te.ExportDefaultDeclaration||i.parent?.type===te.ExportNamedDeclaration||i.parent?.type===te.ExportDefaultDeclaration}function o(i){let p=[];for(let c=0;c<i.length;c++){let a=i[c];if(!a||a.type!==te.Identifier)continue;let u=a.name;if(!t(u)){if(a.optional&&a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.TSPropertySignature&&C.key.type===te.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)?p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y}):p.push({param:a,index:c,name:u,isObjectParam:!1})}else if(a.optional)p.push({param:a,index:c,name:u,isObjectParam:!1});else if(a.typeAnnotation&&a.typeAnnotation.typeAnnotation.type===te.TSTypeLiteral){let m=a.typeAnnotation.typeAnnotation,y=[];for(let C of m.members)C.type===te.TSPropertySignature&&C.key.type===te.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&p.push({param:a,index:c,name:u,isObjectParam:!0,objectProps:y})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=o(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==te.Identifier||!i.init||i.init.type!==te.ArrowFunctionExpression&&i.init.type!==te.FunctionExpression||s(i.parent.parent))return;let c=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.TSTypeReference){let a=i.id.typeAnnotation.typeAnnotation;if(a.typeName.type===te.Identifier&&a.typeName.name==="FC"){let u=a.typeArguments;if(u&&u.params.length===1){let m=u.params[0];if(m&&m.type===te.TSTypeLiteral){let y=[];for(let C of m.members)C.type===te.TSPropertySignature&&C.key.type===te.Identifier&&y.push({name:C.key.name,optional:C.optional===!0});y.some(C=>C.optional)&&c.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:y})}}}}c.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:c})},"Program:exit"(){for(let i of r){let c=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!c)continue;let a=c.references.filter(y=>y.identifier!==c.identifiers[0]);if(a.length===0)continue;let u=!1;for(let y of a){let C=y.identifier.parent;if(C.type===te.CallExpression&&y.identifier.type===te.Identifier&&C.arguments.includes(y.identifier)){u=!0;break}if(C.type===te.ReturnStatement){u=!0;break}if(C.type===te.Property&&C.parent.type===te.ObjectExpression&&C.parent.parent.type===te.ReturnStatement){u=!0;break}if(C.type===te.JSXExpressionContainer){u=!0;break}}if(u)continue;let m=[];for(let y of a){let C=y.identifier.parent;if(C.type===te.CallExpression&&C.callee===y.identifier){let f=C.arguments.length,E=C.arguments.some(S=>S.type===te.SpreadElement);if(E){u=!0;break}let x={argCount:f,hasSpread:E};for(let S of i.optionalParams)if(S.isObjectParam&&S.index<f){let I=C.arguments[S.index];if(I?.type===te.ObjectExpression){let A={};for(let T of I.properties)T.type===te.Property&&T.key.type===te.Identifier&&(A[T.key.name]=!0);x.objectArgs||(x.objectArgs=[]),x.objectArgs[S.index]=A}else if(I){u=!0;break}}m.push(x)}else if(C.type===te.JSXOpeningElement&&C.name===y.identifier){let f=C.attributes.some(x=>x.type===te.JSXSpreadAttribute);if(f){u=!0;break}let E={argCount:1,hasSpread:f};for(let x of i.optionalParams)if(x.isObjectParam&&x.index===0){let S={};for(let I of C.attributes)I.type===te.JSXAttribute&&I.name.type===te.JSXIdentifier&&(S[I.name.name]=!0);E.objectArgs||(E.objectArgs=[]),E.objectArgs[0]=S}m.push(E)}}if(!(u||m.length===0))for(let y of i.optionalParams)if(y.isObjectParam&&y.objectProps)for(let C of y.objectProps){if(!C.optional)continue;let f=!1;for(let E of m)if(E.objectArgs&&E.objectArgs[y.index]){let x=E.objectArgs[y.index];if(x&&x[C.name]){f=!0;break}}f||e.report({node:y.param,messageId:"unusedOptionalProp",data:{name:C.name}})}else{let C=!1;for(let f of m)if(f.argCount>y.index){C=!0;break}C||e.report({node:y.param,messageId:"unusedOptionalArg",data:{name:y.name}})}}}}}});import{AST_NODE_TYPES as le,ESLintUtils as qs}from"@typescript-eslint/utils";import{z as Xe}from"zod/v4";var Zs=Xe.object({selectors:Xe.array(Xe.object({name:Xe.string(),selectorProp:Xe.string().optional(),selectorArgPos:Xe.number().optional(),returnProp:Xe.string().optional()}))}),Gs=qs.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-unused-selected-values",Yt={name:pr,rule:Gs({name:pr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[B(Zs)]},defaultOptions:[{selectors:[]}],create(e,[n]){let{selectors:r=[]}=n,t=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===le.CallExpression&&(o=s.init),!o)return;let i=Qs(o);if(!i)return;let p=t.get(i);if(!p)return;let c=Ks(o,p.selectorArgPos??0,p.selectorProp);if(!c)return;let a=eo(c);if(!a)return;let u=cr(a.properties,void 0);if(!u)return;if(s.id.type===le.ObjectPattern){let C=cr(s.id.properties,p.returnProp);if(!C)return;for(let[f,E]of u)C.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==le.Identifier||p.returnProp)return;let m=to(s,e.sourceCode);if(m.length===0)return;let y=new Set;for(let C of m){if(C.identifier.parent.type!==le.MemberExpression)return;let f=C.identifier.parent.property;if(f.type!==le.Identifier)return;y.add(f.name)}for(let[C,f]of u)y.has(C)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:C}})}}}})};function Ks(e,n,r){let t=e.arguments[n];if(!t)return null;if(t.type===le.ArrowFunctionExpression||t.type===le.FunctionExpression)return t;if(r&&t.type===le.ObjectExpression){let s=t.properties.find(i=>i.type===le.Property&&i.key.type===le.Identifier&&i.key.name===r);if(s?.type!==le.Property)return null;let o=s.value;if(o.type===le.ArrowFunctionExpression||o.type===le.FunctionExpression)return o}return null}function Qs(e){return e.callee.type===le.Identifier?e.callee.name:e.callee.type===le.MemberExpression&&e.callee.property.type===le.Identifier?e.callee.property.name:null}function eo(e){if(e.body.type===le.ObjectExpression)return e.body;if(e.body.type===le.BlockStatement){let n=e.body.body.filter(r=>r.type===le.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==le.ObjectExpression?null:n[0].argument}return null}function cr(e,n){let r=e;if(n){let s=e.find(o=>o.type===le.Property&&o.key.type===le.Identifier&&o.key.name===n);if(s?.type!==le.Property||s.value.type!==le.ObjectPattern)return null;r=s.value.properties}let t=new Map;for(let s of r){if(s.type!==le.Property||s.key.type!==le.Identifier)return null;t.set(s.key.name,s)}return t.size>0?t:null}function to(e,n){let r=n.getDeclaredVariables(e);if(r.length!==1)return[];let t=r[0];return t?t.references.filter(s=>s.identifier!==e.id):[]}import{AST_NODE_TYPES as ae}from"@typescript-eslint/utils";var qt=q({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(o=>o.type===ae.ImportDeclaration&&o.source.value==="t-state-form"))return{};let t=null,s=!1;return{CallExpression(o){if(s)return;if(!t){let p=no(o);p&&(t=p);return}let i=ro(o,e.sourceCode);if(i){s=!0;for(let p of i)t.delete(p);if(t.size!==0)for(let[p,c]of t)e.report({node:c,messageId:"unusedField",data:{name:p}})}}}}});function no(e){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==ae.ObjectExpression)return null;let t=Rt(r.properties,o=>o.type!==ae.Property||o.key.type!==ae.Identifier||o.key.name!=="initialConfig"?null:o.value.type===ae.ObjectExpression?o.value:o.value.type===ae.ArrowFunctionExpression||o.value.type===ae.FunctionExpression?io(o.value):null);if(!t)return null;let s=new Map;for(let o of t.properties)o.type===ae.Property&&o.key.type===ae.Identifier&&s.set(o.key.name,o);return s}function ro(e,n){if(!(e.callee.type===ae.Identifier&&e.callee.name==="useFormState")||e.parent.type!==ae.VariableDeclarator||e.parent.id.type!==ae.ObjectPattern||!Rt(e.parent.id.properties,i=>i.type===ae.Property&&i.key.type===ae.Identifier&&i.key.name==="formFields"&&i))return null;let s=Jn(e.parent,"formFields",n),o=new Set;for(let{identifier:i}of s){if(i.type!==ae.Identifier||i.parent.type===ae.Property&&i.parent.parent.type===ae.ObjectExpression&&i.parent.parent.parent.type===ae.ReturnStatement||i.parent.type===ae.ReturnStatement)return null;if(i.parent.type===ae.MemberExpression){if(i.parent.object.type!==ae.Identifier||i.parent.property.type!==ae.Identifier)return null;o.add(i.parent.property.name)}}return o}function io(e){if(e.body.type===ae.ObjectExpression)return e.body;if(e.body.type===ae.BlockStatement){let n=e.body.body.filter(r=>r.type===ae.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==ae.ObjectExpression?null:n[0].argument}return null}import{AST_NODE_TYPES as ie,ESLintUtils as so}from"@typescript-eslint/utils";import{z as yt}from"zod/v4";var oo=so.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function ur(e){let n=[];for(let r of e.members)r.type===ie.TSPropertySignature&&r.key.type===ie.Identifier&&n.push([r.key.name,r]);return n}function fr(e,...n){for(let r of n)e.set(...r);return e}var ao=yt.object({forceCheckOnFCPropTypesWithName:yt.array(yt.string()).optional(),alwaysCheckFunctionOptionTypes:yt.boolean().optional()}),mr="no-unused-type-props-in-args",Zt=null,lo=oo({name:mr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[B(ao)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[n]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:t=!0}=n;r&&!Zt&&(Zt=r.map(c=>new RegExp(c)));function s(c,a,u,m,y=!0,C=!1){let f=u.name,E=e.sourceCode.getScope(a).references.find(T=>T.identifier.name===f)?.resolved,x=c&&Zt?.some(T=>T.test(f)),S=C&&t;if(!E||!x&&E.references.filter(T=>T.isTypeReference).length>1||!E.defs[0])return;let I=E.defs[0].node,A=I.parent?.type===ie.ExportNamedDeclaration;if(!(y&&A&&!S)){if(I.type===ie.TSTypeAliasDeclaration){o(c,a,m,I.typeAnnotation,!0,C);return}if(I.type===ie.TSInterfaceDeclaration){o(c,a,m,I.body,!0,C);return}}}function o(c,a,u,m,y,C=!1){if(m.type===ie.TSInterfaceBody){for(let f of m.body)f.type===ie.TSPropertySignature&&f.key.type===ie.Identifier&&u.set(f.key.name,f);return}if(m.type===ie.TSTypeLiteral){fr(u,...ur(m));return}if(m.type===ie.TSIntersectionType){for(let f of m.types)o(c,a,u,f,!0,C);return}y||m.type===ie.TSTypeReference&&m.typeName.type===ie.Identifier&&s(c,a,m.typeName,u,!0,C)}function i(c,a,u,m=!1){for(let y of u)if(y.type===ie.ObjectPattern&&y.typeAnnotation){let C=new Map;if(o(c,a,C,y.typeAnnotation.typeAnnotation,!1,m),C.size===0)continue;p(y,C)}else y.type===ie.AssignmentPattern&&y.left.type===ie.ObjectPattern&&i(c,a,[y.left],m)}function p(c,a){let u=[];if(c.properties.at(-1)?.type===ie.RestElement)return;for(let f of c.properties)f.type===ie.Property&&f.key.type===ie.Identifier&&u.push(f.key.name);let y=[],C=[];for(let[f,E]of a)u.includes(f)||(C.push(f),y.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,E]of y.entries())e.report({...E,fix:f===y.length-1?x=>{let S=c.properties.at(-1),I=C.join(", ");return S?S.type===ie.RestElement?null:x.insertTextAfter(S,`, ${I}`):x.insertTextBeforeRange([c.range[0]+1,c.range[1]],I)}:void 0})}return{VariableDeclaration(c){let a=c.declarations[0],u=new Map,m=a.id.type===ie.Identifier&&a.id.typeAnnotation?.typeAnnotation.type===ie.TSTypeReference&&a.id.typeAnnotation.typeAnnotation.typeName.type===ie.Identifier&&a.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&a.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===ie.TSTypeReference&&m.typeName.type===ie.Identifier)s(!0,c,m.typeName,u,!1);else if(m.type===ie.TSTypeLiteral)fr(u,...ur(m));else if(m.type===ie.TSIntersectionType)for(let y of m.types)y.type===ie.TSTypeReference&&y.typeName.type===ie.Identifier?s(!0,c,y.typeName,u,!1):o(!0,c,u,y,!0);if(u.size!==0&&a.init?.type===ie.ArrowFunctionExpression){let y=a.init.params[0];if(!y){e.report({node:a.init,messageId:"missingComponentParam"});return}y.type===ie.ObjectPattern&&p(y,u)}}},FunctionDeclaration(c){i(!1,c,c.params,t)},ArrowFunctionExpression(c){i(!1,c,c.params,t)}}}}),Gt={name:mr,rule:lo};import{AST_NODE_TYPES as ve}from"@typescript-eslint/utils";var Kt=q({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let n=new Set;function r(t){return t.callee.type===ve.Identifier?n.has(t.callee.name):t.callee.type===ve.MemberExpression&&t.callee.object.type===ve.Identifier&&t.callee.property.type===ve.Identifier?t.callee.property.name==="useRef":!1}return{ImportDeclaration(t){if(t.source.value==="react")for(let s of t.specifiers)s.type===ve.ImportSpecifier&&s.imported.type===ve.Identifier&&s.imported.name==="useRef"&&n.add(s.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ve.CallExpression&&r(t.init)&&t.id.type===ve.Identifier){let o=e.sourceCode.getScope(t).set.get(t.id.name);if(o){let i=!1;for(let p of o.references){let a=p.identifier.parent;if(a!==t&&!(a.type===ve.JSXExpressionContainer&&a.parent.type===ve.JSXAttribute&&a.parent.name.type===ve.JSXIdentifier&&a.parent.name.name==="ref")){i=!0;break}}i||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});import{AST_NODE_TYPES as Qt,ESLintUtils as po}from"@typescript-eslint/utils";var co=po.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="prefer-named-functions",yr=new Map,uo=co({name:dr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[n]){let r=null;if(n.ignoreRegex){let t=yr.get(n.ignoreRegex);t?r=t:(r=new RegExp(n.ignoreRegex),yr.set(n.ignoreRegex,r))}return{VariableDeclarator(t){if(t.init&&t.init.type===Qt.ArrowFunctionExpression&&t.id.type===Qt.Identifier){let s=t.id.name;if(t.id.typeAnnotation||r&&r.test(s)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Qt.BlockStatement)return;let o=t.parent,i=t.init.params,p=t.init.body,c=t.init;e.report({node:t.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:a=>a.replaceText(o,`${c.async?"async ":""}function ${s}(${i.map(u=>e.sourceCode.getText(u)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),en={name:dr,rule:uo};import{AST_NODE_TYPES as Q}from"@typescript-eslint/utils";import{z as Me}from"zod/v4";var fo=Me.object({disallowedFunctions:Me.array(Me.object({name:Me.string(),allowUsingWithArgs:Me.boolean().optional(),hookAlternative:Me.string().optional(),message:Me.string().optional(),allowUseInside:Me.array(Me.string()).optional()}))}),mo=/^use[A-Z]/,yo=/^[A-Z]/;function dt(e){return mo.test(e)}function gr(e){return yo.test(e)}function go(e){return e.type===Q.Identifier?dt(e.name):e.type===Q.MemberExpression&&e.property.type===Q.Identifier?dt(e.property.name):!1}function Sr(e,n){return e.type===Q.Identifier?e.name===n:e.type===Q.MemberExpression&&e.object.type===Q.Identifier&&e.property.type===Q.Identifier?e.object.name==="React"&&e.property.name===n:!1}function Tr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Sr(e.parent.callee,"forwardRef"))}function hr(e){return!!(e.parent&&e.parent.type===Q.CallExpression&&Sr(e.parent.callee,"memo"))}function tn(e){if(e.type===Q.FunctionDeclaration||e.type===Q.FunctionExpression&&e.id)return e.id||void 0;if(e.type===Q.FunctionExpression||e.type===Q.ArrowFunctionExpression){if(e.parent.type===Q.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===Q.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===Q.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===Q.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function So(e){let n=e.parent,r=!1;for(;n;){if(n.type===Q.FunctionDeclaration||n.type===Q.FunctionExpression||n.type===Q.ArrowFunctionExpression){let t=tn(n);if(t&&t.type===Q.Identifier){if(gr(t.name)||dt(t.name))return!r;r=!0}else{if(Tr(n)||hr(n))return!r;if(n.parent.type===Q.CallExpression){let s=n.parent;go(s.callee)||(r=!0)}else n.parent.type===Q.JSXExpressionContainer||(r=!0)}}n=n.parent}return!1}function Er(e){return e.callee.type===Q.Identifier?e.callee.name:e.callee.type===Q.MemberExpression&&e.callee.property.type===Q.Identifier?e.callee.property.name:null}function To(e,n){if(!n.length)return!1;let r=e.parent;for(;r;){if(r.type===Q.FunctionDeclaration||r.type===Q.FunctionExpression||r.type===Q.ArrowFunctionExpression){let t=tn(r);if(t&&t.type===Q.Identifier&&n.includes(t.name))return!0}else if(r.type===Q.CallExpression){let t=Er(r);if(t&&n.includes(t))return!0}r=r.parent}return!1}function ho(e){return e.arguments.length>0&&!e.arguments.every(n=>n.type===Q.Identifier&&n.name==="undefined")}function Eo(e,n){let r=!1,t=e.parent;for(;t;){if(t.type===Q.FunctionDeclaration||t.type===Q.FunctionExpression||t.type===Q.ArrowFunctionExpression){let s=tn(t);if(s&&s.type===Q.Identifier){if(gr(s.name)||dt(s.name)){r=!0;break}}else if(Tr(t)||hr(t)){r=!0;break}}t=t.parent}return r?n.length===0?So(e):!To(e,n):!1}var nn=q({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[B(fo)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[n]){let{disallowedFunctions:r}=n,t=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Er(s);if(!o)return;let i=t.get(o);if(!i||i.allowUsingWithArgs&&ho(s))return;let p=i.allowUseInside||[];Eo(s,p)&&e.report({node:s,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:c=>{let a=i.hookAlternative;return a?s.callee.type===Q.Identifier?c.replaceText(s.callee,a):s.callee.type===Q.MemberExpression&&s.callee.property.type===Q.Identifier?c.replaceText(s.callee.property,a):null:null}}]:[]})}}}});import{AST_NODE_TYPES as ye,AST_TOKEN_TYPES as br,ESLintUtils as bo}from"@typescript-eslint/utils";import rn from"zod/v4";var xo=bo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="prefer-single-line-if",Co=rn.object({maxLineLength:rn.number().optional(),maxNonSimpleConditionLength:rn.number().optional()}),Io=xo({name:Cr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[B(Co)]},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==ye.BlockStatement||t.loc.start.line===t.loc.end.line||r.getCommentsInside(t.consequent).length>0||t.alternate||t.consequent.body.length!==1)return;let o=t.consequent.body[0];if(!o)return;if(o.type===ye.ReturnStatement){if(!Ar(o))return}else if(!(o.type===ye.ContinueStatement||o.type===ye.BreakStatement))return;if(t.test.type===ye.LogicalExpression||t.test.type===ye.ConditionalExpression)return;let i;if(n.maxNonSimpleConditionLength){let m=xr(t.test);if(!m&&t.test.type===ye.UnaryExpression&&t.test.operator==="!"){let y=t.test.argument;xr(y)&&(m=!0)}if(m&&(i=r.getText(t.test),i.length>n.maxNonSimpleConditionLength))return}i||(i=r.getText(t.test));let p=r.getText(o);if(i.includes(`
18
+ `))return;let c=r.getTokenAfter(t);if(c&&c.type===br.Punctuator&&c.value==="}"){let m=r.getTokenAfter(c);if(m&&m.type===br.Keyword&&(m.value==="else"||m.value==="catch"))return}let a=Ao(r,t),u=`if (${i}) ${p}`;n.maxLineLength&&u.length+a.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:m=>m.replaceText(t,u)})}}}});function xr(e){return e.type===ye.CallExpression||e.type===ye.BinaryExpression||e.type===ye.MemberExpression&&Ir(e)}function Ir(e){return e.object.type===ye.MemberExpression?Ir(e.object):e.object.type!==ye.Identifier}function Ao(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}function Ar(e){if(!e.argument)return!0;let n=e.argument;return n.type===ye.ArrayExpression&&n.elements.length===0||n.type===ye.ObjectExpression&&n.properties.length===0||n.type===ye.Literal||n.type===ye.Identifier||n.type===ye.TemplateLiteral||n.type===ye.TaggedTemplateExpression?!0:n.type===ye.CallExpression?n.arguments.length===0:n.type===ye.UnaryExpression?Ar(n):!1}var sn={name:Cr,rule:Io};import{AST_NODE_TYPES as z,ESLintUtils as wo}from"@typescript-eslint/utils";import{z as wr}from"zod/v4";var Ro=wo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pr="react-compiler-extra",Fo=wr.object({runOnlyWithEnableCompilerDirective:wr.boolean().optional()}),ko=/eslint +react-compiler\/react-compiler: +\["error/;function vr(e){return e.type===z.Identifier?e.name.startsWith("use"):!1}function Po(e){return e.type===z.Identifier?e.name.startsWith("use"):e.type===z.MemberExpression&&e.property.type===z.Identifier?e.property.name.startsWith("use"):!1}function Ne(e){if(!e)return!1;switch(e.type){case z.JSXElement:case z.JSXFragment:return!0;case z.ConditionalExpression:return Ne(e.consequent)||Ne(e.alternate);case z.LogicalExpression:return e.operator==="&&"?Ne(e.right):e.operator==="||"?Ne(e.left)||Ne(e.right):!1;case z.CallExpression:if(e.callee.type===z.MemberExpression&&e.callee.object.type===z.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===z.Identifier&&e.callee.property.name==="createElement")return!0;for(let n of e.arguments)if(n.type!==z.SpreadElement&&Ne(n))return!0;return!1;default:return!1}}function vo(e){let n=e.typeAnnotation;if(n.type===z.TSTypeReference){if(n.typeName.type===z.Identifier)return n.typeName.name==="FC";if(n.typeName.type===z.TSQualifiedName&&n.typeName.left.type===z.Identifier&&n.typeName.right.type===z.Identifier)return n.typeName.left.name==="React"&&n.typeName.right.name==="FC"}return!1}var Oo=/^[A-Z][a-zA-Z0-9]*$/;function it(e){return Oo.test(e)}function an(e){return e.startsWith("use")&&e.length>3}function ln(e,n,r,t){if(r&&vo(r))return n?it(n.name):e.type===z.FunctionDeclaration&&e.id?it(e.id.name):!0;if(n&&an(n.name)||e.type===z.FunctionDeclaration&&e.id&&an(e.id.name))return!0;if(t){let s=n?.name||e.type===z.FunctionDeclaration&&e.id?.name;if(s&&it(s)&&Or(e.body,t).containsJSX)return!0}return!1}function rt(e){if(e.body.type===z.BlockStatement){for(let n of e.body.body)if(n.type===z.ExpressionStatement&&n.expression.type===z.Literal&&typeof n.expression.value=="string"&&n.expression.value==="use memo")return!0}return!1}function Or(e,n){let r={containsJSX:!1,containsHookCalls:!1};return Pe(e,t=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(t.type){case z.JSXElement:case z.JSXFragment:r.containsJSX=!0;break;case z.CallExpression:vr(t.callee)&&(r.containsHookCalls=!0),Ne(t)&&(r.containsJSX=!0);break;case z.ReturnStatement:t.argument&&Ne(t.argument)&&(r.containsJSX=!0);break;case z.VariableDeclarator:t.init&&Ne(t.init)&&(r.containsJSX=!0);break;case z.AssignmentExpression:Ne(t.right)&&(r.containsJSX=!0);break}},n),r}function Rr(e,n){let r=e.body,t=Or(r,n);return t.containsJSX||t.containsHookCalls}var No=/\bthis[.[]/;function Fr(e){return No.test(e)}function Do(e,n){let r={containsJSX:!1,containsHookCalls:!1};return Pe(e,t=>{if(r.containsHookCalls||(t.type===z.FunctionDeclaration||t.type===z.FunctionExpression||t.type===z.ArrowFunctionExpression)&&t!==e)return!0;t.type===z.CallExpression&&Po(t.callee)&&(r.containsHookCalls=!0)},n),r}function kr(e){return it(e)||an(e)}function on(e,n,r,t){if(!Do(e.body,n).containsHookCalls)return!1;let o=ln(e,r,t,n);if(!o&&t){let i=r?.name||e.type===z.FunctionDeclaration&&e.id?.name;i&&it(i)&&(o=!0)}return!o}var jo=Ro({name:Pr,meta:{type:"suggestion",fixable:"code",docs:{description:"Extra rules to enforce best practices when using the React compiler"},messages:{objectMethodIsNotSupported:"Object methods such as `{ method() {} }` have limited support to optimizations in the React compiler, use a function expression `{ method: () => {} }` instead.",replaceWithFunctionExpression:"Replace with function expression",thisKeywordInMethod:"Object method uses `this` keyword which would have different behavior if converted to an arrow function. Fix this manually.",fcComponentShouldReturnJsx:'React components and hooks should create JSX elements, call other hooks or use the "use memo" directive for optimal React compiler detection.',addUseMemoDirective:'Add "use memo" directive to opt into React compiler memoization',functionCallingHooksMustBeComponent:'Functions calling hooks must be React components (PascalCase with FC type) or hooks (start with "use").',useMemoDirectiveNaming:'Functions using "use memo" directive must follow React naming conventions (PascalCase for components or start with "use" for hooks).'},hasSuggestions:!0,schema:[B(Fo)]},defaultOptions:[{}],create(e,[n]){let r=!1;if(n.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(ko.test(o.value)){r=!0;break}if(!r)return{}}function t(o){for(let i of o.properties)if(i.type===z.Property&&i.method&&i.value.type===z.FunctionExpression){let p=e.sourceCode,c=p.getText(i.key),a=i.value,u=p.getText(a.body);if(Fr(u))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=a.params.map(C=>p.getText(C)).join(", "),y="";a.generator?y=`${c}: function* (${m}) ${u}`:y=`${c}: (${m}) => ${u}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:C=>C.replaceText(i,y)})}}}function s(o){for(let i of o.properties)if(i.type===z.Property&&i.value.type===z.ObjectExpression){for(let p of i.value.properties)if(p.type===z.Property&&p.method&&p.value.type===z.FunctionExpression){let a=e.sourceCode.getText(p.value.body);Fr(a)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(vr(o.callee))for(let i of o.arguments){if(i.type===z.ObjectExpression&&(t(i),s(i)),i.type===z.ArrowFunctionExpression&&(i.body.type===z.ObjectExpression&&(t(i.body),s(i.body)),i.body.type===z.BlockStatement))for(let p of i.body.body)p.type===z.ReturnStatement&&p.argument?.type===z.ObjectExpression&&(t(p.argument),s(p.argument));if(i.type===z.FunctionExpression)for(let p of i.body.body)p.type===z.ReturnStatement&&p.argument?.type===z.ObjectExpression&&(t(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===z.Identifier&&o.init&&(o.init.type===z.ArrowFunctionExpression||o.init.type===z.FunctionExpression)){let i=o.init,p=o.id,c=o.id.typeAnnotation;if(rt(i)&&!kr(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(on(i,e.sourceCode,p,c)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(ln(i,p,c,e.sourceCode)){let a=Rr(i,e.sourceCode),u=rt(i);!a&&!u&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===z.BlockStatement){let y=i.body.range[0]+1;return m.insertTextAfterRange([y,y],`
19
19
  "use memo"
20
- `)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&nt(o)&&!kr(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(rn(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(on(o,void 0,void 0,e.sourceCode)){let i=Rr(o,e.sourceCode),p=nt(o);!i&&!p&&e.report({node:o,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(a){let l=o.body.range[0]+1;return a.insertTextAfterRange([l,l],`
20
+ `)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&rt(o)&&!kr(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(on(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(ln(o,void 0,void 0,e.sourceCode)){let i=Rr(o,e.sourceCode),p=rt(o);!i&&!p&&e.report({node:o,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(c){let a=o.body.range[0]+1;return c.insertTextAfterRange([a,a],`
21
21
  "use memo"
22
- `)}}]})}},FunctionExpression(o){if(nt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}rn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),an={name:Pr,rule:Do};import{AST_NODE_TYPES as Fe,ESLintUtils as jo}from"@typescript-eslint/utils";import{z as je}from"zod/v4";var Lo=jo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="react-compiler-migration",Mo=je.object({disallowHooks:je.array(je.object({name:je.string(),replacement:je.string()})).optional(),disallowMethods:je.array(je.object({name:je.string(),replacement:je.string().optional(),requireTrueProp:je.string().optional()})).optional()}),$o=/eslint +react-compiler\/react-compiler: +\["error/;function _o(e){return e.type===Fe.Identifier?e.name.startsWith("use"):e.type===Fe.MemberExpression&&e.property.type===Fe.Identifier?e.property.name.startsWith("use"):!1}var Uo=Lo({name:Nr,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:[B(Mo)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[n]){let r=!1;for(let t of e.sourceCode.getAllComments())if($o.test(t.value)){r=!0;break}return r?{CallExpression(t){if(n.disallowHooks?.length){let s=null,o=null;if(t.callee.type===Fe.Identifier?(s=t.callee.name,o=t.callee):t.callee.type===Fe.MemberExpression&&t.callee.property.type===Fe.Identifier&&(s=t.callee.property.name,o=t.callee.property),s){let i=n.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(n.disallowMethods?.length&&_o(t.callee)){for(let s of t.arguments)if(s.type===Fe.ObjectExpression){for(let o of s.properties)if(o.type===Fe.Property&&o.key.type===Fe.Identifier){let i=o.key.name,p=n.disallowMethods.find(a=>a.name===i);if(p){if(p.requireTrueProp){let a=p.requireTrueProp,l=!1;for(let u of s.properties)if(u.type===Fe.Property&&u.key.type===Fe.Identifier&&u.key.name===a&&u.value.type===Fe.Literal&&u.value.value===!0){l=!0;break}if(!l){e.report({node:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:a}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:a=>p.replacement?a.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),ln={name:Nr,rule:Uo};import{AST_NODE_TYPES as _}from"@typescript-eslint/utils";import{z as Dr}from"zod";var zo=Dr.object({runOnlyWithEnableCompilerDirective:Dr.boolean().optional()}),Wo=/eslint +react-compiler\/react-compiler: +\["error/,Jo=/^\d+$/,Vo=/[\s_-]+/,Xo=/[a-z][A-Z]/,Bo=/^(.+?)([A-Z][a-z]+s?)$/,Ho=/^[a-z][a-zA-Z]*$/;function jr(e,n){let r=[];if(e.type===_.JSXElement){for(let t of e.openingElement.attributes)if(t.type===_.JSXAttribute&&t.name.type===_.JSXIdentifier&&t.value?.type===_.JSXExpressionContainer&&t.value.expression.type!==_.JSXEmptyExpression){let s=t.name.name,o=t.value.expression,i=!1;ve(o,p=>{switch(p.type){case _.ObjectExpression:case _.ArrowFunctionExpression:case _.FunctionExpression:case _.ArrayExpression:return i=!0,!0}return!1},n),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Yo(e){if(e.body.type===_.JSXElement||e.body.type===_.JSXFragment)return!0;if(e.body.type===_.BlockStatement){for(let n of e.body.body)if(n.type===_.ReturnStatement&&n.argument&&(n.argument.type===_.JSXElement||n.argument.type===_.JSXFragment))return!0}return!1}function qo(e,n){let r=e.callee;if(r.type===_.MemberExpression){let t=r.object;if(t.type===_.Identifier){let s=t.name,o=Zo(s);if(o!==s)return cn(o)}}if(n.length>0){let t=n[0];if(t&&t.type===_.Identifier)return cn(t.name)}return"ListItem"}function Zo(e){let r={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(r)return r;if(e.match(Xo)){let t=e.match(Bo);if(t){let s=t[1],o=t[2];if(!s||!o)return pn(e);let i=pn(o);if(i!==o)return s+i}}return pn(e)}function pn(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 cn(e){return e.match(Ho)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Vo).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join("")}function Lr(e,n,r){let t=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);ve(e,i=>{if(i.type===_.Identifier&&!n.includes(i.name)&&!o.has(i.name)&&!Jo.test(i.name)){let p=i.parent;if(p.type===_.Property&&p.key===i||p.type===_.MemberExpression&&p.property===i&&!p.computed||p.type===_.JSXOpeningElement||p.type===_.JSXClosingElement||p.type===_.JSXAttribute&&p.name.type===_.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)n.includes(i)||t.push({name:i,type:"unknown"});return t}function Mr(e,n,r,t,s){let i=[...r.map(d=>d.type===_.Identifier?d.name:"item").map((d,g)=>({name:d,type:g===0?`${e}Type`:g===1?"number":"unknown"})),...t],p=i.map(d=>{let g=d.type;return d.name.includes("on")&&g==="any"&&(g="unknown"),` ${d.name}: ${g};`}).join(`
23
- `),a=i.map(d=>d.name).join(", "),l=s.getText(n),u=`${e}Props`;return`type ${u} = {
22
+ `)}}]})}},FunctionExpression(o){if(rt(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}on(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),pn={name:Pr,rule:jo};import{AST_NODE_TYPES as Re,ESLintUtils as Lo}from"@typescript-eslint/utils";import{z as De}from"zod/v4";var Mo=Lo.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nr="react-compiler-migration",$o=De.object({disallowHooks:De.array(De.object({name:De.string(),replacement:De.string()})).optional(),disallowMethods:De.array(De.object({name:De.string(),replacement:De.string().optional(),requireTrueProp:De.string().optional()})).optional()}),_o=/eslint +react-compiler\/react-compiler: +\["error/;function Uo(e){return e.type===Re.Identifier?e.name.startsWith("use"):e.type===Re.MemberExpression&&e.property.type===Re.Identifier?e.property.name.startsWith("use"):!1}var zo=Mo({name:Nr,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:[B($o)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[n]){let r=!1;for(let t of e.sourceCode.getAllComments())if(_o.test(t.value)){r=!0;break}return r?{CallExpression(t){if(n.disallowHooks?.length){let s=null,o=null;if(t.callee.type===Re.Identifier?(s=t.callee.name,o=t.callee):t.callee.type===Re.MemberExpression&&t.callee.property.type===Re.Identifier&&(s=t.callee.property.name,o=t.callee.property),s){let i=n.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(n.disallowMethods?.length&&Uo(t.callee)){for(let s of t.arguments)if(s.type===Re.ObjectExpression){for(let o of s.properties)if(o.type===Re.Property&&o.key.type===Re.Identifier){let i=o.key.name,p=n.disallowMethods.find(c=>c.name===i);if(p){if(p.requireTrueProp){let c=p.requireTrueProp,a=!1;for(let u of s.properties)if(u.type===Re.Property&&u.key.type===Re.Identifier&&u.key.name===c&&u.value.type===Re.Literal&&u.value.value===!0){a=!0;break}if(!a){e.report({node:o,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:p.name,requireTrueProp:c}});continue}}p.replacement&&e.report({node:o,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:p.name,replacement:p.replacement},suggest:[{messageId:"replace",data:{replacement:p.replacement},fix:c=>p.replacement?c.replaceText(o.key,p.replacement):null}]})}}}}}}:{}}}),cn={name:Nr,rule:zo};import{AST_NODE_TYPES as _}from"@typescript-eslint/utils";import{z as Dr}from"zod";var Wo=Dr.object({runOnlyWithEnableCompilerDirective:Dr.boolean().optional()}),Jo=/eslint +react-compiler\/react-compiler: +\["error/,Vo=/^\d+$/,Xo=/[\s_-]+/,Bo=/[a-z][A-Z]/,Ho=/^(.+?)([A-Z][a-z]+s?)$/,Yo=/^[a-z][a-zA-Z]*$/;function jr(e,n){let r=[];if(e.type===_.JSXElement){for(let t of e.openingElement.attributes)if(t.type===_.JSXAttribute&&t.name.type===_.JSXIdentifier&&t.value?.type===_.JSXExpressionContainer&&t.value.expression.type!==_.JSXEmptyExpression){let s=t.name.name,o=t.value.expression,i=!1;Pe(o,p=>{switch(p.type){case _.ObjectExpression:case _.ArrowFunctionExpression:case _.FunctionExpression:case _.ArrayExpression:return i=!0,!0}return!1},n),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function qo(e){if(e.body.type===_.JSXElement||e.body.type===_.JSXFragment)return!0;if(e.body.type===_.BlockStatement){for(let n of e.body.body)if(n.type===_.ReturnStatement&&n.argument&&(n.argument.type===_.JSXElement||n.argument.type===_.JSXFragment))return!0}return!1}function Zo(e,n){let r=e.callee;if(r.type===_.MemberExpression){let t=r.object;if(t.type===_.Identifier){let s=t.name,o=Go(s);if(o!==s)return fn(o)}}if(n.length>0){let t=n[0];if(t&&t.type===_.Identifier)return fn(t.name)}return"ListItem"}function Go(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(Bo)){let t=e.match(Ho);if(t){let s=t[1],o=t[2];if(!s||!o)return un(e);let i=un(o);if(i!==o)return s+i}}return un(e)}function un(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 fn(e){return e.match(Yo)?e.charAt(0).toUpperCase()+e.slice(1):e.split(Xo).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join("")}function Lr(e,n,r){let t=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Pe(e,i=>{if(i.type===_.Identifier&&!n.includes(i.name)&&!o.has(i.name)&&!Vo.test(i.name)){let p=i.parent;if(p.type===_.Property&&p.key===i||p.type===_.MemberExpression&&p.property===i&&!p.computed||p.type===_.JSXOpeningElement||p.type===_.JSXClosingElement||p.type===_.JSXAttribute&&p.name.type===_.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)n.includes(i)||t.push({name:i,type:"unknown"});return t}function Mr(e,n,r,t,s){let i=[...r.map(m=>m.type===_.Identifier?m.name:"item").map((m,y)=>({name:m,type:y===0?`${e}Type`:y===1?"number":"unknown"})),...t],p=i.map(m=>{let y=m.type;return m.name.includes("on")&&y==="any"&&(y="unknown"),` ${m.name}: ${y};`}).join(`
23
+ `),c=i.map(m=>m.name).join(", "),a=s.getText(n),u=`${e}Props`;return`type ${u} = {
24
24
  ${p}
25
25
  };
26
26
 
27
- const ${e}: FC<${u}> = ({ ${a} }) => {
27
+ const ${e}: FC<${u}> = ({ ${c} }) => {
28
28
  return (
29
- ${l}
29
+ ${a}
30
30
  );
31
- };`}function Go(e,n,r,t){let s=n.map(i=>i.type===_.Identifier?i.name:"item"),o=[t?`key={${t}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Ko(e){if(e.type===_.JSXElement&&e.openingElement.name.type===_.JSXIdentifier){let n=e.openingElement.name.name;if(n!=="div"&&n!=="span")return cn(n)}return"ListItem"}function Qo(e,n,r){let t=[r?`key={${r}}`:"",...n.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${t.length>0?` ${t.join(" ")}`:""} />`}function $r(e,n){for(let r of e.openingElement.attributes)if(r.type===_.JSXAttribute&&r.name.type===_.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===_.JSXExpressionContainer&&r.value.expression.type!==_.JSXEmptyExpression)return n.getText(r.value.expression);return null}var un=q({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[B(zo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[n]){let{sourceCode:r}=e;if(n.runOnlyWithEnableCompilerDirective){let t=!1;for(let s of r.getAllComments())if(Wo.test(s.value)){t=!0;break}if(!t)return{}}return{CallExpression(t){t.callee.type===_.MemberExpression&&t.callee.property.type===_.Identifier&&(t.callee.property.name==="map"||t.callee.property.name==="push")&&(t.callee.property.name==="map"?ea(t,r,e):ta(t,r,e))}}}});function ea(e,n,r){let t=e.arguments[0];if(!t||t.type!==_.ArrowFunctionExpression&&t.type!==_.FunctionExpression||!Yo(t))return;let s=null;if(t.body.type===_.JSXElement||t.body.type===_.JSXFragment?s=t.body:t.body.type===_.BlockStatement&&t.body.body[0]?.type===_.ReturnStatement&&t.body.body[0].argument&&(t.body.body[0].argument.type===_.JSXElement||t.body.body[0].argument.type===_.JSXFragment)&&(s=t.body.body[0].argument),!s)return;let o=jr(s,n);if(!o.hasUnstable)return;let i=qo(e,t.params),p=t.params.map(d=>d.type===_.Identifier?d.name:"item"),a=Lr(s,p,n),l=s.type===_.JSXElement?$r(s,n):null,u=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:d=>{let g=Mr(i,s,t.params,a,n),x=Go(i,t.params,a,l),y=e;for(;y.parent.type!==_.Program&&!(y.type===_.FunctionDeclaration||y.type===_.VariableDeclarator&&y.init&&(y.init.type===_.ArrowFunctionExpression||y.init.type===_.FunctionExpression));)y=y.parent;let E=[];return E.push(d.insertTextAfter(y,`
31
+ };`}function Ko(e,n,r,t){let s=n.map(i=>i.type===_.Identifier?i.name:"item"),o=[t?`key={${t}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Qo(e){if(e.type===_.JSXElement&&e.openingElement.name.type===_.JSXIdentifier){let n=e.openingElement.name.name;if(n!=="div"&&n!=="span")return fn(n)}return"ListItem"}function ea(e,n,r){let t=[r?`key={${r}}`:"",...n.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${t.length>0?` ${t.join(" ")}`:""} />`}function $r(e,n){for(let r of e.openingElement.attributes)if(r.type===_.JSXAttribute&&r.name.type===_.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===_.JSXExpressionContainer&&r.value.expression.type!==_.JSXEmptyExpression)return n.getText(r.value.expression);return null}var mn=q({name:"react-optimized-collections",meta:{type:"suggestion",docs:{description:"Detect unstable values in map renders that prevent React Compiler optimization"},messages:{unstableValueInMap:"Unstable values in {{problematicProps}} prevent React Compiler from optimizing individual list items. Extract the problematic props to outside the loop or extract the item to a separate component.",extractComponent:"Extract to {{componentName}} component"},schema:[B(Wo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[n]){let{sourceCode:r}=e;if(n.runOnlyWithEnableCompilerDirective){let t=!1;for(let s of r.getAllComments())if(Jo.test(s.value)){t=!0;break}if(!t)return{}}return{CallExpression(t){t.callee.type===_.MemberExpression&&t.callee.property.type===_.Identifier&&(t.callee.property.name==="map"||t.callee.property.name==="push")&&(t.callee.property.name==="map"?ta(t,r,e):na(t,r,e))}}}});function ta(e,n,r){let t=e.arguments[0];if(!t||t.type!==_.ArrowFunctionExpression&&t.type!==_.FunctionExpression||!qo(t))return;let s=null;if(t.body.type===_.JSXElement||t.body.type===_.JSXFragment?s=t.body:t.body.type===_.BlockStatement&&t.body.body[0]?.type===_.ReturnStatement&&t.body.body[0].argument&&(t.body.body[0].argument.type===_.JSXElement||t.body.body[0].argument.type===_.JSXFragment)&&(s=t.body.body[0].argument),!s)return;let o=jr(s,n);if(!o.hasUnstable)return;let i=Zo(e,t.params),p=t.params.map(m=>m.type===_.Identifier?m.name:"item"),c=Lr(s,p,n),a=s.type===_.JSXElement?$r(s,n):null,u=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:u},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:m=>{let y=Mr(i,s,t.params,c,n),C=Ko(i,t.params,c,a),f=e;for(;f.parent.type!==_.Program&&!(f.type===_.FunctionDeclaration||f.type===_.VariableDeclarator&&f.init&&(f.init.type===_.ArrowFunctionExpression||f.init.type===_.FunctionExpression));)f=f.parent;let E=[];return E.push(m.insertTextAfter(f,`
32
32
 
33
- ${g}`)),E.push(d.replaceText(s,x)),E}}]})}function ta(e,n,r){let t=e.arguments[0];if(!t||t.type!==_.JSXElement&&t.type!==_.JSXFragment)return;let s=t,o=jr(s,n);if(!o.hasUnstable)return;let i=Ko(s),p=Lr(s,[],n),a=s.type===_.JSXElement?$r(s,n):null,l=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:l},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let d=Mr(i,s,[],p,n),g=Qo(i,p,a),x=e;for(;x.parent.type!==_.Program&&!(x.type===_.FunctionDeclaration||x.type===_.VariableDeclarator&&x.init&&(x.init.type===_.ArrowFunctionExpression||x.init.type===_.FunctionExpression));)x=x.parent;let y=[];return y.push(u.insertTextAfter(x,`
33
+ ${y}`)),E.push(m.replaceText(s,C)),E}}]})}function na(e,n,r){let t=e.arguments[0];if(!t||t.type!==_.JSXElement&&t.type!==_.JSXFragment)return;let s=t,o=jr(s,n);if(!o.hasUnstable)return;let i=Qo(s),p=Lr(s,[],n),c=s.type===_.JSXElement?$r(s,n):null,a=o.problematicProps.length===1?`prop "${o.problematicProps[0]}"`:`props "${o.problematicProps.join('", "')}"`;r.report({node:s,messageId:"unstableValueInMap",data:{problematicProps:a},suggest:[{messageId:"extractComponent",data:{componentName:i},fix:u=>{let m=Mr(i,s,[],p,n),y=ea(i,p,c),C=e;for(;C.parent.type!==_.Program&&!(C.type===_.FunctionDeclaration||C.type===_.VariableDeclarator&&C.init&&(C.init.type===_.ArrowFunctionExpression||C.init.type===_.FunctionExpression));)C=C.parent;let f=[];return f.push(u.insertTextAfter(C,`
34
34
 
35
- ${d}`)),y.push(u.replaceText(s,g)),y}}]})}import{ESLintUtils as na,TSESTree as ra}from"@typescript-eslint/utils";var ia=na.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="require-description",sa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,oa=/^eslint-disable-(next-)?line$/u,aa=ia({name:_r,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=la(s);o!=null&&(t.has(o.kind)||o.description||e.report({loc:ua(s.loc),messageId:"missingDescription"}))}}}}}),Ur={name:_r,rule:aa};function la(e){let{text:n,description:r}=ca(e.value);if(!n)return null;let t=sa.exec(n);if(!t)return null;let s=t[1];if(!s)return null;let o=oa.test(s);if(e.type===ra.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+s.length);return{kind:s,value:i.trim(),description:r}}var pa=/\s-{2,}\s/u;function ca(e){let n=e.split(pa);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function ua(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 _e}from"zod/v4";var fa=_e.object({varsToCheck:_e.array(_e.object({selector:_e.string().optional(),fromFnCall:_e.string().optional(),prop:_e.string().or(_e.array(_e.string())),errorMsg:_e.string().optional()}))}),fn=q({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[B(fa)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,p,a,l){let u=new Set;for(let g of i.properties)g.type===ne.Property&&g.key.type===ne.Identifier&&u.add(g.key.name);let d=p.filter(g=>!u.has(g));if(d.length>0)if(d.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:d[0],fnName:l,customMsg:a||""}});else{let g=d.map(x=>`"${x}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:g,fnName:l,customMsg:a||""}})}}function s(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 o={};for(let i of n.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===ne.VariableDeclarator&&p.id.type===ne.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===ne.VariableDeclarator&&p.id.type===ne.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];t(p.id,a,i.errorMsg,s(p))}});for(let i of n.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let l=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[l]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let d=u.parent;if(d.parent.type!==ne.VariableDeclarator)return;let g=d.parent;if(g.id.type===ne.Identifier)r.set(g.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:g.id,fnName:i.fromFnCall||"unknown function"});else if(g.id.type===ne.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];t(g.id,x,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[a,l]=p.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${a}"][property.name="${l}"]`;o[u]=d=>{if(d.type!==ne.MemberExpression||d.parent.type!==ne.CallExpression)return;let g=d.parent;if(g.parent.type!==ne.VariableDeclarator)return;let x=g.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 y=Array.isArray(i.prop)?i.prop:[i.prop];t(x.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[a]=l=>{if(l.type!==ne.Identifier||l.parent.type!==ne.CallExpression)return;let u=l.parent;if(u.parent.type!==ne.VariableDeclarator)return;let d=u.parent;if(d.id.type===ne.Identifier)r.set(d.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:d.id,fnName:i.fromFnCall||"unknown function"});else if(d.id.type===ne.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];t(d.id,g,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:a,node:l,fnName:u}]of r){let g=e.sourceCode.getScope(l).set.get(i);if(g){let x=new Set(p);for(let y of g.references){let E=y.identifier,b=E.parent;if(!(b.type===ne.VariableDeclarator&&b.id===E)){if(b.type===ne.MemberExpression&&b.object===E&&b.property.type===ne.Identifier&&x.has(b.property.name)){if(x.delete(b.property.name),x.size===0)break;continue}if(b.type===ne.VariableDeclarator&&b.init===E&&b.id.type===ne.ObjectPattern){for(let f of b.id.properties)f.type===ne.Property&&f.key.type===ne.Identifier&&x.has(f.key.name)&&x.delete(f.key.name);if(x.size===0)break;continue}if(!(b.type===ne.MemberExpression&&b.object===E&&b.property.type===ne.Identifier&&!p.includes(b.property.name))){x.clear();break}}}if(x.size>0){let y=Array.from(x);if(y.length===1)e.report({node:l,messageId:"propNotRead",data:{prop:y[0],fnName:u,customMsg:a||""}});else{let E=y.map(b=>`"${b}"`).join(", ");e.report({node:l,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:a||""}})}}}}}}}});function Jr(e){return/^use[A-Z0-9]/.test(e)}function dt(e){return e.type==="Identifier"?Jr(e.name):e.type==="MemberExpression"&&!e.computed&&dt(e.property)?e.object.type==="Identifier":!1}function Vr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Xr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function Br(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"forwardRef"))}function Hr(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"memo"))}function mn(e){for(;e;){let n=qr(e);if(n&&(Vr(n)||dt(n))||Br(e)||Hr(e))return!0;e=e.parent}return!1}function zr(e){return!1}function yn(e){return!1}var ma=/eslint +react-compiler\/react-compiler: +\["error/,Yr={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"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let a of e.sourceCode.getAllComments())if(ma.test(a.value))return{CallExpression(l){let u=null;l.callee.name==="useMemo"?u="useMemo":l.callee.name==="useCallback"&&(u="useCallback"),u&&e.report({node:l,message:`"${u}" is not necessary when using React Compiler.`})}}}let n=typeof e.getSource=="function"?a=>n(a):a=>e.sourceCode.getText(a),r=typeof e.getScope=="function"?()=>r():a=>e.sourceCode.getScope(a),t=null,s=[],o=[],i=new WeakSet;function p(a){for(let l of a.references){let u=l.identifier.parent;if(u.type==="VariableDeclarator"&&u.init&&u.init.type==="CallExpression"&&u.init.callee&&zr(u.init.callee))for(let d of l.resolved.references)d!==l&&i.add(d.identifier)}}return{onCodePathSegmentStart:a=>o.push(a),onCodePathSegmentEnd:()=>o.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(a,l){let u=s.pop();if(u.size===0)return;let d=new Set;function g(m,C){let{cache:h}=g,w=h.get(m.id),P=new Set(C);if(P.has(m.id)){let v=[...P],c=v.slice(v.indexOf(m.id)+1);for(let F of c)d.add(F);return BigInt("0")}if(P.add(m.id),w!==void 0)return w;if(a.thrownSegments.includes(m))w=BigInt("0");else if(m.prevSegments.length===0)w=BigInt("1");else{w=BigInt("0");for(let v of m.prevSegments)w+=g(v,P)}return m.reachable&&w===BigInt("0")?h.delete(m.id):h.set(m.id,w),w}function x(m,C){let{cache:h}=x,w=h.get(m.id),P=new Set(C);if(P.has(m.id)){let v=Array.from(P),c=v.slice(v.indexOf(m.id)+1);for(let F of c)d.add(F);return BigInt("0")}if(P.add(m.id),w!==void 0)return w;if(a.thrownSegments.includes(m))w=BigInt("0");else if(m.nextSegments.length===0)w=BigInt("1");else{w=BigInt("0");for(let v of m.nextSegments)w+=x(v,P)}return h.set(m.id,w),w}function y(m){let{cache:C}=y,h=C.get(m.id);if(h===null)return 1/0;if(h!==void 0)return h;if(C.set(m.id,null),m.prevSegments.length===0)h=1;else{h=1/0;for(let w of m.prevSegments){let P=y(w);P<h&&(h=P)}h+=1}return C.set(m.id,h),h}g.cache=new Map,x.cache=new Map,y.cache=new Map;let E=x(a.initialSegment),b=qr(l),f=mn(l),A=b?Vr(b)||dt(b):Br(l)||Hr(l),I=1/0;for(let m of a.finalSegments){if(!m.reachable)continue;let C=y(m);C<I&&(I=C)}for(let[m,C]of u){if(!m.reachable)continue;let h=m.nextSegments.length===0?I<=y(m):I<y(m),w=g(m)*x(m),P=d.has(m.id);for(let v of C)if(P&&!yn(v)&&e.report({node:v,message:`React Hook "${n(v)}" 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(l.async&&e.report({node:v,message:`React Hook "${n(v)}" cannot be called in an async function.`}),!P&&w!==E&&!yn(v)){let F=`React Hook "${n(v)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(h?" Did you accidentally call a React Hook after an early return?":"");e.report({node:v,message:F})}}else if(l.parent&&(l.parent.type==="MethodDefinition"||l.parent.type==="ClassProperty")&&l.parent.value===l){let c=`React Hook "${n(v)}" 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:v,message:c})}else if(b){let c=`React Hook "${n(v)}" is called in function "${n(b)}" 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:v,message:c})}else if(l.type==="Program"){let c=`React Hook "${n(v)}" 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:v,message:c})}else if(f&&!yn(v)){if(l.parent.type==="CallExpression"&&l.parent.callee.type==="Identifier"&&l.parent.callee.name==="useCallback"){let F=l.parent;if(F.parent.type==="VariableDeclarator"&&Jr(F.parent.id.name))return}let c=`React Hook "${n(v)}" 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:v,message:c})}}},CallExpression(a){if(dt(a.callee)){let l=Wr(s),u=Wr(o),d=l.get(u);d||(d=[],l.set(u,d)),d.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||zr(a.callee))&&a.arguments.length>0&&(t=a)},Identifier(a){t==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${n(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===t&&(t=null)},FunctionDeclaration(a){mn(a)&&p(r(a))},ArrowFunctionExpression(a){mn(a)&&p(r(a))}}}};function qr(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 Wr(e){return e[e.length-1]}import{AST_NODE_TYPES as Se,AST_TOKEN_TYPES as ya}from"@typescript-eslint/utils";import*as be from"zod/v4";var da=/^\s+$/,dn=/\r?\n/,ga=/^(\s*)/,Sa=/^(\s*)\S/,Ta=/\r?\n/,ha=be.object({indent:be.union([be.string().regex(da),be.number().int().min(1)]).optional(),tags:be.array(be.string()).optional(),functions:be.array(be.string()).optional(),comments:be.array(be.string()).optional()}),gn=q({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[B(ha)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(f=>f.toLowerCase());function p(f){let A=f.split(dn),I=A.filter(C=>C.trim()!=="");if(I.length===0)return f;let m=Number.POSITIVE_INFINITY;for(let C of I){let h=C.match(ga);h&&(m=Math.min(m,h[1]?.length??0))}return!isFinite(m)||m===0?f:A.map(C=>C.slice(m)).join(`
36
- `)}function a(f,A,I){return f.split(dn).map(C=>C.trim()===""?C:I.repeat(A)+C).join(`
37
- `)}function l(f){if(f.type===Se.Identifier)return f.name;if(f.type===Se.MemberExpression){let A=f.object.type===Se.Identifier?f.object.name:null,I=f.property.type===Se.Identifier?f.property.name:null;return A&&I?`${A}.${I}`:I}return null}function u(f,A){if(!f)return!1;for(let I of A)if(I.includes(".")){let m=I.split(".");if(f.type===Se.MemberExpression&&f.object.type===Se.Identifier&&f.property.type===Se.Identifier&&f.object.name===m[0]&&f.property.name===m[1])return!0}else if(f.type===Se.Identifier&&f.name===I)return!0;return!1}function d(f,A){let I=f.parent;if(I.type!==Se.TaggedTemplateExpression)return!1;let m=l(I.tag);return m?A.includes(m):!1}function g(f,A){if(!f||f.type!==Se.CallExpression)return!1;let{method:I,argumentsLength:m,optionalCall:C=!0,optionalMember:h=!0}=A;return m!==void 0&&f.arguments.length!==m||!C&&f.optional||f.callee.type!==Se.MemberExpression||!h&&f.callee.optional||f.callee.property.type!==Se.Identifier?!1:f.callee.property.name===I}function x(f,A){if(!f||f.type!==Se.CallExpression)return!1;let{name:I,argumentsLength:m,optionalCall:C=!0}=A;return m!==void 0&&f.arguments.length!==m||!C&&f.optional||f.callee.type!==Se.Identifier?!1:f.callee.name===I}function y(f){return g(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===Se.CallExpression&&f.parent.arguments[0]===f&&x(f.parent.callee.type===Se.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(f){if(i.length>0){let A=n.getTokenBefore(f,{includeComments:!0});if(A?.type===ya.Block&&i.includes(A.value.trim().toLowerCase()))return!0}return!!(y(f)||s.length>0&&d(f,s)||t.length>0&&f.parent.type===Se.CallExpression&&f.parent.arguments.includes(f)&&u(f.parent.callee,t))}function b(f){let A=`__PLACEHOLDER__${Math.random()}`,I=f.quasis.map(D=>n.getText(D).slice(1,D.tail?-1:-2)).join(A),m=I.match(Ta);if(!m)return;let C=m[0],h=n.lines[n.getLocFromIndex(f.range[0]).line-1];if(!h)return;let P=h.match(Sa)?.[1]??"",v;typeof o=="string"?v=o:typeof o=="number"?v=" ".repeat(o):v=P.startsWith(" ")?" ":" ";let F=p(I).replace(new RegExp(`^${C}|${C}[ ]*$`,"g"),""),T=C+a(F,1,P+v)+C+P,S=I.includes(`\r
35
+ ${m}`)),f.push(u.replaceText(s,y)),f}}]})}import{ESLintUtils as ra,TSESTree as ia}from"@typescript-eslint/utils";var sa=ra.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_r="require-description",oa=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,aa=/^eslint-disable-(next-)?line$/u,la=sa({name:_r,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[n]){let r=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=pa(s);o!=null&&(t.has(o.kind)||o.description||e.report({loc:fa(s.loc),messageId:"missingDescription"}))}}}}}),Ur={name:_r,rule:la};function pa(e){let{text:n,description:r}=ua(e.value);if(!n)return null;let t=oa.exec(n);if(!t)return null;let s=t[1];if(!s)return null;let o=aa.test(s);if(e.type===ia.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=n.slice(t.index+s.length);return{kind:s,value:i.trim(),description:r}}var ca=/\s-{2,}\s/u;function ua(e){let n=e.split(ca);return{text:n[0]?.trim(),description:n.length>1?n[1]?.trim()??null:null}}function fa(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 $e}from"zod/v4";var ma=$e.object({varsToCheck:$e.array($e.object({selector:$e.string().optional(),fromFnCall:$e.string().optional(),prop:$e.string().or($e.array($e.string())),errorMsg:$e.string().optional()}))}),yn=q({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[B(ma)]},defaultOptions:[{varsToCheck:[]}],create(e,[n]){let r=new Map;function t(i,p,c,a){let u=new Set;for(let y of i.properties)y.type===ne.Property&&y.key.type===ne.Identifier&&u.add(y.key.name);let m=p.filter(y=>!u.has(y));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:a,customMsg:c||""}});else{let y=m.map(C=>`"${C}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:y,fnName:a,customMsg:c||""}})}}function s(i){if(i.init?.type===ne.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 o={};for(let i of n.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===ne.VariableDeclarator&&p.id.type===ne.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===ne.VariableDeclarator&&p.id.type===ne.ObjectPattern){let c=Array.isArray(i.prop)?i.prop:[i.prop];t(p.id,c,i.errorMsg,s(p))}});for(let i of n.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let a=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;o[a]=u=>{if(u.type!==ne.MemberExpression||u.parent.type!==ne.CallExpression)return;let m=u.parent;if(m.parent.type!==ne.VariableDeclarator)return;let y=m.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 C=Array.isArray(i.prop)?i.prop:[i.prop];t(y.id,C,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[c,a]=p.split("."),u=`VariableDeclarator > CallExpression > MemberExpression[object.name="${c}"][property.name="${a}"]`;o[u]=m=>{if(m.type!==ne.MemberExpression||m.parent.type!==ne.CallExpression)return;let y=m.parent;if(y.parent.type!==ne.VariableDeclarator)return;let C=y.parent;if(C.id.type===ne.Identifier)r.set(C.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:C.id,fnName:i.fromFnCall||"unknown function"});else if(C.id.type===ne.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];t(C.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let c=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[c]=a=>{if(a.type!==ne.Identifier||a.parent.type!==ne.CallExpression)return;let u=a.parent;if(u.parent.type!==ne.VariableDeclarator)return;let m=u.parent;if(m.id.type===ne.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===ne.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];t(m.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...o,"Program:exit"(){for(let[i,{props:p,errorMsg:c,node:a,fnName:u}]of r){let y=e.sourceCode.getScope(a).set.get(i);if(y){let C=new Set(p);for(let f of y.references){let E=f.identifier,x=E.parent;if(!(x.type===ne.VariableDeclarator&&x.id===E)){if(x.type===ne.MemberExpression&&x.object===E&&x.property.type===ne.Identifier&&C.has(x.property.name)){if(C.delete(x.property.name),C.size===0)break;continue}if(x.type===ne.VariableDeclarator&&x.init===E&&x.id.type===ne.ObjectPattern){for(let S of x.id.properties)S.type===ne.Property&&S.key.type===ne.Identifier&&C.has(S.key.name)&&C.delete(S.key.name);if(C.size===0)break;continue}if(!(x.type===ne.MemberExpression&&x.object===E&&x.property.type===ne.Identifier&&!p.includes(x.property.name))){C.clear();break}}}if(C.size>0){let f=Array.from(C);if(f.length===1)e.report({node:a,messageId:"propNotRead",data:{prop:f[0],fnName:u,customMsg:c||""}});else{let E=f.map(x=>`"${x}"`).join(", ");e.report({node:a,messageId:"propsNotRead",data:{props:E,fnName:u,customMsg:c||""}})}}}}}}}});function Jr(e){return/^use[A-Z0-9]/.test(e)}function gt(e){return e.type==="Identifier"?Jr(e.name):e.type==="MemberExpression"&&!e.computed&&gt(e.property)?e.object.type==="Identifier":!1}function Vr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Xr(e,n){return e.name===n||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===n}function Br(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"forwardRef"))}function Hr(e){return!!(e.parent&&e.parent.callee&&Xr(e.parent.callee,"memo"))}function dn(e){for(;e;){let n=qr(e);if(n&&(Vr(n)||gt(n))||Br(e)||Hr(e))return!0;e=e.parent}return!1}function zr(e){return!1}function gn(e){return!1}var ya=/eslint +react-compiler\/react-compiler: +\["error/,Yr={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"}}}]},create(e){let n=!!e.options[0]?.reactCompilerIsEnabled;if(e.options[0]?.ignoreIfReactCompilerIsEnabled||n){for(let a of e.sourceCode.getAllComments())if(n||ya.test(a.value))return{CallExpression(u){let m=null;u.callee.name==="useMemo"?m="useMemo":u.callee.name==="useCallback"&&(m="useCallback"),m&&e.report({node:u,message:`"${m}" is not necessary when using React Compiler.`})}}}let r=typeof e.getSource=="function"?a=>r(a):a=>e.sourceCode.getText(a),t=typeof e.getScope=="function"?()=>t():a=>e.sourceCode.getScope(a),s=null,o=[],i=[],p=new WeakSet;function c(a){for(let u of a.references){let m=u.identifier.parent;if(m.type==="VariableDeclarator"&&m.init&&m.init.type==="CallExpression"&&m.init.callee&&zr(m.init.callee))for(let y of u.resolved.references)y!==u&&p.add(y.identifier)}}return{onCodePathSegmentStart:a=>i.push(a),onCodePathSegmentEnd:()=>i.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(a,u){let m=o.pop();if(m.size===0)return;let y=new Set;function C(h,b){let{cache:w}=C,P=w.get(h.id),N=new Set(b);if(N.has(h.id)){let l=[...N],R=l.slice(l.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),P!==void 0)return P;if(a.thrownSegments.includes(h))P=BigInt("0");else if(h.prevSegments.length===0)P=BigInt("1");else{P=BigInt("0");for(let l of h.prevSegments)P+=C(l,N)}return h.reachable&&P===BigInt("0")?w.delete(h.id):w.set(h.id,P),P}function f(h,b){let{cache:w}=f,P=w.get(h.id),N=new Set(b);if(N.has(h.id)){let l=Array.from(N),R=l.slice(l.indexOf(h.id)+1);for(let d of R)y.add(d);return BigInt("0")}if(N.add(h.id),P!==void 0)return P;if(a.thrownSegments.includes(h))P=BigInt("0");else if(h.nextSegments.length===0)P=BigInt("1");else{P=BigInt("0");for(let l of h.nextSegments)P+=f(l,N)}return w.set(h.id,P),P}function E(h){let{cache:b}=E,w=b.get(h.id);if(w===null)return 1/0;if(w!==void 0)return w;if(b.set(h.id,null),h.prevSegments.length===0)w=1;else{w=1/0;for(let P of h.prevSegments){let N=E(P);N<w&&(w=N)}w+=1}return b.set(h.id,w),w}C.cache=new Map,f.cache=new Map,E.cache=new Map;let x=f(a.initialSegment),S=qr(u),I=dn(u),A=S?Vr(S)||gt(S):Br(u)||Hr(u),T=1/0;for(let h of a.finalSegments){if(!h.reachable)continue;let b=E(h);b<T&&(T=b)}for(let[h,b]of m){if(!h.reachable)continue;let w=h.nextSegments.length===0?T<=E(h):T<E(h),P=C(h)*f(h),N=y.has(h.id);for(let l of b)if(N&&!gn(l)&&e.report({node:l,message:`React Hook "${r(l)}" may be executed more than once. Possibly because it is called in a loop. React Hooks must be called in the exact same order in every component render.`}),A){if(u.async&&e.report({node:l,message:`React Hook "${r(l)}" cannot be called in an async function.`}),!N&&P!==x&&!gn(l)){let d=`React Hook "${r(l)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(w?" Did you accidentally call a React Hook after an early return?":"");e.report({node:l,message:d})}}else if(u.parent&&(u.parent.type==="MethodDefinition"||u.parent.type==="ClassProperty")&&u.parent.value===u){let R=`React Hook "${r(l)}" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:l,message:R})}else if(S){let R=`React Hook "${r(l)}" is called in function "${r(S)}" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".`;e.report({node:l,message:R})}else if(u.type==="Program"){let R=`React Hook "${r(l)}" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:l,message:R})}else if(I&&!gn(l)){if(u.parent.type==="CallExpression"&&u.parent.callee.type==="Identifier"&&u.parent.callee.name==="useCallback"){let d=u.parent;if(d.parent.type==="VariableDeclarator"&&Jr(d.parent.id.name))return}let R=`React Hook "${r(l)}" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function.`;e.report({node:l,message:R})}}},CallExpression(a){if(gt(a.callee)){let u=Wr(o),m=Wr(i),y=u.get(m);y||(y=[],u.set(m,y)),y.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||zr(a.callee))&&a.arguments.length>0&&(s=a)},Identifier(a){s==null&&p.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${r(a)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(a){a===s&&(s=null)},FunctionDeclaration(a){dn(a)&&c(t(a))},ArrowFunctionExpression(a){dn(a)&&c(t(a))}}}};function qr(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 Wr(e){return e[e.length-1]}import{AST_NODE_TYPES as Se,AST_TOKEN_TYPES as da}from"@typescript-eslint/utils";import*as be from"zod/v4";var ga=/^\s+$/,Sn=/\r?\n/,Sa=/^(\s*)/,Ta=/^(\s*)\S/,ha=/\r?\n/,Ea=be.object({indent:be.union([be.string().regex(ga),be.number().int().min(1)]).optional(),tags:be.array(be.string()).optional(),functions:be.array(be.string()).optional(),comments:be.array(be.string()).optional()}),Tn=q({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[B(Ea)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let n=e.sourceCode,{comments:r=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:o}=e.options[0],i=r.map(S=>S.toLowerCase());function p(S){let I=S.split(Sn),A=I.filter(h=>h.trim()!=="");if(A.length===0)return S;let T=Number.POSITIVE_INFINITY;for(let h of A){let b=h.match(Sa);b&&(T=Math.min(T,b[1]?.length??0))}return!isFinite(T)||T===0?S:I.map(h=>h.slice(T)).join(`
36
+ `)}function c(S,I,A){return S.split(Sn).map(h=>h.trim()===""?h:A.repeat(I)+h).join(`
37
+ `)}function a(S){if(S.type===Se.Identifier)return S.name;if(S.type===Se.MemberExpression){let I=S.object.type===Se.Identifier?S.object.name:null,A=S.property.type===Se.Identifier?S.property.name:null;return I&&A?`${I}.${A}`:A}return null}function u(S,I){if(!S)return!1;for(let A of I)if(A.includes(".")){let T=A.split(".");if(S.type===Se.MemberExpression&&S.object.type===Se.Identifier&&S.property.type===Se.Identifier&&S.object.name===T[0]&&S.property.name===T[1])return!0}else if(S.type===Se.Identifier&&S.name===A)return!0;return!1}function m(S,I){let A=S.parent;if(A.type!==Se.TaggedTemplateExpression)return!1;let T=a(A.tag);return T?I.includes(T):!1}function y(S,I){if(!S||S.type!==Se.CallExpression)return!1;let{method:A,argumentsLength:T,optionalCall:h=!0,optionalMember:b=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==Se.MemberExpression||!b&&S.callee.optional||S.callee.property.type!==Se.Identifier?!1:S.callee.property.name===A}function C(S,I){if(!S||S.type!==Se.CallExpression)return!1;let{name:A,argumentsLength:T,optionalCall:h=!0}=I;return T!==void 0&&S.arguments.length!==T||!h&&S.optional||S.callee.type!==Se.Identifier?!1:S.callee.name===A}function f(S){return y(S.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&S.parent.type===Se.CallExpression&&S.parent.arguments[0]===S&&C(S.parent.callee.type===Se.MemberExpression?S.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(S){if(i.length>0){let I=n.getTokenBefore(S,{includeComments:!0});if(I?.type===da.Block&&i.includes(I.value.trim().toLowerCase()))return!0}return!!(f(S)||s.length>0&&m(S,s)||t.length>0&&S.parent.type===Se.CallExpression&&S.parent.arguments.includes(S)&&u(S.parent.callee,t))}function x(S){let I=`__PLACEHOLDER__${Math.random()}`,A=S.quasis.map(j=>n.getText(j).slice(1,j.tail?-1:-2)).join(I),T=A.match(ha);if(!T)return;let h=T[0],b=n.lines[n.getLocFromIndex(S.range[0]).line-1];if(!b)return;let P=b.match(Ta)?.[1]??"",N;typeof o=="string"?N=o:typeof o=="number"?N=" ".repeat(o):N=P.startsWith(" ")?" ":" ";let R=p(A).replace(new RegExp(`^${h}|${h}[ ]*$`,"g"),""),d=h+c(R,1,P+N)+h+P,g=A.includes(`\r
38
38
  `)?`\r
39
39
  `:`
40
- `,R=I.split(dn),O=R.map((D,Z)=>Z!==R.length-1&&D===v+P?"":D).join(S);if(T!==O)return{node:f,messageId:"improperlyIndented",fix:D=>T.split(A).map((Z,G)=>{let V=f.quasis[G];return V?D.replaceTextRange([V.range[0]+1,V.range[1]-(V.tail?1:2)],Z):[]}).flat()}}return{TemplateLiteral(f){if(!E(f))return;let A=b(f);if(A)return e.report(A)}}}});import{AST_NODE_TYPES as Zr}from"@typescript-eslint/utils";function Ea(e){if(!("regex"in e))return!1;let n=e.regex.flags;return n.includes("g")||n.includes("y")}function ba(e){let n=e.parent;return n?.type===Zr.NewExpression&&n.callee.type===Zr.Identifier&&n.callee.name==="RegExp"}var Sn=q({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function n(r){Ea(r)||ba(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":n}}});import{AST_NODE_TYPES as Te}from"@typescript-eslint/utils";import{z as it}from"zod/v4";var xa=it.object({checkOnly:it.array(it.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:it.array(it.string()).optional()}),Tn=q({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[B(xa)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=new Map,s=[];function o(y){for(let E of s)if(y.range[0]>=E.range[0]&&y.range[1]<=E.range[1])return E;return null}function i(y){let E=y.parent;for(;E;){if(E.type===Te.FunctionDeclaration||E.type===Te.FunctionExpression||E.type===Te.ArrowFunctionExpression){let b=E.params;for(let f of b)if(y.range[0]>=f.range[0]&&y.range[1]<=f.range[1])return!0;break}E=E.parent}return!1}function p(y){let E=y.parent;for(;E;){if(E.type===Te.TSTypeParameterInstantiation){let b=E.parent;if(b.type===Te.TSTypeReference&&b.typeName.type===Te.Identifier&&(b.typeName.name==="FC"||b.typeName.name==="React.FC")||b.type===Te.TSTypeReference&&b.typeName.type===Te.TSQualifiedName&&b.typeName.right.name==="FC")return!0}E=E.parent}return!1}function a(y){let E=y.parent;for(;E;){if(E.type===Te.TSTypeParameterInstantiation){let b=E.parent;if(b.type===Te.CallExpression||b.type===Te.NewExpression)return!0}E=E.parent}return!1}function l(y){let E=y.parent;for(;E;){if(E.type===Te.TSTypeAliasDeclaration||E.type===Te.TSInterfaceDeclaration)return!0;E=E.parent}return!1}function u(y){return y.parent.type===Te.TSIndexedAccessType&&y.parent.objectType===y}let d=[];function g(y){let E=[],b=new Map;for(let{typeName:A,firstUsage:I}of y){let m=b.get(I)||[];m.push(A),b.set(I,m)}for(let{typeName:A,firstUsage:I,firstUsagePosition:m,firstUsageInFunctionArgs:C}of y){let h=t.get(A);if(!h||h.statement===I)continue;let w=s.indexOf(h.statement),P=s.indexOf(I);if(w===-1||P===-1)continue;let v=!!(n.checkOnly&&n.checkOnly.includes("function-args")&&C),F=(b.get(I)||[]).length>1;(v||F?w>P:w>P||w!==P-1)&&E.push({typeName:A,typeDef:h,targetStatement:I,firstUsagePosition:m})}if(E.length===0)return;E.sort((A,I)=>{let m=A.firstUsagePosition-I.firstUsagePosition;if(m!==0)return m;let C=s.indexOf(A.typeDef.statement),h=s.indexOf(I.typeDef.statement);return C-h});let f=E[0];f&&e.report({node:f.typeDef.node,messageId:"moveTypeAboveUsage",fix:x(E)})}function x(y){return function*(E){let b=new Map;for(let f of y){let A=b.get(f.targetStatement)||[];A.push(f),b.set(f.targetStatement,A)}for(let[,f]of b)f.sort((A,I)=>{let m=A.firstUsagePosition-I.firstUsagePosition;if(m!==0)return m;let C=s.indexOf(A.typeDef.statement),h=s.indexOf(I.typeDef.statement);return C-h});for(let f of y){let{typeDef:A}=f,I=A.statement,m=r.getCommentsBefore(I),C=I.range[0],h=I.range[1];m.length>0&&m[0]&&(C=m[0].range[0]),yield E.removeRange([C,h])}for(let[f,A]of b){let I=r.getCommentsBefore(f),m=I.length>0&&I[0]?I[0].range[0]:f.range[0],C=[];for(let h of A){let w=h.typeDef.statement,P=r.getText(w),v=r.getCommentsBefore(w),c=P;v.length>0&&(c=`${v.map(T=>r.getText(T)).join(`
40
+ `,F=A.split(Sn),v=F.map((j,J)=>J!==F.length-1&&j===N+P?"":j).join(g);if(d!==v)return{node:S,messageId:"improperlyIndented",fix:j=>d.split(I).map((J,G)=>{let H=S.quasis[G];return H?j.replaceTextRange([H.range[0]+1,H.range[1]-(H.tail?1:2)],J):[]}).flat()}}return{TemplateLiteral(S){if(!E(S))return;let I=x(S);if(I)return e.report(I)}}}});import{AST_NODE_TYPES as Zr}from"@typescript-eslint/utils";function ba(e){if(!("regex"in e))return!1;let n=e.regex.flags;return n.includes("g")||n.includes("y")}function xa(e){let n=e.parent;return n?.type===Zr.NewExpression&&n.callee.type===Zr.Identifier&&n.callee.name==="RegExp"}var hn=q({name:"use-top-level-regex",meta:{type:"suggestion",docs:{description:"Require regex literals to be declared at the top level to avoid performance issues"},messages:{regexShouldBeTopLevel:"Move this regex literal to the top level to avoid creating new RegExp objects on each function call."},schema:[],hasSuggestions:!1},defaultOptions:[],create(e){function n(r){ba(r)||xa(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":n}}});import{AST_NODE_TYPES as Te}from"@typescript-eslint/utils";import{z as st}from"zod/v4";var Ca=st.object({checkOnly:st.array(st.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:st.array(st.string()).optional()}),En=q({name:"use-types-directly-above-usage",meta:{type:"suggestion",docs:{description:"Require type definitions to be placed directly above their first usage for better readability"},fixable:"code",schema:[B(Ca)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=new Map,s=[];function o(f){for(let E of s)if(f.range[0]>=E.range[0]&&f.range[1]<=E.range[1])return E;return null}function i(f){let E=f.parent;for(;E;){if(E.type===Te.FunctionDeclaration||E.type===Te.FunctionExpression||E.type===Te.ArrowFunctionExpression){let x=E.params;for(let S of x)if(f.range[0]>=S.range[0]&&f.range[1]<=S.range[1])return!0;break}E=E.parent}return!1}function p(f){let E=f.parent;for(;E;){if(E.type===Te.TSTypeParameterInstantiation){let x=E.parent;if(x.type===Te.TSTypeReference&&x.typeName.type===Te.Identifier&&(x.typeName.name==="FC"||x.typeName.name==="React.FC")||x.type===Te.TSTypeReference&&x.typeName.type===Te.TSQualifiedName&&x.typeName.right.name==="FC")return!0}E=E.parent}return!1}function c(f){let E=f.parent;for(;E;){if(E.type===Te.TSTypeParameterInstantiation){let x=E.parent;if(x.type===Te.CallExpression||x.type===Te.NewExpression)return!0}E=E.parent}return!1}function a(f){let E=f.parent;for(;E;){if(E.type===Te.TSTypeAliasDeclaration||E.type===Te.TSInterfaceDeclaration)return!0;E=E.parent}return!1}function u(f){return f.parent.type===Te.TSIndexedAccessType&&f.parent.objectType===f}let m=[];function y(f){let E=[],x=new Map;for(let{typeName:I,firstUsage:A}of f){let T=x.get(A)||[];T.push(I),x.set(A,T)}for(let{typeName:I,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h}of f){let b=t.get(I);if(!b||b.statement===A)continue;let w=s.indexOf(b.statement),P=s.indexOf(A);if(w===-1||P===-1)continue;let N=!!(n.checkOnly&&n.checkOnly.includes("function-args")&&h),R=(x.get(A)||[]).length>1;(N||R?w>P:w>P||w!==P-1)&&E.push({typeName:I,typeDef:b,targetStatement:A,firstUsagePosition:T})}if(E.length===0)return;E.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let h=s.indexOf(I.typeDef.statement),b=s.indexOf(A.typeDef.statement);return h-b});let S=E[0];S&&e.report({node:S.typeDef.node,messageId:"moveTypeAboveUsage",fix:C(E)})}function C(f){return function*(E){let x=new Map;for(let S of f){let I=x.get(S.targetStatement)||[];I.push(S),x.set(S.targetStatement,I)}for(let[,S]of x)S.sort((I,A)=>{let T=I.firstUsagePosition-A.firstUsagePosition;if(T!==0)return T;let h=s.indexOf(I.typeDef.statement),b=s.indexOf(A.typeDef.statement);return h-b});for(let S of f){let{typeDef:I}=S,A=I.statement,T=r.getCommentsBefore(A),h=A.range[0],b=A.range[1];T.length>0&&T[0]&&(h=T[0].range[0]),yield E.removeRange([h,b])}for(let[S,I]of x){let A=r.getCommentsBefore(S),T=A.length>0&&A[0]?A[0].range[0]:S.range[0],h=[];for(let b of I){let w=b.typeDef.statement,P=r.getText(w),N=r.getCommentsBefore(w),l=P;N.length>0&&(l=`${N.map(d=>r.getText(d)).join(`
41
41
  `)}
42
- ${P}`),C.push(c)}yield E.insertTextBeforeRange([m,m],`${C.join(`
42
+ ${P}`),h.push(l)}yield E.insertTextBeforeRange([T,T],`${h.join(`
43
43
 
44
44
  `)}
45
45
 
46
- `)}}}return{Program(y){s.push(...y.body)},TSTypeAliasDeclaration(y){if(s.some(b=>b.type===Te.ExportNamedDeclaration&&b.declaration===y?!0:b===y)){let b=o(y);b&&t.set(y.id.name,{node:y,name:y.id.name,statement:b})}},TSInterfaceDeclaration(y){if(s.some(b=>b.type===Te.ExportNamedDeclaration&&b.declaration===y?!0:b===y)){let b=o(y);b&&t.set(y.id.name,{node:y,name:y.id.name,statement:b})}},TSTypeReference(y){if(y.typeName.type===Te.Identifier){if(u(y))return;let E=i(y),b=p(y),f=a(y);d.push({typeName:y.typeName.name,node:y,inFunctionArgs:E,inFCProps:b,inGenericArgAtFunctionCall:f,usagePosition:y.range[0]})}},"Program:exit"(){let y=new Map;function E(f){if(!n.checkOnly||n.checkOnly.length===0)return!0;for(let A of n.checkOnly)if(A==="function-args"&&f.inFunctionArgs||A==="FC"&&f.inFCProps||A==="generic-args-at-fn-calls"&&f.inGenericArgAtFunctionCall)return!0;return!1}for(let f of d){let{typeName:A,node:I}=f;if(!t.has(A)||!E(f))continue;let m=o(I),C=t.get(A);if(!m||!C||m===C.statement)continue;y.has(A)||y.set(A,[]);let h=y.get(A);if(!h)return;h.includes(m)||h.push(m)}let b=[];for(let[f,A]of y)if(A.length>0){if(A.length===0)continue;let I=A[0];if(!I)continue;let m=Number.MAX_SAFE_INTEGER,C=!1;for(let w of A)w.range[0]<I.range[0]&&(I=w);for(let w of d)E(w)&&w.typeName===f&&o(w.node)===I&&w.usagePosition<m&&(m=w.usagePosition,C=w.inFunctionArgs);if(!!(n.checkOnly&&n.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let v of d){if(v.typeName!==f)continue;let c=o(v.node);if(!c)continue;let F=s.indexOf(c);F!==-1&&F<w&&(w=F)}let P=s.indexOf(I);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let v of d){if(v.typeName!==f||l(v.node))continue;let c=o(v.node);if(!c)continue;let F=s.indexOf(c);F!==-1&&F<w&&(w=F)}let P=s.indexOf(I);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}b.push({typeName:f,firstUsage:I,firstUsagePosition:m,firstUsageInFunctionArgs:C})}b.length>0&&g(b)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as Ze from"zod/v4";var Ca=["tsx"],Ia=/^[A-Z][A-Za-z0-9]*$/,Aa=Ze.object({extensions:Ze.array(Ze.string()).optional()}),hn=q({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[B(Aa)]},defaultOptions:[{}],create(e,[n]){let r=e.getFilename(),t=n.extensions??Ca,s=!1;for(let m of t)if(r.endsWith(m)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function a(m){return Ia.test(m)}function l(m){if(m.type!==re.CallExpression)return!1;let C=m.callee;return C.type===re.Identifier?C.name==="memo"||C.name==="forwardRef":C.type===re.MemberExpression&&C.property.type===re.Identifier?C.property.name==="memo"||C.property.name==="forwardRef":!1}function u(m){if(m.type===re.JSXElement||m.type===re.JSXFragment)return!0;if(m.type===re.ArrayExpression){for(let C of m.elements)if(C&&(C.type===re.JSXElement||C.type===re.JSXFragment))return!0}return!1}function d(m){if(m.type!==re.ArrowFunctionExpression)return!1;let C=m.body;if(C.type===re.ArrowFunctionExpression){let h=C.body;if(u(h))return!0}return!1}function g(m){if(m.id.type!==re.Identifier)return;let C=m.id.name,h=m.init;if(h){if(a(C)&&(h.type===re.ArrowFunctionExpression||h.type===re.FunctionExpression||l(h))){i.add(C);return}h.type===re.Identifier&&p.set(C,h.name),a(C)||d(h)&&i.add(C)}}function x(m){if(m.type===re.VariableDeclaration){for(let C of m.declarations)g(C);return}if(m.type===re.FunctionDeclaration&&m.id){a(m.id.name)&&i.add(m.id.name);return}if(m.type===re.ExportNamedDeclaration&&m.declaration){let C=m.declaration;if(C.type===re.VariableDeclaration){for(let h of C.declarations)g(h);return}if(C.type===re.FunctionDeclaration&&C.id){a(C.id.name)&&i.add(C.id.name);return}}}for(let m of o.ast.body)x(m);function y(m,C=new Set){if(i.has(m))return!0;if(C.has(m))return!1;C.add(m);let h=p.get(m);return h?y(h,C):!1}let E=[];function b(m,C,h){E.push({node:m,isType:C,isComponent:h})}for(let m of o.ast.body){if(m.type===re.ExportNamedDeclaration){let C=m.exportKind==="type";if(m.declaration){let h=m.declaration;if(h.type===re.TSTypeAliasDeclaration||h.type===re.TSInterfaceDeclaration){b(h,!0,!1);continue}if(h.type===re.VariableDeclaration){for(let w of h.declarations){if(w.id.type!==re.Identifier)continue;let P=w.id.name,v=y(P);b(w,C,v)}continue}if(h.type===re.FunctionDeclaration){let w=h.id?.name,P=w?y(w)||a(w):!1;b(h,C,P);continue}b(h,C,!1);continue}if(m.specifiers.length>0)for(let h of m.specifiers){if(h.local.type!==re.Identifier)continue;let w=h.local.name,P=y(w);b(h,C,P)}continue}if(m.type===re.ExportDefaultDeclaration){let C=m.declaration;if(C.type===re.Identifier){let h=y(C.name)||a(C.name);b(m,!1,h);continue}if(C.type===re.FunctionDeclaration||C.type===re.ArrowFunctionExpression||C.type===re.FunctionExpression||C.type===re.CallExpression){b(m,!1,!0);continue}b(m,!1,!1);continue}}let f=!1;for(let m of E)if(!m.isType&&m.isComponent){f=!0;break}if(!f)return{};let A=[];for(let m of E)m.isType||A.push(m);let I=-1;for(let[m,C]of A.entries())if(C.isComponent){I=m;break}if(I===-1)return{};for(let[m,C]of A.entries())if(m!==I){e.report({node:C.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as We}from"@typescript-eslint/utils";import{z as En}from"zod/v4";function gt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wa(e){return e.callee.type===We.Identifier?e.callee.name==="useState":e.callee.type===We.MemberExpression&&e.callee.object.type===We.Identifier&&e.callee.property.type===We.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ra=En.object({ignorePrefixes:En.array(En.string()).optional()});function Gr(e,n){for(let r of n)if(e.startsWith(r))return e.slice(r.length);return e}function Fa(e){return`set${gt(e)}`}var bn=q({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[B(Ra)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[n]){return{VariableDeclarator(r){if(!r.init||r.init.type!==We.CallExpression||!wa(r.init)||r.id.type!==We.ArrayPattern||r.id.elements.length!==2)return;let[t,s]=r.id.elements;if(!t||!s||t.type!==We.Identifier||s.type!==We.Identifier)return;let o=t.name,i=s.name,p=n.ignorePrefixes||[],a=Gr(o,p),l=Gr(i,p);if(a===""){if(!l.startsWith("set")){let d=`set${gt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:gt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:g=>g.replaceText(s,d)}]})}return}let u=Fa(a);l!==u&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:gt(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:d=>d.replaceText(s,u)}]})}}}});import{AST_NODE_TYPES as ye}from"@typescript-eslint/utils";import{z as Ge}from"zod/v4";var ka=Ge.object({name:Ge.string(),defaults:Ge.array(Ge.unknown())}),Pa=Ge.object({functions:Ge.array(ka)});function St(e,n){if(e===n)return!0;if(e===null||n===null||e===void 0||n===void 0)return e===n;if(typeof e!=typeof n||typeof e!="object"||Array.isArray(e)!==Array.isArray(n))return!1;if(Array.isArray(e)&&Array.isArray(n))return e.length!==n.length?!1:e.every((s,o)=>St(s,n[o]));let r=Object.keys(e),t=Object.keys(n);if(r.length!==t.length)return!1;for(let s of r){if(!t.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(n,s);if(!o||!i)return!1;let p=o.value,a=i.value;if(!St(p,a))return!1}return!0}function va(e,n){let r=new Set;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return r;for(let t in e){if(!(t in n))continue;let s=Object.getOwnPropertyDescriptor(e,t),o=Object.getOwnPropertyDescriptor(n,t);s&&o&&St(s.value,o.value)&&r.add(t)}return r}function Kr(e){if(e.type===ye.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ye.Literal:return e.value;case ye.ObjectExpression:{let n={};for(let r of e.properties)r.type===ye.Property&&r.key.type===ye.Identifier&&!r.computed&&(r.value.type===ye.Literal?n[r.key.name]=r.value.value:r.value.type===ye.ObjectExpression?n[r.key.name]=Kr(r.value):n[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return n}case ye.ArrayExpression:return e.elements.map(n=>{if(!(!n||n.type===ye.SpreadElement))return n.type===ye.Literal?n.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Oa(e){return e.type===ye.Identifier?e.name:e.type===ye.MemberExpression&&e.property.type===ye.Identifier&&!e.computed?e.property.name:null}var xn=q({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[B(Pa)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map;for(let t of n.functions)r.set(t.name,t.defaults);return{CallExpression(t){let s=Oa(t.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=t.arguments;if(i.length===0)return;let p=-1,a=!1,l=new Map,u=new Set,d=new Map,g=[];for(let y=0;y<i.length;y++){if(y>=o.length){p=y;continue}let E=o[y],b=i[y];if(!b||b.type===ye.SpreadElement){p=y;continue}let f=Kr(b);if(E===void 0){p=y;continue}if(St(f,E)){b.type===ye.ObjectExpression?(u.add(y),g.push({type:"object",position:y+1})):(d.set(y,f),g.push({type:"simple",position:y+1,value:f}));continue}if(b.type===ye.ObjectExpression&&b.properties.length===0&&typeof E=="object"&&E!==null&&Object.keys(E).length>0){u.add(y),g.push({type:"object",position:y+1});continue}let A=va(f,E);if(A.size>0){let I=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(b.type===ye.ObjectExpression&&b.properties.length===A.size&&b.properties.length===I){u.add(y),g.push({type:"object",position:y+1});continue}else a=!0,l.set(y,A),g.push({type:"partialObject",position:y+1,redundantProperties:Array.from(A)}),p=y}else p=y}if(p<i.length-1||a||u.size>0){let y=function(){let b=[];for(let f of g)if(f.type==="simple")b.push(`Param ${f.position} with value ${JSON.stringify(f.value)}`);else if(f.type==="object")b.push(`Param ${f.position} (object)`);else{let A=f.redundantProperties||[],I=o?o[f.position-1]:void 0;if(typeof I=="object"&&I!==null){let m=I;for(let C of A)if(C in m){let h=Object.getOwnPropertyDescriptor(m,C);h&&b.push(`Param ${f.position} property "${C}" with value ${JSON.stringify(h.value)}`)}}}return{messageId:"redundantParams",data:{details:b.join(", ")}}};var x=y;let E=y();e.report({node:t,messageId:E.messageId,data:E.data,fix(b){let f=[];if(a)for(let[I,m]of l){let C=i[I];if(C&&C.type===ye.ObjectExpression){let h=[];for(let P of C.properties)P.type===ye.Property&&P.key.type===ye.Identifier&&!P.computed&&m.has(P.key.name)||h.push(P);let w=h.map(P=>e.sourceCode.getText(P));f.push(b.replaceText(C,`{ ${w.join(", ")} }`))}}let A=-1;for(let I=i.length-1;I>=0;I--)if(!u.has(I)&&I<=p){A=I;break}if(A<i.length-1)if(A===-1){let I=e.sourceCode.getTokenAfter(t.callee),m=e.sourceCode.getLastToken(t);I&&m&&f.push(b.replaceTextRange([I.range[1],m.range[0]],""))}else{let I=i[A],m=e.sourceCode.getLastToken(t);m&&I&&f.push(b.replaceTextRange([I.range[1],m.range[0]],""))}return f.length>0?f:null}})}}}}});import{AST_NODE_TYPES as ke}from"@typescript-eslint/utils";function Na(e){let n=e.parent;for(;n;){if(n.type===ke.AwaitExpression||n.type===ke.MemberExpression&&n.object===e&&n.property.type===ke.Identifier&&n.property.name==="then"||n.type===ke.ArrowFunctionExpression&&n.body===e)return!0;if(n.type===ke.ArrayExpression&&n.parent.type===ke.CallExpression){let r=n.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(n.parent)n=n.parent;else break}return!1}function Da(e){let{callee:n}=e;return n.type===ke.Identifier&&n.name==="require"||n.type===ke.MemberExpression&&n.object.type===ke.Identifier&&n.object.name==="require"}var Cn=q({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(n){Na(n)||e.report({node:n,messageId:"syncDynamicImport"})},TSImportType(n){e.report({node:n,messageId:"syncDynamicImport"})},CallExpression(n){Da(n)&&e.report({node:n,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as L}from"@typescript-eslint/utils";import{z as In}from"zod/v4";var ja=In.object({mainComponentRegex:In.string().optional(),mainComponentSelector:In.string().optional()}),La=/^[A-Z][A-Za-z0-9]*$/,An=q({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[B(ja)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.mainComponentRegex?new RegExp(n.mainComponentRegex):void 0,s=n.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,p=new Map,a=[],l=[],u=new Set;function d(T){let S=T.node;if(S.type===L.VariableDeclaration){for(let R of S.declarations)if(R.id.type===L.Identifier&&R.id.name===T.name&&R.init)return R.init}if(S.type===L.ExportNamedDeclaration){let R=S.declaration;if(R&&R.type===L.VariableDeclaration){for(let O of R.declarations)if(O.id.type===L.Identifier&&O.id.name===T.name&&O.init)return O.init}}return null}function g(T){let S=new Set;return ve(T,R=>(R.type===L.Identifier&&R.name!=="styled"&&R.name!=="css"&&S.add(R.name),!1),r),S}function x(T){return La.test(T)}function y(T){if(T.type!==L.CallExpression)return!1;let S=T.callee;return S.type===L.Identifier?S.name==="memo"||S.name==="forwardRef":S.type===L.MemberExpression&&S.property.type===L.Identifier?S.property.name==="memo"||S.property.name==="forwardRef":!1}function E(T){if(T.type===L.JSXElement||T.type===L.JSXFragment)return!0;if(T.type===L.BlockStatement){for(let S of T.body)if(S.type===L.ReturnStatement&&S.argument)return E(S.argument)}if(T.type===L.ArrayExpression){for(let S of T.elements)if(S&&(S.type===L.JSXElement||S.type===L.JSXFragment))return!0}return!1}function b(T){if(T.type!==L.ArrowFunctionExpression)return!1;let S=T.body;if(S.type===L.ArrowFunctionExpression){let R=S.body;if(E(R))return!0}return!1}function f(T){if(T.type===L.TaggedTemplateExpression){let S=T.tag;if(S.type===L.MemberExpression&&S.object.type===L.Identifier&&S.object.name==="styled")return!0;if(S.type===L.CallExpression){let R=S.callee;if(R.type===L.Identifier&&R.name==="styled")return!0}}return!1}function A(T){if(T.type===L.TaggedTemplateExpression){let S=T.tag;if(S.type===L.Identifier&&S.name==="css")return!0}return!1}function I(T,S){if(T.id.type!==L.Identifier)return;let R=T.id.name,O=T.init;if(O){if(f(O)||A(O)){l.push({node:S,name:R});return}if((x(R)||O.type===L.ArrowFunctionExpression)&&(O.type===L.ArrowFunctionExpression||O.type===L.FunctionExpression||y(O))){if(O.type===L.ArrowFunctionExpression||O.type===L.FunctionExpression){if(E(O.body)){i.add(R);return}}else if(y(O)){i.add(R);return}}O.type===L.Identifier&&p.set(R,O.name),x(R)||b(O)&&i.add(R)}}function m(T){return T.type===L.ExportDefaultDeclaration||T.type===L.ExportNamedDeclaration}function C(T){if(T.type===L.FunctionDeclaration)return T.id?T.id.name:null;if(T.type===L.VariableDeclaration){let S=T.declarations[0];if(S&&S.id.type===L.Identifier)return S.id.name}if(T.type===L.ExportDefaultDeclaration){let S=T.declaration;if(S.type===L.FunctionDeclaration)return S.id?S.id.name:"default";if(S.type===L.Identifier)return S.name}if(T.type===L.ExportNamedDeclaration){let S=T.declaration;if(S&&S.type===L.FunctionDeclaration)return S.id?S.id.name:null;if(S&&S.type===L.VariableDeclaration){let R=S.declarations[0];if(R&&R.id.type===L.Identifier)return R.id.name}}return null}function h(T,S){return s?u.has(T):t?t.test(S):m(T)}function w(T){let S=new Set;ve(T.node,R=>{if(R.type===L.Identifier)for(let O of l)O.name===R.name&&(S.add(O.name),(O.firstUsagePosition===void 0||R.range[0]<O.firstUsagePosition)&&(O.firstUsagePosition=R.range[0]));if(R.type===L.JSXElement){let O=R.openingElement;if(O.name.type===L.JSXIdentifier)for(let D of l)D.name===O.name.name&&(S.add(D.name),(D.firstUsagePosition===void 0||O.name.range[0]<D.firstUsagePosition)&&(D.firstUsagePosition=O.name.range[0]))}return!1},r),T.usedStyles=S}function P(T){if(T.type===L.VariableDeclaration){for(let S of T.declarations)I(S,T);return}if(T.type===L.FunctionDeclaration){x(T.id.name)&&E(T.body)&&i.add(T.id.name);return}if(T.type===L.ExportNamedDeclaration&&T.declaration){let S=T.declaration;if(S.type===L.VariableDeclaration){for(let R of S.declarations)I(R,T);return}if(S.type===L.FunctionDeclaration&&S.id){x(S.id.name)&&E(S.body)&&i.add(S.id.name);return}}if(T.type===L.ExportDefaultDeclaration){let S=T.declaration;S.type===L.Identifier&&i.add(S.name),(S.type===L.FunctionDeclaration||S.type===L.ArrowFunctionExpression||S.type===L.FunctionExpression)&&(S.type===L.FunctionDeclaration?S.id?i.add(S.id.name):i.add("default"):E(S.body)&&i.add("default"))}}function v(T,S=new Set){if(i.has(T))return!0;if(S.has(T))return!1;S.add(T);let R=p.get(T);return R?v(R,S):!1}let c={};return s&&(c[s]=T=>{let S=T;for(;S.parent&&S.parent.type!==L.Program;)S=S.parent;S.parent&&(S.type===L.VariableDeclaration||S.type===L.FunctionDeclaration||S.type===L.ExportNamedDeclaration||S.type===L.ExportDefaultDeclaration)&&u.add(S)}),c["Program:exit"]=T=>{let S=0;for(let j of T.body){if(j.type===L.ImportDeclaration){S+=1;continue}break}for(let j of T.body)P(j);for(let j of T.body){let Y=C(j);if(Y&&v(Y)){let H=h(j,Y);a.push({node:j,name:Y,isMainComponent:H,usedStyles:new Set,isExported:m(j)})}}if(!s&&t&&!a.some(j=>j.isMainComponent))for(let j of a)j.isExported&&(j.isMainComponent=!0);for(let j of a)w(j);let R=new Set;for(let j of l)R.add(j.name);let O=new Map;for(let j=0;j<T.body.length;j+=1){let Y=T.body[j];for(let H of l)H.node===Y&&O.set(H.name,j)}let D=new Map;for(let j of l){let Y=d(j),H=new Set;if(Y){let ce=g(Y);for(let de of ce)R.has(de)&&de!==j.name&&H.add(de)}D.set(j.name,H)}let Z=new Map;for(let j of l){let Y=D.get(j.name);if(!Y)continue;let H=O.get(j.name);if(H!==void 0)for(let ce of Y){let de=Z.get(ce);(de===void 0||H<de)&&Z.set(ce,H)}}let G=[];for(let j of l){if(j.firstUsagePosition===void 0)continue;let Y=T.body.indexOf(j.node),H=-1;for(let ge of a){if(!ge.usedStyles.has(j.name))continue;let xe=T.body.indexOf(ge.node);(H===-1||xe<H)&&(H=xe)}let ce=Z.get(j.name);if(ce!==void 0&&(H===-1||ce<H)&&(H=ce),H===-1)continue;let de=-1;for(let ge of a){let xe=T.body.indexOf(ge.node);xe<H&&xe>de&&(de=xe)}let Ee=Y<H,Ie=Y>de,Ae=-1,Je=D.get(j.name);if(Je)for(let ge of Je){let xe=O.get(ge);xe!==void 0&&xe>Ae&&(Ae=xe)}let wn=Y>Ae;if(!(Ee&&Ie&&wn)){let ge=de+1;if(Ae+1>ge&&(ge=Ae+1),ge<S&&(ge=S),ge>H)continue;G.push({style:j,targetPosition:ge})}}let V=null;if(a.length>1){let j=a.map(H=>({c:H,idx:T.body.indexOf(H.node)})).sort((H,ce)=>H.idx-ce.idx)[0]?.c,Y=a.find(H=>H.isMainComponent)||null;j&&Y&&j.node!==Y.node&&(V={component:Y,targetBefore:j.node})}if(G.length>0||V){let j=G[0]?.style.node||V?.component.node||T,Y=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:j,messageId:Y,fix:F(G,V,T.body)})}},c;function F(T,S,R){return function*(O){T.sort((Z,G)=>Z.targetPosition-G.targetPosition);for(let{style:Z}of T){let G=r.getCommentsBefore(Z.node),V=Z.node.range[0],j=Z.node.range[1];G.length>0&&G[0]&&(V=G[0].range[0]),V===Z.node.range[0]&&r.text.slice(0,V).trim().length===0&&(V=0),yield O.removeRange([V,j])}let D=new Map;for(let Z of T){let G=D.get(Z.targetPosition)||[];G.push(Z),D.set(Z.targetPosition,G)}for(let[Z,G]of D){let V=R[Z];if(!V)continue;let j=r.getCommentsBefore(V),Y=j.length>0&&j[0]?j[0].range[0]:V.range[0],H=[];for(let{style:ce}of G){let de=r.getCommentsBefore(ce.node),Ee=r.getText(ce.node);de.length>0&&(Ee=`${de.map(Ae=>r.getText(Ae)).join(`
46
+ `)}}}return{Program(f){s.push(...f.body)},TSTypeAliasDeclaration(f){if(s.some(x=>x.type===Te.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSInterfaceDeclaration(f){if(s.some(x=>x.type===Te.ExportNamedDeclaration&&x.declaration===f?!0:x===f)){let x=o(f);x&&t.set(f.id.name,{node:f,name:f.id.name,statement:x})}},TSTypeReference(f){if(f.typeName.type===Te.Identifier){if(u(f))return;let E=i(f),x=p(f),S=c(f);m.push({typeName:f.typeName.name,node:f,inFunctionArgs:E,inFCProps:x,inGenericArgAtFunctionCall:S,usagePosition:f.range[0]})}},"Program:exit"(){let f=new Map;function E(S){if(!n.checkOnly||n.checkOnly.length===0)return!0;for(let I of n.checkOnly)if(I==="function-args"&&S.inFunctionArgs||I==="FC"&&S.inFCProps||I==="generic-args-at-fn-calls"&&S.inGenericArgAtFunctionCall)return!0;return!1}for(let S of m){let{typeName:I,node:A}=S;if(!t.has(I)||!E(S))continue;let T=o(A),h=t.get(I);if(!T||!h||T===h.statement)continue;f.has(I)||f.set(I,[]);let b=f.get(I);if(!b)return;b.includes(T)||b.push(T)}let x=[];for(let[S,I]of f)if(I.length>0){if(I.length===0)continue;let A=I[0];if(!A)continue;let T=Number.MAX_SAFE_INTEGER,h=!1;for(let w of I)w.range[0]<A.range[0]&&(A=w);for(let w of m)E(w)&&w.typeName===S&&o(w.node)===A&&w.usagePosition<T&&(T=w.usagePosition,h=w.inFunctionArgs);if(!!(n.checkOnly&&n.checkOnly.length>0)){let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S)continue;let l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let P=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}else{let w=Number.MAX_SAFE_INTEGER;for(let N of m){if(N.typeName!==S||a(N.node))continue;let l=o(N.node);if(!l)continue;let R=s.indexOf(l);R!==-1&&R<w&&(w=R)}let P=s.indexOf(A);if(w!==Number.MAX_SAFE_INTEGER&&P!==-1&&w<P)continue}x.push({typeName:S,firstUsage:A,firstUsagePosition:T,firstUsageInFunctionArgs:h})}x.length>0&&y(x)}}}});import{AST_NODE_TYPES as re}from"@typescript-eslint/utils";import*as Ze from"zod/v4";var Ia=["tsx"],Aa=/^[A-Z][A-Za-z0-9]*$/,wa=Ze.object({extensions:Ze.array(Ze.string()).optional()}),bn=q({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[B(wa)]},defaultOptions:[{}],create(e,[n]){let r=e.getFilename(),t=n.extensions??Ia,s=!1;for(let T of t)if(r.endsWith(T)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function c(T){return Aa.test(T)}function a(T){if(T.type!==re.CallExpression)return!1;let h=T.callee;return h.type===re.Identifier?h.name==="memo"||h.name==="forwardRef":h.type===re.MemberExpression&&h.property.type===re.Identifier?h.property.name==="memo"||h.property.name==="forwardRef":!1}function u(T){if(T.type===re.JSXElement||T.type===re.JSXFragment)return!0;if(T.type===re.ArrayExpression){for(let h of T.elements)if(h&&(h.type===re.JSXElement||h.type===re.JSXFragment))return!0}return!1}function m(T){if(T.type!==re.ArrowFunctionExpression)return!1;let h=T.body;if(h.type===re.ArrowFunctionExpression){let b=h.body;if(u(b))return!0}return!1}function y(T){if(T.id.type!==re.Identifier)return;let h=T.id.name,b=T.init;if(b){if(c(h)&&(b.type===re.ArrowFunctionExpression||b.type===re.FunctionExpression||a(b))){i.add(h);return}b.type===re.Identifier&&p.set(h,b.name),c(h)||m(b)&&i.add(h)}}function C(T){if(T.type===re.VariableDeclaration){for(let h of T.declarations)y(h);return}if(T.type===re.FunctionDeclaration&&T.id){c(T.id.name)&&i.add(T.id.name);return}if(T.type===re.ExportNamedDeclaration&&T.declaration){let h=T.declaration;if(h.type===re.VariableDeclaration){for(let b of h.declarations)y(b);return}if(h.type===re.FunctionDeclaration&&h.id){c(h.id.name)&&i.add(h.id.name);return}}}for(let T of o.ast.body)C(T);function f(T,h=new Set){if(i.has(T))return!0;if(h.has(T))return!1;h.add(T);let b=p.get(T);return b?f(b,h):!1}let E=[];function x(T,h,b){E.push({node:T,isType:h,isComponent:b})}for(let T of o.ast.body){if(T.type===re.ExportNamedDeclaration){let h=T.exportKind==="type";if(T.declaration){let b=T.declaration;if(b.type===re.TSTypeAliasDeclaration||b.type===re.TSInterfaceDeclaration){x(b,!0,!1);continue}if(b.type===re.VariableDeclaration){for(let w of b.declarations){if(w.id.type!==re.Identifier)continue;let P=w.id.name,N=f(P);x(w,h,N)}continue}if(b.type===re.FunctionDeclaration){let w=b.id?.name,P=w?f(w)||c(w):!1;x(b,h,P);continue}x(b,h,!1);continue}if(T.specifiers.length>0)for(let b of T.specifiers){if(b.local.type!==re.Identifier)continue;let w=b.local.name,P=f(w);x(b,h,P)}continue}if(T.type===re.ExportDefaultDeclaration){let h=T.declaration;if(h.type===re.Identifier){let b=f(h.name)||c(h.name);x(T,!1,b);continue}if(h.type===re.FunctionDeclaration||h.type===re.ArrowFunctionExpression||h.type===re.FunctionExpression||h.type===re.CallExpression){x(T,!1,!0);continue}x(T,!1,!1);continue}}let S=!1;for(let T of E)if(!T.isType&&T.isComponent){S=!0;break}if(!S)return{};let I=[];for(let T of E)T.isType||I.push(T);let A=-1;for(let[T,h]of I.entries())if(h.isComponent){A=T;break}if(A===-1)return{};for(let[T,h]of I.entries())if(T!==A){e.report({node:h.node,messageId:"multipleExports"});break}return{}}});import{AST_NODE_TYPES as We}from"@typescript-eslint/utils";import{z as xn}from"zod/v4";function St(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ra(e){return e.callee.type===We.Identifier?e.callee.name==="useState":e.callee.type===We.MemberExpression&&e.callee.object.type===We.Identifier&&e.callee.property.type===We.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Fa=xn.object({ignorePrefixes:xn.array(xn.string()).optional()});function Gr(e,n){for(let r of n)if(e.startsWith(r))return e.slice(r.length);return e}function ka(e){return`set${St(e)}`}var Cn=q({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[B(Fa)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[n]){return{VariableDeclarator(r){if(!r.init||r.init.type!==We.CallExpression||!Ra(r.init)||r.id.type!==We.ArrayPattern||r.id.elements.length!==2)return;let[t,s]=r.id.elements;if(!t||!s||t.type!==We.Identifier||s.type!==We.Identifier)return;let o=t.name,i=s.name,p=n.ignorePrefixes||[],c=Gr(o,p),a=Gr(i,p);if(c===""){if(!a.startsWith("set")){let m=`set${St(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:St(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:m},fix:y=>y.replaceText(s,m)}]})}return}let u=ka(c);a!==u&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:St(c),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:m=>m.replaceText(s,u)}]})}}}});import{AST_NODE_TYPES as de}from"@typescript-eslint/utils";import{z as Ge}from"zod/v4";var Pa=Ge.object({name:Ge.string(),defaults:Ge.array(Ge.unknown())}),va=Ge.object({functions:Ge.array(Pa)});function Tt(e,n){if(e===n)return!0;if(e===null||n===null||e===void 0||n===void 0)return e===n;if(typeof e!=typeof n||typeof e!="object"||Array.isArray(e)!==Array.isArray(n))return!1;if(Array.isArray(e)&&Array.isArray(n))return e.length!==n.length?!1:e.every((s,o)=>Tt(s,n[o]));let r=Object.keys(e),t=Object.keys(n);if(r.length!==t.length)return!1;for(let s of r){if(!t.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(n,s);if(!o||!i)return!1;let p=o.value,c=i.value;if(!Tt(p,c))return!1}return!0}function Oa(e,n){let r=new Set;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return r;for(let t in e){if(!(t in n))continue;let s=Object.getOwnPropertyDescriptor(e,t),o=Object.getOwnPropertyDescriptor(n,t);s&&o&&Tt(s.value,o.value)&&r.add(t)}return r}function Kr(e){if(e.type===de.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case de.Literal:return e.value;case de.ObjectExpression:{let n={};for(let r of e.properties)r.type===de.Property&&r.key.type===de.Identifier&&!r.computed&&(r.value.type===de.Literal?n[r.key.name]=r.value.value:r.value.type===de.ObjectExpression?n[r.key.name]=Kr(r.value):n[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return n}case de.ArrayExpression:return e.elements.map(n=>{if(!(!n||n.type===de.SpreadElement))return n.type===de.Literal?n.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Na(e){return e.type===de.Identifier?e.name:e.type===de.MemberExpression&&e.property.type===de.Identifier&&!e.computed?e.property.name:null}var In=q({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[B(va)]},defaultOptions:[{functions:[]}],create(e,[n]){let r=new Map;for(let t of n.functions)r.set(t.name,t.defaults);return{CallExpression(t){let s=Na(t.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=t.arguments;if(i.length===0)return;let p=-1,c=!1,a=new Map,u=new Set,m=new Map,y=[];for(let f=0;f<i.length;f++){if(f>=o.length){p=f;continue}let E=o[f],x=i[f];if(!x||x.type===de.SpreadElement){p=f;continue}let S=Kr(x);if(E===void 0){p=f;continue}if(Tt(S,E)){x.type===de.ObjectExpression?(u.add(f),y.push({type:"object",position:f+1})):(m.set(f,S),y.push({type:"simple",position:f+1,value:S}));continue}if(x.type===de.ObjectExpression&&x.properties.length===0&&typeof E=="object"&&E!==null&&Object.keys(E).length>0){u.add(f),y.push({type:"object",position:f+1});continue}let I=Oa(S,E);if(I.size>0){let A=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(x.type===de.ObjectExpression&&x.properties.length===I.size&&x.properties.length===A){u.add(f),y.push({type:"object",position:f+1});continue}else c=!0,a.set(f,I),y.push({type:"partialObject",position:f+1,redundantProperties:Array.from(I)}),p=f}else p=f}if(p<i.length-1||c||u.size>0){let f=function(){let x=[];for(let S of y)if(S.type==="simple")x.push(`Param ${S.position} with value ${JSON.stringify(S.value)}`);else if(S.type==="object")x.push(`Param ${S.position} (object)`);else{let I=S.redundantProperties||[],A=o?o[S.position-1]:void 0;if(typeof A=="object"&&A!==null){let T=A;for(let h of I)if(h in T){let b=Object.getOwnPropertyDescriptor(T,h);b&&x.push(`Param ${S.position} property "${h}" with value ${JSON.stringify(b.value)}`)}}}return{messageId:"redundantParams",data:{details:x.join(", ")}}};var C=f;let E=f();e.report({node:t,messageId:E.messageId,data:E.data,fix(x){let S=[];if(c)for(let[A,T]of a){let h=i[A];if(h&&h.type===de.ObjectExpression){let b=[];for(let P of h.properties)P.type===de.Property&&P.key.type===de.Identifier&&!P.computed&&T.has(P.key.name)||b.push(P);let w=b.map(P=>e.sourceCode.getText(P));S.push(x.replaceText(h,`{ ${w.join(", ")} }`))}}let I=-1;for(let A=i.length-1;A>=0;A--)if(!u.has(A)&&A<=p){I=A;break}if(I<i.length-1)if(I===-1){let A=e.sourceCode.getTokenAfter(t.callee),T=e.sourceCode.getLastToken(t);A&&T&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}else{let A=i[I],T=e.sourceCode.getLastToken(t);T&&A&&S.push(x.replaceTextRange([A.range[1],T.range[0]],""))}return S.length>0?S:null}})}}}}});import{AST_NODE_TYPES as Fe}from"@typescript-eslint/utils";function Da(e){let n=e.parent;for(;n;){if(n.type===Fe.AwaitExpression||n.type===Fe.MemberExpression&&n.object===e&&n.property.type===Fe.Identifier&&n.property.name==="then"||n.type===Fe.ArrowFunctionExpression&&n.body===e)return!0;if(n.type===Fe.ArrayExpression&&n.parent.type===Fe.CallExpression){let r=n.parent;if(r.callee.type===Fe.MemberExpression&&r.callee.object.type===Fe.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Fe.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(n.parent)n=n.parent;else break}return!1}function ja(e){let{callee:n}=e;return n.type===Fe.Identifier&&n.name==="require"||n.type===Fe.MemberExpression&&n.object.type===Fe.Identifier&&n.object.name==="require"}var An=q({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(n){Da(n)||e.report({node:n,messageId:"syncDynamicImport"})},TSImportType(n){e.report({node:n,messageId:"syncDynamicImport"})},CallExpression(n){ja(n)&&e.report({node:n,messageId:"requireNotAllowed"})}}}});import{AST_NODE_TYPES as L}from"@typescript-eslint/utils";import{z as wn}from"zod/v4";var La=wn.object({mainComponentRegex:wn.string().optional(),mainComponentSelector:wn.string().optional()}),Ma=/^[A-Z][A-Za-z0-9]*$/,Rn=q({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[B(La)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[n]){let r=e.sourceCode,t=n.mainComponentRegex?new RegExp(n.mainComponentRegex):void 0,s=n.mainComponentSelector;if(!e.filename.endsWith(".tsx"))return{};let i=new Set,p=new Map,c=[],a=[],u=new Set;function m(d){let g=d.node;if(g.type===L.VariableDeclaration){for(let F of g.declarations)if(F.id.type===L.Identifier&&F.id.name===d.name&&F.init)return F.init}if(g.type===L.ExportNamedDeclaration){let F=g.declaration;if(F&&F.type===L.VariableDeclaration){for(let v of F.declarations)if(v.id.type===L.Identifier&&v.id.name===d.name&&v.init)return v.init}}return null}function y(d){let g=new Set;return Pe(d,F=>(F.type===L.Identifier&&F.name!=="styled"&&F.name!=="css"&&g.add(F.name),!1),r),g}function C(d){return Ma.test(d)}function f(d){if(d.type!==L.CallExpression)return!1;let g=d.callee;return g.type===L.Identifier?g.name==="memo"||g.name==="forwardRef":g.type===L.MemberExpression&&g.property.type===L.Identifier?g.property.name==="memo"||g.property.name==="forwardRef":!1}function E(d){if(d.type===L.JSXElement||d.type===L.JSXFragment)return!0;if(d.type===L.BlockStatement){for(let g of d.body)if(g.type===L.ReturnStatement&&g.argument)return E(g.argument)}if(d.type===L.ArrayExpression){for(let g of d.elements)if(g&&(g.type===L.JSXElement||g.type===L.JSXFragment))return!0}return!1}function x(d){if(d.type!==L.ArrowFunctionExpression)return!1;let g=d.body;if(g.type===L.ArrowFunctionExpression){let F=g.body;if(E(F))return!0}return!1}function S(d){if(d.type===L.TaggedTemplateExpression){let g=d.tag;if(g.type===L.MemberExpression&&g.object.type===L.Identifier&&g.object.name==="styled")return!0;if(g.type===L.CallExpression){let F=g.callee;if(F.type===L.Identifier&&F.name==="styled")return!0}}return!1}function I(d){if(d.type===L.TaggedTemplateExpression){let g=d.tag;if(g.type===L.Identifier&&g.name==="css")return!0}return!1}function A(d,g){if(d.id.type!==L.Identifier)return;let F=d.id.name,v=d.init;if(v){if(S(v)||I(v)){a.push({node:g,name:F});return}if((C(F)||v.type===L.ArrowFunctionExpression)&&(v.type===L.ArrowFunctionExpression||v.type===L.FunctionExpression||f(v))){if(v.type===L.ArrowFunctionExpression||v.type===L.FunctionExpression){if(E(v.body)){i.add(F);return}}else if(f(v)){i.add(F);return}}v.type===L.Identifier&&p.set(F,v.name),C(F)||x(v)&&i.add(F)}}function T(d){return d.type===L.ExportDefaultDeclaration||d.type===L.ExportNamedDeclaration}function h(d){if(d.type===L.FunctionDeclaration)return d.id?d.id.name:null;if(d.type===L.VariableDeclaration){let g=d.declarations[0];if(g&&g.id.type===L.Identifier)return g.id.name}if(d.type===L.ExportDefaultDeclaration){let g=d.declaration;if(g.type===L.FunctionDeclaration)return g.id?g.id.name:"default";if(g.type===L.Identifier)return g.name}if(d.type===L.ExportNamedDeclaration){let g=d.declaration;if(g&&g.type===L.FunctionDeclaration)return g.id?g.id.name:null;if(g&&g.type===L.VariableDeclaration){let F=g.declarations[0];if(F&&F.id.type===L.Identifier)return F.id.name}}return null}function b(d,g){return s?u.has(d):t?t.test(g):T(d)}function w(d){let g=new Set;Pe(d.node,F=>{if(F.type===L.Identifier)for(let v of a)v.name===F.name&&(g.add(v.name),(v.firstUsagePosition===void 0||F.range[0]<v.firstUsagePosition)&&(v.firstUsagePosition=F.range[0]));if(F.type===L.JSXElement){let v=F.openingElement;if(v.name.type===L.JSXIdentifier)for(let j of a)j.name===v.name.name&&(g.add(j.name),(j.firstUsagePosition===void 0||v.name.range[0]<j.firstUsagePosition)&&(j.firstUsagePosition=v.name.range[0]))}return!1},r),d.usedStyles=g}function P(d){if(d.type===L.VariableDeclaration){for(let g of d.declarations)A(g,d);return}if(d.type===L.FunctionDeclaration){C(d.id.name)&&E(d.body)&&i.add(d.id.name);return}if(d.type===L.ExportNamedDeclaration&&d.declaration){let g=d.declaration;if(g.type===L.VariableDeclaration){for(let F of g.declarations)A(F,d);return}if(g.type===L.FunctionDeclaration&&g.id){C(g.id.name)&&E(g.body)&&i.add(g.id.name);return}}if(d.type===L.ExportDefaultDeclaration){let g=d.declaration;g.type===L.Identifier&&i.add(g.name),(g.type===L.FunctionDeclaration||g.type===L.ArrowFunctionExpression||g.type===L.FunctionExpression)&&(g.type===L.FunctionDeclaration?g.id?i.add(g.id.name):i.add("default"):E(g.body)&&i.add("default"))}}function N(d,g=new Set){if(i.has(d))return!0;if(g.has(d))return!1;g.add(d);let F=p.get(d);return F?N(F,g):!1}let l={};return s&&(l[s]=d=>{let g=d;for(;g.parent&&g.parent.type!==L.Program;)g=g.parent;g.parent&&(g.type===L.VariableDeclaration||g.type===L.FunctionDeclaration||g.type===L.ExportNamedDeclaration||g.type===L.ExportDefaultDeclaration)&&u.add(g)}),l["Program:exit"]=d=>{let g=0;for(let D of d.body){if(D.type===L.ImportDeclaration){g+=1;continue}break}for(let D of d.body)P(D);for(let D of d.body){let Z=h(D);if(Z&&N(Z)){let Y=b(D,Z);c.push({node:D,name:Z,isMainComponent:Y,usedStyles:new Set,isExported:T(D)})}}if(!s&&t&&!c.some(D=>D.isMainComponent))for(let D of c)D.isExported&&(D.isMainComponent=!0);for(let D of c)w(D);let F=new Set;for(let D of a)F.add(D.name);let v=new Map;for(let D=0;D<d.body.length;D+=1){let Z=d.body[D];for(let Y of a)Y.node===Z&&v.set(Y.name,D)}let j=new Map;for(let D of a){let Z=m(D),Y=new Set;if(Z){let ce=y(Z);for(let ue of ce)F.has(ue)&&ue!==D.name&&Y.add(ue)}j.set(D.name,Y)}let J=new Map;for(let D of a){let Z=j.get(D.name);if(!Z)continue;let Y=v.get(D.name);if(Y!==void 0)for(let ce of Z){let ue=J.get(ce);(ue===void 0||Y<ue)&&J.set(ce,Y)}}let G=[];for(let D of a){if(D.firstUsagePosition===void 0)continue;let Z=d.body.indexOf(D.node),Y=-1;for(let Ee of c){if(!Ee.usedStyles.has(D.name))continue;let xe=d.body.indexOf(Ee.node);(Y===-1||xe<Y)&&(Y=xe)}let ce=J.get(D.name);if(ce!==void 0&&(Y===-1||ce<Y)&&(Y=ce),Y===-1)continue;let ue=-1;for(let Ee of c){let xe=d.body.indexOf(Ee.node);xe<Y&&xe>ue&&(ue=xe)}let Ie=Z<Y,_e=Z>ue,ge=-1,Ke=j.get(D.name);if(Ke)for(let Ee of Ke){let xe=v.get(Ee);xe!==void 0&&xe>ge&&(ge=xe)}let Be=Z>ge;if(!(Ie&&_e&&Be)){let Ee=ue+1;if(ge+1>Ee&&(Ee=ge+1),Ee<g&&(Ee=g),Ee>Y)continue;G.push({style:D,targetPosition:Ee})}}let H=null;if(c.length>1){let D=c.map(Y=>({c:Y,idx:d.body.indexOf(Y.node)})).sort((Y,ce)=>Y.idx-ce.idx)[0]?.c,Z=c.find(Y=>Y.isMainComponent)||null;D&&Z&&D.node!==Z.node&&(H={component:Z,targetBefore:D.node})}if(G.length>0||H){let D=G[0]?.style.node||H?.component.node||d,Z=G.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:Z,fix:R(G,H,d.body)})}},l;function R(d,g,F){return function*(v){d.sort((J,G)=>J.targetPosition-G.targetPosition);for(let{style:J}of d){let G=r.getCommentsBefore(J.node),H=J.node.range[0],D=J.node.range[1];G.length>0&&G[0]&&(H=G[0].range[0]),H===J.node.range[0]&&r.text.slice(0,H).trim().length===0&&(H=0),yield v.removeRange([H,D])}let j=new Map;for(let J of d){let G=j.get(J.targetPosition)||[];G.push(J),j.set(J.targetPosition,G)}for(let[J,G]of j){let H=F[J];if(!H)continue;let D=r.getCommentsBefore(H),Z=D.length>0&&D[0]?D[0].range[0]:H.range[0],Y=[];for(let{style:ce}of G){let ue=r.getCommentsBefore(ce.node),Ie=r.getText(ce.node);ue.length>0&&(Ie=`${ue.map(ge=>r.getText(ge)).join(`
47
47
  `)}
48
- ${Ee}`),H.push(Ee)}yield O.insertTextBeforeRange([Y,Y],`${H.join(`
48
+ ${Ie}`),Y.push(Ie)}yield v.insertTextBeforeRange([Z,Z],`${Y.join(`
49
49
 
50
50
  `)}
51
51
 
52
- `)}if(S){let{component:Z,targetBefore:G}=S,V=r.getCommentsBefore(Z.node),j=Z.node.range[0],Y=Z.node.range[1];V.length>0&&V[0]&&(j=V[0].range[0]),j===Z.node.range[0]&&r.text.slice(0,j).trim().length===0&&(j=0);let H=r.getCommentsBefore(G),ce=H.length>0&&H[0]?H[0].range[0]:G.range[0],de=(()=>{let Ee=r.getText(Z.node);return V.length>0&&(Ee=`${V.map(Ae=>r.getText(Ae)).join(`
52
+ `)}if(g){let{component:J,targetBefore:G}=g,H=r.getCommentsBefore(J.node),D=J.node.range[0],Z=J.node.range[1];H.length>0&&H[0]&&(D=H[0].range[0]),D===J.node.range[0]&&r.text.slice(0,D).trim().length===0&&(D=0);let Y=r.getCommentsBefore(G),ce=Y.length>0&&Y[0]?Y[0].range[0]:G.range[0],ue=(()=>{let Ie=r.getText(J.node);return H.length>0&&(Ie=`${H.map(ge=>r.getText(ge)).join(`
53
53
  `)}
54
- ${Ee}`),Ee})();yield O.removeRange([j,Y]),yield O.insertTextBeforeRange([ce,ce],`${de}
55
- `)}}}}});var Qr={[qt.name]:qt.rule,[Pt.name]:Pt.rule,[kt.name]:kt.rule,"rules-of-hooks":Yr,"exhaustive-deps":Mn,"require-description":Ur.rule,[vt.name]:vt.rule,[Nt.name]:Nt.rule,[Kt.name]:Kt.rule,[Tt.name]:Tt.rule,[Ft.name]:Ft.rule,[Lt.name]:Lt.rule,[Qe.name]:Qe.rule,[nn.name]:nn.rule,[Dt.name]:Dt.rule,[Ot.name]:Ot.rule,[Mt.name]:Mt.rule,[Et.name]:Et.rule,[ln.name]:ln.rule,[an.name]:an.rule,[un.name]:un.rule,[wt.name]:wt.rule,[zt.name]:zt.rule,[Wt.name]:Wt.rule,[Jt.name]:Jt.rule,[Bt.name]:Bt.rule,[Ht.name]:Ht.rule,[Vt.name]:Vt.rule,[Xt.name]:Xt.rule,[en.name]:en.rule,[_t.name]:_t.rule,[$t.name]:$t.rule,[Sn.name]:Sn.rule,[Zt.name]:Zt.rule,[fn.name]:fn.rule,[gn.name]:gn.rule,[Tn.name]:Tn.rule,[hn.name]:hn.rule,[bn.name]:bn.rule,[xn.name]:xn.rule,[Cn.name]:Cn.rule,[An.name]:An.rule,[Qe.name]:Qe.rule};var rf={rules:Qr};export{rf as extendedLintPlugin};
54
+ ${Ie}`),Ie})();yield v.removeRange([D,Z]),yield v.insertTextBeforeRange([ce,ce],`${ue}
55
+ `)}}}}});var Qr={[Gt.name]:Gt.rule,[Ot.name]:Ot.rule,[vt.name]:vt.rule,"rules-of-hooks":Yr,"exhaustive-deps":Mn,"require-description":Ur.rule,[Nt.name]:Nt.rule,[jt.name]:jt.rule,[en.name]:en.rule,[Et.name]:Et.rule,[Pt.name]:Pt.rule,[$t.name]:$t.rule,[et.name]:et.rule,[sn.name]:sn.rule,[Lt.name]:Lt.rule,[Dt.name]:Dt.rule,[_t.name]:_t.rule,[xt.name]:xt.rule,[cn.name]:cn.rule,[pn.name]:pn.rule,[mn.name]:mn.rule,[Ft.name]:Ft.rule,[Jt.name]:Jt.rule,[Vt.name]:Vt.rule,[Xt.name]:Xt.rule,[Yt.name]:Yt.rule,[qt.name]:qt.rule,[Bt.name]:Bt.rule,[Ht.name]:Ht.rule,[nn.name]:nn.rule,[zt.name]:zt.rule,[Ut.name]:Ut.rule,[hn.name]:hn.rule,[Kt.name]:Kt.rule,[yn.name]:yn.rule,[Tn.name]:Tn.rule,[En.name]:En.rule,[bn.name]:bn.rule,[Cn.name]:Cn.rule,[In.name]:In.rule,[An.name]:An.rule,[Rn.name]:Rn.rule,[et.name]:et.rule};var sf={rules:Qr};export{sf as extendedLintPlugin};