@ls-stack/extended-lint 0.62.1 → 0.63.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 +12 -12
- package/dist/extended-lint.mjs +12 -12
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Ir=Object.create;var qe=Object.defineProperty;var Rr=Object.getOwnPropertyDescriptor;var Ar=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var kr=(e,t)=>{for(var r in t)qe(e,r,{get:t[r],enumerable:!0})},sn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ar(t))!vr.call(e,o)&&o!==r&&qe(e,o,{get:()=>t[o],enumerable:!(n=Rr(t,o))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?Ir(wr(e)):{},sn(t||!e||!e.__esModule?qe(r,"default",{value:e,enumerable:!0}):r,e)),Fr=e=>sn(qe({},"__esModule",{value:!0}),e);var mo={};kr(mo,{extendedLintPlugin:()=>fo});module.exports=Fr(mo);var ne=require("@typescript-eslint/utils"),w=require("zod/v4");var on=require("@typescript-eslint/utils"),an=Ee(require("zod/v4"));function J(e){let r=on.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return an.toJSONSchema(e)}var Pr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),pt=J({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(Pr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:o,disallow:a,disallowFnCalls:i}=t,s=o??e.filename,l=[],p=new Map,c=new Set,m=new Map,f=new Set,d=new Map;function y(S){for(let I of S.specifiers)I.type===ne.AST_NODE_TYPES.ImportSpecifier&&I.imported.type===ne.AST_NODE_TYPES.Identifier&&I.imported.name!==I.local.name&&d.set(I.local.name,I.imported.name)}function E(S){if(S.declaration){if(S.declaration.type===ne.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let I=S.declaration.id.name;for(let v of Array.from(f)){let[R,N]=v.split(":");R===I&&(N==="function"||N==="any")&&f.delete(v)}}else if(S.declaration.type===ne.AST_NODE_TYPES.VariableDeclaration){for(let I of S.declaration.declarations)if(I.id.type===ne.AST_NODE_TYPES.Identifier){let v=I.id.name;for(let R of Array.from(f)){let[N,_]=R.split(":");N===v&&(_==="variable"||_==="any")&&f.delete(R)}}}}for(let I of S.specifiers)if(I.exported.type===ne.AST_NODE_TYPES.Identifier){let v=I.exported.name;for(let R of Array.from(f)){let[N,_]=R.split(":");N===v&&_==="any"&&f.delete(R)}}}function h(S){S.id.type===ne.AST_NODE_TYPES.Identifier&&S.init?.type===ne.AST_NODE_TYPES.Identifier&&d.set(S.id.name,S.init.name)}function u(S){return d.get(S)??S}function x(S,I){return u(S)===I||S===I}for(let{includeRegex:S,mustCallFn:I,mustMatchSelector:v,mustHaveExport:R}of n??[]){let _=function(K){let q=K;for(let{name:ee,value:te}of N??[])q=q.replaceAll(ee,te);return q};var A=_;let N=Or(s,new RegExp(S));if(N){for(let{anyCall:K,message:q}of I??[]){let ee=`Expected file to call the function: ${K.map(({fn:te})=>te).join(" or ")}`;c.add(ee),l.push(te=>{let{callee:X}=te;if(X.type===ne.AST_NODE_TYPES.Identifier){for(let{fn:de,withArgs:Me}of K)if(X.name===de){c.delete(ee);for(let ie of Me){let Ie=te.arguments[ie.atIndex],pe=typeof ie.literal=="string"?_(ie.literal):ie.literal;if(!Ie){e.report({node:te,messageId:"default",data:{message:`Missing argument with value "${pe}" at index ${ie.atIndex}${q?`: ${_(q)}`:""}`}});continue}if(Ie.type!==ne.AST_NODE_TYPES.Literal){e.report({node:Ie,messageId:"default",data:{message:`Argument at position ${ie.atIndex} should the literal "${pe}"${q?`: ${_(q)}`:""}`}});continue}Ie.value!==pe&&e.report({node:Ie,messageId:"default",data:{message:`Argument should have the value "${pe}"${q?`: ${_(q)}`:""}`},fix:Pe=>Pe.replaceText(Ie,typeof pe=="string"?`'${pe}'`:String(pe))})}break}}})}for(let{selector:K,message:q}of v??[])m.set(K,_(q)),p.set(_(K),()=>{m.delete(K)});for(let{name:K,type:q,message:ee}of R??[]){let te=_(K),X=_(ee);f.add(`${te}:${q}:${X}`)}}}for(let{fn:S,withArgs:I,message:v,replaceWith:R,ignoreRegex:N}of i??[])N&&new RegExp(N).test(s)||l.push(_=>{let{callee:K}=_;if(K.type!==ne.AST_NODE_TYPES.Identifier||!x(K.name,S))return;if(I)for(let ee of I){let te=_.arguments[ee.atIndex];if(!te){e.report({node:_,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${v}`}});return}if(te.type!==ne.AST_NODE_TYPES.Literal||te.value!==ee.value)return}let q=ee=>R?ee.replaceText(_,R):null;e.report({node:_,messageId:"default",data:{message:v},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:q}]:void 0})});function b(S,I){let v=r[S];v?r[S]=R=>{v(R),I(R)}:r[S]=I}for(let{selector:S,message:I,replace:v,replaceType:R="suggestion"}of a??[]){if(S==="CallExpression"){l.push(N=>{g(v,N,I,R)});continue}r[S]=N=>{g(v,N,I,R)}}if(p.size>0)for(let[S,I]of p)b(S,I);return l.length>0&&(r.CallExpression=S=>{if(S.type===ne.AST_NODE_TYPES.CallExpression)for(let I of l)I(S)}),r.ImportDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ImportDeclaration&&y(S)},r.ExportNamedDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ExportNamedDeclaration&&E(S)},r.VariableDeclarator=S=>{S.type===ne.AST_NODE_TYPES.VariableDeclarator&&h(S)},r["Program:exit"]=S=>{for(let I of c)e.report({node:S,messageId:"default",data:{message:I}});for(let[,I]of m)e.report({node:S,messageId:"default",data:{message:I}});for(let I of f){let[v,R,N]=I.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${v}" of type ${R}: ${N}`}})}},r;function g(S,I,v,R){let N=_=>{if(!S)return null;if(typeof S=="string")return _.replaceText(I,S);{let K=new RegExp(S.regex),q=e.sourceCode.getText(I);return _.replaceText(I,q.replace(K,S.with))}};e.report({node:I,messageId:"default",data:{message:v},fix:S&&R==="autofix"?N:void 0,suggest:S&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:N}]:void 0})}}});function Or(e,t){let r=[],n=t.exec(e);if(!n)return null;let[o,...a]=n;r.push({name:"$0_lowercase",value:o.toLowerCase()}),r.push({name:"$0_capitalize",value:ln(o)}),r.push({name:"$0_uncapitalize",value:pn(o)}),r.push({name:"$0",value:o});for(let i=0;i<a.length;i++){let s=`$${i+1}`,l=a[i];l!==void 0&&(r.push({name:`${s}_lowercase`,value:l.toLowerCase()}),r.push({name:`${s}_capitalize`,value:ln(l)}),r.push({name:`${s}_uncapitalize`,value:pn(l)}),r.push({name:s,value:l}))}return r}function ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var z=require("@typescript-eslint/utils"),Ae=require("zod/v4");var Nr=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),un="collapse-simple-objs-in-one-line",Dr=Ae.z.object({maxLineLength:Ae.z.number().optional(),maxProperties:Ae.z.number().optional(),nestedObjMaxLineLength:Ae.z.number().optional(),nestedObjMaxProperties:Ae.z.number().optional(),ignoreTypesWithSuffix:Ae.z.array(Ae.z.string()).optional()}),Mr=Nr({name:un,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:[$(Dr)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],o=t.maxProperties??2,a=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function s(p){if(p.type===z.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===z.AST_NODE_TYPES.Property,m=c?i:o,f=p.properties.length;if(f>m)return!1;if(f===1){let y=p.properties[0];return!y||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ObjectExpression||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(h=>h&&ct(h))?!1:{text:r.getText(y),isNested:c,propsSize:f}}let d=[];for(let y of p.properties){if(y.type===z.AST_NODE_TYPES.Property&&!ct(y.value))return!1;d.push(r.getText(y))}return{text:d.join(", "),isNested:c,propsSize:f}}else{let c=p.parent.parent?.type===z.AST_NODE_TYPES.TSPropertySignature,m=c?i:o,f=p.members.length;if(f>m)return!1;if(n.length>0&&p.parent.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(n.some(E=>y.endsWith(E)))return!1}if(f===1){let y=p.members[0];return!y||y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(y),isNested:c,propsSize:1}}if(p.parent.type===z.AST_NODE_TYPES.TSIntersectionType||p.parent.type===z.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let d=[];for(let y of p.members){if(y.type!==z.AST_NODE_TYPES.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===z.AST_NODE_TYPES.TSTypeLiteral||!cn(E))return!1;if(E.type===z.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let u=E.typeArguments.params[0];if(!u||!cn(u))return!1}let h=r.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),d.push(h)}return{text:d.join("; "),isNested:c,propsSize:f}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==z.AST_NODE_TYPES.JSXExpressionContainer){let E=0,h=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==z.AST_TOKEN_TYPES.Punctuator||h?!0:b.value===","?(E++,!1):b.value===";"?(E++,h=!0,!1):b.value===")"||b.value==="}"?(E++,!1):!0});if(E>4)return;let x=u?.type===z.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
|
|
2
|
-
`);if(u?.loc.start.line===p.loc.end.line&&!x)return}let c=
|
|
3
|
-
`)||r.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let f=`{ ${m} }`,d=
|
|
4
|
-
`,r.range[1]);return(n!==-1?n:t.text.length)-r.range[1]}function
|
|
1
|
+
"use strict";var wr=Object.create;var Ze=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var kr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Pr=Object.prototype.hasOwnProperty;var Or=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},un=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of kr(t))!Pr.call(e,a)&&a!==r&&Ze(e,a,{get:()=>t[a],enumerable:!(n=vr(t,a))||n.enumerable});return e};var Ee=(e,t,r)=>(r=e!=null?wr(Fr(e)):{},un(t||!e||!e.__esModule?Ze(r,"default",{value:e,enumerable:!0}):r,e)),Nr=e=>un(Ze({},"__esModule",{value:!0}),e);var To={};Or(To,{extendedLintPlugin:()=>So});module.exports=Nr(To);var ne=require("@typescript-eslint/utils"),w=require("zod/v4");var fn=require("@typescript-eslint/utils"),mn=Ee(require("zod/v4"));function J(e){let r=fn.ESLintUtils.RuleCreator(n=>`https://github.com/lucasols/extended-lint#${n}`)(e);return{name:e.name,rule:r}}function $(e){return mn.toJSONSchema(e)}var Dr=w.z.object({disallow:w.z.array(w.z.object({selector:w.z.string(),message:w.z.string(),replace:w.z.optional(w.z.union([w.z.string(),w.z.object({regex:w.z.string(),with:w.z.string()})])),replaceType:w.z.optional(w.z.enum(["suggestion","autofix"]))})).optional(),disallowFnCalls:w.z.optional(w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.optional(w.z.array(w.z.object({atIndex:w.z.number(),value:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))),message:w.z.string(),replaceWith:w.z.optional(w.z.string()),ignoreRegex:w.z.optional(w.z.string())}))),__dev_simulateFileName:w.z.optional(w.z.string()),mustMatchSyntax:w.z.optional(w.z.array(w.z.object({includeRegex:w.z.string(),mustCallFn:w.z.optional(w.z.array(w.z.object({anyCall:w.z.array(w.z.object({fn:w.z.string(),withArgs:w.z.array(w.z.object({atIndex:w.z.number(),literal:w.z.union([w.z.string(),w.z.number(),w.z.boolean()])}))})),message:w.z.optional(w.z.string())}))),mustMatchSelector:w.z.optional(w.z.array(w.z.object({selector:w.z.string(),message:w.z.string()}))),mustHaveExport:w.z.optional(w.z.array(w.z.object({name:w.z.string(),type:w.z.enum(["function","variable","any"]).default("any"),message:w.z.string()})))})))}),ut=J({name:"advanced-no-restricted-syntax",meta:{type:"suggestion",docs:{description:"Disallow specific syntax patterns"},schema:[$(Dr)],messages:{default:"{{message}}"},fixable:"code",hasSuggestions:!0},defaultOptions:[{disallow:[]}],create(e,[t]){let r={},{mustMatchSyntax:n,__dev_simulateFileName:a,disallow:s,disallowFnCalls:i}=t,o=a??e.filename,l=[],p=new Map,c=new Set,m=new Map,f=new Set,d=new Map;function y(S){for(let I of S.specifiers)I.type===ne.AST_NODE_TYPES.ImportSpecifier&&I.imported.type===ne.AST_NODE_TYPES.Identifier&&I.imported.name!==I.local.name&&d.set(I.local.name,I.imported.name)}function E(S){if(S.declaration){if(S.declaration.type===ne.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let I=S.declaration.id.name;for(let v of Array.from(f)){let[R,D]=v.split(":");R===I&&(D==="function"||D==="any")&&f.delete(v)}}else if(S.declaration.type===ne.AST_NODE_TYPES.VariableDeclaration){for(let I of S.declaration.declarations)if(I.id.type===ne.AST_NODE_TYPES.Identifier){let v=I.id.name;for(let R of Array.from(f)){let[D,_]=R.split(":");D===v&&(_==="variable"||_==="any")&&f.delete(R)}}}}for(let I of S.specifiers)if(I.exported.type===ne.AST_NODE_TYPES.Identifier){let v=I.exported.name;for(let R of Array.from(f)){let[D,_]=R.split(":");D===v&&_==="any"&&f.delete(R)}}}function h(S){S.id.type===ne.AST_NODE_TYPES.Identifier&&S.init?.type===ne.AST_NODE_TYPES.Identifier&&d.set(S.id.name,S.init.name)}function u(S){return d.get(S)??S}function x(S,I){return u(S)===I||S===I}for(let{includeRegex:S,mustCallFn:I,mustMatchSelector:v,mustHaveExport:R}of n??[]){let _=function(K){let q=K;for(let{name:ee,value:te}of D??[])q=q.replaceAll(ee,te);return q};var A=_;let D=Mr(o,new RegExp(S));if(D){for(let{anyCall:K,message:q}of I??[]){let ee=`Expected file to call the function: ${K.map(({fn:te})=>te).join(" or ")}`;c.add(ee),l.push(te=>{let{callee:Y}=te;if(Y.type===ne.AST_NODE_TYPES.Identifier){for(let{fn:de,withArgs:Me}of K)if(Y.name===de){c.delete(ee);for(let ie of Me){let Ie=te.arguments[ie.atIndex],pe=typeof ie.literal=="string"?_(ie.literal):ie.literal;if(!Ie){e.report({node:te,messageId:"default",data:{message:`Missing argument with value "${pe}" at index ${ie.atIndex}${q?`: ${_(q)}`:""}`}});continue}if(Ie.type!==ne.AST_NODE_TYPES.Literal){e.report({node:Ie,messageId:"default",data:{message:`Argument at position ${ie.atIndex} should the literal "${pe}"${q?`: ${_(q)}`:""}`}});continue}Ie.value!==pe&&e.report({node:Ie,messageId:"default",data:{message:`Argument should have the value "${pe}"${q?`: ${_(q)}`:""}`},fix:Pe=>Pe.replaceText(Ie,typeof pe=="string"?`'${pe}'`:String(pe))})}break}}})}for(let{selector:K,message:q}of v??[])m.set(K,_(q)),p.set(_(K),()=>{m.delete(K)});for(let{name:K,type:q,message:ee}of R??[]){let te=_(K),Y=_(ee);f.add(`${te}:${q}:${Y}`)}}}for(let{fn:S,withArgs:I,message:v,replaceWith:R,ignoreRegex:D}of i??[])D&&new RegExp(D).test(o)||l.push(_=>{let{callee:K}=_;if(K.type!==ne.AST_NODE_TYPES.Identifier||!x(K.name,S))return;if(I)for(let ee of I){let te=_.arguments[ee.atIndex];if(!te){e.report({node:_,messageId:"default",data:{message:`Missing argument with value "${ee.value}" at index ${ee.atIndex}: ${v}`}});return}if(te.type!==ne.AST_NODE_TYPES.Literal||te.value!==ee.value)return}let q=ee=>R?ee.replaceText(_,R):null;e.report({node:_,messageId:"default",data:{message:v},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:q}]:void 0})});function b(S,I){let v=r[S];v?r[S]=R=>{v(R),I(R)}:r[S]=I}for(let{selector:S,message:I,replace:v,replaceType:R="suggestion"}of s??[]){if(S==="CallExpression"){l.push(D=>{g(v,D,I,R)});continue}r[S]=D=>{g(v,D,I,R)}}if(p.size>0)for(let[S,I]of p)b(S,I);return l.length>0&&(r.CallExpression=S=>{if(S.type===ne.AST_NODE_TYPES.CallExpression)for(let I of l)I(S)}),r.ImportDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ImportDeclaration&&y(S)},r.ExportNamedDeclaration=S=>{S.type===ne.AST_NODE_TYPES.ExportNamedDeclaration&&E(S)},r.VariableDeclarator=S=>{S.type===ne.AST_NODE_TYPES.VariableDeclarator&&h(S)},r["Program:exit"]=S=>{for(let I of c)e.report({node:S,messageId:"default",data:{message:I}});for(let[,I]of m)e.report({node:S,messageId:"default",data:{message:I}});for(let I of f){let[v,R,D]=I.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${v}" of type ${R}: ${D}`}})}},r;function g(S,I,v,R){let D=_=>{if(!S)return null;if(typeof S=="string")return _.replaceText(I,S);{let K=new RegExp(S.regex),q=e.sourceCode.getText(I);return _.replaceText(I,q.replace(K,S.with))}};e.report({node:I,messageId:"default",data:{message:v},fix:S&&R==="autofix"?D:void 0,suggest:S&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:D}]:void 0})}}});function Mr(e,t){let r=[],n=t.exec(e);if(!n)return null;let[a,...s]=n;r.push({name:"$0_lowercase",value:a.toLowerCase()}),r.push({name:"$0_capitalize",value:dn(a)}),r.push({name:"$0_uncapitalize",value:yn(a)}),r.push({name:"$0",value:a});for(let i=0;i<s.length;i++){let o=`$${i+1}`,l=s[i];l!==void 0&&(r.push({name:`${o}_lowercase`,value:l.toLowerCase()}),r.push({name:`${o}_capitalize`,value:dn(l)}),r.push({name:`${o}_uncapitalize`,value:yn(l)}),r.push({name:o,value:l}))}return r}function dn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function yn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var z=require("@typescript-eslint/utils"),Ae=require("zod/v4");var jr=z.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="collapse-simple-objs-in-one-line",Lr=Ae.z.object({maxLineLength:Ae.z.number().optional(),maxProperties:Ae.z.number().optional(),nestedObjMaxLineLength:Ae.z.number().optional(),nestedObjMaxProperties:Ae.z.number().optional(),ignoreTypesWithSuffix:Ae.z.array(Ae.z.string()).optional()}),_r=jr({name:Sn,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:[$(Lr)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=t.ignoreTypesWithSuffix??[],a=t.maxProperties??2,s=t.nestedObjMaxLineLength??t.maxLineLength,i=t.nestedObjMaxProperties??3;function o(p){if(p.type===z.AST_NODE_TYPES.ObjectExpression){let c=p.parent.type===z.AST_NODE_TYPES.Property,m=c?i:a,f=p.properties.length;if(f>m)return!1;if(f===1){let y=p.properties[0];return!y||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ObjectExpression||y.type===z.AST_NODE_TYPES.Property&&y.value.type===z.AST_NODE_TYPES.ArrayExpression&&!y.value.elements.every(h=>h&&ft(h))?!1:{text:r.getText(y),isNested:c,propsSize:f}}let d=[];for(let y of p.properties){if(y.type===z.AST_NODE_TYPES.Property&&!ft(y.value))return!1;d.push(r.getText(y))}return{text:d.join(", "),isNested:c,propsSize:f}}else{let c=p.parent.parent?.type===z.AST_NODE_TYPES.TSPropertySignature,m=c?i:a,f=p.members.length;if(f>m)return!1;if(n.length>0&&p.parent.type===z.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(n.some(E=>y.endsWith(E)))return!1}if(f===1){let y=p.members[0];return!y||y.type===z.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral?!1:{text:r.getText(y),isNested:c,propsSize:1}}if(p.parent.type===z.AST_NODE_TYPES.TSIntersectionType||p.parent.type===z.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let d=[];for(let y of p.members){if(y.type!==z.AST_NODE_TYPES.TSPropertySignature)return!1;let E=y.typeAnnotation?.typeAnnotation;if(!E||E.type===z.AST_NODE_TYPES.TSTypeLiteral||!gn(E))return!1;if(E.type===z.AST_NODE_TYPES.TSTypeReference&&E.typeArguments){if(E.typeArguments.params.length>1)return!1;let u=E.typeArguments.params[0];if(!u||!gn(u))return!1}let h=r.getText(y).trim();(h.endsWith(";")||h.endsWith(","))&&(h=h.slice(0,-1)),d.push(h)}return{text:d.join("; "),isNested:c,propsSize:f}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==z.AST_NODE_TYPES.JSXExpressionContainer){let E=0,h=!1,u=r.getTokenAfter(p,{filter:b=>b.type!==z.AST_TOKEN_TYPES.Punctuator||h?!0:b.value===","?(E++,!1):b.value===";"?(E++,h=!0,!1):b.value===")"||b.value==="}"?(E++,!1):!0});if(E>4)return;let x=u?.type===z.AST_TOKEN_TYPES.Template&&u.value.startsWith(`}
|
|
2
|
+
`);if(u?.loc.start.line===p.loc.end.line&&!x)return}let c=o(p);if(!c)return;let m=c.text;if(m.includes(`
|
|
3
|
+
`)||r.getCommentsInside(p).length>0)return;m.endsWith(";")&&(m=m.slice(0,-1));let f=`{ ${m} }`,d=Ur(r,p),y=c.isNested&&c.propsSize>2?s:t.maxLineLength;y&&f.length+d.length+$r(p,r)>y||e.report({node:p,messageId:"singleLineProp",fix:E=>E.replaceText(p,f)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function gn(e){return e.type===z.AST_NODE_TYPES.TSLiteralType||e.type===z.AST_NODE_TYPES.TSTypeReference||e.type===z.AST_NODE_TYPES.TSNumberKeyword||e.type===z.AST_NODE_TYPES.TSStringKeyword||e.type===z.AST_NODE_TYPES.TSBooleanKeyword||e.type===z.AST_NODE_TYPES.TSNullKeyword||e.type===z.AST_NODE_TYPES.TSUndefinedKeyword}function ft(e,t){return!!(e.type===z.AST_NODE_TYPES.Literal||e.type===z.AST_NODE_TYPES.Identifier||e.type===z.AST_NODE_TYPES.TemplateLiteral||e.type===z.AST_NODE_TYPES.TaggedTemplateExpression||!t&&e.type===z.AST_NODE_TYPES.ArrayExpression&&e.elements.every(r=>r&&ft(r,!0)))}function $r(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 Ur(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}var mt={name:Sn,rule:_r};var zr=/eslint +react-compiler\/react-compiler: +\["error/,hn={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"?u=>r(u):u=>e.sourceCode.getText(u),n=typeof e.getScope=="function"?()=>n():u=>e.sourceCode.getScope(u),a=e.options&&e.options[0]&&e.options[0].additionalHooks?new RegExp(e.options[0].additionalHooks):void 0,s=e.options&&e.options[0]&&e.options[0].enableDangerousAutofixThisMayCauseInfiniteLoops||!1,i={additionalHooks:a,enableDangerousAutofixThisMayCauseInfiniteLoops:s};function o(u){s&&Array.isArray(u.suggest)&&u.suggest.length>0&&(u.fix=u.suggest[0].fix),e.report(u)}let l=e.getSourceCode().scopeManager,p=new WeakMap,c=new WeakSet,m=new WeakMap,f=new WeakMap,d=new WeakSet;function y(u,x){return function(b){if(x.has(b))return x.get(b);let g=u(b);return x.set(b,g),g}}function E(u,x,b,g,A){A&&u.async&&o({node:u,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,20 +12,20 @@ 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 S=l.acquire(u),I=new Set,v=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;v=T}let R=Array.isArray;function N(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let F=C.node.parent;if(F==null&&(dt(v.block,C.node.id),F=C.node.parent,F==null))return!1;if(F.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let O=k.callee;if(O.type==="MemberExpression"&&O.object.name==="React"&&O.property!=null&&!O.computed&&(O=O.property),O.type!=="Identifier")return!1;let P=C.node.id,{name:j}=O;if(j==="useRef"&&P.type==="Identifier")return!0;if(Vr(O)&&P.type==="Identifier"){for(let L of T.references)L!==P&&d.add(L.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(P.type==="ArrayPattern"&&P.elements.length===2&&R(T.identifiers)){if(P.elements[1]===T.identifiers[0]){if(j==="useState"){let L=T.references,ce=0;for(let he=0;he<L.length;he++){if(L[he].isWrite()&&ce++,ce>1)return!1;p.set(L[he].identifier,P.elements[0])}}return!0}else if(P.elements[0]===T.identifiers[0]){if(j==="useState"){let L=T.references;for(let ce=0;ce<L.length;ce++)c.add(L[ce].identifier)}return!1}}}else if(j==="useTransition"&&P.type==="ArrayPattern"&&P.elements.length===2&&Array.isArray(T.identifiers)&&P.elements[1]===T.identifiers[0])return!0;return!1}function _(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,F=v.childScopes,O=null,P;for(P=0;P<F.length;P++){let j=F[P],L=j.block;if(k.type==="FunctionDeclaration"&&L===k||k.type==="VariableDeclarator"&&L.parent===k){O=j;break}}if(O==null)return!1;for(P=0;P<O.through.length;P++){let j=O.through[P];if(j.resolved!=null&&I.has(j.resolved.scope)&&!K(j.resolved))return!1}return!0}let K=y(N,m),q=y(_,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==u;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let X=new Map,de=new Map;Me(S);function Me(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=dt(u,C.identifier),F=dn(k),O=xe(F,de);if(A&&F.type==="Identifier"&&(F.parent.type==="MemberExpression"||F.parent.type==="OptionalMemberExpression")&&!F.parent.computed&&F.parent.property.type==="Identifier"&&F.parent.property.name==="current"&&te(C)&&ee.set(O,{reference:C,dependencyNode:F}),F.parent.type==="TSTypeQuery"||F.parent.type==="TSTypeReference")continue;let P=C.resolved.defs[0];if(P!=null&&!(P.node!=null&&P.node.init===u.parent)&&P.type!=="TypeParameter")if(X.has(O))X.get(O).references.push(C);else{let j=C.resolved,L=K(j)||q(j);X.set(O,{isStable:L,references:[C]})}}for(let C of T.childScopes)Me(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let F=T.resolved.references,O=!1;for(let P=0;P<F.length;P++){let{identifier:j}=F[P],{parent:L}=j;if(L!=null&&L.type==="MemberExpression"&&!L.computed&&L.property.type==="Identifier"&&L.property.name==="current"&&L.parent.type==="AssignmentExpression"&&L.parent.left===L){O=!0;break}}O||s({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Ie(T,C){ie.has(C)||(ie.add(C),s({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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(b)}.`}))}let pe=new Set;if(X.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(F=>{F.writeExpr&&Ie(F.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(X.forEach(({isStable:C,references:k},F)=>{T||k.forEach(O=>{if(T)return;let P=O.identifier;if(!p.has(P))return;let L=O.from;for(;L.type!=="function";)L=L.upper;L.block===u&&(T=F)})}),T){let{suggestedDependencies:C}=ft({dependencies:X,declaredDependencies:[],stableDependencies:pe,externalDependencies:new Set,isEffect:!0});s({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(u,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],ze=new Set;x.type!=="ArrayExpression"?s({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){s({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&s({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(O){return O.removeRange(T.range)}}]});let C;try{C=xe(T,de)}catch(O){if(/Unsupported node type/.test(O.message)){T.type==="Literal"?X.has(T.value)?s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):s({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):s({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw O}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let F=!v.through.some(O=>O.identifier===k);Pe.push({key:C,node:T}),F||ze.add(C)});let{suggestedDependencies:Er,unnecessaryDependencies:Xe,missingDependencies:Re,duplicateDependencies:tn}=ft({dependencies:X,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:ze,isEffect:A}),Be=Er;if(tn.size+Re.size+Xe.size===0){if(t)return;$r({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:F})=>{let O=F==="function"?"useCallback":"useMemo",P=F==="function"?"definition":"initialization",j=`wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,L=k?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,ce=F==="conditional"||F==="logical expression"?"could make":"makes",he=`The '${C.name.name}' ${F} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${L}`,nn;k&&C.type==="Variable"&&F==="function"&&(nn=[{desc:`Wrap the ${P} of '${C.name.name}' in its own ${O}() Hook.`,fix(rn){let[br,Cr]=O==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[rn.insertTextBefore(C.node.init,br),rn.insertTextAfter(C.node.init,Cr)]}}]),s({node:C.node,message:he,suggest:nn})});return}!A&&Re.size>0&&(Be=ft({dependencies:X,declaredDependencies:[],stableDependencies:pe,externalDependencies:ze,isEffect:A}).suggestedDependencies);function xr(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}xr()&&Be.sort();function at(T){let C=T.split("."),k="";for(let F=0;F<C.length;F++){if(F!==0){let O=C.slice(0,F+1).join("."),P=de.get(O)===!0;k+=P?"?.":"."}k+=C[F]}return k}function lt(T,C,k,F){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+zr(Array.from(T).sort().map(O=>"'"+at(O)+"'"))+`. Either ${F} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(Xe.size>0){let T=null;if(Array.from(Xe.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)fe=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ze.size>0){let C=Array.from(ze)[0];S.set.has(C)||(fe=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&Re.has("props")){let T=X.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let F=0;F<C.length;F++){let O=C[F],P=dt(v.block,O.identifier);if(!P){k=!1;break}let j=P.parent;if(j==null){k=!1;break}if(j.type!=="MemberExpression"&&j.type!=="OptionalMemberExpression"){k=!1;break}}k&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&Re.size>0){let T=null;Re.forEach(C=>{if(T)return;let k=v.set.get(C),F=X.get(C);if(F.references[0].resolved!==k)return;let O=k.defs[0];if(O==null||O.name==null||O.type!=="Parameter")return;let P=!1,j;for(let L=0;L<F.references.length;L++)if(j=F.references[L].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){P=!0;break}P&&(T=C)}),T!==null&&(fe=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&Re.size>0){let T=null;if(Re.forEach(C=>{if(T!==null)return;let F=X.get(C).references,O,P;for(let j=0;j<F.length;j++){for(O=F[j].identifier,P=O.parent;P!=null&&P!==v.block;){if(P.type==="CallExpression"){let L=p.get(P.callee);if(L!=null){if(L.name===C)T={missingDep:C,setter:P.callee.name,form:"updater"};else if(c.has(O))T={missingDep:C,setter:P.callee.name,form:"reducer"};else{let ce=F[j].resolved;if(ce!=null){let he=ce.defs[0];he!=null&&he.type==="Parameter"&&(T={missingDep:C,setter:P.callee.name,form:"inlineReducer"})}}break}}P=P.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":fe=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}s({node:x,message:`React Hook ${r(b)} has `+(lt(Re,"a","missing","include")||lt(Xe,"an","unnecessary","exclude")||lt(tn,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Be.map(at).join(", ")}]`,fix(T){return T.replaceText(x,`[${Be.map(at).join(", ")}]`)}}]})}function h(u){let x=Ur(u.callee,i);if(x===-1)return;let b=u.arguments[x],g=u.callee,A=yn(g).name,S=u.arguments[x+1],I=/Effect($|[^a-z])/g.test(A);if(!b){s({node:g,message:`React Hook ${A} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!I)){if(!S&&!I){(A==="useMemo"||A==="useCallback")&&s({node:g,message:`React Hook ${A} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,A,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(N=>N&&N.type==="Identifier"&&N.name===b.name))return;let v=n(u).set.get(b.name);if(v==null||v.defs==null)return;let R=v.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,A,I);return;case"VariableDeclarator":let N=R.node.init;if(!N)break;switch(N.type){case"ArrowFunctionExpression":case"FunctionExpression":E(N,S,g,A,I);return}break}break;default:s({node:g,message:`React Hook ${A} received a function whose dependencies are unknown. Pass an inline function instead.`});return}s({node:g,message:`React Hook ${A} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(v){return v.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(_r.test(u.value))return t=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:u=>h(u)}}};function ft({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:o}){let a=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let u=s(a,h);u.isUsed=!0,l(a,h,x=>{x.isSubtreeUsed=!0})}),t.forEach(({key:E})=>{let h=s(a,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=s(a,E);h.isSatisfiedRecursively=!0});function s(E,h){let u=h.split("."),x=E;for(let b of u){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,u){let x=h.split("."),b=E;for(let g of x){let A=b.children.get(g);if(!A)return;u(A),b=A}}let p=new Set,c=new Set;m(a,p,c,E=>E);function m(E,h,u,x){E.children.forEach((b,g)=>{let A=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(A);return}if(b.isUsed){h.add(A);return}m(b,h,u,S=>A+"."+S)})}let f=[],d=new Set,y=new Set;return t.forEach(({key:E})=>{c.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function we(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function $r({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let o=e.map(({key:i})=>{let s=r.variables.find(p=>p.name===i);if(s==null)return null;let l=s.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[s,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[s,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[s,"class"]:null}).filter(Boolean);function a(i){let s=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(s)return!0;s=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!gn(t,p.identifier))return!0}return!1}return o.map(([i,s])=>({construction:i.defs[0],depType:s,isUsedOutsideOfHook:a(i)}))}function dn(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)?dn(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function mt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function xe(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=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),o=`${r}.${n}`;return mt(e,t,o),o}else if(e.type==="ChainExpression"&&!e.computed){let r=e.expression;if(r.type==="CallExpression")throw new Error(`Unsupported node type: ${r.type}`);let n=xe(r.object,t),o=xe(r.property,null),a=`${n}.${o}`;return mt(r,t,a),a}else throw new Error(`Unsupported node type: ${e.type}`)}function yn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Ur(e,t){let r=yn(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=xe(r,null)}catch(o){if(/Unsupported node type/.test(o.message))return 0;throw o}return t.additionalHooks.test(n)?0:-1}else return-1}}function dt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Wr(n,t))return n;if(gn(n,t))for(let[o,a]of Object.entries(n))o!=="parent"&&(fn(a)?(a.parent=n,r.push(a)):Array.isArray(a)&&a.forEach(i=>{fn(i)&&(i.parent=n,r.push(i))}))}return null}function zr(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 fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Wr(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 gn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Vr(e){return!1}var ve=require("@typescript-eslint/utils"),re=Ee(require("typescript")),Tn=require("zod/v4");var Hr=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Sn="improved-no-unnecessary-condition",Jr=Tn.z.object({}),Yr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Xr=new Set(Yr),yt={name:Sn,rule:Hr({name:Sn,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}}".'},schema:[$(Jr)]},defaultOptions:[{}],create(e){let t=ve.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(s){return s.type===ve.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown?null:s.flags&re.default.TypeFlags.StringLike?["string"]:s.flags&re.default.TypeFlags.NumberLike?["number"]:s.flags&re.default.TypeFlags.BigIntLike?["bigint"]:s.flags&re.default.TypeFlags.BooleanLike?["boolean"]:s.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&re.default.TypeFlags.Undefined||s.flags&re.default.TypeFlags.Void?["undefined"]:s.flags&re.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&re.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&re.default.TypeFlags.NonPrimitive?["object"]:s.flags&re.default.TypeFlags.Never?["never"]:null}function a(s){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(s),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let f of p.types){let d=o(f);if(d)c.push(...d);else return null}return c}let m=o(p);return m?(c.push(...m),c):null}function i(s){if(!(s.operator==="==="||s.operator==="!=="))return;let p=null,c=null;if(n(s.left)?(p=s.left,c=s.right.type===ve.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):n(s.right)&&(p=s.right,c=s.left.type===ve.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!p||!c||!Br(c,Xr))return;let m=a(p);if(!m)return;let f=s.operator==="!==",d=m.includes(c);m.length===1?d&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!d&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):d&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ge(m),conditionType:c}}):!d&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Ge(m)}})}return{BinaryExpression:i}}})};function Ge(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===ve.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Br(e,t){return t.has(e)}var Ke=require("@typescript-eslint/utils"),Ze=require("zod/v4");var qr=Ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),hn="no-call-with-explicit-generics",Gr=Ze.z.object({functions:Ze.z.array(Ze.z.string())}),Zr=qr({name:hn,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:[$(Gr)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:o}=n;o.type===Ke.AST_NODE_TYPES.Identifier&&r.has(o.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),gt={name:hn,rule:Zr};var Oe=require("@typescript-eslint/utils"),Kr=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),En="no-call-with-inferred-generics",Qr=Kr({name:En,meta:{type:"problem",docs:{description:"Disable calling configured functions with infered generics"},messages:{missingGenericDeclaration:"Function '{{ functionName }}' should be called with at least {{ minGenerics }} generic(s) (ex: `fn<Generic>()`) defined",anyUsedInGenerics:"Function '{{ functionName }}' should not be called with 'any' in generics"},schema:[{type:"object",properties:{functions:{type:"array",items:{type:"object",properties:{name:{type:"string"},minGenerics:{type:"number"},allowAny:{type:"boolean"},disallowTypes:{type:"array",items:{type:"string"}}},required:["name"]}},anyAliases:{type:"array",items:{type:"string"}}},required:["functions"]}]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Map(t.functions.map(n=>[n.name,n]));return{CallExpression(n){let{callee:o}=n;if(o.type!==Oe.AST_NODE_TYPES.Identifier)return;let a=r.get(o.name);if(!a)return;let{minGenerics:i=1,allowAny:s,disallowTypes:l=t.disallowTypes}=a;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:i||0}}),!(s&&!l)&&n.typeArguments?.params.some(c=>!s&&c.type===Oe.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===Oe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Oe.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),St={name:En,rule:Qr};var Cn=require("@typescript-eslint/utils"),ei=Cn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),In="no-commented-out-code",ti=["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:"],ni=/^\s*return\s+/,ri=/\w=("|'|`)/,ii=/\w+:\s*('|"|`)/,si=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,oi=/\w+-\w+:/,ai=/\w+_\w+:/,li=/\?\s+\w/,pi=/:\s+\w/,ci=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,ui=/^\s*\d+[,}]/,fi=/^\s*\[[^\]]*\][,}]/,mi=/^\s*\{[^}]*\}[,}]/,di=/\.\w+\(/,yi=/\[\w+\]/,gi=/^\s*(['"`]).+?\1\s*:/,Si=/^<[A-Z]\w*(\s|>|\/)/,Ti=/^<[a-z]+(\s|>|\/)/,hi=/<[A-Z]\w*(\s.*)?>/,Ei=/<\/[A-Z]\w*>/,xi=/<[a-z]+(\s.*)?>/,bi=/<\/[a-z]+>/,Ci=/^\s*[*\s]*$/,Ii=/^[a-zA-Z]/,Ri=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,Ai=/```[\s\S]*?```/g,wi=/`[^`]*`/g,xn=/[a-zA-Z0-9]/,vi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,ki=/[{}[\]()`=<>]/,Fi=/:\s*(['"`[{(]|\w+\s*=>)/,Pi=/\bif\s*\(|\belse\b|=>/,G={returnStatement:ni,stringAssignment:ri,objectPropertyWithQuotes:ii,computedPropertyAssignment:si,kebabCaseProperty:oi,snakeCaseProperty:ai,ternaryOperator:li,colonWithWord:pi,quotedString:ci,numberWithComma:ui,arrayWithComma:fi,objectWithComma:mi,methodCall:di,arrayAccess:yi,quotedPropertyKey:gi,jsxSelfClosing:Si,jsxElement:Ti,jsxOpeningTag:hi,jsxClosingTag:Ei,htmlOpeningTag:xi,htmlClosingTag:bi,jsdocComment:Ci};function Oi(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&Ii.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||vi.test(t)||ki.test(t)||Fi.test(t)||Pi.test(t)?!1:!!(t.includes(":")&&Ri.test(t))}var Ni=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],Di=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],bn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],Mi=ei({name:In,meta:{type:"problem",docs:{description:"Disallow commented code"},messages:{commentedOutCode:"Commented code is not allowed. Detected pattern: `{{ wrongPattern }}` Use a comment starting with one of these prefixes if you want to keep this code commented out: {{ allowedPrefixes }}"},schema:[]},defaultOptions:[],create(e){function t(n,o){if(n.startsWith("/"))return!1;let a=n.trimStart();if(n.startsWith("*")||a.startsWith("eslint-disable")||n.includes("@deprecated")||n.includes("@example")||n.includes("@param")||n.includes("@returns")||n.includes("@throws")||n.includes("typescript-eslint")||n.includes("@ts-")||n.includes("prettier-ignore")||G.jsdocComment.test(n))return!1;for(let i of bn)if(a.startsWith(i))return!1;if(n.includes("https://")||Oi(a))return!1;if(o==="Block"){for(let i of Di)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 ti)if(a.startsWith(i))return{wrongPattern:i};for(let i of Ni)if(typeof i=="string"){if(n.includes(i))return{wrongPattern:i}}else if(i.test(n))return{wrongPattern:`regex(${i.toString()})`};return!1}function r(n,o){let a=n,i=a.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Ai);p.some(m=>xn.test(m))&&(a=p.join(""))}if(!a.includes("`"))return a;let s=a.split(wi);return s.some(p=>xn.test(p))?s.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let i=r(a.value,a.type),s=t(i,a.type);s&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:s.wrongPattern,allowedPrefixes:bn.join(", ")}})}}}}}),Tt={name:In,rule:Mi};var Qe=require("@typescript-eslint/utils"),ji=Qe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-default-export",Li=ji({name:Rn,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===Qe.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),ht={name:Rn,rule:Li};var An=require("@typescript-eslint/utils"),_i=An.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),wn="no-leaked-text-in-jsx",$i=[",",";","[","]","(",")"],Ui=_i({name:wn,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="";$i.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),Et={name:wn,rule:Ui};var ke=require("@typescript-eslint/utils"),zi=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),kn="no-non-camel-case-functions",Wi=/^(\$?[a-z][a-zA-Z0-9]*)$/;function vn(e){if(e.typeName.type!==ke.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ke.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Vi=zi({name:kn,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&&!Wi.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ke.AST_NODE_TYPES.TSTypeReference?vn(r):r.type===ke.AST_NODE_TYPES.TSUnionType&&r.types.some(o=>o.type===ke.AST_NODE_TYPES.TSTypeReference&&vn(o))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),xt={name:kn,rule:Vi};var V=require("@typescript-eslint/utils");var bt=require("@typescript-eslint/utils");function Le(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Le(e.parent,t,r===1/0?r:r-1)}function*Ct(e){yield e,e.parent&&(yield*Ct(e.parent))}function It(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Pn(e,t,r){let o=r.getDeclaredVariables(e).find(a=>a.name===t||a.identifiers[0]?.parent.type===bt.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===bt.AST_NODE_TYPES.Identifier&&a.identifiers[0].parent.key.name===t);return o?o.references.filter(a=>!a.init):[]}function Fn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Hi(e,t){return e[t]}function On(e,t,r){let n=r.visitorKeys,o=new Set;function a(i){if(o.has(i))return!1;if(o.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let c=Hi(i,p);if(c){if(Array.isArray(c)){for(let m of c)if(Fn(m)&&a(m))return!0}else if(Fn(c)&&a(c))return!0}}return!1}a(e)}var Ji=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="no-optional-root-props",Yi=Ji({name:Nn,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 s of Ct(i.identifier)){if("returnType"in s||s.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=s.parent;if(!l)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Le(l.parent.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=et(c,e.sourceCode);return m?!(m.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(s.type===V.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Le(l,V.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!et(p,e.sourceCode):!1}if(l.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!et(l,e.sourceCode)}return!1}function r(n){n.key.type!==V.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:o=>{let a=Le(n,V.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let i=e.sourceCode.getText(a);return o.replaceText(a,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===V.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(tt(n)||!t(n)))for(let o of n.typeAnnotation.members)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSInterfaceDeclaration(n){if(!(tt(n)||!t(n)))for(let o of n.body.body)o.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(o)},TSTypeReference(n){if(n.typeName.type!==V.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let o=n.typeArguments.params[0];if(o.type!==V.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=Le(n.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let i=et(a,e.sourceCode);if(!(!i||i.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of o.members)l.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function tt(e){return e?e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function et(e,t){if(tt(e))return;let r;if(e.type===V.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.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===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let o=n.variables.find(i=>i.identifiers.includes(r));if(!o)return;let a=o.references.filter(i=>i.identifier!==r);if(!(a.length!==1||!a[0])&&!tt(a[0].identifier.parent.parent))return a[0].identifier}var Rt={name:Nn,rule:Yi};var We=require("@typescript-eslint/utils");var Ve=J({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===We.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===We.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let o of n.specifiers)t.add(o.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===We.AST_NODE_TYPES.VariableDeclaration)for(let o of n.declaration.declarations)r(o.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===We.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var Dn=require("@typescript-eslint/utils"),nt=Ee(require("path")),be=require("zod/v4");var Xi=Dn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-relative-imports",Bi=be.z.object({find:be.z.string(),replacement:be.z.string()}),qi=be.z.object({aliases:be.z.array(Bi),rootDir:be.z.string().optional(),allowNotFoundAliases:be.z.boolean().optional(),_dev_simulateFileName:be.z.string().optional()}),Gi=Xi({name:Mn,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:[$(qi)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function o(i,s){let l=nt.default.dirname(s);return nt.default.resolve(l,i)}function a(i){let s=t.rootDir??process.cwd(),l=nt.default.relative(s,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let m=l.replace(c,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let s=i.source.value;if(!n(s))return;let l=o(s,r),p=a(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),At={name:Mn,rule:Gi};var Z=require("@typescript-eslint/utils"),wt=require("zod/v4");var Zi=wt.z.object({customMessage:wt.z.string().optional()}),vt=J({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(Zi)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case Z.AST_NODE_TYPES.Literal:return!0;case Z.AST_NODE_TYPES.ObjectExpression:return n.properties.every(o=>o.type===Z.AST_NODE_TYPES.Property?o.computed||o.value.type===Z.AST_NODE_TYPES.Identifier&&o.key.type===Z.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:r(o.value):!1);case Z.AST_NODE_TYPES.ArrayExpression:return n.elements.every(o=>o?o.type===Z.AST_NODE_TYPES.SpreadElement?!1:r(o):!0);case Z.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case Z.AST_NODE_TYPES.ConditionalExpression:case Z.AST_NODE_TYPES.LogicalExpression:case Z.AST_NODE_TYPES.BinaryExpression:case Z.AST_NODE_TYPES.UnaryExpression:case Z.AST_NODE_TYPES.CallExpression:case Z.AST_NODE_TYPES.MemberExpression:case Z.AST_NODE_TYPES.Identifier:case Z.AST_NODE_TYPES.ArrowFunctionExpression:case Z.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===Z.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let o=null;n.value.type===Z.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==Z.AST_NODE_TYPES.JSXEmptyExpression&&(o=n.value.expression):n.value.type===Z.AST_NODE_TYPES.Literal&&(o=n.value),o&&r(o)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var He=require("@typescript-eslint/utils"),Ne=Ee(require("zod/v4"));var Ki=Ne.object({alternativeMsgs:Ne.object({inArrayFind:Ne.string().optional(),inArrayFilter:Ne.string().optional()}).optional(),__dev_simulateFileName:Ne.string().optional()});function Qi(e){return e.typeAnnotation.type!==He.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var es=/(typeGuards|type-guards)\.(ts|tsx)$/;function ts(e){return es.test(e)}function ns(e){let t=e.parent;for(;t;){if(t.type===He.AST_NODE_TYPES.CallExpression&&t.callee.type===He.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===He.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var kt=J({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:[$(Ki)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(ts(r))return{};function n(o){if(!Qi(o))return;let a=ns(o);if(t.alternativeMsgs&&a){let i=a.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let s=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:s,data:{message:i}});return}}e.report({node:o,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var De=require("@typescript-eslint/utils");var rs="no-unnecessary-async-on-jsx-props";function is(e){if(e.body.type!==De.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!==De.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===De.AST_NODE_TYPES.AwaitExpression}var Ft=J({name:rs,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){is(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let o=e.sourceCode,a=[],i=o.getFirstToken(r,l=>l.value==="async");if(i){let l=o.getTokenAfter(i);l?a.push(n.replaceTextRange([i.range[0],l.range[0]],"")):a.push(n.remove(i))}function s(l){if(l.type===De.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let c=o.getTokenAfter(p);c?a.push(n.replaceTextRange([p.range[0],c.range[0]],"")):a.push(n.remove(p))}}if(l.type===De.AST_NODE_TYPES.BlockStatement)for(let p of l.body)s(p);else l.type===De.AST_NODE_TYPES.ExpressionStatement&&s(l.expression)}return s(r.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Ce=require("@typescript-eslint/utils"),Pt=Ee(require("typescript")),_e=Ee(require("zod/v4"));var ss=Ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),jn="no-unnecessary-casting",os=_e.default.object({additionalCastFunctions:_e.default.array(_e.default.object({name:_e.default.string(),expectedType:_e.default.enum(["string","number"])})).optional()}),Ot={name:jn,rule:ss({name:jn,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:[$(os)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],o=Ce.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function i(c,m){switch(c.type){case Ce.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Ce.AST_NODE_TYPES.TemplateLiteral:return m==="string";case Ce.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function s(c,m){return m==="number"?!!(c.flags&Pt.TypeFlags.NumberLike):!!(c.flags&Pt.TypeFlags.StringLike)}function l(c,m){return f=>f.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!a||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Ce.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=c;if(f.type!==Ce.AST_NODE_TYPES.Identifier)return;let d=f.name,y=n.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||s(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,u;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...u?{data:u}:{},fix:l(c,m)})}}return{CallExpression:p}}})};var Je=require("@typescript-eslint/utils"),ye=Ee(require("zod/v4"));var as=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),Nt=J({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:[$(as)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(s){return Array.isArray(r)?r.includes(s):n.has(s)}function a(s){let{callee:l}=s;if(l.type===Je.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Je.AST_NODE_TYPES.Identifier)return p.name}return null}function i(s,l){if(s.type!==Je.AST_NODE_TYPES.Identifier||!s.typeAnnotation)return;let p=l.parent;if(p.type===Je.AST_NODE_TYPES.CallExpression){let c=a(p);c&&o(c)&&p.arguments.indexOf(l)===0&&e.report({node:s.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return s.typeAnnotation?f.remove(s.typeAnnotation):null}})}}return{ArrowFunctionExpression(s){for(let l of s.params)i(l,s)},FunctionExpression(s){for(let l of s.params)i(l,s)}}}});var le=require("@typescript-eslint/utils");var Dt=J({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===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=ls(t,e.sourceCode);if(n.length===0)return;let o=t.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let i of n){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let s=i.identifier.parent;if(s.object!==i.identifier)return;if(s.computed)if(s.property.type===le.AST_NODE_TYPES.Literal&&typeof s.property.value=="string")a.add(s.property.value);else return;else{if(s.property.type!==le.AST_NODE_TYPES.Identifier)return;a.add(s.property.name)}if(s.parent.type===le.AST_NODE_TYPES.CallExpression&&o)return}for(let[i,s]of r)a.has(i)||e.report({node:s,messageId:"unusedObjectProperty",data:{name:i}})}}}});function ls(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var H=require("@typescript-eslint/utils"),Fe=require("zod/v4");var ps=Fe.z.object({selectors:Fe.z.array(Fe.z.object({name:Fe.z.string(),selectorProp:Fe.z.string().optional(),selectorArgPos:Fe.z.number().optional(),returnProp:Fe.z.string().optional()}))}),cs=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ln="no-unused-selected-values",Mt={name:Ln,rule:cs({name:Ln,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(ps)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===H.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let i=fs(a);if(!i)return;let s=n.get(i);if(!s)return;let l=us(a,s.selectorArgPos??0,s.selectorProp);if(!l)return;let p=ms(l);if(!p)return;let c=_n(p.properties,void 0);if(!c)return;if(o.id.type===H.AST_NODE_TYPES.ObjectPattern){let d=_n(o.id.properties,s.returnProp);if(!d)return;for(let[y,E]of c)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==H.AST_NODE_TYPES.Identifier||s.returnProp)return;let m=ds(o,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==H.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==H.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of c)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function us(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===H.AST_NODE_TYPES.ArrowFunctionExpression||n.type===H.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===H.AST_NODE_TYPES.ObjectExpression){let o=n.properties.find(i=>i.type===H.AST_NODE_TYPES.Property&&i.key.type===H.AST_NODE_TYPES.Identifier&&i.key.name===r);if(o?.type!==H.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===H.AST_NODE_TYPES.ArrowFunctionExpression||a.type===H.AST_NODE_TYPES.FunctionExpression)return a}return null}function fs(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 ms(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function _n(e,t){let r=e;if(t){let o=e.find(a=>a.type===H.AST_NODE_TYPES.Property&&a.key.type===H.AST_NODE_TYPES.Identifier&&a.key.name===t);if(o?.type!==H.AST_NODE_TYPES.Property||o.value.type!==H.AST_NODE_TYPES.ObjectPattern)return null;r=o.value.properties}let n=new Map;for(let o of r){if(o.type!==H.AST_NODE_TYPES.Property||o.key.type!==H.AST_NODE_TYPES.Identifier)return null;n.set(o.key.name,o)}return n.size>0?n:null}function ds(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(o=>o.identifier!==e.id):[]}var Y=require("@typescript-eslint/utils");var jt=J({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===Y.AST_NODE_TYPES.ImportDeclaration&&a.source.value==="t-state-form"))return{};let n=null,o=!1;return{CallExpression(a){if(o)return;if(!n){let s=ys(a);s&&(n=s);return}let i=gs(a,e.sourceCode);if(i){o=!0;for(let s of i)n.delete(s);if(n.size!==0)for(let[s,l]of n)e.report({node:l,messageId:"unusedField",data:{name:s}})}}}}});function ys(e){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==Y.AST_NODE_TYPES.ObjectExpression)return null;let n=It(r.properties,a=>a.type!==Y.AST_NODE_TYPES.Property||a.key.type!==Y.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===Y.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===Y.AST_NODE_TYPES.FunctionExpression?Ss(a.value):null);if(!n)return null;let o=new Map;for(let a of n.properties)a.type===Y.AST_NODE_TYPES.Property&&a.key.type===Y.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function gs(e,t){if(!(e.callee.type===Y.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==Y.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==Y.AST_NODE_TYPES.ObjectPattern||!It(e.parent.id.properties,i=>i.type===Y.AST_NODE_TYPES.Property&&i.key.type===Y.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let o=Pn(e.parent,"formFields",t),a=new Set;for(let{identifier:i}of o){if(i.type!==Y.AST_NODE_TYPES.Identifier||i.parent.type===Y.AST_NODE_TYPES.Property&&i.parent.parent.type===Y.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===Y.AST_NODE_TYPES.ReturnStatement||i.parent.type===Y.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===Y.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==Y.AST_NODE_TYPES.Identifier||i.parent.property.type!==Y.AST_NODE_TYPES.Identifier)return null;a.add(i.parent.property.name)}}return a}function Ss(e){if(e.body.type===Y.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===Y.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===Y.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==Y.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var W=require("@typescript-eslint/utils"),Ye=require("zod/v4");var Ts=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function $n(e){let t=[];for(let r of e.members)r.type===W.AST_NODE_TYPES.TSPropertySignature&&r.key.type===W.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Un(e,...t){for(let r of t)e.set(...r);return e}var hs=Ye.z.object({forceCheckOnFCPropTypesWithName:Ye.z.array(Ye.z.string()).optional(),alwaysCheckFunctionOptionTypes:Ye.z.boolean().optional()}),zn="no-unused-type-props-in-args",Lt=null,Es=Ts({name:zn,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:[$(hs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!Lt&&(Lt=r.map(l=>new RegExp(l)));function o(l,p,c,m,f=!0,d=!1){let y=c.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&Lt?.some(g=>g.test(y)),u=d&&n;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!u)){if(x.type===W.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===W.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,m,x.body,!0,d);return}}}function a(l,p,c,m,f,d=!1){if(m.type===W.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===W.AST_NODE_TYPES.TSPropertySignature&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.set(y.key.name,y);return}if(m.type===W.AST_NODE_TYPES.TSTypeLiteral){Un(c,...$n(m));return}if(m.type===W.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)a(l,p,c,y,!0,d);return}f||m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier&&o(l,p,m.typeName,c,!0,d)}function i(l,p,c,m=!1){for(let f of c)if(f.type===W.AST_NODE_TYPES.ObjectPattern&&f.typeAnnotation){let d=new Map;if(a(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;s(f,d)}else f.type===W.AST_NODE_TYPES.AssignmentPattern&&f.left.type===W.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function s(l,p){let c=[];if(l.properties.at(-1)?.type===W.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===W.AST_NODE_TYPES.Property&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.push(y.key.name);let f=[],d=[];for(let[y,E]of p)c.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let u=l.properties.at(-1),x=d.join(", ");return u?u.type===W.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(u,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],c=new Map,m=p.id.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier)o(!0,l,m.typeName,c,!1);else if(m.type===W.AST_NODE_TYPES.TSTypeLiteral)Un(c,...$n(m));else if(m.type===W.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===W.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===W.AST_NODE_TYPES.Identifier?o(!0,l,f.typeName,c,!1):a(!0,l,c,f,!0);if(c.size!==0&&p.init?.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===W.AST_NODE_TYPES.ObjectPattern&&s(f,c)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),_t={name:zn,rule:Es};var ue=require("@typescript-eslint/utils");var $t=J({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===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let o of n.specifiers)o.type===ue.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ue.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&t.add(o.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(n).set.get(n.id.name);if(a){let i=!1;for(let s of a.references){let p=s.identifier.parent;if(p!==n&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var $e=require("@typescript-eslint/utils"),xs=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Vn="prefer-named-functions",Wn=new Map,bs=xs({name:Vn,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=Wn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Wn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===$e.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===$e.AST_NODE_TYPES.Identifier){let o=n.id.name;if(n.id.typeAnnotation||r&&r.test(o)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==$e.AST_NODE_TYPES.BlockStatement)return;let a=n.parent,i=n.init.params,s=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(s)}`)}]})}}}}}),Ut={name:Vn,rule:bs};var M=require("@typescript-eslint/utils"),ge=require("zod/v4");var Cs=ge.z.object({disallowedFunctions:ge.z.array(ge.z.object({name:ge.z.string(),allowUsingWithArgs:ge.z.boolean().optional(),hookAlternative:ge.z.string().optional(),message:ge.z.string().optional(),allowUseInside:ge.z.array(ge.z.string()).optional()}))}),Is=/^use[A-Z]/,Rs=/^[A-Z]/;function rt(e){return Is.test(e)}function Hn(e){return Rs.test(e)}function As(e){return e.type===M.AST_NODE_TYPES.Identifier?rt(e.name):e.type===M.AST_NODE_TYPES.MemberExpression&&e.property.type===M.AST_NODE_TYPES.Identifier?rt(e.property.name):!1}function Jn(e,t){return e.type===M.AST_NODE_TYPES.Identifier?e.name===t:e.type===M.AST_NODE_TYPES.MemberExpression&&e.object.type===M.AST_NODE_TYPES.Identifier&&e.property.type===M.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Yn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"forwardRef"))}function Xn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Jn(e.parent.callee,"memo"))}function zt(e){if(e.type===M.AST_NODE_TYPES.FunctionDeclaration||e.type===M.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.AST_NODE_TYPES.FunctionExpression||e.type===M.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===M.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function ws(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.AST_NODE_TYPES.FunctionDeclaration||t.type===M.AST_NODE_TYPES.FunctionExpression||t.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(t);if(n&&n.type===M.AST_NODE_TYPES.Identifier){if(Hn(n.name)||rt(n.name))return!r;r=!0}else{if(Yn(t)||Xn(t))return!r;if(t.parent.type===M.AST_NODE_TYPES.CallExpression){let o=t.parent;As(o.callee)||(r=!0)}else t.parent.type===M.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Bn(e){return e.callee.type===M.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===M.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===M.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function vs(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.AST_NODE_TYPES.FunctionDeclaration||r.type===M.AST_NODE_TYPES.FunctionExpression||r.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=zt(r);if(n&&n.type===M.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===M.AST_NODE_TYPES.CallExpression){let n=Bn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function ks(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Fs(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.AST_NODE_TYPES.FunctionDeclaration||n.type===M.AST_NODE_TYPES.FunctionExpression||n.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let o=zt(n);if(o&&o.type===M.AST_NODE_TYPES.Identifier){if(Hn(o.name)||rt(o.name)){r=!0;break}}else if(Yn(n)||Xn(n)){r=!0;break}}n=n.parent}return r?t.length===0?ws(e):!vs(e,t):!1}var Wt=J({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:[$(Cs)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(o=>[o.name,o]));return{CallExpression(o){let a=Bn(o);if(!a)return;let i=n.get(a);if(!i||i.allowUsingWithArgs&&ks(o))return;let s=i.allowUseInside||[];Fs(o,s)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:i.message?` ${i.message}`:` use ${i.hookAlternative} instead`},suggest:i.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${i.hookAlternative}`,hookAlternative:i.hookAlternative},fix:l=>{let p=i.hookAlternative;return p?o.callee.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===M.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var B=require("@typescript-eslint/utils"),it=Ee(require("zod/v4"));var Ps=B.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Gn="prefer-single-line-if",Os=it.default.object({maxLineLength:it.default.number().optional(),maxNonSimpleConditionLength:it.default.number().optional()}),Ns=Ps({name:Gn,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:[$(Os)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==B.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===B.AST_NODE_TYPES.ReturnStatement){if(!Kn(a))return}else if(!(a.type===B.AST_NODE_TYPES.ContinueStatement||a.type===B.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===B.AST_NODE_TYPES.LogicalExpression||n.test.type===B.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=qn(n.test);if(!m&&n.test.type===B.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;qn(f)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let s=r.getText(a);if(i.includes(`
|
|
16
|
-
`))return;let l=r.getTokenAfter(n);if(l&&l.type===
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(u),I=new Set,v=null;{let T=S.upper;for(;T&&(I.add(T),T.type!=="function");)T=T.upper;if(!T)return;v=T}let R=Array.isArray;function D(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node.type!=="VariableDeclarator")return!1;let k=C.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let P=C.node.parent;if(P==null&&(gt(v.block,C.node.id),P=C.node.parent,P==null))return!1;if(P.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let N=k.callee;if(N.type==="MemberExpression"&&N.object.name==="React"&&N.property!=null&&!N.computed&&(N=N.property),N.type!=="Identifier")return!1;let O=C.node.id,{name:j}=N;if(j==="useRef"&&O.type==="Identifier")return!0;if(Br(N)&&O.type==="Identifier"){for(let L of T.references)L!==O&&d.add(L.identifier);return!0}else if(j==="useState"||j==="useReducer"){if(O.type==="ArrayPattern"&&O.elements.length===2&&R(T.identifiers)){if(O.elements[1]===T.identifiers[0]){if(j==="useState"){let L=T.references,ce=0;for(let he=0;he<L.length;he++){if(L[he].isWrite()&&ce++,ce>1)return!1;p.set(L[he].identifier,O.elements[0])}}return!0}else if(O.elements[0]===T.identifiers[0]){if(j==="useState"){let L=T.references;for(let ce=0;ce<L.length;ce++)c.add(L[ce].identifier)}return!1}}}else if(j==="useTransition"&&O.type==="ArrayPattern"&&O.elements.length===2&&Array.isArray(T.identifiers)&&O.elements[1]===T.identifiers[0])return!0;return!1}function _(T){if(!R(T.defs))return!1;let C=T.defs[0];if(C==null||C.node==null||C.node.id==null)return!1;let k=C.node,P=v.childScopes,N=null,O;for(O=0;O<P.length;O++){let j=P[O],L=j.block;if(k.type==="FunctionDeclaration"&&L===k||k.type==="VariableDeclarator"&&L.parent===k){N=j;break}}if(N==null)return!1;for(O=0;O<N.through.length;O++){let j=N.through[O];if(j.resolved!=null&&I.has(j.resolved.scope)&&!K(j.resolved))return!1}return!0}let K=y(D,m),q=y(_,f),ee=new Map;function te(T){let C=T.from,k=!1;for(;C.block!==u;)C.type==="function"&&(k=C.block.parent!=null&&C.block.parent.type==="ReturnStatement"),C=C.upper;return k}let Y=new Map,de=new Map;Me(S);function Me(T){for(let C of T.references){if(!C.resolved||!I.has(C.resolved.scope))continue;let k=gt(u,C.identifier),P=En(k),N=xe(P,de);if(A&&P.type==="Identifier"&&(P.parent.type==="MemberExpression"||P.parent.type==="OptionalMemberExpression")&&!P.parent.computed&&P.parent.property.type==="Identifier"&&P.parent.property.name==="current"&&te(C)&&ee.set(N,{reference:C,dependencyNode:P}),P.parent.type==="TSTypeQuery"||P.parent.type==="TSTypeReference")continue;let O=C.resolved.defs[0];if(O!=null&&!(O.node!=null&&O.node.init===u.parent)&&O.type!=="TypeParameter")if(Y.has(N))Y.get(N).references.push(C);else{let j=C.resolved,L=K(j)||q(j);Y.set(N,{isStable:L,references:[C]})}}for(let C of T.childScopes)Me(C)}ee.forEach(({reference:T,dependencyNode:C},k)=>{let P=T.resolved.references,N=!1;for(let O=0;O<P.length;O++){let{identifier:j}=P[O],{parent:L}=j;if(L!=null&&L.type==="MemberExpression"&&!L.computed&&L.property.type==="Identifier"&&L.property.name==="current"&&L.parent.type==="AssignmentExpression"&&L.parent.left===L){N=!0;break}}N||o({node:C.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let ie=new Set;function Ie(T,C){ie.has(C)||(ie.add(C),o({node:T,message:`Assignments to the '${C}' variable from inside React Hook ${r(b)} 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(b)}.`}))}let pe=new Set;if(Y.forEach(({isStable:T,references:C},k)=>{T&&pe.add(k),C.forEach(P=>{P.writeExpr&&Ie(P.writeExpr,k)})}),ie.size>0)return;if(!x){let T=null;if(Y.forEach(({isStable:C,references:k},P)=>{T||k.forEach(N=>{if(T)return;let O=N.identifier;if(!p.has(O))return;let L=N.from;for(;L.type!=="function";)L=L.upper;L.block===u&&(T=P)})}),T){let{suggestedDependencies:C}=dt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:new Set,isEffect:!0});o({node:b,message:`React Hook ${g} contains a call to '${T}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+C.join(", ")+`] as a second argument to the ${g} Hook.`,suggest:[{desc:`Add dependencies array: [${C.join(", ")}]`,fix(k){return k.insertTextAfter(u,`, [${C.join(", ")}]`)}}]})}return}let Pe=[],ze=new Set;x.type!=="ArrayExpression"?o({node:x,message:`React Hook ${r(b)} 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.`}):x.elements.forEach(T=>{if(T===null)return;if(T.type==="SpreadElement"){o({node:T,message:`React Hook ${r(b)} has a spread element in its dependency array. This means we can't statically verify whether you've passed the correct dependencies.`});return}d.has(T)&&o({node:T,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${r(T)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${r(T)}\``,fix(N){return N.removeRange(T.range)}}]});let C;try{C=xe(T,de)}catch(N){if(/Unsupported node type/.test(N.message)){T.type==="Literal"?Y.has(T.value)?o({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. Did you mean to include ${T.value} in the array instead?`}):o({node:T,message:`The ${T.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):o({node:T,message:`React Hook ${r(b)} has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked.`});return}else throw N}let k=T;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let P=!v.through.some(N=>N.identifier===k);Pe.push({key:C,node:T}),P||ze.add(C)});let{suggestedDependencies:Cr,unnecessaryDependencies:qe,missingDependencies:Re,duplicateDependencies:ln}=dt({dependencies:Y,declaredDependencies:Pe,stableDependencies:pe,externalDependencies:ze,isEffect:A}),Ge=Cr;if(ln.size+Re.size+qe.size===0){if(t)return;Wr({declaredDependencies:Pe,declaredDependenciesNode:x,componentScope:v,scope:S}).forEach(({construction:C,isUsedOutsideOfHook:k,depType:P})=>{let N=P==="function"?"useCallback":"useMemo",O=P==="function"?"definition":"initialization",j=`wrap the ${O} of '${C.name.name}' in its own ${N}() Hook.`,L=k?`To fix this, ${j}`:`Move it inside the ${g} callback. Alternatively, ${j}`,ce=P==="conditional"||P==="logical expression"?"could make":"makes",he=`The '${C.name.name}' ${P} ${ce} the dependencies of ${g} Hook (at line ${x.loc.start.line}) change on every render. ${L}`,pn;k&&C.type==="Variable"&&P==="function"&&(pn=[{desc:`Wrap the ${O} of '${C.name.name}' in its own ${N}() Hook.`,fix(cn){let[Rr,Ar]=N==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[cn.insertTextBefore(C.node.init,Rr),cn.insertTextAfter(C.node.init,Ar)]}}]),o({node:C.node,message:he,suggest:pn})});return}!A&&Re.size>0&&(Ge=dt({dependencies:Y,declaredDependencies:[],stableDependencies:pe,externalDependencies:ze,isEffect:A}).suggestedDependencies);function Ir(){if(Pe.length===0)return!0;let T=Pe.map(k=>k.key),C=T.slice().sort();return T.join(",")===C.join(",")}Ir()&&Ge.sort();function pt(T){let C=T.split("."),k="";for(let P=0;P<C.length;P++){if(P!==0){let N=C.slice(0,P+1).join("."),O=de.get(N)===!0;k+=O?"?.":"."}k+=C[P]}return k}function ct(T,C,k,P){return T.size===0?null:(T.size>1?"":C+" ")+k+" "+(T.size>1?"dependencies":"dependency")+": "+Hr(Array.from(T).sort().map(N=>"'"+pt(N)+"'"))+`. Either ${P} ${T.size>1?"them":"it"} or remove the dependency array.`}let fe="";if(qe.size>0){let T=null;if(Array.from(qe.keys()).forEach(C=>{T===null&&C.endsWith(".current")&&(T=C)}),T!==null)fe=` Mutable values like '${T}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(ze.size>0){let C=Array.from(ze)[0];S.set.has(C)||(fe=` Outer scope values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!fe&&Re.has("props")){let T=Y.get("props");if(T==null)return;let C=T.references;if(!Array.isArray(C))return;let k=!0;for(let P=0;P<C.length;P++){let N=C[P],O=gt(v.block,N.identifier);if(!O){k=!1;break}let j=O.parent;if(j==null){k=!1;break}if(j.type!=="MemberExpression"&&j.type!=="OptionalMemberExpression"){k=!1;break}}k&&(fe=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${g} call and refer to those specific props inside ${r(b)}.`)}if(!fe&&Re.size>0){let T=null;Re.forEach(C=>{if(T)return;let k=v.set.get(C),P=Y.get(C);if(P.references[0].resolved!==k)return;let N=k.defs[0];if(N==null||N.name==null||N.type!=="Parameter")return;let O=!1,j;for(let L=0;L<P.references.length;L++)if(j=P.references[L].identifier,j!=null&&j.parent!=null&&(j.parent.type==="CallExpression"||j.parent.type==="OptionalCallExpression")&&j.parent.callee===j){O=!0;break}O&&(T=C)}),T!==null&&(fe=` If '${T}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!fe&&Re.size>0){let T=null;if(Re.forEach(C=>{if(T!==null)return;let P=Y.get(C).references,N,O;for(let j=0;j<P.length;j++){for(N=P[j].identifier,O=N.parent;O!=null&&O!==v.block;){if(O.type==="CallExpression"){let L=p.get(O.callee);if(L!=null){if(L.name===C)T={missingDep:C,setter:O.callee.name,form:"updater"};else if(c.has(N))T={missingDep:C,setter:O.callee.name,form:"reducer"};else{let ce=P[j].resolved;if(ce!=null){let he=ce.defs[0];he!=null&&he.type==="Parameter"&&(T={missingDep:C,setter:O.callee.name,form:"inlineReducer"})}}break}}O=O.parent}if(T!==null)break}}),T!==null)switch(T.form){case"reducer":fe=` You can also replace multiple useState variables with useReducer if '${T.setter}' needs the current value of '${T.missingDep}'.`;break;case"inlineReducer":fe=` If '${T.setter}' needs the current value of '${T.missingDep}', you can also switch to useReducer instead of useState and read '${T.missingDep}' in the reducer.`;break;case"updater":fe=` You can also do a functional update '${T.setter}(${T.missingDep.slice(0,1)} => ...)' if you only need '${T.missingDep}' in the '${T.setter}' call.`;break;default:throw new Error("Unknown case.")}}o({node:x,message:`React Hook ${r(b)} has `+(ct(Re,"a","missing","include")||ct(qe,"an","unnecessary","exclude")||ct(ln,"a","duplicate","omit"))+fe,suggest:[{desc:`Update the dependencies array to be: [${Ge.map(pt).join(", ")}]`,fix(T){return T.replaceText(x,`[${Ge.map(pt).join(", ")}]`)}}]})}function h(u){let x=Vr(u.callee,i);if(x===-1)return;let b=u.arguments[x],g=u.callee,A=xn(g).name,S=u.arguments[x+1],I=/Effect($|[^a-z])/g.test(A);if(!b){o({node:g,message:`React Hook ${A} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(t&&!I)){if(!S&&!I){(A==="useMemo"||A==="useCallback")&&o({node:g,message:`React Hook ${A} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(b.type){case"FunctionExpression":case"ArrowFunctionExpression":E(b,S,g,A,I);return;case"Identifier":if(!S||S.elements&&S.elements.some(D=>D&&D.type==="Identifier"&&D.name===b.name))return;let v=n(u).set.get(b.name);if(v==null||v.defs==null)return;let R=v.defs[0];if(!R||!R.node||R.type!=="Variable"&&R.type!=="FunctionName")break;switch(R.node.type){case"FunctionDeclaration":E(R.node,S,g,A,I);return;case"VariableDeclarator":let D=R.node.init;if(!D)break;switch(D.type){case"ArrowFunctionExpression":case"FunctionExpression":E(D,S,g,A,I);return}break}break;default:o({node:g,message:`React Hook ${A} received a function whose dependencies are unknown. Pass an inline function instead.`});return}o({node:g,message:`React Hook ${A} has a missing dependency: '${b.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${b.name}]`,fix(v){return v.replaceText(S,`[${b.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let u of e.sourceCode.getAllComments())if(zr.test(u.value))return t=!0,{CallExpression:x=>h(x,!0)}}return{CallExpression:u=>h(u)}}};function dt({dependencies:e,declaredDependencies:t,stableDependencies:r,externalDependencies:n,isEffect:a}){let s=i();function i(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((E,h)=>{let u=o(s,h);u.isUsed=!0,l(s,h,x=>{x.isSubtreeUsed=!0})}),t.forEach(({key:E})=>{let h=o(s,E);h.isSatisfiedRecursively=!0}),r.forEach(E=>{let h=o(s,E);h.isSatisfiedRecursively=!0});function o(E,h){let u=h.split("."),x=E;for(let b of u){let g=x.children.get(b);g||(g=i(),x.children.set(b,g)),x=g}return x}function l(E,h,u){let x=h.split("."),b=E;for(let g of x){let A=b.children.get(g);if(!A)return;u(A),b=A}}let p=new Set,c=new Set;m(s,p,c,E=>E);function m(E,h,u,x){E.children.forEach((b,g)=>{let A=x(g);if(b.isSatisfiedRecursively){b.isSubtreeUsed&&u.add(A);return}if(b.isUsed){h.add(A);return}m(b,h,u,S=>A+"."+S)})}let f=[],d=new Set,y=new Set;return t.forEach(({key:E})=>{c.has(E)?f.indexOf(E)===-1?f.push(E):y.add(E):d.add(E)}),p.forEach(E=>{f.push(E)}),{suggestedDependencies:f,unnecessaryDependencies:d,duplicateDependencies:y,missingDependencies:p}}function we(e){switch(e.type){case"ObjectExpression":return"object";case"ArrayExpression":return"array";case"ArrowFunctionExpression":case"FunctionExpression":return"function";case"ClassExpression":return"class";case"ConditionalExpression":return we(e.consequent)!=null||we(e.alternate)!=null?"conditional":null;case"LogicalExpression":return we(e.left)!=null||we(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return we(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return we(e.expression);case"TSAsExpression":return we(e.expression)}return null}function Wr({declaredDependencies:e,declaredDependenciesNode:t,componentScope:r,scope:n}){let a=e.map(({key:i})=>{let o=r.variables.find(p=>p.name===i);if(o==null)return null;let l=o.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=we(l.node.init);if(p!=null)return[o,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[o,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[o,"class"]:null}).filter(Boolean);function s(i){let o=!1;for(let l=0;l<i.references.length;l++){let p=i.references[l];if(p.writeExpr){if(o)return!0;o=!0;continue}let c=p.from;for(;c!==n&&c!=null;)c=c.upper;if(c!==n&&!bn(t,p.identifier))return!0}return!1}return a.map(([i,o])=>({construction:i.defs[0],depType:o,isUsedOutsideOfHook:s(i)}))}function En(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)?En(e.parent):e.type==="MemberExpression"&&e.parent&&e.parent.type==="AssignmentExpression"&&e.parent.left===e?e.object:e}function yt(e,t,r){t&&(e.optional?t.has(r)||t.set(r,!0):t.has(r)||t.set(r,!1))}function xe(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=xe(e.object,t),n=xe(e.property,null),a=`${r}.${n}`;return yt(e,t,a),a}else if(e.type==="OptionalMemberExpression"&&!e.computed){let r=xe(e.object,t),n=xe(e.property,null),a=`${r}.${n}`;return yt(e,t,a),a}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=xe(r.object,t),a=xe(r.property,null),s=`${n}.${a}`;return yt(r,t,s),s}else throw new Error(`Unsupported node type: ${e.type}`)}function xn(e,t){return e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="React"&&e.property.type==="Identifier"&&!e.computed?e.property:e}function Vr(e,t){let r=xn(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=xe(r,null)}catch(a){if(/Unsupported node type/.test(a.message))return 0;throw a}return t.additionalHooks.test(n)?0:-1}else return-1}}function gt(e,t){let r=[e],n=null;for(;r.length;){if(n=r.shift(),Jr(n,t))return n;if(bn(n,t))for(let[a,s]of Object.entries(n))a!=="parent"&&(Tn(s)?(s.parent=n,r.push(s)):Array.isArray(s)&&s.forEach(i=>{Tn(i)&&(i.parent=n,r.push(i))}))}return null}function Hr(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 Tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.type=="string"}function Jr(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 bn(e,t){return e.range[0]<=t.range[0]&&e.range[1]>=t.range[1]}function Br(e){return!1}var ve=require("@typescript-eslint/utils"),re=Ee(require("typescript")),In=require("zod/v4");var Yr=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Cn="improved-no-unnecessary-condition",Xr=In.z.object({}),qr=["string","number","bigint","boolean","symbol","undefined","object","function","never"],Gr=new Set(qr),St={name:Cn,rule:Yr({name:Cn,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}}".'},schema:[$(Xr)]},defaultOptions:[{}],create(e){let t=ve.ESLintUtils.getParserServices(e,!0),r=t.program?.getTypeChecker();if(!r||!t.program)throw new Error("TypeScript services or program not available");function n(o){return o.type===ve.AST_NODE_TYPES.UnaryExpression&&o.operator==="typeof"}function a(o){return o.flags&re.default.TypeFlags.Any||o.flags&re.default.TypeFlags.Unknown?null:o.flags&re.default.TypeFlags.StringLike?["string"]:o.flags&re.default.TypeFlags.NumberLike?["number"]:o.flags&re.default.TypeFlags.BigIntLike?["bigint"]:o.flags&re.default.TypeFlags.BooleanLike?["boolean"]:o.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:o.flags&re.default.TypeFlags.Undefined||o.flags&re.default.TypeFlags.Void?["undefined"]:o.flags&re.default.TypeFlags.Null?["object"]:o.getCallSignatures().length>0?["function"]:o.flags&re.default.TypeFlags.Object?o.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:o.flags&re.default.TypeFlags.NonPrimitive?["object"]:o.flags&re.default.TypeFlags.Never?["never"]:null}function s(o){if(!r)return null;let l=t.esTreeNodeToTSNodeMap.get(o),p=r.getTypeAtLocation(l.expression);if(p.flags&re.default.TypeFlags.Any||p.flags&re.default.TypeFlags.Unknown)return null;let c=[];if(p.isUnion()){for(let f of p.types){let d=a(f);if(d)c.push(...d);else return null}return c}let m=a(p);return m?(c.push(...m),c):null}function i(o){if(!(o.operator==="==="||o.operator==="!=="))return;let p=null,c=null;if(n(o.left)?(p=o.left,c=o.right.type===ve.AST_NODE_TYPES.Literal&&typeof o.right.value=="string"?o.right.value:null):n(o.right)&&(p=o.right,c=o.left.type===ve.AST_NODE_TYPES.Literal&&typeof o.left.value=="string"?o.left.value:null),!p||!c||!Zr(c,Gr))return;let m=s(p);if(!m)return;let f=o.operator==="!==",d=m.includes(c);m.length===1?d&&!f?e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:c}}):!d&&f?e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Array.from(m)[0]}}):!d&&!f?e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ke(m),conditionType:c}}):d&&f&&e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ke(m),conditionType:c}}):!d&&!f?e.report({node:o,messageId:"alwaysFalseTypeofCondition",data:{name:je(p,e),actualType:Ke(m),conditionType:c}}):!d&&f&&e.report({node:o,messageId:"unnecessaryTypeofCondition",data:{name:je(p,e),type:Ke(m)}})}return{BinaryExpression:i}}})};function Ke(e){return Array.from(new Set(e)).join(" | ")||"never"}function je(e,t){let r=e.argument;return r.type===ve.AST_NODE_TYPES.Identifier?r.name:t.sourceCode.getText(r)}function Zr(e,t){return t.has(e)}var et=require("@typescript-eslint/utils"),Qe=require("zod/v4");var Kr=et.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Rn="no-call-with-explicit-generics",Qr=Qe.z.object({functions:Qe.z.array(Qe.z.string())}),ei=Kr({name:Rn,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:[$(Qr)]},defaultOptions:[{functions:[]}],create(e,[t]){let r=new Set(t.functions);return{CallExpression(n){let{callee:a}=n;a.type===et.AST_NODE_TYPES.Identifier&&r.has(a.name)&&n.typeArguments&&e.report({node:n,messageId:"noExplicitGenerics",data:{functionName:a.name}})}}}}),Tt={name:Rn,rule:ei};var Oe=require("@typescript-eslint/utils"),ti=Oe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),An="no-call-with-inferred-generics",ni=ti({name:An,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:a}=n;if(a.type!==Oe.AST_NODE_TYPES.Identifier)return;let s=r.get(a.name);if(!s)return;let{minGenerics:i=1,allowAny:o,disallowTypes:l=t.disallowTypes}=s;(n.typeArguments?.params.length||0)<(i||0)&&e.report({node:n,messageId:"missingGenericDeclaration",data:{functionName:a.name,minGenerics:i||0}}),!(o&&!l)&&n.typeArguments?.params.some(c=>!o&&c.type===Oe.AST_NODE_TYPES.TSAnyKeyword||l&&c.type===Oe.AST_NODE_TYPES.TSTypeReference&&c.typeName.type===Oe.AST_NODE_TYPES.Identifier&&l.includes(c.typeName.name))&&e.report({node:n,messageId:"anyUsedInGenerics",data:{functionName:a.name}})}}}}),ht={name:An,rule:ni};var kn=require("@typescript-eslint/utils"),ri=kn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fn="no-commented-out-code",ii=["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:"],si=/^\s*return\s+/,oi=/\w=("|'|`)/,ai=/\w+:\s*('|"|`)/,li=/\[['"][^'"]*['"]\]:\s*('|"|`|[^'"`\s])/,pi=/\w+-\w+:/,ci=/\w+_\w+:/,ui=/\?\s+\w/,fi=/:\s+\w/,mi=/^\s*('|"|`)[^'"]*('|"|`),?\s*$/,di=/^\s*\d+[,}]/,yi=/^\s*\[[^\]]*\][,}]/,gi=/^\s*\{[^}]*\}[,}]/,Si=/\.\w+\(/,Ti=/\[\w+\]/,hi=/^\s*(['"`]).+?\1\s*:/,Ei=/^<[A-Z]\w*(\s|>|\/)/,xi=/^<[a-z]+(\s|>|\/)/,bi=/<[A-Z]\w*(\s.*)?>/,Ci=/<\/[A-Z]\w*>/,Ii=/<[a-z]+(\s.*)?>/,Ri=/<\/[a-z]+>/,Ai=/^\s*[*\s]*$/,wi=/^[a-zA-Z]/,vi=/^[A-Z][A-Za-z]*(?:\s+\d+)?(?:\s+[a-z]+)*:\s+[A-Za-z]/,ki=/```[\s\S]*?```/g,Fi=/`[^`]*`/g,wn=/[a-zA-Z0-9]/,Pi=/\.[A-Za-z_][A-Za-z0-9_]*\(/,Oi=/[{}[\]()`=<>]/,Ni=/:\s*(['"`[{(]|\w+\s*=>)/,Di=/\bif\s*\(|\belse\b|=>/,G={returnStatement:si,stringAssignment:oi,objectPropertyWithQuotes:ai,computedPropertyAssignment:li,kebabCaseProperty:pi,snakeCaseProperty:ci,ternaryOperator:ui,colonWithWord:fi,quotedString:mi,numberWithComma:di,arrayWithComma:yi,objectWithComma:gi,methodCall:Si,arrayAccess:Ti,quotedPropertyKey:hi,jsxSelfClosing:Ei,jsxElement:xi,jsxOpeningTag:bi,jsxClosingTag:Ci,htmlOpeningTag:Ii,htmlClosingTag:Ri,jsdocComment:Ai};function Mi(e){if(e.includes(":")){let r=e.split(":")[0]?.trim();if(r&&wi.test(r)&&r.includes(" "))return!0}let t=e.trim();return t.length===0||Pi.test(t)||Oi.test(t)||Ni.test(t)||Di.test(t)?!1:!!(t.includes(":")&&vi.test(t))}var ji=[") {","return;",G.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",G.stringAssignment,");",G.objectPropertyWithQuotes,G.computedPropertyAssignment,G.kebabCaseProperty,G.snakeCaseProperty,"&&","||","()",G.ternaryOperator,G.colonWithWord,G.quotedString,G.numberWithComma,G.arrayWithComma,G.objectWithComma,G.methodCall,G.arrayAccess,"?.(","??","=>",G.quotedPropertyKey],Li=["/>","</",G.jsxSelfClosing,G.jsxElement,G.jsxOpeningTag,G.jsxClosingTag,G.htmlOpeningTag,G.htmlClosingTag],vn=["INFO:","TODO:","DOCS:","FIX:","FIXME:","HACK:","NOTE:","WARNING:","WARN:","BUG:","ISSUE:","TEMP:","TEMPORARY:","XXX:","REVIEW:","eslint"],_i=ri({name:Fn,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,a){if(n.startsWith("/"))return!1;let s=n.trimStart();if(n.startsWith("*")||s.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")||G.jsdocComment.test(n))return!1;for(let i of vn)if(s.startsWith(i))return!1;if(n.includes("https://")||Mi(s))return!1;if(a==="Block"){for(let i of Li)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 ii)if(s.startsWith(i))return{wrongPattern:i};for(let i of ji)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,a){let s=n,i=s.trim();if(i.startsWith("`")&&(i.endsWith("`,")||i.endsWith("`;")||i.endsWith("`")))return s;if(a==="Block"&&s.includes("```")){let p=s.split(ki);p.some(m=>wn.test(m))&&(s=p.join(""))}if(!s.includes("`"))return s;let o=s.split(Fi);return o.some(p=>wn.test(p))?o.join(""):s}return{Program(){let a=e.sourceCode.getAllComments();for(let s of a){let i=r(s.value,s.type),o=t(i,s.type);o&&e.report({node:s,messageId:"commentedOutCode",data:{wrongPattern:o.wrongPattern,allowedPrefixes:vn.join(", ")}})}}}}}),Et={name:Fn,rule:_i};var tt=require("@typescript-eslint/utils"),$i=tt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="no-default-export",Ui=$i({name:Pn,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===tt.TSESTree.AST_NODE_TYPES.Identifier&&r.exported.name==="default"&&e.report({node:t,messageId:"noDefaultExport"})}}}}),xt={name:Pn,rule:Ui};var On=require("@typescript-eslint/utils"),zi=On.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Nn="no-leaked-text-in-jsx",Wi=[",",";","[","]","(",")"],Vi=zi({name:Nn,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="";Wi.includes(r)?n=r:r.includes("&&")?n="&&":r.includes("||")?n="||":r.endsWith("? (")&&(n="? ("),n&&e.report({node:t,messageId:"leakedTextInJSX",data:{text:n}})}}}}),bt={name:Nn,rule:Vi};var ke=require("@typescript-eslint/utils"),Hi=ke.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Mn="no-non-camel-case-functions",Ji=/^(\$?[a-z][a-zA-Z0-9]*)$/;function Dn(e){if(e.typeName.type!==ke.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:t,right:r}=e.typeName;return t.type===ke.AST_NODE_TYPES.Identifier&&t.name==="JSX"&&r.name==="Element"}var Bi=Hi({name:Mn,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&&!Ji.test(t.id.name)){let r=t.returnType?.typeAnnotation;if(r&&(r.type===ke.AST_NODE_TYPES.TSTypeReference?Dn(r):r.type===ke.AST_NODE_TYPES.TSUnionType&&r.types.some(a=>a.type===ke.AST_NODE_TYPES.TSTypeReference&&Dn(a))))return;e.report({node:t.id,messageId:"nonCamelCaseFunction",data:{functionName:t.id.name}})}}}}}),Ct={name:Mn,rule:Bi};var V=require("@typescript-eslint/utils");var It=require("@typescript-eslint/utils");function Le(e,t,r=1/0){if(r!==0&&e.parent)return e.type===t?e:Le(e.parent,t,r===1/0?r:r-1)}function*Rt(e){yield e,e.parent&&(yield*Rt(e.parent))}function At(e,t){for(let r of e){let n=t(r);if(n!=null&&n!==!1)return n}}function Ln(e,t,r){let a=r.getDeclaredVariables(e).find(s=>s.name===t||s.identifiers[0]?.parent.type===It.AST_NODE_TYPES.Property&&s.identifiers[0].parent.key.type===It.AST_NODE_TYPES.Identifier&&s.identifiers[0].parent.key.name===t);return a?a.references.filter(s=>!s.init):[]}function jn(e){return e===null||typeof e!="object"||!("type"in e)?!1:typeof e.type=="string"}function Yi(e,t){return e[t]}function wt(e,t,r){let n=r.visitorKeys,a=new Set;function s(i){if(a.has(i))return!1;if(a.add(i),t(i)===!0)return!0;let l=n[i.type];if(l)for(let p of l){let c=Yi(i,p);if(c){if(Array.isArray(c)){for(let m of c)if(jn(m)&&s(m))return!0}else if(jn(c)&&s(c))return!0}}return!1}s(e)}var Xi=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),_n="no-optional-root-props",qi=Xi({name:_n,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 s=e.sourceCode.getDeclaredVariables(n)[0];if(!s||s.references.length!==1)return!1;let i=s.references[0];if(!i)return!1;for(let o of Rt(i.identifier)){if("returnType"in o||o.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=o.parent;if(!l)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===V.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===V.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let c=Le(l.parent.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!c)return!1;let m=nt(c,e.sourceCode);return m?!(m.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&m.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&m.parent.callee.name==="memo"):!1}if(o.type===V.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===V.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=Le(l,V.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!nt(p,e.sourceCode):!1}if(l.type===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!nt(l,e.sourceCode)}return!1}function r(n){n.key.type!==V.TSESTree.AST_NODE_TYPES.Identifier||!n.optional||e.report({node:n.key,messageId:"optionalNotAllowed",data:{propertyName:n.key.name},suggest:[{messageId:"suggestion",fix:a=>{let s=Le(n,V.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!s)return null;let i=e.sourceCode.getText(s);return a.replaceText(s,i.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(n){if(n.typeAnnotation.type===V.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(rt(n)||!t(n)))for(let a of n.typeAnnotation.members)a.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(a)},TSInterfaceDeclaration(n){if(!(rt(n)||!t(n)))for(let a of n.body.body)a.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(a)},TSTypeReference(n){if(n.typeName.type!==V.TSESTree.AST_NODE_TYPES.Identifier||n.typeName.name!=="FC"||!n.typeArguments?.params[0])return;let a=n.typeArguments.params[0];if(a.type!==V.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let s=Le(n.parent,V.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!s)return;let i=nt(s,e.sourceCode);if(!(!i||i.parent.type===V.TSESTree.AST_NODE_TYPES.CallExpression&&i.parent.callee.type===V.TSESTree.AST_NODE_TYPES.Identifier&&i.parent.callee.name==="memo"))for(let l of a.members)l.type===V.TSESTree.AST_NODE_TYPES.TSPropertySignature&&r(l)}}}});function rt(e){return e?e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===V.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function nt(e,t){if(rt(e))return;let r;if(e.type===V.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===V.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===V.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&n.upper&&(n=n.upper);let a=n.variables.find(i=>i.identifiers.includes(r));if(!a)return;let s=a.references.filter(i=>i.identifier!==r);if(!(s.length!==1||!s[0])&&!rt(s[0].identifier.parent.parent))return s[0].identifier}var vt={name:_n,rule:qi};var We=require("@typescript-eslint/utils");var Ve=J({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===We.AST_NODE_TYPES.Identifier?t.has(n.name):n.type===We.AST_NODE_TYPES.MemberExpression?r(n.object):!1:!1}return{ImportDeclaration(n){for(let a of n.specifiers)t.add(a.local.name)},ExportNamedDeclaration(n){if(n.source){e.report({node:n,messageId:"noReexport"});return}if(n.declaration?.type===We.AST_NODE_TYPES.VariableDeclaration)for(let a of n.declaration.declarations)r(a.init)&&e.report({node:n,messageId:"noReexport"});n.specifiers.length>0&&e.report({node:n,messageId:"noReexport"})},ExportDefaultDeclaration(n){n.declaration.type===We.AST_NODE_TYPES.Identifier&&t.has(n.declaration.name)&&e.report({node:n,messageId:"noReexport"})},ExportAllDeclaration(n){e.report({node:n,messageId:"noReexport"})}}}});var $n=require("@typescript-eslint/utils"),it=Ee(require("path")),be=require("zod/v4");var Gi=$n.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Un="no-relative-imports",Zi=be.z.object({find:be.z.string(),replacement:be.z.string()}),Ki=be.z.object({aliases:be.z.array(Zi),rootDir:be.z.string().optional(),allowNotFoundAliases:be.z.boolean().optional(),_dev_simulateFileName:be.z.string().optional()}),Qi=Gi({name:Un,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:[$(Ki)]},defaultOptions:[{aliases:[],rootDir:void 0}],create(e,[t]){let r=t._dev_simulateFileName??e.filename;function n(i){return i.startsWith(".")||i.startsWith("..")}function a(i,o){let l=it.default.dirname(o);return it.default.resolve(l,i)}function s(i){let o=t.rootDir??process.cwd(),l=it.default.relative(o,i);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:c}of t.aliases)if(l.startsWith(c)){let m=l.replace(c,p);return{alias:p,newPath:m}}return null}return{ImportDeclaration(i){let o=i.source.value;if(!n(o))return;let l=a(o,r),p=s(l);!p&&t.allowNotFoundAliases||e.report({node:i,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?c=>c.replaceText(i.source,`'${p.newPath}'`):void 0})}}}}),kt={name:Un,rule:Qi};var Z=require("@typescript-eslint/utils"),Ft=require("zod/v4");var es=Ft.z.object({customMessage:Ft.z.string().optional()}),Pt=J({name:"no-static-style-prop",meta:{type:"problem",docs:{description:"Prevent using static style props in JSX, only dynamic values should be allowed"},schema:[$(es)],messages:{noStaticStyleProp:"Static style props are not allowed use css instead.{{customMessage}}"}},defaultOptions:[{}],create(e,[t]){function r(n){switch(n.type){case Z.AST_NODE_TYPES.Literal:return!0;case Z.AST_NODE_TYPES.ObjectExpression:return n.properties.every(a=>a.type===Z.AST_NODE_TYPES.Property?a.computed||a.value.type===Z.AST_NODE_TYPES.Identifier&&a.key.type===Z.AST_NODE_TYPES.Identifier&&a.key.name===a.value.name?!1:r(a.value):!1);case Z.AST_NODE_TYPES.ArrayExpression:return n.elements.every(a=>a?a.type===Z.AST_NODE_TYPES.SpreadElement?!1:r(a):!0);case Z.AST_NODE_TYPES.TemplateLiteral:return n.expressions.length===0;case Z.AST_NODE_TYPES.ConditionalExpression:case Z.AST_NODE_TYPES.LogicalExpression:case Z.AST_NODE_TYPES.BinaryExpression:case Z.AST_NODE_TYPES.UnaryExpression:case Z.AST_NODE_TYPES.CallExpression:case Z.AST_NODE_TYPES.MemberExpression:case Z.AST_NODE_TYPES.Identifier:case Z.AST_NODE_TYPES.ArrowFunctionExpression:case Z.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(n){if(n.name.type===Z.AST_NODE_TYPES.JSXIdentifier&&n.name.name==="style"&&n.value){let a=null;n.value.type===Z.AST_NODE_TYPES.JSXExpressionContainer?n.value.expression.type!==Z.AST_NODE_TYPES.JSXEmptyExpression&&(a=n.value.expression):n.value.type===Z.AST_NODE_TYPES.Literal&&(a=n.value),a&&r(a)&&e.report({node:n,messageId:"noStaticStyleProp",data:{customMessage:t.customMessage?` ${t.customMessage}`:""}})}}}}});var He=require("@typescript-eslint/utils"),Ne=Ee(require("zod/v4"));var ts=Ne.object({alternativeMsgs:Ne.object({inArrayFind:Ne.string().optional(),inArrayFilter:Ne.string().optional()}).optional(),__dev_simulateFileName:Ne.string().optional()});function ns(e){return e.typeAnnotation.type!==He.AST_NODE_TYPES.TSTypePredicate?!1:e.typeAnnotation.asserts===!1}var rs=/(typeGuards|type-guards)\.(ts|tsx)$/;function is(e){return rs.test(e)}function ss(e){let t=e.parent;for(;t;){if(t.type===He.AST_NODE_TYPES.CallExpression&&t.callee.type===He.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===He.AST_NODE_TYPES.Identifier){let r=t.callee.property.name;if(r==="filter"||r==="find")return{method:r}}t=t.parent}return null}var Ot=J({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:[$(ts)],hasSuggestions:!0},defaultOptions:[{}],create(e,[t]){let r=t.__dev_simulateFileName??e.filename;if(is(r))return{};function n(a){if(!ns(a))return;let s=ss(a);if(t.alternativeMsgs&&s){let i=s.method==="filter"?t.alternativeMsgs.inArrayFilter:t.alternativeMsgs.inArrayFind;if(i){let o=s.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:a,messageId:o,data:{message:i}});return}}e.report({node:a,messageId:"typeGuardNotAllowed"})}return{"FunctionDeclaration > :matches(TSTypeAnnotation)":n,"ArrowFunctionExpression > :matches(TSTypeAnnotation)":n,"MethodDefinition > FunctionExpression > :matches(TSTypeAnnotation)":n}}});var De=require("@typescript-eslint/utils");var os="no-unnecessary-async-on-jsx-props";function as(e){if(e.body.type!==De.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!==De.AST_NODE_TYPES.ExpressionStatement?!1:r.expression.type===De.AST_NODE_TYPES.AwaitExpression}var Nt=J({name:os,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){as(r)&&e.report({node:r,messageId:"unnecessaryAsyncInJsxProp",fix(n){let a=e.sourceCode,s=[],i=a.getFirstToken(r,l=>l.value==="async");if(i){let l=a.getTokenAfter(i);l?s.push(n.replaceTextRange([i.range[0],l.range[0]],"")):s.push(n.remove(i))}function o(l){if(l.type===De.AST_NODE_TYPES.AwaitExpression){let p=a.getFirstToken(l);if(p&&p.value==="await"){let c=a.getTokenAfter(p);c?s.push(n.replaceTextRange([p.range[0],c.range[0]],"")):s.push(n.remove(p))}}if(l.type===De.AST_NODE_TYPES.BlockStatement)for(let p of l.body)o(p);else l.type===De.AST_NODE_TYPES.ExpressionStatement&&o(l.expression)}return o(r.body),s}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":t,"JSXAttribute FunctionExpression[async=true]":t}}});var Ce=require("@typescript-eslint/utils"),Dt=Ee(require("typescript")),_e=Ee(require("zod/v4"));var ls=Ce.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),zn="no-unnecessary-casting",ps=_e.default.object({additionalCastFunctions:_e.default.array(_e.default.object({name:_e.default.string(),expectedType:_e.default.enum(["string","number"])})).optional()}),Mt={name:zn,rule:ls({name:zn,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:[$(ps)],fixable:"code"},defaultOptions:[{}],create(e){let r=e.options[0].additionalCastFunctions||[],n=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...r],a=Ce.ESLintUtils.getParserServices(e,!0),s=a.program?.getTypeChecker();if(!s||!a.program)throw new Error("TypeScript services or program not available");function i(c,m){switch(c.type){case Ce.AST_NODE_TYPES.Literal:return m==="number"?typeof c.value=="number":typeof c.value=="string";case Ce.AST_NODE_TYPES.TemplateLiteral:return m==="string";case Ce.AST_NODE_TYPES.UnaryExpression:return m==="number"?c.operator==="+"||c.operator==="-"||c.operator==="~":!1;default:return!1}}function o(c,m){return m==="number"?!!(c.flags&Dt.TypeFlags.NumberLike):!!(c.flags&Dt.TypeFlags.StringLike)}function l(c,m){return f=>f.replaceText(c,e.sourceCode.getText(m))}function p(c){if(!s||c.arguments.length!==1)return;let m=c.arguments[0];if(!m||m.type===Ce.AST_NODE_TYPES.SpreadElement)return;let{callee:f}=c;if(f.type!==Ce.AST_NODE_TYPES.Identifier)return;let d=f.name,y=n.find(h=>h.name===d);if(!y)return;if(i(m,y.expectedType)||o(s.getTypeAtLocation(a.esTreeNodeToTSNodeMap.get(m)),y.expectedType)){let h,u;d==="Number"?h="unnecessaryNumberCasting":d==="String"?h="unnecessaryStringCasting":(h="unnecessaryCustomCasting",u={name:y.name,type:y.expectedType}),e.report({node:c,messageId:h,...u?{data:u}:{},fix:l(c,m)})}}return{CallExpression:p}}})};var Je=require("@typescript-eslint/utils"),ye=Ee(require("zod/v4"));var cs=ye.object({methods:ye.union([ye.array(ye.string()),ye.literal("array")])}),jt=J({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:[$(cs)]},defaultOptions:[{methods:"array"}],create(e,[t]){let r=t.methods,n=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function a(o){return Array.isArray(r)?r.includes(o):n.has(o)}function s(o){let{callee:l}=o;if(l.type===Je.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Je.AST_NODE_TYPES.Identifier)return p.name}return null}function i(o,l){if(o.type!==Je.AST_NODE_TYPES.Identifier||!o.typeAnnotation)return;let p=l.parent;if(p.type===Je.AST_NODE_TYPES.CallExpression){let c=s(p);c&&a(c)&&p.arguments.indexOf(l)===0&&e.report({node:o.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(f){return o.typeAnnotation?f.remove(o.typeAnnotation):null}})}}return{ArrowFunctionExpression(o){for(let l of o.params)i(l,o)},FunctionExpression(o){for(let l of o.params)i(l,o)}}}});var le=require("@typescript-eslint/utils");var Lt=J({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===le.AST_NODE_TYPES.ObjectPattern||!t.init||t.init.type!==le.AST_NODE_TYPES.ObjectExpression||t.id.type===le.AST_NODE_TYPES.Identifier&&t.id.typeAnnotation||t.parent.parent.type===le.AST_NODE_TYPES.ExportNamedDeclaration)return;let r=new Map;for(let i of t.init.properties)i.type===le.AST_NODE_TYPES.Property&&i.key.type===le.AST_NODE_TYPES.Identifier&&r.set(i.key.name,i);if(r.size===0||t.id.type!==le.AST_NODE_TYPES.Identifier)return;let n=us(t,e.sourceCode);if(n.length===0)return;let a=t.init.properties.some(i=>i.type!==le.AST_NODE_TYPES.Property?!1:i.value.type===le.AST_NODE_TYPES.FunctionExpression),s=new Set;for(let i of n){if(i.identifier.parent.type!==le.AST_NODE_TYPES.MemberExpression)return;let o=i.identifier.parent;if(o.object!==i.identifier)return;if(o.computed)if(o.property.type===le.AST_NODE_TYPES.Literal&&typeof o.property.value=="string")s.add(o.property.value);else return;else{if(o.property.type!==le.AST_NODE_TYPES.Identifier)return;s.add(o.property.name)}if(o.parent.type===le.AST_NODE_TYPES.CallExpression&&a)return}for(let[i,o]of r)s.has(i)||e.report({node:o,messageId:"unusedObjectProperty",data:{name:i}})}}}});function us(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(a=>a.identifier!==e.id):[]}var H=require("@typescript-eslint/utils"),Fe=require("zod/v4");var fs=Fe.z.object({selectors:Fe.z.array(Fe.z.object({name:Fe.z.string(),selectorProp:Fe.z.string().optional(),selectorArgPos:Fe.z.number().optional(),returnProp:Fe.z.string().optional()}))}),ms=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="no-unused-selected-values",_t={name:Wn,rule:ms({name:Wn,meta:{type:"suggestion",docs:{description:"Disallow unused values in selector objects"},messages:{unusedSelectedValue:'The selected value "{{name}}" is not being used'},schema:[$(fs)]},defaultOptions:[{selectors:[]}],create(e,[t]){let{selectors:r=[]}=t,n=new Map(r.map(a=>[a.name,a]));return{VariableDeclarator(a){let s=null;if(a.init?.type===H.AST_NODE_TYPES.CallExpression&&(s=a.init),!s)return;let i=ys(s);if(!i)return;let o=n.get(i);if(!o)return;let l=ds(s,o.selectorArgPos??0,o.selectorProp);if(!l)return;let p=gs(l);if(!p)return;let c=Vn(p.properties,void 0);if(!c)return;if(a.id.type===H.AST_NODE_TYPES.ObjectPattern){let d=Vn(a.id.properties,o.returnProp);if(!d)return;for(let[y,E]of c)d.has(y)||e.report({node:E,messageId:"unusedSelectedValue",data:{name:y}});return}if(a.id.type!==H.AST_NODE_TYPES.Identifier||o.returnProp)return;let m=Ss(a,e.sourceCode);if(m.length===0)return;let f=new Set;for(let d of m){if(d.identifier.parent.type!==H.AST_NODE_TYPES.MemberExpression)return;let y=d.identifier.parent.property;if(y.type!==H.AST_NODE_TYPES.Identifier)return;f.add(y.name)}for(let[d,y]of c)f.has(d)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:d}})}}}})};function ds(e,t,r){let n=e.arguments[t];if(!n)return null;if(n.type===H.AST_NODE_TYPES.ArrowFunctionExpression||n.type===H.AST_NODE_TYPES.FunctionExpression)return n;if(r&&n.type===H.AST_NODE_TYPES.ObjectExpression){let a=n.properties.find(i=>i.type===H.AST_NODE_TYPES.Property&&i.key.type===H.AST_NODE_TYPES.Identifier&&i.key.name===r);if(a?.type!==H.AST_NODE_TYPES.Property)return null;let s=a.value;if(s.type===H.AST_NODE_TYPES.ArrowFunctionExpression||s.type===H.AST_NODE_TYPES.FunctionExpression)return s}return null}function ys(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 gs(e){if(e.body.type===H.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===H.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===H.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==H.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}function Vn(e,t){let r=e;if(t){let a=e.find(s=>s.type===H.AST_NODE_TYPES.Property&&s.key.type===H.AST_NODE_TYPES.Identifier&&s.key.name===t);if(a?.type!==H.AST_NODE_TYPES.Property||a.value.type!==H.AST_NODE_TYPES.ObjectPattern)return null;r=a.value.properties}let n=new Map;for(let a of r){if(a.type!==H.AST_NODE_TYPES.Property||a.key.type!==H.AST_NODE_TYPES.Identifier)return null;n.set(a.key.name,a)}return n.size>0?n:null}function Ss(e,t){let r=t.getDeclaredVariables(e);if(r.length!==1)return[];let n=r[0];return n?n.references.filter(a=>a.identifier!==e.id):[]}var B=require("@typescript-eslint/utils");var $t=J({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(s=>s.type===B.AST_NODE_TYPES.ImportDeclaration&&s.source.value==="t-state-form"))return{};let n=null,a=!1;return{CallExpression(s){if(a)return;if(!n){let o=Ts(s);o&&(n=o);return}let i=hs(s,e.sourceCode);if(i){a=!0;for(let o of i)n.delete(o);if(n.size!==0)for(let[o,l]of n)e.report({node:l,messageId:"unusedField",data:{name:o}})}}}}});function Ts(e){if(!(e.callee.type===B.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let r=e.arguments[0];if(!r||r.type!==B.AST_NODE_TYPES.ObjectExpression)return null;let n=At(r.properties,s=>s.type!==B.AST_NODE_TYPES.Property||s.key.type!==B.AST_NODE_TYPES.Identifier||s.key.name!=="initialConfig"?null:s.value.type===B.AST_NODE_TYPES.ObjectExpression?s.value:s.value.type===B.AST_NODE_TYPES.ArrowFunctionExpression||s.value.type===B.AST_NODE_TYPES.FunctionExpression?Es(s.value):null);if(!n)return null;let a=new Map;for(let s of n.properties)s.type===B.AST_NODE_TYPES.Property&&s.key.type===B.AST_NODE_TYPES.Identifier&&a.set(s.key.name,s);return a}function hs(e,t){if(!(e.callee.type===B.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==B.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==B.AST_NODE_TYPES.ObjectPattern||!At(e.parent.id.properties,i=>i.type===B.AST_NODE_TYPES.Property&&i.key.type===B.AST_NODE_TYPES.Identifier&&i.key.name==="formFields"&&i))return null;let a=Ln(e.parent,"formFields",t),s=new Set;for(let{identifier:i}of a){if(i.type!==B.AST_NODE_TYPES.Identifier||i.parent.type===B.AST_NODE_TYPES.Property&&i.parent.parent.type===B.AST_NODE_TYPES.ObjectExpression&&i.parent.parent.parent.type===B.AST_NODE_TYPES.ReturnStatement||i.parent.type===B.AST_NODE_TYPES.ReturnStatement)return null;if(i.parent.type===B.AST_NODE_TYPES.MemberExpression){if(i.parent.object.type!==B.AST_NODE_TYPES.Identifier||i.parent.property.type!==B.AST_NODE_TYPES.Identifier)return null;s.add(i.parent.property.name)}}return s}function Es(e){if(e.body.type===B.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===B.AST_NODE_TYPES.BlockStatement){let t=e.body.body.filter(r=>r.type===B.AST_NODE_TYPES.ReturnStatement);return t.length!==1||!t[0]||t[0].argument?.type!==B.AST_NODE_TYPES.ObjectExpression?null:t[0].argument}return null}var W=require("@typescript-eslint/utils"),Be=require("zod/v4");var xs=W.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function Hn(e){let t=[];for(let r of e.members)r.type===W.AST_NODE_TYPES.TSPropertySignature&&r.key.type===W.AST_NODE_TYPES.Identifier&&t.push([r.key.name,r]);return t}function Jn(e,...t){for(let r of t)e.set(...r);return e}var bs=Be.z.object({forceCheckOnFCPropTypesWithName:Be.z.array(Be.z.string()).optional(),alwaysCheckFunctionOptionTypes:Be.z.boolean().optional()}),Bn="no-unused-type-props-in-args",Ut=null,Cs=xs({name:Bn,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:[$(bs)],fixable:"code"},defaultOptions:[{alwaysCheckFunctionOptionTypes:!0}],create(e,[t]){let{forceCheckOnFCPropTypesWithName:r,alwaysCheckFunctionOptionTypes:n=!0}=t;r&&!Ut&&(Ut=r.map(l=>new RegExp(l)));function a(l,p,c,m,f=!0,d=!1){let y=c.name,E=e.sourceCode.getScope(p).references.find(g=>g.identifier.name===y)?.resolved,h=l&&Ut?.some(g=>g.test(y)),u=d&&n;if(!E||!h&&E.references.filter(g=>g.isTypeReference).length>1||!E.defs[0])return;let x=E.defs[0].node,b=x.parent?.type===W.AST_NODE_TYPES.ExportNamedDeclaration;if(!(f&&b&&!u)){if(x.type===W.AST_NODE_TYPES.TSTypeAliasDeclaration){s(l,p,m,x.typeAnnotation,!0,d);return}if(x.type===W.AST_NODE_TYPES.TSInterfaceDeclaration){s(l,p,m,x.body,!0,d);return}}}function s(l,p,c,m,f,d=!1){if(m.type===W.AST_NODE_TYPES.TSInterfaceBody){for(let y of m.body)y.type===W.AST_NODE_TYPES.TSPropertySignature&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.set(y.key.name,y);return}if(m.type===W.AST_NODE_TYPES.TSTypeLiteral){Jn(c,...Hn(m));return}if(m.type===W.AST_NODE_TYPES.TSIntersectionType){for(let y of m.types)s(l,p,c,y,!0,d);return}f||m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier&&a(l,p,m.typeName,c,!0,d)}function i(l,p,c,m=!1){for(let f of c)if(f.type===W.AST_NODE_TYPES.ObjectPattern&&f.typeAnnotation){let d=new Map;if(s(l,p,d,f.typeAnnotation.typeAnnotation,!1,m),d.size===0)continue;o(f,d)}else f.type===W.AST_NODE_TYPES.AssignmentPattern&&f.left.type===W.AST_NODE_TYPES.ObjectPattern&&i(l,p,[f.left],m)}function o(l,p){let c=[];if(l.properties.at(-1)?.type===W.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===W.AST_NODE_TYPES.Property&&y.key.type===W.AST_NODE_TYPES.Identifier&&c.push(y.key.name);let f=[],d=[];for(let[y,E]of p)c.includes(y)||(d.push(y),f.push({node:E,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,E]of f.entries())e.report({...E,fix:y===f.length-1?h=>{let u=l.properties.at(-1),x=d.join(", ");return u?u.type===W.AST_NODE_TYPES.RestElement?null:h.insertTextAfter(u,`, ${x}`):h.insertTextBeforeRange([l.range[0]+1,l.range[1]],x)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],c=new Map,m=p.id.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===W.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===W.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(m){if(m.type===W.AST_NODE_TYPES.TSTypeReference&&m.typeName.type===W.AST_NODE_TYPES.Identifier)a(!0,l,m.typeName,c,!1);else if(m.type===W.AST_NODE_TYPES.TSTypeLiteral)Jn(c,...Hn(m));else if(m.type===W.AST_NODE_TYPES.TSIntersectionType)for(let f of m.types)f.type===W.AST_NODE_TYPES.TSTypeReference&&f.typeName.type===W.AST_NODE_TYPES.Identifier?a(!0,l,f.typeName,c,!1):s(!0,l,c,f,!0);if(c.size!==0&&p.init?.type===W.AST_NODE_TYPES.ArrowFunctionExpression){let f=p.init.params[0];if(!f){e.report({node:p.init,messageId:"missingComponentParam"});return}f.type===W.AST_NODE_TYPES.ObjectPattern&&o(f,c)}}},FunctionDeclaration(l){i(!1,l,l.params,n)},ArrowFunctionExpression(l){i(!1,l,l.params,n)}}}}),zt={name:Bn,rule:Cs};var ue=require("@typescript-eslint/utils");var Wt=J({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===ue.AST_NODE_TYPES.Identifier?t.has(n.callee.name):n.callee.type===ue.AST_NODE_TYPES.MemberExpression&&n.callee.object.type===ue.AST_NODE_TYPES.Identifier&&n.callee.property.type===ue.AST_NODE_TYPES.Identifier?n.callee.property.name==="useRef":!1}return{ImportDeclaration(n){if(n.source.value==="react")for(let a of n.specifiers)a.type===ue.AST_NODE_TYPES.ImportSpecifier&&a.imported.type===ue.AST_NODE_TYPES.Identifier&&a.imported.name==="useRef"&&t.add(a.local.name)},VariableDeclarator(n){if(n.init&&n.init.type===ue.AST_NODE_TYPES.CallExpression&&r(n.init)&&n.id.type===ue.AST_NODE_TYPES.Identifier){let s=e.sourceCode.getScope(n).set.get(n.id.name);if(s){let i=!1;for(let o of s.references){let p=o.identifier.parent;if(p!==n&&!(p.type===ue.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ue.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ue.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){i=!0;break}}i||e.report({node:n.id,messageId:"refNotRead",data:{name:n.id.name}})}}}}}});var $e=require("@typescript-eslint/utils"),Is=$e.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Xn="prefer-named-functions",Yn=new Map,Rs=Is({name:Xn,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=Yn.get(t.ignoreRegex);n?r=n:(r=new RegExp(t.ignoreRegex),Yn.set(t.ignoreRegex,r))}return{VariableDeclarator(n){if(n.init&&n.init.type===$e.AST_NODE_TYPES.ArrowFunctionExpression&&n.id.type===$e.AST_NODE_TYPES.Identifier){let a=n.id.name;if(n.id.typeAnnotation||r&&r.test(a)||!t.disallowArrowFnWithImplicitReturns&&n.init.body.type!==$e.AST_NODE_TYPES.BlockStatement)return;let s=n.parent,i=n.init.params,o=n.init.body,l=n.init;e.report({node:n.id,messageId:r?"withIgnoreRegex":"default",data:{functionName:a,ignoreRegex:t.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(s,`${l.async?"async ":""}function ${a}(${i.map(c=>e.sourceCode.getText(c)).join(", ")||""}) ${e.sourceCode.getText(o)}`)}]})}}}}}),Vt={name:Xn,rule:Rs};var M=require("@typescript-eslint/utils"),ge=require("zod/v4");var As=ge.z.object({disallowedFunctions:ge.z.array(ge.z.object({name:ge.z.string(),allowUsingWithArgs:ge.z.boolean().optional(),hookAlternative:ge.z.string().optional(),message:ge.z.string().optional(),allowUseInside:ge.z.array(ge.z.string()).optional()}))}),ws=/^use[A-Z]/,vs=/^[A-Z]/;function st(e){return ws.test(e)}function qn(e){return vs.test(e)}function ks(e){return e.type===M.AST_NODE_TYPES.Identifier?st(e.name):e.type===M.AST_NODE_TYPES.MemberExpression&&e.property.type===M.AST_NODE_TYPES.Identifier?st(e.property.name):!1}function Gn(e,t){return e.type===M.AST_NODE_TYPES.Identifier?e.name===t:e.type===M.AST_NODE_TYPES.MemberExpression&&e.object.type===M.AST_NODE_TYPES.Identifier&&e.property.type===M.AST_NODE_TYPES.Identifier?e.object.name==="React"&&e.property.name===t:!1}function Zn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Gn(e.parent.callee,"forwardRef"))}function Kn(e){return!!(e.parent&&e.parent.type===M.AST_NODE_TYPES.CallExpression&&Gn(e.parent.callee,"memo"))}function Ht(e){if(e.type===M.AST_NODE_TYPES.FunctionDeclaration||e.type===M.AST_NODE_TYPES.FunctionExpression&&e.id)return e.id||void 0;if(e.type===M.AST_NODE_TYPES.FunctionExpression||e.type===M.AST_NODE_TYPES.ArrowFunctionExpression){if(e.parent.type===M.AST_NODE_TYPES.VariableDeclarator&&e.parent.init===e)return e.parent.id;if(e.parent.type===M.AST_NODE_TYPES.AssignmentExpression&&e.parent.right===e&&e.parent.operator==="=")return e.parent.left;if(e.parent.type===M.AST_NODE_TYPES.Property&&e.parent.value===e&&!e.parent.computed)return e.parent.key;if(e.parent.type===M.AST_NODE_TYPES.AssignmentPattern&&e.parent.right===e)return e.parent.left}}function Fs(e){let t=e.parent,r=!1;for(;t;){if(t.type===M.AST_NODE_TYPES.FunctionDeclaration||t.type===M.AST_NODE_TYPES.FunctionExpression||t.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=Ht(t);if(n&&n.type===M.AST_NODE_TYPES.Identifier){if(qn(n.name)||st(n.name))return!r;r=!0}else{if(Zn(t)||Kn(t))return!r;if(t.parent.type===M.AST_NODE_TYPES.CallExpression){let a=t.parent;ks(a.callee)||(r=!0)}else t.parent.type===M.AST_NODE_TYPES.JSXExpressionContainer||(r=!0)}}t=t.parent}return!1}function Qn(e){return e.callee.type===M.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===M.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===M.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function Ps(e,t){if(!t.length)return!1;let r=e.parent;for(;r;){if(r.type===M.AST_NODE_TYPES.FunctionDeclaration||r.type===M.AST_NODE_TYPES.FunctionExpression||r.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let n=Ht(r);if(n&&n.type===M.AST_NODE_TYPES.Identifier&&t.includes(n.name))return!0}else if(r.type===M.AST_NODE_TYPES.CallExpression){let n=Qn(r);if(n&&t.includes(n))return!0}r=r.parent}return!1}function Os(e){return e.arguments.length>0&&!e.arguments.every(t=>t.type===M.AST_NODE_TYPES.Identifier&&t.name==="undefined")}function Ns(e,t){let r=!1,n=e.parent;for(;n;){if(n.type===M.AST_NODE_TYPES.FunctionDeclaration||n.type===M.AST_NODE_TYPES.FunctionExpression||n.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let a=Ht(n);if(a&&a.type===M.AST_NODE_TYPES.Identifier){if(qn(a.name)||st(a.name)){r=!0;break}}else if(Zn(n)||Kn(n)){r=!0;break}}n=n.parent}return r?t.length===0?Fs(e):!Ps(e,t):!1}var Jt=J({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:[$(As)],hasSuggestions:!0},defaultOptions:[{disallowedFunctions:[]}],create(e,[t]){let{disallowedFunctions:r}=t,n=new Map(r.map(a=>[a.name,a]));return{CallExpression(a){let s=Qn(a);if(!s)return;let i=n.get(s);if(!i||i.allowUsingWithArgs&&Os(a))return;let o=i.allowUseInside||[];Ns(a,o)&&e.report({node:a,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 p=i.hookAlternative;return p?a.callee.type===M.AST_NODE_TYPES.Identifier?l.replaceText(a.callee,p):a.callee.type===M.AST_NODE_TYPES.MemberExpression&&a.callee.property.type===M.AST_NODE_TYPES.Identifier?l.replaceText(a.callee.property,p):null:null}}]:[]})}}}});var X=require("@typescript-eslint/utils"),ot=Ee(require("zod/v4"));var Ds=X.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="prefer-single-line-if",Ms=ot.default.object({maxLineLength:ot.default.number().optional(),maxNonSimpleConditionLength:ot.default.number().optional()}),js=Ds({name:tr,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:[$(Ms)]},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode;return{IfStatement(n){if(n.consequent.type!==X.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 s=n.consequent.body[0];if(!s)return;if(s.type===X.AST_NODE_TYPES.ReturnStatement){if(!rr(s))return}else if(!(s.type===X.AST_NODE_TYPES.ContinueStatement||s.type===X.AST_NODE_TYPES.BreakStatement))return;if(n.test.type===X.AST_NODE_TYPES.LogicalExpression||n.test.type===X.AST_NODE_TYPES.ConditionalExpression)return;let i;if(t.maxNonSimpleConditionLength){let m=er(n.test);if(!m&&n.test.type===X.AST_NODE_TYPES.UnaryExpression&&n.test.operator==="!"){let f=n.test.argument;er(f)&&(m=!0)}if(m&&(i=r.getText(n.test),i.length>t.maxNonSimpleConditionLength))return}i||(i=r.getText(n.test));let o=r.getText(s);if(i.includes(`
|
|
16
|
+
`))return;let l=r.getTokenAfter(n);if(l&&l.type===X.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let m=r.getTokenAfter(l);if(m&&m.type===X.AST_TOKEN_TYPES.Keyword&&(m.value==="else"||m.value==="catch"))return}let p=Ls(r,n),c=`if (${i}) ${o}`;t.maxLineLength&&c.length+p.length>t.maxLineLength||e.report({node:n,messageId:"noSingleLineCurly",fix:m=>m.replaceText(n,c)})}}}});function er(e){return e.type===X.AST_NODE_TYPES.CallExpression||e.type===X.AST_NODE_TYPES.BinaryExpression||e.type===X.AST_NODE_TYPES.MemberExpression&&nr(e)}function nr(e){return e.object.type===X.AST_NODE_TYPES.MemberExpression?nr(e.object):e.object.type!==X.AST_NODE_TYPES.Identifier}function Ls(e,t){return e.text.slice(t.range[0]-t.loc.start.column,t.range[0])}function rr(e){if(!e.argument)return!0;let t=e.argument;return t.type===X.AST_NODE_TYPES.ArrayExpression&&t.elements.length===0||t.type===X.AST_NODE_TYPES.ObjectExpression&&t.properties.length===0||t.type===X.AST_NODE_TYPES.Literal||t.type===X.AST_NODE_TYPES.Identifier||t.type===X.AST_NODE_TYPES.TemplateLiteral||t.type===X.AST_NODE_TYPES.TaggedTemplateExpression?!0:t.type===X.AST_NODE_TYPES.CallExpression?t.arguments.length===0:t.type===X.AST_NODE_TYPES.UnaryExpression?rr(t):!1}var Bt={name:tr,rule:js};var F=require("@typescript-eslint/utils"),Xt=require("zod/v4");var _s=F.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="react-compiler-extra",$s=Xt.z.object({runOnlyWithEnableCompilerDirective:Xt.z.boolean().optional()}),Us=/eslint +react-compiler\/react-compiler: +\["error/;function lr(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):!1}function zs(e){return e.type===F.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===F.AST_NODE_TYPES.MemberExpression&&e.property.type===F.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}function Se(e){if(!e)return!1;switch(e.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:return!0;case F.AST_NODE_TYPES.ConditionalExpression:return Se(e.consequent)||Se(e.alternate);case F.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Se(e.right):e.operator==="||"?Se(e.left)||Se(e.right):!1;case F.AST_NODE_TYPES.CallExpression:if(e.callee.type===F.AST_NODE_TYPES.MemberExpression&&e.callee.object.type===F.AST_NODE_TYPES.Identifier&&e.callee.object.name==="React"&&e.callee.property.type===F.AST_NODE_TYPES.Identifier&&e.callee.property.name==="createElement")return!0;for(let t of e.arguments)if(t.type!==F.AST_NODE_TYPES.SpreadElement&&Se(t))return!0;return!1;default:return!1}}function Ws(e){let t=e.typeAnnotation;if(t.type===F.AST_NODE_TYPES.TSTypeReference){if(t.typeName.type===F.AST_NODE_TYPES.Identifier)return t.typeName.name==="FC";if(t.typeName.type===F.AST_NODE_TYPES.TSQualifiedName&&t.typeName.left.type===F.AST_NODE_TYPES.Identifier&&t.typeName.right.type===F.AST_NODE_TYPES.Identifier)return t.typeName.left.name==="React"&&t.typeName.right.name==="FC"}return!1}var Vs=/^[A-Z][a-zA-Z0-9]*$/;function Xe(e){return Vs.test(e)}function qt(e){return e.startsWith("use")&&e.length>3}function Gt(e,t,r,n){if(r&&Ws(r))return t?Xe(t.name):e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?Xe(e.id.name):!0;if(t&&qt(t.name)||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id&&qt(e.id.name))return!0;if(n){let a=t?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(a&&Xe(a)&&pr(e.body,n).containsJSX)return!0}return!1}function Ye(e){if(e.body.type===F.AST_NODE_TYPES.BlockStatement){for(let t of e.body.body)if(t.type===F.AST_NODE_TYPES.ExpressionStatement&&t.expression.type===F.AST_NODE_TYPES.Literal&&typeof t.expression.value=="string"&&t.expression.value==="use memo")return!0}return!1}function pr(e,t){let r={containsJSX:!1,containsHookCalls:!1};return wt(e,n=>{if(r.containsJSX&&r.containsHookCalls)return!0;switch(n.type){case F.AST_NODE_TYPES.JSXElement:case F.AST_NODE_TYPES.JSXFragment:r.containsJSX=!0;break;case F.AST_NODE_TYPES.CallExpression:lr(n.callee)&&(r.containsHookCalls=!0),Se(n)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.ReturnStatement:n.argument&&Se(n.argument)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.VariableDeclarator:n.init&&Se(n.init)&&(r.containsJSX=!0);break;case F.AST_NODE_TYPES.AssignmentExpression:Se(n.right)&&(r.containsJSX=!0);break}},t),r}function ir(e,t){let r=e.body,n=pr(r,t);return n.containsJSX||n.containsHookCalls}var Hs=/\bthis[.[]/;function sr(e){return Hs.test(e)}function Js(e,t){let r={containsJSX:!1,containsHookCalls:!1};return wt(e,n=>{if(r.containsHookCalls||(n.type===F.AST_NODE_TYPES.FunctionDeclaration||n.type===F.AST_NODE_TYPES.FunctionExpression||n.type===F.AST_NODE_TYPES.ArrowFunctionExpression)&&n!==e)return!0;n.type===F.AST_NODE_TYPES.CallExpression&&zs(n.callee)&&(r.containsHookCalls=!0)},t),r}function or(e){return Xe(e)||qt(e)}function Yt(e,t,r,n){if(!Js(e.body,t).containsHookCalls)return!1;let s=Gt(e,r,n,t);if(!s&&n){let i=r?.name||e.type===F.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;i&&Xe(i)&&(s=!0)}return!s}var Bs=_s({name:ar,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:[$($s)]},defaultOptions:[{}],create(e,[t]){let r=!1;if(t.runOnlyWithEnableCompilerDirective){for(let s of e.sourceCode.getAllComments())if(Us.test(s.value)){r=!0;break}if(!r)return{}}function n(s){for(let i of s.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.method&&i.value.type===F.AST_NODE_TYPES.FunctionExpression){let o=e.sourceCode,l=o.getText(i.key),p=i.value,c=o.getText(p.body);if(sr(c))e.report({node:i,messageId:"thisKeywordInMethod"});else{let m=p.params.map(d=>o.getText(d)).join(", "),f="";p.generator?f=`${l}: function* (${m}) ${c}`:f=`${l}: (${m}) => ${c}`,e.report({node:i,messageId:"objectMethodIsNotSupported",fix:d=>d.replaceText(i,f)})}}}function a(s){for(let i of s.properties)if(i.type===F.AST_NODE_TYPES.Property&&i.value.type===F.AST_NODE_TYPES.ObjectExpression){for(let o of i.value.properties)if(o.type===F.AST_NODE_TYPES.Property&&o.method&&o.value.type===F.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(o.value.body);sr(p)&&e.report({node:o,messageId:"thisKeywordInMethod"})}}}return{CallExpression(s){if(lr(s.callee))for(let i of s.arguments){if(i.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i),a(i)),i.type===F.AST_NODE_TYPES.ArrowFunctionExpression&&(i.body.type===F.AST_NODE_TYPES.ObjectExpression&&(n(i.body),a(i.body)),i.body.type===F.AST_NODE_TYPES.BlockStatement))for(let o of i.body.body)o.type===F.AST_NODE_TYPES.ReturnStatement&&o.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(o.argument),a(o.argument));if(i.type===F.AST_NODE_TYPES.FunctionExpression)for(let o of i.body.body)o.type===F.AST_NODE_TYPES.ReturnStatement&&o.argument?.type===F.AST_NODE_TYPES.ObjectExpression&&(n(o.argument),a(o.argument))}},VariableDeclarator(s){if(s.id.type===F.AST_NODE_TYPES.Identifier&&s.init&&(s.init.type===F.AST_NODE_TYPES.ArrowFunctionExpression||s.init.type===F.AST_NODE_TYPES.FunctionExpression)){let i=s.init,o=s.id,l=s.id.typeAnnotation;if(Ye(i)&&!or(o.name)){e.report({node:i,messageId:"useMemoDirectiveNaming"});return}if(Yt(i,e.sourceCode,o,l)){e.report({node:i,messageId:"functionCallingHooksMustBeComponent"});return}if(Gt(i,o,l,e.sourceCode)){let p=ir(i,e.sourceCode),c=Ye(i);!p&&!c&&e.report({node:i,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(m){if(i.body.type===F.AST_NODE_TYPES.BlockStatement){let f=i.body.range[0]+1;return m.insertTextAfterRange([f,f],`
|
|
17
17
|
"use memo"
|
|
18
|
-
`)}return null}}]})}}},FunctionDeclaration(
|
|
18
|
+
`)}return null}}]})}}},FunctionDeclaration(s){if(s.id&&Ye(s)&&!or(s.id.name)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}if(Yt(s,e.sourceCode)){e.report({node:s,messageId:"functionCallingHooksMustBeComponent"});return}if(Gt(s,void 0,void 0,e.sourceCode)){let i=ir(s,e.sourceCode),o=Ye(s);!i&&!o&&e.report({node:s,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let p=s.body.range[0]+1;return l.insertTextAfterRange([p,p],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}}]})}}}}}),Jt={name:sr,rule:Ws};var se=require("@typescript-eslint/utils"),me=require("zod/v4");var Vs=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ar="react-compiler-migration",Hs=me.z.object({disallowHooks:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string()})).optional(),disallowMethods:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string().optional(),requireTrueProp:me.z.string().optional()})).optional()}),Js=/eslint +react-compiler\/react-compiler: +\["error/;function Ys(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===se.AST_NODE_TYPES.MemberExpression&&e.property.type===se.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Xs=Vs({name:ar,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:[$(Hs)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(Js.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let o=null,a=null;if(n.callee.type===se.AST_NODE_TYPES.Identifier?(o=n.callee.name,a=n.callee):n.callee.type===se.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===se.AST_NODE_TYPES.Identifier&&(o=n.callee.property.name,a=n.callee.property),o){let i=t.disallowHooks.find(s=>s.name===o);i&&a&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:s=>s.replaceText(a,i.replacement)}]})}}if(t.disallowMethods?.length&&Ys(n.callee)){for(let o of n.arguments)if(o.type===se.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===se.AST_NODE_TYPES.Property&&a.key.type===se.AST_NODE_TYPES.Identifier){let i=a.key.name,s=t.disallowMethods.find(l=>l.name===i);if(s){if(s.requireTrueProp){let l=s.requireTrueProp,p=!1;for(let c of o.properties)if(c.type===se.AST_NODE_TYPES.Property&&c.key.type===se.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===se.AST_NODE_TYPES.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:s.name,requireTrueProp:l}});continue}}s.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:s.name,replacement:s.replacement},suggest:[{messageId:"replace",data:{replacement:s.replacement},fix:l=>s.replacement?l.replaceText(a.key,s.replacement):null}]})}}}}}}:{}}}),Yt={name:ar,rule:Xs};var st=require("@typescript-eslint/utils"),Bs=st.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),lr="require-description",qs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,Gs=/^eslint-disable-(next-)?line$/u,Zs=Bs({name:lr,meta:{type:"problem",docs:{description:"Require descriptions for eslint directives."},messages:{missingDescription:"Unexpected undescribed directive comment. Include descriptions to explain why the comment is necessary."},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["eslint","eslint-disable","eslint-disable-line","eslint-disable-next-line","eslint-enable","eslint-env","exported","global","globals"]},additionalItems:!1,uniqueItems:!0}},additionalProperties:!1}]},defaultOptions:[{ignore:[]}],create(e,[t]){let r=e.sourceCode,n=new Set(t.ignore||[]);return{Program(){for(let o of r.getAllComments()){let a=Ks(o);a!=null&&(n.has(a.kind)||a.description||e.report({loc:to(o.loc),messageId:"missingDescription"}))}}}}}),pr={name:lr,rule:Zs};function Ks(e){let{text:t,description:r}=eo(e.value);if(!t)return null;let n=qs.exec(t);if(!n)return null;let o=n[1];if(!o)return null;let a=Gs.test(o);if(e.type===st.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+o.length);return{kind:o,value:i.trim(),description:r}}var Qs=/\s-{2,}\s/u;function eo(e){let t=e.split(Qs);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function to(e){return{start:{line:e.start.line,column:-1},end:e.end}}var U=require("@typescript-eslint/utils"),Te=require("zod/v4");var no=Te.z.object({varsToCheck:Te.z.array(Te.z.object({selector:Te.z.string().optional(),fromFnCall:Te.z.string().optional(),prop:Te.z.string().or(Te.z.array(Te.z.string())),errorMsg:Te.z.string().optional()}))}),Xt=J({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:[$(no)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,s,l,p){let c=new Set;for(let f of i.properties)f.type===U.AST_NODE_TYPES.Property&&f.key.type===U.AST_NODE_TYPES.Identifier&&c.add(f.key.name);let m=s.filter(f=>!c.has(f));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:l||""}});else{let f=m.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:f,fnName:p,customMsg:l||""}})}}function o(i){if(i.init?.type===U.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===U.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===U.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]=s=>{if(s.type===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.AST_NODE_TYPES.Identifier&&r.set(s.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:s.id,fnName:o(s)}),s.type===U.AST_NODE_TYPES.VariableDeclarator&&s.id.type===U.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(s.id,l,i.errorMsg,o(s))}});for(let i of t.varsToCheck)if(i.fromFnCall){let s=i.fromFnCall;if(s.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${s.slice(2)}"]`;a[p]=c=>{if(c.type!==U.AST_NODE_TYPES.MemberExpression||c.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let m=c.parent;if(m.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let f=m.parent;if(f.id.type===U.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===U.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(s.includes(".")){let[l,p]=s.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[c]=m=>{if(m.type!==U.AST_NODE_TYPES.MemberExpression||m.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let f=m.parent;if(f.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let d=f.parent;if(d.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${s}"]`;a[l]=p=>{if(p.type!==U.AST_NODE_TYPES.Identifier||p.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let m=c.parent;if(m.id.type===U.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===U.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[i,{props:s,errorMsg:l,node:p,fnName:c}]of r){let f=e.sourceCode.getScope(p).set.get(i);if(f){let d=new Set(s);for(let y of f.references){let E=y.identifier,h=E.parent;if(!(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===U.AST_NODE_TYPES.ObjectPattern){for(let u of h.id.properties)u.type===U.AST_NODE_TYPES.Property&&u.key.type===U.AST_NODE_TYPES.Identifier&&d.has(u.key.name)&&d.delete(u.key.name);if(d.size===0)break;continue}if(!(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&!s.includes(h.property.name))){d.clear();break}}}if(d.size>0){let y=Array.from(d);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:c,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:c,customMsg:l||""}})}}}}}}}});function fr(e){return/^use[A-Z0-9]/.test(e)}function ot(e){return e.type==="Identifier"?fr(e.name):e.type==="MemberExpression"&&!e.computed&&ot(e.property)?e.object.type==="Identifier":!1}function mr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function dr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function yr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"forwardRef"))}function gr(e){return!!(e.parent&&e.parent.callee&&dr(e.parent.callee,"memo"))}function Bt(e){for(;e;){let t=Tr(e);if(t&&(mr(t)||ot(t))||yr(e)||gr(e))return!0;e=e.parent}return!1}function cr(e){return!1}function qt(e){return!1}var ro=/eslint +react-compiler\/react-compiler: +\["error/,Sr={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(ro.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" 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,o=[],a=[],i=new WeakSet;function s(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&cr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let c=o.pop();if(c.size===0)return;let m=new Set;function f(g,A){let{cache:S}=f,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=[...v],N=R.slice(R.indexOf(g.id)+1);for(let _ of N)m.add(_);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.prevSegments)I+=f(R,v)}return g.reachable&&I===BigInt("0")?S.delete(g.id):S.set(g.id,I),I}function d(g,A){let{cache:S}=d,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=Array.from(v),N=R.slice(R.indexOf(g.id)+1);for(let _ of N)m.add(_);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.nextSegments)I+=d(R,v)}return S.set(g.id,I),I}function y(g){let{cache:A}=y,S=A.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(A.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let I of g.prevSegments){let v=y(I);v<S&&(S=v)}S+=1}return A.set(g.id,S),S}f.cache=new Map,d.cache=new Map,y.cache=new Map;let E=d(l.initialSegment),h=Tr(p),u=Bt(p),x=h?mr(h)||ot(h):yr(p)||gr(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let A=y(g);A<b&&(b=A)}for(let[g,A]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=y(g):b<y(g),I=f(g)*d(g),v=m.has(g.id);for(let R of A)if(v&&!qt(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.`}),x){if(p.async&&e.report({node:R,message:`React Hook "${t(R)}" cannot be called in an async function.`}),!v&&I!==E&&!qt(R)){let _=`React Hook "${t(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:_})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let N=`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:N})}else if(h){let N=`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:N})}else if(p.type==="Program"){let N=`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:N})}else if(u&&!qt(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let _=p.parent;if(_.parent.type==="VariableDeclarator"&&fr(_.parent.id.name))return}let N=`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:N})}}},CallExpression(l){if(ot(l.callee)){let p=ur(o),c=ur(a),m=p.get(c);m||(m=[],p.set(c,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||cr(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){Bt(l)&&s(r(l))},ArrowFunctionExpression(l){Bt(l)&&s(r(l))}}}};function Tr(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 ur(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),oe=Ee(require("zod/v4"));var io=/^\s+$/,Gt=/\r?\n/,so=/^(\s*)/,oo=/^(\s*)\S/,ao=/\r?\n/,lo=oe.object({indent:oe.union([oe.string().regex(io),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),Zt=J({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(lo)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],i=r.map(u=>u.toLowerCase());function s(u){let x=u.split(Gt),b=x.filter(A=>A.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let A of b){let S=A.match(so);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:x.map(A=>A.slice(g)).join(`
|
|
21
|
-
`)}function l(u,x,b){return u.split(
|
|
22
|
-
`)}function p(u){if(u.type===Q.AST_NODE_TYPES.Identifier)return u.name;if(u.type===Q.AST_NODE_TYPES.MemberExpression){let x=u.object.type===Q.AST_NODE_TYPES.Identifier?u.object.name:null,b=u.property.type===Q.AST_NODE_TYPES.Identifier?u.property.name:null;return x&&b?`${x}.${b}`:b}return null}function c(u,x){if(!u)return!1;for(let b of x)if(b.includes(".")){let g=b.split(".");if(u.type===Q.AST_NODE_TYPES.MemberExpression&&u.object.type===Q.AST_NODE_TYPES.Identifier&&u.property.type===Q.AST_NODE_TYPES.Identifier&&u.object.name===g[0]&&u.property.name===g[1])return!0}else if(u.type===Q.AST_NODE_TYPES.Identifier&&u.name===b)return!0;return!1}function m(u,x){let b=u.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?x.includes(g):!1}function f(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:A=!0,optionalMember:S=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&u.callee.optional||u.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.property.name===b}function d(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:A=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.name===b}function y(u){return f(u.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments[0]===u&&d(u.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?u.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(u){if(i.length>0){let x=t.getTokenBefore(u,{includeComments:!0});if(x?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(x.value.trim().toLowerCase()))return!0}return!!(y(u)||
|
|
20
|
+
`)}}]})}},FunctionExpression(s){if(Ye(s)){e.report({node:s,messageId:"useMemoDirectiveNaming"});return}Yt(s,e.sourceCode)&&e.report({node:s,messageId:"functionCallingHooksMustBeComponent"})}}}}),Zt={name:ar,rule:Bs};var se=require("@typescript-eslint/utils"),me=require("zod/v4");var Ys=se.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),cr="react-compiler-migration",Xs=me.z.object({disallowHooks:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string()})).optional(),disallowMethods:me.z.array(me.z.object({name:me.z.string(),replacement:me.z.string().optional(),requireTrueProp:me.z.string().optional()})).optional()}),qs=/eslint +react-compiler\/react-compiler: +\["error/;function Gs(e){return e.type===se.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===se.AST_NODE_TYPES.MemberExpression&&e.property.type===se.AST_NODE_TYPES.Identifier?e.property.name.startsWith("use"):!1}var Zs=Ys({name:cr,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:[$(Xs)]},defaultOptions:[{disallowHooks:[],disallowMethods:[]}],create(e,[t]){let r=!1;for(let n of e.sourceCode.getAllComments())if(qs.test(n.value)){r=!0;break}return r?{CallExpression(n){if(t.disallowHooks?.length){let a=null,s=null;if(n.callee.type===se.AST_NODE_TYPES.Identifier?(a=n.callee.name,s=n.callee):n.callee.type===se.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===se.AST_NODE_TYPES.Identifier&&(a=n.callee.property.name,s=n.callee.property),a){let i=t.disallowHooks.find(o=>o.name===a);i&&s&&e.report({node:n,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:i.name,replacement:i.replacement},suggest:[{messageId:"replace",data:{replacement:i.replacement},fix:o=>o.replaceText(s,i.replacement)}]})}}if(t.disallowMethods?.length&&Gs(n.callee)){for(let a of n.arguments)if(a.type===se.AST_NODE_TYPES.ObjectExpression){for(let s of a.properties)if(s.type===se.AST_NODE_TYPES.Property&&s.key.type===se.AST_NODE_TYPES.Identifier){let i=s.key.name,o=t.disallowMethods.find(l=>l.name===i);if(o){if(o.requireTrueProp){let l=o.requireTrueProp,p=!1;for(let c of a.properties)if(c.type===se.AST_NODE_TYPES.Property&&c.key.type===se.AST_NODE_TYPES.Identifier&&c.key.name===l&&c.value.type===se.AST_NODE_TYPES.Literal&&c.value.value===!0){p=!0;break}if(!p){e.report({node:s,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:o.name,requireTrueProp:l}});continue}}o.replacement&&e.report({node:s,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:o.name,replacement:o.replacement},suggest:[{messageId:"replace",data:{replacement:o.replacement},fix:l=>o.replacement?l.replaceText(s.key,o.replacement):null}]})}}}}}}:{}}}),Kt={name:cr,rule:Zs};var at=require("@typescript-eslint/utils"),Ks=at.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),ur="require-description",Qs=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,eo=/^eslint-disable-(next-)?line$/u,to=Ks({name:ur,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 a of r.getAllComments()){let s=no(a);s!=null&&(n.has(s.kind)||s.description||e.report({loc:so(a.loc),messageId:"missingDescription"}))}}}}}),fr={name:ur,rule:to};function no(e){let{text:t,description:r}=io(e.value);if(!t)return null;let n=Qs.exec(t);if(!n)return null;let a=n[1];if(!a)return null;let s=eo.test(a);if(e.type===at.TSESTree.AST_TOKEN_TYPES.Line&&!s||s&&e.loc.start.line!==e.loc.end.line)return null;let i=t.slice(n.index+a.length);return{kind:a,value:i.trim(),description:r}}var ro=/\s-{2,}\s/u;function io(e){let t=e.split(ro);return{text:t[0]?.trim(),description:t.length>1?t[1]?.trim()??null:null}}function so(e){return{start:{line:e.start.line,column:-1},end:e.end}}var U=require("@typescript-eslint/utils"),Te=require("zod/v4");var oo=Te.z.object({varsToCheck:Te.z.array(Te.z.object({selector:Te.z.string().optional(),fromFnCall:Te.z.string().optional(),prop:Te.z.string().or(Te.z.array(Te.z.string())),errorMsg:Te.z.string().optional()}))}),Qt=J({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:[$(oo)]},defaultOptions:[{varsToCheck:[]}],create(e,[t]){let r=new Map;function n(i,o,l,p){let c=new Set;for(let f of i.properties)f.type===U.AST_NODE_TYPES.Property&&f.key.type===U.AST_NODE_TYPES.Identifier&&c.add(f.key.name);let m=o.filter(f=>!c.has(f));if(m.length>0)if(m.length===1)e.report({node:i,messageId:"propNotRead",data:{prop:m[0],fnName:p,customMsg:l||""}});else{let f=m.map(d=>`"${d}"`).join(", ");e.report({node:i,messageId:"propsNotRead",data:{props:f,fnName:p,customMsg:l||""}})}}function a(i){if(i.init?.type===U.AST_NODE_TYPES.CallExpression){if(i.init.callee.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.name;if(i.init.callee.type===U.AST_NODE_TYPES.MemberExpression&&i.init.callee.property.type===U.AST_NODE_TYPES.Identifier)return i.init.callee.object.type===U.AST_NODE_TYPES.Identifier?`${i.init.callee.object.name}.${i.init.callee.property.name}`:i.init.callee.property.name}return"unknown function"}let s={};for(let i of t.varsToCheck)i.selector&&(s[i.selector]=o=>{if(o.type===U.AST_NODE_TYPES.VariableDeclarator&&o.id.type===U.AST_NODE_TYPES.Identifier&&r.set(o.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:o.id,fnName:a(o)}),o.type===U.AST_NODE_TYPES.VariableDeclarator&&o.id.type===U.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(i.prop)?i.prop:[i.prop];n(o.id,l,i.errorMsg,a(o))}});for(let i of t.varsToCheck)if(i.fromFnCall){let o=i.fromFnCall;if(o.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${o.slice(2)}"]`;s[p]=c=>{if(c.type!==U.AST_NODE_TYPES.MemberExpression||c.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let m=c.parent;if(m.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let f=m.parent;if(f.id.type===U.AST_NODE_TYPES.Identifier)r.set(f.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:f.id,fnName:i.fromFnCall||"unknown function"});else if(f.id.type===U.AST_NODE_TYPES.ObjectPattern){let d=Array.isArray(i.prop)?i.prop:[i.prop];n(f.id,d,i.errorMsg,i.fromFnCall||"unknown function")}}}else if(o.includes(".")){let[l,p]=o.split("."),c=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;s[c]=m=>{if(m.type!==U.AST_NODE_TYPES.MemberExpression||m.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let f=m.parent;if(f.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let d=f.parent;if(d.id.type===U.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===U.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(i.prop)?i.prop:[i.prop];n(d.id,y,i.errorMsg,i.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${o}"]`;s[l]=p=>{if(p.type!==U.AST_NODE_TYPES.Identifier||p.parent.type!==U.AST_NODE_TYPES.CallExpression)return;let c=p.parent;if(c.parent.type!==U.AST_NODE_TYPES.VariableDeclarator)return;let m=c.parent;if(m.id.type===U.AST_NODE_TYPES.Identifier)r.set(m.id.name,{props:Array.isArray(i.prop)?i.prop:[i.prop],errorMsg:i.errorMsg,node:m.id,fnName:i.fromFnCall||"unknown function"});else if(m.id.type===U.AST_NODE_TYPES.ObjectPattern){let f=Array.isArray(i.prop)?i.prop:[i.prop];n(m.id,f,i.errorMsg,i.fromFnCall||"unknown function")}}}}return{...s,"Program:exit"(){for(let[i,{props:o,errorMsg:l,node:p,fnName:c}]of r){let f=e.sourceCode.getScope(p).set.get(i);if(f){let d=new Set(o);for(let y of f.references){let E=y.identifier,h=E.parent;if(!(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.id===E)){if(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&d.has(h.property.name)){if(d.delete(h.property.name),d.size===0)break;continue}if(h.type===U.AST_NODE_TYPES.VariableDeclarator&&h.init===E&&h.id.type===U.AST_NODE_TYPES.ObjectPattern){for(let u of h.id.properties)u.type===U.AST_NODE_TYPES.Property&&u.key.type===U.AST_NODE_TYPES.Identifier&&d.has(u.key.name)&&d.delete(u.key.name);if(d.size===0)break;continue}if(!(h.type===U.AST_NODE_TYPES.MemberExpression&&h.object===E&&h.property.type===U.AST_NODE_TYPES.Identifier&&!o.includes(h.property.name))){d.clear();break}}}if(d.size>0){let y=Array.from(d);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:c,customMsg:l||""}});else{let E=y.map(h=>`"${h}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:E,fnName:c,customMsg:l||""}})}}}}}}}});function yr(e){return/^use[A-Z0-9]/.test(e)}function lt(e){return e.type==="Identifier"?yr(e.name):e.type==="MemberExpression"&&!e.computed&<(e.property)?e.object.type==="Identifier":!1}function gr(e){return e.type==="Identifier"&&/^[A-Z]/.test(e.name)}function Sr(e,t){return e.name===t||e.type==="MemberExpression"&&e.object.name==="React"&&e.property.name===t}function Tr(e){return!!(e.parent&&e.parent.callee&&Sr(e.parent.callee,"forwardRef"))}function hr(e){return!!(e.parent&&e.parent.callee&&Sr(e.parent.callee,"memo"))}function en(e){for(;e;){let t=xr(e);if(t&&(gr(t)||lt(t))||Tr(e)||hr(e))return!0;e=e.parent}return!1}function mr(e){return!1}function tn(e){return!1}var ao=/eslint +react-compiler\/react-compiler: +\["error/,Er={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(ao.test(l.value))return{CallExpression(p){let c=null;p.callee.name==="useMemo"?c="useMemo":p.callee.name==="useCallback"&&(c="useCallback"),c&&e.report({node:p,message:`"${c}" 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,a=[],s=[],i=new WeakSet;function o(l){for(let p of l.references){let c=p.identifier.parent;if(c.type==="VariableDeclarator"&&c.init&&c.init.type==="CallExpression"&&c.init.callee&&mr(c.init.callee))for(let m of p.resolved.references)m!==p&&i.add(m.identifier)}}return{onCodePathSegmentStart:l=>s.push(l),onCodePathSegmentEnd:()=>s.pop(),onCodePathStart:()=>a.push(new Map),onCodePathEnd(l,p){let c=a.pop();if(c.size===0)return;let m=new Set;function f(g,A){let{cache:S}=f,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=[...v],D=R.slice(R.indexOf(g.id)+1);for(let _ of D)m.add(_);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.prevSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.prevSegments)I+=f(R,v)}return g.reachable&&I===BigInt("0")?S.delete(g.id):S.set(g.id,I),I}function d(g,A){let{cache:S}=d,I=S.get(g.id),v=new Set(A);if(v.has(g.id)){let R=Array.from(v),D=R.slice(R.indexOf(g.id)+1);for(let _ of D)m.add(_);return BigInt("0")}if(v.add(g.id),I!==void 0)return I;if(l.thrownSegments.includes(g))I=BigInt("0");else if(g.nextSegments.length===0)I=BigInt("1");else{I=BigInt("0");for(let R of g.nextSegments)I+=d(R,v)}return S.set(g.id,I),I}function y(g){let{cache:A}=y,S=A.get(g.id);if(S===null)return 1/0;if(S!==void 0)return S;if(A.set(g.id,null),g.prevSegments.length===0)S=1;else{S=1/0;for(let I of g.prevSegments){let v=y(I);v<S&&(S=v)}S+=1}return A.set(g.id,S),S}f.cache=new Map,d.cache=new Map,y.cache=new Map;let E=d(l.initialSegment),h=xr(p),u=en(p),x=h?gr(h)||lt(h):Tr(p)||hr(p),b=1/0;for(let g of l.finalSegments){if(!g.reachable)continue;let A=y(g);A<b&&(b=A)}for(let[g,A]of c){if(!g.reachable)continue;let S=g.nextSegments.length===0?b<=y(g):b<y(g),I=f(g)*d(g),v=m.has(g.id);for(let R of A)if(v&&!tn(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.`}),x){if(p.async&&e.report({node:R,message:`React Hook "${t(R)}" cannot be called in an async function.`}),!v&&I!==E&&!tn(R)){let _=`React Hook "${t(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:_})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){let D=`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:D})}else if(h){let D=`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:D})}else if(p.type==="Program"){let D=`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:D})}else if(u&&!tn(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let _=p.parent;if(_.parent.type==="VariableDeclarator"&&yr(_.parent.id.name))return}let D=`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:D})}}},CallExpression(l){if(lt(l.callee)){let p=dr(a),c=dr(s),m=p.get(c);m||(m=[],p.set(c,m)),m.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||mr(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){en(l)&&o(r(l))},ArrowFunctionExpression(l){en(l)&&o(r(l))}}}};function xr(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 dr(e){return e[e.length-1]}var Q=require("@typescript-eslint/utils"),oe=Ee(require("zod/v4"));var lo=/^\s+$/,nn=/\r?\n/,po=/^(\s*)/,co=/^(\s*)\S/,uo=/\r?\n/,fo=oe.object({indent:oe.union([oe.string().regex(lo),oe.number().int().min(1)]).optional(),tags:oe.array(oe.string()).optional(),functions:oe.array(oe.string()).optional(),comments:oe.array(oe.string()).optional()}),rn=J({name:"template-indent",meta:{type:"suggestion",docs:{description:"Fix whitespace-insensitive template indentation"},fixable:"code",schema:[$(fo)],messages:{improperlyIndented:"Templates should be properly indented."}},defaultOptions:[{}],create(e){let t=e.sourceCode,{comments:r=["HTML","indent"],functions:n=["dedent","stripIndent"],tags:a=["outdent","dedent","gql","sql","html","styled"],indent:s}=e.options[0],i=r.map(u=>u.toLowerCase());function o(u){let x=u.split(nn),b=x.filter(A=>A.trim()!=="");if(b.length===0)return u;let g=Number.POSITIVE_INFINITY;for(let A of b){let S=A.match(po);S&&(g=Math.min(g,S[1]?.length??0))}return!isFinite(g)||g===0?u:x.map(A=>A.slice(g)).join(`
|
|
21
|
+
`)}function l(u,x,b){return u.split(nn).map(A=>A.trim()===""?A:b.repeat(x)+A).join(`
|
|
22
|
+
`)}function p(u){if(u.type===Q.AST_NODE_TYPES.Identifier)return u.name;if(u.type===Q.AST_NODE_TYPES.MemberExpression){let x=u.object.type===Q.AST_NODE_TYPES.Identifier?u.object.name:null,b=u.property.type===Q.AST_NODE_TYPES.Identifier?u.property.name:null;return x&&b?`${x}.${b}`:b}return null}function c(u,x){if(!u)return!1;for(let b of x)if(b.includes(".")){let g=b.split(".");if(u.type===Q.AST_NODE_TYPES.MemberExpression&&u.object.type===Q.AST_NODE_TYPES.Identifier&&u.property.type===Q.AST_NODE_TYPES.Identifier&&u.object.name===g[0]&&u.property.name===g[1])return!0}else if(u.type===Q.AST_NODE_TYPES.Identifier&&u.name===b)return!0;return!1}function m(u,x){let b=u.parent;if(b.type!==Q.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let g=p(b.tag);return g?x.includes(g):!1}function f(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{method:b,argumentsLength:g,optionalCall:A=!0,optionalMember:S=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.MemberExpression||!S&&u.callee.optional||u.callee.property.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.property.name===b}function d(u,x){if(!u||u.type!==Q.AST_NODE_TYPES.CallExpression)return!1;let{name:b,argumentsLength:g,optionalCall:A=!0}=x;return g!==void 0&&u.arguments.length!==g||!A&&u.optional||u.callee.type!==Q.AST_NODE_TYPES.Identifier?!1:u.callee.name===b}function y(u){return f(u.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments[0]===u&&d(u.parent.callee.type===Q.AST_NODE_TYPES.MemberExpression?u.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function E(u){if(i.length>0){let x=t.getTokenBefore(u,{includeComments:!0});if(x?.type===Q.AST_TOKEN_TYPES.Block&&i.includes(x.value.trim().toLowerCase()))return!0}return!!(y(u)||a.length>0&&m(u,a)||n.length>0&&u.parent.type===Q.AST_NODE_TYPES.CallExpression&&u.parent.arguments.includes(u)&&c(u.parent.callee,n))}function h(u){let x=`__PLACEHOLDER__${Math.random()}`,b=u.quasis.map(Y=>t.getText(Y).slice(1,Y.tail?-1:-2)).join(x),g=b.match(uo);if(!g)return;let A=g[0],S=t.lines[t.getLocFromIndex(u.range[0]).line-1];if(!S)return;let v=S.match(co)?.[1]??"",R;typeof s=="string"?R=s:typeof s=="number"?R=" ".repeat(s):R=v.startsWith(" ")?" ":" ";let _=o(b).replace(new RegExp(`^${A}|${A}[ ]*$`,"g"),""),K=A+l(_,1,v+R)+A+v,q=b.includes(`\r
|
|
23
23
|
`)?`\r
|
|
24
24
|
`:`
|
|
25
|
-
`,ee=b.split(
|
|
25
|
+
`,ee=b.split(nn),te=ee.map((Y,de)=>de!==ee.length-1&&Y===R+v?"":Y).join(q);if(K!==te)return{node:u,messageId:"improperlyIndented",fix:Y=>K.split(x).map((de,Me)=>{let ie=u.quasis[Me];return ie?Y.replaceTextRange([ie.range[0]+1,ie.range[1]-(ie.tail?1:2)],de):[]}).flat()}}return{TemplateLiteral(u){if(!E(u))return;let x=h(u);if(x)return e.report(x)}}}});var sn=require("@typescript-eslint/utils");function mo(e){if(!("regex"in e))return!1;let t=e.regex.flags;return t.includes("g")||t.includes("y")}function yo(e){let t=e.parent;return t?.type===sn.AST_NODE_TYPES.NewExpression&&t.callee.type===sn.AST_NODE_TYPES.Identifier&&t.callee.name==="RegExp"}var on=J({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){mo(r)||yo(r)||e.report({node:r,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":t}}});var ae=require("@typescript-eslint/utils"),Ue=require("zod/v4");var go=Ue.z.object({checkOnly:Ue.z.array(Ue.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Ue.z.array(Ue.z.string()).optional()}),an=J({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:[$(go)],messages:{moveTypeAboveUsage:"Type definition should be placed directly above its first usage."}},defaultOptions:[{}],create(e,[t]){let r=e.sourceCode,n=new Map,a=[];function s(f){for(let d of a)if(f.range[0]>=d.range[0]&&f.range[1]<=d.range[1])return d;return null}function i(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.FunctionDeclaration||d.type===ae.AST_NODE_TYPES.FunctionExpression||d.type===ae.AST_NODE_TYPES.ArrowFunctionExpression){let y=d.params;for(let E of y)if(f.range[0]>=E.range[0]&&f.range[1]<=E.range[1])return!0;break}d=d.parent}return!1}function o(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===ae.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ae.AST_NODE_TYPES.TSQualifiedName&&y.typeName.right.name==="FC")return!0}d=d.parent}return!1}function l(f){let d=f.parent;for(;d;){if(d.type===ae.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=d.parent;if(y.type===ae.AST_NODE_TYPES.CallExpression||y.type===ae.AST_NODE_TYPES.NewExpression)return!0}d=d.parent}return!1}let p=[];function c(f){let d=[],y=new Map;for(let{typeName:h,firstUsage:u}of f){let x=y.get(u)||[];x.push(h),y.set(u,x)}for(let{typeName:h,firstUsage:u,firstUsagePosition:x,firstUsageInFunctionArgs:b}of f){let g=n.get(h);if(!g||g.statement===u)continue;let A=a.indexOf(g.statement),S=a.indexOf(u);if(A===-1||S===-1)continue;let I=!!(t.checkOnly&&t.checkOnly.includes("function-args")&&b),R=(y.get(u)||[]).length>1;(I||R?A>S:A>S||A!==S-1)&&d.push({typeName:h,typeDef:g,targetStatement:u,firstUsagePosition:x})}if(d.length===0)return;d.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=a.indexOf(h.typeDef.statement),g=a.indexOf(u.typeDef.statement);return b-g});let E=d[0];E&&e.report({node:E.typeDef.node,messageId:"moveTypeAboveUsage",fix:m(d)})}function m(f){return function*(d){let y=new Map;for(let E of f){let h=y.get(E.targetStatement)||[];h.push(E),y.set(E.targetStatement,h)}for(let[,E]of y)E.sort((h,u)=>{let x=h.firstUsagePosition-u.firstUsagePosition;if(x!==0)return x;let b=a.indexOf(h.typeDef.statement),g=a.indexOf(u.typeDef.statement);return b-g});for(let E of f){let{typeDef:h}=E,u=h.statement,x=r.getCommentsBefore(u),b=u.range[0],g=u.range[1];x.length>0&&x[0]&&(b=x[0].range[0]),yield d.removeRange([b,g])}for(let[E,h]of y){let u=r.getCommentsBefore(E),x=u.length>0&&u[0]?u[0].range[0]:E.range[0],b=[];for(let g of h){let A=g.typeDef.statement,S=r.getText(A),I=r.getCommentsBefore(A),v=S;I.length>0&&(v=`${I.map(D=>r.getText(D)).join(`
|
|
26
26
|
`)}
|
|
27
27
|
${S}`),b.push(v)}yield d.insertTextBeforeRange([x,x],`${b.join(`
|
|
28
28
|
|
|
29
29
|
`)}
|
|
30
30
|
|
|
31
|
-
`)}}}return{Program(f){
|
|
31
|
+
`)}}}return{Program(f){a.push(...f.body)},TSTypeAliasDeclaration(f){if(a.some(y=>y.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&y.declaration===f?!0:y===f)){let y=s(f);y&&n.set(f.id.name,{node:f,name:f.id.name,statement:y})}},TSInterfaceDeclaration(f){if(a.some(y=>y.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&y.declaration===f?!0:y===f)){let y=s(f);y&&n.set(f.id.name,{node:f,name:f.id.name,statement:y})}},TSTypeReference(f){if(f.typeName.type===ae.AST_NODE_TYPES.Identifier){let d=i(f),y=o(f),E=l(f);p.push({typeName:f.typeName.name,node:f,inFunctionArgs:d,inFCProps:y,inGenericArgAtFunctionCall:E,usagePosition:f.range[0]})}},"Program:exit"(){let f=new Map,d=p.filter(E=>{if(!t.checkOnly||t.checkOnly.length===0)return!0;for(let h of t.checkOnly)if(h==="function-args"&&E.inFunctionArgs||h==="FC"&&E.inFCProps||h==="generic-args-at-fn-calls"&&E.inGenericArgAtFunctionCall)return!0;return!1});for(let E of d){let{typeName:h,node:u}=E;if(n.has(h)){let x=s(u),b=n.get(h);if(x&&b&&x!==b.statement){f.has(h)||f.set(h,[]);let g=f.get(h);if(!g)return;g.includes(x)||g.push(x)}}}let y=[];for(let[E,h]of f)if(h.length>0){let u=h[0];if(!u)continue;let x=Number.MAX_SAFE_INTEGER,b=!1;for(let g of h)g.range[0]<u.range[0]&&(u=g);for(let g of d)g.typeName===E&&s(g.node)===u&&g.usagePosition<x&&(x=g.usagePosition,b=g.inFunctionArgs);y.push({typeName:E,firstUsage:u,firstUsagePosition:x,firstUsageInFunctionArgs:b})}y.length>0&&c(y)}}}});var br={[zt.name]:zt.rule,[Et.name]:Et.rule,[ht.name]:ht.rule,"rules-of-hooks":Er,"exhaustive-deps":hn,"require-description":fr.rule,[xt.name]:xt.rule,[Ct.name]:Ct.rule,[Vt.name]:Vt.rule,[ut.name]:ut.rule,[Tt.name]:Tt.rule,[kt.name]:kt.rule,[Ve.name]:Ve.rule,[Bt.name]:Bt.rule,[vt.name]:vt.rule,[bt.name]:bt.rule,[Pt.name]:Pt.rule,[mt.name]:mt.rule,[Kt.name]:Kt.rule,[Zt.name]:Zt.rule,[St.name]:St.rule,[Mt.name]:Mt.rule,[jt.name]:jt.rule,[_t.name]:_t.rule,[$t.name]:$t.rule,[Lt.name]:Lt.rule,[Jt.name]:Jt.rule,[Nt.name]:Nt.rule,[Ot.name]:Ot.rule,[on.name]:on.rule,[Wt.name]:Wt.rule,[Qt.name]:Qt.rule,[rn.name]:rn.rule,[an.name]:an.rule,[Ve.name]:Ve.rule};var So={rules:br};0&&(module.exports={extendedLintPlugin});
|