@ls-stack/extended-lint 0.73.1 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extended-lint.js +24 -24
- package/dist/extended-lint.mjs +24 -24
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var ai=Object.create;var ft=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var pi=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,ui=Object.prototype.hasOwnProperty;var fi=(e,t)=>{for(var r in t)ft(e,r,{get:t[r],enumerable:!0})},zn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of pi(t))!ui.call(e,s)&&s!==r&&ft(e,s,{get:()=>t[s],enumerable:!(n=li(t,s))||n.enumerable});return e};var Fe=(e,t,r)=>(r=e!=null?ai(ci(e)):{},zn(t||!e||!e.__esModule?ft(r,"default",{value:e,enumerable:!0}):r,e)),mi=e=>zn(ft({},"__esModule",{value:!0}),e);var va={};fi(va,{extendedLintPlugin:()=>Pa});module.exports=mi(va);var Te=require("@typescript-eslint/utils"),j=require("zod/v4");var Wn=require("@typescript-eslint/utils"),Jn=Fe(require("zod/v4"));function X(e){let r=Wn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function J(e){return Jn.toJSONSchema(e)}var di=j.z.object({disallow:j.z.array(j.z.object({selector:j.z.string(),message:j.z.string(),replace:j.z.optional(j.z.union([j.z.string(),j.z.object({regex:j.z.string(),with:j.z.string()})])),replaceType:j.z.optional(j.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:j.z.optional(j.z.array(j.z.object({fn:j.z.string(),withArgs:j.z.optional(j.z.array(j.z.object({atIndex:j.z.number(),value:j.z.union([j.z.string(),j.z.number(),j.z.boolean()])}))),message:j.z.string(),replaceWith:j.z.optional(j.z.string()),ignoreRegex:j.z.optional(j.z.string())}))),__dev_simulateFileName:j.z.optional(j.z.string()),mustMatchSyntax:j.z.optional(j.z.array(j.z.object({includeRegex:j.z.string(),mustCallFn:j.z.optional(j.z.array(j.z.object({anyCall:j.z.array(j.z.object({fn:j.z.string(),withArgs:j.z.array(j.z.object({atIndex:j.z.number(),literal:j.z.union([j.z.string(),j.z.number(),j.z.boolean()])}))})),message:j.z.optional(j.z.string())}))),mustMatchSelector:j.z.optional(j.z.array(j.z.object({selector:j.z.string(),message:j.z.string()}))),mustHaveExport:j.z.optional(j.z.array(j.z.object({name:j.z.string(),type:j.z.enum(["function","variable","any"]).default("any"),message:j.z.string()})))})))}),Ft=X({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[J(di)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:a,disallowFnCalls:i}=t,p=s??e.filename,l=[],c=new Map,d=new Set,y=new Map,g=new Set,b=new Map;function f(u){for(let T of u.specifiers)T.type===Te.AST_NODE_TYPES.ImportSpecifier&&T.imported.type===Te.AST_NODE_TYPES.Identifier&&T.imported.name!==T.local.name&&b.set(T.local.name,T.imported.name)}function E(u){if(u.declaration){if(u.declaration.type===Te.AST_NODE_TYPES.FunctionDeclaration&&u.declaration.id){let T=u.declaration.id.name;for(let w of Array.from(g)){let[R,v]=w.split(":");R===T&&(v==="function"||v==="any")&&g.delete(w)}}else if(u.declaration.type===Te.AST_NODE_TYPES.VariableDeclaration){for(let T of u.declaration.declarations)if(T.id.type===Te.AST_NODE_TYPES.Identifier){let w=T.id.name;for(let R of Array.from(g)){let[v,x]=R.split(":");v===w&&(x==="variable"||x==="any")&&g.delete(R)}}}}for(let T of u.specifiers)if(T.exported.type===Te.AST_NODE_TYPES.Identifier){let w=T.exported.name;for(let R of Array.from(g)){let[v,x]=R.split(":");v===w&&x==="any"&&g.delete(R)}}}function h(u){u.id.type===Te.AST_NODE_TYPES.Identifier&&u.init?.type===Te.AST_NODE_TYPES.Identifier&&b.set(u.id.name,u.init.name)}function m(u){return b.get(u)??u}function A(u,T){return m(u)===T||u===T}for(let{includeRegex:u,mustCallFn:T,mustMatchSelector:w,mustHaveExport:R}of n??[]){let x=function(C){let F=C;for(let{name:O,value:Q}of v??[])F=F.replaceAll(O,Q);return F};var S=x;let v=yi(p,new RegExp(u));if(v){for(let{anyCall:C,message:F}of T??[]){let O=`Expected file to call the function: ${C.map(({fn:Q})=>Q).join(" or ")}`;d.add(O),l.push(Q=>{let{callee:z}=Q;if(z.type===Te.AST_NODE_TYPES.Identifier){for(let{fn:re,withArgs:ae}of C)if(z.name===re){d.delete(O);for(let D of ae){let q=Q.arguments[D.atIndex],V=typeof D.literal=="string"?x(D.literal):D.literal;if(!q){e.report({node:Q,messageId:"default",data:{message:`Missing argument with value "${V}" at index ${D.atIndex}${F?`: ${x(F)}`:""}`}});continue}if(q.type!==Te.AST_NODE_TYPES.Literal){e.report({node:q,messageId:"default",data:{message:`Argument at position ${D.atIndex} should the literal "${V}"${F?`: ${x(F)}`:""}`}});continue}q.value!==V&&e.report({node:q,messageId:"default",data:{message:`Argument should have the value "${V}"${F?`: ${x(F)}`:""}`},fix:ce=>ce.replaceText(q,typeof V=="string"?`'${V}'`:String(V))})}break}}})}for(let{selector:C,message:F}of w??[])y.set(C,x(F)),c.set(x(C),()=>{y.delete(C)});for(let{name:C,type:F,message:O}of R??[]){let Q=x(C),z=x(O);g.add(`${Q}:${F}:${z}`)}}}for(let{fn:u,withArgs:T,message:w,replaceWith:R,ignoreRegex:v}of i??[])v&&new RegExp(v).test(p)||l.push(x=>{let{callee:C}=x;if(C.type!==Te.AST_NODE_TYPES.Identifier||!A(C.name,u))return;if(T)for(let O of T){let Q=x.arguments[O.atIndex];if(!Q){e.report({node:x,messageId:"default",data:{message:`Missing argument with value "${O.value}" at index ${O.atIndex}: ${w}`}});return}if(Q.type!==Te.AST_NODE_TYPES.Literal||Q.value!==O.value)return}let F=O=>R?O.replaceText(x,R):null;e.report({node:x,messageId:"default",data:{message:w},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:F}]:void 0})});function I(u,T){let w=r[u];w?r[u]=R=>{w(R),T(R)}:r[u]=T}for(let{selector:u,message:T,replace:w,replaceType:R="suggestion"}of a??[]){if(u==="CallExpression"){l.push(v=>{o(w,v,T,R)});continue}r[u]=v=>{o(w,v,T,R)}}if(c.size>0)for(let[u,T]of c)I(u,T);return l.length>0&&(r.CallExpression=u=>{if(u.type===Te.AST_NODE_TYPES.CallExpression)for(let T of l)T(u)}),r.ImportDeclaration=u=>{u.type===Te.AST_NODE_TYPES.ImportDeclaration&&f(u)},r.ExportNamedDeclaration=u=>{u.type===Te.AST_NODE_TYPES.ExportNamedDeclaration&&E(u)},r.VariableDeclarator=u=>{u.type===Te.AST_NODE_TYPES.VariableDeclarator&&h(u)},r["Program:exit"]=u=>{for(let T of d)e.report({node:u,messageId:"default",data:{message:T}});for(let[,T]of y)e.report({node:u,messageId:"default",data:{message:T}});for(let T of g){let[w,R,v]=T.split(":");e.report({node:u,messageId:"default",data:{message:`Missing required export "${w}" of type ${R}: ${v}`}})}},r;function o(u,T,w,R){let v=x=>{if(!u)return null;if(typeof u=="string")return x.replaceText(T,u);{let C=new RegExp(u.regex),F=e.sourceCode.getText(T);return x.replaceText(T,F.replace(C,u.with))}};e.report({node:T,messageId:"default",data:{message:w},fix:u&&R==="autofix"?v:void 0,suggest:u&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof u=="string"?u:u.with}"`},fix:v}]:void 0})}}});function yi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...a]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Vn(s)}),r.push({name:"$0_uncapitalize",value:Xn(s)}),r.push({name:"$0",value:s});for(let i=0;i<a.length;i++){let p=`$${i+1}`,l=a[i];l!==void 0&&(r.push({name:`${p}_lowercase`,value:l.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Vn(l)}),r.push({name:`${p}_uncapitalize`,value:Xn(l)}),r.push({name:p,value:l}))}return r}function Vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var ee=require("@typescript-eslint/utils"),Je=require("zod/v4");var gi=ee.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Hn="collapse-simple-objs-in-one-line",Si=Je.z.object({maxLineLength:Je.z.number().optional(),maxProperties:Je.z.number().optional(),nestedObjMaxLineLength:Je.z.number().optional(),nestedObjMaxProperties:Je.z.number().optional(),ignoreTypesWithSuffix:Je.z.array(Je.z.string()).optional()}),Ti=gi({name:Hn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[J(Si)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(c){if(c.type===ee.AST_NODE_TYPES.ObjectExpression){let d=c.parent.type===ee.AST_NODE_TYPES.Property,y=d?i:s,g=c.properties.length;if(g>y)return!1;if(g===1){let f=c.properties[0];return!f||f.type===ee.AST_NODE_TYPES.Property&&f.value.type===ee.AST_NODE_TYPES.ObjectExpression||f.type===ee.AST_NODE_TYPES.Property&&f.value.type===ee.AST_NODE_TYPES.ArrayExpression&&!f.value.elements.every(h=>h&&kt(h))?!1:{text:r.getText(f),isNested:d,propsSize:g}}let b=[];for(let f of c.properties){if(f.type===ee.AST_NODE_TYPES.Property&&!kt(f.value))return!1;b.push(r.getText(f))}return{text:b.join(", "),isNested:d,propsSize:g}}else{let d=c.parent.parent?.type===ee.AST_NODE_TYPES.TSPropertySignature,y=d?i:s,g=c.members.length;if(g>y)return!1;if(n.length>0&&c.parent.type===ee.AST_NODE_TYPES.TSTypeAliasDeclaration){let f=c.parent.id.name;if(n.some(E=>f.endsWith(E)))return!1}if(g===1){let f=c.members[0];return!f||f.type===ee.AST_NODE_TYPES.TSPropertySignature&&f.typeAnnotation?.typeAnnotation.type===ee.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(f),isNested:d,propsSize:1}}if(c.parent.type===ee.AST_NODE_TYPES.TSIntersectionType||c.parent.type===ee.AST_NODE_TYPES.TSUnionType&&c.parent.types[0]!==c)return!1;let b=[];for(let f of c.members){if(f.type!==ee.AST_NODE_TYPES.TSPropertySignature)return!1;let E=f.typeAnnotation?.typeAnnotation;if(!E||E.type===ee.AST_NODE_TYPES.TSTypeLiteral||!Bn(E))return!1;if(E.type===ee.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let m=E.typeArguments.params[0];if(!m||!Bn(m))return!1}let h=r.getText(f).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),b.push(h)}return{text:b.join("; "),isNested:d,propsSize:g}}}function l(c){if(c.loc.start.line===c.loc.end.line)return;if(c.parent.type!==ee.AST_NODE_TYPES.JSXExpressionContainer){let E=0,h=!1,m=r.getTokenAfter(c,{filter:I=>I.type!==ee.AST_TOKEN_TYPES.Punctuator||h?!0:I.value===","?(E++,!1):I.value===";"?(E++,h=!0,!1):I.value===")"||I.value==="}"?(E++,!1):!0});if(E>4)return;let A=m?.type===ee.AST_TOKEN_TYPES.Template&&m.value.startsWith(`}
|
|
2
|
-
`);if(
|
|
3
|
-
`)||r.getCommentsInside(
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function
|
|
1
|
+
"use strict";var li=Object.create;var ft=Object.defineProperty;var pi=Object.getOwnPropertyDescriptor;var ci=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var mi=(e,t)=>{for(var r in t)ft(e,r,{get:t[r],enumerable:!0})},Wn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ci(t))!fi.call(e,s)&&s!==r&&ft(e,s,{get:()=>t[s],enumerable:!(n=pi(t,s))||n.enumerable});return e};var Oe=(e,t,r)=>(r=e!=null?li(ui(e)):{},Wn(t||!e||!e.__esModule?ft(r,"default",{value:e,enumerable:!0}):r,e)),yi=e=>Wn(ft({},"__esModule",{value:!0}),e);var Pa={};mi(Pa,{extendedLintPlugin:()=>ka});module.exports=yi(Pa);var he=require("@typescript-eslint/utils"),M=require("zod/v4");var Jn=require("@typescript-eslint/utils"),Vn=Oe(require("zod/v4"));function q(e){let r=Jn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function B(e){return Vn.toJSONSchema(e)}var di=M.z.object({disallow:M.z.array(M.z.object({selector:M.z.string(),message:M.z.string(),replace:M.z.optional(M.z.union([M.z.string(),M.z.object({regex:M.z.string(),with:M.z.string()})])),replaceType:M.z.optional(M.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:M.z.optional(M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.optional(M.z.array(M.z.object({atIndex:M.z.number(),value:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))),message:M.z.string(),replaceWith:M.z.optional(M.z.string()),ignoreRegex:M.z.optional(M.z.string())}))),__dev_simulateFileName:M.z.optional(M.z.string()),mustMatchSyntax:M.z.optional(M.z.array(M.z.object({includeRegex:M.z.string(),mustCallFn:M.z.optional(M.z.array(M.z.object({anyCall:M.z.array(M.z.object({fn:M.z.string(),withArgs:M.z.array(M.z.object({atIndex:M.z.number(),literal:M.z.union([M.z.string(),M.z.number(),M.z.boolean()])}))})),message:M.z.optional(M.z.string())}))),mustMatchSelector:M.z.optional(M.z.array(M.z.object({selector:M.z.string(),message:M.z.string()}))),mustHaveExport:M.z.optional(M.z.array(M.z.object({name:M.z.string(),type:M.z.enum(["function","variable","any"]).default("any"),message:M.z.string()})))})))}),kt=q({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[B(di)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:s,disallow:o,disallowFnCalls:i}=t,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.AST_NODE_TYPES.ImportSpecifier&&w.imported.type===he.AST_NODE_TYPES.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.AST_NODE_TYPES.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.AST_NODE_TYPES.VariableDeclaration){for(let w of h.declaration.declarations)if(w.id.type===he.AST_NODE_TYPES.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.AST_NODE_TYPES.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.AST_NODE_TYPES.Identifier&&h.init?.type===he.AST_NODE_TYPES.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 n??[]){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=gi(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.AST_NODE_TYPES.Identifier){for(let{fn:Z,withArgs:K}of T)if(D.name===Z){u.delete(R);for(let V of K){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.AST_NODE_TYPES.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.AST_NODE_TYPES.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.AST_NODE_TYPES.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.AST_NODE_TYPES.CallExpression)for(let w of a)w(h)}),r.ImportDeclaration=h=>{h.type===he.AST_NODE_TYPES.ImportDeclaration&&y(h)},r.ExportNamedDeclaration=h=>{h.type===he.AST_NODE_TYPES.ExportNamedDeclaration&&E(h)},r.VariableDeclarator=h=>{h.type===he.AST_NODE_TYPES.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 gi(e,t){let r=[],n=t.exec(e);if(!n)return null;let[s,...o]=n;r.push({name:"$0_lowercase",value:s.toLowerCase()}),r.push({name:"$0_capitalize",value:Xn(s)}),r.push({name:"$0_uncapitalize",value:Bn(s)}),r.push({name:"$0",value:s});for(let i=0;i<o.length;i++){let p=`$${i+1}`,a=o[i];a!==void 0&&(r.push({name:`${p}_lowercase`,value:a.toLowerCase()}),r.push({name:`${p}_capitalize`,value:Xn(a)}),r.push({name:`${p}_uncapitalize`,value:Bn(a)}),r.push({name:p,value:a}))}return r}function Xn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var re=require("@typescript-eslint/utils"),Ve=require("zod/v4");var Si=re.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Yn="collapse-simple-objs-in-one-line",Ti=Ve.z.object({maxLineLength:Ve.z.number().optional(),maxProperties:Ve.z.number().optional(),nestedObjMaxLineLength:Ve.z.number().optional(),nestedObjMaxProperties:Ve.z.number().optional(),ignoreTypesWithSuffix:Ve.z.array(Ve.z.string()).optional()}),hi=Si({name:Yn,meta:{type:"suggestion",fixable:"code",docs:{description:"Format simple objects and types in one line"},messages:{singleLineProp:"Object/type should be written in a single line"},schema:[B(Ti)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],s=t.maxProperties??2,o=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function p(l){if(l.type===re.AST_NODE_TYPES.ObjectExpression){let u=l.parent.type===re.AST_NODE_TYPES.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===re.AST_NODE_TYPES.Property&&y.value.type===re.AST_NODE_TYPES.ObjectExpression||y.type===re.AST_NODE_TYPES.Property&&y.value.type===re.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(b=>b&&Pt(b))?!1:{text:r.getText(y),isNested:u,propsSize:g}}let x=[];for(let y of l.properties){if(y.type===re.AST_NODE_TYPES.Property&&!Pt(y.value))return!1;x.push(r.getText(y))}return{text:x.join(", "),isNested:u,propsSize:g}}else{let u=l.parent.parent?.type===re.AST_NODE_TYPES.TSPropertySignature,d=u?i:s,g=l.members.length;if(g>d)return!1;if(n.length>0&&l.parent.type===re.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=l.parent.id.name;if(n.some(E=>y.endsWith(E)))return!1}if(g===1){let y=l.members[0];return!y||y.type===re.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===re.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(y),isNested:u,propsSize:1}}if(l.parent.type===re.AST_NODE_TYPES.TSIntersectionType||l.parent.type===re.AST_NODE_TYPES.TSUnionType&&l.parent.types[0]!==l)return!1;let x=[];for(let y of l.members){if(y.type!==re.AST_NODE_TYPES.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===re.AST_NODE_TYPES.TSTypeLiteral||!Hn(E))return!1;if(E.type===re.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let f=E.typeArguments.params[0];if(!f||!Hn(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!==re.AST_NODE_TYPES.JSXExpressionContainer){let E=0,b=!1,f=r.getTokenAfter(l,{filter:I=>I.type!==re.AST_TOKEN_TYPES.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===re.AST_TOKEN_TYPES.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=bi(r,l),y=u.isNested&&u.propsSize>2?o:t.maxLineLength;y&&g.length+x.length+Ei(l,r)>y||e.report({node:l,messageId:"singleLineProp",fix:E=>E.replaceText(l,g)})}return{TSTypeLiteral:a,ObjectExpression:a}}});function Hn(e){return e.type===re.AST_NODE_TYPES.TSLiteralType||e.type===re.AST_NODE_TYPES.TSTypeReference||e.type===re.AST_NODE_TYPES.TSNumberKeyword||e.type===re.AST_NODE_TYPES.TSStringKeyword||e.type===re.AST_NODE_TYPES.TSBooleanKeyword||e.type===re.AST_NODE_TYPES.TSNullKeyword||e.type===re.AST_NODE_TYPES.TSUndefinedKeyword}function Pt(e,t){return!!(e.type===re.AST_NODE_TYPES.Literal||e.type===re.AST_NODE_TYPES.Identifier||e.type===re.AST_NODE_TYPES.TemplateLiteral||e.type===re.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===re.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&Pt(r,!0)))}function Ei(e,t){let r=t.getLastToken(e);if(!r)return 0;let n=t.text.indexOf(`
|
|
4
|
+
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function bi(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var vt={name:Yn,rule:hi};var xi=/eslint +react-compiler\/react-compiler: +\["error/,Zn={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 t=!1,r=typeof e.getSource=="function"?f=>r(f):f=>e.sourceCode.getText(f),n=typeof e.getScope=="function"?()=>n():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:
|
|
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 u=l.acquire(m),T=new Set,w=null;{let P=u.upper;for(;P&&(T.add(P),P.type!=="function");)P=P.upper;if(!P)return;w=P}let R=Array.isArray;function v(P){if(!R(P.defs))return!1;let k=P.defs[0];if(k==null||k.node.type!=="VariableDeclarator")return!1;let M=k.node.init;if(M==null)return!1;for(;M.type==="TSAsExpression";)M=M.expression;let _=k.node.parent;if(_==null&&(jt(w.block,k.node.id),_=k.node.parent,_==null))return!1;if(_.kind==="const"&&M.type==="Literal"&&(typeof M.value=="string"||typeof M.value=="number"||M.value===null))return!0;if(M.type!=="CallExpression")return!1;let W=M.callee;if(W.type==="MemberExpression"&&W.object.name==="React"&&W.property!=null&&!W.computed&&(W=W.property),W.type!=="Identifier")return!1;let U=k.node.id,{name:Y}=W;if(Y==="useRef"&&U.type==="Identifier")return!0;if(wi(W)&&U.type==="Identifier"){for(let Z of P.references)Z!==U&&b.add(Z.identifier);return!0}else if(Y==="useState"||Y==="useReducer"){if(U.type==="ArrayPattern"&&U.elements.length===2&&R(P.identifiers)){if(U.elements[1]===P.identifiers[0]){if(Y==="useState"){let Z=P.references,Re=0;for(let Me=0;Me<Z.length;Me++){if(Z[Me].isWrite()&&Re++,Re>1)return!1;c.set(Z[Me].identifier,U.elements[0])}}return!0}else if(U.elements[0]===P.identifiers[0]){if(Y==="useState"){let Z=P.references;for(let Re=0;Re<Z.length;Re++)d.add(Z[Re].identifier)}return!1}}}else if(Y==="useTransition"&&U.type==="ArrayPattern"&&U.elements.length===2&&Array.isArray(P.identifiers)&&U.elements[1]===P.identifiers[0])return!0;return!1}function x(P){if(!R(P.defs))return!1;let k=P.defs[0];if(k==null||k.node==null||k.node.id==null)return!1;let M=k.node,_=w.childScopes,W=null,U;for(U=0;U<_.length;U++){let Y=_[U],Z=Y.block;if(M.type==="FunctionDeclaration"&&Z===M||M.type==="VariableDeclarator"&&Z.parent===M){W=Y;break}}if(W==null)return!1;for(U=0;U<W.through.length;U++){let Y=W.through[U];if(Y.resolved!=null&&T.has(Y.resolved.scope)&&!C(Y.resolved))return!1}return!0}let C=f(v,y),F=f(x,g),O=new Map;function Q(P){let k=P.from,M=!1;for(;k.block!==m;)k.type==="function"&&(M=k.block.parent!=null&&k.block.parent.type==="ReturnStatement"),k=k.upper;return M}let z=new Map,re=new Map;ae(u);function ae(P){for(let k of P.references){if(!k.resolved||!T.has(k.resolved.scope))continue;let M=jt(m,k.identifier),_=Zn(M),W=$e(_,re);if(S&&_.type==="Identifier"&&(_.parent.type==="MemberExpression"||_.parent.type==="OptionalMemberExpression")&&!_.parent.computed&&_.parent.property.type==="Identifier"&&_.parent.property.name==="current"&&Q(k)&&O.set(W,{reference:k,dependencyNode:_}),_.parent.type==="TSTypeQuery"||_.parent.type==="TSTypeReference")continue;let U=k.resolved.defs[0];if(U!=null&&!(U.node!=null&&U.node.init===m.parent)&&U.type!=="TypeParameter")if(z.has(W))z.get(W).references.push(k);else{let Y=k.resolved,Z=C(Y)||F(Y);z.set(W,{isStable:Z,references:[k]})}}for(let k of P.childScopes)ae(k)}O.forEach(({reference:P,dependencyNode:k},M)=>{let _=P.resolved.references,W=!1;for(let U=0;U<_.length;U++){let{identifier:Y}=_[U],{parent:Z}=Y;if(Z!=null&&Z.type==="MemberExpression"&&!Z.computed&&Z.property.type==="Identifier"&&Z.property.name==="current"&&Z.parent.type==="AssignmentExpression"&&Z.parent.left===Z){W=!0;break}}W||p({node:k.parent.property,message:`The ref value '${M}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${M}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let D=new Set;function q(P,k){D.has(k)||(D.add(k),p({node:P,message:`Assignments to the '${k}' 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 V=new Set;if(z.forEach(({isStable:P,references:k},M)=>{P&&V.add(M),k.forEach(_=>{_.writeExpr&&q(_.writeExpr,M)})}),D.size>0)return;if(!A){let P=null;if(z.forEach(({isStable:k,references:M},_)=>{P||M.forEach(W=>{if(P)return;let U=W.identifier;if(!c.has(U))return;let Z=W.from;for(;Z.type!=="function";)Z=Z.upper;Z.block===m&&(P=_)})}),P){let{suggestedDependencies:k}=Nt({dependencies:z,declaredDependencies:[],stableDependencies:V,externalDependencies:new Set,isEffect:!0});p({node:I,message:`React Hook ${o} contains a call to '${P}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+k.join(", ")+`] as a second argument to the ${o} Hook.`,suggest:[{desc:`Add dependencies array: [${k.join(", ")}]`,fix(M){return M.insertTextAfter(m,`, [${k.join(", ")}]`)}}]})}return}let ce=[],ue=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(P=>{if(P===null)return;if(P.type==="SpreadElement"){p({node:P,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}b.has(P)&&p({node:P,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(P)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(P)}\``,fix(W){return W.removeRange(P.range)}}]});let k;try{k=$e(P,re)}catch(W){if(/Unsupported node type/.test(W.message)){P.type==="Literal"?z.has(P.value)?p({node:P,message:`The ${P.raw} literal is not a valid dependency because it never changes. Did you mean to include ${P.value} in the array instead?`}):p({node:P,message:`The ${P.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):p({node:P,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 W}let M=P;for(;M.type==="MemberExpression"||M.type==="OptionalMemberExpression"||M.type==="ChainExpression";)M=M.object||M.expression.object;let _=!w.through.some(W=>W.identifier===M);ce.push({key:k,node:P}),_||ue.add(k)});let{suggestedDependencies:we,unnecessaryDependencies:We,missingDependencies:ge,duplicateDependencies:it}=Nt({dependencies:z,declaredDependencies:ce,stableDependencies:V,externalDependencies:ue,isEffect:S}),Ge=we;if(it.size+ge.size+We.size===0){if(t)return;xi({declaredDependencies:ce,declaredDependenciesNode:A,componentScope:w,scope:u}).forEach(({construction:k,isUsedOutsideOfHook:M,depType:_})=>{let W=_==="function"?"useCallback":"useMemo",U=_==="function"?"definition":"initialization",Y=`wrap the ${U} of '${k.name.name}' in its own ${W}() Hook.`,Z=M?`To fix this, ${Y}`:`Move it inside the ${o} callback. Alternatively, ${Y}`,Re=_==="conditional"||_==="logical expression"?"could make":"makes",Me=`The '${k.name.name}' ${_} ${Re} the dependencies of ${o} Hook (at line ${A.loc.start.line}) change on every render. ${Z}`,_n;M&&k.type==="Variable"&&_==="function"&&(_n=[{desc:`Wrap the ${U} of '${k.name.name}' in its own ${W}() Hook.`,fix(Un){let[oi,si]=W==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[Un.insertTextBefore(k.node.init,oi),Un.insertTextAfter(k.node.init,si)]}}]),p({node:k.node,message:Me,suggest:_n})});return}!S&&ge.size>0&&(Ge=Nt({dependencies:z,declaredDependencies:[],stableDependencies:V,externalDependencies:ue,isEffect:S}).suggestedDependencies);function he(){if(ce.length===0)return!0;let P=ce.map(M=>M.key),k=P.slice().sort();return P.join(",")===k.join(",")}he()&&Ge.sort();function xe(P){let k=P.split("."),M="";for(let _=0;_<k.length;_++){if(_!==0){let W=k.slice(0,_+1).join("."),U=re.get(W)===!0;M+=U?"?.":"."}M+=k[_]}return M}function vt(P,k,M,_){return P.size===0?null:(P.size>1?"":k+" ")+M+" "+(P.size>1?"dependencies":"dependency")+": "+Ii(Array.from(P).sort().map(W=>"'"+xe(W)+"'"))+`. Either ${_} ${P.size>1?"them":"it"} or remove the dependency array.`}let ve="";if(We.size>0){let P=null;if(Array.from(We.keys()).forEach(k=>{P===null&&k.endsWith(".current")&&(P=k)}),P!==null)ve=` Mutable values like '${P}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ue.size>0){let k=Array.from(ue)[0];u.set.has(k)||(ve=` Outer scope values like '${k}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ve&&ge.has("props")){let P=z.get("props");if(P==null)return;let k=P.references;if(!Array.isArray(k))return;let M=!0;for(let _=0;_<k.length;_++){let W=k[_],U=jt(w.block,W.identifier);if(!U){M=!1;break}let Y=U.parent;if(Y==null){M=!1;break}if(Y.type!=="MemberExpression"&&Y.type!=="OptionalMemberExpression"){M=!1;break}}M&&(ve=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${o} call and refer to those specific props inside ${r(I)}.`)}if(!ve&&ge.size>0){let P=null;ge.forEach(k=>{if(P)return;let M=w.set.get(k),_=z.get(k);if(_.references[0].resolved!==M)return;let W=M.defs[0];if(W==null||W.name==null||W.type!=="Parameter")return;let U=!1,Y;for(let Z=0;Z<_.references.length;Z++)if(Y=_.references[Z].identifier,Y!=null&&Y.parent!=null&&(Y.parent.type==="CallExpression"||Y.parent.type==="OptionalCallExpression")&&Y.parent.callee===Y){U=!0;break}U&&(P=k)}),P!==null&&(ve=` If '${P}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ve&&ge.size>0){let P=null;if(ge.forEach(k=>{if(P!==null)return;let _=z.get(k).references,W,U;for(let Y=0;Y<_.length;Y++){for(W=_[Y].identifier,U=W.parent;U!=null&&U!==w.block;){if(U.type==="CallExpression"){let Z=c.get(U.callee);if(Z!=null){if(Z.name===k)P={missingDep:k,setter:U.callee.name,form:"updater"};else if(d.has(W))P={missingDep:k,setter:U.callee.name,form:"reducer"};else{let Re=_[Y].resolved;if(Re!=null){let Me=Re.defs[0];Me!=null&&Me.type==="Parameter"&&(P={missingDep:k,setter:U.callee.name,form:"inlineReducer"})}}break}}U=U.parent}if(P!==null)break}}),P!==null)switch(P.form){case"reducer":ve=` You can also replace multiple useState variables with useReducer if '${P.setter}' needs the current value of '${P.missingDep}'.`;break;case"inlineReducer":ve=` If '${P.setter}' needs the current value of '${P.missingDep}', you can also switch to useReducer instead of useState and read '${P.missingDep}' in the reducer.`;break;case"updater":ve=` You can also do a functional update '${P.setter}(${P.missingDep.slice(0,1)} => ...)' if you only need '${P.missingDep}' in the '${P.setter}' call.`;break;default:throw new Error("Unknown case.")}}p({node:A,message:`React Hook ${r(I)} has `+(vt(ge,"a","missing","include")||vt(We,"an","unnecessary","exclude")||vt(it,"a","duplicate","omit"))+ve,suggest:[{desc:`Update the dependencies array to be: [${Ge.map(xe).join(", ")}]`,fix(P){return P.replaceText(A,`[${Ge.map(xe).join(", ")}]`)}}]})}function h(m){let A=Ci(m.callee,i);if(A===-1)return;let I=m.arguments[A],o=m.callee,S=Gn(o).name,u=m.arguments[A+1],T=/Effect($|[^a-z])/g.test(S);if(!I){p({node:o,message:`React Hook ${S} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!T)){if(!u&&!T){(S==="useMemo"||S==="useCallback")&&p({node:o,message:`React Hook ${S} 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,u,o,S,T);return;case"Identifier":if(!u||u.elements&&u.elements.some(v=>v&&v.type==="Identifier"&&v.name===I.name))return;let w=n(m).set.get(I.name);if(w==null||w.defs==null)return;let R=w.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,u,o,S,T);return;case"VariableDeclarator":let v=R.node.init;if(!v)break;switch(v.type){case"ArrowFunctionExpression":case"FunctionExpression":E(v,u,o,S,T);return}break}break;default:p({node:o,message:`React Hook ${S} received a function whose dependencies are unknown. Pass an inline function instead.`});return}p({node:o,message:`React Hook ${S} 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(w){return w.replaceText(u,`[${I.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let m of e.sourceCode.getAllComments())if(bi.test(m.value))return t=!0,{CallExpression:A=>h(A,!0)}}return{CallExpression:m=>h(m)}}};function Nt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:s}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let m=p(a,h);m.isUsed=!0,l(a,h,A=>{A.isSubtreeUsed=!0})}),t.forEach(({key:E})=>{let h=p(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=p(a,E);h.isSatisfiedRecursively=!0});function p(E,h){let m=h.split("."),A=E;for(let I of m){let o=A.children.get(I);o||(o=i(),A.children.set(I,o)),A=o}return A}function l(E,h,m){let A=h.split("."),I=E;for(let o of A){let S=I.children.get(o);if(!S)return;m(S),I=S}}let c=new Set,d=new Set;y(a,c,d,E=>E);function y(E,h,m,A){E.children.forEach((I,o)=>{let S=A(o);if(I.isSatisfiedRecursively){I.isSubtreeUsed&&m.add(S);return}if(I.isUsed){h.add(S);return}y(I,h,m,u=>S+"."+u)})}let g=[],b=new Set,f=new Set;return t.forEach(({key:E})=>{d.has(E)?g.indexOf(E)===-1?g.push(E):f.add(E):b.add(E)}),c.forEach(E=>{g.push(E)}),{suggestedDependencies:g,unnecessaryDependencies:b,duplicateDependencies:f,missingDependencies:c}}function Ve(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 Ve(e.consequent)!=null||Ve(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Ve(e.left)!=null||Ve(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Ve(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Ve(e.expression);case"TSAsExpression":return Ve(e.expression)}return null}function xi({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let s=e.map(({key:i})=>{let p=r.variables.find(c=>c.name===i);if(p==null)return null;let l=p.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let c=Ve(l.node.init);if(c!=null)return[p,c]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[p,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[p,"class"]:null}).filter(Boolean);function a(i){let p=!1;for(let l=0;l<i.references.length;l++){let c=i.references[l];if(c.writeExpr){if(p)return!0;p=!0;continue}let d=c.from;for(;d!==n&&d!=null;)d=d.upper;if(d!==n&&!Kn(t,c.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:a(i)}))}function Zn(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)?Zn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Dt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function $e(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=$e(e.object,t),n=$e(e.property,null),s=`${r}.${n}`;return Dt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=$e(e.object,t),n=$e(e.property,null),s=`${r}.${n}`;return Dt(e,t,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 n=$e(r.object,t),s=$e(r.property,null),a=`${n}.${s}`;return Dt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function Gn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ci(e,t){let r=Gn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=$e(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return t.additionalHooks.test(n)?0:-1}else return-1}}function jt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Ai(n,t))return n;if(Kn(n,t))for(let[s,a]of Object.entries(n))s!=="parent"&&(Yn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{Yn(i)&&(i.parent=n,r.push(i))}))}return null}function Ii(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function Yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Ai(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Kn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function wi(e){return!1}var pe=require("@typescript-eslint/utils"),B=Fe(require("typescript")),_t=require("zod/v4");var Lt=require("@typescript-eslint/utils");function Ke(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Ke(e.parent,t,r===1/0?r:r-1)}function*Mt(e){yield e,e.parent&&(yield*Mt(e.parent))}function $t(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function er(e,t,r){let s=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===Lt.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===Lt.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===t);return s?s.references.filter(a=>!a.init):[]}function Qn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Ri(e,t){return e[t]}function ke(e,t,r){let n=r.visitorKeys,s=new Set;function a(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let c of l){let d=Ri(i,c);if(d){if(Array.isArray(d)){for(let y of d)if(Qn(y)&&a(y))return!0}else if(Qn(d)&&a(d))return!0}}return!1}a(e)}var Pi=pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="improved-no-unnecessary-condition",vi=_t.z.object({alternativeForInCondition:_t.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),Fi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],ki=new Set(Fi),Ut={name:tr,rule:Pi({name:tr,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.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[J(vi)]},defaultOptions:[{}],create(e,[t]){let r=pe.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function s(o){return o.type===pe.AST_NODE_TYPES.UnaryExpression&&o.operator==="typeof"}function a(o){return o.flags&B.default.TypeFlags.Any||o.flags&B.default.TypeFlags.Unknown?null:o.flags&B.default.TypeFlags.StringLike?["string"]:o.flags&B.default.TypeFlags.NumberLike?["number"]:o.flags&B.default.TypeFlags.BigIntLike?["bigint"]:o.flags&B.default.TypeFlags.BooleanLike?["boolean"]:o.flags&B.default.TypeFlags.ESSymbolLike?["symbol"]:o.flags&B.default.TypeFlags.Undefined||o.flags&B.default.TypeFlags.Void?["undefined"]:o.flags&B.default.TypeFlags.Null?["object"]:o.getCallSignatures().length>0?["function"]:o.flags&B.default.TypeFlags.Object?o.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:o.flags&B.default.TypeFlags.NonPrimitive?["object"]:o.flags&B.default.TypeFlags.Never?["never"]:null}function i(o){if(!n)return null;let S=r.esTreeNodeToTSNodeMap.get(o),u=n.getTypeAtLocation(S.expression);if(u.flags&B.default.TypeFlags.Any||u.flags&B.default.TypeFlags.Unknown)return null;let T=[];if(u.isUnion()){for(let R of u.types){let v=a(R);if(v)T.push(...v);else return null}return T}let w=a(u);return w?(T.push(...w),T):null}function p(o){if(!(o.operator==="==="||o.operator==="!=="))return;let u=null,T=null;if(s(o.left)?(u=o.left,T=o.right.type===pe.AST_NODE_TYPES.Literal&&typeof o.right.value=="string"?o.right.value:null):s(o.right)&&(u=o.right,T=o.left.type===pe.AST_NODE_TYPES.Literal&&typeof o.left.value=="string"?o.left.value:null),!u||!T||!Oi(T,ki))return;let w=i(u);if(!w)return;let R=o.operator==="!==",v=w.includes(T);w.length===1?v&&!R?e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:Qe(u,e),type:T}}):!v&&R?e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:Qe(u,e),type:Array.from(w)[0]}}):!v&&!R?e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:Qe(u,e),actualType:mt(w),conditionType:T}}):v&&R&&e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:Qe(u,e),actualType:mt(w),conditionType:T}}):!v&&!R?e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:Qe(u,e),actualType:mt(w),conditionType:T}}):!v&&R&&e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:Qe(u,e),type:mt(w)}})}function l(o){if(o.flags&B.default.TypeFlags.Any||o.flags&B.default.TypeFlags.Unknown)return null;if(o.isUnion()){let S=[];for(let u of o.types)if(u.flags&B.default.TypeFlags.StringLiteral){let T=u.value;S.push(T)}else return null;return S}return o.flags&B.default.TypeFlags.StringLiteral?[o.value]:null}function c(o){if(!n)return null;let S=r.esTreeNodeToTSNodeMap.get(o),u=n.getTypeAtLocation(S),T=l(u);if(T)return T;let w=n.getSymbolAtLocation(S);if(w){let R=n.getTypeOfSymbolAtLocation(w,S),v=l(R);if(v)return v}return null}function d(o){let S=e.sourceCode.ast,u=null;return ke(S,T=>{if(T.type===pe.AST_NODE_TYPES.VariableDeclarator&&T.id.type===pe.AST_NODE_TYPES.Identifier&&T.id.name===o.name&&T.id.typeAnnotation){let w=T.id.typeAnnotation.typeAnnotation;if(w.type===pe.AST_NODE_TYPES.TSUnionType){let R=[];for(let v of w.types)if(v.type===pe.AST_NODE_TYPES.TSLiteralType&&v.literal.type===pe.AST_NODE_TYPES.Literal&&typeof v.literal.value=="string")R.push(v.literal.value);else return!0;return u=R,!0}if(w.type===pe.AST_NODE_TYPES.TSLiteralType&&w.literal.type===pe.AST_NODE_TYPES.Literal&&typeof w.literal.value=="string")return u=[w.literal.value],!0}return!1},e.sourceCode),u}function y(o){if(o.callee.type!==pe.AST_NODE_TYPES.MemberExpression||o.callee.property.type!==pe.AST_NODE_TYPES.Identifier||o.callee.computed)return;let S=o.callee.property.name;if(S!=="startsWith"&&S!=="endsWith"&&S!=="includes"||o.arguments.length!==1)return;let[u]=o.arguments;if(!u||u.type!==pe.AST_NODE_TYPES.Literal||typeof u.value!="string")return;let T=o.callee.object,w=c(T);if(!w&&T.type===pe.AST_NODE_TYPES.Identifier&&(w=d(T)),!w||w.length===0)return;let R=u.value;if(S==="includes"&&w.length>1)return;let v=0,x=0;for(let C of w)if((S==="startsWith"?C.startsWith(R):S==="endsWith"?C.endsWith(R):C.includes(R))?v++:x++,v>0&&x>0)return;if(v>0&&x===0){let C=S==="startsWith"?"unnecessaryStartsWithCondition":S==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:o,messageId:C})}else if(x>0&&v===0){let C=S==="startsWith"?"alwaysFalseStartsWithCondition":S==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:o,messageId:C})}}function g(o){if(!new Set(["===","!==",">",">=","<","<="]).has(o.operator))return;function u(F){if(F.type!==pe.AST_NODE_TYPES.MemberExpression||F.computed||F.property.type!==pe.AST_NODE_TYPES.Identifier||F.property.name!=="length")return null;let O=F.object,Q=c(O);if(!Q||Q.length===0)return null;let z=[];for(let re of Q)z.push(re.length);return{values:z}}let T=u(o.left),w=u(o.right),R=null,v=null;if(T?o.right.type===pe.AST_NODE_TYPES.Literal&&typeof o.right.value=="number"&&(R=T.values,v=o.right.value):w&&o.left.type===pe.AST_NODE_TYPES.Literal&&typeof o.left.value=="number"&&(R=w.values,v=o.left.value),!R||v===null)return;let x=0,C=0;for(let F of R){let O=!1;if(o.operator==="==="?O=F===v:o.operator==="!=="?O=F!==v:o.operator===">"?O=F>v:o.operator===">="?O=F>=v:o.operator==="<"?O=F<v:o.operator==="<="&&(O=F<=v),O?x++:C++,x>0&&C>0)return}x>0&&C===0?e.report({node:o,messageId:"unnecessaryLengthCondition"}):C>0&&x===0&&e.report({node:o,messageId:"alwaysFalseLengthCondition"})}function b(o){if(o.type===pe.AST_NODE_TYPES.Literal&&typeof o.value=="string")return o.value;let S=c(o);if(!S||S.length!==1)return null;let[u]=S;return u??null}function f(o){return(o.flags&B.default.TypeFlags.Intersection)!==0}function E(o){return(o.flags&B.default.TypeFlags.Object)!==0}function h(o){return!n||n.getIndexTypeOfType(o,B.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(o,B.default.IndexKind.Number)}function m(o,S){if(!n||h(o)||o.getProperties().length===0)return"unknown";let u=n.getPropertyOfType(o,S);return u?u.flags&B.default.SymbolFlags.Optional?"optional":"required":"absent"}function A(o,S){if(o.flags&B.default.TypeFlags.Any||o.flags&B.default.TypeFlags.Unknown||o.flags&B.default.TypeFlags.Never||o.flags&B.default.TypeFlags.TypeParameter||o.flags&B.default.TypeFlags.IndexedAccess||o.flags&B.default.TypeFlags.StringLike||o.flags&B.default.TypeFlags.NumberLike||o.flags&B.default.TypeFlags.BigIntLike||o.flags&B.default.TypeFlags.BooleanLike||o.flags&B.default.TypeFlags.EnumLike||o.flags&B.default.TypeFlags.ESSymbolLike||o.flags&B.default.TypeFlags.NonPrimitive||o.flags&B.default.TypeFlags.Null||o.flags&B.default.TypeFlags.Undefined||o.flags&B.default.TypeFlags.Void)return"unknown";if(o.isUnion()){let u=!0,T=!0;for(let w of o.types){let R=A(w,S);if(R==="unknown"||(R!=="required"&&(u=!1),R!=="absent"&&(T=!1),R==="optional"))return"unknown"}return u?"required":T?"absent":"unknown"}if(f(o)){let u=o,T=!1,w=!1;for(let R of u.types){let v=A(R,S);if(v==="unknown")return"unknown";v==="required"?T=!0:v==="optional"&&(w=!0)}return T?"required":w?"optional":"absent"}return E(o)?m(o,S):"unknown"}function I(o){if(o.operator!=="in"||o.left.type===pe.AST_NODE_TYPES.PrivateIdentifier)return;let S=b(o.left);if(!S)return;let u=o.right,T=r.esTreeNodeToTSNodeMap.get(u);if(!n)return;let w=n.getTypeAtLocation(T),R=A(w,S);R==="required"?e.report({node:o,messageId:"unnecessaryInCondition",data:{property:S,type:n.typeToString(w),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):R==="absent"&&e.report({node:o,messageId:"alwaysFalseInCondition",data:{property:S,type:n.typeToString(w),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(o){p(o),g(o),I(o)},CallExpression:y}}})};function mt(e){return Array.from(new Set(e)).join(" | ")||"never"}function Qe(e,t){let r=e.argument;return r.type===pe.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Oi(e,t){return t.has(e)}var yt=require("@typescript-eslint/utils"),dt=require("zod/v4");var Ni=yt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-call-with-explicit-generics",Di=dt.z.object({functions:dt.z.array(dt.z.string())}),ji=Ni({name:nr,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[J(Di)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===yt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),zt={name:nr,rule:ji};var He=require("@typescript-eslint/utils"),Li=He.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),rr="no-call-with-inferred-generics",Mi=Li({name:rr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:s}=n;if(s.type!==He.AST_NODE_TYPES.Identifier)return;let a=r.get(s.name);if(!a)return;let{minGenerics:i=1,allowAny:p,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!l)&&n.typeArguments?.params.some(d=>!p&&d.type===He.AST_NODE_TYPES.TSAnyKeyword||l&&d.type===He.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===He.AST_NODE_TYPES.Identifier&&l.includes(d.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),Wt={name:rr,rule:Mi};var sr=require("@typescript-eslint/utils"),$i=sr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="no-commented-out-code",_i=["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:"],Ui=/^\s*return\s+/,zi=/\w=("|'|`)/,Wi=/\w+:\s*('|"|`)/,Ji=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Vi=/\w+-\w+:/,Xi=/\w+_\w+:/,Bi=/\?\s+\w/,Hi=/:\s+\w/,Yi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,qi=/^\s*\d+[,}]/,Zi=/^\s*\[[^\]]*\][,}]/,Gi=/^\s*\{[^}]*\}[,}]/,Ki=/\.\w+\(/,Qi=/\[\w+\]/,eo=/^\s*(['"`]).+?\1\s*:/,to=/^<[A-Z]\w*(\s|>|\/)/,no=/^<[a-z]+(\s|>|\/)/,ro=/<[A-Z]\w*(\s.*)?>/,io=/<\/[A-Z]\w*>/,oo=/<[a-z]+(\s.*)?>/,so=/<\/[a-z]+>/,ao=/^\s*[*\s]*$/,lo=/^[a-zA-Z]/,po=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,co=/```[\s\S]*?```/g,uo=/`[^`]*`/g,ir=/[a-zA-Z0-9]/,fo=/\.[A-Za-z_][A-Za-z0-9_]*\(/,mo=/[{}[\]()`=<>]/,yo=/:\s*(['"`[{(]|\w+\s*=>)/,go=/\bif\s*\(|\belse\b|=>/,fe={returnStatement:Ui,stringAssignment:zi,objectPropertyWithQuotes:Wi,computedPropertyAssignment:Ji,kebabCaseProperty:Vi,snakeCaseProperty:Xi,ternaryOperator:Bi,colonWithWord:Hi,quotedString:Yi,numberWithComma:qi,arrayWithComma:Zi,objectWithComma:Gi,methodCall:Ki,arrayAccess:Qi,quotedPropertyKey:eo,jsxSelfClosing:to,jsxElement:no,jsxOpeningTag:ro,jsxClosingTag:io,htmlOpeningTag:oo,htmlClosingTag:so,jsdocComment:ao};function So(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&lo.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||fo.test(t)||mo.test(t)||yo.test(t)||go.test(t)?!1:!!(t.includes(":")&&po.test(t))}var To=[") {","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],ho=["/>","</",fe.jsxSelfClosing,fe.jsxElement,fe.jsxOpeningTag,fe.jsxClosingTag,fe.htmlOpeningTag,fe.htmlClosingTag],or=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Eo=$i({name:ar,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,s){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||fe.jsdocComment.test(n))return!1;for(let i of or)if(a.startsWith(i))return!1;if(n.includes("https://")||So(a))return!1;if(s==="Block"){for(let i of ho)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of _i)if(a.startsWith(i))return{wrongPattern:i};for(let i of To)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(s==="Block"&&a.includes("```")){let c=a.split(co);c.some(y=>ir.test(y))&&(a=c.join(""))}if(!a.includes("`"))return a;let p=a.split(uo);return p.some(c=>ir.test(c))?p.join(""):a}return{Program(){let s=e.sourceCode.getAllComments();for(let a of s){let i=r(a.value,a.type),p=t(i,a.type);p&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:or.join(", ")}})}}}}}),Jt={name:ar,rule:Eo};var gt=require("@typescript-eslint/utils"),bo=gt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="no-default-export",xo=bo({name:lr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===gt.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Vt={name:lr,rule:xo};var pr=require("@typescript-eslint/utils"),Co=pr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-leaked-text-in-jsx",Io=[",",";","[","]","(",")"],Ao=Co({name:cr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Io.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Xt={name:cr,rule:Ao};var Xe=require("@typescript-eslint/utils"),wo=Xe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-non-camel-case-functions",Ro=/^(\$?[a-z][a-zA-Z0-9]*)$/;function ur(e){if(e.typeName.type!==Xe.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Xe.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Po=wo({name:fr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Ro.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Xe.AST_NODE_TYPES.TSTypeReference?ur(r):r.type===Xe.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Xe.AST_NODE_TYPES.TSTypeReference&&ur(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Bt={name:fr,rule:Po};var ie=require("@typescript-eslint/utils");var vo=ie.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),mr="no-optional-root-props",Fo=vo({name:mr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let a=e.sourceCode.getDeclaredVariables(n)[0];if(!a||a.references.length!==1)return!1;let i=a.references[0];if(!i)return!1;for(let p of Mt(i.identifier)){if("returnType"in p||p.type===ie.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=p.parent;if(!l)return!1;if(l.type===ie.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===ie.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===ie.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let d=Ke(l.parent.parent,ie.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!d)return!1;let y=St(d,e.sourceCode);return y?!(y.parent.type===ie.TSESTree.AST_NODE_TYPES.CallExpression&&y.parent.callee.type===ie.TSESTree.AST_NODE_TYPES.Identifier&&y.parent.callee.name==="memo"):!1}if(p.type===ie.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===ie.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let c=Ke(l,ie.TSESTree.AST_NODE_TYPES.VariableDeclaration);return c?!!St(c,e.sourceCode):!1}if(l.type===ie.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!St(l,e.sourceCode)}return!1}function r(n){n.key.type!==ie.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:s=>{let a=Ke(n,ie.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return s.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===ie.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Tt(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===ie.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(Tt(n)||!t(n)))for(let s of n.body.body)s.type===ie.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==ie.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==ie.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Ke(n.parent,ie.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=St(a,e.sourceCode);if(!(!i||i.parent.type===ie.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===ie.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of s.members)l.type===ie.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function Tt(e){return e?e.parent?.type===ie.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===ie.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function St(e,t){if(Tt(e))return;let r;if(e.type===ie.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===ie.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===ie.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.variables.find(i=>i.identifiers.includes(r));if(!s)return;let a=s.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!Tt(a[0].identifier.parent.parent))return a[0].identifier}var Ht={name:mr,rule:Fo};var ot=require("@typescript-eslint/utils");var st=X({name:"no-reexport",meta:{type:"problem",docs:{description:"Disallow re-exports to prevent indirection"},schema:[],messages:{noReexport:"Re-exports are not allowed. Use direct exports only."}},defaultOptions:[],create(e){let t=new Set;function r(n){return n?n.type===ot.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===ot.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===ot.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===ot.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var dr=require("@typescript-eslint/utils"),ht=Fe(require("path")),_e=require("zod/v4");var ko=dr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-relative-imports",Oo=_e.z.object({find:_e.z.string(),replacement:_e.z.string()}),No=_e.z.object({aliases:_e.z.array(Oo),rootDir:_e.z.string().optional(),allowNotFoundAliases:_e.z.boolean().optional(),_dev_simulateFileName:_e.z.string().optional()}),Do=ko({name:yr,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[J(No)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let l=ht.default.dirname(p);return ht.default.resolve(l,i)}function a(i){let p=t.rootDir??process.cwd(),l=ht.default.relative(p,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:c,replacement:d}of t.aliases)if(l.startsWith(d)){let y=l.replace(d,c);return{alias:c,newPath:y}}return null}return{ImportDeclaration(i){let p=i.source.value;if(!n(p))return;let l=s(p,r),c=a(l);!c&&t.allowNotFoundAliases||e.report({node:i,messageId:c?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:c?.alias},fix:c?d=>d.replaceText(i.source,`'${c.newPath}'`):void 0})}}}}),Yt={name:yr,rule:Do};var me=require("@typescript-eslint/utils"),qt=require("zod/v4");var jo=qt.z.object({customMessage:qt.z.string().optional()}),Zt=X({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[J(jo)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case me.AST_NODE_TYPES.Literal:return!0;case me.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===me.AST_NODE_TYPES.Property?s.computed||s.value.type===me.AST_NODE_TYPES.Identifier&&s.key.type===me.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case me.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===me.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case me.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case me.AST_NODE_TYPES.ConditionalExpression:case me.AST_NODE_TYPES.LogicalExpression:case me.AST_NODE_TYPES.BinaryExpression:case me.AST_NODE_TYPES.UnaryExpression:case me.AST_NODE_TYPES.CallExpression:case me.AST_NODE_TYPES.MemberExpression:case me.AST_NODE_TYPES.Identifier:case me.AST_NODE_TYPES.ArrowFunctionExpression:case me.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===me.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===me.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==me.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===me.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var at=require("@typescript-eslint/utils"),Ye=Fe(require("zod/v4"));var Lo=Ye.object({alternativeMsgs:Ye.object({inArrayFind:Ye.string().optional(),inArrayFilter:Ye.string().optional()}).optional(),__dev_simulateFileName:Ye.string().optional()});function Mo(e){return e.typeAnnotation.type!==at.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var $o=/(typeGuards|type-guards)\.(ts|tsx)$/;function _o(e){return $o.test(e)}function Uo(e){let t=e.parent;for(;t;){if(t.type===at.AST_NODE_TYPES.CallExpression&&t.callee.type===at.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===at.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Gt=X({name:"no-type-guards",meta:{type:"problem",docs:{description:"Disallow type guards unless in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files"},messages:{typeGuardNotAllowed:"Check if the type guard can be inferred by typescript, in most cases it can, e.g. `.filter((nullable) => nullable !== null)`. If not, type guards are only allowed in *.typeGuards.(ts|tsx) or *.type-guards.(ts|tsx) files",useFilterWithTypeCheck:"{{message}}",useFindWithTypeCheck:"{{message}}"},schema:[J(Lo)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(_o(r))return{};function n(s){if(!Mo(s))return;let a=Uo(s);if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let p=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:s,messageId:p,data:{message:i}});return}}e.report({node:s,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var qe=require("@typescript-eslint/utils");var zo="no-unnecessary-async-on-jsx-props";function Wo(e){if(e.body.type!==qe.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==qe.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===qe.AST_NODE_TYPES.AwaitExpression}var Kt=X({name:zo,meta:{type:"suggestion",fixable:"code",docs:{description:"Disallow unnecessary async/await in JSX props where a single await provides no benefit"},messages:{unnecessaryAsyncInJsxProp:"Unnecessary async/await in JSX prop. The single await expression provides no benefit here."},schema:[]},defaultOptions:[],create(e){function t(r){Wo(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,a=[],i=s.getFirstToken(r,l=>l.value==="async");if(i){let l=s.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function p(l){if(l.type===qe.AST_NODE_TYPES.AwaitExpression){let c=s.getFirstToken(l);if(c&&c.value==="await"){let d=s.getTokenAfter(c);d?a.push(n.replaceTextRange([c.range[0],d.range[0]],"")):a.push(n.remove(c))}}if(l.type===qe.AST_NODE_TYPES.BlockStatement)for(let c of l.body)p(c);else l.type===qe.AST_NODE_TYPES.ExpressionStatement&&p(l.expression)}return p(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Ue=require("@typescript-eslint/utils"),Qt=Fe(require("typescript")),et=Fe(require("zod/v4"));var Jo=Ue.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),gr="no-unnecessary-casting",Vo=et.default.object({additionalCastFunctions:et.default.array(et.default.object({name:et.default.string(),expectedType:et.default.enum(["string","number"])})).optional()}),en={name:gr,rule:Jo({name:gr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[J(Vo)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=Ue.ESLintUtils.getParserServices(e,!0),a=s.program?.getTypeChecker();if(!a||!s.program)throw new Error("TypeScript services or program not available");function i(d,y){switch(d.type){case Ue.AST_NODE_TYPES.Literal:return y==="number"?typeof d.value=="number":typeof d.value=="string";case Ue.AST_NODE_TYPES.TemplateLiteral:return y==="string";case Ue.AST_NODE_TYPES.UnaryExpression:return y==="number"?d.operator==="+"||d.operator==="-"||d.operator==="~":!1;default:return!1}}function p(d,y){return y==="number"?!!(d.flags&Qt.TypeFlags.NumberLike):!!(d.flags&Qt.TypeFlags.StringLike)}function l(d,y){return g=>g.replaceText(d,e.sourceCode.getText(y))}function c(d){if(!a||d.arguments.length!==1)return;let y=d.arguments[0];if(!y||y.type===Ue.AST_NODE_TYPES.SpreadElement)return;let{callee:g}=d;if(g.type!==Ue.AST_NODE_TYPES.Identifier)return;let b=g.name,f=n.find(h=>h.name===b);if(!f)return;if(i(y,f.expectedType)||p(a.getTypeAtLocation(s.esTreeNodeToTSNodeMap.get(y)),f.expectedType)){let h,m;b==="Number"?h="unnecessaryNumberCasting":b==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",m={name:f.name,type:f.expectedType}),e.report({node:d,messageId:h,...m?{data:m}:{},fix:l(d,y)})}}return{CallExpression:c}}})};var Ie=require("@typescript-eslint/utils"),Et=Fe(require("zod/v4"));var Xo=Et.object({ignoreWithDescription:Et.string().optional()}),tn=X({name:"no-unnecessary-describe",meta:{type:"suggestion",docs:{description:"Disallow unnecessary describe blocks that wrap all tests in a file"},messages:{unnecessaryDescribe:"Describe blocks that solely wrap all tests in the file are unnecessary, they just add unnecessary nesting to the code. The file itself should be enough to group tests. Remove it.",removeDescribe:"Remove the describe block"},hasSuggestions:!0,schema:[J(Xo)]},defaultOptions:[{}],create(e,[t]){let r=e.getSourceCode(),n=r.ast;function s(l){let c=l.arguments[0];return c&&c.type===Ie.AST_NODE_TYPES.Literal&&typeof c.value=="string"?c.value:null}function a(l){return!l||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(l)}function i(l){return l.length!==1?!1:n.body.filter(d=>{if(d.type===Ie.AST_NODE_TYPES.ExpressionStatement){let y=d.expression;if(y.type===Ie.AST_NODE_TYPES.CallExpression&&y.callee.type===Ie.AST_NODE_TYPES.Identifier){let g=y.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(g)}}return!1}).length===0}function p(l){let c=l.arguments[1];if(c&&(c.type===Ie.AST_NODE_TYPES.FunctionExpression||c.type===Ie.AST_NODE_TYPES.ArrowFunctionExpression)&&c.body.type===Ie.AST_NODE_TYPES.BlockStatement){let d=c.body.body;return d.length===0?"":d.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 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 z=N.node.parent;if(z==null&&(Dt(P.block,N.node.id),z=N.node.parent,z==null))return!1;if(z.kind==="const"&&_.type==="Literal"&&(typeof _.value=="string"||typeof _.value=="number"||_.value===null))return!0;if(_.type!=="CallExpression")return!1;let X=_.callee;if(X.type==="MemberExpression"&&X.object.name==="React"&&X.property!=null&&!X.computed&&(X=X.property),X.type!=="Identifier")return!1;let W=N.node.id,{name:Q}=X;if(Q==="useRef"&&W.type==="Identifier")return!0;if(Ri(X)&&W.type==="Identifier"){for(let ee of k.references)ee!==W&&x.add(ee.identifier);return!0}else if(Q==="useState"||Q==="useReducer"){if(W.type==="ArrayPattern"&&W.elements.length===2&&v(k.identifiers)){if(W.elements[1]===k.identifiers[0]){if(Q==="useState"){let ee=k.references,ke=0;for(let _e=0;_e<ee.length;_e++){if(ee[_e].isWrite()&&ke++,ke>1)return!1;l.set(ee[_e].identifier,W.elements[0])}}return!0}else if(W.elements[0]===k.identifiers[0]){if(Q==="useState"){let ee=k.references;for(let ke=0;ke<ee.length;ke++)u.add(ee[ke].identifier)}return!1}}}else if(Q==="useTransition"&&W.type==="ArrayPattern"&&W.elements.length===2&&Array.isArray(k.identifiers)&&W.elements[1]===k.identifiers[0])return!0;return!1}function 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,z=P.childScopes,X=null,W;for(W=0;W<z.length;W++){let Q=z[W],ee=Q.block;if(_.type==="FunctionDeclaration"&&ee===_||_.type==="VariableDeclarator"&&ee.parent===_){X=Q;break}}if(X==null)return!1;for(W=0;W<X.through.length;W++){let Q=X.through[W];if(Q.resolved!=null&&w.has(Q.resolved.scope)&&!T(Q.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;K(h);function K(k){for(let N of k.references){if(!N.resolved||!w.has(N.resolved.scope))continue;let _=Dt(f,N.identifier),z=Gn(_),X=Ue(z,Z);if(C&&z.type==="Identifier"&&(z.parent.type==="MemberExpression"||z.parent.type==="OptionalMemberExpression")&&!z.parent.computed&&z.parent.property.type==="Identifier"&&z.parent.property.name==="current"&&O(N)&&R.set(X,{reference:N,dependencyNode:z}),z.parent.type==="TSTypeQuery"||z.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 Q=N.resolved,ee=T(Q)||S(Q);D.set(X,{isStable:ee,references:[N]})}}for(let N of k.childScopes)K(N)}R.forEach(({reference:k,dependencyNode:N},_)=>{let z=k.resolved.references,X=!1;for(let W=0;W<z.length;W++){let{identifier:Q}=z[W],{parent:ee}=Q;if(ee!=null&&ee.type==="MemberExpression"&&!ee.computed&&ee.property.type==="Identifier"&&ee.property.name==="current"&&ee.parent.type==="AssignmentExpression"&&ee.parent.left===ee){X=!0;break}}X||p({node: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(z=>{z.writeExpr&&j(z.writeExpr,_)})}),V.size>0)return;if(!A){let k=null;if(D.forEach(({isStable:N,references:_},z)=>{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=z)})}),k){let{suggestedDependencies:N}=Ot({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=[],ue=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=Ue(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 z=!P.through.some(X=>X.identifier===_);H.push({key:N,node:k}),z||ue.add(N)});let{suggestedDependencies:ge,unnecessaryDependencies:Ee,missingDependencies:Re,duplicateDependencies:Fe}=Ot({dependencies:D,declaredDependencies:H,stableDependencies:Y,externalDependencies:ue,isEffect:C}),Ye=ge;if(Fe.size+Re.size+Ee.size===0){if(t)return;Ci({declaredDependencies:H,declaredDependenciesNode:A,componentScope:P,scope:h}).forEach(({construction:N,isUsedOutsideOfHook:_,depType:z})=>{let X=z==="function"?"useCallback":"useMemo",W=z==="function"?"definition":"initialization",Q=`wrap the ${W} of '${N.name.name}' in its own ${X}() Hook.`,ee=_?`To fix this, ${Q}`:`Move it inside the ${m} callback. Alternatively, ${Q}`,ke=z==="conditional"||z==="logical expression"?"could make":"makes",_e=`The '${N.name.name}' ${z} ${ke} the dependencies of ${m} Hook (at line ${A.loc.start.line}) change on every render. ${ee}`,Un;_&&N.type==="Variable"&&z==="function"&&(Un=[{desc:`Wrap the ${W} of '${N.name.name}' in its own ${X}() Hook.`,fix(zn){let[oi,ai]=X==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[zn.insertTextBefore(N.node.init,oi),zn.insertTextAfter(N.node.init,ai)]}}]),p({node:N.node,message:_e,suggest:Un})});return}!C&&Re.size>0&&(Ye=Ot({dependencies:D,declaredDependencies:[],stableDependencies:Y,externalDependencies:ue,isEffect:C}).suggestedDependencies);function _n(){if(H.length===0)return!0;let k=H.map(_=>_.key),N=k.slice().sort();return k.join(",")===N.join(",")}_n()&&Ye.sort();function Te(k){let N=k.split("."),_="";for(let z=0;z<N.length;z++){if(z!==0){let X=N.slice(0,z+1).join("."),W=Z.get(X)===!0;_+=W?"?.":"."}_+=N[z]}return _}function Ce(k,N,_,z){return k.size===0?null:(k.size>1?"":N+" ")+_+" "+(k.size>1?"dependencies":"dependency")+": "+Ai(Array.from(k).sort().map(X=>"'"+Te(X)+"'"))+`. Either ${z} ${k.size>1?"them":"it"} or remove the dependency array.`}let ve="";if(Ee.size>0){let k=null;if(Array.from(Ee.keys()).forEach(N=>{k===null&&N.endsWith(".current")&&(k=N)}),k!==null)ve=` Mutable values like '${k}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ue.size>0){let N=Array.from(ue)[0];h.set.has(N)||(ve=` Outer scope values like '${N}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!ve&&Re.has("props")){let k=D.get("props");if(k==null)return;let N=k.references;if(!Array.isArray(N))return;let _=!0;for(let z=0;z<N.length;z++){let X=N[z],W=Dt(P.block,X.identifier);if(!W){_=!1;break}let Q=W.parent;if(Q==null){_=!1;break}if(Q.type!=="MemberExpression"&&Q.type!=="OptionalMemberExpression"){_=!1;break}}_&&(ve=` 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(!ve&&Re.size>0){let k=null;Re.forEach(N=>{if(k)return;let _=P.set.get(N),z=D.get(N);if(z.references[0].resolved!==_)return;let X=_.defs[0];if(X==null||X.name==null||X.type!=="Parameter")return;let W=!1,Q;for(let ee=0;ee<z.references.length;ee++)if(Q=z.references[ee].identifier,Q!=null&&Q.parent!=null&&(Q.parent.type==="CallExpression"||Q.parent.type==="OptionalCallExpression")&&Q.parent.callee===Q){W=!0;break}W&&(k=N)}),k!==null&&(ve=` If '${k}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!ve&&Re.size>0){let k=null;if(Re.forEach(N=>{if(k!==null)return;let z=D.get(N).references,X,W;for(let Q=0;Q<z.length;Q++){for(X=z[Q].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 ke=z[Q].resolved;if(ke!=null){let _e=ke.defs[0];_e!=null&&_e.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":ve=` You can also replace multiple useState variables with useReducer if '${k.setter}' needs the current value of '${k.missingDep}'.`;break;case"inlineReducer":ve=` 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":ve=` 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 `+(Ce(Re,"a","missing","include")||Ce(Ee,"an","unnecessary","exclude")||Ce(Fe,"a","duplicate","omit"))+ve,suggest:[{desc:`Update the dependencies array to be: [${Ye.map(Te).join(", ")}]`,fix(k){return k.replaceText(A,`[${Ye.map(Te).join(", ")}]`)}}]})}function b(f){let A=Ii(f.callee,i);if(A===-1)return;let I=f.arguments[A],m=f.callee,C=Kn(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(!(t&&!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=n(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(xi.test(f.value))return t=!0,{CallExpression:A=>b(A,!0)}}return{CallExpression:f=>b(f)}}};function Ot({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,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})}),t.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 t.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 Xe(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return Xe(e.consequent)!=null||Xe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Xe(e.left)!=null||Xe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Xe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Xe(e.expression);case"TSAsExpression":return Xe(e.expression)}return null}function Ci({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){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=Xe(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!==n&&u!=null;)u=u.upper;if(u!==n&&!Qn(t,l.identifier))return!0}return!1}return s.map(([i,p])=>({construction:i.defs[0],depType:p,isUsedOutsideOfHook:o(i)}))}function Gn(e){return(e.parent.type==="MemberExpression"||e.parent.type==="OptionalMemberExpression")&&e.parent.object===e&&e.parent.property.name!=="current"&&!e.parent.computed&&!(e.parent.parent!=null&&(e.parent.parent.type==="CallExpression"||e.parent.parent.type==="OptionalCallExpression")&&e.parent.parent.callee===e.parent)?Gn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function Nt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function Ue(e,t){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let r=e.name;return t&&t.set(r,!1),r}else if(e.type==="MemberExpression"&&!e.computed){let r=Ue(e.object,t),n=Ue(e.property,null),s=`${r}.${n}`;return Nt(e,t,s),s}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=Ue(e.object,t),n=Ue(e.property,null),s=`${r}.${n}`;return Nt(e,t,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 n=Ue(r.object,t),s=Ue(r.property,null),o=`${n}.${s}`;return Nt(r,t,o),o}else throw new Error(`Unsupported node type: ${e.type}`)}function Kn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ii(e,t){let r=Kn(e);if(r.type!=="Identifier")return-1;switch(r.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(r===e&&t&&t.additionalHooks){let n;try{n=Ue(r,null)}catch(s){if(/Unsupported node type/.test(s.message))return 0;throw s}return t.additionalHooks.test(n)?0:-1}else return-1}}function Dt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),wi(n,t))return n;if(Qn(n,t))for(let[s,o]of Object.entries(n))s!=="parent"&&(qn(o)?(o.parent=n,r.push(o)):Array.isArray(o)&&o.forEach(i=>{qn(i)&&(i.parent=n,r.push(i))}))}return null}function Ai(e){let t="";for(let r=0;r<e.length;r++)t+=e[r],r===0&&e.length===2?t+=" and ":r===e.length-2&&e.length>2?t+=", and ":r<e.length-1&&(t+=", ");return t}function qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function wi(e,t){return(e.type==="Identifier"||e.type==="JSXIdentifier")&&e.type===t.type&&e.name===t.name&&e.range[0]===t.range[0]&&e.range[1]===t.range[1]}function Qn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Ri(e){return!1}var ae=require("@typescript-eslint/utils"),J=Oe(require("typescript")),$t=require("zod/v4");var jt=require("@typescript-eslint/utils");function Qe(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Qe(e.parent,t,r===1/0?r:r-1)}function*Lt(e){yield e,e.parent&&(yield*Lt(e.parent))}function Mt(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function tr(e,t,r){let s=r.getDeclaredVariables(e).find(o=>o.name===t||o.identifiers[0]?.parent.type===jt.AST_NODE_TYPES.Property&&o.identifiers[0].parent.key.type===jt.AST_NODE_TYPES.Identifier&&o.identifiers[0].parent.key.name===t);return s?s.references.filter(o=>!o.init):[]}function er(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Fi(e,t){return e[t]}function Ne(e,t,r){let n=r.visitorKeys,s=new Set;function o(i){if(s.has(i))return!1;if(s.add(i),t(i)===!0)return!0;let a=n[i.type];if(a)for(let l of a){let u=Fi(i,l);if(u){if(Array.isArray(u)){for(let d of u)if(er(d)&&o(d))return!0}else if(er(u)&&o(u))return!0}}return!1}o(e)}var ki=ae.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="improved-no-unnecessary-condition",Pi=$t.z.object({alternativeForInCondition:$t.z.string().optional().describe("Alternative to appear in the error for `in` condition")}),rr={object:"Array",property:"isArray"},vi=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Oi=new Set(vi),_t={name:nr,rule:ki({name:nr,meta:{type:"suggestion",docs:{description:"Extends checks of `no-unnecessary-condition` rule"},messages:{unnecessaryTypeofCondition:'This condition is unnecessary. The type of "{{name}}" is always "{{type}}".',alwaysFalseTypeofCondition:'This condition will always be false. The type of "{{name}}" is "{{actualType}}" so the condition has no overlap with "{{conditionType}}".',unnecessaryStartsWithCondition:"This startsWith check is unnecessary as it always evaluates to true.",alwaysFalseStartsWithCondition:"This startsWith check will always be false.",unnecessaryEndsWithCondition:"This endsWith check is unnecessary as it always evaluates to true.",alwaysFalseEndsWithCondition:"This endsWith check will always be false.",unnecessaryIncludesCondition:"This includes check is unnecessary as it always evaluates to true.",alwaysFalseIncludesCondition:"This includes check will always be false.",unnecessaryArrayIsArrayCondition:"This Array.isArray check is unnecessary as it always evaluates to true.",alwaysFalseArrayIsArrayCondition:"This Array.isArray check will always be false.",unnecessaryLengthCondition:"This length comparison is unnecessary as it always evaluates to true.",alwaysFalseLengthCondition:"This length comparison will always be false.",unnecessaryInCondition:'This in check is unnecessary. Property "{{property}}" always exists on type "{{type}}".{{alternative}}',alwaysFalseInCondition:'This in check will always be false. Property "{{property}}" does not exist on type "{{type}}".{{alternative}}'},schema:[B(Pi)]},defaultOptions:[{}],create(e,[t]){let r=ae.ESLintUtils.getParserServices(e,!0),n=r.program?.getTypeChecker();if(!n||!r.program)throw new Error("TypeScript services or program not available");function s(c){return c.type===ae.AST_NODE_TYPES.UnaryExpression&&c.operator==="typeof"}function o(c){return c.flags&J.default.TypeFlags.Any||c.flags&J.default.TypeFlags.Unknown?null:c.flags&J.default.TypeFlags.StringLike?["string"]:c.flags&J.default.TypeFlags.NumberLike?["number"]:c.flags&J.default.TypeFlags.BigIntLike?["bigint"]:c.flags&J.default.TypeFlags.BooleanLike?["boolean"]:c.flags&J.default.TypeFlags.ESSymbolLike?["symbol"]:c.flags&J.default.TypeFlags.Undefined||c.flags&J.default.TypeFlags.Void?["undefined"]:c.flags&J.default.TypeFlags.Null?["object"]:c.getCallSignatures().length>0?["function"]:c.flags&J.default.TypeFlags.Object?c.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:c.flags&J.default.TypeFlags.NonPrimitive?["object"]:c.flags&J.default.TypeFlags.Never?["never"]:null}function i(c){if(!n)return null;let F=r.esTreeNodeToTSNodeMap.get(c),T=n.getTypeAtLocation(F.expression);if(T.flags&J.default.TypeFlags.Any||T.flags&J.default.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===ae.AST_NODE_TYPES.Literal&&typeof c.right.value=="string"?c.right.value:null):s(c.right)&&(T=c.right,S=c.left.type===ae.AST_NODE_TYPES.Literal&&typeof c.left.value=="string"?c.left.value:null),!T||!S||!Ni(S,Oi))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:et(T,e),type:S}}):!D&&O?e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:et(T,e),type:Array.from(R)[0]}}):!D&&!O?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:et(T,e),actualType:mt(R),conditionType:S}}):D&&O&&e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:et(T,e),actualType:mt(R),conditionType:S}}):!D&&!O?e.report({node:c,messageId:"alwaysFalseTypeofCondition",data:{name:et(T,e),actualType:mt(R),conditionType:S}}):!D&&O&&e.report({node:c,messageId:"unnecessaryTypeofCondition",data:{name:et(T,e),type:mt(R)}})}function a(c){if(c.flags&J.default.TypeFlags.Any||c.flags&J.default.TypeFlags.Unknown)return null;if(c.isUnion()){let F=[];for(let T of c.types)if(T.flags&J.default.TypeFlags.StringLiteral){let S=T.value;F.push(S)}else return null;return F}return c.flags&J.default.TypeFlags.StringLiteral?[c.value]:null}function l(c){if(!n)return null;let F=r.esTreeNodeToTSNodeMap.get(c),T=n.getTypeAtLocation(F),S=a(T);if(S)return S;let R=n.getSymbolAtLocation(F);if(R){let O=n.getTypeOfSymbolAtLocation(R,F),D=a(O);if(D)return D}return null}function u(c){let F=e.sourceCode.ast,T=null;return Ne(F,S=>{if(S.type===ae.AST_NODE_TYPES.VariableDeclarator&&S.id.type===ae.AST_NODE_TYPES.Identifier&&S.id.name===c.name&&S.id.typeAnnotation){let R=S.id.typeAnnotation.typeAnnotation;if(R.type===ae.AST_NODE_TYPES.TSUnionType){let O=[];for(let D of R.types)if(D.type===ae.AST_NODE_TYPES.TSLiteralType&&D.literal.type===ae.AST_NODE_TYPES.Literal&&typeof D.literal.value=="string")O.push(D.literal.value);else return!0;return T=O,!0}if(R.type===ae.AST_NODE_TYPES.TSLiteralType&&R.literal.type===ae.AST_NODE_TYPES.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(!n)return!1;if(n.isArrayType(c)||n.isTupleType(c))return!0;let F=n.getApparentType(c);if(F!==c&&(n.isArrayType(F)||n.isTupleType(F)))return!0;if(c.aliasSymbol){let S=n.getFullyQualifiedName(c.aliasSymbol);if(d(S))return!0}let T=c.getSymbol();if(T){let S=n.getFullyQualifiedName(T);if(d(S))return!0}return!1}function x(c){if(!n)return!1;if(c.flags&J.default.TypeFlags.StringLike||c.flags&J.default.TypeFlags.NumberLike||c.flags&J.default.TypeFlags.BigIntLike||c.flags&J.default.TypeFlags.BooleanLike||c.flags&J.default.TypeFlags.ESSymbolLike||c.flags&J.default.TypeFlags.EnumLike||c.flags&J.default.TypeFlags.Null||c.flags&J.default.TypeFlags.Undefined||c.flags&J.default.TypeFlags.Void||c.flags&J.default.TypeFlags.Never)return!0;let F=c.getSymbol();if(F){let T=n.getFullyQualifiedName(F);if(T==="__function"||T==="__object"&&!g(c))return!0}return!1}function y(c){if(c.flags&J.default.TypeFlags.Any||c.flags&J.default.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===ae.AST_NODE_TYPES.Identifier&&c.object.name===rr.object&&c.property.type===ae.AST_NODE_TYPES.Identifier&&c.property.name===rr.property}function b(c){if(!n||c.callee.type!==ae.AST_NODE_TYPES.MemberExpression||!E(c.callee)||c.arguments.length===0)return;let[F]=c.arguments;if(!F||F.type===ae.AST_NODE_TYPES.SpreadElement)return;let T=r.esTreeNodeToTSNodeMap.get(F),S=n.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!==ae.AST_NODE_TYPES.MemberExpression||c.callee.property.type!==ae.AST_NODE_TYPES.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!==ae.AST_NODE_TYPES.Literal||typeof T.value!="string")return;let S=c.callee.object,R=l(S);if(!R&&S.type===ae.AST_NODE_TYPES.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 K of R)if((F==="startsWith"?K.startsWith(O):F==="endsWith"?K.endsWith(O):K.includes(O))?D++:Z++,D>0&&Z>0)return;if(D>0&&Z===0){let K=F==="startsWith"?"unnecessaryStartsWithCondition":F==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:c,messageId:K})}else if(Z>0&&D===0){let K=F==="startsWith"?"alwaysFalseStartsWithCondition":F==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:c,messageId:K})}}function A(c){if(!new Set(["===","!==",">",">=","<","<="]).has(c.operator))return;function T(V){if(V.type!==ae.AST_NODE_TYPES.MemberExpression||V.computed||V.property.type!==ae.AST_NODE_TYPES.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 ue of Y)H.push(ue.length);return{values:H}}let S=T(c.left),R=T(c.right),O=null,D=null;if(S?c.right.type===ae.AST_NODE_TYPES.Literal&&typeof c.right.value=="number"&&(O=S.values,D=c.right.value):R&&c.left.type===ae.AST_NODE_TYPES.Literal&&typeof c.left.value=="number"&&(O=R.values,D=c.left.value),!O||D===null)return;let Z=0,K=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++:K++,Z>0&&K>0)return}Z>0&&K===0?e.report({node:c,messageId:"unnecessaryLengthCondition"}):K>0&&Z===0&&e.report({node:c,messageId:"alwaysFalseLengthCondition"})}function I(c){if(c.type===ae.AST_NODE_TYPES.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.default.TypeFlags.Intersection)!==0}function C(c){return(c.flags&J.default.TypeFlags.Object)!==0}function h(c){return!n||n.getIndexTypeOfType(c,J.default.IndexKind.String)?!0:!!n.getIndexTypeOfType(c,J.default.IndexKind.Number)}function w(c,F){if(!n||h(c)||c.getProperties().length===0)return"unknown";let T=n.getPropertyOfType(c,F);return T?T.flags&J.default.SymbolFlags.Optional?"optional":"required":"absent"}function P(c,F){if(c.flags&J.default.TypeFlags.Any||c.flags&J.default.TypeFlags.Unknown||c.flags&J.default.TypeFlags.Never||c.flags&J.default.TypeFlags.TypeParameter||c.flags&J.default.TypeFlags.IndexedAccess||c.flags&J.default.TypeFlags.StringLike||c.flags&J.default.TypeFlags.NumberLike||c.flags&J.default.TypeFlags.BigIntLike||c.flags&J.default.TypeFlags.BooleanLike||c.flags&J.default.TypeFlags.EnumLike||c.flags&J.default.TypeFlags.ESSymbolLike||c.flags&J.default.TypeFlags.NonPrimitive||c.flags&J.default.TypeFlags.Null||c.flags&J.default.TypeFlags.Undefined||c.flags&J.default.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===ae.AST_NODE_TYPES.PrivateIdentifier)return;let F=I(c.left);if(!F)return;let T=c.right,S=r.esTreeNodeToTSNodeMap.get(T);if(!n)return;let R=n.getTypeAtLocation(S),O=P(R,F);O==="required"?e.report({node:c,messageId:"unnecessaryInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}}):O==="absent"&&e.report({node:c,messageId:"alwaysFalseInCondition",data:{property:F,type:n.typeToString(R),alternative:t.alternativeForInCondition?`If this a valid condition, you can use as alternative: ${t.alternativeForInCondition}`:""}})}return{BinaryExpression(c){p(c),A(c),v(c)},CallExpression(c){f(c),b(c)}}}})};function mt(e){return Array.from(new Set(e)).join(" | ")||"never"}function et(e,t){let r=e.argument;return r.type===ae.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Ni(e,t){return t.has(e)}var dt=require("@typescript-eslint/utils"),yt=require("zod/v4");var Di=dt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ir="no-call-with-explicit-generics",ji=yt.z.object({functions:yt.z.array(yt.z.string())}),Li=Di({name:ir,meta:{type:"problem",docs:{description:"Enforce calling configured functions with inferred generics only"},messages:{noExplicitGenerics:"Function '{{ functionName }}' should be called with inferred generics (remove the explicit type parameters)"},schema:[B(ji)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:s}=n;s.type===dt.AST_NODE_TYPES.Identifier&&r.has(s.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:s.name}})}}}}),Ut={name:ir,rule:Li};var qe=require("@typescript-eslint/utils"),Mi=qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),sr="no-call-with-inferred-generics",$i=Mi({name:sr,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:s}=n;if(s.type!==qe.AST_NODE_TYPES.Identifier)return;let o=r.get(s.name);if(!o)return;let{minGenerics:i=1,allowAny:p,disallowTypes:a=t.disallowTypes}=o;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:s.name,minGenerics:i||0}}),!(p&&!a)&&n.typeArguments?.params.some(u=>!p&&u.type===qe.AST_NODE_TYPES.TSAnyKeyword||a&&u.type===qe.AST_NODE_TYPES.TSTypeReference&&u.typeName.type===qe.AST_NODE_TYPES.Identifier&&a.includes(u.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:s.name}})}}}}),zt={name:sr,rule:$i};var lr=require("@typescript-eslint/utils"),_i=lr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),pr="no-commented-out-code",Ui=["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:"],zi=/^\s*return\s+/,Wi=/\w=("|'|`)/,Ji=/\w+:\s*('|"|`)/,Vi=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,Xi=/\w+-\w+:/,Bi=/\w+_\w+:/,Hi=/\?\s+\w/,Yi=/:\s+\w/,qi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,Zi=/^\s*\d+[,}]/,Gi=/^\s*\[[^\]]*\][,}]/,Ki=/^\s*\{[^}]*\}[,}]/,Qi=/\.\w+\(/,es=/\[\w+\]/,ts=/^\s*(['"`]).+?\1\s*:/,ns=/^<[A-Z]\w*(\s|>|\/)/,rs=/^<[a-z]+(\s|>|\/)/,is=/<[A-Z]\w*(\s.*)?>/,ss=/<\/[A-Z]\w*>/,os=/<[a-z]+(\s.*)?>/,as=/<\/[a-z]+>/,ls=/^\s*[*\s]*$/,ps=/^[a-zA-Z]/,cs=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,us=/```[\s\S]*?```/g,fs=/`[^`]*`/g,or=/[a-zA-Z0-9]/,ms=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ys=/[{}[\]()`=<>]/,ds=/:\s*(['"`[{(]|\w+\s*=>)/,gs=/\bif\s*\(|\belse\b|=>/,fe={returnStatement:zi,stringAssignment:Wi,objectPropertyWithQuotes:Ji,computedPropertyAssignment:Vi,kebabCaseProperty:Xi,snakeCaseProperty:Bi,ternaryOperator:Hi,colonWithWord:Yi,quotedString:qi,numberWithComma:Zi,arrayWithComma:Gi,objectWithComma:Ki,methodCall:Qi,arrayAccess:es,quotedPropertyKey:ts,jsxSelfClosing:ns,jsxElement:rs,jsxOpeningTag:is,jsxClosingTag:ss,htmlOpeningTag:os,htmlClosingTag:as,jsdocComment:ls};function Ss(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&ps.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||ms.test(t)||ys.test(t)||ds.test(t)||gs.test(t)?!1:!!(t.includes(":")&&cs.test(t))}var Ts=[") {","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],hs=["/>","</",fe.jsxSelfClosing,fe.jsxElement,fe.jsxOpeningTag,fe.jsxClosingTag,fe.htmlOpeningTag,fe.htmlClosingTag],ar=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Es=_i({name:pr,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,s){if(n.startsWith("/"))return!1;let o=n.trimStart();if(n.startsWith("*")||o.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||fe.jsdocComment.test(n))return!1;for(let i of ar)if(o.startsWith(i))return!1;if(n.includes("https://")||Ss(o))return!1;if(s==="Block"){for(let i of hs)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}for(let i of Ui)if(o.startsWith(i))return{wrongPattern:i};for(let i of Ts)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,s){let o=n,i=o.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return o;if(s==="Block"&&o.includes("```")){let l=o.split(us);l.some(d=>or.test(d))&&(o=l.join(""))}if(!o.includes("`"))return o;let p=o.split(fs);return p.some(l=>or.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=t(i,o.type);p&&e.report({node:o,messageId:"commentedOutCode",data:{wrongPattern:p.wrongPattern,allowedPrefixes:ar.join(", ")}})}}}}}),Wt={name:pr,rule:Es};var gt=require("@typescript-eslint/utils"),bs=gt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="no-default-export",xs=bs({name:cr,meta:{type:"problem",docs:{description:"Disallow default exports"},schema:[],messages:{noDefaultExport:"Default exports are not allowed, use named exports instead."}},defaultOptions:[],create(e){return{ExportDefaultDeclaration(t){e.report({node:t,messageId:"noDefaultExport"})},ExportNamedDeclaration(t){for(let r of t.specifiers)r.exported.type===gt.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),Jt={name:cr,rule:xs};var ur=require("@typescript-eslint/utils"),Cs=ur.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),fr="no-leaked-text-in-jsx",Is=[",",";","[","]","(",")"],As=Cs({name:fr,meta:{type:"problem",docs:{description:"Prevents leaking of text in JSX that should be wrapped in an expression container"},messages:{leakedTextInJSX:'Text "{{ text }}" should be wrapped in a JSX expression container.'},schema:[],fixable:"code"},defaultOptions:[],create(e){return{JSXText(t){let r=t.value.trim();if(!r)return;let n="";Is.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Vt={name:fr,rule:As};var Be=require("@typescript-eslint/utils"),ws=Be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),yr="no-non-camel-case-functions",Rs=/^(\$?[a-z][a-zA-Z0-9]*)$/;function mr(e){if(e.typeName.type!==Be.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===Be.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Fs=ws({name:yr,meta:{type:"suggestion",docs:{description:"Enforce camelCase naming convention for function declarations"},schema:[],messages:{nonCamelCaseFunction:'Function name "{{functionName}}" should be in camelCase format. If this fn is a React component and can\'t use the `FC` type, add a explicit "JSX.Element" return type to it'}},defaultOptions:[],create(e){return{FunctionDeclaration(t){if(t.id&&!Rs.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===Be.AST_NODE_TYPES.TSTypeReference?mr(r):r.type===Be.AST_NODE_TYPES.TSUnionType&&r.types.some(s=>s.type===Be.AST_NODE_TYPES.TSTypeReference&&mr(s))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Xt={name:yr,rule:Fs};var oe=require("@typescript-eslint/utils");var ks=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="no-optional-root-props",Ps=ks({name:dr,meta:{type:"problem",docs:{description:"Prevents usage of optional properties at the root of a type if that type is a local type alias or interface referenced only once"},messages:{optionalNotAllowed:'Optional property "{{ propertyName }}" is not allowed on a local type used only once. Use `prop: undefined | ...` instead.',suggestion:"Use `prop: undefined | ...` instead."},hasSuggestions:!0,schema:[]},defaultOptions:[],create(e){function t(n){let o=e.sourceCode.getDeclaredVariables(n)[0];if(!o||o.references.length!==1)return!1;let i=o.references[0];if(!i)return!1;for(let p of Lt(i.identifier)){if("returnType"in p||p.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let a=p.parent;if(!a)return!1;if(a.type===oe.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&a.parent.type===oe.TSESTree.AST_NODE_TYPES.TSTypeReference&&a.parent.typeName.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&a.parent.typeName.name==="FC"){let u=Qe(a.parent.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!u)return!1;let d=St(u,e.sourceCode);return d?!(d.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&d.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&d.parent.callee.name==="memo"):!1}if(p.type===oe.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(a.type===oe.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let l=Qe(a,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration);return l?!!St(l,e.sourceCode):!1}if(a.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!St(a,e.sourceCode)}return!1}function r(n){n.key.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:s=>{let o=Qe(n,oe.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!o)return null;let i=e.sourceCode.getText(o);return s.replaceText(o,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(Tt(n)||!t(n)))for(let s of n.typeAnnotation.members)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSInterfaceDeclaration(n){if(!(Tt(n)||!t(n)))for(let s of n.body.body)s.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(s)},TSTypeReference(n){if(n.typeName.type!==oe.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let s=n.typeArguments.params[0];if(s.type!==oe.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let o=Qe(n.parent,oe.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!o)return;let i=St(o,e.sourceCode);if(!(!i||i.parent.type===oe.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let a of s.members)a.type===oe.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(a)}}}});function Tt(e){return e?e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===oe.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function St(e,t){if(Tt(e))return;let r;if(e.type===oe.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===oe.TSESTree.AST_NODE_TYPES.Identifier&&(r=e.declarations[0].id)}else{if(!e.id)return;r=e.id}if(!r)return;let n=t.getScope(e);e.type===oe.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let s=n.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])&&!Tt(o[0].identifier.parent.parent))return o[0].identifier}var Bt={name:dr,rule:Ps};var st=require("@typescript-eslint/utils");var ot=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 t=new Set;function r(n){return n?n.type===st.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===st.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let s of n.specifiers)t.add(s.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===st.AST_NODE_TYPES.VariableDeclaration)for(let s of n.declaration.declarations)r(s.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===st.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var gr=require("@typescript-eslint/utils"),ht=Oe(require("path")),ze=require("zod/v4");var vs=gr.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-relative-imports",Os=ze.z.object({find:ze.z.string(),replacement:ze.z.string()}),Ns=ze.z.object({aliases:ze.z.array(Os),rootDir:ze.z.string().optional(),allowNotFoundAliases:ze.z.boolean().optional(),_dev_simulateFileName:ze.z.string().optional()}),Ds=vs({name:Sr,meta:{type:"problem",fixable:"code",docs:{description:"Prevent relative imports and auto-fix them using configured aliases"},messages:{noRelativeImports:"Relative imports are not allowed. Use one of the valid aliases in tsconfig.json instead.",noRelativeImportsWithAlias:'Relative imports are not allowed. Use the "{{ alias }}" alias instead.'},schema:[B(Ns)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function s(i,p){let a=ht.default.dirname(p);return ht.default.resolve(a,i)}function o(i){let p=t.rootDir??process.cwd(),a=ht.default.relative(p,i);if(a.startsWith("."))return null;a.startsWith("/")||(a=`/${a}`);for(let{find:l,replacement:u}of t.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(!n(p))return;let a=s(p,r),l=o(a);!l&&t.allowNotFoundAliases||e.report({node:i,messageId:l?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:l?.alias},fix:l?u=>u.replaceText(i.source,`'${l.newPath}'`):void 0})}}}}),Ht={name:Sr,rule:Ds};var me=require("@typescript-eslint/utils"),Yt=require("zod/v4");var js=Yt.z.object({customMessage:Yt.z.string().optional()}),qt=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,[t]){function r(n){switch(n.type){case me.AST_NODE_TYPES.Literal:return!0;case me.AST_NODE_TYPES.ObjectExpression:return n.properties.every(s=>s.type===me.AST_NODE_TYPES.Property?s.computed||s.value.type===me.AST_NODE_TYPES.Identifier&&s.key.type===me.AST_NODE_TYPES.Identifier&&s.key.name===s.value.name?!1:r(s.value):!1);case me.AST_NODE_TYPES.ArrayExpression:return n.elements.every(s=>s?s.type===me.AST_NODE_TYPES.SpreadElement?!1:r(s):!0);case me.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case me.AST_NODE_TYPES.ConditionalExpression:case me.AST_NODE_TYPES.LogicalExpression:case me.AST_NODE_TYPES.BinaryExpression:case me.AST_NODE_TYPES.UnaryExpression:case me.AST_NODE_TYPES.CallExpression:case me.AST_NODE_TYPES.MemberExpression:case me.AST_NODE_TYPES.Identifier:case me.AST_NODE_TYPES.ArrowFunctionExpression:case me.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===me.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let s=null;n.value.type===me.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==me.AST_NODE_TYPES.JSXEmptyExpression&&(s=n.value.expression):n.value.type===me.AST_NODE_TYPES.Literal&&(s=n.value),s&&r(s)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var at=require("@typescript-eslint/utils"),Ze=Oe(require("zod/v4"));var Ls=Ze.object({alternativeMsgs:Ze.object({inArrayFind:Ze.string().optional(),inArrayFilter:Ze.string().optional()}).optional(),__dev_simulateFileName:Ze.string().optional()});function Ms(e){return e.typeAnnotation.type!==at.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var $s=/(typeGuards|type-guards)\.(ts|tsx)$/;function _s(e){return $s.test(e)}function Us(e){let t=e.parent;for(;t;){if(t.type===at.AST_NODE_TYPES.CallExpression&&t.callee.type===at.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===at.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Zt=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,[t]){let r=t.__dev_simulateFileName??e.filename;if(_s(r))return{};function n(s){if(!Ms(s))return;let o=Us(s);if(t.alternativeMsgs&&o){let i=o.method==="filter"?t.alternativeMsgs.inArrayFilter:t.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)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var Ge=require("@typescript-eslint/utils");var zs="no-unnecessary-async-on-jsx-props";function Ws(e){if(e.body.type!==Ge.AST_NODE_TYPES.BlockStatement)return!1;let t=e.body.body;if(t.length!==1)return!1;let r=t[0];return!r||r.type!==Ge.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===Ge.AST_NODE_TYPES.AwaitExpression}var Gt=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 t(r){Ws(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let s=e.sourceCode,o=[],i=s.getFirstToken(r,a=>a.value==="async");if(i){let a=s.getTokenAfter(i);a?o.push(n.replaceTextRange([i.range[0],a.range[0]],"")):o.push(n.remove(i))}function p(a){if(a.type===Ge.AST_NODE_TYPES.AwaitExpression){let l=s.getFirstToken(a);if(l&&l.value==="await"){let u=s.getTokenAfter(l);u?o.push(n.replaceTextRange([l.range[0],u.range[0]],"")):o.push(n.remove(l))}}if(a.type===Ge.AST_NODE_TYPES.BlockStatement)for(let l of a.body)p(l);else a.type===Ge.AST_NODE_TYPES.ExpressionStatement&&p(a.expression)}return p(r.body),o}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var We=require("@typescript-eslint/utils"),Kt=Oe(require("typescript")),tt=Oe(require("zod/v4"));var Js=We.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Tr="no-unnecessary-casting",Vs=tt.default.object({additionalCastFunctions:tt.default.array(tt.default.object({name:tt.default.string(),expectedType:tt.default.enum(["string","number"])})).optional()}),Qt={name:Tr,rule:Js({name:Tr,meta:{type:"suggestion",docs:{description:"Prevents unnecessary Number and String castings"},messages:{unnecessaryNumberCasting:"Unnecessary Number() casting on a value already of number type",unnecessaryStringCasting:"Unnecessary String() casting on a value already of string type",unnecessaryCustomCasting:"Unnecessary {{name}}() casting on a value already of {{type}} type"},schema:[B(Vs)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],s=We.ESLintUtils.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 We.AST_NODE_TYPES.Literal:return d==="number"?typeof u.value=="number":typeof u.value=="string";case We.AST_NODE_TYPES.TemplateLiteral:return d==="string";case We.AST_NODE_TYPES.UnaryExpression:return d==="number"?u.operator==="+"||u.operator==="-"||u.operator==="~":!1;default:return!1}}function p(u,d){return d==="number"?!!(u.flags&Kt.TypeFlags.NumberLike):!!(u.flags&Kt.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===We.AST_NODE_TYPES.SpreadElement)return;let{callee:g}=u;if(g.type!==We.AST_NODE_TYPES.Identifier)return;let x=g.name,y=n.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}}})};var Ae=require("@typescript-eslint/utils"),Et=Oe(require("zod/v4"));var Xs=Et.object({ignoreWithDescription:Et.string().optional()}),en=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,[t]){let r=e.getSourceCode(),n=r.ast;function s(a){let l=a.arguments[0];return l&&l.type===Ae.AST_NODE_TYPES.Literal&&typeof l.value=="string"?l.value:null}function o(a){return!a||!t.ignoreWithDescription?!1:new RegExp(t.ignoreWithDescription).test(a)}function i(a){return a.length!==1?!1:n.body.filter(u=>{if(u.type===Ae.AST_NODE_TYPES.ExpressionStatement){let d=u.expression;if(d.type===Ae.AST_NODE_TYPES.CallExpression&&d.callee.type===Ae.AST_NODE_TYPES.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===Ae.AST_NODE_TYPES.FunctionExpression||l.type===Ae.AST_NODE_TYPES.ArrowFunctionExpression)&&l.body.type===Ae.AST_NODE_TYPES.BlockStatement){let u=l.body.body;return u.length===0?"":u.map(g=>r.text.slice(g.range[0],g.range[1])).join(`
|
|
16
16
|
|
|
17
|
-
`)}return""}return{Program(){let l=[];for(let g of n.body)g.type===Ie.AST_NODE_TYPES.ExpressionStatement&&g.expression.type===Ie.AST_NODE_TYPES.CallExpression&&g.expression.callee.type===Ie.AST_NODE_TYPES.Identifier&&g.expression.callee.name==="describe"&&g.expression.arguments.length===2&&l.push(g.expression);if(!i(l))return;let[c]=l;if(!c)return;let d=s(c);if(a(d))return;let y=n.body.find(g=>g.type===Ie.AST_NODE_TYPES.ExpressionStatement&&g.expression===c);!y||y.type!==Ie.AST_NODE_TYPES.ExpressionStatement||e.report({node:c,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(g){let b=p(c);return b?g.replaceText(y,b):null}}]})}}}});var lt=require("@typescript-eslint/utils"),Ne=Fe(require("zod/v4"));var Bo=Ne.object({methods:Ne.union([Ne.array(Ne.string()),Ne.literal("array")])}),nn=X({name:"no-unnecessary-typing",meta:{type:"suggestion",docs:{description:"Prevents unnecessary explicit type annotations in callback parameters where TypeScript can infer the type"},messages:{unnecessaryTypeAnnotation:"Unnecessary type annotation. TypeScript can infer this type from context."},fixable:"code",schema:[J(Bo)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function a(p){let{callee:l}=p;if(l.type===lt.AST_NODE_TYPES.MemberExpression){let c=l.property;if(c.type===lt.AST_NODE_TYPES.Identifier)return c.name}return null}function i(p,l){if(p.type!==lt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let c=l.parent;if(c.type===lt.AST_NODE_TYPES.CallExpression){let d=a(c);d&&s(d)&&c.arguments.indexOf(l)===0&&e.report({node:p.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(g){return p.typeAnnotation?g.remove(p.typeAnnotation):null}})}}return{ArrowFunctionExpression(p){for(let l of p.params)i(l,p)},FunctionExpression(p){for(let l of p.params)i(l,p)}}}});var Ce=require("@typescript-eslint/utils");var rn=X({name:"no-unused-obj-props",meta:{type:"suggestion",docs:{description:"Disallow unused properties when it is safe to remove them"},messages:{unusedObjectProperty:'The object property "{{name}}" is not being used',unusedReturnObjectProperty:'The object property "{{name}}" returned by this function is not being used'},schema:[]},defaultOptions:[],create(e){return{VariableDeclarator(t){if(t.id.type===Ce.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==Ce.AST_NODE_TYPES.ObjectExpression||t.id.type===Ce.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===Ce.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===Ce.AST_NODE_TYPES.Property&&i.key.type===Ce.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==Ce.AST_NODE_TYPES.Identifier)return;let n=Ho(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==Ce.AST_NODE_TYPES.Property?!1:i.value.type===Ce.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==Ce.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ce.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")a.add(p.property.value);else return;else{if(p.property.type!==Ce.AST_NODE_TYPES.Identifier)return;a.add(p.property.name)}if(p.parent.type===Ce.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)a.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Ho(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var G=require("@typescript-eslint/utils"),on=require("zod/v4");var Yo=on.z.object({ignoreArgsMatching:on.z.string().optional()}),sn=X({name:"no-unused-optional-args",meta:{type:"problem",docs:{description:"Detect unused optional function arguments in non-exported functions"},messages:{unusedOptionalArg:"Optional parameter '{{name}}' is never used",unusedOptionalProp:"Optional prop '{{name}}' is never provided"},schema:[J(Yo)]},defaultOptions:[{}],create(e,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===G.AST_NODE_TYPES.ExportNamedDeclaration||i.type===G.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===G.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===G.AST_NODE_TYPES.ExportDefaultDeclaration}function a(i){let p=[];for(let l=0;l<i.length;l++){let c=i[l];if(!c||c.type!==G.AST_NODE_TYPES.Identifier)continue;let d=c.name;if(!n(d)){if(c.optional&&c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===G.AST_NODE_TYPES.TSTypeLiteral){let y=c.typeAnnotation.typeAnnotation,g=[];for(let b of y.members)b.type===G.AST_NODE_TYPES.TSPropertySignature&&b.key.type===G.AST_NODE_TYPES.Identifier&&g.push({name:b.key.name,optional:b.optional===!0});g.some(b=>b.optional)?p.push({param:c,index:l,name:d,isObjectParam:!0,objectProps:g}):p.push({param:c,index:l,name:d,isObjectParam:!1})}else if(c.optional)p.push({param:c,index:l,name:d,isObjectParam:!1});else if(c.typeAnnotation&&c.typeAnnotation.typeAnnotation.type===G.AST_NODE_TYPES.TSTypeLiteral){let y=c.typeAnnotation.typeAnnotation,g=[];for(let b of y.members)b.type===G.AST_NODE_TYPES.TSPropertySignature&&b.key.type===G.AST_NODE_TYPES.Identifier&&g.push({name:b.key.name,optional:b.optional===!0});g.some(b=>b.optional)&&p.push({param:c,index:l,name:d,isObjectParam:!0,objectProps:g})}}}return p}return{FunctionDeclaration(i){if(s(i))return;let p=a(i.params);p.length!==0&&r.push({node:i,declarationNode:i,optionalParams:p})},VariableDeclarator(i){if(i.id.type!==G.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==G.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==G.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let l=[...a(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===G.AST_NODE_TYPES.TSTypeReference){let c=i.id.typeAnnotation.typeAnnotation;if(c.typeName.type===G.AST_NODE_TYPES.Identifier&&c.typeName.name==="FC"){let d=c.typeArguments;if(d&&d.params.length===1){let y=d.params[0];if(y&&y.type===G.AST_NODE_TYPES.TSTypeLiteral){let g=[];for(let b of y.members)b.type===G.AST_NODE_TYPES.TSPropertySignature&&b.key.type===G.AST_NODE_TYPES.Identifier&&g.push({name:b.key.name,optional:b.optional===!0});g.some(b=>b.optional)&&l.push({param:i.id,index:0,name:"props",isObjectParam:!0,objectProps:g})}}}}l.length!==0&&r.push({node:i.init,declarationNode:i,optionalParams:l})},"Program:exit"(){for(let i of r){let l=e.sourceCode.getDeclaredVariables(i.declarationNode)[0];if(!l)continue;let c=l.references.filter(g=>g.identifier!==l.identifiers[0]);if(c.length===0)continue;let d=!1;for(let g of c){let b=g.identifier.parent;if(b.type===G.AST_NODE_TYPES.CallExpression&&g.identifier.type===G.AST_NODE_TYPES.Identifier&&b.arguments.includes(g.identifier)){d=!0;break}if(b.type===G.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(b.type===G.AST_NODE_TYPES.Property&&b.parent.type===G.AST_NODE_TYPES.ObjectExpression&&b.parent.parent.type===G.AST_NODE_TYPES.ReturnStatement){d=!0;break}if(b.type===G.AST_NODE_TYPES.JSXExpressionContainer){d=!0;break}}if(d)continue;let y=[];for(let g of c){let b=g.identifier.parent;if(b.type===G.AST_NODE_TYPES.CallExpression&&b.callee===g.identifier){let f=b.arguments.length,E=b.arguments.some(m=>m.type===G.AST_NODE_TYPES.SpreadElement);if(E){d=!0;break}let h={argCount:f,hasSpread:E};for(let m of i.optionalParams)if(m.isObjectParam&&m.index<f){let A=b.arguments[m.index];if(A?.type===G.AST_NODE_TYPES.ObjectExpression){let I={};for(let o of A.properties)o.type===G.AST_NODE_TYPES.Property&&o.key.type===G.AST_NODE_TYPES.Identifier&&(I[o.key.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[m.index]=I}else if(A){d=!0;break}}y.push(h)}else if(b.type===G.AST_NODE_TYPES.JSXOpeningElement&&b.name===g.identifier){let f=b.attributes.some(h=>h.type===G.AST_NODE_TYPES.JSXSpreadAttribute);if(f){d=!0;break}let E={argCount:1,hasSpread:f};for(let h of i.optionalParams)if(h.isObjectParam&&h.index===0){let m={};for(let A of b.attributes)A.type===G.AST_NODE_TYPES.JSXAttribute&&A.name.type===G.AST_NODE_TYPES.JSXIdentifier&&(m[A.name.name]=!0);E.objectArgs||(E.objectArgs=[]),E.objectArgs[0]=m}y.push(E)}}if(!(d||y.length===0))for(let g of i.optionalParams)if(g.isObjectParam&&g.objectProps)for(let b of g.objectProps){if(!b.optional)continue;let f=!1;for(let E of y)if(E.objectArgs&&E.objectArgs[g.index]){let h=E.objectArgs[g.index];if(h&&h[b.name]){f=!0;break}}f||e.report({node:g.param,messageId:"unusedOptionalProp",data:{name:b.name}})}else{let b=!1;for(let f of y)if(f.argCount>g.index){b=!0;break}b||e.report({node:g.param,messageId:"unusedOptionalArg",data:{name:g.name}})}}}}}});var oe=require("@typescript-eslint/utils"),Be=require("zod/v4");var qo=Be.z.object({selectors:Be.z.array(Be.z.object({name:Be.z.string(),selectorProp:Be.z.string().optional(),selectorArgPos:Be.z.number().optional(),returnProp:Be.z.string().optional()}))}),Zo=oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sr="no-unused-selected-values",an={name:Sr,rule:Zo({name:Sr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[J(qo)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let a=null;if(s.init?.type===oe.AST_NODE_TYPES.CallExpression&&(a=s.init),!a)return;let i=Ko(a);if(!i)return;let p=n.get(i);if(!p)return;let l=Go(a,p.selectorArgPos??0,p.selectorProp);if(!l)return;let c=Qo(l);if(!c)return;let d=Tr(c.properties,void 0);if(!d)return;if(s.id.type===oe.AST_NODE_TYPES.ObjectPattern){let b=Tr(s.id.properties,p.returnProp);if(!b)return;for(let[f,E]of d)b.has(f)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:f}});return}if(s.id.type!==oe.AST_NODE_TYPES.Identifier||p.returnProp)return;let y=es(s,e.sourceCode);if(y.length===0)return;let g=new Set;for(let b of y){if(b.identifier.parent.type!==oe.AST_NODE_TYPES.MemberExpression)return;let f=b.identifier.parent.property;if(f.type!==oe.AST_NODE_TYPES.Identifier)return;g.add(f.name)}for(let[b,f]of d)g.has(b)||e.report({node:f,messageId:"unusedSelectedValue",data:{name:b}})}}}})};function Go(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===oe.AST_NODE_TYPES.ArrowFunctionExpression||n.type===oe.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===oe.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===oe.AST_NODE_TYPES.Property&&i.key.type===oe.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==oe.AST_NODE_TYPES.Property)return null;let a=s.value;if(a.type===oe.AST_NODE_TYPES.ArrowFunctionExpression||a.type===oe.AST_NODE_TYPES.FunctionExpression)return a}return null}function Ko(e){return e.callee.type===oe.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===oe.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===oe.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Qo(e){if(e.body.type===oe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===oe.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===oe.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==oe.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function Tr(e,t){let r=e;if(t){let s=e.find(a=>a.type===oe.AST_NODE_TYPES.Property&&a.key.type===oe.AST_NODE_TYPES.Identifier&&a.key.name===t);if(s?.type!==oe.AST_NODE_TYPES.Property||s.value.type!==oe.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==oe.AST_NODE_TYPES.Property||s.key.type!==oe.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function es(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var se=require("@typescript-eslint/utils");var ln=X({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(a=>a.type===se.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(a){if(s)return;if(!n){let p=ts(a);p&&(n=p);return}let i=ns(a,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,l]of n)e.report({node:l,messageId:"unusedField",data:{name:p}})}}}}});function ts(e){if(!(e.callee.type===se.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==se.AST_NODE_TYPES.ObjectExpression)return null;let n=$t(r.properties,a=>a.type!==se.AST_NODE_TYPES.Property||a.key.type!==se.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===se.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===se.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===se.AST_NODE_TYPES.FunctionExpression?rs(a.value):null);if(!n)return null;let s=new Map;for(let a of n.properties)a.type===se.AST_NODE_TYPES.Property&&a.key.type===se.AST_NODE_TYPES.Identifier&&s.set(a.key.name,a);return s}function ns(e,t){if(!(e.callee.type===se.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==se.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==se.AST_NODE_TYPES.ObjectPattern||!$t(e.parent.id.properties,i=>i.type===se.AST_NODE_TYPES.Property&&i.key.type===se.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=er(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of s){if(i.type!==se.AST_NODE_TYPES.Identifier||i.parent.type===se.AST_NODE_TYPES.Property&&i.parent.parent.type===se.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===se.AST_NODE_TYPES.ReturnStatement||i.parent.type===se.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===se.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==se.AST_NODE_TYPES.Identifier||i.parent.property.type!==se.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function rs(e){if(e.body.type===se.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===se.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===se.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==se.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var ne=require("@typescript-eslint/utils"),pt=require("zod/v4");var is=ne.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function hr(e){let t=[];for(let r of e.members)r.type===ne.AST_NODE_TYPES.TSPropertySignature&&r.key.type===ne.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Er(e,...t){for(let r of t)e.set(...r);return e}var os=pt.z.object({forceCheckOnFCPropTypesWithName:pt.z.array(pt.z.string()).optional(),alwaysCheckFunctionOptionTypes:pt.z.boolean().optional()}),br="no-unused-type-props-in-args",pn=null,ss=is({name:br,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[J(os)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!pn&&(pn=r.map(l=>new RegExp(l)));function s(l,c,d,y,g=!0,b=!1){let f=d.name,E=e.sourceCode.getScope(c).references.find(o=>o.identifier.name===f)?.resolved,h=l&&pn?.some(o=>o.test(f)),m=b&&n;if(!E||!h&&E.references.filter(o=>o.isTypeReference).length>1||!E.defs[0])return;let A=E.defs[0].node,I=A.parent?.type===ne.AST_NODE_TYPES.ExportNamedDeclaration;if(!(g&&I&&!m)){if(A.type===ne.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,c,y,A.typeAnnotation,!0,b);return}if(A.type===ne.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,c,y,A.body,!0,b);return}}}function a(l,c,d,y,g,b=!1){if(y.type===ne.AST_NODE_TYPES.TSInterfaceBody){for(let f of y.body)f.type===ne.AST_NODE_TYPES.TSPropertySignature&&f.key.type===ne.AST_NODE_TYPES.Identifier&&d.set(f.key.name,f);return}if(y.type===ne.AST_NODE_TYPES.TSTypeLiteral){Er(d,...hr(y));return}if(y.type===ne.AST_NODE_TYPES.TSIntersectionType){for(let f of y.types)a(l,c,d,f,!0,b);return}g||y.type===ne.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ne.AST_NODE_TYPES.Identifier&&s(l,c,y.typeName,d,!0,b)}function i(l,c,d,y=!1){for(let g of d)if(g.type===ne.AST_NODE_TYPES.ObjectPattern&&g.typeAnnotation){let b=new Map;if(a(l,c,b,g.typeAnnotation.typeAnnotation,!1,y),b.size===0)continue;p(g,b)}else g.type===ne.AST_NODE_TYPES.AssignmentPattern&&g.left.type===ne.AST_NODE_TYPES.ObjectPattern&&i(l,c,[g.left],y)}function p(l,c){let d=[];if(l.properties.at(-1)?.type===ne.AST_NODE_TYPES.RestElement)return;for(let f of l.properties)f.type===ne.AST_NODE_TYPES.Property&&f.key.type===ne.AST_NODE_TYPES.Identifier&&d.push(f.key.name);let g=[],b=[];for(let[f,E]of c)d.includes(f)||(b.push(f),g.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:f}}));for(let[f,E]of g.entries())e.report({...E,fix:f===g.length-1?h=>{let m=l.properties.at(-1),A=b.join(", ");return m?m.type===ne.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(m,`, ${A}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],A)}:void 0})}return{VariableDeclaration(l){let c=l.declarations[0],d=new Map,y=c.id.type===ne.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation?.typeAnnotation.type===ne.AST_NODE_TYPES.TSTypeReference&&c.id.typeAnnotation.typeAnnotation.typeName.type===ne.AST_NODE_TYPES.Identifier&&c.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&c.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(y){if(y.type===ne.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ne.AST_NODE_TYPES.Identifier)s(!0,l,y.typeName,d,!1);else if(y.type===ne.AST_NODE_TYPES.TSTypeLiteral)Er(d,...hr(y));else if(y.type===ne.AST_NODE_TYPES.TSIntersectionType)for(let g of y.types)g.type===ne.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===ne.AST_NODE_TYPES.Identifier?s(!0,l,g.typeName,d,!1):a(!0,l,d,g,!0);if(d.size!==0&&c.init?.type===ne.AST_NODE_TYPES.ArrowFunctionExpression){let g=c.init.params[0];if(!g){e.report({node:c.init,messageId:"missingComponentParam"});return}g.type===ne.AST_NODE_TYPES.ObjectPattern&&p(g,d)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),cn={name:br,rule:ss};var Pe=require("@typescript-eslint/utils");var un=X({name:"no-write-only-ref",meta:{type:"problem",docs:{description:"Disallow creating refs that are never read"},messages:{refNotRead:'Ref "{{name}}" is never read. Consider removing it if not needed.'},schema:[]},defaultOptions:[],create(e){let t=new Set;function r(n){return n.callee.type===Pe.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&n.callee.property.type===Pe.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===Pe.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Pe.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Pe.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Pe.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let p of a.references){let c=p.identifier.parent;if(c!==n&&!(c.type===Pe.AST_NODE_TYPES.JSXExpressionContainer&&c.parent.type===Pe.AST_NODE_TYPES.JSXAttribute&&c.parent.name.type===Pe.AST_NODE_TYPES.JSXIdentifier&&c.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var tt=require("@typescript-eslint/utils"),as=tt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cr="prefer-named-functions",xr=new Map,ls=as({name:Cr,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=xr.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),xr.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===tt.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===tt.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==tt.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,p=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:c=>c.replaceText(a,`${l.async?"async ":""}function ${s}(${i.map(d=>e.sourceCode.getText(d)).join(", ")||""}) ${e.sourceCode.getText(p)}`)}]})}}}}}),fn={name:Cr,rule:ls};var H=require("@typescript-eslint/utils"),De=require("zod/v4");var ps=De.z.object({disallowedFunctions:De.z.array(De.z.object({name:De.z.string(),allowUsingWithArgs:De.z.boolean().optional(),hookAlternative:De.z.string().optional(),message:De.z.string().optional(),allowUseInside:De.z.array(De.z.string()).optional()}))}),cs=/^use[A-Z]/,us=/^[A-Z]/;function bt(e){return cs.test(e)}function Ir(e){return us.test(e)}function fs(e){return e.type===H.AST_NODE_TYPES.Identifier?bt(e.name):e.type===H.AST_NODE_TYPES.MemberExpression&&e.property.type===H.AST_NODE_TYPES.Identifier?bt(e.property.name):!1}function Ar(e,t){return e.type===H.AST_NODE_TYPES.Identifier?e.name===t:e.type===H.AST_NODE_TYPES.MemberExpression&&e.object.type===H.AST_NODE_TYPES.Identifier&&e.property.type===H.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function wr(e){return!!(e.parent&&e.parent.type===H.AST_NODE_TYPES.CallExpression&&Ar(e.parent.callee,"forwardRef"))}function Rr(e){return!!(e.parent&&e.parent.type===H.AST_NODE_TYPES.CallExpression&&Ar(e.parent.callee,"memo"))}function mn(e){if(e.type===H.AST_NODE_TYPES.FunctionDeclaration||e.type===H.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===H.AST_NODE_TYPES.FunctionExpression||e.type===H.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===H.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===H.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===H.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===H.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ms(e){let t=e.parent,r=!1;for(;t;){if(t.type===H.AST_NODE_TYPES.FunctionDeclaration||t.type===H.AST_NODE_TYPES.FunctionExpression||t.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let n=mn(t);if(n&&n.type===H.AST_NODE_TYPES.Identifier){if(Ir(n.name)||bt(n.name))return!r;r=!0}else{if(wr(t)||Rr(t))return!r;if(t.parent.type===H.AST_NODE_TYPES.CallExpression){let s=t.parent;fs(s.callee)||(r=!0)}else t.parent.type===H.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Pr(e){return e.callee.type===H.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===H.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===H.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function ds(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===H.AST_NODE_TYPES.FunctionDeclaration||r.type===H.AST_NODE_TYPES.FunctionExpression||r.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let n=mn(r);if(n&&n.type===H.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===H.AST_NODE_TYPES.CallExpression){let n=Pr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ys(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===H.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function gs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===H.AST_NODE_TYPES.FunctionDeclaration||n.type===H.AST_NODE_TYPES.FunctionExpression||n.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let s=mn(n);if(s&&s.type===H.AST_NODE_TYPES.Identifier){if(Ir(s.name)||bt(s.name)){r=!0;break}}else if(wr(n)||Rr(n)){r=!0;break}}n=n.parent}return r?t.length===0?ms(e):!ds(e,t):!1}var dn=X({name:"prefer-react-hook-alternative",meta:{type:"suggestion",docs:{description:"Prefer hook alternatives for certain functions in React components and hooks"},messages:{preferHookAlternative:"This function should not be used in react{{message}}."},schema:[J(ps)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let a=Pr(s);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ys(s))return;let p=i.allowUseInside||[];gs(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:l=>{let c=i.hookAlternative;return c?s.callee.type===H.AST_NODE_TYPES.Identifier?l.replaceText(s.callee,c):s.callee.type===H.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===H.AST_NODE_TYPES.Identifier?l.replaceText(s.callee.property,c):null:null}}]:[]})}}}});var le=require("@typescript-eslint/utils"),xt=Fe(require("zod/v4"));var Ss=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="prefer-single-line-if",Ts=xt.default.object({maxLineLength:xt.default.number().optional(),maxNonSimpleConditionLength:xt.default.number().optional()}),hs=Ss({name:Fr,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[J(Ts)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==le.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let a=n.consequent.body[0];if(!a)return;if(a.type===le.AST_NODE_TYPES.ReturnStatement){if(!Or(a))return}else if(!(a.type===le.AST_NODE_TYPES.ContinueStatement||a.type===le.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===le.AST_NODE_TYPES.LogicalExpression||n.test.type===le.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let y=vr(n.test);if(!y&&n.test.type===le.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let g=n.test.argument;vr(g)&&(y=!0)}if(y&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(a);if(i.includes(`
|
|
18
|
-
`))return;let
|
|
17
|
+
`)}return""}return{Program(){let a=[];for(let g of n.body)g.type===Ae.AST_NODE_TYPES.ExpressionStatement&&g.expression.type===Ae.AST_NODE_TYPES.CallExpression&&g.expression.callee.type===Ae.AST_NODE_TYPES.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=n.body.find(g=>g.type===Ae.AST_NODE_TYPES.ExpressionStatement&&g.expression===l);!d||d.type!==Ae.AST_NODE_TYPES.ExpressionStatement||e.report({node:l,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(g){let x=p(l);return x?g.replaceText(d,x):null}}]})}}}});var lt=require("@typescript-eslint/utils"),je=Oe(require("zod/v4"));var Bs=je.object({methods:je.union([je.array(je.string()),je.literal("array")])}),tn=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,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function s(p){return Array.isArray(r)?r.includes(p):n.has(p)}function o(p){let{callee:a}=p;if(a.type===lt.AST_NODE_TYPES.MemberExpression){let l=a.property;if(l.type===lt.AST_NODE_TYPES.Identifier)return l.name}return null}function i(p,a){if(p.type!==lt.AST_NODE_TYPES.Identifier||!p.typeAnnotation)return;let l=a.parent;if(l.type===lt.AST_NODE_TYPES.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)}}}});var Ie=require("@typescript-eslint/utils");var nn=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(t){if(t.id.type===Ie.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==Ie.AST_NODE_TYPES.ObjectExpression||t.id.type===Ie.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===Ie.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===Ie.AST_NODE_TYPES.Property&&i.key.type===Ie.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==Ie.AST_NODE_TYPES.Identifier)return;let n=Hs(t,e.sourceCode);if(n.length===0)return;let s=t.init.properties.some(i=>i.type!==Ie.AST_NODE_TYPES.Property?!1:i.value.type===Ie.AST_NODE_TYPES.FunctionExpression),o=new Set;for(let i of n){if(i.identifier.parent.type!==Ie.AST_NODE_TYPES.MemberExpression)return;let p=i.identifier.parent;if(p.object!==i.identifier)return;if(p.computed)if(p.property.type===Ie.AST_NODE_TYPES.Literal&&typeof p.property.value=="string")o.add(p.property.value);else return;else{if(p.property.type!==Ie.AST_NODE_TYPES.Identifier)return;o.add(p.property.name)}if(p.parent.type===Ie.AST_NODE_TYPES.CallExpression&&s)return}for(let[i,p]of r)o.has(i)||e.report({node:p,messageId:"unusedObjectProperty",data:{name:i}})}}}});function Hs(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var te=require("@typescript-eslint/utils"),rn=require("zod/v4");var Ys=rn.z.object({ignoreArgsMatching:rn.z.string().optional()}),sn=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,[t]){let r=[];function n(i){return t.ignoreArgsMatching?new RegExp(t.ignoreArgsMatching).test(i):!1}function s(i){return i.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.type===te.AST_NODE_TYPES.ExportDefaultDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportNamedDeclaration||i.parent?.type===te.AST_NODE_TYPES.ExportDefaultDeclaration}function o(i){let p=[];for(let a=0;a<i.length;a++){let l=i[a];if(!l||l.type!==te.AST_NODE_TYPES.Identifier)continue;let u=l.name;if(!n(u)){if(l.optional&&l.typeAnnotation&&l.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeLiteral){let d=l.typeAnnotation.typeAnnotation,g=[];for(let x of d.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.TSTypeLiteral){let d=l.typeAnnotation.typeAnnotation,g=[];for(let x of d.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.Identifier||!i.init||i.init.type!==te.AST_NODE_TYPES.ArrowFunctionExpression&&i.init.type!==te.AST_NODE_TYPES.FunctionExpression||s(i.parent.parent))return;let a=[...o(i.init.params)];if(i.id.typeAnnotation&&i.id.typeAnnotation.typeAnnotation.type===te.AST_NODE_TYPES.TSTypeReference){let l=i.id.typeAnnotation.typeAnnotation;if(l.typeName.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.TSTypeLiteral){let g=[];for(let x of d.members)x.type===te.AST_NODE_TYPES.TSPropertySignature&&x.key.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.CallExpression&&g.identifier.type===te.AST_NODE_TYPES.Identifier&&x.arguments.includes(g.identifier)){u=!0;break}if(x.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.Property&&x.parent.type===te.AST_NODE_TYPES.ObjectExpression&&x.parent.parent.type===te.AST_NODE_TYPES.ReturnStatement){u=!0;break}if(x.type===te.AST_NODE_TYPES.JSXExpressionContainer){u=!0;break}}if(u)continue;let d=[];for(let g of l){let x=g.identifier.parent;if(x.type===te.AST_NODE_TYPES.CallExpression&&x.callee===g.identifier){let y=x.arguments.length,E=x.arguments.some(f=>f.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectExpression){let I={};for(let m of A.properties)m.type===te.AST_NODE_TYPES.Property&&m.key.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.JSXOpeningElement&&x.name===g.identifier){let y=x.attributes.some(b=>b.type===te.AST_NODE_TYPES.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.AST_NODE_TYPES.JSXAttribute&&A.name.type===te.AST_NODE_TYPES.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}})}}}}}});var le=require("@typescript-eslint/utils"),He=require("zod/v4");var qs=He.z.object({selectors:He.z.array(He.z.object({name:He.z.string(),selectorProp:He.z.string().optional(),selectorArgPos:He.z.number().optional(),returnProp:He.z.string().optional()}))}),Zs=le.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hr="no-unused-selected-values",on={name:hr,rule:Zs({name:hr,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[B(qs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(s=>[s.name,s]));return{VariableDeclarator(s){let o=null;if(s.init?.type===le.AST_NODE_TYPES.CallExpression&&(o=s.init),!o)return;let i=Ks(o);if(!i)return;let p=n.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=Er(l.properties,void 0);if(!u)return;if(s.id.type===le.AST_NODE_TYPES.ObjectPattern){let x=Er(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.AST_NODE_TYPES.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.AST_NODE_TYPES.MemberExpression)return;let y=x.identifier.parent.property;if(y.type!==le.AST_NODE_TYPES.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,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===le.AST_NODE_TYPES.ArrowFunctionExpression||n.type===le.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===le.AST_NODE_TYPES.ObjectExpression){let s=n.properties.find(i=>i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&i.key.name===r);if(s?.type!==le.AST_NODE_TYPES.Property)return null;let o=s.value;if(o.type===le.AST_NODE_TYPES.ArrowFunctionExpression||o.type===le.AST_NODE_TYPES.FunctionExpression)return o}return null}function Ks(e){return e.callee.type===le.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===le.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===le.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Qs(e){if(e.body.type===le.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===le.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===le.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==le.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function Er(e,t){let r=e;if(t){let s=e.find(o=>o.type===le.AST_NODE_TYPES.Property&&o.key.type===le.AST_NODE_TYPES.Identifier&&o.key.name===t);if(s?.type!==le.AST_NODE_TYPES.Property||s.value.type!==le.AST_NODE_TYPES.ObjectPattern)return null;r=s.value.properties}let n=new Map;for(let s of r){if(s.type!==le.AST_NODE_TYPES.Property||s.key.type!==le.AST_NODE_TYPES.Identifier)return null;n.set(s.key.name,s)}return n.size>0?n:null}function eo(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(s=>s.identifier!==e.id):[]}var pe=require("@typescript-eslint/utils");var an=q({name:"no-unused-t-state-field",meta:{type:"suggestion",docs:{description:"Prevent declaring unused t-state fields"},messages:{unusedField:'Field "{{name}}" is not being used, you can safely remove it'},schema:[]},defaultOptions:[],create(e){if(!(e.filename.endsWith(".jsx")||e.filename.endsWith(".tsx")))return{};if(!e.sourceCode.ast.body.some(o=>o.type===pe.AST_NODE_TYPES.ImportDeclaration&&o.source.value==="t-state-form"))return{};let n=null,s=!1;return{CallExpression(o){if(s)return;if(!n){let p=to(o);p&&(n=p);return}let i=no(o,e.sourceCode);if(i){s=!0;for(let p of i)n.delete(p);if(n.size!==0)for(let[p,a]of n)e.report({node:a,messageId:"unusedField",data:{name:p}})}}}}});function to(e){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==pe.AST_NODE_TYPES.ObjectExpression)return null;let n=Mt(r.properties,o=>o.type!==pe.AST_NODE_TYPES.Property||o.key.type!==pe.AST_NODE_TYPES.Identifier||o.key.name!=="initialConfig"?null:o.value.type===pe.AST_NODE_TYPES.ObjectExpression?o.value:o.value.type===pe.AST_NODE_TYPES.ArrowFunctionExpression||o.value.type===pe.AST_NODE_TYPES.FunctionExpression?ro(o.value):null);if(!n)return null;let s=new Map;for(let o of n.properties)o.type===pe.AST_NODE_TYPES.Property&&o.key.type===pe.AST_NODE_TYPES.Identifier&&s.set(o.key.name,o);return s}function no(e,t){if(!(e.callee.type===pe.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==pe.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==pe.AST_NODE_TYPES.ObjectPattern||!Mt(e.parent.id.properties,i=>i.type===pe.AST_NODE_TYPES.Property&&i.key.type===pe.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let s=tr(e.parent,"formFields",t),o=new Set;for(let{identifier:i}of s){if(i.type!==pe.AST_NODE_TYPES.Identifier||i.parent.type===pe.AST_NODE_TYPES.Property&&i.parent.parent.type===pe.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===pe.AST_NODE_TYPES.ReturnStatement||i.parent.type===pe.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===pe.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==pe.AST_NODE_TYPES.Identifier||i.parent.property.type!==pe.AST_NODE_TYPES.Identifier)return null;o.add(i.parent.property.name)}}return o}function ro(e){if(e.body.type===pe.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===pe.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===pe.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==pe.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var se=require("@typescript-eslint/utils"),pt=require("zod/v4");var io=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function br(e){let t=[];for(let r of e.members)r.type===se.AST_NODE_TYPES.TSPropertySignature&&r.key.type===se.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function xr(e,...t){for(let r of t)e.set(...r);return e}var so=pt.z.object({forceCheckOnFCPropTypesWithName:pt.z.array(pt.z.string()).optional(),alwaysCheckFunctionOptionTypes:pt.z.boolean().optional()}),Cr="no-unused-type-props-in-args",ln=null,oo=io({name:Cr,meta:{type:"problem",docs:{description:"Disallow unused undestructured object type properties"},messages:{unusedObjectTypeProperty:"Object type property '{{ propertyName }}' is defined but never used",missingComponentParam:"Component has declared props but no props are used"},schema:[B(so)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!ln&&(ln=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&&ln?.some(m=>m.test(y)),f=x&&n;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===se.AST_NODE_TYPES.ExportNamedDeclaration;if(!(g&&I&&!f)){if(A.type===se.AST_NODE_TYPES.TSTypeAliasDeclaration){o(a,l,d,A.typeAnnotation,!0,x);return}if(A.type===se.AST_NODE_TYPES.TSInterfaceDeclaration){o(a,l,d,A.body,!0,x);return}}}function o(a,l,u,d,g,x=!1){if(d.type===se.AST_NODE_TYPES.TSInterfaceBody){for(let y of d.body)y.type===se.AST_NODE_TYPES.TSPropertySignature&&y.key.type===se.AST_NODE_TYPES.Identifier&&u.set(y.key.name,y);return}if(d.type===se.AST_NODE_TYPES.TSTypeLiteral){xr(u,...br(d));return}if(d.type===se.AST_NODE_TYPES.TSIntersectionType){for(let y of d.types)o(a,l,u,y,!0,x);return}g||d.type===se.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===se.AST_NODE_TYPES.Identifier&&s(a,l,d.typeName,u,!0,x)}function i(a,l,u,d=!1){for(let g of u)if(g.type===se.AST_NODE_TYPES.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===se.AST_NODE_TYPES.AssignmentPattern&&g.left.type===se.AST_NODE_TYPES.ObjectPattern&&i(a,l,[g.left],d)}function p(a,l){let u=[];if(a.properties.at(-1)?.type===se.AST_NODE_TYPES.RestElement)return;for(let y of a.properties)y.type===se.AST_NODE_TYPES.Property&&y.key.type===se.AST_NODE_TYPES.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===se.AST_NODE_TYPES.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===se.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation?.typeAnnotation.type===se.AST_NODE_TYPES.TSTypeReference&&l.id.typeAnnotation.typeAnnotation.typeName.type===se.AST_NODE_TYPES.Identifier&&l.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&l.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(d){if(d.type===se.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===se.AST_NODE_TYPES.Identifier)s(!0,a,d.typeName,u,!1);else if(d.type===se.AST_NODE_TYPES.TSTypeLiteral)xr(u,...br(d));else if(d.type===se.AST_NODE_TYPES.TSIntersectionType)for(let g of d.types)g.type===se.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===se.AST_NODE_TYPES.Identifier?s(!0,a,g.typeName,u,!1):o(!0,a,u,g,!0);if(u.size!==0&&l.init?.type===se.AST_NODE_TYPES.ArrowFunctionExpression){let g=l.init.params[0];if(!g){e.report({node:l.init,messageId:"missingComponentParam"});return}g.type===se.AST_NODE_TYPES.ObjectPattern&&p(g,u)}}},FunctionDeclaration(a){i(!1,a,a.params,n)},ArrowFunctionExpression(a){i(!1,a,a.params,n)}}}}),pn={name:Cr,rule:oo};var Pe=require("@typescript-eslint/utils");var cn=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 t=new Set;function r(n){return n.callee.type===Pe.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===Pe.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===Pe.AST_NODE_TYPES.Identifier&&n.callee.property.type===Pe.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let s of n.specifiers)s.type===Pe.AST_NODE_TYPES.ImportSpecifier&&s.imported.type===Pe.AST_NODE_TYPES.Identifier&&s.imported.name==="useRef"&&t.add(s.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===Pe.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===Pe.AST_NODE_TYPES.Identifier){let o=e.sourceCode.getScope(n).set.get(n.id.name);if(o){let i=!1;for(let p of o.references){let l=p.identifier.parent;if(l!==n&&!(l.type===Pe.AST_NODE_TYPES.JSXExpressionContainer&&l.parent.type===Pe.AST_NODE_TYPES.JSXAttribute&&l.parent.name.type===Pe.AST_NODE_TYPES.JSXIdentifier&&l.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var nt=require("@typescript-eslint/utils"),ao=nt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="prefer-named-functions",Ir=new Map,lo=ao({name:Ar,meta:{hasSuggestions:!0,type:"suggestion",docs:{description:"Prevent using arrow functions when a named function can be used instead"},schema:[{type:"object",properties:{ignoreRegex:{type:"string"},disallowArrowFnWithImplicitReturns:{type:"boolean"}}}],messages:{suggestion:"Convert to named function",default:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}" instead of an arrow function',withIgnoreRegex:'Function {{functionName}} should be defined as a named function "function {{functionName}} () {}", if not possible to use `function` you can also use a name that matches the rule ignore regex'}},defaultOptions:[{}],create(e,[t]){let r=null;if(t.ignoreRegex){let n=Ir.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Ir.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===nt.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===nt.AST_NODE_TYPES.Identifier){let s=n.id.name;if(n.id.typeAnnotation||r&&r.test(s)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==nt.AST_NODE_TYPES.BlockStatement)return;let o=n.parent,i=n.init.params,p=n.init.body,a=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:s,ignoreRegex:t.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)}`)}]})}}}}}),un={name:Ar,rule:lo};var G=require("@typescript-eslint/utils"),Le=require("zod/v4");var po=Le.z.object({disallowedFunctions:Le.z.array(Le.z.object({name:Le.z.string(),allowUsingWithArgs:Le.z.boolean().optional(),hookAlternative:Le.z.string().optional(),message:Le.z.string().optional(),allowUseInside:Le.z.array(Le.z.string()).optional()}))}),co=/^use[A-Z]/,uo=/^[A-Z]/;function bt(e){return co.test(e)}function wr(e){return uo.test(e)}function fo(e){return e.type===G.AST_NODE_TYPES.Identifier?bt(e.name):e.type===G.AST_NODE_TYPES.MemberExpression&&e.property.type===G.AST_NODE_TYPES.Identifier?bt(e.property.name):!1}function Rr(e,t){return e.type===G.AST_NODE_TYPES.Identifier?e.name===t:e.type===G.AST_NODE_TYPES.MemberExpression&&e.object.type===G.AST_NODE_TYPES.Identifier&&e.property.type===G.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Fr(e){return!!(e.parent&&e.parent.type===G.AST_NODE_TYPES.CallExpression&&Rr(e.parent.callee,"forwardRef"))}function kr(e){return!!(e.parent&&e.parent.type===G.AST_NODE_TYPES.CallExpression&&Rr(e.parent.callee,"memo"))}function fn(e){if(e.type===G.AST_NODE_TYPES.FunctionDeclaration||e.type===G.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===G.AST_NODE_TYPES.FunctionExpression||e.type===G.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===G.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===G.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===G.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===G.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function mo(e){let t=e.parent,r=!1;for(;t;){if(t.type===G.AST_NODE_TYPES.FunctionDeclaration||t.type===G.AST_NODE_TYPES.FunctionExpression||t.type===G.AST_NODE_TYPES.ArrowFunctionExpression){let n=fn(t);if(n&&n.type===G.AST_NODE_TYPES.Identifier){if(wr(n.name)||bt(n.name))return!r;r=!0}else{if(Fr(t)||kr(t))return!r;if(t.parent.type===G.AST_NODE_TYPES.CallExpression){let s=t.parent;fo(s.callee)||(r=!0)}else t.parent.type===G.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Pr(e){return e.callee.type===G.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===G.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===G.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function yo(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===G.AST_NODE_TYPES.FunctionDeclaration||r.type===G.AST_NODE_TYPES.FunctionExpression||r.type===G.AST_NODE_TYPES.ArrowFunctionExpression){let n=fn(r);if(n&&n.type===G.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===G.AST_NODE_TYPES.CallExpression){let n=Pr(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function go(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===G.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function So(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===G.AST_NODE_TYPES.FunctionDeclaration||n.type===G.AST_NODE_TYPES.FunctionExpression||n.type===G.AST_NODE_TYPES.ArrowFunctionExpression){let s=fn(n);if(s&&s.type===G.AST_NODE_TYPES.Identifier){if(wr(s.name)||bt(s.name)){r=!0;break}}else if(Fr(n)||kr(n)){r=!0;break}}n=n.parent}return r?t.length===0?mo(e):!yo(e,t):!1}var mn=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(po)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(s=>[s.name,s]));return{CallExpression(s){let o=Pr(s);if(!o)return;let i=n.get(o);if(!i||i.allowUsingWithArgs&&go(s))return;let p=i.allowUseInside||[];So(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===G.AST_NODE_TYPES.Identifier?a.replaceText(s.callee,l):s.callee.type===G.AST_NODE_TYPES.MemberExpression&&s.callee.property.type===G.AST_NODE_TYPES.Identifier?a.replaceText(s.callee.property,l):null:null}}]:[]})}}}});var ce=require("@typescript-eslint/utils"),xt=Oe(require("zod/v4"));var To=ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Or="prefer-single-line-if",ho=xt.default.object({maxLineLength:xt.default.number().optional(),maxNonSimpleConditionLength:xt.default.number().optional()}),Eo=To({name:Or,meta:{type:"suggestion",fixable:"code",docs:{description:"Enforce single-line if in simple if statements"},messages:{noSingleLineCurly:"If return statement with single statement body should be written in a single line"},schema:[B(ho)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==ce.AST_NODE_TYPES.BlockStatement||n.loc.start.line===n.loc.end.line||r.getCommentsInside(n.consequent).length>0||n.alternate||n.consequent.body.length!==1)return;let o=n.consequent.body[0];if(!o)return;if(o.type===ce.AST_NODE_TYPES.ReturnStatement){if(!Dr(o))return}else if(!(o.type===ce.AST_NODE_TYPES.ContinueStatement||o.type===ce.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===ce.AST_NODE_TYPES.LogicalExpression||n.test.type===ce.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let d=vr(n.test);if(!d&&n.test.type===ce.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let g=n.test.argument;vr(g)&&(d=!0)}if(d&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let p=r.getText(o);if(i.includes(`
|
|
18
|
+
`))return;let a=r.getTokenAfter(n);if(a&&a.type===ce.AST_TOKEN_TYPES.Punctuator&&a.value==="}"){let d=r.getTokenAfter(a);if(d&&d.type===ce.AST_TOKEN_TYPES.Keyword&&(d.value==="else"||d.value==="catch"))return}let l=bo(r,n),u=`if (${i}) ${p}`;t.maxLineLength&&u.length+l.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:d=>d.replaceText(n,u)})}}}});function vr(e){return e.type===ce.AST_NODE_TYPES.CallExpression||e.type===ce.AST_NODE_TYPES.BinaryExpression||e.type===ce.AST_NODE_TYPES.MemberExpression&&Nr(e)}function Nr(e){return e.object.type===ce.AST_NODE_TYPES.MemberExpression?Nr(e.object):e.object.type!==ce.AST_NODE_TYPES.Identifier}function bo(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function Dr(e){if(!e.argument)return!0;let t=e.argument;return t.type===ce.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===ce.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===ce.AST_NODE_TYPES.Literal||t.type===ce.AST_NODE_TYPES.Identifier||t.type===ce.AST_NODE_TYPES.TemplateLiteral||t.type===ce.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===ce.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===ce.AST_NODE_TYPES.UnaryExpression?Dr(t):!1}var yn={name:Or,rule:Eo};var U=require("@typescript-eslint/utils"),gn=require("zod/v4");var xo=U.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),$r="react-compiler-extra",Co=gn.z.object({runOnlyWithEnableCompilerDirective:gn.z.boolean().optional()}),Io=/eslint +react-compiler\/react-compiler: +\["error/;function _r(e){return e.type===U.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function Ao(e){return e.type===U.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===U.AST_NODE_TYPES.MemberExpression&&e.property.type===U.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Me(e){if(!e)return!1;switch(e.type){case U.AST_NODE_TYPES.JSXElement:case U.AST_NODE_TYPES.JSXFragment:return!0;case U.AST_NODE_TYPES.ConditionalExpression:return Me(e.consequent)||Me(e.alternate);case U.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Me(e.right):e.operator==="||"?Me(e.left)||Me(e.right):!1;case U.AST_NODE_TYPES.CallExpression:if(e.callee.type===U.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===U.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===U.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==U.AST_NODE_TYPES.SpreadElement&&Me(t))return!0;return!1;default:return!1}}function wo(e){let t=e.typeAnnotation;if(t.type===U.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===U.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===U.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===U.AST_NODE_TYPES.Identifier&&t.typeName.right.type===U.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Ro=/^[A-Z][a-zA-Z0-9]*$/;function ut(e){return Ro.test(e)}function Sn(e){return e.startsWith("use")&&e.length>3}function Tn(e,t,r,n){if(r&&wo(r))return t?ut(t.name):e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?ut(e.id.name):!0;if(t&&Sn(t.name)||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id&&Sn(e.id.name))return!0;if(n){let s=t?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(s&&ut(s)&&Ur(e.body,n).containsJSX)return!0}return!1}function ct(e){if(e.body.type===U.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===U.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===U.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function Ur(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Ne(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case U.AST_NODE_TYPES.JSXElement:case U.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case U.AST_NODE_TYPES.CallExpression:_r(n.callee)&&(r.containsHookCalls=!0),Me(n)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.ReturnStatement:n.argument&&Me(n.argument)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.VariableDeclarator:n.init&&Me(n.init)&&(r.containsJSX=!0);break;case U.AST_NODE_TYPES.AssignmentExpression:Me(n.right)&&(r.containsJSX=!0);break}},t),r}function jr(e,t){let r=e.body,n=Ur(r,t);return n.containsJSX||n.containsHookCalls}var Fo=/\bthis[.[]/;function Lr(e){return Fo.test(e)}function ko(e,t){let r={containsJSX:!1,containsHookCalls:!1};return Ne(e,n=>{if(r.containsHookCalls||(n.type===U.AST_NODE_TYPES.FunctionDeclaration||n.type===U.AST_NODE_TYPES.FunctionExpression||n.type===U.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===U.AST_NODE_TYPES.CallExpression&&Ao(n.callee)&&(r.containsHookCalls=!0)},t),r}function Mr(e){return ut(e)||Sn(e)}function dn(e,t,r,n){if(!ko(e.body,t).containsHookCalls)return!1;let o=Tn(e,r,n,t);if(!o&&n){let i=r?.name||e.type===U.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&ut(i)&&(o=!0)}return!o}var Po=xo({name:$r,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(Co)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let o of e.sourceCode.getAllComments())if(Io.test(o.value)){r=!0;break}if(!r)return{}}function n(o){for(let i of o.properties)if(i.type===U.AST_NODE_TYPES.Property&&i.method&&i.value.type===U.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode,a=p.getText(i.key),l=i.value,u=p.getText(l.body);if(Lr(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===U.AST_NODE_TYPES.Property&&i.value.type===U.AST_NODE_TYPES.ObjectExpression){for(let p of i.value.properties)if(p.type===U.AST_NODE_TYPES.Property&&p.method&&p.value.type===U.AST_NODE_TYPES.FunctionExpression){let l=e.sourceCode.getText(p.value.body);Lr(l)&&e.report({node:p,messageId:"thisKeywordInMethod"})}}}return{CallExpression(o){if(_r(o.callee))for(let i of o.arguments){if(i.type===U.AST_NODE_TYPES.ObjectExpression&&(n(i),s(i)),i.type===U.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===U.AST_NODE_TYPES.ObjectExpression&&(n(i.body),s(i.body)),i.body.type===U.AST_NODE_TYPES.BlockStatement))for(let p of i.body.body)p.type===U.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument));if(i.type===U.AST_NODE_TYPES.FunctionExpression)for(let p of i.body.body)p.type===U.AST_NODE_TYPES.ReturnStatement&&p.argument?.type===U.AST_NODE_TYPES.ObjectExpression&&(n(p.argument),s(p.argument))}},VariableDeclarator(o){if(o.id.type===U.AST_NODE_TYPES.Identifier&&o.init&&(o.init.type===U.AST_NODE_TYPES.ArrowFunctionExpression||o.init.type===U.AST_NODE_TYPES.FunctionExpression)){let i=o.init,p=o.id,a=o.id.typeAnnotation;if(ct(i)&&!Mr(p.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(dn(i,e.sourceCode,p,a)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(Tn(i,p,a,e.sourceCode)){let l=jr(i,e.sourceCode),u=ct(i);!l&&!u&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(d){if(i.body.type===U.AST_NODE_TYPES.BlockStatement){let g=i.body.range[0]+1;return d.insertTextAfterRange([g,g],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}return null}}]})}}},FunctionDeclaration(
|
|
20
|
+
`)}return null}}]})}}},FunctionDeclaration(o){if(o.id&&ct(o)&&!Mr(o.id.name)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}if(dn(o,e.sourceCode)){e.report({node:o,messageId:"functionCallingHooksMustBeComponent"});return}if(Tn(o,void 0,void 0,e.sourceCode)){let i=jr(o,e.sourceCode),p=ct(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],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(
|
|
23
|
-
`),
|
|
22
|
+
`)}}]})}},FunctionExpression(o){if(ct(o)){e.report({node:o,messageId:"useMemoDirectiveNaming"});return}dn(o,e.sourceCode)&&e.report({node:o,messageId:"functionCallingHooksMustBeComponent"})}}}}),hn={name:$r,rule:Po};var be=require("@typescript-eslint/utils"),De=require("zod/v4");var vo=be.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zr="react-compiler-migration",Oo=De.z.object({disallowHooks:De.z.array(De.z.object({name:De.z.string(),replacement:De.z.string()})).optional(),disallowMethods:De.z.array(De.z.object({name:De.z.string(),replacement:De.z.string().optional(),requireTrueProp:De.z.string().optional()})).optional()}),No=/eslint +react-compiler\/react-compiler: +\["error/;function Do(e){return e.type===be.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===be.AST_NODE_TYPES.MemberExpression&&e.property.type===be.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var jo=vo({name:zr,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(Oo)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(No.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let s=null,o=null;if(n.callee.type===be.AST_NODE_TYPES.Identifier?(s=n.callee.name,o=n.callee):n.callee.type===be.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===be.AST_NODE_TYPES.Identifier&&(s=n.callee.property.name,o=n.callee.property),s){let i=t.disallowHooks.find(p=>p.name===s);i&&o&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:p=>p.replaceText(o,i.replacement)}]})}}if(t.disallowMethods?.length&&Do(n.callee)){for(let s of n.arguments)if(s.type===be.AST_NODE_TYPES.ObjectExpression){for(let o of s.properties)if(o.type===be.AST_NODE_TYPES.Property&&o.key.type===be.AST_NODE_TYPES.Identifier){let i=o.key.name,p=t.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===be.AST_NODE_TYPES.Property&&u.key.type===be.AST_NODE_TYPES.Identifier&&u.key.name===a&&u.value.type===be.AST_NODE_TYPES.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}]})}}}}}}:{}}}),En={name:zr,rule:jo};var $=require("@typescript-eslint/utils"),xn=require("zod");var Lo=xn.z.object({runOnlyWithEnableCompilerDirective:xn.z.boolean().optional()}),Mo=/eslint +react-compiler\/react-compiler: +\["error/,$o=/^\d+$/,_o=/[\s_-]+/,Uo=/[a-z][A-Z]/,zo=/^(.+?)([A-Z][a-z]+s?)$/,Wo=/^[a-z][a-zA-Z]*$/;function Wr(e,t){let r=[];if(e.type===$.AST_NODE_TYPES.JSXElement){for(let n of e.openingElement.attributes)if(n.type===$.AST_NODE_TYPES.JSXAttribute&&n.name.type===$.AST_NODE_TYPES.JSXIdentifier&&n.value?.type===$.AST_NODE_TYPES.JSXExpressionContainer&&n.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression){let s=n.name.name,o=n.value.expression,i=!1;Ne(o,p=>{switch(p.type){case $.AST_NODE_TYPES.ObjectExpression:case $.AST_NODE_TYPES.ArrowFunctionExpression:case $.AST_NODE_TYPES.FunctionExpression:case $.AST_NODE_TYPES.ArrayExpression:return i=!0,!0}return!1},t),i&&r.push(s)}}return{hasUnstable:r.length>0,problematicProps:r}}function Jo(e){if(e.body.type===$.AST_NODE_TYPES.JSXElement||e.body.type===$.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===$.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===$.AST_NODE_TYPES.ReturnStatement&&t.argument&&(t.argument.type===$.AST_NODE_TYPES.JSXElement||t.argument.type===$.AST_NODE_TYPES.JSXFragment))return!0}return!1}function Vo(e,t){let r=e.callee;if(r.type===$.AST_NODE_TYPES.MemberExpression){let n=r.object;if(n.type===$.AST_NODE_TYPES.Identifier){let s=n.name,o=Xo(s);if(o!==s)return Cn(o)}}if(t.length>0){let n=t[0];if(n&&n.type===$.AST_NODE_TYPES.Identifier)return Cn(n.name)}return"ListItem"}function Xo(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(Uo)){let n=e.match(zo);if(n){let s=n[1],o=n[2];if(!s||!o)return bn(e);let i=bn(o);if(i!==o)return s+i}}return bn(e)}function bn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function Cn(e){return e.match(Wo)?e.charAt(0).toUpperCase()+e.slice(1):e.split(_o).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function Jr(e,t,r){let n=[],s=new Set,o=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Ne(e,i=>{if(i.type===$.AST_NODE_TYPES.Identifier&&!t.includes(i.name)&&!o.has(i.name)&&!$o.test(i.name)){let p=i.parent;if(p.type===$.AST_NODE_TYPES.Property&&p.key===i||p.type===$.AST_NODE_TYPES.MemberExpression&&p.property===i&&!p.computed||p.type===$.AST_NODE_TYPES.JSXOpeningElement||p.type===$.AST_NODE_TYPES.JSXClosingElement||p.type===$.AST_NODE_TYPES.JSXAttribute&&p.name.type===$.AST_NODE_TYPES.JSXIdentifier&&p.name.name===i.name)return!1;s.add(i.name)}return!1},r);for(let i of s)t.includes(i)||n.push({name:i,type:"unknown"});return n}function Vr(e,t,r,n,s){let i=[...r.map(d=>d.type===$.AST_NODE_TYPES.Identifier?d.name:"item").map((d,g)=>({name:d,type:g===0?`${e}Type`:g===1?"number":"unknown"})),...n],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(t),u=`${e}Props`;return`type ${u} = {
|
|
24
24
|
${p}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const ${e}: FC<${
|
|
27
|
+
const ${e}: FC<${u}> = ({ ${a} }) => {
|
|
28
28
|
return (
|
|
29
|
-
${
|
|
29
|
+
${l}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Bo(e,t,r,n){let s=t.map(i=>i.type===$.AST_NODE_TYPES.Identifier?i.name:"item"),o=[n?`key={${n}}`:`key={${s[0]}.id}`,...s.map(i=>`${i}={${i}}`),...r.map(i=>`${i.name}={${i.name}}`)].filter(Boolean);return`<${e} ${o.join(" ")} />`}function Ho(e){if(e.type===$.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===$.AST_NODE_TYPES.JSXIdentifier){let t=e.openingElement.name.name;if(t!=="div"&&t!=="span")return Cn(t)}return"ListItem"}function Yo(e,t,r){let n=[r?`key={${r}}`:"",...t.map(s=>`${s.name}={${s.name}}`)].filter(Boolean);return`<${e}${n.length>0?` ${n.join(" ")}`:""} />`}function Xr(e,t){for(let r of e.openingElement.attributes)if(r.type===$.AST_NODE_TYPES.JSXAttribute&&r.name.type===$.AST_NODE_TYPES.JSXIdentifier&&r.name.name==="key"&&r.value&&r.value.type===$.AST_NODE_TYPES.JSXExpressionContainer&&r.value.expression.type!==$.AST_NODE_TYPES.JSXEmptyExpression)return t.getText(r.value.expression);return null}var In=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(Lo)],hasSuggestions:!0},defaultOptions:[{runOnlyWithEnableCompilerDirective:!1}],create(e,[t]){let{sourceCode:r}=e;if(t.runOnlyWithEnableCompilerDirective){let n=!1;for(let s of r.getAllComments())if(Mo.test(s.value)){n=!0;break}if(!n)return{}}return{CallExpression(n){n.callee.type===$.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===$.AST_NODE_TYPES.Identifier&&(n.callee.property.name==="map"||n.callee.property.name==="push")&&(n.callee.property.name==="map"?qo(n,r,e):Zo(n,r,e))}}}});function qo(e,t,r){let n=e.arguments[0];if(!n||n.type!==$.AST_NODE_TYPES.ArrowFunctionExpression&&n.type!==$.AST_NODE_TYPES.FunctionExpression||!Jo(n))return;let s=null;if(n.body.type===$.AST_NODE_TYPES.JSXElement||n.body.type===$.AST_NODE_TYPES.JSXFragment?s=n.body:n.body.type===$.AST_NODE_TYPES.BlockStatement&&n.body.body[0]?.type===$.AST_NODE_TYPES.ReturnStatement&&n.body.body[0].argument&&(n.body.body[0].argument.type===$.AST_NODE_TYPES.JSXElement||n.body.body[0].argument.type===$.AST_NODE_TYPES.JSXFragment)&&(s=n.body.body[0].argument),!s)return;let o=Wr(s,t);if(!o.hasUnstable)return;let i=Vo(e,n.params),p=n.params.map(d=>d.type===$.AST_NODE_TYPES.Identifier?d.name:"item"),a=Jr(s,p,t),l=s.type===$.AST_NODE_TYPES.JSXElement?Xr(s,t):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=Vr(i,s,n.params,a,t),x=Bo(i,n.params,a,l),y=e;for(;y.parent.type!==$.AST_NODE_TYPES.Program&&!(y.type===$.AST_NODE_TYPES.FunctionDeclaration||y.type===$.AST_NODE_TYPES.VariableDeclarator&&y.init&&(y.init.type===$.AST_NODE_TYPES.ArrowFunctionExpression||y.init.type===$.AST_NODE_TYPES.FunctionExpression));)y=y.parent;let E=[];return E.push(d.insertTextAfter(y,`
|
|
32
32
|
|
|
33
|
-
${g}`)),E.push(
|
|
33
|
+
${g}`)),E.push(d.replaceText(s,x)),E}}]})}function Zo(e,t,r){let n=e.arguments[0];if(!n||n.type!==$.AST_NODE_TYPES.JSXElement&&n.type!==$.AST_NODE_TYPES.JSXFragment)return;let s=n,o=Wr(s,t);if(!o.hasUnstable)return;let i=Ho(s),p=Jr(s,[],t),a=s.type===$.AST_NODE_TYPES.JSXElement?Xr(s,t):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=Vr(i,s,[],p,t),g=Yo(i,p,a),x=e;for(;x.parent.type!==$.AST_NODE_TYPES.Program&&!(x.type===$.AST_NODE_TYPES.FunctionDeclaration||x.type===$.AST_NODE_TYPES.VariableDeclarator&&x.init&&(x.init.type===$.AST_NODE_TYPES.ArrowFunctionExpression||x.init.type===$.AST_NODE_TYPES.FunctionExpression));)x=x.parent;let y=[];return y.push(u.insertTextAfter(x,`
|
|
34
34
|
|
|
35
|
-
${y}`)),f.push(d.replaceText(s,g)),f}}]})}var Ct=require("@typescript-eslint/utils"),Zs=Ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vr="require-description",Gs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Ks=/^eslint-disable-(next-)?line$/u,Qs=Zs({name:Vr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let s of r.getAllComments()){let a=ea(s);a!=null&&(n.has(a.kind)||a.description||e.report({loc:ra(s.loc),messageId:"missingDescription"}))}}}}}),Xr={name:Vr,rule:Qs};function ea(e){let{text:t,description:r}=na(e.value);if(!t)return null;let n=Gs.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let a=Ks.test(s);if(e.type===Ct.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var ta=/\s-{2,}\s/u;function na(e){let t=e.split(ta);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ra(e){return{start:{line:e.start.line,column:-1},end:e.end}}var K=require("@typescript-eslint/utils"),Le=require("zod/v4");var ia=Le.z.object({varsToCheck:Le.z.array(Le.z.object({selector:Le.z.string().optional(),fromFnCall:Le.z.string().optional(),prop:Le.z.string().or(Le.z.array(Le.z.string())),errorMsg:Le.z.string().optional()}))}),wn=X({name:"require-reads-to-var-prop",meta:{type:"suggestion",docs:{description:"Require specific properties from variables to be read or ensure the variable is passed to functions/components"},messages:{propNotRead:'"{{fnName}}" requires reads to the prop "{{prop}}". {{customMsg}}',propsNotRead:'"{{fnName}}" requires reads to the props {{props}}. {{customMsg}}'},schema:[J(ia)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,l,c){let d=new Set;for(let g of i.properties)g.type===K.AST_NODE_TYPES.Property&&g.key.type===K.AST_NODE_TYPES.Identifier&&d.add(g.key.name);let y=p.filter(g=>!d.has(g));if(y.length>0)if(y.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:y[0],fnName:c,customMsg:l||""}});else{let g=y.map(b=>`"${b}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:g,fnName:c,customMsg:l||""}})}}function s(i){if(i.init?.type===K.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===K.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===K.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===K.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===K.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let a={};for(let i of t.varsToCheck)i.selector&&(a[i.selector]=p=>{if(p.type===K.AST_NODE_TYPES.VariableDeclarator&&p.id.type===K.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===K.AST_NODE_TYPES.VariableDeclarator&&p.id.type===K.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(p.id,l,i.errorMsg,s(p))}});for(let i of t.varsToCheck)if(i.fromFnCall){let p=i.fromFnCall;if(p.startsWith("*.")){let c=`VariableDeclarator > CallExpression > MemberExpression[property.name="${p.slice(2)}"]`;a[c]=d=>{if(d.type!==K.AST_NODE_TYPES.MemberExpression||d.parent.type!==K.AST_NODE_TYPES.CallExpression)return;let y=d.parent;if(y.parent.type!==K.AST_NODE_TYPES.VariableDeclarator)return;let g=y.parent;if(g.id.type===K.AST_NODE_TYPES.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===K.AST_NODE_TYPES.ObjectPattern){let b=Array.isArray(i.prop)?i.prop:[i.prop];n(g.id,b,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(p.includes(".")){let[l,c]=p.split("."),d=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${c}"]`;a[d]=y=>{if(y.type!==K.AST_NODE_TYPES.MemberExpression||y.parent.type!==K.AST_NODE_TYPES.CallExpression)return;let g=y.parent;if(g.parent.type!==K.AST_NODE_TYPES.VariableDeclarator)return;let b=g.parent;if(b.id.type===K.AST_NODE_TYPES.Identifier)r.set(b.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:b.id,fnName:i.fromFnCall||"unknown function"});else if(b.id.type===K.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(b.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;a[l]=c=>{if(c.type!==K.AST_NODE_TYPES.Identifier||c.parent.type!==K.AST_NODE_TYPES.CallExpression)return;let d=c.parent;if(d.parent.type!==K.AST_NODE_TYPES.VariableDeclarator)return;let y=d.parent;if(y.id.type===K.AST_NODE_TYPES.Identifier)r.set(y.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:y.id,fnName:i.fromFnCall||"unknown function"});else if(y.id.type===K.AST_NODE_TYPES.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];n(y.id,g,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:p,errorMsg:l,node:c,fnName:d}]of r){let g=e.sourceCode.getScope(c).set.get(i);if(g){let b=new Set(p);for(let f of g.references){let E=f.identifier,h=E.parent;if(!(h.type===K.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===K.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===K.AST_NODE_TYPES.Identifier&&b.has(h.property.name)){if(b.delete(h.property.name),b.size===0)break;continue}if(h.type===K.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===K.AST_NODE_TYPES.ObjectPattern){for(let m of h.id.properties)m.type===K.AST_NODE_TYPES.Property&&m.key.type===K.AST_NODE_TYPES.Identifier&&b.has(m.key.name)&&b.delete(m.key.name);if(b.size===0)break;continue}if(!(h.type===K.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===K.AST_NODE_TYPES.Identifier&&!p.includes(h.property.name))){b.clear();break}}}if(b.size>0){let f=Array.from(b);if(f.length===1)e.report({node:c,messageId:"propNotRead",data:{prop:f[0],fnName:d,customMsg:l||""}});else{let E=f.map(h=>`"${h}"`).join(", ");e.report({node:c,messageId:"propsNotRead",data:{props:E,fnName:d,customMsg:l||""}})}}}}}}}});function Yr(e){return/^use[A-Z0-9]/.test(e)}function It(e){return e.type==="Identifier"?Yr(e.name):e.type==="MemberExpression"&&!e.computed&&It(e.property)?e.object.type==="Identifier":!1}function qr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Zr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Gr(e){return!!(e.parent&&e.parent.callee&&Zr(e.parent.callee,"forwardRef"))}function Kr(e){return!!(e.parent&&e.parent.callee&&Zr(e.parent.callee,"memo"))}function Rn(e){for(;e;){let t=ei(e);if(t&&(qr(t)||It(t))||Gr(e)||Kr(e))return!0;e=e.parent}return!1}function Br(e){return!1}function Pn(e){return!1}var oa=/eslint +react-compiler\/react-compiler: +\["error/,Qr={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 l of e.sourceCode.getAllComments())if(oa.test(l.value))return{CallExpression(c){let d=null;c.callee.name==="useMemo"?d="useMemo":c.callee.name==="useCallback"&&(d="useCallback"),d&&e.report({node:c,message:`"${d}" is not necessary when using React Compiler.`})}}}let t=typeof e.getSource=="function"?l=>t(l):l=>e.sourceCode.getText(l),r=typeof e.getScope=="function"?()=>r():l=>e.sourceCode.getScope(l),n=null,s=[],a=[],i=new WeakSet;function p(l){for(let c of l.references){let d=c.identifier.parent;if(d.type==="VariableDeclarator"&&d.init&&d.init.type==="CallExpression"&&d.init.callee&&Br(d.init.callee))for(let y of c.resolved.references)y!==c&&i.add(y.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>s.push(new Map),onCodePathEnd(l,c){let d=s.pop();if(d.size===0)return;let y=new Set;function g(o,S){let{cache:u}=g,T=u.get(o.id),w=new Set(S);if(w.has(o.id)){let R=[...w],v=R.slice(R.indexOf(o.id)+1);for(let x of v)y.add(x);return BigInt("0")}if(w.add(o.id),T!==void 0)return T;if(l.thrownSegments.includes(o))T=BigInt("0");else if(o.prevSegments.length===0)T=BigInt("1");else{T=BigInt("0");for(let R of o.prevSegments)T+=g(R,w)}return o.reachable&&T===BigInt("0")?u.delete(o.id):u.set(o.id,T),T}function b(o,S){let{cache:u}=b,T=u.get(o.id),w=new Set(S);if(w.has(o.id)){let R=Array.from(w),v=R.slice(R.indexOf(o.id)+1);for(let x of v)y.add(x);return BigInt("0")}if(w.add(o.id),T!==void 0)return T;if(l.thrownSegments.includes(o))T=BigInt("0");else if(o.nextSegments.length===0)T=BigInt("1");else{T=BigInt("0");for(let R of o.nextSegments)T+=b(R,w)}return u.set(o.id,T),T}function f(o){let{cache:S}=f,u=S.get(o.id);if(u===null)return 1/0;if(u!==void 0)return u;if(S.set(o.id,null),o.prevSegments.length===0)u=1;else{u=1/0;for(let T of o.prevSegments){let w=f(T);w<u&&(u=w)}u+=1}return S.set(o.id,u),u}g.cache=new Map,b.cache=new Map,f.cache=new Map;let E=b(l.initialSegment),h=ei(c),m=Rn(c),A=h?qr(h)||It(h):Gr(c)||Kr(c),I=1/0;for(let o of l.finalSegments){if(!o.reachable)continue;let S=f(o);S<I&&(I=S)}for(let[o,S]of d){if(!o.reachable)continue;let u=o.nextSegments.length===0?I<=f(o):I<f(o),T=g(o)*b(o),w=y.has(o.id);for(let R of S)if(w&&!Pn(R)&&e.report({node:R,message:`React Hook "${t(R)}" 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(c.async&&e.report({node:R,message:`React Hook "${t(R)}" cannot be called in an async function.`}),!w&&T!==E&&!Pn(R)){let x=`React Hook "${t(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(u?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:x})}}else if(c.parent&&(c.parent.type==="MethodDefinition"||c.parent.type==="ClassProperty")&&c.parent.value===c){let v=`React Hook "${t(R)}" 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:R,message:v})}else if(h){let v=`React Hook "${t(R)}" is called in function "${t(h)}" 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:R,message:v})}else if(c.type==="Program"){let v=`React Hook "${t(R)}" 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:R,message:v})}else if(m&&!Pn(R)){if(c.parent.type==="CallExpression"&&c.parent.callee.type==="Identifier"&&c.parent.callee.name==="useCallback"){let x=c.parent;if(x.parent.type==="VariableDeclarator"&&Yr(x.parent.id.name))return}let v=`React Hook "${t(R)}" 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:R,message:v})}}},CallExpression(l){if(It(l.callee)){let c=Hr(s),d=Hr(a),y=c.get(d);y||(y=[],c.set(d,y)),y.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Br(l.callee))&&l.arguments.length>0&&(n=l)},Identifier(l){n==null&&i.has(l)&&l.parent.type!=="CallExpression"&&e.report({node:l,message:`\`${t(l)}\` is a function created with React Hook "useEffectEvent", and can only be called from the same component. They cannot be assigned to variables or passed down.`})},"CallExpression:exit"(l){l===n&&(n=null)},FunctionDeclaration(l){Rn(l)&&p(r(l))},ArrowFunctionExpression(l){Rn(l)&&p(r(l))}}}};function ei(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 Hr(e){return e[e.length-1]}var ye=require("@typescript-eslint/utils"),be=Fe(require("zod/v4"));var sa=/^\s+$/,vn=/\r?\n/,aa=/^(\s*)/,la=/^(\s*)\S/,pa=/\r?\n/,ca=be.object({indent:be.union([be.string().regex(sa),be.number().int().min(1)]).optional(),tags:be.array(be.string()).optional(),functions:be.array(be.string()).optional(),comments:be.array(be.string()).optional()}),Fn=X({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[J(ca)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:s=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(m=>m.toLowerCase());function p(m){let A=m.split(vn),I=A.filter(S=>S.trim()!=="");if(I.length===0)return m;let o=Number.POSITIVE_INFINITY;for(let S of I){let u=S.match(aa);u&&(o=Math.min(o,u[1]?.length??0))}return!isFinite(o)||o===0?m:A.map(S=>S.slice(o)).join(`
|
|
36
|
-
`)}function
|
|
37
|
-
`)}function
|
|
35
|
+
${d}`)),y.push(u.replaceText(s,g)),y}}]})}var Ct=require("@typescript-eslint/utils"),Go=Ct.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Br="require-description",Ko=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Qo=/^eslint-disable-(next-)?line$/u,ea=Go({name:Br,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let s of r.getAllComments()){let o=ta(s);o!=null&&(n.has(o.kind)||o.description||e.report({loc:ia(s.loc),messageId:"missingDescription"}))}}}}}),Hr={name:Br,rule:ea};function ta(e){let{text:t,description:r}=ra(e.value);if(!t)return null;let n=Ko.exec(t);if(!n)return null;let s=n[1];if(!s)return null;let o=Qo.test(s);if(e.type===Ct.TSESTree.AST_TOKEN_TYPES.Line&&!o||o&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+s.length);return{kind:s,value:i.trim(),description:r}}var na=/\s-{2,}\s/u;function ra(e){let t=e.split(na);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function ia(e){return{start:{line:e.start.line,column:-1},end:e.end}}var ne=require("@typescript-eslint/utils"),$e=require("zod/v4");var sa=$e.z.object({varsToCheck:$e.z.array($e.z.object({selector:$e.z.string().optional(),fromFnCall:$e.z.string().optional(),prop:$e.z.string().or($e.z.array($e.z.string())),errorMsg:$e.z.string().optional()}))}),An=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(sa)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,p,a,l){let u=new Set;for(let g of i.properties)g.type===ne.AST_NODE_TYPES.Property&&g.key.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===ne.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===ne.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===ne.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let o={};for(let i of t.varsToCheck)i.selector&&(o[i.selector]=p=>{if(p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.Identifier&&r.set(p.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:p.id,fnName:s(p)}),p.type===ne.AST_NODE_TYPES.VariableDeclarator&&p.id.type===ne.AST_NODE_TYPES.ObjectPattern){let a=Array.isArray(i.prop)?i.prop:[i.prop];n(p.id,a,i.errorMsg,s(p))}});for(let i of t.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.AST_NODE_TYPES.MemberExpression||u.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let d=u.parent;if(d.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let g=d.parent;if(g.id.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectPattern){let x=Array.isArray(i.prop)?i.prop:[i.prop];n(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.AST_NODE_TYPES.MemberExpression||d.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let g=d.parent;if(g.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let x=g.parent;if(x.id.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(x.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let a=`VariableDeclarator > CallExpression > Identifier[name="${p}"]`;o[a]=l=>{if(l.type!==ne.AST_NODE_TYPES.Identifier||l.parent.type!==ne.AST_NODE_TYPES.CallExpression)return;let u=l.parent;if(u.parent.type!==ne.AST_NODE_TYPES.VariableDeclarator)return;let d=u.parent;if(d.id.type===ne.AST_NODE_TYPES.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.AST_NODE_TYPES.ObjectPattern){let g=Array.isArray(i.prop)?i.prop:[i.prop];n(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.AST_NODE_TYPES.VariableDeclarator&&b.id===E)){if(b.type===ne.AST_NODE_TYPES.MemberExpression&&b.object===E&&b.property.type===ne.AST_NODE_TYPES.Identifier&&x.has(b.property.name)){if(x.delete(b.property.name),x.size===0)break;continue}if(b.type===ne.AST_NODE_TYPES.VariableDeclarator&&b.init===E&&b.id.type===ne.AST_NODE_TYPES.ObjectPattern){for(let f of b.id.properties)f.type===ne.AST_NODE_TYPES.Property&&f.key.type===ne.AST_NODE_TYPES.Identifier&&x.has(f.key.name)&&x.delete(f.key.name);if(x.size===0)break;continue}if(!(b.type===ne.AST_NODE_TYPES.MemberExpression&&b.object===E&&b.property.type===ne.AST_NODE_TYPES.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 Zr(e){return/^use[A-Z0-9]/.test(e)}function It(e){return e.type==="Identifier"?Zr(e.name):e.type==="MemberExpression"&&!e.computed&&It(e.property)?e.object.type==="Identifier":!1}function Gr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Kr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Qr(e){return!!(e.parent&&e.parent.callee&&Kr(e.parent.callee,"forwardRef"))}function ei(e){return!!(e.parent&&e.parent.callee&&Kr(e.parent.callee,"memo"))}function wn(e){for(;e;){let t=ni(e);if(t&&(Gr(t)||It(t))||Qr(e)||ei(e))return!0;e=e.parent}return!1}function Yr(e){return!1}function Rn(e){return!1}var oa=/eslint +react-compiler\/react-compiler: +\["error/,ti={meta:{type:"problem",docs:{description:"enforces the Rules of Hooks",recommended:!0,url:"https://reactjs.org/docs/hooks-rules.html"},schema:[{type:"object",ignoreIfReactCompilerIsEnabled:!1,properties:{ignoreIfReactCompilerIsEnabled:{type:"boolean"}}}]},create(e){if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let a of e.sourceCode.getAllComments())if(oa.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 t=typeof e.getSource=="function"?a=>t(a):a=>e.sourceCode.getText(a),r=typeof e.getScope=="function"?()=>r():a=>e.sourceCode.getScope(a),n=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&&Yr(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=ni(l),f=wn(l),A=b?Gr(b)||It(b):Qr(l)||ei(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&&!Rn(v)&&e.report({node:v,message:`React Hook "${t(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 "${t(v)}" cannot be called in an async function.`}),!P&&w!==E&&!Rn(v)){let F=`React Hook "${t(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 "${t(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 "${t(v)}" is called in function "${t(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 "${t(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&&!Rn(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"&&Zr(F.parent.id.name))return}let c=`React Hook "${t(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(It(a.callee)){let l=qr(s),u=qr(o),d=l.get(u);d||(d=[],l.set(u,d)),d.push(a.callee)}a.callee.type==="Identifier"&&(a.callee.name==="useEffect"||Yr(a.callee))&&a.arguments.length>0&&(n=a)},Identifier(a){n==null&&i.has(a)&&a.parent.type!=="CallExpression"&&e.report({node:a,message:`\`${t(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===n&&(n=null)},FunctionDeclaration(a){wn(a)&&p(r(a))},ArrowFunctionExpression(a){wn(a)&&p(r(a))}}}};function ni(e){return e.type==="FunctionDeclaration"||e.type==="FunctionExpression"&&e.id?e.id:e.type==="FunctionExpression"||e.type==="ArrowFunctionExpression"?e.parent.type==="VariableDeclarator"&&e.parent.init===e?e.parent.id:e.parent.type==="AssignmentExpression"&&e.parent.right===e&&e.parent.operator==="="?e.parent.left:e.parent.type==="Property"&&e.parent.value===e&&!e.parent.computed?e.parent.key:e.parent.type==="AssignmentPattern"&&e.parent.right===e&&!e.parent.computed?e.parent.left:void 0:void 0}function qr(e){return e[e.length-1]}var de=require("@typescript-eslint/utils"),xe=Oe(require("zod/v4"));var aa=/^\s+$/,Fn=/\r?\n/,la=/^(\s*)/,pa=/^(\s*)\S/,ca=/\r?\n/,ua=xe.object({indent:xe.union([xe.string().regex(aa),xe.number().int().min(1)]).optional(),tags:xe.array(xe.string()).optional(),functions:xe.array(xe.string()).optional(),comments:xe.array(xe.string()).optional()}),kn=q({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[B(ua)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["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(Fn),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(la);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(Fn).map(C=>C.trim()===""?C:I.repeat(A)+C).join(`
|
|
37
|
+
`)}function l(f){if(f.type===de.AST_NODE_TYPES.Identifier)return f.name;if(f.type===de.AST_NODE_TYPES.MemberExpression){let A=f.object.type===de.AST_NODE_TYPES.Identifier?f.object.name:null,I=f.property.type===de.AST_NODE_TYPES.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===de.AST_NODE_TYPES.MemberExpression&&f.object.type===de.AST_NODE_TYPES.Identifier&&f.property.type===de.AST_NODE_TYPES.Identifier&&f.object.name===m[0]&&f.property.name===m[1])return!0}else if(f.type===de.AST_NODE_TYPES.Identifier&&f.name===I)return!0;return!1}function d(f,A){let I=f.parent;if(I.type!==de.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let m=l(I.tag);return m?A.includes(m):!1}function g(f,A){if(!f||f.type!==de.AST_NODE_TYPES.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!==de.AST_NODE_TYPES.MemberExpression||!h&&f.callee.optional||f.callee.property.type!==de.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===I}function x(f,A){if(!f||f.type!==de.AST_NODE_TYPES.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!==de.AST_NODE_TYPES.Identifier?!1:f.callee.name===I}function y(f){return g(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===de.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&x(f.parent.callee.type===de.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(f){if(i.length>0){let A=t.getTokenBefore(f,{includeComments:!0});if(A?.type===de.AST_TOKEN_TYPES.Block&&i.includes(A.value.trim().toLowerCase()))return!0}return!!(y(f)||s.length>0&&d(f,s)||n.length>0&&f.parent.type===de.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&u(f.parent.callee,n))}function b(f){let A=`__PLACEHOLDER__${Math.random()}`,I=f.quasis.map(D=>t.getText(D).slice(1,D.tail?-1:-2)).join(A),m=I.match(ca);if(!m)return;let C=m[0],h=t.lines[t.getLocFromIndex(f.range[0]).line-1];if(!h)return;let P=h.match(pa)?.[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
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,
|
|
40
|
+
`,R=I.split(Fn),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,K)=>{let V=f.quasis[K];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)}}}});var Pn=require("@typescript-eslint/utils");function fa(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function ma(e){let t=e.parent;return t?.type===Pn.AST_NODE_TYPES.NewExpression&&t.callee.type===Pn.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var vn=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 t(r){fa(r)||ma(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var Se=require("@typescript-eslint/utils"),rt=require("zod/v4");var ya=rt.z.object({checkOnly:rt.z.array(rt.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:rt.z.array(rt.z.string()).optional()}),On=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(ya)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=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===Se.AST_NODE_TYPES.FunctionDeclaration||E.type===Se.AST_NODE_TYPES.FunctionExpression||E.type===Se.AST_NODE_TYPES.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===Se.AST_NODE_TYPES.TSTypeParameterInstantiation){let b=E.parent;if(b.type===Se.AST_NODE_TYPES.TSTypeReference&&b.typeName.type===Se.AST_NODE_TYPES.Identifier&&(b.typeName.name==="FC"||b.typeName.name==="React.FC")||b.type===Se.AST_NODE_TYPES.TSTypeReference&&b.typeName.type===Se.AST_NODE_TYPES.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===Se.AST_NODE_TYPES.TSTypeParameterInstantiation){let b=E.parent;if(b.type===Se.AST_NODE_TYPES.CallExpression||b.type===Se.AST_NODE_TYPES.NewExpression)return!0}E=E.parent}return!1}function l(y){let E=y.parent;for(;E;){if(E.type===Se.AST_NODE_TYPES.TSTypeAliasDeclaration||E.type===Se.AST_NODE_TYPES.TSInterfaceDeclaration)return!0;E=E.parent}return!1}function u(y){return y.parent.type===Se.AST_NODE_TYPES.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=n.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=!!(t.checkOnly&&t.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(`
|
|
41
41
|
`)}
|
|
42
|
-
${
|
|
42
|
+
${P}`),C.push(c)}yield E.insertTextBeforeRange([m,m],`${C.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(f){s.push(...f.body)},TSTypeAliasDeclaration(f){if(s.some(h=>h.type===Se.AST_NODE_TYPES.ExportNamedDeclaration&&h.declaration===f?!0:h===f)){let h=a(f);h&&n.set(f.id.name,{node:f,name:f.id.name,statement:h})}},TSInterfaceDeclaration(f){if(s.some(h=>h.type===Se.AST_NODE_TYPES.ExportNamedDeclaration&&h.declaration===f?!0:h===f)){let h=a(f);h&&n.set(f.id.name,{node:f,name:f.id.name,statement:h})}},TSTypeReference(f){if(f.typeName.type===Se.AST_NODE_TYPES.Identifier){if(d(f))return;let E=i(f),h=p(f),m=l(f);y.push({typeName:f.typeName.name,node:f,inFunctionArgs:E,inFCProps:h,inGenericArgAtFunctionCall:m,usagePosition:f.range[0]})}},"Program:exit"(){let f=new Map;function E(m){if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let A of t.checkOnly)if(A==="function-args"&&m.inFunctionArgs||A==="FC"&&m.inFCProps||A==="generic-args-at-fn-calls"&&m.inGenericArgAtFunctionCall)return!0;return!1}for(let m of y){let{typeName:A,node:I}=m;if(!n.has(A)||!E(m))continue;let o=a(I),S=n.get(A);if(!o||!S||o===S.statement)continue;f.has(A)||f.set(A,[]);let u=f.get(A);if(!u)return;u.includes(o)||u.push(o)}let h=[];for(let[m,A]of f)if(A.length>0){if(A.length===0)continue;let I=A[0];if(!I)continue;let o=Number.MAX_SAFE_INTEGER,S=!1;for(let T of A)T.range[0]<I.range[0]&&(I=T);for(let T of y)E(T)&&T.typeName===m&&a(T.node)===I&&T.usagePosition<o&&(o=T.usagePosition,S=T.inFunctionArgs);if(!!(t.checkOnly&&t.checkOnly.length>0)){let T=Number.MAX_SAFE_INTEGER;for(let R of y){if(R.typeName!==m)continue;let v=a(R.node);if(!v)continue;let x=s.indexOf(v);x!==-1&&x<T&&(T=x)}let w=s.indexOf(I);if(T!==Number.MAX_SAFE_INTEGER&&w!==-1&&T<w)continue}else{let T=Number.MAX_SAFE_INTEGER;for(let R of y){if(R.typeName!==m||c(R.node))continue;let v=a(R.node);if(!v)continue;let x=s.indexOf(v);x!==-1&&x<T&&(T=x)}let w=s.indexOf(I);if(T!==Number.MAX_SAFE_INTEGER&&w!==-1&&T<w)continue}h.push({typeName:m,firstUsage:I,firstUsagePosition:o,firstUsageInFunctionArgs:S})}h.length>0&&g(h)}}}});var te=require("@typescript-eslint/utils"),rt=Fe(require("zod/v4"));var da=["tsx"],ya=/^[A-Z][A-Za-z0-9]*$/,ga=rt.object({extensions:rt.array(rt.string()).optional()}),Dn=X({name:"react-single-export",meta:{type:"problem",docs:{description:"Enforces only one export per React component file to support fast refresh"},messages:{multipleExports:"React component files should have only one export to support fast refresh, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[J(ga)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??da,s=!1;for(let o of n)if(r.endsWith(o)){s=!0;break}if(!s)return{};let a=e.sourceCode,i=new Set,p=new Map;function l(o){return ya.test(o)}function c(o){if(o.type!==te.AST_NODE_TYPES.CallExpression)return!1;let S=o.callee;return S.type===te.AST_NODE_TYPES.Identifier?S.name==="memo"||S.name==="forwardRef":S.type===te.AST_NODE_TYPES.MemberExpression&&S.property.type===te.AST_NODE_TYPES.Identifier?S.property.name==="memo"||S.property.name==="forwardRef":!1}function d(o){if(o.type===te.AST_NODE_TYPES.JSXElement||o.type===te.AST_NODE_TYPES.JSXFragment)return!0;if(o.type===te.AST_NODE_TYPES.ArrayExpression){for(let S of o.elements)if(S&&(S.type===te.AST_NODE_TYPES.JSXElement||S.type===te.AST_NODE_TYPES.JSXFragment))return!0}return!1}function y(o){if(o.type!==te.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let S=o.body;if(S.type===te.AST_NODE_TYPES.ArrowFunctionExpression){let u=S.body;if(d(u))return!0}return!1}function g(o){if(o.id.type!==te.AST_NODE_TYPES.Identifier)return;let S=o.id.name,u=o.init;if(u){if(l(S)&&(u.type===te.AST_NODE_TYPES.ArrowFunctionExpression||u.type===te.AST_NODE_TYPES.FunctionExpression||c(u))){i.add(S);return}u.type===te.AST_NODE_TYPES.Identifier&&p.set(S,u.name),l(S)||y(u)&&i.add(S)}}function b(o){if(o.type===te.AST_NODE_TYPES.VariableDeclaration){for(let S of o.declarations)g(S);return}if(o.type===te.AST_NODE_TYPES.FunctionDeclaration&&o.id){l(o.id.name)&&i.add(o.id.name);return}if(o.type===te.AST_NODE_TYPES.ExportNamedDeclaration&&o.declaration){let S=o.declaration;if(S.type===te.AST_NODE_TYPES.VariableDeclaration){for(let u of S.declarations)g(u);return}if(S.type===te.AST_NODE_TYPES.FunctionDeclaration&&S.id){l(S.id.name)&&i.add(S.id.name);return}}}for(let o of a.ast.body)b(o);function f(o,S=new Set){if(i.has(o))return!0;if(S.has(o))return!1;S.add(o);let u=p.get(o);return u?f(u,S):!1}let E=[];function h(o,S,u){E.push({node:o,isType:S,isComponent:u})}for(let o of a.ast.body){if(o.type===te.AST_NODE_TYPES.ExportNamedDeclaration){let S=o.exportKind==="type";if(o.declaration){let u=o.declaration;if(u.type===te.AST_NODE_TYPES.TSTypeAliasDeclaration||u.type===te.AST_NODE_TYPES.TSInterfaceDeclaration){h(u,!0,!1);continue}if(u.type===te.AST_NODE_TYPES.VariableDeclaration){for(let T of u.declarations){if(T.id.type!==te.AST_NODE_TYPES.Identifier)continue;let w=T.id.name,R=f(w);h(T,S,R)}continue}if(u.type===te.AST_NODE_TYPES.FunctionDeclaration){let T=u.id?.name,w=T?f(T)||l(T):!1;h(u,S,w);continue}h(u,S,!1);continue}if(o.specifiers.length>0)for(let u of o.specifiers){if(u.local.type!==te.AST_NODE_TYPES.Identifier)continue;let T=u.local.name,w=f(T);h(u,S,w)}continue}if(o.type===te.AST_NODE_TYPES.ExportDefaultDeclaration){let S=o.declaration;if(S.type===te.AST_NODE_TYPES.Identifier){let u=f(S.name)||l(S.name);h(o,!1,u);continue}if(S.type===te.AST_NODE_TYPES.FunctionDeclaration||S.type===te.AST_NODE_TYPES.ArrowFunctionExpression||S.type===te.AST_NODE_TYPES.FunctionExpression||S.type===te.AST_NODE_TYPES.CallExpression){h(o,!1,!0);continue}h(o,!1,!1);continue}}let m=!1;for(let o of E)if(!o.isType&&o.isComponent){m=!0;break}if(!m)return{};let A=[];for(let o of E)o.isType||A.push(o);let I=-1;for(let[o,S]of A.entries())if(S.isComponent){I=o;break}if(I===-1)return{};for(let[o,S]of A.entries())if(o!==I){e.report({node:S.node,messageId:"multipleExports"});break}return{}}});var ze=require("@typescript-eslint/utils"),At=require("zod/v4");function wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Sa(e){return e.callee.type===ze.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===ze.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===ze.AST_NODE_TYPES.Identifier&&e.callee.property.type===ze.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var Ta=At.z.object({ignorePrefixes:At.z.array(At.z.string()).optional()});function ti(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function ha(e){return`set${wt(e)}`}var jn=X({name:"use-state-setter-naming",meta:{type:"problem",docs:{description:"Enforce consistent naming convention for useState destructuring where setter should be set{Value}"},messages:{incorrectSetterName:'useState setter should follow the pattern "set{{expectedName}}" with a "set" prefix but got "{{actualName}}"',useSuggestedName:'Use "{{expectedSetterName}}" instead'},hasSuggestions:!0,schema:[J(Ta)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==ze.AST_NODE_TYPES.CallExpression||!Sa(r.init)||r.id.type!==ze.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==ze.AST_NODE_TYPES.Identifier||s.type!==ze.AST_NODE_TYPES.Identifier)return;let a=n.name,i=s.name,p=t.ignorePrefixes||[],l=ti(a,p),c=ti(i,p);if(l===""){if(!c.startsWith("set")){let y=`set${wt(a)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:wt(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:y},fix:g=>g.replaceText(s,y)}]})}return}let d=ha(l);c!==d&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:wt(l),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:y=>y.replaceText(s,d)}]})}}}});var de=require("@typescript-eslint/utils"),Ze=require("zod/v4");var Ea=Ze.z.object({name:Ze.z.string(),defaults:Ze.z.array(Ze.z.unknown())}),ba=Ze.z.object({functions:Ze.z.array(Ea)});function Rt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,a)=>Rt(s,t[a]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let a=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!a||!i)return!1;let p=a.value,l=i.value;if(!Rt(p,l))return!1}return!0}function xa(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);s&&a&&Rt(s.value,a.value)&&r.add(n)}return r}function ni(e){if(e.type===de.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case de.AST_NODE_TYPES.Literal:return e.value;case de.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===de.AST_NODE_TYPES.Property&&r.key.type===de.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===de.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===de.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=ni(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case de.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===de.AST_NODE_TYPES.SpreadElement))return t.type===de.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Ca(e){return e.type===de.AST_NODE_TYPES.Identifier?e.name:e.type===de.AST_NODE_TYPES.MemberExpression&&e.property.type===de.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var Ln=X({name:"no-redundant-function-params",meta:{type:"suggestion",docs:{description:"Disallow calling functions with redundant default parameters"},messages:{redundantParams:"Function call has redundant parameters matching its default values and can be removed: {{details}}"},fixable:"code",schema:[J(ba)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=Ca(n.callee);if(!s)return;let a=r.get(s);if(!a)return;let i=n.arguments;if(i.length===0)return;let p=-1,l=!1,c=new Map,d=new Set,y=new Map,g=[];for(let f=0;f<i.length;f++){if(f>=a.length){p=f;continue}let E=a[f],h=i[f];if(!h||h.type===de.AST_NODE_TYPES.SpreadElement){p=f;continue}let m=ni(h);if(E===void 0){p=f;continue}if(Rt(m,E)){h.type===de.AST_NODE_TYPES.ObjectExpression?(d.add(f),g.push({type:"object",position:f+1})):(y.set(f,m),g.push({type:"simple",position:f+1,value:m}));continue}if(h.type===de.AST_NODE_TYPES.ObjectExpression&&h.properties.length===0&&typeof E=="object"&&E!==null&&Object.keys(E).length>0){d.add(f),g.push({type:"object",position:f+1});continue}let A=xa(m,E);if(A.size>0){let I=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(h.type===de.AST_NODE_TYPES.ObjectExpression&&h.properties.length===A.size&&h.properties.length===I){d.add(f),g.push({type:"object",position:f+1});continue}else l=!0,c.set(f,A),g.push({type:"partialObject",position:f+1,redundantProperties:Array.from(A)}),p=f}else p=f}if(p<i.length-1||l||d.size>0){let f=function(){let h=[];for(let m of g)if(m.type==="simple")h.push(`Param ${m.position} with value ${JSON.stringify(m.value)}`);else if(m.type==="object")h.push(`Param ${m.position} (object)`);else{let A=m.redundantProperties||[],I=a?a[m.position-1]:void 0;if(typeof I=="object"&&I!==null){let o=I;for(let S of A)if(S in o){let u=Object.getOwnPropertyDescriptor(o,S);u&&h.push(`Param ${m.position} property "${S}" with value ${JSON.stringify(u.value)}`)}}}return{messageId:"redundantParams",data:{details:h.join(", ")}}};var b=f;let E=f();e.report({node:n,messageId:E.messageId,data:E.data,fix(h){let m=[];if(l)for(let[I,o]of c){let S=i[I];if(S&&S.type===de.AST_NODE_TYPES.ObjectExpression){let u=[];for(let w of S.properties)w.type===de.AST_NODE_TYPES.Property&&w.key.type===de.AST_NODE_TYPES.Identifier&&!w.computed&&o.has(w.key.name)||u.push(w);let T=u.map(w=>e.sourceCode.getText(w));m.push(h.replaceText(S,`{ ${T.join(", ")} }`))}}let A=-1;for(let I=i.length-1;I>=0;I--)if(!d.has(I)&&I<=p){A=I;break}if(A<i.length-1)if(A===-1){let I=e.sourceCode.getTokenAfter(n.callee),o=e.sourceCode.getLastToken(n);I&&o&&m.push(h.replaceTextRange([I.range[1],o.range[0]],""))}else{let I=i[A],o=e.sourceCode.getLastToken(n);o&&I&&m.push(h.replaceTextRange([I.range[1],o.range[0]],""))}return m.length>0?m:null}})}}}}});var Ae=require("@typescript-eslint/utils");function Ia(e){let t=e.parent;for(;t;){if(t.type===Ae.AST_NODE_TYPES.AwaitExpression||t.type===Ae.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===Ae.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===Ae.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===Ae.AST_NODE_TYPES.ArrayExpression&&t.parent.type===Ae.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===Ae.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===Ae.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===Ae.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function Aa(e){let{callee:t}=e;return t.type===Ae.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===Ae.AST_NODE_TYPES.MemberExpression&&t.object.type===Ae.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Mn=X({name:"no-sync-dynamic-import",meta:{type:"problem",docs:{description:"Disallow synchronous dynamic imports and require statements, only allow async dynamic imports with await"},messages:{syncDynamicImport:"Synchronous dynamic import() is not allowed. Use regular import statement or await import() for dynamic imports.",requireNotAllowed:"require() statements are not allowed. Use ES6 import statements instead."},schema:[]},defaultOptions:[],create(e){return{ImportExpression(t){Ia(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){Aa(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var N=require("@typescript-eslint/utils"),Pt=require("zod/v4");var wa=Pt.z.object({mainComponentRegex:Pt.z.string().optional(),mainComponentSelector:Pt.z.string().optional()}),Ra=/^[A-Z][A-Za-z0-9]*$/,$n=X({name:"sort-react-components-and-styles",meta:{type:"suggestion",docs:{description:"Sort React components and styles with styles placed above their first usage"},fixable:"code",schema:[J(wa)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,s=t.mainComponentSelector,a=new Set,i=new Map,p=[],l=[],c=new Set;function d(x){let C=x.node;if(C.type===N.AST_NODE_TYPES.VariableDeclaration){for(let F of C.declarations)if(F.id.type===N.AST_NODE_TYPES.Identifier&&F.id.name===x.name&&F.init)return F.init}if(C.type===N.AST_NODE_TYPES.ExportNamedDeclaration){let F=C.declaration;if(F&&F.type===N.AST_NODE_TYPES.VariableDeclaration){for(let O of F.declarations)if(O.id.type===N.AST_NODE_TYPES.Identifier&&O.id.name===x.name&&O.init)return O.init}}return null}function y(x){let C=new Set;return ke(x,F=>(F.type===N.AST_NODE_TYPES.Identifier&&F.name!=="styled"&&F.name!=="css"&&C.add(F.name),!1),r),C}function g(x){return Ra.test(x)}function b(x){if(x.type!==N.AST_NODE_TYPES.CallExpression)return!1;let C=x.callee;return C.type===N.AST_NODE_TYPES.Identifier?C.name==="memo"||C.name==="forwardRef":C.type===N.AST_NODE_TYPES.MemberExpression&&C.property.type===N.AST_NODE_TYPES.Identifier?C.property.name==="memo"||C.property.name==="forwardRef":!1}function f(x){if(x.type===N.AST_NODE_TYPES.JSXElement||x.type===N.AST_NODE_TYPES.JSXFragment)return!0;if(x.type===N.AST_NODE_TYPES.BlockStatement){for(let C of x.body)if(C.type===N.AST_NODE_TYPES.ReturnStatement&&C.argument)return f(C.argument)}if(x.type===N.AST_NODE_TYPES.ArrayExpression){for(let C of x.elements)if(C&&(C.type===N.AST_NODE_TYPES.JSXElement||C.type===N.AST_NODE_TYPES.JSXFragment))return!0}return!1}function E(x){if(x.type!==N.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let C=x.body;if(C.type===N.AST_NODE_TYPES.ArrowFunctionExpression){let F=C.body;if(f(F))return!0}return!1}function h(x){if(x.type===N.AST_NODE_TYPES.TaggedTemplateExpression){let C=x.tag;if(C.type===N.AST_NODE_TYPES.MemberExpression&&C.object.type===N.AST_NODE_TYPES.Identifier&&C.object.name==="styled")return!0;if(C.type===N.AST_NODE_TYPES.CallExpression){let F=C.callee;if(F.type===N.AST_NODE_TYPES.Identifier&&F.name==="styled")return!0}}return!1}function m(x){if(x.type===N.AST_NODE_TYPES.TaggedTemplateExpression){let C=x.tag;if(C.type===N.AST_NODE_TYPES.Identifier&&C.name==="css")return!0}return!1}function A(x,C){if(x.id.type!==N.AST_NODE_TYPES.Identifier)return;let F=x.id.name,O=x.init;if(O){if(h(O)||m(O)){l.push({node:C,name:F});return}if((g(F)||O.type===N.AST_NODE_TYPES.ArrowFunctionExpression)&&(O.type===N.AST_NODE_TYPES.ArrowFunctionExpression||O.type===N.AST_NODE_TYPES.FunctionExpression||b(O))){if(O.type===N.AST_NODE_TYPES.ArrowFunctionExpression||O.type===N.AST_NODE_TYPES.FunctionExpression){if(f(O.body)){a.add(F);return}}else if(b(O)){a.add(F);return}}O.type===N.AST_NODE_TYPES.Identifier&&i.set(F,O.name),g(F)||E(O)&&a.add(F)}}function I(x){return x.type===N.AST_NODE_TYPES.ExportDefaultDeclaration||x.type===N.AST_NODE_TYPES.ExportNamedDeclaration}function o(x){if(x.type===N.AST_NODE_TYPES.FunctionDeclaration)return x.id?x.id.name:null;if(x.type===N.AST_NODE_TYPES.VariableDeclaration){let C=x.declarations[0];if(C&&C.id.type===N.AST_NODE_TYPES.Identifier)return C.id.name}if(x.type===N.AST_NODE_TYPES.ExportDefaultDeclaration){let C=x.declaration;if(C.type===N.AST_NODE_TYPES.FunctionDeclaration)return C.id?C.id.name:"default";if(C.type===N.AST_NODE_TYPES.Identifier)return C.name}if(x.type===N.AST_NODE_TYPES.ExportNamedDeclaration){let C=x.declaration;if(C&&C.type===N.AST_NODE_TYPES.FunctionDeclaration)return C.id?C.id.name:null;if(C&&C.type===N.AST_NODE_TYPES.VariableDeclaration){let F=C.declarations[0];if(F&&F.id.type===N.AST_NODE_TYPES.Identifier)return F.id.name}}return null}function S(x,C){return s?c.has(x):n?n.test(C):I(x)}function u(x){let C=new Set;ke(x.node,F=>{if(F.type===N.AST_NODE_TYPES.Identifier)for(let O of l)O.name===F.name&&(C.add(O.name),(O.firstUsagePosition===void 0||F.range[0]<O.firstUsagePosition)&&(O.firstUsagePosition=F.range[0]));if(F.type===N.AST_NODE_TYPES.JSXElement){let O=F.openingElement;if(O.name.type===N.AST_NODE_TYPES.JSXIdentifier)for(let Q of l)Q.name===O.name.name&&(C.add(Q.name),(Q.firstUsagePosition===void 0||O.name.range[0]<Q.firstUsagePosition)&&(Q.firstUsagePosition=O.name.range[0]))}return!1},r),x.usedStyles=C}function T(x){if(x.type===N.AST_NODE_TYPES.VariableDeclaration){for(let C of x.declarations)A(C,x);return}if(x.type===N.AST_NODE_TYPES.FunctionDeclaration){g(x.id.name)&&f(x.body)&&a.add(x.id.name);return}if(x.type===N.AST_NODE_TYPES.ExportNamedDeclaration&&x.declaration){let C=x.declaration;if(C.type===N.AST_NODE_TYPES.VariableDeclaration){for(let F of C.declarations)A(F,x);return}if(C.type===N.AST_NODE_TYPES.FunctionDeclaration&&C.id){g(C.id.name)&&f(C.body)&&a.add(C.id.name);return}}if(x.type===N.AST_NODE_TYPES.ExportDefaultDeclaration){let C=x.declaration;C.type===N.AST_NODE_TYPES.Identifier&&a.add(C.name),(C.type===N.AST_NODE_TYPES.FunctionDeclaration||C.type===N.AST_NODE_TYPES.ArrowFunctionExpression||C.type===N.AST_NODE_TYPES.FunctionExpression)&&(C.type===N.AST_NODE_TYPES.FunctionDeclaration?C.id?a.add(C.id.name):a.add("default"):f(C.body)&&a.add("default"))}}function w(x,C=new Set){if(a.has(x))return!0;if(C.has(x))return!1;C.add(x);let F=i.get(x);return F?w(F,C):!1}let R={};return s&&(R[s]=x=>{let C=x;for(;C.parent&&C.parent.type!==N.AST_NODE_TYPES.Program;)C=C.parent;C.parent&&(C.type===N.AST_NODE_TYPES.VariableDeclaration||C.type===N.AST_NODE_TYPES.FunctionDeclaration||C.type===N.AST_NODE_TYPES.ExportNamedDeclaration||C.type===N.AST_NODE_TYPES.ExportDefaultDeclaration)&&c.add(C)}),R["Program:exit"]=x=>{let C=0;for(let D of x.body){if(D.type===N.AST_NODE_TYPES.ImportDeclaration){C+=1;continue}break}for(let D of x.body)T(D);for(let D of x.body){let q=o(D);if(q&&w(q)){let V=S(D,q);p.push({node:D,name:q,isMainComponent:V,usedStyles:new Set})}}for(let D of p)u(D);let F=new Set;for(let D of l)F.add(D.name);let O=new Map;for(let D=0;D<x.body.length;D+=1){let q=x.body[D];for(let V of l)V.node===q&&O.set(V.name,D)}let Q=new Map;for(let D of l){let q=d(D),V=new Set;if(q){let ce=y(q);for(let ue of ce)F.has(ue)&&ue!==D.name&&V.add(ue)}Q.set(D.name,V)}let z=new Map;for(let D of l){let q=Q.get(D.name);if(!q)continue;let V=O.get(D.name);if(V!==void 0)for(let ce of q){let ue=z.get(ce);(ue===void 0||V<ue)&&z.set(ce,V)}}let re=[];for(let D of l){if(D.firstUsagePosition===void 0)continue;let q=x.body.indexOf(D.node),V=-1;for(let he of p){if(!he.usedStyles.has(D.name))continue;let xe=x.body.indexOf(he.node);(V===-1||xe<V)&&(V=xe)}let ce=z.get(D.name);if(ce!==void 0&&(V===-1||ce<V)&&(V=ce),V===-1)continue;let ue=-1;for(let he of p){let xe=x.body.indexOf(he.node);xe<V&&xe>ue&&(ue=xe)}let we=q<V,We=q>ue,ge=-1,it=Q.get(D.name);if(it)for(let he of it){let xe=O.get(he);xe!==void 0&&xe>ge&&(ge=xe)}let Ge=q>ge;if(!(we&&We&&Ge)){let he=ue+1;if(ge+1>he&&(he=ge+1),he<C&&(he=C),he>V)continue;re.push({style:D,targetPosition:he})}}let ae=null;if(p.length>1){let D=p.map(V=>({c:V,idx:x.body.indexOf(V.node)})).sort((V,ce)=>V.idx-ce.idx)[0]?.c,q=p.find(V=>V.isMainComponent)||null;D&&q&&D.node!==q.node&&(ae={component:q,targetBefore:D.node})}if(re.length>0||ae){let D=re[0]?.style.node||ae?.component.node||x,q=re.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:D,messageId:q,fix:v(re,ae,x.body)})}},R;function v(x,C,F){return function*(O){x.sort((z,re)=>z.targetPosition-re.targetPosition);for(let{style:z}of x){let re=r.getCommentsBefore(z.node),ae=z.node.range[0],D=z.node.range[1];re.length>0&&re[0]&&(ae=re[0].range[0]),ae===z.node.range[0]&&r.text.slice(0,ae).trim().length===0&&(ae=0),yield O.removeRange([ae,D])}let Q=new Map;for(let z of x){let re=Q.get(z.targetPosition)||[];re.push(z),Q.set(z.targetPosition,re)}for(let[z,re]of Q){let ae=F[z];if(!ae)continue;let D=r.getCommentsBefore(ae),q=D.length>0&&D[0]?D[0].range[0]:ae.range[0],V=[];for(let{style:ce}of re){let ue=r.getCommentsBefore(ce.node),we=r.getText(ce.node);ue.length>0&&(we=`${ue.map(ge=>r.getText(ge)).join(`
|
|
46
|
+
`)}}}return{Program(y){s.push(...y.body)},TSTypeAliasDeclaration(y){if(s.some(b=>b.type===Se.AST_NODE_TYPES.ExportNamedDeclaration&&b.declaration===y?!0:b===y)){let b=o(y);b&&n.set(y.id.name,{node:y,name:y.id.name,statement:b})}},TSInterfaceDeclaration(y){if(s.some(b=>b.type===Se.AST_NODE_TYPES.ExportNamedDeclaration&&b.declaration===y?!0:b===y)){let b=o(y);b&&n.set(y.id.name,{node:y,name:y.id.name,statement:b})}},TSTypeReference(y){if(y.typeName.type===Se.AST_NODE_TYPES.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(!t.checkOnly||t.checkOnly.length===0)return!0;for(let A of t.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(!n.has(A)||!E(f))continue;let m=o(I),C=n.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(!!(t.checkOnly&&t.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)}}}});var ie=require("@typescript-eslint/utils"),it=Oe(require("zod/v4"));var da=["tsx"],ga=/^[A-Z][A-Za-z0-9]*$/,Sa=it.object({extensions:it.array(it.string()).optional()}),Nn=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(Sa)]},defaultOptions:[{}],create(e,[t]){let r=e.getFilename(),n=t.extensions??da,s=!1;for(let m of n)if(r.endsWith(m)){s=!0;break}if(!s)return{};let o=e.sourceCode,i=new Set,p=new Map;function a(m){return ga.test(m)}function l(m){if(m.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let C=m.callee;return C.type===ie.AST_NODE_TYPES.Identifier?C.name==="memo"||C.name==="forwardRef":C.type===ie.AST_NODE_TYPES.MemberExpression&&C.property.type===ie.AST_NODE_TYPES.Identifier?C.property.name==="memo"||C.property.name==="forwardRef":!1}function u(m){if(m.type===ie.AST_NODE_TYPES.JSXElement||m.type===ie.AST_NODE_TYPES.JSXFragment)return!0;if(m.type===ie.AST_NODE_TYPES.ArrayExpression){for(let C of m.elements)if(C&&(C.type===ie.AST_NODE_TYPES.JSXElement||C.type===ie.AST_NODE_TYPES.JSXFragment))return!0}return!1}function d(m){if(m.type!==ie.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let C=m.body;if(C.type===ie.AST_NODE_TYPES.ArrowFunctionExpression){let h=C.body;if(u(h))return!0}return!1}function g(m){if(m.id.type!==ie.AST_NODE_TYPES.Identifier)return;let C=m.id.name,h=m.init;if(h){if(a(C)&&(h.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||h.type===ie.AST_NODE_TYPES.FunctionExpression||l(h))){i.add(C);return}h.type===ie.AST_NODE_TYPES.Identifier&&p.set(C,h.name),a(C)||d(h)&&i.add(C)}}function x(m){if(m.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let C of m.declarations)g(C);return}if(m.type===ie.AST_NODE_TYPES.FunctionDeclaration&&m.id){a(m.id.name)&&i.add(m.id.name);return}if(m.type===ie.AST_NODE_TYPES.ExportNamedDeclaration&&m.declaration){let C=m.declaration;if(C.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let h of C.declarations)g(h);return}if(C.type===ie.AST_NODE_TYPES.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===ie.AST_NODE_TYPES.ExportNamedDeclaration){let C=m.exportKind==="type";if(m.declaration){let h=m.declaration;if(h.type===ie.AST_NODE_TYPES.TSTypeAliasDeclaration||h.type===ie.AST_NODE_TYPES.TSInterfaceDeclaration){b(h,!0,!1);continue}if(h.type===ie.AST_NODE_TYPES.VariableDeclaration){for(let w of h.declarations){if(w.id.type!==ie.AST_NODE_TYPES.Identifier)continue;let P=w.id.name,v=y(P);b(w,C,v)}continue}if(h.type===ie.AST_NODE_TYPES.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!==ie.AST_NODE_TYPES.Identifier)continue;let w=h.local.name,P=y(w);b(h,C,P)}continue}if(m.type===ie.AST_NODE_TYPES.ExportDefaultDeclaration){let C=m.declaration;if(C.type===ie.AST_NODE_TYPES.Identifier){let h=y(C.name)||a(C.name);b(m,!1,h);continue}if(C.type===ie.AST_NODE_TYPES.FunctionDeclaration||C.type===ie.AST_NODE_TYPES.ArrowFunctionExpression||C.type===ie.AST_NODE_TYPES.FunctionExpression||C.type===ie.AST_NODE_TYPES.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{}}});var Je=require("@typescript-eslint/utils"),At=require("zod/v4");function wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ta(e){return e.callee.type===Je.AST_NODE_TYPES.Identifier?e.callee.name==="useState":e.callee.type===Je.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===Je.AST_NODE_TYPES.Identifier&&e.callee.property.type===Je.AST_NODE_TYPES.Identifier?e.callee.object.name==="React"&&e.callee.property.name==="useState":!1}var ha=At.z.object({ignorePrefixes:At.z.array(At.z.string()).optional()});function ri(e,t){for(let r of t)if(e.startsWith(r))return e.slice(r.length);return e}function Ea(e){return`set${wt(e)}`}var Dn=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(ha)]},defaultOptions:[{ignorePrefixes:[]}],create(e,[t]){return{VariableDeclarator(r){if(!r.init||r.init.type!==Je.AST_NODE_TYPES.CallExpression||!Ta(r.init)||r.id.type!==Je.AST_NODE_TYPES.ArrayPattern||r.id.elements.length!==2)return;let[n,s]=r.id.elements;if(!n||!s||n.type!==Je.AST_NODE_TYPES.Identifier||s.type!==Je.AST_NODE_TYPES.Identifier)return;let o=n.name,i=s.name,p=t.ignorePrefixes||[],a=ri(o,p),l=ri(i,p);if(a===""){if(!l.startsWith("set")){let d=`set${wt(o)}`;e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:wt(o),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:d},fix:g=>g.replaceText(s,d)}]})}return}let u=Ea(a);l!==u&&e.report({node:s,messageId:"incorrectSetterName",data:{expectedName:wt(a),actualName:i},suggest:[{messageId:"useSuggestedName",data:{expectedSetterName:u},fix:d=>d.replaceText(s,u)}]})}}}});var ye=require("@typescript-eslint/utils"),Ke=require("zod/v4");var ba=Ke.z.object({name:Ke.z.string(),defaults:Ke.z.array(Ke.z.unknown())}),xa=Ke.z.object({functions:Ke.z.array(ba)});function Rt(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0)return e===t;if(typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>Rt(s,t[o]));let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let s of r){if(!n.includes(s))return!1;let o=Object.getOwnPropertyDescriptor(e,s),i=Object.getOwnPropertyDescriptor(t,s);if(!o||!i)return!1;let p=o.value,a=i.value;if(!Rt(p,a))return!1}return!0}function Ca(e,t){let r=new Set;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return r;for(let n in e){if(!(n in t))continue;let s=Object.getOwnPropertyDescriptor(e,n),o=Object.getOwnPropertyDescriptor(t,n);s&&o&&Rt(s.value,o.value)&&r.add(n)}return r}function ii(e){if(e.type===ye.AST_NODE_TYPES.SpreadElement)return Symbol("COMPLEX_EXPRESSION");switch(e.type){case ye.AST_NODE_TYPES.Literal:return e.value;case ye.AST_NODE_TYPES.ObjectExpression:{let t={};for(let r of e.properties)r.type===ye.AST_NODE_TYPES.Property&&r.key.type===ye.AST_NODE_TYPES.Identifier&&!r.computed&&(r.value.type===ye.AST_NODE_TYPES.Literal?t[r.key.name]=r.value.value:r.value.type===ye.AST_NODE_TYPES.ObjectExpression?t[r.key.name]=ii(r.value):t[r.key.name]=Symbol("COMPLEX_EXPRESSION"));return t}case ye.AST_NODE_TYPES.ArrayExpression:return e.elements.map(t=>{if(!(!t||t.type===ye.AST_NODE_TYPES.SpreadElement))return t.type===ye.AST_NODE_TYPES.Literal?t.value:Symbol("COMPLEX_EXPRESSION")});default:return Symbol("COMPLEX_EXPRESSION")}}function Ia(e){return e.type===ye.AST_NODE_TYPES.Identifier?e.name:e.type===ye.AST_NODE_TYPES.MemberExpression&&e.property.type===ye.AST_NODE_TYPES.Identifier&&!e.computed?e.property.name:null}var jn=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(xa)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map;for(let n of t.functions)r.set(n.name,n.defaults);return{CallExpression(n){let s=Ia(n.callee);if(!s)return;let o=r.get(s);if(!o)return;let i=n.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.AST_NODE_TYPES.SpreadElement){p=y;continue}let f=ii(b);if(E===void 0){p=y;continue}if(Rt(f,E)){b.type===ye.AST_NODE_TYPES.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.AST_NODE_TYPES.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=Ca(f,E);if(A.size>0){let I=typeof E=="object"&&E!==null?Object.keys(E).length:0;if(b.type===ye.AST_NODE_TYPES.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:n,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.AST_NODE_TYPES.ObjectExpression){let h=[];for(let P of C.properties)P.type===ye.AST_NODE_TYPES.Property&&P.key.type===ye.AST_NODE_TYPES.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(n.callee),m=e.sourceCode.getLastToken(n);I&&m&&f.push(b.replaceTextRange([I.range[1],m.range[0]],""))}else{let I=i[A],m=e.sourceCode.getLastToken(n);m&&I&&f.push(b.replaceTextRange([I.range[1],m.range[0]],""))}return f.length>0?f:null}})}}}}});var we=require("@typescript-eslint/utils");function Aa(e){let t=e.parent;for(;t;){if(t.type===we.AST_NODE_TYPES.AwaitExpression||t.type===we.AST_NODE_TYPES.MemberExpression&&t.object===e&&t.property.type===we.AST_NODE_TYPES.Identifier&&t.property.name==="then"||t.type===we.AST_NODE_TYPES.ArrowFunctionExpression&&t.body===e)return!0;if(t.type===we.AST_NODE_TYPES.ArrayExpression&&t.parent.type===we.AST_NODE_TYPES.CallExpression){let r=t.parent;if(r.callee.type===we.AST_NODE_TYPES.MemberExpression&&r.callee.object.type===we.AST_NODE_TYPES.Identifier&&r.callee.object.name==="Promise"&&r.callee.property.type===we.AST_NODE_TYPES.Identifier&&["all","allSettled","race"].includes(r.callee.property.name))return!0}if(t.parent)t=t.parent;else break}return!1}function wa(e){let{callee:t}=e;return t.type===we.AST_NODE_TYPES.Identifier&&t.name==="require"||t.type===we.AST_NODE_TYPES.MemberExpression&&t.object.type===we.AST_NODE_TYPES.Identifier&&t.object.name==="require"}var Ln=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(t){Aa(t)||e.report({node:t,messageId:"syncDynamicImport"})},TSImportType(t){e.report({node:t,messageId:"syncDynamicImport"})},CallExpression(t){wa(t)&&e.report({node:t,messageId:"requireNotAllowed"})}}}});var L=require("@typescript-eslint/utils"),Ft=require("zod/v4");var Ra=Ft.z.object({mainComponentRegex:Ft.z.string().optional(),mainComponentSelector:Ft.z.string().optional()}),Fa=/^[A-Z][A-Za-z0-9]*$/,Mn=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(Ra)],messages:{stylesShouldBeAboveUsage:"Style definitions should be placed above the first component that uses them",mainComponentShouldBeFirst:"Main component should be placed before other components"}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.mainComponentRegex?new RegExp(t.mainComponentRegex):void 0,s=t.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.AST_NODE_TYPES.VariableDeclaration){for(let R of S.declarations)if(R.id.type===L.AST_NODE_TYPES.Identifier&&R.id.name===T.name&&R.init)return R.init}if(S.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let R=S.declaration;if(R&&R.type===L.AST_NODE_TYPES.VariableDeclaration){for(let O of R.declarations)if(O.id.type===L.AST_NODE_TYPES.Identifier&&O.id.name===T.name&&O.init)return O.init}}return null}function g(T){let S=new Set;return Ne(T,R=>(R.type===L.AST_NODE_TYPES.Identifier&&R.name!=="styled"&&R.name!=="css"&&S.add(R.name),!1),r),S}function x(T){return Fa.test(T)}function y(T){if(T.type!==L.AST_NODE_TYPES.CallExpression)return!1;let S=T.callee;return S.type===L.AST_NODE_TYPES.Identifier?S.name==="memo"||S.name==="forwardRef":S.type===L.AST_NODE_TYPES.MemberExpression&&S.property.type===L.AST_NODE_TYPES.Identifier?S.property.name==="memo"||S.property.name==="forwardRef":!1}function E(T){if(T.type===L.AST_NODE_TYPES.JSXElement||T.type===L.AST_NODE_TYPES.JSXFragment)return!0;if(T.type===L.AST_NODE_TYPES.BlockStatement){for(let S of T.body)if(S.type===L.AST_NODE_TYPES.ReturnStatement&&S.argument)return E(S.argument)}if(T.type===L.AST_NODE_TYPES.ArrayExpression){for(let S of T.elements)if(S&&(S.type===L.AST_NODE_TYPES.JSXElement||S.type===L.AST_NODE_TYPES.JSXFragment))return!0}return!1}function b(T){if(T.type!==L.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let S=T.body;if(S.type===L.AST_NODE_TYPES.ArrowFunctionExpression){let R=S.body;if(E(R))return!0}return!1}function f(T){if(T.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let S=T.tag;if(S.type===L.AST_NODE_TYPES.MemberExpression&&S.object.type===L.AST_NODE_TYPES.Identifier&&S.object.name==="styled")return!0;if(S.type===L.AST_NODE_TYPES.CallExpression){let R=S.callee;if(R.type===L.AST_NODE_TYPES.Identifier&&R.name==="styled")return!0}}return!1}function A(T){if(T.type===L.AST_NODE_TYPES.TaggedTemplateExpression){let S=T.tag;if(S.type===L.AST_NODE_TYPES.Identifier&&S.name==="css")return!0}return!1}function I(T,S){if(T.id.type!==L.AST_NODE_TYPES.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.AST_NODE_TYPES.ArrowFunctionExpression)&&(O.type===L.AST_NODE_TYPES.ArrowFunctionExpression||O.type===L.AST_NODE_TYPES.FunctionExpression||y(O))){if(O.type===L.AST_NODE_TYPES.ArrowFunctionExpression||O.type===L.AST_NODE_TYPES.FunctionExpression){if(E(O.body)){i.add(R);return}}else if(y(O)){i.add(R);return}}O.type===L.AST_NODE_TYPES.Identifier&&p.set(R,O.name),x(R)||b(O)&&i.add(R)}}function m(T){return T.type===L.AST_NODE_TYPES.ExportDefaultDeclaration||T.type===L.AST_NODE_TYPES.ExportNamedDeclaration}function C(T){if(T.type===L.AST_NODE_TYPES.FunctionDeclaration)return T.id?T.id.name:null;if(T.type===L.AST_NODE_TYPES.VariableDeclaration){let S=T.declarations[0];if(S&&S.id.type===L.AST_NODE_TYPES.Identifier)return S.id.name}if(T.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let S=T.declaration;if(S.type===L.AST_NODE_TYPES.FunctionDeclaration)return S.id?S.id.name:"default";if(S.type===L.AST_NODE_TYPES.Identifier)return S.name}if(T.type===L.AST_NODE_TYPES.ExportNamedDeclaration){let S=T.declaration;if(S&&S.type===L.AST_NODE_TYPES.FunctionDeclaration)return S.id?S.id.name:null;if(S&&S.type===L.AST_NODE_TYPES.VariableDeclaration){let R=S.declarations[0];if(R&&R.id.type===L.AST_NODE_TYPES.Identifier)return R.id.name}}return null}function h(T,S){return s?u.has(T):n?n.test(S):m(T)}function w(T){let S=new Set;Ne(T.node,R=>{if(R.type===L.AST_NODE_TYPES.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.AST_NODE_TYPES.JSXElement){let O=R.openingElement;if(O.name.type===L.AST_NODE_TYPES.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.AST_NODE_TYPES.VariableDeclaration){for(let S of T.declarations)I(S,T);return}if(T.type===L.AST_NODE_TYPES.FunctionDeclaration){x(T.id.name)&&E(T.body)&&i.add(T.id.name);return}if(T.type===L.AST_NODE_TYPES.ExportNamedDeclaration&&T.declaration){let S=T.declaration;if(S.type===L.AST_NODE_TYPES.VariableDeclaration){for(let R of S.declarations)I(R,T);return}if(S.type===L.AST_NODE_TYPES.FunctionDeclaration&&S.id){x(S.id.name)&&E(S.body)&&i.add(S.id.name);return}}if(T.type===L.AST_NODE_TYPES.ExportDefaultDeclaration){let S=T.declaration;S.type===L.AST_NODE_TYPES.Identifier&&i.add(S.name),(S.type===L.AST_NODE_TYPES.FunctionDeclaration||S.type===L.AST_NODE_TYPES.ArrowFunctionExpression||S.type===L.AST_NODE_TYPES.FunctionExpression)&&(S.type===L.AST_NODE_TYPES.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.AST_NODE_TYPES.Program;)S=S.parent;S.parent&&(S.type===L.AST_NODE_TYPES.VariableDeclaration||S.type===L.AST_NODE_TYPES.FunctionDeclaration||S.type===L.AST_NODE_TYPES.ExportNamedDeclaration||S.type===L.AST_NODE_TYPES.ExportDefaultDeclaration)&&u.add(S)}),c["Program:exit"]=T=>{let S=0;for(let j of T.body){if(j.type===L.AST_NODE_TYPES.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})}}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 ue=g(Y);for(let ge of ue)R.has(ge)&&ge!==j.name&&H.add(ge)}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 ue of Y){let ge=Z.get(ue);(ge===void 0||H<ge)&&Z.set(ue,H)}}let K=[];for(let j of l){if(j.firstUsagePosition===void 0)continue;let Y=T.body.indexOf(j.node),H=-1;for(let Te of a){if(!Te.usedStyles.has(j.name))continue;let Ce=T.body.indexOf(Te.node);(H===-1||Ce<H)&&(H=Ce)}let ue=Z.get(j.name);if(ue!==void 0&&(H===-1||ue<H)&&(H=ue),H===-1)continue;let ge=-1;for(let Te of a){let Ce=T.body.indexOf(Te.node);Ce<H&&Ce>ge&&(ge=Ce)}let Ee=Y<H,Re=Y>ge,Fe=-1,Ye=D.get(j.name);if(Ye)for(let Te of Ye){let Ce=O.get(Te);Ce!==void 0&&Ce>Fe&&(Fe=Ce)}let $n=Y>Fe;if(!(Ee&&Re&&$n)){let Te=ge+1;if(Fe+1>Te&&(Te=Fe+1),Te<S&&(Te=S),Te>H)continue;K.push({style:j,targetPosition:Te})}}let V=null;if(a.length>1){let j=a.map(H=>({c:H,idx:T.body.indexOf(H.node)})).sort((H,ue)=>H.idx-ue.idx)[0]?.c,Y=a.find(H=>H.isMainComponent)||null;j&&Y&&j.node!==Y.node&&(V={component:Y,targetBefore:j.node})}if(K.length>0||V){let j=K[0]?.style.node||V?.component.node||T,Y=K.length>0?"stylesShouldBeAboveUsage":"mainComponentShouldBeFirst";e.report({node:j,messageId:Y,fix:F(K,V,T.body)})}},c;function F(T,S,R){return function*(O){T.sort((Z,K)=>Z.targetPosition-K.targetPosition);for(let{style:Z}of T){let K=r.getCommentsBefore(Z.node),V=Z.node.range[0],j=Z.node.range[1];K.length>0&&K[0]&&(V=K[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 K=D.get(Z.targetPosition)||[];K.push(Z),D.set(Z.targetPosition,K)}for(let[Z,K]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:ue}of K){let ge=r.getCommentsBefore(ue.node),Ee=r.getText(ue.node);ge.length>0&&(Ee=`${ge.map(Fe=>r.getText(Fe)).join(`
|
|
47
47
|
`)}
|
|
48
|
-
${
|
|
48
|
+
${Ee}`),H.push(Ee)}yield O.insertTextBeforeRange([Y,Y],`${H.join(`
|
|
49
49
|
|
|
50
50
|
`)}
|
|
51
51
|
|
|
52
|
-
`)}if(
|
|
52
|
+
`)}if(S){let{component:Z,targetBefore:K}=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(K),ue=H.length>0&&H[0]?H[0].range[0]:K.range[0],ge=(()=>{let Ee=r.getText(Z.node);return V.length>0&&(Ee=`${V.map(Fe=>r.getText(Fe)).join(`
|
|
53
53
|
`)}
|
|
54
|
-
${
|
|
55
|
-
`)}}}}});var
|
|
54
|
+
${Ee}`),Ee})();yield O.removeRange([j,Y]),yield O.insertTextBeforeRange([ue,ue],`${ge}
|
|
55
|
+
`)}}}}});var si={[pn.name]:pn.rule,[Wt.name]:Wt.rule,[zt.name]:zt.rule,"rules-of-hooks":ti,"exhaustive-deps":Zn,"require-description":Hr.rule,[Jt.name]:Jt.rule,[Xt.name]:Xt.rule,[un.name]:un.rule,[kt.name]:kt.rule,[Ut.name]:Ut.rule,[Ht.name]:Ht.rule,[ot.name]:ot.rule,[yn.name]:yn.rule,[Bt.name]:Bt.rule,[Vt.name]:Vt.rule,[qt.name]:qt.rule,[vt.name]:vt.rule,[En.name]:En.rule,[hn.name]:hn.rule,[In.name]:In.rule,[_t.name]:_t.rule,[Qt.name]:Qt.rule,[en.name]:en.rule,[tn.name]:tn.rule,[on.name]:on.rule,[an.name]:an.rule,[nn.name]:nn.rule,[sn.name]:sn.rule,[mn.name]:mn.rule,[Gt.name]:Gt.rule,[Zt.name]:Zt.rule,[vn.name]:vn.rule,[cn.name]:cn.rule,[An.name]:An.rule,[kn.name]:kn.rule,[On.name]:On.rule,[Nn.name]:Nn.rule,[Dn.name]:Dn.rule,[jn.name]:jn.rule,[Ln.name]:Ln.rule,[Mn.name]:Mn.rule,[ot.name]:ot.rule};var ka={rules:si};0&&(module.exports={extendedLintPlugin});
|