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