@ls-stack/extended-lint 0.67.0 → 0.67.2
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 +21 -21
- package/dist/extended-lint.mjs +21 -21
- package/package.json +1 -1
package/dist/extended-lint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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===
|
|
3
|
-
`)||
|
|
4
|
-
`,
|
|
1
|
+
"use strict";var Xr=Object.create;var rt=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Yr=Object.getPrototypeOf,qr=Object.prototype.hasOwnProperty;var Zr=(e,n)=>{for(var i in n)rt(e,i,{get:n[i],enumerable:!0})},In=(e,n,i,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Br(n))!qr.call(e,o)&&o!==i&&rt(e,o,{get:()=>n[o],enumerable:!(t=Hr(n,o))||t.enumerable});return e};var Te=(e,n,i)=>(i=e!=null?Xr(Yr(e)):{},In(n||!e||!e.__esModule?rt(i,"default",{value:e,enumerable:!0}):i,e)),Gr=e=>In(rt({},"__esModule",{value:!0}),e);var na={};Zr(na,{extendedLintPlugin:()=>ta});module.exports=Gr(na);var ae=require("@typescript-eslint/utils"),v=require("zod/v4");var Rn=require("@typescript-eslint/utils"),wn=Te(require("zod/v4"));function W(e){let i=Rn.ESLintUtils.RuleCreator(t=>`https://github.com/lucasols/extended-lint#${t}`)(e);return{name:e.name,rule:i}}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()})))})))}),Tt=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 i={},{mustMatchSyntax:t,__dev_simulateFileName:o,disallow:a,disallowFnCalls:r}=n,c=o??e.filename,l=[],p=new Map,d=new Set,g=new Map,s=new Set,u=new Map;function y(S){for(let A of S.specifiers)A.type===ae.AST_NODE_TYPES.ImportSpecifier&&A.imported.type===ae.AST_NODE_TYPES.Identifier&&A.imported.name!==A.local.name&&u.set(A.local.name,A.imported.name)}function h(S){if(S.declaration){if(S.declaration.type===ae.AST_NODE_TYPES.FunctionDeclaration&&S.declaration.id){let A=S.declaration.id.name;for(let w of Array.from(s)){let[R,L]=w.split(":");R===A&&(L==="function"||L==="any")&&s.delete(w)}}else if(S.declaration.type===ae.AST_NODE_TYPES.VariableDeclaration){for(let A of S.declaration.declarations)if(A.id.type===ae.AST_NODE_TYPES.Identifier){let w=A.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 A of S.specifiers)if(A.exported.type===ae.AST_NODE_TYPES.Identifier){let w=A.exported.name;for(let R of Array.from(s)){let[L,U]=R.split(":");L===w&&U==="any"&&s.delete(R)}}}function T(S){S.id.type===ae.AST_NODE_TYPES.Identifier&&S.init?.type===ae.AST_NODE_TYPES.Identifier&&u.set(S.id.name,S.init.name)}function f(S){return u.get(S)??S}function E(S,A){return f(S)===A||S===A}for(let{includeRegex:S,mustCallFn:A,mustMatchSelector:w,mustHaveExport:R}of t??[]){let U=function(ne){let Q=ne;for(let{name:se,value:oe}of L??[])Q=Q.replaceAll(se,oe);return Q};var b=U;let L=Qr(c,new RegExp(S));if(L){for(let{anyCall:ne,message:Q}of A??[]){let se=`Expected file to call the function: ${ne.map(({fn:oe})=>oe).join(" or ")}`;d.add(se),l.push(oe=>{let{callee:Z}=oe;if(Z.type===ae.AST_NODE_TYPES.Identifier){for(let{fn:Ee,withArgs:Ue}of ne)if(Z.name===Ee){d.delete(se);for(let le of Ue){let Fe=oe.arguments[le.atIndex],ye=typeof le.literal=="string"?U(le.literal):le.literal;if(!Fe){e.report({node:oe,messageId:"default",data:{message:`Missing argument with value "${ye}" at index ${le.atIndex}${Q?`: ${U(Q)}`:""}`}});continue}if(Fe.type!==ae.AST_NODE_TYPES.Literal){e.report({node:Fe,messageId:"default",data:{message:`Argument at position ${le.atIndex} should the literal "${ye}"${Q?`: ${U(Q)}`:""}`}});continue}Fe.value!==ye&&e.report({node:Fe,messageId:"default",data:{message:`Argument should have the value "${ye}"${Q?`: ${U(Q)}`:""}`},fix:je=>je.replaceText(Fe,typeof ye=="string"?`'${ye}'`:String(ye))})}break}}})}for(let{selector:ne,message:Q}of w??[])g.set(ne,U(Q)),p.set(U(ne),()=>{g.delete(ne)});for(let{name:ne,type:Q,message:se}of R??[]){let oe=U(ne),Z=U(se);s.add(`${oe}:${Q}:${Z}`)}}}for(let{fn:S,withArgs:A,message:w,replaceWith:R,ignoreRegex:L}of r??[])L&&new RegExp(L).test(c)||l.push(U=>{let{callee:ne}=U;if(ne.type!==ae.AST_NODE_TYPES.Identifier||!E(ne.name,S))return;if(A)for(let se of A){let oe=U.arguments[se.atIndex];if(!oe){e.report({node:U,messageId:"default",data:{message:`Missing argument with value "${se.value}" at index ${se.atIndex}: ${w}`}});return}if(oe.type!==ae.AST_NODE_TYPES.Literal||oe.value!==se.value)return}let Q=se=>R?se.replaceText(U,R):null;e.report({node:U,messageId:"default",data:{message:w},suggest:R?[{messageId:"default",data:{message:`Replace with "${R}"`},fix:Q}]:void 0})});function x(S,A){let w=i[S];w?i[S]=R=>{w(R),A(R)}:i[S]=A}for(let{selector:S,message:A,replace:w,replaceType:R="suggestion"}of a??[]){if(S==="CallExpression"){l.push(L=>{m(w,L,A,R)});continue}i[S]=L=>{m(w,L,A,R)}}if(p.size>0)for(let[S,A]of p)x(S,A);return l.length>0&&(i.CallExpression=S=>{if(S.type===ae.AST_NODE_TYPES.CallExpression)for(let A of l)A(S)}),i.ImportDeclaration=S=>{S.type===ae.AST_NODE_TYPES.ImportDeclaration&&y(S)},i.ExportNamedDeclaration=S=>{S.type===ae.AST_NODE_TYPES.ExportNamedDeclaration&&h(S)},i.VariableDeclarator=S=>{S.type===ae.AST_NODE_TYPES.VariableDeclarator&&T(S)},i["Program:exit"]=S=>{for(let A of d)e.report({node:S,messageId:"default",data:{message:A}});for(let[,A]of g)e.report({node:S,messageId:"default",data:{message:A}});for(let A of s){let[w,R,L]=A.split(":");e.report({node:S,messageId:"default",data:{message:`Missing required export "${w}" of type ${R}: ${L}`}})}},i;function m(S,A,w,R){let L=U=>{if(!S)return null;if(typeof S=="string")return U.replaceText(A,S);{let ne=new RegExp(S.regex),Q=e.sourceCode.getText(A);return U.replaceText(A,Q.replace(ne,S.with))}};e.report({node:A,messageId:"default",data:{message:w},fix:S&&R==="autofix"?L:void 0,suggest:S&&R==="suggestion"?[{messageId:"default",data:{message:`Replace with "${typeof S=="string"?S:S.with}"`},fix:L}]:void 0})}}});function Qr(e,n){let i=[],t=n.exec(e);if(!t)return null;let[o,...a]=t;i.push({name:"$0_lowercase",value:o.toLowerCase()}),i.push({name:"$0_capitalize",value:vn(o)}),i.push({name:"$0_uncapitalize",value:Fn(o)}),i.push({name:"$0",value:o});for(let r=0;r<a.length;r++){let c=`$${r+1}`,l=a[r];l!==void 0&&(i.push({name:`${c}_lowercase`,value:l.toLowerCase()}),i.push({name:`${c}_capitalize`,value:vn(l)}),i.push({name:`${c}_uncapitalize`,value:Fn(l)}),i.push({name:c,value:l}))}return i}function vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fn(e){return e.charAt(0).toLowerCase()+e.slice(1)}var V=require("@typescript-eslint/utils"),Pe=require("zod/v4");var ei=V.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Pn="collapse-simple-objs-in-one-line",ti=Pe.z.object({maxLineLength:Pe.z.number().optional(),maxProperties:Pe.z.number().optional(),nestedObjMaxLineLength:Pe.z.number().optional(),nestedObjMaxProperties:Pe.z.number().optional(),ignoreTypesWithSuffix:Pe.z.array(Pe.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 i=e.sourceCode,t=n.ignoreTypesWithSuffix??[],o=n.maxProperties??2,a=n.nestedObjMaxLineLength??n.maxLineLength,r=n.nestedObjMaxProperties??3;function c(p){if(p.type===V.AST_NODE_TYPES.ObjectExpression){let d=p.parent.type===V.AST_NODE_TYPES.Property,g=d?r:o,s=p.properties.length;if(s>g)return!1;if(s===1){let y=p.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(T=>T&&ht(T))?!1:{text:i.getText(y),isNested:d,propsSize:s}}let u=[];for(let y of p.properties){if(y.type===V.AST_NODE_TYPES.Property&&!ht(y.value))return!1;u.push(i.getText(y))}return{text:u.join(", "),isNested:d,propsSize:s}}else{let d=p.parent.parent?.type===V.AST_NODE_TYPES.TSPropertySignature,g=d?r:o,s=p.members.length;if(s>g)return!1;if(t.length>0&&p.parent.type===V.AST_NODE_TYPES.TSTypeAliasDeclaration){let y=p.parent.id.name;if(t.some(h=>y.endsWith(h)))return!1}if(s===1){let y=p.members[0];return!y||y.type===V.AST_NODE_TYPES.TSPropertySignature&&y.typeAnnotation?.typeAnnotation.type===V.AST_NODE_TYPES.TSTypeLiteral?!1:{text:i.getText(y),isNested:d,propsSize:1}}if(p.parent.type===V.AST_NODE_TYPES.TSIntersectionType||p.parent.type===V.AST_NODE_TYPES.TSUnionType&&p.parent.types[0]!==p)return!1;let u=[];for(let y of p.members){if(y.type!==V.AST_NODE_TYPES.TSPropertySignature)return!1;let h=y.typeAnnotation?.typeAnnotation;if(!h||h.type===V.AST_NODE_TYPES.TSTypeLiteral||!kn(h))return!1;if(h.type===V.AST_NODE_TYPES.TSTypeReference&&h.typeArguments){if(h.typeArguments.params.length>1)return!1;let f=h.typeArguments.params[0];if(!f||!kn(f))return!1}let T=i.getText(y).trim();(T.endsWith(";")||T.endsWith(","))&&(T=T.slice(0,-1)),u.push(T)}return{text:u.join("; "),isNested:d,propsSize:s}}}function l(p){if(p.loc.start.line===p.loc.end.line)return;if(p.parent.type!==V.AST_NODE_TYPES.JSXExpressionContainer){let h=0,T=!1,f=i.getTokenAfter(p,{filter:x=>x.type!==V.AST_TOKEN_TYPES.Punctuator||T?!0:x.value===","?(h++,!1):x.value===";"?(h++,T=!0,!1):x.value===")"||x.value==="}"?(h++,!1):!0});if(h>4)return;let E=f?.type===V.AST_TOKEN_TYPES.Template&&f.value.startsWith(`}
|
|
2
|
+
`);if(f?.loc.start.line===p.loc.end.line&&!E)return}let d=c(p);if(!d)return;let g=d.text;if(g.includes(`
|
|
3
|
+
`)||i.getCommentsInside(p).length>0)return;g.endsWith(";")&&(g=g.slice(0,-1));let s=`{ ${g} }`,u=ii(i,p),y=d.isNested&&d.propsSize>2?a:n.maxLineLength;y&&s.length+u.length+ri(p,i)>y||e.report({node:p,messageId:"singleLineProp",fix:h=>h.replaceText(p,s)})}return{TSTypeLiteral:l,ObjectExpression:l}}});function kn(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 ht(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(i=>i&&ht(i,!0)))}function ri(e,n){let i=n.getLastToken(e);if(!i)return 0;let t=n.text.indexOf(`
|
|
4
|
+
`,i.range[1]);return(t!==-1?t:n.text.length)-i.range[1]}function ii(e,n){return e.text.slice(n.range[0]-n.loc.start.column,n.range[0])}var Et={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,i=typeof e.getSource=="function"?f=>i(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,r={additionalHooks:o,enableDangerousAutofixThisMayCauseInfiniteLoops:a};function c(f){a&&Array.isArray(f.suggest)&&f.suggest.length>0&&(f.fix=f.suggest[0].fix),e.report(f)}let l=e.getSourceCode().scopeManager,p=new WeakMap,d=new WeakSet,g=new WeakMap,s=new WeakMap,u=new WeakSet;function y(f,E){return function(x){if(E.has(x))return E.get(x);let m=f(x);return E.set(x,m),m}}function h(f,E,x,m,b){b&&f.async&&c({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,35 +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&&(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(`
|
|
15
|
+
Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`});let S=l.acquire(f),A=new Set,w=null;{let C=S.upper;for(;C&&(A.add(C),C.type!=="function");)C=C.upper;if(!C)return;w=C}let R=Array.isArray;function L(C){if(!R(C.defs))return!1;let I=C.defs[0];if(I==null||I.node.type!=="VariableDeclarator")return!1;let k=I.node.init;if(k==null)return!1;for(;k.type==="TSAsExpression";)k=k.expression;let O=I.node.parent;if(O==null&&(Ct(w.block,I.node.id),O=I.node.parent,O==null))return!1;if(O.kind==="const"&&k.type==="Literal"&&(typeof k.value=="string"||typeof k.value=="number"||k.value===null))return!0;if(k.type!=="CallExpression")return!1;let D=k.callee;if(D.type==="MemberExpression"&&D.object.name==="React"&&D.property!=null&&!D.computed&&(D=D.property),D.type!=="Identifier")return!1;let N=I.node.id,{name:$}=D;if($==="useRef"&&N.type==="Identifier")return!0;if(ci(D)&&N.type==="Identifier"){for(let _ of C.references)_!==N&&u.add(_.identifier);return!0}else if($==="useState"||$==="useReducer"){if(N.type==="ArrayPattern"&&N.elements.length===2&&R(C.identifiers)){if(N.elements[1]===C.identifiers[0]){if($==="useState"){let _=C.references,de=0;for(let Ie=0;Ie<_.length;Ie++){if(_[Ie].isWrite()&&de++,de>1)return!1;p.set(_[Ie].identifier,N.elements[0])}}return!0}else if(N.elements[0]===C.identifiers[0]){if($==="useState"){let _=C.references;for(let de=0;de<_.length;de++)d.add(_[de].identifier)}return!1}}}else if($==="useTransition"&&N.type==="ArrayPattern"&&N.elements.length===2&&Array.isArray(C.identifiers)&&N.elements[1]===C.identifiers[0])return!0;return!1}function U(C){if(!R(C.defs))return!1;let I=C.defs[0];if(I==null||I.node==null||I.node.id==null)return!1;let k=I.node,O=w.childScopes,D=null,N;for(N=0;N<O.length;N++){let $=O[N],_=$.block;if(k.type==="FunctionDeclaration"&&_===k||k.type==="VariableDeclarator"&&_.parent===k){D=$;break}}if(D==null)return!1;for(N=0;N<D.through.length;N++){let $=D.through[N];if($.resolved!=null&&A.has($.resolved.scope)&&!ne($.resolved))return!1}return!0}let ne=y(L,g),Q=y(U,s),se=new Map;function oe(C){let I=C.from,k=!1;for(;I.block!==f;)I.type==="function"&&(k=I.block.parent!=null&&I.block.parent.type==="ReturnStatement"),I=I.upper;return k}let Z=new Map,Ee=new Map;Ue(S);function Ue(C){for(let I of C.references){if(!I.resolved||!A.has(I.resolved.scope))continue;let k=Ct(f,I.identifier),O=Dn(k),D=Re(O,Ee);if(b&&O.type==="Identifier"&&(O.parent.type==="MemberExpression"||O.parent.type==="OptionalMemberExpression")&&!O.parent.computed&&O.parent.property.type==="Identifier"&&O.parent.property.name==="current"&&oe(I)&&se.set(D,{reference:I,dependencyNode:O}),O.parent.type==="TSTypeQuery"||O.parent.type==="TSTypeReference")continue;let N=I.resolved.defs[0];if(N!=null&&!(N.node!=null&&N.node.init===f.parent)&&N.type!=="TypeParameter")if(Z.has(D))Z.get(D).references.push(I);else{let $=I.resolved,_=ne($)||Q($);Z.set(D,{isStable:_,references:[I]})}}for(let I of C.childScopes)Ue(I)}se.forEach(({reference:C,dependencyNode:I},k)=>{let O=C.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||c({node:I.parent.property,message:`The ref value '${k}.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy '${k}.current' to a variable inside the effect, and use that variable in the cleanup function.`})});let le=new Set;function Fe(C,I){le.has(I)||(le.add(I),c({node:C,message:`Assignments to the '${I}' variable from inside React Hook ${i(x)} 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 ${i(x)}.`}))}let ye=new Set;if(Z.forEach(({isStable:C,references:I},k)=>{C&&ye.add(k),I.forEach(O=>{O.writeExpr&&Fe(O.writeExpr,k)})}),le.size>0)return;if(!E){let C=null;if(Z.forEach(({isStable:I,references:k},O)=>{C||k.forEach(D=>{if(C)return;let N=D.identifier;if(!p.has(N))return;let _=D.from;for(;_.type!=="function";)_=_.upper;_.block===f&&(C=O)})}),C){let{suggestedDependencies:I}=bt({dependencies:Z,declaredDependencies:[],stableDependencies:ye,externalDependencies:new Set,isEffect:!0});c({node:x,message:`React Hook ${m} contains a call to '${C}'. Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, pass [`+I.join(", ")+`] as a second argument to the ${m} Hook.`,suggest:[{desc:`Add dependencies array: [${I.join(", ")}]`,fix(k){return k.insertTextAfter(f,`, [${I.join(", ")}]`)}}]})}return}let je=[],Be=new Set;E.type!=="ArrayExpression"?c({node:E,message:`React Hook ${i(x)} 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.`}):E.elements.forEach(C=>{if(C===null)return;if(C.type==="SpreadElement"){c({node:C,message:`React Hook ${i(x)} 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(C)&&c({node:C,message:`Functions returned from \`useEffectEvent\` must not be included in the dependency array. Remove \`${i(C)}\` from the list.`,suggest:[{desc:`Remove the dependency \`${i(C)}\``,fix(D){return D.removeRange(C.range)}}]});let I;try{I=Re(C,Ee)}catch(D){if(/Unsupported node type/.test(D.message)){C.type==="Literal"?Z.has(C.value)?c({node:C,message:`The ${C.raw} literal is not a valid dependency because it never changes. Did you mean to include ${C.value} in the array instead?`}):c({node:C,message:`The ${C.raw} literal is not a valid dependency because it never changes. You can safely remove it.`}):c({node:C,message:`React Hook ${i(x)} 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 k=C;for(;k.type==="MemberExpression"||k.type==="OptionalMemberExpression"||k.type==="ChainExpression";)k=k.object||k.expression.object;let O=!w.through.some(D=>D.identifier===k);je.push({key:I,node:C}),O||Be.add(I)});let{suggestedDependencies:Wr,unnecessaryDependencies:tt,missingDependencies:ke,duplicateDependencies:xn}=bt({dependencies:Z,declaredDependencies:je,stableDependencies:ye,externalDependencies:Be,isEffect:b}),nt=Wr;if(xn.size+ke.size+tt.size===0){if(n)return;oi({declaredDependencies:je,declaredDependenciesNode:E,componentScope:w,scope:S}).forEach(({construction:I,isUsedOutsideOfHook:k,depType:O})=>{let D=O==="function"?"useCallback":"useMemo",N=O==="function"?"definition":"initialization",$=`wrap the ${N} of '${I.name.name}' in its own ${D}() Hook.`,_=k?`To fix this, ${$}`:`Move it inside the ${m} callback. Alternatively, ${$}`,de=O==="conditional"||O==="logical expression"?"could make":"makes",Ie=`The '${I.name.name}' ${O} ${de} the dependencies of ${m} Hook (at line ${E.loc.start.line}) change on every render. ${_}`,Cn;k&&I.type==="Variable"&&O==="function"&&(Cn=[{desc:`Wrap the ${N} of '${I.name.name}' in its own ${D}() Hook.`,fix(An){let[Jr,Vr]=D==="useMemo"?["useMemo(() => { return ","; })"]:["useCallback(",")"];return[An.insertTextBefore(I.node.init,Jr),An.insertTextAfter(I.node.init,Vr)]}}]),c({node:I.node,message:Ie,suggest:Cn})});return}!b&&ke.size>0&&(nt=bt({dependencies:Z,declaredDependencies:[],stableDependencies:ye,externalDependencies:Be,isEffect:b}).suggestedDependencies);function zr(){if(je.length===0)return!0;let C=je.map(k=>k.key),I=C.slice().sort();return C.join(",")===I.join(",")}zr()&&nt.sort();function gt(C){let I=C.split("."),k="";for(let O=0;O<I.length;O++){if(O!==0){let D=I.slice(0,O+1).join("."),N=Ee.get(D)===!0;k+=N?"?.":"."}k+=I[O]}return k}function St(C,I,k,O){return C.size===0?null:(C.size>1?"":I+" ")+k+" "+(C.size>1?"dependencies":"dependency")+": "+li(Array.from(C).sort().map(D=>"'"+gt(D)+"'"))+`. Either ${O} ${C.size>1?"them":"it"} or remove the dependency array.`}let Se="";if(tt.size>0){let C=null;if(Array.from(tt.keys()).forEach(I=>{C===null&&I.endsWith(".current")&&(C=I)}),C!==null)Se=` Mutable values like '${C}' aren't valid dependencies because mutating them doesn't re-render the component.`;else if(Be.size>0){let I=Array.from(Be)[0];S.set.has(I)||(Se=` Outer scope values like '${I}' aren't valid dependencies because mutating them doesn't re-render the component.`)}}if(!Se&&ke.has("props")){let C=Z.get("props");if(C==null)return;let I=C.references;if(!Array.isArray(I))return;let k=!0;for(let O=0;O<I.length;O++){let D=I[O],N=Ct(w.block,D.identifier);if(!N){k=!1;break}let $=N.parent;if($==null){k=!1;break}if($.type!=="MemberExpression"&&$.type!=="OptionalMemberExpression"){k=!1;break}}k&&(Se=` However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the ${m} call and refer to those specific props inside ${i(x)}.`)}if(!Se&&ke.size>0){let C=null;ke.forEach(I=>{if(C)return;let k=w.set.get(I),O=Z.get(I);if(O.references[0].resolved!==k)return;let D=k.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&&(C=I)}),C!==null&&(Se=` If '${C}' changes too often, find the parent component that defines it and wrap that definition in useCallback.`)}if(!Se&&ke.size>0){let C=null;if(ke.forEach(I=>{if(C!==null)return;let O=Z.get(I).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 _=p.get(N.callee);if(_!=null){if(_.name===I)C={missingDep:I,setter:N.callee.name,form:"updater"};else if(d.has(D))C={missingDep:I,setter:N.callee.name,form:"reducer"};else{let de=O[$].resolved;if(de!=null){let Ie=de.defs[0];Ie!=null&&Ie.type==="Parameter"&&(C={missingDep:I,setter:N.callee.name,form:"inlineReducer"})}}break}}N=N.parent}if(C!==null)break}}),C!==null)switch(C.form){case"reducer":Se=` You can also replace multiple useState variables with useReducer if '${C.setter}' needs the current value of '${C.missingDep}'.`;break;case"inlineReducer":Se=` If '${C.setter}' needs the current value of '${C.missingDep}', you can also switch to useReducer instead of useState and read '${C.missingDep}' in the reducer.`;break;case"updater":Se=` You can also do a functional update '${C.setter}(${C.missingDep.slice(0,1)} => ...)' if you only need '${C.missingDep}' in the '${C.setter}' call.`;break;default:throw new Error("Unknown case.")}}c({node:E,message:`React Hook ${i(x)} has `+(St(ke,"a","missing","include")||St(tt,"an","unnecessary","exclude")||St(xn,"a","duplicate","omit"))+Se,suggest:[{desc:`Update the dependencies array to be: [${nt.map(gt).join(", ")}]`,fix(C){return C.replaceText(E,`[${nt.map(gt).join(", ")}]`)}}]})}function T(f){let E=ai(f.callee,r);if(E===-1)return;let x=f.arguments[E],m=f.callee,b=Ln(m).name,S=f.arguments[E+1],A=/Effect($|[^a-z])/g.test(b);if(!x){c({node:m,message:`React Hook ${b} requires an effect callback. Did you forget to pass a callback to the hook?`});return}if(!(n&&!A)){if(!S&&!A){(b==="useMemo"||b==="useCallback")&&c({node:m,message:`React Hook ${b} does nothing when called with only one argument. Did you forget to pass an array of dependencies?`});return}switch(x.type){case"FunctionExpression":case"ArrowFunctionExpression":h(x,S,m,b,A);return;case"Identifier":if(!S||S.elements&&S.elements.some(L=>L&&L.type==="Identifier"&&L.name===x.name))return;let w=t(f).set.get(x.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":h(R.node,S,m,b,A);return;case"VariableDeclarator":let L=R.node.init;if(!L)break;switch(L.type){case"ArrowFunctionExpression":case"FunctionExpression":h(L,S,m,b,A);return}break}break;default:c({node:m,message:`React Hook ${b} received a function whose dependencies are unknown. Pass an inline function instead.`});return}c({node:m,message:`React Hook ${b} has a missing dependency: '${x.name}'. Either include it or remove the dependency array.`,suggest:[{desc:`Update the dependencies array to be: [${x.name}]`,fix(w){return w.replaceText(S,`[${x.name}]`)}}]})}}if(e.options[0]?.ignoreIfReactCompilerIsEnabled){for(let f of e.sourceCode.getAllComments())if(si.test(f.value))return n=!0,{CallExpression:E=>T(E,!0)}}return{CallExpression:f=>T(f)}}};function bt({dependencies:e,declaredDependencies:n,stableDependencies:i,externalDependencies:t,isEffect:o}){let a=r();function r(){return{isUsed:!1,isSatisfiedRecursively:!1,isSubtreeUsed:!1,children:new Map}}e.forEach((h,T)=>{let f=c(a,T);f.isUsed=!0,l(a,T,E=>{E.isSubtreeUsed=!0})}),n.forEach(({key:h})=>{let T=c(a,h);T.isSatisfiedRecursively=!0}),i.forEach(h=>{let T=c(a,h);T.isSatisfiedRecursively=!0});function c(h,T){let f=T.split("."),E=h;for(let x of f){let m=E.children.get(x);m||(m=r(),E.children.set(x,m)),E=m}return E}function l(h,T,f){let E=T.split("."),x=h;for(let m of E){let b=x.children.get(m);if(!b)return;f(b),x=b}}let p=new Set,d=new Set;g(a,p,d,h=>h);function g(h,T,f,E){h.children.forEach((x,m)=>{let b=E(m);if(x.isSatisfiedRecursively){x.isSubtreeUsed&&f.add(b);return}if(x.isUsed){T.add(b);return}g(x,T,f,S=>b+"."+S)})}let s=[],u=new Set,y=new Set;return n.forEach(({key:h})=>{d.has(h)?s.indexOf(h)===-1?s.push(h):y.add(h):u.add(h)}),p.forEach(h=>{s.push(h)}),{suggestedDependencies:s,unnecessaryDependencies:u,duplicateDependencies:y,missingDependencies:p}}function Oe(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 Oe(e.consequent)!=null||Oe(e.alternate)!=null?"conditional":null;case"LogicalExpression":return Oe(e.left)!=null||Oe(e.right)!=null?"logical expression":null;case"JSXFragment":return"JSX fragment";case"JSXElement":return"JSX element";case"AssignmentExpression":return Oe(e.right)!=null?"assignment expression":null;case"NewExpression":return"object construction";case"Literal":return e.value instanceof RegExp?"regular expression":null;case"TypeCastExpression":return Oe(e.expression);case"TSAsExpression":return Oe(e.expression)}return null}function oi({declaredDependencies:e,declaredDependenciesNode:n,componentScope:i,scope:t}){let o=e.map(({key:r})=>{let c=i.variables.find(p=>p.name===r);if(c==null)return null;let l=c.defs[0];if(l==null)return null;if(l.type==="Variable"&&l.node.type==="VariableDeclarator"&&l.node.id.type==="Identifier"&&l.node.init!=null){let p=Oe(l.node.init);if(p!=null)return[c,p]}return l.type==="FunctionName"&&l.node.type==="FunctionDeclaration"?[c,"function"]:l.type==="ClassName"&&l.node.type==="ClassDeclaration"?[c,"class"]:null}).filter(Boolean);function a(r){let c=!1;for(let l=0;l<r.references.length;l++){let p=r.references[l];if(p.writeExpr){if(c)return!0;c=!0;continue}let d=p.from;for(;d!==t&&d!=null;)d=d.upper;if(d!==t&&!jn(n,p.identifier))return!0}return!1}return o.map(([r,c])=>({construction:r.defs[0],depType:c,isUsedOutsideOfHook:a(r)}))}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 xt(e,n,i){n&&(e.optional?n.has(i)||n.set(i,!0):n.has(i)||n.set(i,!1))}function Re(e,n){if(e.type==="Identifier"||e.type==="JSXIdentifier"){let i=e.name;return n&&n.set(i,!1),i}else if(e.type==="MemberExpression"&&!e.computed){let i=Re(e.object,n),t=Re(e.property,null),o=`${i}.${t}`;return xt(e,n,o),o}else if(e.type==="OptionalMemberExpression"&&!e.computed){let i=Re(e.object,n),t=Re(e.property,null),o=`${i}.${t}`;return xt(e,n,o),o}else if(e.type==="ChainExpression"&&!e.computed){let i=e.expression;if(i.type==="CallExpression")throw new Error(`Unsupported node type: ${i.type}`);let t=Re(i.object,n),o=Re(i.property,null),a=`${t}.${o}`;return xt(i,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 i=Ln(e);if(i.type!=="Identifier")return-1;switch(i.name){case"useEffect":case"useLayoutEffect":case"useCallback":case"useMemo":return 0;case"useImperativeHandle":return 1;default:if(i===e&&n&&n.additionalHooks){let t;try{t=Re(i,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 Ct(e,n){let i=[e],t=null;for(;i.length;){if(t=i.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,i.push(a)):Array.isArray(a)&&a.forEach(r=>{On(r)&&(r.parent=t,i.push(r))}))}return null}function li(e){let n="";for(let i=0;i<e.length;i++)n+=e[i],i===0&&e.length===2?n+=" and ":i===e.length-2&&e.length>2?n+=", and ":i<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 K=require("@typescript-eslint/utils"),re=Te(require("typescript")),Un=require("zod/v4");var At=require("@typescript-eslint/utils");function We(e,n,i=1/0){if(i!==0&&e.parent)return e.type===n?e:We(e.parent,n,i===1/0?i:i-1)}function*It(e){yield e,e.parent&&(yield*It(e.parent))}function Rt(e,n){for(let i of e){let t=n(i);if(t!=null&&t!==!1)return t}}function $n(e,n,i){let o=i.getDeclaredVariables(e).find(a=>a.name===n||a.identifiers[0]?.parent.type===At.AST_NODE_TYPES.Property&&a.identifiers[0].parent.key.type===At.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 Ne(e,n,i){let t=i.visitorKeys,o=new Set;function a(r){if(o.has(r))return!1;if(o.add(r),n(r)===!0)return!0;let l=t[r.type];if(l)for(let p of l){let d=ui(r,p);if(d){if(Array.isArray(d)){for(let g of d)if(Mn(g)&&a(g))return!0}else if(Mn(d)&&a(d))return!0}}return!1}a(e)}var fi=K.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),wt={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=K.ESLintUtils.getParserServices(e,!0),i=n.program?.getTypeChecker();if(!i||!n.program)throw new Error("TypeScript services or program not available");function t(s){return s.type===K.AST_NODE_TYPES.UnaryExpression&&s.operator==="typeof"}function o(s){return s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown?null:s.flags&re.default.TypeFlags.StringLike?["string"]:s.flags&re.default.TypeFlags.NumberLike?["number"]:s.flags&re.default.TypeFlags.BigIntLike?["bigint"]:s.flags&re.default.TypeFlags.BooleanLike?["boolean"]:s.flags&re.default.TypeFlags.ESSymbolLike?["symbol"]:s.flags&re.default.TypeFlags.Undefined||s.flags&re.default.TypeFlags.Void?["undefined"]:s.flags&re.default.TypeFlags.Null?["object"]:s.getCallSignatures().length>0?["function"]:s.flags&re.default.TypeFlags.Object?s.getProperties().length===0?["string","number","bigint","boolean","symbol","object","function"]:["object"]:s.flags&re.default.TypeFlags.NonPrimitive?["object"]:s.flags&re.default.TypeFlags.Never?["never"]:null}function a(s){if(!i)return null;let u=n.esTreeNodeToTSNodeMap.get(s),y=i.getTypeAtLocation(u.expression);if(y.flags&re.default.TypeFlags.Any||y.flags&re.default.TypeFlags.Unknown)return null;let h=[];if(y.isUnion()){for(let f of y.types){let E=o(f);if(E)h.push(...E);else return null}return h}let T=o(y);return T?(h.push(...T),h):null}function r(s){if(!(s.operator==="==="||s.operator==="!=="))return;let y=null,h=null;if(t(s.left)?(y=s.left,h=s.right.type===K.AST_NODE_TYPES.Literal&&typeof s.right.value=="string"?s.right.value:null):t(s.right)&&(y=s.right,h=s.left.type===K.AST_NODE_TYPES.Literal&&typeof s.left.value=="string"?s.left.value:null),!y||!h||!gi(h,di))return;let T=a(y);if(!T)return;let f=s.operator==="!==",E=T.includes(h);T.length===1?E&&!f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ze(y,e),type:h}}):!E&&f?e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ze(y,e),type:Array.from(T)[0]}}):!E&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ze(y,e),actualType:it(T),conditionType:h}}):E&&f&&e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ze(y,e),actualType:it(T),conditionType:h}}):!E&&!f?e.report({node:s,messageId:"alwaysFalseTypeofCondition",data:{name:ze(y,e),actualType:it(T),conditionType:h}}):!E&&f&&e.report({node:s,messageId:"unnecessaryTypeofCondition",data:{name:ze(y,e),type:it(T)}})}function c(s){if(s.flags&re.default.TypeFlags.Any||s.flags&re.default.TypeFlags.Unknown)return null;if(s.isUnion()){let u=[];for(let y of s.types)if(y.flags&re.default.TypeFlags.StringLiteral){let h=y.value;u.push(h)}else return null;return u}return s.flags&re.default.TypeFlags.StringLiteral?[s.value]:null}function l(s){if(!i)return null;let u=n.esTreeNodeToTSNodeMap.get(s),y=i.getTypeAtLocation(u),h=c(y);if(h)return h;let T=i.getSymbolAtLocation(u);if(T){let f=i.getTypeOfSymbolAtLocation(T,u),E=c(f);if(E)return E}return null}function p(s){let u=e.sourceCode.ast,y=null;return Ne(u,h=>{if(h.type===K.AST_NODE_TYPES.VariableDeclarator&&h.id.type===K.AST_NODE_TYPES.Identifier&&h.id.name===s.name&&h.id.typeAnnotation){let T=h.id.typeAnnotation.typeAnnotation;if(T.type===K.AST_NODE_TYPES.TSUnionType){let f=[];for(let E of T.types)if(E.type===K.AST_NODE_TYPES.TSLiteralType&&E.literal.type===K.AST_NODE_TYPES.Literal&&typeof E.literal.value=="string")f.push(E.literal.value);else return!0;return y=f,!0}if(T.type===K.AST_NODE_TYPES.TSLiteralType&&T.literal.type===K.AST_NODE_TYPES.Literal&&typeof T.literal.value=="string")return y=[T.literal.value],!0}return!1},e.sourceCode),y}function d(s){if(s.callee.type!==K.AST_NODE_TYPES.MemberExpression||s.callee.property.type!==K.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!==K.AST_NODE_TYPES.Literal||typeof y.value!="string")return;let h=s.callee.object,T=l(h);if(!T&&h.type===K.AST_NODE_TYPES.Identifier&&(T=p(h)),!T||T.length===0)return;let f=y.value;if(u==="includes"&&T.length>1)return;let E=0,x=0;for(let m of T)if((u==="startsWith"?m.startsWith(f):u==="endsWith"?m.endsWith(f):m.includes(f))?E++:x++,E>0&&x>0)return;if(E>0&&x===0){let m=u==="startsWith"?"unnecessaryStartsWithCondition":u==="endsWith"?"unnecessaryEndsWithCondition":"unnecessaryIncludesCondition";e.report({node:s,messageId:m})}else if(x>0&&E===0){let m=u==="startsWith"?"alwaysFalseStartsWithCondition":u==="endsWith"?"alwaysFalseEndsWithCondition":"alwaysFalseIncludesCondition";e.report({node:s,messageId:m})}}function g(s){if(!new Set(["===","!==",">",">=","<","<="]).has(s.operator))return;function y(b){if(b.type!==K.AST_NODE_TYPES.MemberExpression||b.computed||b.property.type!==K.AST_NODE_TYPES.Identifier||b.property.name!=="length")return null;let S=b.object,A=l(S);if(!A||A.length===0)return null;let w=[];for(let R of A)w.push(R.length);return{values:w}}let h=y(s.left),T=y(s.right),f=null,E=null;if(h?s.right.type===K.AST_NODE_TYPES.Literal&&typeof s.right.value=="number"&&(f=h.values,E=s.right.value):T&&s.left.type===K.AST_NODE_TYPES.Literal&&typeof s.left.value=="number"&&(f=T.values,E=s.left.value),!f||E===null)return;let x=0,m=0;for(let b of f){let S=!1;if(s.operator==="==="?S=b===E:s.operator==="!=="?S=b!==E:s.operator===">"?S=b>E:s.operator===">="?S=b>=E:s.operator==="<"?S=b<E:s.operator==="<="&&(S=b<=E),S?x++:m++,x>0&&m>0)return}x>0&&m===0?e.report({node:s,messageId:"unnecessaryLengthCondition"}):m>0&&x===0&&e.report({node:s,messageId:"alwaysFalseLengthCondition"})}return{BinaryExpression(s){r(s),g(s)},CallExpression:d}}})};function it(e){return Array.from(new Set(e)).join(" | ")||"never"}function ze(e,n){let i=e.argument;return i.type===K.AST_NODE_TYPES.Identifier?i.name:n.sourceCode.getText(i)}function gi(e,n){return n.has(e)}var ot=require("@typescript-eslint/utils"),st=require("zod/v4");var Si=ot.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Wn="no-call-with-explicit-generics",Ti=st.z.object({functions:st.z.array(st.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 i=new Set(n.functions);return{CallExpression(t){let{callee:o}=t;o.type===ot.AST_NODE_TYPES.Identifier&&i.has(o.name)&&t.typeArguments&&e.report({node:t,messageId:"noExplicitGenerics",data:{functionName:o.name}})}}}}),vt={name:Wn,rule:hi};var Me=require("@typescript-eslint/utils"),Ei=Me.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 i=new Map(n.functions.map(t=>[t.name,t]));return{CallExpression(t){let{callee:o}=t;if(o.type!==Me.AST_NODE_TYPES.Identifier)return;let a=i.get(o.name);if(!a)return;let{minGenerics:r=1,allowAny:c,disallowTypes:l=n.disallowTypes}=a;(t.typeArguments?.params.length||0)<(r||0)&&e.report({node:t,messageId:"missingGenericDeclaration",data:{functionName:o.name,minGenerics:r||0}}),!(c&&!l)&&t.typeArguments?.params.some(d=>!c&&d.type===Me.AST_NODE_TYPES.TSAnyKeyword||l&&d.type===Me.AST_NODE_TYPES.TSTypeReference&&d.typeName.type===Me.AST_NODE_TYPES.Identifier&&l.includes(d.typeName.name))&&e.report({node:t,messageId:"anyUsedInGenerics",data:{functionName:o.name}})}}}}),Ft={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+:/,Fi=/\w+_\w+:/,ki=/\?\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|=>/,ee={returnStatement:Ai,stringAssignment:Ii,objectPropertyWithQuotes:Ri,computedPropertyAssignment:wi,kebabCaseProperty:vi,snakeCaseProperty:Fi,ternaryOperator:ki,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 i=e.split(":")[0]?.trim();if(i&&Hi.test(i)&&i.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;",ee.returnStatement,"if (","else {","else if (","/>","</","< ","},",": {"," } = ","={",ee.stringAssignment,");",ee.objectPropertyWithQuotes,ee.computedPropertyAssignment,ee.kebabCaseProperty,ee.snakeCaseProperty,"&&","||","()",ee.ternaryOperator,ee.colonWithWord,ee.quotedString,ee.numberWithComma,ee.arrayWithComma,ee.objectWithComma,ee.methodCall,ee.arrayAccess,"?.(","??","=>",ee.quotedPropertyKey],ns=["/>","</",ee.jsxSelfClosing,ee.jsxElement,ee.jsxOpeningTag,ee.jsxClosingTag,ee.htmlOpeningTag,ee.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")||ee.jsdocComment.test(t))return!1;for(let r of Vn)if(a.startsWith(r))return!1;if(t.includes("https://")||es(a))return!1;if(o==="Block"){for(let r of ns)if(typeof r=="string"){if(t.includes(r))return{wrongPattern:r}}else if(r.test(t))return{wrongPattern:`regex(${r.toString()})`};return!1}for(let r of Ci)if(a.startsWith(r))return{wrongPattern:r};for(let r of ts)if(typeof r=="string"){if(t.includes(r))return{wrongPattern:r}}else if(r.test(t))return{wrongPattern:`regex(${r.toString()})`};return!1}function i(t,o){let a=t,r=a.trim();if(r.startsWith("`")&&(r.endsWith("`,")||r.endsWith("`;")||r.endsWith("`")))return a;if(o==="Block"&&a.includes("```")){let p=a.split(Yi);p.some(g=>Jn.test(g))&&(a=p.join(""))}if(!a.includes("`"))return a;let c=a.split(qi);return c.some(p=>Jn.test(p))?c.join(""):a}return{Program(){let o=e.sourceCode.getAllComments();for(let a of o){let r=i(a.value,a.type),c=n(r,a.type);c&&e.report({node:a,messageId:"commentedOutCode",data:{wrongPattern:c.wrongPattern,allowedPrefixes:Vn.join(", ")}})}}}}}),kt={name:Hn,rule:rs};var at=require("@typescript-eslint/utils"),is=at.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 i of n.specifiers)i.exported.type===at.TSESTree.AST_NODE_TYPES.Identifier&&i.exported.name==="default"&&e.report({node:n,messageId:"noDefaultExport"})}}}}),Pt={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 i=n.value.trim();if(!i)return;let t="";as.includes(i)?t=i:i.includes("&&")?t="&&":i.includes("||")?t="||":i.endsWith("? (")&&(t="? ("),t&&e.report({node:n,messageId:"leakedTextInJSX",data:{text:t}})}}}}),Ot={name:qn,rule:ls};var De=require("@typescript-eslint/utils"),ps=De.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!==De.AST_NODE_TYPES.TSQualifiedName)return!1;let{left:n,right:i}=e.typeName;return n.type===De.AST_NODE_TYPES.Identifier&&n.name==="JSX"&&i.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 i=n.returnType?.typeAnnotation;if(i&&(i.type===De.AST_NODE_TYPES.TSTypeReference?Zn(i):i.type===De.AST_NODE_TYPES.TSUnionType&&i.types.some(o=>o.type===De.AST_NODE_TYPES.TSTypeReference&&Zn(o))))return;e.report({node:n.id,messageId:"nonCamelCaseFunction",data:{functionName:n.id.name}})}}}}}),Nt={name:Gn,rule:us};var B=require("@typescript-eslint/utils");var fs=B.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 r=a.references[0];if(!r)return!1;for(let c of It(r.identifier)){if("returnType"in c||c.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration)return!1;let l=c.parent;if(!l)return!1;if(l.type===B.TSESTree.AST_NODE_TYPES.TSTypeParameterInstantiation&&l.parent.type===B.TSESTree.AST_NODE_TYPES.TSTypeReference&&l.parent.typeName.type===B.TSESTree.AST_NODE_TYPES.Identifier&&l.parent.typeName.name==="FC"){let d=We(l.parent.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!d)return!1;let g=lt(d,e.sourceCode);return g?!(g.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&g.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&g.parent.callee.name==="memo"):!1}if(c.type===B.TSESTree.AST_NODE_TYPES.AssignmentPattern)return!1;if(l.type===B.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression){let p=We(l,B.TSESTree.AST_NODE_TYPES.VariableDeclaration);return p?!!lt(p,e.sourceCode):!1}if(l.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration)return!!lt(l,e.sourceCode)}return!1}function i(t){t.key.type!==B.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=We(t,B.TSESTree.AST_NODE_TYPES.TSPropertySignature);if(!a)return null;let r=e.sourceCode.getText(a);return o.replaceText(a,r.replace("?:",": undefined |"))}}]})}return{TSTypeAliasDeclaration(t){if(t.typeAnnotation.type===B.TSESTree.AST_NODE_TYPES.TSTypeLiteral&&!(pt(t)||!n(t)))for(let o of t.typeAnnotation.members)o.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&i(o)},TSInterfaceDeclaration(t){if(!(pt(t)||!n(t)))for(let o of t.body.body)o.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&i(o)},TSTypeReference(t){if(t.typeName.type!==B.TSESTree.AST_NODE_TYPES.Identifier||t.typeName.name!=="FC"||!t.typeArguments?.params[0])return;let o=t.typeArguments.params[0];if(o.type!==B.TSESTree.AST_NODE_TYPES.TSTypeLiteral)return;let a=We(t.parent,B.TSESTree.AST_NODE_TYPES.VariableDeclaration,4);if(!a)return;let r=lt(a,e.sourceCode);if(!(!r||r.parent.type===B.TSESTree.AST_NODE_TYPES.CallExpression&&r.parent.callee.type===B.TSESTree.AST_NODE_TYPES.Identifier&&r.parent.callee.name==="memo"))for(let l of o.members)l.type===B.TSESTree.AST_NODE_TYPES.TSPropertySignature&&i(l)}}}});function pt(e){return e?e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportNamedDeclaration||e.parent?.type===B.TSESTree.AST_NODE_TYPES.ExportDefaultDeclaration:!1}function lt(e,n){if(pt(e))return;let i;if(e.type===B.TSESTree.AST_NODE_TYPES.VariableDeclaration){if(e.declarations.length!==1)return;e.declarations[0].id.type===B.TSESTree.AST_NODE_TYPES.Identifier&&(i=e.declarations[0].id)}else{if(!e.id)return;i=e.id}if(!i)return;let t=n.getScope(e);e.type===B.TSESTree.AST_NODE_TYPES.FunctionDeclaration&&t.upper&&(t=t.upper);let o=t.variables.find(r=>r.identifiers.includes(i));if(!o)return;let a=o.references.filter(r=>r.identifier!==i);if(!(a.length!==1||!a[0])&&!pt(a[0].identifier.parent.parent))return a[0].identifier}var Dt={name:Kn,rule:ms};var Ye=require("@typescript-eslint/utils");var qe=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 i(t){return t?t.type===Ye.AST_NODE_TYPES.Identifier?n.has(t.name):t.type===Ye.AST_NODE_TYPES.MemberExpression?i(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===Ye.AST_NODE_TYPES.VariableDeclaration)for(let o of t.declaration.declarations)i(o.init)&&e.report({node:t,messageId:"noReexport"});t.specifiers.length>0&&e.report({node:t,messageId:"noReexport"})},ExportDefaultDeclaration(t){t.declaration.type===Ye.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"),ct=Te(require("path")),we=require("zod/v4");var ys=Qn.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),er="no-relative-imports",ds=we.z.object({find:we.z.string(),replacement:we.z.string()}),gs=we.z.object({aliases:we.z.array(ds),rootDir:we.z.string().optional(),allowNotFoundAliases:we.z.boolean().optional(),_dev_simulateFileName:we.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 i=n._dev_simulateFileName??e.filename;function t(r){return r.startsWith(".")||r.startsWith("..")}function o(r,c){let l=ct.default.dirname(c);return ct.default.resolve(l,r)}function a(r){let c=n.rootDir??process.cwd(),l=ct.default.relative(c,r);if(l.startsWith("."))return null;l.startsWith("/")||(l=`/${l}`);for(let{find:p,replacement:d}of n.aliases)if(l.startsWith(d)){let g=l.replace(d,p);return{alias:p,newPath:g}}return null}return{ImportDeclaration(r){let c=r.source.value;if(!t(c))return;let l=o(c,i),p=a(l);!p&&n.allowNotFoundAliases||e.report({node:r,messageId:p?"noRelativeImportsWithAlias":"noRelativeImports",data:{alias:p?.alias},fix:p?d=>d.replaceText(r.source,`'${p.newPath}'`):void 0})}}}}),Lt={name:er,rule:Ss};var te=require("@typescript-eslint/utils"),jt=require("zod/v4");var Ts=jt.z.object({customMessage:jt.z.string().optional()}),Mt=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 i(t){switch(t.type){case te.AST_NODE_TYPES.Literal:return!0;case te.AST_NODE_TYPES.ObjectExpression:return t.properties.every(o=>o.type===te.AST_NODE_TYPES.Property?o.computed||o.value.type===te.AST_NODE_TYPES.Identifier&&o.key.type===te.AST_NODE_TYPES.Identifier&&o.key.name===o.value.name?!1:i(o.value):!1);case te.AST_NODE_TYPES.ArrayExpression:return t.elements.every(o=>o?o.type===te.AST_NODE_TYPES.SpreadElement?!1:i(o):!0);case te.AST_NODE_TYPES.TemplateLiteral:return t.expressions.length===0;case te.AST_NODE_TYPES.ConditionalExpression:case te.AST_NODE_TYPES.LogicalExpression:case te.AST_NODE_TYPES.BinaryExpression:case te.AST_NODE_TYPES.UnaryExpression:case te.AST_NODE_TYPES.CallExpression:case te.AST_NODE_TYPES.MemberExpression:case te.AST_NODE_TYPES.Identifier:case te.AST_NODE_TYPES.ArrowFunctionExpression:case te.AST_NODE_TYPES.FunctionExpression:return!1;default:return!1}}return{JSXAttribute(t){if(t.name.type===te.AST_NODE_TYPES.JSXIdentifier&&t.name.name==="style"&&t.value){let o=null;t.value.type===te.AST_NODE_TYPES.JSXExpressionContainer?t.value.expression.type!==te.AST_NODE_TYPES.JSXEmptyExpression&&(o=t.value.expression):t.value.type===te.AST_NODE_TYPES.Literal&&(o=t.value),o&&i(o)&&e.report({node:t,messageId:"noStaticStyleProp",data:{customMessage:n.customMessage?` ${n.customMessage}`:""}})}}}}});var Ze=require("@typescript-eslint/utils"),$e=Te(require("zod/v4"));var hs=$e.object({alternativeMsgs:$e.object({inArrayFind:$e.string().optional(),inArrayFilter:$e.string().optional()}).optional(),__dev_simulateFileName:$e.string().optional()});function Es(e){return e.typeAnnotation.type!==Ze.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===Ze.AST_NODE_TYPES.CallExpression&&n.callee.type===Ze.AST_NODE_TYPES.MemberExpression&&n.callee.property.type===Ze.AST_NODE_TYPES.Identifier){let i=n.callee.property.name;if(i==="filter"||i==="find")return{method:i}}n=n.parent}return null}var $t=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 i=n.__dev_simulateFileName??e.filename;if(xs(i))return{};function t(o){if(!Es(o))return;let a=Cs(o);if(n.alternativeMsgs&&a){let r=a.method==="filter"?n.alternativeMsgs.inArrayFilter:n.alternativeMsgs.inArrayFind;if(r){let c=a.method==="filter"?"useFilterWithTypeCheck":"useFindWithTypeCheck";e.report({node:o,messageId:c,data:{message:r}});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 i=n[0];return!i||i.type!==_e.AST_NODE_TYPES.ExpressionStatement?!1:i.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(i){Is(i)&&e.report({node:i,messageId:"unnecessaryAsyncInJsxProp",fix(t){let o=e.sourceCode,a=[],r=o.getFirstToken(i,l=>l.value==="async");if(r){let l=o.getTokenAfter(r);l?a.push(t.replaceTextRange([r.range[0],l.range[0]],"")):a.push(t.remove(r))}function c(l){if(l.type===_e.AST_NODE_TYPES.AwaitExpression){let p=o.getFirstToken(l);if(p&&p.value==="await"){let d=o.getTokenAfter(p);d?a.push(t.replaceTextRange([p.range[0],d.range[0]],"")):a.push(t.remove(p))}}if(l.type===_e.AST_NODE_TYPES.BlockStatement)for(let p of l.body)c(p);else l.type===_e.AST_NODE_TYPES.ExpressionStatement&&c(l.expression)}return c(i.body),a}})}return{"JSXAttribute ArrowFunctionExpression[async=true]":n,"JSXAttribute FunctionExpression[async=true]":n}}});var ve=require("@typescript-eslint/utils"),Ut=Te(require("typescript")),Je=Te(require("zod/v4"));var Rs=ve.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),tr="no-unnecessary-casting",ws=Je.default.object({additionalCastFunctions:Je.default.array(Je.default.object({name:Je.default.string(),expectedType:Je.default.enum(["string","number"])})).optional()}),Wt={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 i=e.options[0].additionalCastFunctions||[],t=[{name:"Number",expectedType:"number"},{name:"String",expectedType:"string"},...i],o=ve.ESLintUtils.getParserServices(e,!0),a=o.program?.getTypeChecker();if(!a||!o.program)throw new Error("TypeScript services or program not available");function r(d,g){switch(d.type){case ve.AST_NODE_TYPES.Literal:return g==="number"?typeof d.value=="number":typeof d.value=="string";case ve.AST_NODE_TYPES.TemplateLiteral:return g==="string";case ve.AST_NODE_TYPES.UnaryExpression:return g==="number"?d.operator==="+"||d.operator==="-"||d.operator==="~":!1;default:return!1}}function c(d,g){return g==="number"?!!(d.flags&Ut.TypeFlags.NumberLike):!!(d.flags&Ut.TypeFlags.StringLike)}function l(d,g){return s=>s.replaceText(d,e.sourceCode.getText(g))}function p(d){if(!a||d.arguments.length!==1)return;let g=d.arguments[0];if(!g||g.type===ve.AST_NODE_TYPES.SpreadElement)return;let{callee:s}=d;if(s.type!==ve.AST_NODE_TYPES.Identifier)return;let u=s.name,y=t.find(T=>T.name===u);if(!y)return;if(r(g,y.expectedType)||c(a.getTypeAtLocation(o.esTreeNodeToTSNodeMap.get(g)),y.expectedType)){let T,f;u==="Number"?T="unnecessaryNumberCasting":u==="String"?T="unnecessaryStringCasting":(T="unnecessaryCustomCasting",f={name:y.name,type:y.expectedType}),e.report({node:d,messageId:T,...f?{data:f}:{},fix:l(d,g)})}}return{CallExpression:p}}})};var me=require("@typescript-eslint/utils"),ut=Te(require("zod/v4"));var vs=ut.object({ignoreWithDescription:ut.string().optional()}),zt=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 i=e.getSourceCode(),t=i.ast;function o(l){let p=l.arguments[0];return p&&p.type===me.AST_NODE_TYPES.Literal&&typeof p.value=="string"?p.value:null}function a(l){return!l||!n.ignoreWithDescription?!1:new RegExp(n.ignoreWithDescription).test(l)}function r(l){return l.length!==1?!1:t.body.filter(d=>{if(d.type===me.AST_NODE_TYPES.ExpressionStatement){let g=d.expression;if(g.type===me.AST_NODE_TYPES.CallExpression&&g.callee.type===me.AST_NODE_TYPES.Identifier){let s=g.callee.name;return["test","it","beforeEach","afterEach","beforeAll","afterAll"].includes(s)}}return!1}).length===0}function c(l){let p=l.arguments[1];if(p&&(p.type===me.AST_NODE_TYPES.FunctionExpression||p.type===me.AST_NODE_TYPES.ArrowFunctionExpression)&&p.body.type===me.AST_NODE_TYPES.BlockStatement){let d=p.body.body;return d.length===0?"":d.map(s=>i.text.slice(s.range[0],s.range[1])).join(`
|
|
16
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=
|
|
17
|
+
`)}return""}return{Program(){let l=[];for(let s of t.body)s.type===me.AST_NODE_TYPES.ExpressionStatement&&s.expression.type===me.AST_NODE_TYPES.CallExpression&&s.expression.callee.type===me.AST_NODE_TYPES.Identifier&&s.expression.callee.name==="describe"&&s.expression.arguments.length===2&&l.push(s.expression);if(!r(l))return;let[p]=l;if(!p)return;let d=o(p);if(a(d))return;let g=t.body.find(s=>s.type===me.AST_NODE_TYPES.ExpressionStatement&&s.expression===p);!g||g.type!==me.AST_NODE_TYPES.ExpressionStatement||e.report({node:p,messageId:"unnecessaryDescribe",suggest:[{messageId:"removeDescribe",fix(s){let u=c(p);return u?s.replaceText(g,u):null}}]})}}}});var Ge=require("@typescript-eslint/utils"),be=Te(require("zod/v4"));var Fs=be.object({methods:be.union([be.array(be.string()),be.literal("array")])}),Jt=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(Fs)]},defaultOptions:[{methods:"array"}],create(e,[n]){let i=n.methods,t=new Set(["find","filter","map","forEach","some","every","reduce","findIndex","sort"]);function o(c){return Array.isArray(i)?i.includes(c):t.has(c)}function a(c){let{callee:l}=c;if(l.type===Ge.AST_NODE_TYPES.MemberExpression){let p=l.property;if(p.type===Ge.AST_NODE_TYPES.Identifier)return p.name}return null}function r(c,l){if(c.type!==Ge.AST_NODE_TYPES.Identifier||!c.typeAnnotation)return;let p=l.parent;if(p.type===Ge.AST_NODE_TYPES.CallExpression){let d=a(p);d&&o(d)&&p.arguments.indexOf(l)===0&&e.report({node:c.typeAnnotation,messageId:"unnecessaryTypeAnnotation",fix(s){return c.typeAnnotation?s.remove(c.typeAnnotation):null}})}}return{ArrowFunctionExpression(c){for(let l of c.params)r(l,c)},FunctionExpression(c){for(let l of c.params)r(l,c)}}}});var fe=require("@typescript-eslint/utils");var Vt=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===fe.AST_NODE_TYPES.ObjectPattern||!n.init||n.init.type!==fe.AST_NODE_TYPES.ObjectExpression||n.id.type===fe.AST_NODE_TYPES.Identifier&&n.id.typeAnnotation||n.parent.parent.type===fe.AST_NODE_TYPES.ExportNamedDeclaration)return;let i=new Map;for(let r of n.init.properties)r.type===fe.AST_NODE_TYPES.Property&&r.key.type===fe.AST_NODE_TYPES.Identifier&&i.set(r.key.name,r);if(i.size===0||n.id.type!==fe.AST_NODE_TYPES.Identifier)return;let t=ks(n,e.sourceCode);if(t.length===0)return;let o=n.init.properties.some(r=>r.type!==fe.AST_NODE_TYPES.Property?!1:r.value.type===fe.AST_NODE_TYPES.FunctionExpression),a=new Set;for(let r of t){if(r.identifier.parent.type!==fe.AST_NODE_TYPES.MemberExpression)return;let c=r.identifier.parent;if(c.object!==r.identifier)return;if(c.computed)if(c.property.type===fe.AST_NODE_TYPES.Literal&&typeof c.property.value=="string")a.add(c.property.value);else return;else{if(c.property.type!==fe.AST_NODE_TYPES.Identifier)return;a.add(c.property.name)}if(c.parent.type===fe.AST_NODE_TYPES.CallExpression&&o)return}for(let[r,c]of i)a.has(r)||e.report({node:c,messageId:"unusedObjectProperty",data:{name:r}})}}}});function ks(e,n){let i=n.getDeclaredVariables(e);if(i.length!==1)return[];let t=i[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var z=require("@typescript-eslint/utils"),Xt=require("zod/v4");var Ps=Xt.z.object({ignoreArgsMatching:Xt.z.string().optional()}),Ht=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 i=[];function t(r){return n.ignoreArgsMatching?new RegExp(n.ignoreArgsMatching).test(r):!1}function o(r){return r.type===z.AST_NODE_TYPES.ExportNamedDeclaration||r.type===z.AST_NODE_TYPES.ExportDefaultDeclaration||r.parent?.type===z.AST_NODE_TYPES.ExportNamedDeclaration||r.parent?.type===z.AST_NODE_TYPES.ExportDefaultDeclaration}function a(r){let c=[];for(let l=0;l<r.length;l++){let p=r[l];if(!p||p.type!==z.AST_NODE_TYPES.Identifier)continue;let d=p.name;if(!t(d)){if(p.optional&&p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral){let g=p.typeAnnotation.typeAnnotation,s=[];for(let u of g.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)?c.push({param:p,index:l,name:d,isObjectParam:!0,objectProps:s}):c.push({param:p,index:l,name:d,isObjectParam:!1})}else if(p.optional)c.push({param:p,index:l,name:d,isObjectParam:!1});else if(p.typeAnnotation&&p.typeAnnotation.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeLiteral){let g=p.typeAnnotation.typeAnnotation,s=[];for(let u of g.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)&&c.push({param:p,index:l,name:d,isObjectParam:!0,objectProps:s})}}}return c}return{FunctionDeclaration(r){if(o(r))return;let c=a(r.params);c.length!==0&&i.push({node:r,declarationNode:r,optionalParams:c})},VariableDeclarator(r){if(r.id.type!==z.AST_NODE_TYPES.Identifier||!r.init||r.init.type!==z.AST_NODE_TYPES.ArrowFunctionExpression&&r.init.type!==z.AST_NODE_TYPES.FunctionExpression||o(r.parent.parent))return;let l=[...a(r.init.params)];if(r.id.typeAnnotation&&r.id.typeAnnotation.typeAnnotation.type===z.AST_NODE_TYPES.TSTypeReference){let p=r.id.typeAnnotation.typeAnnotation;if(p.typeName.type===z.AST_NODE_TYPES.Identifier&&p.typeName.name==="FC"){let d=p.typeArguments;if(d&&d.params.length===1){let g=d.params[0];if(g&&g.type===z.AST_NODE_TYPES.TSTypeLiteral){let s=[];for(let u of g.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:r.id,index:0,name:"props",isObjectParam:!0,objectProps:s})}}}}l.length!==0&&i.push({node:r.init,declarationNode:r,optionalParams:l})},"Program:exit"(){for(let r of i){let l=e.sourceCode.getDeclaredVariables(r.declarationNode)[0];if(!l)continue;let p=l.references.filter(s=>s.identifier!==l.identifiers[0]);if(p.length===0)continue;let d=!1;for(let s of p){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)){d=!0;break}if(u.type===z.AST_NODE_TYPES.ReturnStatement){d=!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){d=!0;break}if(u.type===z.AST_NODE_TYPES.JSXExpressionContainer){d=!0;break}}if(d)continue;let g=[];for(let s of p){let u=s.identifier.parent;if(u.type===z.AST_NODE_TYPES.CallExpression&&u.callee===s.identifier){let y=u.arguments.length,h=u.arguments.some(f=>f.type===z.AST_NODE_TYPES.SpreadElement);if(h){d=!0;break}let T={argCount:y,hasSpread:h};for(let f of r.optionalParams)if(f.isObjectParam&&f.index<y){let E=u.arguments[f.index];if(E?.type===z.AST_NODE_TYPES.ObjectExpression){let x={};for(let m of E.properties)m.type===z.AST_NODE_TYPES.Property&&m.key.type===z.AST_NODE_TYPES.Identifier&&(x[m.key.name]=!0);T.objectArgs||(T.objectArgs=[]),T.objectArgs[f.index]=x}else if(E){d=!0;break}}g.push(T)}else if(u.type===z.AST_NODE_TYPES.JSXOpeningElement&&u.name===s.identifier){let y=u.attributes.some(T=>T.type===z.AST_NODE_TYPES.JSXSpreadAttribute);if(y){d=!0;break}let h={argCount:1,hasSpread:y};for(let T of r.optionalParams)if(T.isObjectParam&&T.index===0){let f={};for(let E of u.attributes)E.type===z.AST_NODE_TYPES.JSXAttribute&&E.name.type===z.AST_NODE_TYPES.JSXIdentifier&&(f[E.name.name]=!0);h.objectArgs||(h.objectArgs=[]),h.objectArgs[0]=f}g.push(h)}}if(!(d||g.length===0))for(let s of r.optionalParams)if(s.isObjectParam&&s.objectProps)for(let u of s.objectProps){if(!u.optional)continue;let y=!1;for(let h of g)if(h.objectArgs&&h.objectArgs[s.index]){let T=h.objectArgs[s.index];if(T&&T[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 g)if(y.argCount>s.index){u=!0;break}u||e.report({node:s.param,messageId:"unusedOptionalArg",data:{name:s.name}})}}}}}});var Y=require("@typescript-eslint/utils"),Le=require("zod/v4");var Os=Le.z.object({selectors:Le.z.array(Le.z.object({name:Le.z.string(),selectorProp:Le.z.string().optional(),selectorArgPos:Le.z.number().optional(),returnProp:Le.z.string().optional()}))}),Ns=Y.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),nr="no-unused-selected-values",Bt={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:i=[]}=n,t=new Map(i.map(o=>[o.name,o]));return{VariableDeclarator(o){let a=null;if(o.init?.type===Y.AST_NODE_TYPES.CallExpression&&(a=o.init),!a)return;let r=Ls(a);if(!r)return;let c=t.get(r);if(!c)return;let l=Ds(a,c.selectorArgPos??0,c.selectorProp);if(!l)return;let p=js(l);if(!p)return;let d=rr(p.properties,void 0);if(!d)return;if(o.id.type===Y.AST_NODE_TYPES.ObjectPattern){let u=rr(o.id.properties,c.returnProp);if(!u)return;for(let[y,h]of d)u.has(y)||e.report({node:h,messageId:"unusedSelectedValue",data:{name:y}});return}if(o.id.type!==Y.AST_NODE_TYPES.Identifier||c.returnProp)return;let g=Ms(o,e.sourceCode);if(g.length===0)return;let s=new Set;for(let u of g){if(u.identifier.parent.type!==Y.AST_NODE_TYPES.MemberExpression)return;let y=u.identifier.parent.property;if(y.type!==Y.AST_NODE_TYPES.Identifier)return;s.add(y.name)}for(let[u,y]of d)s.has(u)||e.report({node:y,messageId:"unusedSelectedValue",data:{name:u}})}}}})};function Ds(e,n,i){let t=e.arguments[n];if(!t)return null;if(t.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||t.type===Y.AST_NODE_TYPES.FunctionExpression)return t;if(i&&t.type===Y.AST_NODE_TYPES.ObjectExpression){let o=t.properties.find(r=>r.type===Y.AST_NODE_TYPES.Property&&r.key.type===Y.AST_NODE_TYPES.Identifier&&r.key.name===i);if(o?.type!==Y.AST_NODE_TYPES.Property)return null;let a=o.value;if(a.type===Y.AST_NODE_TYPES.ArrowFunctionExpression||a.type===Y.AST_NODE_TYPES.FunctionExpression)return a}return null}function Ls(e){return e.callee.type===Y.AST_NODE_TYPES.Identifier?e.callee.name:e.callee.type===Y.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===Y.AST_NODE_TYPES.Identifier?e.callee.property.name:null}function js(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(i=>i.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}function rr(e,n){let i=e;if(n){let o=e.find(a=>a.type===Y.AST_NODE_TYPES.Property&&a.key.type===Y.AST_NODE_TYPES.Identifier&&a.key.name===n);if(o?.type!==Y.AST_NODE_TYPES.Property||o.value.type!==Y.AST_NODE_TYPES.ObjectPattern)return null;i=o.value.properties}let t=new Map;for(let o of i){if(o.type!==Y.AST_NODE_TYPES.Property||o.key.type!==Y.AST_NODE_TYPES.Identifier)return null;t.set(o.key.name,o)}return t.size>0?t:null}function Ms(e,n){let i=n.getDeclaredVariables(e);if(i.length!==1)return[];let t=i[0];return t?t.references.filter(o=>o.identifier!==e.id):[]}var q=require("@typescript-eslint/utils");var Yt=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===q.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 c=$s(a);c&&(t=c);return}let r=_s(a,e.sourceCode);if(r){o=!0;for(let c of r)t.delete(c);if(t.size!==0)for(let[c,l]of t)e.report({node:l,messageId:"unusedField",data:{name:c}})}}}}});function $s(e){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useForm"))return null;let i=e.arguments[0];if(!i||i.type!==q.AST_NODE_TYPES.ObjectExpression)return null;let t=Rt(i.properties,a=>a.type!==q.AST_NODE_TYPES.Property||a.key.type!==q.AST_NODE_TYPES.Identifier||a.key.name!=="initialConfig"?null:a.value.type===q.AST_NODE_TYPES.ObjectExpression?a.value:a.value.type===q.AST_NODE_TYPES.ArrowFunctionExpression||a.value.type===q.AST_NODE_TYPES.FunctionExpression?Us(a.value):null);if(!t)return null;let o=new Map;for(let a of t.properties)a.type===q.AST_NODE_TYPES.Property&&a.key.type===q.AST_NODE_TYPES.Identifier&&o.set(a.key.name,a);return o}function _s(e,n){if(!(e.callee.type===q.AST_NODE_TYPES.Identifier&&e.callee.name==="useFormState")||e.parent.type!==q.AST_NODE_TYPES.VariableDeclarator||e.parent.id.type!==q.AST_NODE_TYPES.ObjectPattern||!Rt(e.parent.id.properties,r=>r.type===q.AST_NODE_TYPES.Property&&r.key.type===q.AST_NODE_TYPES.Identifier&&r.key.name==="formFields"&&r))return null;let o=$n(e.parent,"formFields",n),a=new Set;for(let{identifier:r}of o){if(r.type!==q.AST_NODE_TYPES.Identifier||r.parent.type===q.AST_NODE_TYPES.Property&&r.parent.parent.type===q.AST_NODE_TYPES.ObjectExpression&&r.parent.parent.parent.type===q.AST_NODE_TYPES.ReturnStatement||r.parent.type===q.AST_NODE_TYPES.ReturnStatement)return null;if(r.parent.type===q.AST_NODE_TYPES.MemberExpression){if(r.parent.object.type!==q.AST_NODE_TYPES.Identifier||r.parent.property.type!==q.AST_NODE_TYPES.Identifier)return null;a.add(r.parent.property.name)}}return a}function Us(e){if(e.body.type===q.AST_NODE_TYPES.ObjectExpression)return e.body;if(e.body.type===q.AST_NODE_TYPES.BlockStatement){let n=e.body.body.filter(i=>i.type===q.AST_NODE_TYPES.ReturnStatement);return n.length!==1||!n[0]||n[0].argument?.type!==q.AST_NODE_TYPES.ObjectExpression?null:n[0].argument}return null}var H=require("@typescript-eslint/utils"),Ke=require("zod/v4");var Ws=H.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`);function ir(e){let n=[];for(let i of e.members)i.type===H.AST_NODE_TYPES.TSPropertySignature&&i.key.type===H.AST_NODE_TYPES.Identifier&&n.push([i.key.name,i]);return n}function sr(e,...n){for(let i of n)e.set(...i);return e}var zs=Ke.z.object({forceCheckOnFCPropTypesWithName:Ke.z.array(Ke.z.string()).optional(),alwaysCheckFunctionOptionTypes:Ke.z.boolean().optional()}),or="no-unused-type-props-in-args",qt=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:i,alwaysCheckFunctionOptionTypes:t=!0}=n;i&&!qt&&(qt=i.map(l=>new RegExp(l)));function o(l,p,d,g,s=!0,u=!1){let y=d.name,h=e.sourceCode.getScope(p).references.find(m=>m.identifier.name===y)?.resolved,T=l&&qt?.some(m=>m.test(y)),f=u&&t;if(!h||!T&&h.references.filter(m=>m.isTypeReference).length>1||!h.defs[0])return;let E=h.defs[0].node,x=E.parent?.type===H.AST_NODE_TYPES.ExportNamedDeclaration;if(!(s&&x&&!f)){if(E.type===H.AST_NODE_TYPES.TSTypeAliasDeclaration){a(l,p,g,E.typeAnnotation,!0,u);return}if(E.type===H.AST_NODE_TYPES.TSInterfaceDeclaration){a(l,p,g,E.body,!0,u);return}}}function a(l,p,d,g,s,u=!1){if(g.type===H.AST_NODE_TYPES.TSInterfaceBody){for(let y of g.body)y.type===H.AST_NODE_TYPES.TSPropertySignature&&y.key.type===H.AST_NODE_TYPES.Identifier&&d.set(y.key.name,y);return}if(g.type===H.AST_NODE_TYPES.TSTypeLiteral){sr(d,...ir(g));return}if(g.type===H.AST_NODE_TYPES.TSIntersectionType){for(let y of g.types)a(l,p,d,y,!0,u);return}s||g.type===H.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===H.AST_NODE_TYPES.Identifier&&o(l,p,g.typeName,d,!0,u)}function r(l,p,d,g=!1){for(let s of d)if(s.type===H.AST_NODE_TYPES.ObjectPattern&&s.typeAnnotation){let u=new Map;if(a(l,p,u,s.typeAnnotation.typeAnnotation,!1,g),u.size===0)continue;c(s,u)}else s.type===H.AST_NODE_TYPES.AssignmentPattern&&s.left.type===H.AST_NODE_TYPES.ObjectPattern&&r(l,p,[s.left],g)}function c(l,p){let d=[];if(l.properties.at(-1)?.type===H.AST_NODE_TYPES.RestElement)return;for(let y of l.properties)y.type===H.AST_NODE_TYPES.Property&&y.key.type===H.AST_NODE_TYPES.Identifier&&d.push(y.key.name);let s=[],u=[];for(let[y,h]of p)d.includes(y)||(u.push(y),s.push({node:h,messageId:"unusedObjectTypeProperty",data:{propertyName:y}}));for(let[y,h]of s.entries())e.report({...h,fix:y===s.length-1?T=>{let f=l.properties.at(-1),E=u.join(", ");return f?f.type===H.AST_NODE_TYPES.RestElement?null:T.insertTextAfter(f,`, ${E}`):T.insertTextBeforeRange([l.range[0]+1,l.range[1]],E)}:void 0})}return{VariableDeclaration(l){let p=l.declarations[0],d=new Map,g=p.id.type===H.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation?.typeAnnotation.type===H.AST_NODE_TYPES.TSTypeReference&&p.id.typeAnnotation.typeAnnotation.typeName.type===H.AST_NODE_TYPES.Identifier&&p.id.typeAnnotation.typeAnnotation.typeName.name==="FC"&&p.id.typeAnnotation.typeAnnotation.typeArguments?.params[0];if(g){if(g.type===H.AST_NODE_TYPES.TSTypeReference&&g.typeName.type===H.AST_NODE_TYPES.Identifier)o(!0,l,g.typeName,d,!1);else if(g.type===H.AST_NODE_TYPES.TSTypeLiteral)sr(d,...ir(g));else if(g.type===H.AST_NODE_TYPES.TSIntersectionType)for(let s of g.types)s.type===H.AST_NODE_TYPES.TSTypeReference&&s.typeName.type===H.AST_NODE_TYPES.Identifier?o(!0,l,s.typeName,d,!1):a(!0,l,d,s,!0);if(d.size!==0&&p.init?.type===H.AST_NODE_TYPES.ArrowFunctionExpression){let s=p.init.params[0];if(!s){e.report({node:p.init,messageId:"missingComponentParam"});return}s.type===H.AST_NODE_TYPES.ObjectPattern&&c(s,d)}}},FunctionDeclaration(l){r(!1,l,l.params,t)},ArrowFunctionExpression(l){r(!1,l,l.params,t)}}}}),Zt={name:or,rule:Js};var ge=require("@typescript-eslint/utils");var Gt=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 i(t){return t.callee.type===ge.AST_NODE_TYPES.Identifier?n.has(t.callee.name):t.callee.type===ge.AST_NODE_TYPES.MemberExpression&&t.callee.object.type===ge.AST_NODE_TYPES.Identifier&&t.callee.property.type===ge.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===ge.AST_NODE_TYPES.ImportSpecifier&&o.imported.type===ge.AST_NODE_TYPES.Identifier&&o.imported.name==="useRef"&&n.add(o.local.name)},VariableDeclarator(t){if(t.init&&t.init.type===ge.AST_NODE_TYPES.CallExpression&&i(t.init)&&t.id.type===ge.AST_NODE_TYPES.Identifier){let a=e.sourceCode.getScope(t).set.get(t.id.name);if(a){let r=!1;for(let c of a.references){let p=c.identifier.parent;if(p!==t&&!(p.type===ge.AST_NODE_TYPES.JSXExpressionContainer&&p.parent.type===ge.AST_NODE_TYPES.JSXAttribute&&p.parent.name.type===ge.AST_NODE_TYPES.JSXIdentifier&&p.parent.name.name==="ref")){r=!0;break}}r||e.report({node:t.id,messageId:"refNotRead",data:{name:t.id.name}})}}}}}});var Ve=require("@typescript-eslint/utils"),Vs=Ve.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 i=null;if(n.ignoreRegex){let t=ar.get(n.ignoreRegex);t?i=t:(i=new RegExp(n.ignoreRegex),ar.set(n.ignoreRegex,i))}return{VariableDeclarator(t){if(t.init&&t.init.type===Ve.AST_NODE_TYPES.ArrowFunctionExpression&&t.id.type===Ve.AST_NODE_TYPES.Identifier){let o=t.id.name;if(t.id.typeAnnotation||i&&i.test(o)||!n.disallowArrowFnWithImplicitReturns&&t.init.body.type!==Ve.AST_NODE_TYPES.BlockStatement)return;let a=t.parent,r=t.init.params,c=t.init.body,l=t.init;e.report({node:t.id,messageId:i?"withIgnoreRegex":"default",data:{functionName:o,ignoreRegex:n.ignoreRegex},suggest:[{messageId:"suggestion",fix:p=>p.replaceText(a,`${l.async?"async ":""}function ${o}(${r.map(d=>e.sourceCode.getText(d)).join(", ")||""}) ${e.sourceCode.getText(c)}`)}]})}}}}}),Kt={name:lr,rule:Xs};var M=require("@typescript-eslint/utils"),xe=require("zod/v4");var Hs=xe.z.object({disallowedFunctions:xe.z.array(xe.z.object({name:xe.z.string(),allowUsingWithArgs:xe.z.boolean().optional(),hookAlternative:xe.z.string().optional(),message:xe.z.string().optional(),allowUseInside:xe.z.array(xe.z.string()).optional()}))}),Bs=/^use[A-Z]/,Ys=/^[A-Z]/;function ft(e){return Bs.test(e)}function pr(e){return Ys.test(e)}function qs(e){return e.type===M.AST_NODE_TYPES.Identifier?ft(e.name):e.type===M.AST_NODE_TYPES.MemberExpression&&e.property.type===M.AST_NODE_TYPES.Identifier?ft(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 Qt(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,i=!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=Qt(n);if(t&&t.type===M.AST_NODE_TYPES.Identifier){if(pr(t.name)||ft(t.name))return!i;i=!0}else{if(ur(n)||fr(n))return!i;if(n.parent.type===M.AST_NODE_TYPES.CallExpression){let o=n.parent;qs(o.callee)||(i=!0)}else n.parent.type===M.AST_NODE_TYPES.JSXExpressionContainer||(i=!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 i=e.parent;for(;i;){if(i.type===M.AST_NODE_TYPES.FunctionDeclaration||i.type===M.AST_NODE_TYPES.FunctionExpression||i.type===M.AST_NODE_TYPES.ArrowFunctionExpression){let t=Qt(i);if(t&&t.type===M.AST_NODE_TYPES.Identifier&&n.includes(t.name))return!0}else if(i.type===M.AST_NODE_TYPES.CallExpression){let t=mr(i);if(t&&n.includes(t))return!0}i=i.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 i=!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=Qt(t);if(o&&o.type===M.AST_NODE_TYPES.Identifier){if(pr(o.name)||ft(o.name)){i=!0;break}}else if(ur(t)||fr(t)){i=!0;break}}t=t.parent}return i?n.length===0?Zs(e):!Gs(e,n):!1}var en=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:i}=n,t=new Map(i.map(o=>[o.name,o]));return{CallExpression(o){let a=mr(o);if(!a)return;let r=t.get(a);if(!r||r.allowUsingWithArgs&&Ks(o))return;let c=r.allowUseInside||[];Qs(o,c)&&e.report({node:o,messageId:"preferHookAlternative",data:{message:r.message?` ${r.message}`:` use ${r.hookAlternative} instead`},suggest:r.hookAlternative?[{messageId:"preferHookAlternative",data:{message:`Replace with ${r.hookAlternative}`,hookAlternative:r.hookAlternative},fix:l=>{let p=r.hookAlternative;return p?o.callee.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee,p):o.callee.type===M.AST_NODE_TYPES.MemberExpression&&o.callee.property.type===M.AST_NODE_TYPES.Identifier?l.replaceText(o.callee.property,p):null:null}}]:[]})}}}});var G=require("@typescript-eslint/utils"),mt=Te(require("zod/v4"));var eo=G.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),dr="prefer-single-line-if",to=mt.default.object({maxLineLength:mt.default.number().optional(),maxNonSimpleConditionLength:mt.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 i=e.sourceCode;return{IfStatement(t){if(t.consequent.type!==G.AST_NODE_TYPES.BlockStatement||t.loc.start.line===t.loc.end.line||i.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===G.AST_NODE_TYPES.ReturnStatement){if(!Sr(a))return}else if(!(a.type===G.AST_NODE_TYPES.ContinueStatement||a.type===G.AST_NODE_TYPES.BreakStatement))return;if(t.test.type===G.AST_NODE_TYPES.LogicalExpression||t.test.type===G.AST_NODE_TYPES.ConditionalExpression)return;let r;if(n.maxNonSimpleConditionLength){let g=yr(t.test);if(!g&&t.test.type===G.AST_NODE_TYPES.UnaryExpression&&t.test.operator==="!"){let s=t.test.argument;yr(s)&&(g=!0)}if(g&&(r=i.getText(t.test),r.length>n.maxNonSimpleConditionLength))return}r||(r=i.getText(t.test));let c=i.getText(a);if(r.includes(`
|
|
18
|
+
`))return;let l=i.getTokenAfter(t);if(l&&l.type===G.AST_TOKEN_TYPES.Punctuator&&l.value==="}"){let g=i.getTokenAfter(l);if(g&&g.type===G.AST_TOKEN_TYPES.Keyword&&(g.value==="else"||g.value==="catch"))return}let p=ro(i,t),d=`if (${r}) ${c}`;n.maxLineLength&&d.length+p.length>n.maxLineLength||e.report({node:t,messageId:"noSingleLineCurly",fix:g=>g.replaceText(t,d)})}}}});function yr(e){return e.type===G.AST_NODE_TYPES.CallExpression||e.type===G.AST_NODE_TYPES.BinaryExpression||e.type===G.AST_NODE_TYPES.MemberExpression&&gr(e)}function gr(e){return e.object.type===G.AST_NODE_TYPES.MemberExpression?gr(e.object):e.object.type!==G.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===G.AST_NODE_TYPES.ArrayExpression&&n.elements.length===0||n.type===G.AST_NODE_TYPES.ObjectExpression&&n.properties.length===0||n.type===G.AST_NODE_TYPES.Literal||n.type===G.AST_NODE_TYPES.Identifier||n.type===G.AST_NODE_TYPES.TemplateLiteral||n.type===G.AST_NODE_TYPES.TaggedTemplateExpression?!0:n.type===G.AST_NODE_TYPES.CallExpression?n.arguments.length===0:n.type===G.AST_NODE_TYPES.UnaryExpression?Sr(n):!1}var tn={name:dr,rule:no};var P=require("@typescript-eslint/utils"),rn=require("zod/v4");var io=P.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),br="react-compiler-extra",so=rn.z.object({runOnlyWithEnableCompilerDirective:rn.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 Ce(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 Ce(e.consequent)||Ce(e.alternate);case P.AST_NODE_TYPES.LogicalExpression:return e.operator==="&&"?Ce(e.right):e.operator==="||"?Ce(e.left)||Ce(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&&Ce(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 et(e){return po.test(e)}function sn(e){return e.startsWith("use")&&e.length>3}function on(e,n,i,t){if(i&&lo(i))return n?et(n.name):e.type===P.AST_NODE_TYPES.FunctionDeclaration&&e.id?et(e.id.name):!0;if(n&&sn(n.name)||e.type===P.AST_NODE_TYPES.FunctionDeclaration&&e.id&&sn(e.id.name))return!0;if(t){let o=n?.name||e.type===P.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;if(o&&et(o)&&Cr(e.body,t).containsJSX)return!0}return!1}function Qe(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 i={containsJSX:!1,containsHookCalls:!1};return Ne(e,t=>{if(i.containsJSX&&i.containsHookCalls)return!0;switch(t.type){case P.AST_NODE_TYPES.JSXElement:case P.AST_NODE_TYPES.JSXFragment:i.containsJSX=!0;break;case P.AST_NODE_TYPES.CallExpression:xr(t.callee)&&(i.containsHookCalls=!0),Ce(t)&&(i.containsJSX=!0);break;case P.AST_NODE_TYPES.ReturnStatement:t.argument&&Ce(t.argument)&&(i.containsJSX=!0);break;case P.AST_NODE_TYPES.VariableDeclarator:t.init&&Ce(t.init)&&(i.containsJSX=!0);break;case P.AST_NODE_TYPES.AssignmentExpression:Ce(t.right)&&(i.containsJSX=!0);break}},n),i}function Tr(e,n){let i=e.body,t=Cr(i,n);return t.containsJSX||t.containsHookCalls}var co=/\bthis[.[]/;function hr(e){return co.test(e)}function uo(e,n){let i={containsJSX:!1,containsHookCalls:!1};return Ne(e,t=>{if(i.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)&&(i.containsHookCalls=!0)},n),i}function Er(e){return et(e)||sn(e)}function nn(e,n,i,t){if(!uo(e.body,n).containsHookCalls)return!1;let a=on(e,i,t,n);if(!a&&t){let r=i?.name||e.type===P.AST_NODE_TYPES.FunctionDeclaration&&e.id?.name;r&&et(r)&&(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 i=!1;if(n.runOnlyWithEnableCompilerDirective){for(let a of e.sourceCode.getAllComments())if(oo.test(a.value)){i=!0;break}if(!i)return{}}function t(a){for(let r of a.properties)if(r.type===P.AST_NODE_TYPES.Property&&r.method&&r.value.type===P.AST_NODE_TYPES.FunctionExpression){let c=e.sourceCode,l=c.getText(r.key),p=r.value,d=c.getText(p.body);if(hr(d))e.report({node:r,messageId:"thisKeywordInMethod"});else{let g=p.params.map(u=>c.getText(u)).join(", "),s="";p.generator?s=`${l}: function* (${g}) ${d}`:s=`${l}: (${g}) => ${d}`,e.report({node:r,messageId:"objectMethodIsNotSupported",fix:u=>u.replaceText(r,s)})}}}function o(a){for(let r of a.properties)if(r.type===P.AST_NODE_TYPES.Property&&r.value.type===P.AST_NODE_TYPES.ObjectExpression){for(let c of r.value.properties)if(c.type===P.AST_NODE_TYPES.Property&&c.method&&c.value.type===P.AST_NODE_TYPES.FunctionExpression){let p=e.sourceCode.getText(c.value.body);hr(p)&&e.report({node:c,messageId:"thisKeywordInMethod"})}}}return{CallExpression(a){if(xr(a.callee))for(let r of a.arguments){if(r.type===P.AST_NODE_TYPES.ObjectExpression&&(t(r),o(r)),r.type===P.AST_NODE_TYPES.ArrowFunctionExpression&&(r.body.type===P.AST_NODE_TYPES.ObjectExpression&&(t(r.body),o(r.body)),r.body.type===P.AST_NODE_TYPES.BlockStatement))for(let c of r.body.body)c.type===P.AST_NODE_TYPES.ReturnStatement&&c.argument?.type===P.AST_NODE_TYPES.ObjectExpression&&(t(c.argument),o(c.argument));if(r.type===P.AST_NODE_TYPES.FunctionExpression)for(let c of r.body.body)c.type===P.AST_NODE_TYPES.ReturnStatement&&c.argument?.type===P.AST_NODE_TYPES.ObjectExpression&&(t(c.argument),o(c.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 r=a.init,c=a.id,l=a.id.typeAnnotation;if(Qe(r)&&!Er(c.name)){e.report({node:r,messageId:"useMemoDirectiveNaming"});return}if(nn(r,e.sourceCode,c,l)){e.report({node:r,messageId:"functionCallingHooksMustBeComponent"});return}if(on(r,c,l,e.sourceCode)){let p=Tr(r,e.sourceCode),d=Qe(r);!p&&!d&&e.report({node:r,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(g){if(r.body.type===P.AST_NODE_TYPES.BlockStatement){let s=r.body.range[0]+1;return g.insertTextAfterRange([s,s],`
|
|
19
19
|
"use memo"
|
|
20
|
-
`)}return null}}]})}}},FunctionDeclaration(a){if(a.id&&
|
|
20
|
+
`)}return null}}]})}}},FunctionDeclaration(a){if(a.id&&Qe(a)&&!Er(a.id.name)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}if(nn(a,e.sourceCode)){e.report({node:a,messageId:"functionCallingHooksMustBeComponent"});return}if(on(a,void 0,void 0,e.sourceCode)){let r=Tr(a,e.sourceCode),c=Qe(a);!r&&!c&&e.report({node:a,messageId:"fcComponentShouldReturnJsx",suggest:[{messageId:"addUseMemoDirective",fix(l){let p=a.body.range[0]+1;return l.insertTextAfterRange([p,p],`
|
|
21
21
|
"use memo"
|
|
22
|
-
`)}}]})}},FunctionExpression(a){if(
|
|
23
|
-
`),l=
|
|
24
|
-
${
|
|
22
|
+
`)}}]})}},FunctionExpression(a){if(Qe(a)){e.report({node:a,messageId:"useMemoDirectiveNaming"});return}nn(a,e.sourceCode)&&e.report({node:a,messageId:"functionCallingHooksMustBeComponent"})}}}}),an={name:br,rule:fo};var pe=require("@typescript-eslint/utils"),he=require("zod/v4");var mo=pe.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Ar="react-compiler-migration",yo=he.z.object({disallowHooks:he.z.array(he.z.object({name:he.z.string(),replacement:he.z.string()})).optional(),disallowMethods:he.z.array(he.z.object({name:he.z.string(),replacement:he.z.string().optional(),requireTrueProp:he.z.string().optional()})).optional()}),go=/eslint +react-compiler\/react-compiler: +\["error/;function So(e){return e.type===pe.AST_NODE_TYPES.Identifier?e.name.startsWith("use"):e.type===pe.AST_NODE_TYPES.MemberExpression&&e.property.type===pe.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 i=!1;for(let t of e.sourceCode.getAllComments())if(go.test(t.value)){i=!0;break}return i?{CallExpression(t){if(n.disallowHooks?.length){let o=null,a=null;if(t.callee.type===pe.AST_NODE_TYPES.Identifier?(o=t.callee.name,a=t.callee):t.callee.type===pe.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===pe.AST_NODE_TYPES.Identifier&&(o=t.callee.property.name,a=t.callee.property),o){let r=n.disallowHooks.find(c=>c.name===o);r&&a&&e.report({node:t,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:r.name,replacement:r.replacement},suggest:[{messageId:"replace",data:{replacement:r.replacement},fix:c=>c.replaceText(a,r.replacement)}]})}}if(n.disallowMethods?.length&&So(t.callee)){for(let o of t.arguments)if(o.type===pe.AST_NODE_TYPES.ObjectExpression){for(let a of o.properties)if(a.type===pe.AST_NODE_TYPES.Property&&a.key.type===pe.AST_NODE_TYPES.Identifier){let r=a.key.name,c=n.disallowMethods.find(l=>l.name===r);if(c){if(c.requireTrueProp){let l=c.requireTrueProp,p=!1;for(let d of o.properties)if(d.type===pe.AST_NODE_TYPES.Property&&d.key.type===pe.AST_NODE_TYPES.Identifier&&d.key.name===l&&d.value.type===pe.AST_NODE_TYPES.Literal&&d.value.value===!0){p=!0;break}if(!p){e.report({node:a,messageId:"disallowedMethodWithMissingRequireTrueProp",data:{method:c.name,requireTrueProp:l}});continue}}c.replacement&&e.report({node:a,messageId:"disallowedFunctionOrMethod",data:{functionOrMethod:c.name,replacement:c.replacement},suggest:[{messageId:"replace",data:{replacement:c.replacement},fix:l=>c.replacement?l.replaceText(a.key,c.replacement):null}]})}}}}}}:{}}}),ln={name:Ar,rule:To};var F=require("@typescript-eslint/utils"),cn=require("zod");var ho=cn.z.object({runOnlyWithEnableCompilerDirective:cn.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 i=[];if(e.type===F.AST_NODE_TYPES.JSXElement){for(let t of e.openingElement.attributes)if(t.type===F.AST_NODE_TYPES.JSXAttribute&&t.name.type===F.AST_NODE_TYPES.JSXIdentifier&&t.value?.type===F.AST_NODE_TYPES.JSXExpressionContainer&&t.value.expression.type!==F.AST_NODE_TYPES.JSXEmptyExpression){let o=t.name.name,a=t.value.expression,r=!1;Ne(a,c=>{switch(c.type){case F.AST_NODE_TYPES.ObjectExpression:case F.AST_NODE_TYPES.ArrowFunctionExpression:case F.AST_NODE_TYPES.FunctionExpression:case F.AST_NODE_TYPES.ArrayExpression:return r=!0,!0}return!1},n),r&&i.push(o)}}return{hasUnstable:i.length>0,problematicProps:i}}function Ro(e){if(e.body.type===F.AST_NODE_TYPES.JSXElement||e.body.type===F.AST_NODE_TYPES.JSXFragment)return!0;if(e.body.type===F.AST_NODE_TYPES.BlockStatement){for(let n of e.body.body)if(n.type===F.AST_NODE_TYPES.ReturnStatement&&n.argument&&(n.argument.type===F.AST_NODE_TYPES.JSXElement||n.argument.type===F.AST_NODE_TYPES.JSXFragment))return!0}return!1}function wo(e,n){let i=e.callee;if(i.type===F.AST_NODE_TYPES.MemberExpression){let t=i.object;if(t.type===F.AST_NODE_TYPES.Identifier){let o=t.name,a=vo(o);if(a!==o)return un(a)}}if(n.length>0){let t=n[0];if(t&&t.type===F.AST_NODE_TYPES.Identifier)return un(t.name)}return"ListItem"}function vo(e){let i={people:"person",children:"child",feet:"foot",teeth:"tooth",mice:"mouse",men:"man",women:"woman"}[e.toLowerCase()];if(i)return i;if(e.match(Co)){let t=e.match(Ao);if(t){let o=t[1],a=t[2];if(!o||!a)return pn(e);let r=pn(a);if(r!==a)return o+r}}return pn(e)}function pn(e){return e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("es")&&e.length>3?e.slice(0,-2):e.endsWith("s")&&e.length>1?e.slice(0,-1):e}function un(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,i){let t=[],o=new Set,a=new Set(["console","document","window","Math","Object","Array","String","Number","Boolean","undefined","null"]);Ne(e,r=>{if(r.type===F.AST_NODE_TYPES.Identifier&&!n.includes(r.name)&&!a.has(r.name)&&!bo.test(r.name)){let c=r.parent;if(c.type===F.AST_NODE_TYPES.Property&&c.key===r||c.type===F.AST_NODE_TYPES.MemberExpression&&c.property===r&&!c.computed||c.type===F.AST_NODE_TYPES.JSXOpeningElement||c.type===F.AST_NODE_TYPES.JSXClosingElement||c.type===F.AST_NODE_TYPES.JSXAttribute&&c.name.type===F.AST_NODE_TYPES.JSXIdentifier&&c.name.name===r.name)return!1;o.add(r.name)}return!1},i);for(let r of o)n.includes(r)||t.push({name:r,type:"unknown"});return t}function wr(e,n,i,t,o){let r=[...i.map(g=>g.type===F.AST_NODE_TYPES.Identifier?g.name:"item").map((g,s)=>({name:g,type:s===0?`${e}Type`:s===1?"number":"unknown"})),...t],c=r.map(g=>{let s=g.type;return g.name.includes("on")&&s==="any"&&(s="unknown"),` ${g.name}: ${s};`}).join(`
|
|
23
|
+
`),l=r.map(g=>g.name).join(", "),p=o.getText(n),d=`${e}Props`;return`type ${d} = {
|
|
24
|
+
${c}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const ${e}: FC<${
|
|
27
|
+
const ${e}: FC<${d}> = ({ ${l} }) => {
|
|
28
28
|
return (
|
|
29
|
-
${
|
|
29
|
+
${p}
|
|
30
30
|
);
|
|
31
|
-
};`}function
|
|
31
|
+
};`}function Fo(e,n,i,t){let o=n.map(r=>r.type===F.AST_NODE_TYPES.Identifier?r.name:"item"),a=[t?`key={${t}}`:`key={${o[0]}.id}`,...o.map(r=>`${r}={${r}}`),...i.map(r=>`${r.name}={${r.name}}`)].filter(Boolean);return`<${e} ${a.join(" ")} />`}function ko(e){if(e.type===F.AST_NODE_TYPES.JSXElement&&e.openingElement.name.type===F.AST_NODE_TYPES.JSXIdentifier){let n=e.openingElement.name.name;if(n!=="div"&&n!=="span")return un(n)}return"ListItem"}function Po(e,n,i){let t=[i?`key={${i}}`:"",...n.map(o=>`${o.name}={${o.name}}`)].filter(Boolean);return`<${e}${t.length>0?` ${t.join(" ")}`:""} />`}function vr(e,n){for(let i of e.openingElement.attributes)if(i.type===F.AST_NODE_TYPES.JSXAttribute&&i.name.type===F.AST_NODE_TYPES.JSXIdentifier&&i.name.name==="key"&&i.value&&i.value.type===F.AST_NODE_TYPES.JSXExpressionContainer&&i.value.expression.type!==F.AST_NODE_TYPES.JSXEmptyExpression)return n.getText(i.value.expression);return null}var fn=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:i}=e;if(n.runOnlyWithEnableCompilerDirective){let t=!1;for(let o of i.getAllComments())if(Eo.test(o.value)){t=!0;break}if(!t)return{}}return{CallExpression(t){t.callee.type===F.AST_NODE_TYPES.MemberExpression&&t.callee.property.type===F.AST_NODE_TYPES.Identifier&&(t.callee.property.name==="map"||t.callee.property.name==="push")&&(t.callee.property.name==="map"?Oo(t,i,e):No(t,i,e))}}}});function Oo(e,n,i){let t=e.arguments[0];if(!t||t.type!==F.AST_NODE_TYPES.ArrowFunctionExpression&&t.type!==F.AST_NODE_TYPES.FunctionExpression||!Ro(t))return;let o=null;if(t.body.type===F.AST_NODE_TYPES.JSXElement||t.body.type===F.AST_NODE_TYPES.JSXFragment?o=t.body:t.body.type===F.AST_NODE_TYPES.BlockStatement&&t.body.body[0]?.type===F.AST_NODE_TYPES.ReturnStatement&&t.body.body[0].argument&&(t.body.body[0].argument.type===F.AST_NODE_TYPES.JSXElement||t.body.body[0].argument.type===F.AST_NODE_TYPES.JSXFragment)&&(o=t.body.body[0].argument),!o)return;let a=Ir(o,n);if(!a.hasUnstable)return;let r=wo(e,t.params),c=t.params.map(g=>g.type===F.AST_NODE_TYPES.Identifier?g.name:"item"),l=Rr(o,c,n),p=o.type===F.AST_NODE_TYPES.JSXElement?vr(o,n):null,d=a.problematicProps.length===1?`prop "${a.problematicProps[0]}"`:`props "${a.problematicProps.join('", "')}"`;i.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:d},suggest:[{messageId:"extractComponent",data:{componentName:r},fix:g=>{let s=wr(r,o,t.params,l,n),u=Fo(r,t.params,l,p),y=e;for(;y.parent.type!==F.AST_NODE_TYPES.Program&&!(y.type===F.AST_NODE_TYPES.FunctionDeclaration||y.type===F.AST_NODE_TYPES.VariableDeclarator&&y.init&&(y.init.type===F.AST_NODE_TYPES.ArrowFunctionExpression||y.init.type===F.AST_NODE_TYPES.FunctionExpression));)y=y.parent;let h=[];return h.push(g.insertTextAfter(y,`
|
|
32
32
|
|
|
33
|
-
${s}`)),
|
|
33
|
+
${s}`)),h.push(g.replaceText(o,u)),h}}]})}function No(e,n,i){let t=e.arguments[0];if(!t||t.type!==F.AST_NODE_TYPES.JSXElement&&t.type!==F.AST_NODE_TYPES.JSXFragment)return;let o=t,a=Ir(o,n);if(!a.hasUnstable)return;let r=ko(o),c=Rr(o,[],n),l=o.type===F.AST_NODE_TYPES.JSXElement?vr(o,n):null,p=a.problematicProps.length===1?`prop "${a.problematicProps[0]}"`:`props "${a.problematicProps.join('", "')}"`;i.report({node:o,messageId:"unstableValueInMap",data:{problematicProps:p},suggest:[{messageId:"extractComponent",data:{componentName:r},fix:d=>{let g=wr(r,o,[],c,n),s=Po(r,c,l),u=e;for(;u.parent.type!==F.AST_NODE_TYPES.Program&&!(u.type===F.AST_NODE_TYPES.FunctionDeclaration||u.type===F.AST_NODE_TYPES.VariableDeclarator&&u.init&&(u.init.type===F.AST_NODE_TYPES.ArrowFunctionExpression||u.init.type===F.AST_NODE_TYPES.FunctionExpression));)u=u.parent;let y=[];return y.push(d.insertTextAfter(u,`
|
|
34
34
|
|
|
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,
|
|
37
|
-
`)}function
|
|
35
|
+
${g}`)),y.push(d.replaceText(o,s)),y}}]})}var yt=require("@typescript-eslint/utils"),Do=yt.ESLintUtils.RuleCreator(e=>`https://github.com/lucasols/extended-lint#${e}`),Fr="require-description",Lo=/^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u,jo=/^eslint-disable-(next-)?line$/u,Mo=Do({name:Fr,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 i=e.sourceCode,t=new Set(n.ignore||[]);return{Program(){for(let o of i.getAllComments()){let a=$o(o);a!=null&&(t.has(a.kind)||a.description||e.report({loc:Wo(o.loc),messageId:"missingDescription"}))}}}}}),kr={name:Fr,rule:Mo};function $o(e){let{text:n,description:i}=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===yt.TSESTree.AST_TOKEN_TYPES.Line&&!a||a&&e.loc.start.line!==e.loc.end.line)return null;let r=n.slice(t.index+o.length);return{kind:o,value:r.trim(),description:i}}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"),Ae=require("zod/v4");var zo=Ae.z.object({varsToCheck:Ae.z.array(Ae.z.object({selector:Ae.z.string().optional(),fromFnCall:Ae.z.string().optional(),prop:Ae.z.string().or(Ae.z.array(Ae.z.string())),errorMsg:Ae.z.string().optional()}))}),mn=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 i=new Map;function t(r,c,l,p){let d=new Set;for(let s of r.properties)s.type===J.AST_NODE_TYPES.Property&&s.key.type===J.AST_NODE_TYPES.Identifier&&d.add(s.key.name);let g=c.filter(s=>!d.has(s));if(g.length>0)if(g.length===1)e.report({node:r,messageId:"propNotRead",data:{prop:g[0],fnName:p,customMsg:l||""}});else{let s=g.map(u=>`"${u}"`).join(", ");e.report({node:r,messageId:"propsNotRead",data:{props:s,fnName:p,customMsg:l||""}})}}function o(r){if(r.init?.type===J.AST_NODE_TYPES.CallExpression){if(r.init.callee.type===J.AST_NODE_TYPES.Identifier)return r.init.callee.name;if(r.init.callee.type===J.AST_NODE_TYPES.MemberExpression&&r.init.callee.property.type===J.AST_NODE_TYPES.Identifier)return r.init.callee.object.type===J.AST_NODE_TYPES.Identifier?`${r.init.callee.object.name}.${r.init.callee.property.name}`:r.init.callee.property.name}return"unknown function"}let a={};for(let r of n.varsToCheck)r.selector&&(a[r.selector]=c=>{if(c.type===J.AST_NODE_TYPES.VariableDeclarator&&c.id.type===J.AST_NODE_TYPES.Identifier&&i.set(c.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:c.id,fnName:o(c)}),c.type===J.AST_NODE_TYPES.VariableDeclarator&&c.id.type===J.AST_NODE_TYPES.ObjectPattern){let l=Array.isArray(r.prop)?r.prop:[r.prop];t(c.id,l,r.errorMsg,o(c))}});for(let r of n.varsToCheck)if(r.fromFnCall){let c=r.fromFnCall;if(c.startsWith("*.")){let p=`VariableDeclarator > CallExpression > MemberExpression[property.name="${c.slice(2)}"]`;a[p]=d=>{if(d.type!==J.AST_NODE_TYPES.MemberExpression||d.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let g=d.parent;if(g.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let s=g.parent;if(s.id.type===J.AST_NODE_TYPES.Identifier)i.set(s.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:s.id,fnName:r.fromFnCall||"unknown function"});else if(s.id.type===J.AST_NODE_TYPES.ObjectPattern){let u=Array.isArray(r.prop)?r.prop:[r.prop];t(s.id,u,r.errorMsg,r.fromFnCall||"unknown function")}}}else if(c.includes(".")){let[l,p]=c.split("."),d=`VariableDeclarator > CallExpression > MemberExpression[object.name="${l}"][property.name="${p}"]`;a[d]=g=>{if(g.type!==J.AST_NODE_TYPES.MemberExpression||g.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let s=g.parent;if(s.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let u=s.parent;if(u.id.type===J.AST_NODE_TYPES.Identifier)i.set(u.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:u.id,fnName:r.fromFnCall||"unknown function"});else if(u.id.type===J.AST_NODE_TYPES.ObjectPattern){let y=Array.isArray(r.prop)?r.prop:[r.prop];t(u.id,y,r.errorMsg,r.fromFnCall||"unknown function")}}}else{let l=`VariableDeclarator > CallExpression > Identifier[name="${c}"]`;a[l]=p=>{if(p.type!==J.AST_NODE_TYPES.Identifier||p.parent.type!==J.AST_NODE_TYPES.CallExpression)return;let d=p.parent;if(d.parent.type!==J.AST_NODE_TYPES.VariableDeclarator)return;let g=d.parent;if(g.id.type===J.AST_NODE_TYPES.Identifier)i.set(g.id.name,{props:Array.isArray(r.prop)?r.prop:[r.prop],errorMsg:r.errorMsg,node:g.id,fnName:r.fromFnCall||"unknown function"});else if(g.id.type===J.AST_NODE_TYPES.ObjectPattern){let s=Array.isArray(r.prop)?r.prop:[r.prop];t(g.id,s,r.errorMsg,r.fromFnCall||"unknown function")}}}}return{...a,"Program:exit"(){for(let[r,{props:c,errorMsg:l,node:p,fnName:d}]of i){let s=e.sourceCode.getScope(p).set.get(r);if(s){let u=new Set(c);for(let y of s.references){let h=y.identifier,T=h.parent;if(!(T.type===J.AST_NODE_TYPES.VariableDeclarator&&T.id===h)){if(T.type===J.AST_NODE_TYPES.MemberExpression&&T.object===h&&T.property.type===J.AST_NODE_TYPES.Identifier&&u.has(T.property.name)){if(u.delete(T.property.name),u.size===0)break;continue}if(T.type===J.AST_NODE_TYPES.VariableDeclarator&&T.init===h&&T.id.type===J.AST_NODE_TYPES.ObjectPattern){for(let f of T.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(!(T.type===J.AST_NODE_TYPES.MemberExpression&&T.object===h&&T.property.type===J.AST_NODE_TYPES.Identifier&&!c.includes(T.property.name))){u.clear();break}}}if(u.size>0){let y=Array.from(u);if(y.length===1)e.report({node:p,messageId:"propNotRead",data:{prop:y[0],fnName:d,customMsg:l||""}});else{let h=y.map(T=>`"${T}"`).join(", ");e.report({node:p,messageId:"propsNotRead",data:{props:h,fnName:d,customMsg:l||""}})}}}}}}}});function Nr(e){return/^use[A-Z0-9]/.test(e)}function dt(e){return e.type==="Identifier"?Nr(e.name):e.type==="MemberExpression"&&!e.computed&&dt(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 yn(e){for(;e;){let n=_r(e);if(n&&(Dr(n)||dt(n))||jr(e)||Mr(e))return!0;e=e.parent}return!1}function Pr(e){return!1}function dn(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(p){let d=null;p.callee.name==="useMemo"?d="useMemo":p.callee.name==="useCallback"&&(d="useCallback"),d&&e.report({node:p,message:`"${d}" is not necessary when using React Compiler.`})}}}let n=typeof e.getSource=="function"?l=>n(l):l=>e.sourceCode.getText(l),i=typeof e.getScope=="function"?()=>i():l=>e.sourceCode.getScope(l),t=null,o=[],a=[],r=new WeakSet;function c(l){for(let p of l.references){let d=p.identifier.parent;if(d.type==="VariableDeclarator"&&d.init&&d.init.type==="CallExpression"&&d.init.callee&&Pr(d.init.callee))for(let g of p.resolved.references)g!==p&&r.add(g.identifier)}}return{onCodePathSegmentStart:l=>a.push(l),onCodePathSegmentEnd:()=>a.pop(),onCodePathStart:()=>o.push(new Map),onCodePathEnd(l,p){let d=o.pop();if(d.size===0)return;let g=new Set;function s(m,b){let{cache:S}=s,A=S.get(m.id),w=new Set(b);if(w.has(m.id)){let R=[...w],L=R.slice(R.indexOf(m.id)+1);for(let U of L)g.add(U);return BigInt("0")}if(w.add(m.id),A!==void 0)return A;if(l.thrownSegments.includes(m))A=BigInt("0");else if(m.prevSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let R of m.prevSegments)A+=s(R,w)}return m.reachable&&A===BigInt("0")?S.delete(m.id):S.set(m.id,A),A}function u(m,b){let{cache:S}=u,A=S.get(m.id),w=new Set(b);if(w.has(m.id)){let R=Array.from(w),L=R.slice(R.indexOf(m.id)+1);for(let U of L)g.add(U);return BigInt("0")}if(w.add(m.id),A!==void 0)return A;if(l.thrownSegments.includes(m))A=BigInt("0");else if(m.nextSegments.length===0)A=BigInt("1");else{A=BigInt("0");for(let R of m.nextSegments)A+=u(R,w)}return S.set(m.id,A),A}function y(m){let{cache:b}=y,S=b.get(m.id);if(S===null)return 1/0;if(S!==void 0)return S;if(b.set(m.id,null),m.prevSegments.length===0)S=1;else{S=1/0;for(let A of m.prevSegments){let w=y(A);w<S&&(S=w)}S+=1}return b.set(m.id,S),S}s.cache=new Map,u.cache=new Map,y.cache=new Map;let h=u(l.initialSegment),T=_r(p),f=yn(p),E=T?Dr(T)||dt(T):jr(p)||Mr(p),x=1/0;for(let m of l.finalSegments){if(!m.reachable)continue;let b=y(m);b<x&&(x=b)}for(let[m,b]of d){if(!m.reachable)continue;let S=m.nextSegments.length===0?x<=y(m):x<y(m),A=s(m)*u(m),w=g.has(m.id);for(let R of b)if(w&&!dn(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.`}),E){if(p.async&&e.report({node:R,message:`React Hook "${n(R)}" cannot be called in an async function.`}),!w&&A!==h&&!dn(R)){let U=`React Hook "${n(R)}" is called conditionally. React Hooks must be called in the exact same order in every component render.`+(S?" Did you accidentally call a React Hook after an early return?":"");e.report({node:R,message:U})}}else if(p.parent&&(p.parent.type==="MethodDefinition"||p.parent.type==="ClassProperty")&&p.parent.value===p){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(T){let L=`React Hook "${n(R)}" is called in function "${n(T)}" 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(p.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&&!dn(R)){if(p.parent.type==="CallExpression"&&p.parent.callee.type==="Identifier"&&p.parent.callee.name==="useCallback"){let U=p.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(dt(l.callee)){let p=Or(o),d=Or(a),g=p.get(d);g||(g=[],p.set(d,g)),g.push(l.callee)}l.callee.type==="Identifier"&&(l.callee.name==="useEffect"||Pr(l.callee))&&l.arguments.length>0&&(t=l)},Identifier(l){t==null&&r.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){yn(l)&&c(i(l))},ArrowFunctionExpression(l){yn(l)&&c(i(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 ie=require("@typescript-eslint/utils"),ce=Te(require("zod/v4"));var Vo=/^\s+$/,gn=/\r?\n/,Xo=/^(\s*)/,Ho=/^(\s*)\S/,Bo=/\r?\n/,Yo=ce.object({indent:ce.union([ce.string().regex(Vo),ce.number().int().min(1)]).optional(),tags:ce.array(ce.string()).optional(),functions:ce.array(ce.string()).optional(),comments:ce.array(ce.string()).optional()}),Sn=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:i=["HTML","indent"],functions:t=["dedent","stripIndent"],tags:o=["outdent","dedent","gql","sql","html","styled"],indent:a}=e.options[0],r=i.map(f=>f.toLowerCase());function c(f){let E=f.split(gn),x=E.filter(b=>b.trim()!=="");if(x.length===0)return f;let m=Number.POSITIVE_INFINITY;for(let b of x){let S=b.match(Xo);S&&(m=Math.min(m,S[1]?.length??0))}return!isFinite(m)||m===0?f:E.map(b=>b.slice(m)).join(`
|
|
36
|
+
`)}function l(f,E,x){return f.split(gn).map(b=>b.trim()===""?b:x.repeat(E)+b).join(`
|
|
37
|
+
`)}function p(f){if(f.type===ie.AST_NODE_TYPES.Identifier)return f.name;if(f.type===ie.AST_NODE_TYPES.MemberExpression){let E=f.object.type===ie.AST_NODE_TYPES.Identifier?f.object.name:null,x=f.property.type===ie.AST_NODE_TYPES.Identifier?f.property.name:null;return E&&x?`${E}.${x}`:x}return null}function d(f,E){if(!f)return!1;for(let x of E)if(x.includes(".")){let m=x.split(".");if(f.type===ie.AST_NODE_TYPES.MemberExpression&&f.object.type===ie.AST_NODE_TYPES.Identifier&&f.property.type===ie.AST_NODE_TYPES.Identifier&&f.object.name===m[0]&&f.property.name===m[1])return!0}else if(f.type===ie.AST_NODE_TYPES.Identifier&&f.name===x)return!0;return!1}function g(f,E){let x=f.parent;if(x.type!==ie.AST_NODE_TYPES.TaggedTemplateExpression)return!1;let m=p(x.tag);return m?E.includes(m):!1}function s(f,E){if(!f||f.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let{method:x,argumentsLength:m,optionalCall:b=!0,optionalMember:S=!0}=E;return m!==void 0&&f.arguments.length!==m||!b&&f.optional||f.callee.type!==ie.AST_NODE_TYPES.MemberExpression||!S&&f.callee.optional||f.callee.property.type!==ie.AST_NODE_TYPES.Identifier?!1:f.callee.property.name===x}function u(f,E){if(!f||f.type!==ie.AST_NODE_TYPES.CallExpression)return!1;let{name:x,argumentsLength:m,optionalCall:b=!0}=E;return m!==void 0&&f.arguments.length!==m||!b&&f.optional||f.callee.type!==ie.AST_NODE_TYPES.Identifier?!1:f.callee.name===x}function y(f){return s(f.parent,{method:"toMatchInlineSnapshot",argumentsLength:1,optionalCall:!1,optionalMember:!1})&&f.parent.type===ie.AST_NODE_TYPES.CallExpression&&f.parent.arguments[0]===f&&u(f.parent.callee.type===ie.AST_NODE_TYPES.MemberExpression?f.parent.callee.object:null,{name:"expect",argumentsLength:1,optionalCall:!1,optionalMember:!1})}function h(f){if(r.length>0){let E=n.getTokenBefore(f,{includeComments:!0});if(E?.type===ie.AST_TOKEN_TYPES.Block&&r.includes(E.value.trim().toLowerCase()))return!0}return!!(y(f)||o.length>0&&g(f,o)||t.length>0&&f.parent.type===ie.AST_NODE_TYPES.CallExpression&&f.parent.arguments.includes(f)&&d(f.parent.callee,t))}function T(f){let E=`__PLACEHOLDER__${Math.random()}`,x=f.quasis.map(Z=>n.getText(Z).slice(1,Z.tail?-1:-2)).join(E),m=x.match(Bo);if(!m)return;let b=m[0],S=n.lines[n.getLocFromIndex(f.range[0]).line-1];if(!S)return;let w=S.match(Ho)?.[1]??"",R;typeof a=="string"?R=a:typeof a=="number"?R=" ".repeat(a):R=w.startsWith(" ")?" ":" ";let U=c(x).replace(new RegExp(`^${b}|${b}[ ]*$`,"g"),""),ne=b+l(U,1,w+R)+b+w,Q=x.includes(`\r
|
|
38
38
|
`)?`\r
|
|
39
39
|
`:`
|
|
40
|
-
`,
|
|
40
|
+
`,se=x.split(gn),oe=se.map((Z,Ee)=>Ee!==se.length-1&&Z===R+w?"":Z).join(Q);if(ne!==oe)return{node:f,messageId:"improperlyIndented",fix:Z=>ne.split(E).map((Ee,Ue)=>{let le=f.quasis[Ue];return le?Z.replaceTextRange([le.range[0]+1,le.range[1]-(le.tail?1:2)],Ee):[]}).flat()}}return{TemplateLiteral(f){if(!h(f))return;let E=T(f);if(E)return e.report(E)}}}});var Tn=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===Tn.AST_NODE_TYPES.NewExpression&&n.callee.type===Tn.AST_NODE_TYPES.Identifier&&n.callee.name==="RegExp"}var hn=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(i){qo(i)||Zo(i)||e.report({node:i,messageId:"regexShouldBeTopLevel"})}return{"FunctionDeclaration Literal[regex], FunctionExpression Literal[regex], ArrowFunctionExpression Literal[regex], MethodDefinition Literal[regex]":n}}});var ue=require("@typescript-eslint/utils"),Xe=require("zod/v4");var Go=Xe.z.object({checkOnly:Xe.z.array(Xe.z.enum(["function-args","FC","generic-args-at-fn-calls"])).optional(),checkTypesFromSelectors:Xe.z.array(Xe.z.string()).optional()}),En=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 i=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 r(s){let u=s.parent;for(;u;){if(u.type===ue.AST_NODE_TYPES.FunctionDeclaration||u.type===ue.AST_NODE_TYPES.FunctionExpression||u.type===ue.AST_NODE_TYPES.ArrowFunctionExpression){let y=u.params;for(let h of y)if(s.range[0]>=h.range[0]&&s.range[1]<=h.range[1])return!0;break}u=u.parent}return!1}function c(s){let u=s.parent;for(;u;){if(u.type===ue.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=u.parent;if(y.type===ue.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ue.AST_NODE_TYPES.Identifier&&(y.typeName.name==="FC"||y.typeName.name==="React.FC")||y.type===ue.AST_NODE_TYPES.TSTypeReference&&y.typeName.type===ue.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===ue.AST_NODE_TYPES.TSTypeParameterInstantiation){let y=u.parent;if(y.type===ue.AST_NODE_TYPES.CallExpression||y.type===ue.AST_NODE_TYPES.NewExpression)return!0}u=u.parent}return!1}let p=[];function d(s){let u=[],y=new Map;for(let{typeName:T,firstUsage:f}of s){let E=y.get(f)||[];E.push(T),y.set(f,E)}for(let{typeName:T,firstUsage:f,firstUsagePosition:E,firstUsageInFunctionArgs:x}of s){let m=t.get(T);if(!m||m.statement===f)continue;let b=o.indexOf(m.statement),S=o.indexOf(f);if(b===-1||S===-1)continue;let A=!!(n.checkOnly&&n.checkOnly.includes("function-args")&&x),R=(y.get(f)||[]).length>1;(A||R?b>S:b>S||b!==S-1)&&u.push({typeName:T,typeDef:m,targetStatement:f,firstUsagePosition:E})}if(u.length===0)return;u.sort((T,f)=>{let E=T.firstUsagePosition-f.firstUsagePosition;if(E!==0)return E;let x=o.indexOf(T.typeDef.statement),m=o.indexOf(f.typeDef.statement);return x-m});let h=u[0];h&&e.report({node:h.typeDef.node,messageId:"moveTypeAboveUsage",fix:g(u)})}function g(s){return function*(u){let y=new Map;for(let h of s){let T=y.get(h.targetStatement)||[];T.push(h),y.set(h.targetStatement,T)}for(let[,h]of y)h.sort((T,f)=>{let E=T.firstUsagePosition-f.firstUsagePosition;if(E!==0)return E;let x=o.indexOf(T.typeDef.statement),m=o.indexOf(f.typeDef.statement);return x-m});for(let h of s){let{typeDef:T}=h,f=T.statement,E=i.getCommentsBefore(f),x=f.range[0],m=f.range[1];E.length>0&&E[0]&&(x=E[0].range[0]),yield u.removeRange([x,m])}for(let[h,T]of y){let f=i.getCommentsBefore(h),E=f.length>0&&f[0]?f[0].range[0]:h.range[0],x=[];for(let m of T){let b=m.typeDef.statement,S=i.getText(b),A=i.getCommentsBefore(b),w=S;A.length>0&&(w=`${A.map(L=>i.getText(L)).join(`
|
|
41
41
|
`)}
|
|
42
|
-
${
|
|
42
|
+
${S}`),x.push(w)}yield u.insertTextBeforeRange([E,E],`${x.join(`
|
|
43
43
|
|
|
44
44
|
`)}
|
|
45
45
|
|
|
46
|
-
`)}}}return{Program(s){o.push(...s.body)},TSTypeAliasDeclaration(s){if(o.some(y=>y.type===
|
|
46
|
+
`)}}}return{Program(s){o.push(...s.body)},TSTypeAliasDeclaration(s){if(o.some(y=>y.type===ue.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===ue.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===ue.AST_NODE_TYPES.Identifier){let u=r(s),y=c(s),h=l(s);p.push({typeName:s.typeName.name,node:s,inFunctionArgs:u,inFCProps:y,inGenericArgAtFunctionCall:h,usagePosition:s.range[0]})}},"Program:exit"(){let s=new Map,u=p.filter(h=>{if(!n.checkOnly||n.checkOnly.length===0)return!0;for(let T of n.checkOnly)if(T==="function-args"&&h.inFunctionArgs||T==="FC"&&h.inFCProps||T==="generic-args-at-fn-calls"&&h.inGenericArgAtFunctionCall)return!0;return!1});for(let h of u){let{typeName:T,node:f}=h;if(t.has(T)){let E=a(f),x=t.get(T);if(E&&x&&E!==x.statement){s.has(T)||s.set(T,[]);let m=s.get(T);if(!m)return;m.includes(E)||m.push(E)}}}let y=[];for(let[h,T]of s)if(T.length>0){let f=T[0];if(!f)continue;let E=Number.MAX_SAFE_INTEGER,x=!1;for(let m of T)m.range[0]<f.range[0]&&(f=m);for(let m of u)m.typeName===h&&a(m.node)===f&&m.usagePosition<E&&(E=m.usagePosition,x=m.inFunctionArgs);y.push({typeName:h,firstUsage:f,firstUsagePosition:E,firstUsageInFunctionArgs:x})}y.length>0&&d(y)}}}});var X=require("@typescript-eslint/utils"),He=Te(require("zod/v4"));var Ko=["tsx"],Qo=/^[A-Z][A-Za-z0-9]*$/,ea=He.object({extensions:He.array(He.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, if you want to export multiple components, use a separate file for each component. Type-only exports are allowed."},schema:[j(ea)]},defaultOptions:[{}],create(e,[n]){let i=e.getFilename(),t=n.extensions??Ko,o=!1;for(let m of t)if(i.endsWith(m)){o=!0;break}if(!o)return{};let a=e.sourceCode,r=new Set,c=new Map;function l(m){return Qo.test(m)}function p(m){if(m.type!==X.AST_NODE_TYPES.CallExpression)return!1;let b=m.callee;return b.type===X.AST_NODE_TYPES.Identifier?b.name==="memo"||b.name==="forwardRef":b.type===X.AST_NODE_TYPES.MemberExpression&&b.property.type===X.AST_NODE_TYPES.Identifier?b.property.name==="memo"||b.property.name==="forwardRef":!1}function d(m){if(m.type===X.AST_NODE_TYPES.JSXElement||m.type===X.AST_NODE_TYPES.JSXFragment)return!0;if(m.type===X.AST_NODE_TYPES.ArrayExpression){for(let b of m.elements)if(b&&(b.type===X.AST_NODE_TYPES.JSXElement||b.type===X.AST_NODE_TYPES.JSXFragment))return!0}return!1}function g(m){if(m.type!==X.AST_NODE_TYPES.ArrowFunctionExpression)return!1;let b=m.body;if(b.type===X.AST_NODE_TYPES.ArrowFunctionExpression){let S=b.body;if(d(S))return!0}return!1}function s(m){if(m.id.type!==X.AST_NODE_TYPES.Identifier)return;let b=m.id.name,S=m.init;if(S){if(l(b)&&(S.type===X.AST_NODE_TYPES.ArrowFunctionExpression||S.type===X.AST_NODE_TYPES.FunctionExpression||p(S))){r.add(b);return}S.type===X.AST_NODE_TYPES.Identifier&&c.set(b,S.name),l(b)||g(S)&&r.add(b)}}function u(m){if(m.type===X.AST_NODE_TYPES.VariableDeclaration){for(let b of m.declarations)s(b);return}if(m.type===X.AST_NODE_TYPES.FunctionDeclaration&&m.id){l(m.id.name)&&r.add(m.id.name);return}if(m.type===X.AST_NODE_TYPES.ExportNamedDeclaration&&m.declaration){let b=m.declaration;if(b.type===X.AST_NODE_TYPES.VariableDeclaration){for(let S of b.declarations)s(S);return}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration&&b.id){l(b.id.name)&&r.add(b.id.name);return}}}for(let m of a.ast.body)u(m);function y(m,b=new Set){if(r.has(m))return!0;if(b.has(m))return!1;b.add(m);let S=c.get(m);return S?y(S,b):!1}let h=[];function T(m,b,S){h.push({node:m,isType:b,isComponent:S})}for(let m of a.ast.body){if(m.type===X.AST_NODE_TYPES.ExportNamedDeclaration){let b=m.exportKind==="type";if(m.declaration){let S=m.declaration;if(S.type===X.AST_NODE_TYPES.TSTypeAliasDeclaration||S.type===X.AST_NODE_TYPES.TSInterfaceDeclaration){T(S,!0,!1);continue}if(S.type===X.AST_NODE_TYPES.VariableDeclaration){for(let A of S.declarations){if(A.id.type!==X.AST_NODE_TYPES.Identifier)continue;let w=A.id.name,R=y(w);T(A,b,R)}continue}if(S.type===X.AST_NODE_TYPES.FunctionDeclaration){let A=S.id?.name,w=A?y(A)||l(A):!1;T(S,b,w);continue}T(S,b,!1);continue}if(m.specifiers.length>0)for(let S of m.specifiers){if(S.local.type!==X.AST_NODE_TYPES.Identifier)continue;let A=S.local.name,w=y(A);T(S,b,w)}continue}if(m.type===X.AST_NODE_TYPES.ExportDefaultDeclaration){let b=m.declaration;if(b.type===X.AST_NODE_TYPES.Identifier){let S=y(b.name)||l(b.name);T(m,!1,S);continue}if(b.type===X.AST_NODE_TYPES.FunctionDeclaration||b.type===X.AST_NODE_TYPES.ArrowFunctionExpression||b.type===X.AST_NODE_TYPES.FunctionExpression||b.type===X.AST_NODE_TYPES.CallExpression){T(m,!1,!0);continue}T(m,!1,!1);continue}}let f=!1;for(let m of h)if(!m.isType&&m.isComponent){f=!0;break}if(!f)return{};let E=[];for(let m of h)m.isType||E.push(m);let x=-1;for(let[m,b]of E.entries())if(b.isComponent){x=m;break}if(x===-1)return{};for(let[m,b]of E.entries())if(m!==x){e.report({node:b.node,messageId:"multipleExports"});break}return{}}});var Ur={[Zt.name]:Zt.rule,[kt.name]:kt.rule,[Ft.name]:Ft.rule,"rules-of-hooks":$r,"exhaustive-deps":Nn,"require-description":kr.rule,[Pt.name]:Pt.rule,[Nt.name]:Nt.rule,[Kt.name]:Kt.rule,[Tt.name]:Tt.rule,[vt.name]:vt.rule,[Lt.name]:Lt.rule,[qe.name]:qe.rule,[tn.name]:tn.rule,[Dt.name]:Dt.rule,[Ot.name]:Ot.rule,[Mt.name]:Mt.rule,[Et.name]:Et.rule,[ln.name]:ln.rule,[an.name]:an.rule,[fn.name]:fn.rule,[wt.name]:wt.rule,[Wt.name]:Wt.rule,[zt.name]:zt.rule,[Jt.name]:Jt.rule,[Bt.name]:Bt.rule,[Yt.name]:Yt.rule,[Vt.name]:Vt.rule,[Ht.name]:Ht.rule,[en.name]:en.rule,[_t.name]:_t.rule,[$t.name]:$t.rule,[hn.name]:hn.rule,[Gt.name]:Gt.rule,[mn.name]:mn.rule,[Sn.name]:Sn.rule,[En.name]:En.rule,[bn.name]:bn.rule,[qe.name]:qe.rule};var ta={rules:Ur};0&&(module.exports={extendedLintPlugin});
|